Skip to content

Commit

Permalink
fixed netflix ad skip too far
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamlinerm committed Oct 26, 2023
1 parent a5d4f6b commit 604017a
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 107 deletions.
208 changes: 107 additions & 101 deletions chrome/popup/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -415,42 +415,42 @@ <h2 i18n>PageSpecificTitle;Prime Video</h2>
<p class="description" i18n>StreamLinksDescription</p>

<!-- <h2 i18n>sharedSettings</h2>
<p class="description" i18n>sharedSettingsDescription;Prime Video</p>
<div class="line flex">
<p i18n>IntroSwitch</p>
<label class="switch">
<input type="checkbox" id="AmazonIntro" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>CreditsSwitch</p>
<label class="switch">
<input type="checkbox" id="AmazonCredits" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>WatchCreditsSwitch</p>
<label class="switch">
<input type="checkbox" id="AmazonWatchCredits" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>FreeveeSwitch</p>
<label class="switch">
<input type="checkbox" id="AmazonFreevee" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>SliderSwitch</p>
<label class="switch">
<input type="checkbox" id="AmazonSpeedSlider" />
<span class="slider round"></span>
</label>
</div> -->
<p class="description" i18n>sharedSettingsDescription;Prime Video</p>
<div class="line flex">
<p i18n>IntroSwitch</p>
<label class="switch">
<input type="checkbox" id="AmazonIntro" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>CreditsSwitch</p>
<label class="switch">
<input type="checkbox" id="AmazonCredits" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>WatchCreditsSwitch</p>
<label class="switch">
<input type="checkbox" id="AmazonWatchCredits" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>FreeveeSwitch</p>
<label class="switch">
<input type="checkbox" id="AmazonFreevee" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>SliderSwitch</p>
<label class="switch">
<input type="checkbox" id="AmazonSpeedSlider" />
<span class="slider round"></span>
</label>
</div> -->
</div>
<div class="categoryNetflix hidden" style="margin-top: 0; background-color: unset" id="NetflixSettings">
<div class="flex flex-between" style="padding: 5px 5px; color: #e60010">
Expand Down Expand Up @@ -504,42 +504,42 @@ <h2 i18n>PageSpecificTitle;Netflix</h2>
<img id="profilePicture" class="hidden" style="margin-left: auto; height: 40px; border-radius: 4px; margin-right: 8px" />
</div>
<!-- <h2 i18n>sharedSettings</h2>
<p class="description" i18n>sharedSettingsDescription;Netflix</p>
<div class="line flex">
<p i18n>IntroSwitch</p>
<label class="switch">
<input type="checkbox" id="NetflixIntro" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>CreditsSwitch</p>
<label class="switch">
<input type="checkbox" id="NetflixCredits" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>WatchCreditsSwitch</p>
<label class="switch">
<input type="checkbox" id="NetflixWatchCredits" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>AdsSwitch</p>
<label class="switch">
<input type="checkbox" id="NetflixAds" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>SliderSwitch</p>
<label class="switch">
<input type="checkbox" id="NetflixSpeedSlider" />
<span class="slider round"></span>
</label>
</div> -->
<p class="description" i18n>sharedSettingsDescription;Netflix</p>
<div class="line flex">
<p i18n>IntroSwitch</p>
<label class="switch">
<input type="checkbox" id="NetflixIntro" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>CreditsSwitch</p>
<label class="switch">
<input type="checkbox" id="NetflixCredits" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>WatchCreditsSwitch</p>
<label class="switch">
<input type="checkbox" id="NetflixWatchCredits" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>AdsSwitch</p>
<label class="switch">
<input type="checkbox" id="NetflixAds" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>SliderSwitch</p>
<label class="switch">
<input type="checkbox" id="NetflixSpeedSlider" />
<span class="slider round"></span>
</label>
</div> -->
</div>
<div class="categoryDisney hidden" style="margin-top: 0; background-color: unset" id="DisneySettings">
<div class="flex flex-between" style="padding: 5px 5px; color: #1d1fff">
Expand All @@ -553,35 +553,35 @@ <h2 i18n>PageSpecificTitle;Disney+</h2>
empty

<!-- <h2 i18n>sharedSettings</h2>
<p class="description" i18n>sharedSettingsDescription;Disney+</p>
<div class="line flex">
<p i18n>IntroSwitch</p>
<label class="switch">
<input type="checkbox" id="DisneyIntro" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>CreditsSwitch</p>
<label class="switch">
<input type="checkbox" id="DisneyCredits" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>WatchCreditsSwitch</p>
<label class="switch">
<input type="checkbox" id="DisneyWatchCredits" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>SliderSwitch</p>
<label class="switch">
<input type="checkbox" id="DisneySpeedSlider" />
<span class="slider round"></span>
</label>
</div> -->
<p class="description" i18n>sharedSettingsDescription;Disney+</p>
<div class="line flex">
<p i18n>IntroSwitch</p>
<label class="switch">
<input type="checkbox" id="DisneyIntro" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>CreditsSwitch</p>
<label class="switch">
<input type="checkbox" id="DisneyCredits" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>WatchCreditsSwitch</p>
<label class="switch">
<input type="checkbox" id="DisneyWatchCredits" />
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p i18n>SliderSwitch</p>
<label class="switch">
<input type="checkbox" id="DisneySpeedSlider" />
<span class="slider round"></span>
</label>
</div> -->
</div>
<div id="StatisticsSettings" class="hidden">
<h2 i18n>SkippedTime</h2>
Expand Down Expand Up @@ -631,6 +631,12 @@ <h2 i18n>ImportSettings</h2>
<div id="ChangelogSettings" class="hidden">
<h2>Changelog</h2>
<div>
<div class="line flex">
<h2>1.0.60</h2>
<ul>
<li>fixed Netflix ad skip: skips too far</li>
</ul>
</div>
<div class="line flex">
<h2>1.0.59</h2>
<ul>
Expand Down
9 changes: 6 additions & 3 deletions chrome/skipper.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,17 +590,20 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar) {
}
const video = document.querySelector("video");
const adLength = Number(document.querySelector(".ltr-mmvz9h")?.textContent);
// 16 max but too fast
if (video) {
let playBackRate = 16;
let playBackRate = 8;
if (isEdge) playBackRate = 3;
if (adLength && video.playbackRate != playBackRate) {
if (adLength > 8 && video.playbackRate != playBackRate) {
log("Ad skipped, length:", adLength, "s");
settings.Statistics.NetflixAdTimeSkipped += adLength;
increaseBadge();
video.playbackRate = playBackRate;
} else if (adLength > 2 && video.playbackRate < 2) {
video.playbackRate = adLength / 2;
} else if (adLength && video.paused) {
video.play();
} else if (video.playbackRate == playBackRate && !adLength) {
} else if (adLength <= 2 || !adLength) {
video.playbackRate = 1;
}
}
Expand Down
6 changes: 6 additions & 0 deletions firefox/popup/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,12 @@ <h2 i18n>ImportSettings</h2>
<div id="ChangelogSettings" class="hidden">
<h2>Changelog</h2>
<div>
<div class="line flex">
<h2>1.0.60</h2>
<ul>
<li>fixed Netflix ad skip: skips too far</li>
</ul>
</div>
<div class="line flex">
<h2>1.0.59</h2>
<ul>
Expand Down
9 changes: 6 additions & 3 deletions firefox/skipper.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,17 +594,20 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar) {
}
const video = document.querySelector("video");
const adLength = Number(document.querySelector(".ltr-mmvz9h")?.textContent);
// 16 max but too fast
if (video) {
let playBackRate = 16;
let playBackRate = 8;
if (isEdge) playBackRate = 3;
if (adLength && video.playbackRate != playBackRate) {
if (adLength > 8 && video.playbackRate != playBackRate) {
log("Ad skipped, length:", adLength, "s");
settings.Statistics.NetflixAdTimeSkipped += adLength;
increaseBadge();
video.playbackRate = playBackRate;
} else if (adLength > 2 && video.playbackRate < 2) {
video.playbackRate = adLength / 2;
} else if (adLength && video.paused) {
video.play();
} else if (video.playbackRate == playBackRate && !adLength) {
} else if (adLength <= 2 || !adLength) {
video.playbackRate = 1;
}
}
Expand Down

0 comments on commit 604017a

Please sign in to comment.