Skip to content

Commit

Permalink
1.1.36
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamlinerm committed Aug 31, 2024
1 parent e577651 commit 3e0cb24
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 67 deletions.
2 changes: 1 addition & 1 deletion chrome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__",
"version": "1.1.35",
"version": "1.1.36",

"homepage_url": "https://github.com/Dreamlinerm/Netflix-Prime-Auto-Skip",
"icons": {
Expand Down
2 changes: 1 addition & 1 deletion chrome/popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<img class="Logo" src="../icons/NetflixAmazon Auto-Skip.svg" alt="Logo">
<div class="flex-center flex-col">
<h2 class="title" data-i18n>pageTitle</h2>
<p style="color: grey; font-size: 1em">v.1.1.35</p>
<p style="color: grey; font-size: 1em">v.1.1.36</p>
</div>
</div>
<a target="_blank" class="flex-center flex-col" style="text-align: center; text-decoration: none"
Expand Down
11 changes: 9 additions & 2 deletions chrome/popup/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<img class="Logo" src="../icons/NetflixAmazon Auto-Skip.svg" alt="Logo">
<div class="flex-center flex-col">
<h2 class="title" data-i18n>pageTitle</h2>
<p style="font-size: 1em">v.1.1.35</p>
<p style="font-size: 1em">v.1.1.36</p>
</div>
</div>
<a target="_blank" class="flex-center flex-col" style="text-align: center; text-decoration: none"
Expand Down Expand Up @@ -742,7 +742,14 @@ <h2 data-i18n>ImportSettings</h2>
<h2>Changelog</h2>
<div>
<div class="line flex">
<h2>1.1.35</h2>
<h2>1.1.36</h2>
<ul>
<li>Added double Click to hotstar</li>
<li>Disney fix: Watch Credits</li>
</ul>
</div>
<div class="line flex">
<p>1.1.36</p>
<p>Added Translations for:</p>
<ul>
<li>French</li>
Expand Down
121 changes: 65 additions & 56 deletions chrome/skipper.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const isMobile = /mobile|streamingEnhanced/i.test(ua);
const isEdge = /edg/i.test(ua);
// const isFirefox = /firefox/i.test(ua);
// const isChrome = /chrome/i.test(ua);
const version = "1.1.35";
const version = "1.1.36";
if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO) {
/* eslint-env root:true */
// global variables in localStorage
Expand Down Expand Up @@ -174,8 +174,10 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
logStartOfAddon();
if (isNetflix) startNetflix(settings.Netflix);
else if (isPrimeVideo) startAmazon(settings.Amazon);
else if (isDisney || isHotstar) DisneyObserver.observe(document, config);
else if (isCrunchyroll) startCrunchyroll(settings.Crunchyroll);
else if (isDisney || isHotstar) {
if (isHotstar) Hotstar_doubleClick();
DisneyObserver.observe(document, config);
} else if (isCrunchyroll) startCrunchyroll(settings.Crunchyroll);
else if (isHBO) HBOObserver.observe(document, config);
if (settings?.Video?.playOnFullScreen) startPlayOnFullScreen();
getDBCache();
Expand Down Expand Up @@ -283,7 +285,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
// ----------------------- functions ---------------------------------
// default Options for the observer (which mutations to observe)
const config = { attributes: true, childList: true, subtree: true };

// #region Shared funcs
// shared functions
async function startShowRatingInterval() {
addRating();
Expand Down Expand Up @@ -467,28 +469,34 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
removeEventListener("fullscreenchange", OnFullScreenChange);
}
}

// #endregion
// #region Disney
// Disney Observers
const DisneyObserver = new MutationObserver(Disney);
function Disney() {
let video = document.querySelector("video");
if (!video) video = document.querySelector("disney-web-player")?.shadowRoot?.firstChild?.firstChild;
const time = video?.currentTime;
if (settings.Disney?.skipIntro) Disney_Intro(video, time);
Disney_Credits(time);
Disney_addHomeButton();
Disney_skipCredits(time);
if (settings.Disney?.watchCredits) Disney_Watch_Credits();
if (settings.Disney?.speedSlider) Disney_SpeedSlider(video);
if (settings.Disney?.subtitle) Disney_Subtitles();
if (settings.Disney?.selfAd) Disney_selfAd(video, time);
if (isDisney) {
Disney_addHomeButton();
if (settings.Disney?.subtitle) Disney_Subtitles();
if (settings.Disney?.selfAd) Disney_selfAd(video, time);
}
}
// let SetTimeToZeroOnce = null;
function Disney_Intro(video, time) {
async function Disney_Intro(video, time) {
// intro star wars andor Season 1 episode 2
// Recap Criminal Minds Season 1 Episode 2
let button;
if (isDisney) {
if (!document.querySelector('[data-gv2elementkey="playNext"]')) button = document.querySelector(".skip__button");
const skipCreditsButton = isStarPlus
? document.querySelector('[data-gv2elementkey="playNext"]')
: document.querySelector('[data-testid="playback-action-button"]');
if (!skipCreditsButton) button = document.querySelector(".skip__button");
} else button = document.evaluate("//span[contains(., 'Skip Intro')]", document, null, XPathResult.ANY_TYPE, null)?.iterateNext()?.parentElement;
if (button) {
button.click();
Expand All @@ -506,7 +514,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
// }
// }
}
function Disney_Credits(currentTime) {
async function Disney_skipCredits(currentTime) {
let button;
if (isStarPlus) button = document.querySelector('[data-gv2elementkey="playNext"]');
else if (isDisney && !document.querySelector('[data-testid="playback-action-button"]'))
Expand All @@ -524,27 +532,30 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
increaseBadge();
resetLastATimeText();
}
setTimeout(function () {
if (videoFullscreen && document.fullscreenElement == null) {
chrome.runtime.sendMessage({ type: "fullscreen" });
function resetFullscreen() {
chrome.runtime.sendMessage({ type: "exitFullscreen" });
log("exitFullscreen");
removeEventListener("fullscreenchange", resetFullscreen);
}
addEventListener("fullscreenchange", resetFullscreen);
document.onkeydown = function (evt) {
if ("key" in evt && (evt.key === "Escape" || evt.key === "Esc")) {
if (!isHotstar) {
// keep video fullscreen
setTimeout(function () {
if (videoFullscreen && document.fullscreenElement == null) {
chrome.runtime.sendMessage({ type: "fullscreen" });
function resetFullscreen() {
chrome.runtime.sendMessage({ type: "exitFullscreen" });
log("exitFullscreen");
removeEventListener("fullscreenchange", resetFullscreen);
}
};
log("fullscreen");
}
}, 1000);
addEventListener("fullscreenchange", resetFullscreen);
document.onkeydown = function (evt) {
if ("key" in evt && (evt.key === "Escape" || evt.key === "Esc")) {
chrome.runtime.sendMessage({ type: "exitFullscreen" });
}
};
log("fullscreen");
}
}, 1000);
}
}
}
}
function Disney_addHomeButton() {
async function Disney_addHomeButton() {
// add home button to the end of the credits
const buttonDiv = document.querySelector('[data-testid="browser-action-button"]')?.parentElement;
if (buttonDiv && !document.querySelector("#homeButton")) {
Expand All @@ -566,7 +577,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
buttonDiv.appendChild(homeButton);
}
}
function Disney_Watch_Credits() {
async function Disney_Watch_Credits() {
let button;
if (isStarPlus) button = document.querySelector('[data-gv2elementkey="playNext"]');
else if (isDisney && !document.querySelector('[data-testid="playback-action-button"]'))
Expand All @@ -584,7 +595,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
if (video) {
video.click();
lastAdTimeText = time;
log("Credits skipped", button);
log("Credits Watched", button);
increaseBadge();
resetLastATimeText();
}
Expand Down Expand Up @@ -630,7 +641,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO

const DisneySliderStyle = "pointer-events: auto;background: rgb(221, 221, 221);display: none;width:200px;";
const DisneySpeedStyle = "height:10px;min-width:40px;color:#f9f9f9;pointer-events: auto;position: relative;bottom: 8px;padding: 0 5px;";
function Disney_SpeedSlider(video) {
async function Disney_SpeedSlider(video) {
if (video) {
let alreadySlider = document.querySelector("#videoSpeedSlider");
if (!alreadySlider) {
Expand Down Expand Up @@ -663,7 +674,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
});
}

function Disney_selfAd(video, time) {
async function Disney_selfAd(video, time) {
if (isDisney) {
let button = document.querySelector(".overlay_interstitials__promo_skip_button");
if (button) {
Expand All @@ -675,6 +686,20 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
}
}
}

async function Hotstar_doubleClick() {
if (settings.Video?.doubleClick) {
// event listener for double click
document.ondblclick = function () {
document.querySelector(".icon-player-landscape")?.closest("button")?.click();
document.querySelector(".icon-player-portrait")?.closest("button")?.click();
};
} else {
document.ondblclick = null;
}
}
// #endregion
// #region Netflix
// Netflix Observer
const NetflixObserver = new MutationObserver(Netflix);
function Netflix() {
Expand Down Expand Up @@ -818,7 +843,8 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
}
}
}

// #endregion
// #region Amazon
// Amazon Observers
const AmazonVideoClass = ".dv-player-fullscreen video";
const AmazonObserver = new MutationObserver(Amazon);
Expand All @@ -831,7 +857,6 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
if (settings.Amazon?.speedSlider) Amazon_SpeedSlider(video);
if (settings.Amazon?.subtitle) Amazon_Subtitles();
if (settings.Amazon?.xray) Amazon_xray();
if (settings?.Video?.doubleClick) Amazon_closeFullscreenButtons();
}
const AmazonSkipIntroConfig = { attributes: true, attributeFilter: [".skipelement"], subtree: true, childList: true, attributeOldValue: false };
// const AmazonSkipIntro = new RegExp("skipelement", "i");
Expand Down Expand Up @@ -1099,33 +1124,14 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
if (settings.Video?.doubleClick) {
// event listener for double click
document.ondblclick = function () {
let video = document.querySelector(AmazonVideoClass);
let webPlayer = document.querySelector(".dv-player-fullscreen");
if (webPlayer && video?.checkVisibility()) {
// video is fullscreen
if (document.fullscreenElement) {
document.exitFullscreen();
} else {
webPlayer.requestFullscreen();
}
}
document.querySelector(".dv-player-fullscreen button[class*=fullscreen-button]")?.click();
};
} else {
document.ondblclick = null;
}
}
async function Amazon_closeFullscreenButtons() {
document.querySelector(".dv-player-fullscreen button[class*=playerclose-button]").onclick = function () {
if (document.fullscreenElement) {
document.exitFullscreen();
}
};
document.querySelector(".dv-player-fullscreen button[class*=fullscreen-button]").onclick = function () {
if (document.fullscreenElement) {
document.exitFullscreen();
}
};
}
// #endregion
// #region Crunchyroll
// Crunchyroll functions
function filterQueued(display) {
document.querySelectorAll("div.queue-flag:not(.queued)").forEach((element) => {
Expand Down Expand Up @@ -1349,6 +1355,8 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
document.head.appendChild(style);
}
}
// #endregion
// #region HBO
// HBO functions
const HBOObserver = new MutationObserver(HBO);
async function HBO() {
Expand Down Expand Up @@ -1405,6 +1413,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
if (position) createSlider(video, position, HBOSliderStyle, HBOSpeedStyle, HBODivStyle);
}
}
// #endregion
// Badge functions
// eslint-disable-next-line no-unused-vars
async function setBadgeText(text) {
Expand Down
2 changes: 1 addition & 1 deletion firefox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__",
"version": "1.1.35",
"version": "1.1.36",
"homepage_url": "https://github.com/Dreamlinerm/Netflix-Prime-Auto-Skip",
"icons": {
"16": "icons/NetflixAmazon Auto-Skip.svg",
Expand Down
2 changes: 1 addition & 1 deletion firefox/popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<img class="Logo" src="../icons/NetflixAmazon Auto-Skip.svg" alt="Logo">
<div class="flex-center flex-col">
<h2 class="title" data-i18n>pageTitle</h2>
<p style="color: grey; font-size: 1em">v.1.1.35</p>
<p style="color: grey; font-size: 1em">v.1.1.36</p>
</div>
</div>
<a target="_blank" class="flex-center flex-col" style="text-align: center; text-decoration: none"
Expand Down
6 changes: 3 additions & 3 deletions firefox/popup/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<img class="Logo" src="../icons/NetflixAmazon Auto-Skip.svg" alt="Logo">
<div class="flex-center flex-col">
<h2 class="title" data-i18n>pageTitle</h2>
<p style="font-size: 1em">v.1.1.35</p>
<p style="font-size: 1em">v.1.1.36</p>
</div>
</div>
<a target="_blank" class="flex-center flex-col" style="text-align: center; text-decoration: none"
Expand Down Expand Up @@ -742,14 +742,14 @@ <h2 data-i18n>ImportSettings</h2>
<h2>Changelog</h2>
<div>
<div class="line flex">
<h2>1.1.35</h2>
<h2>1.1.36</h2>
<ul>
<li>Added double Click to hotstar</li>
<li>Disney fix: Watch Credits</li>
</ul>
</div>
<div class="line flex">
<p>1.1.35</p>
<p>1.1.36</p>
<p>Added Translations for:</p>
<ul>
<li>French</li>
Expand Down
2 changes: 1 addition & 1 deletion firefox/skipper.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const isMobile = /mobile|streamingEnhanced/i.test(ua);
const isEdge = /edg/i.test(ua);
// const isFirefox = /firefox/i.test(ua);
// const isChrome = /chrome/i.test(ua);
const version = "1.1.35";
const version = "1.1.36";
if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO) {
/* eslint-env root:true */
// global variables in localStorage
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "streaming-enhanced",
"version": "1.1.35",
"version": "1.1.36",
"description": "Automatically skip Ads, Intros, Credits and add Speed Control, etc. on Netflix, Prime video, Disney+ & Hotstar and Crunchyroll.",
"scripts": {
"start": "web-ext run",
Expand Down

0 comments on commit 3e0cb24

Please sign in to comment.