Skip to content

Commit

Permalink
shorter code
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamlinerm committed Oct 30, 2023
1 parent 53a2647 commit 2f54311
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 53 deletions.
10 changes: 5 additions & 5 deletions chrome/popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -283,23 +283,23 @@ <h2 id="openStatistics" style="margin-left: 10px" i18n>StatisticPageTitle</h2>
<h2 i18n>SkippedTime</h2>
<div class="line flex flex-between">
<p i18n>StatisticAd;Amazon</p>
<p id="AmazonAdTime">0s</p>
<p id="StatisticsAmazonAdTimeSkipped">0s</p>
</div>
<div class="line flex flex-between">
<p i18n>StatisticAd;Netflix</p>
<p id="NetflixAdTime">0s</p>
<p id="StatisticsNetflixAdTimeSkipped">0s</p>
</div>
<div class="line flex flex-between">
<p i18n>StatisticIntro</p>
<p id="IntroTimeSkipped">0s</p>
<p id="StatisticsIntroTimeSkipped">0s</p>
</div>
<div class="line flex flex-between">
<p i18n>StatisticRecap</p>
<p id="RecapTimeSkipped">0s</p>
<p id="StatisticsRecapTimeSkipped">0s</p>
</div>
<div class="line flex flex-between" style="padding-left: 0">
<p i18n>StatisticSegments</p>
<p id="SegmentsSkipped">0</p>
<p id="StatisticsSegmentsSkipped">0</p>
</div>
</div>
<div class="flex flex-row">
Expand Down
10 changes: 5 additions & 5 deletions chrome/popup/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -608,31 +608,31 @@ <h2 i18n>PageSpecificTitle;Disney+</h2>
<h2 i18n>SkippedTime</h2>
<div class="line flex flex-between">
<p i18n>StatisticAd;Amazon</p>
<p id="AmazonAdTime">0s</p>
<p id="StatisticsAmazonAdTimeSkipped">0s</p>
</div>
<p class="description" i18n>AmazonAdDescription</p>
<hr />
<div class="line flex flex-between">
<p i18n>StatisticAd;Netflix</p>
<p id="NetflixAdTime">0s</p>
<p id="StatisticsNetflixAdTimeSkipped">0s</p>
</div>
<p class="description" i18n>NetflixAdDescription</p>
<hr />
<div class="line flex flex-between">
<p i18n>StatisticIntro</p>
<p id="IntroTimeSkipped">0s</p>
<p id="StatisticsIntroTimeSkipped">0s</p>
</div>
<p class="description" i18n>StatisticIntroDescription</p>
<hr />
<div class="line flex flex-between">
<p i18n>StatisticRecap</p>
<p id="RecapTimeSkipped">0s</p>
<p id="StatisticsRecapTimeSkipped">0s</p>
</div>
<p class="description" i18n>StatisticRecapDescription</p>
<hr />
<div class="line flex flex-between" style="padding-left: 0">
<p i18n>StatisticSegments</p>
<p id="SegmentsSkipped">0</p>
<p id="StatisticsSegmentsSkipped">0</p>
</div>
<p class="description" i18n>StatisticSegmentsDescription</p>
</div>
Expand Down
24 changes: 2 additions & 22 deletions chrome/popup/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ function setCheckboxesToSettings() {
setCheckboxesOfService("Amazon");
// ------------- Netflix ---------------------------------------
setCheckboxesOfService("Netflix");
button = document.querySelector("#NetflixAds");
if (button) button.checked = settings?.Netflix.NetflixAds;

button = document.querySelector("#profileName");
if (button) button.textContent = settings?.General.profileName;
Expand All @@ -185,17 +183,9 @@ function setCheckboxesToSettings() {
button.style.display = "block";
}
// ------------- Disney ---------------------------------------
setCheckboxesOfService("Disney");
button = document.querySelector("#DisneySkipIntro");
if (button) button.checked = settings?.Disney.skipIntro;
button = document.querySelector("#DisneySkipCredits");
if (button) button.checked = settings?.Disney.skipCredits;
button = document.querySelector("#DisneyWatchCredits");
if (button) button.checked = settings?.Disney.watchCredits;
button = document.querySelector("#DisneySpeedSlider");
if (button) button.checked = settings?.Disney.speedSlider;
button = document.querySelector("#DisneyShowRating");
if (button) button.checked = settings?.Disney.showRating;

// ------------- Slider Options ---------------------------------------
button = document.querySelector("#SliderSteps");
if (button) button.value = settings?.General.sliderSteps;
Expand All @@ -213,17 +203,7 @@ function setCheckboxesToSettings() {
if (button) button.textContent = sliderValue / 10 + "x";

// Statistics
button = document.querySelector("#AmazonAdTime");
if (button) button.textContent = getTimeFormatted(settings?.Statistics.AmazonAdTimeSkipped);
button = document.querySelector("#NetflixAdTime");
if (button) button.textContent = getTimeFormatted(settings?.Statistics.NetflixAdTimeSkipped);
button = document.querySelector("#IntroTimeSkipped");
if (button) button.textContent = getTimeFormatted(settings?.Statistics.IntroTimeSkipped);
button = document.querySelector("#RecapTimeSkipped");
if (button) button.textContent = getTimeFormatted(settings?.Statistics.RecapTimeSkipped);
button = document.querySelector("#SegmentsSkipped");
if (button) button.textContent = settings?.Statistics.SegmentsSkipped;

setCheckboxesOfService("Statistics");
// import/export buttons
button = document.querySelector("#save");
if (button) {
Expand Down
10 changes: 5 additions & 5 deletions firefox/popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -278,23 +278,23 @@ <h2 id="openStatistics" style="margin-left: 10px" i18n>StatisticPageTitle</h2>
<h2 i18n>SkippedTime</h2>
<div class="line flex flex-between">
<p i18n>StatisticAd;Amazon</p>
<p id="AmazonAdTime">0s</p>
<p id="StatisticsAmazonAdTimeSkipped">0s</p>
</div>
<div class="line flex flex-between">
<p i18n>StatisticAd;Netflix</p>
<p id="NetflixAdTime">0s</p>
<p id="StatisticsNetflixAdTimeSkipped">0s</p>
</div>
<div class="line flex flex-between">
<p i18n>StatisticIntro</p>
<p id="IntroTimeSkipped">0s</p>
<p id="StatisticsIntroTimeSkipped">0s</p>
</div>
<div class="line flex flex-between">
<p i18n>StatisticRecap</p>
<p id="RecapTimeSkipped">0s</p>
<p id="StatisticsRecapTimeSkipped">0s</p>
</div>
<div class="line flex flex-between" style="padding-left: 0">
<p i18n>StatisticSegments</p>
<p id="SegmentsSkipped">0</p>
<p id="StatisticsSegmentsSkipped">0</p>
</div>
</div>
<div class="flex flex-row">
Expand Down
10 changes: 5 additions & 5 deletions firefox/popup/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -603,31 +603,31 @@ <h2 i18n>PageSpecificTitle;Disney+</h2>
<h2 i18n>SkippedTime</h2>
<div class="line flex flex-between">
<p i18n>StatisticAd;Amazon</p>
<p id="AmazonAdTime">0s</p>
<p id="StatisticsAmazonAdTimeSkipped">0s</p>
</div>
<p class="description" i18n>AmazonAdDescription</p>
<hr />
<div class="line flex flex-between">
<p i18n>StatisticAd;Netflix</p>
<p id="NetflixAdTime">0s</p>
<p id="StatisticsNetflixAdTimeSkipped">0s</p>
</div>
<p class="description" i18n>NetflixAdDescription</p>
<hr />
<div class="line flex flex-between">
<p i18n>StatisticIntro</p>
<p id="IntroTimeSkipped">0s</p>
<p id="StatisticsIntroTimeSkipped">0s</p>
</div>
<p class="description" i18n>StatisticIntroDescription</p>
<hr />
<div class="line flex flex-between">
<p i18n>StatisticRecap</p>
<p id="RecapTimeSkipped">0s</p>
<p id="StatisticsRecapTimeSkipped">0s</p>
</div>
<p class="description" i18n>StatisticRecapDescription</p>
<hr />
<div class="line flex flex-between" style="padding-left: 0">
<p i18n>StatisticSegments</p>
<p id="SegmentsSkipped">0</p>
<p id="StatisticsSegmentsSkipped">0</p>
</div>
<p class="description" i18n>StatisticSegmentsDescription</p>
</div>
Expand Down
12 changes: 1 addition & 11 deletions firefox/popup/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,7 @@ function setCheckboxesToSettings() {
if (button) button.textContent = sliderValue / 10 + "x";

// Statistics
button = document.querySelector("#AmazonAdTime");
if (button) button.textContent = getTimeFormatted(settings?.Statistics.AmazonAdTimeSkipped);
button = document.querySelector("#NetflixAdTime");
if (button) button.textContent = getTimeFormatted(settings?.Statistics.NetflixAdTimeSkipped);
button = document.querySelector("#IntroTimeSkipped");
if (button) button.textContent = getTimeFormatted(settings?.Statistics.IntroTimeSkipped);
button = document.querySelector("#RecapTimeSkipped");
if (button) button.textContent = getTimeFormatted(settings?.Statistics.RecapTimeSkipped);
button = document.querySelector("#SegmentsSkipped");
if (button) button.textContent = settings?.Statistics.SegmentsSkipped;

setCheckboxesOfService("Statistics");
// import/export buttons
button = document.querySelector("#save");
if (button) {
Expand Down

0 comments on commit 2f54311

Please sign in to comment.