From 2db9507bf8fc68aaf50de745b3606ac5efc135bd Mon Sep 17 00:00:00 2001 From: Marvin Alexander Krebber Date: Sun, 25 Aug 2024 10:56:50 +0200 Subject: [PATCH] Amazon close Fullscreen on original close buttons --- chrome/manifest.json | 2 +- chrome/popup/popup.html | 2 +- chrome/popup/settings.html | 10 ++++-- chrome/skipper.js | 62 +++++++++++++++++++++---------------- firefox/manifest.json | 2 +- firefox/popup/popup.html | 2 +- firefox/popup/settings.html | 10 ++++-- firefox/skipper.js | 62 +++++++++++++++++++++---------------- package.json | 2 +- 9 files changed, 93 insertions(+), 61 deletions(-) diff --git a/chrome/manifest.json b/chrome/manifest.json index f172299e..b7503930 100644 --- a/chrome/manifest.json +++ b/chrome/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 3, "name": "__MSG_extensionName__", "description": "__MSG_extensionDescription__", - "version": "1.1.33", + "version": "1.1.34", "homepage_url": "https://github.com/Dreamlinerm/Netflix-Prime-Auto-Skip", "icons": { diff --git a/chrome/popup/popup.html b/chrome/popup/popup.html index 88b594ca..87650d92 100644 --- a/chrome/popup/popup.html +++ b/chrome/popup/popup.html @@ -32,7 +32,7 @@

pageTitle

-

v.1.1.33

+

v.1.1.34

pageTitle

-

v.1.1.33

+

v.1.1.34

ImportSettings

Changelog

-

1.1.33

+

1.1.34

+
    +
  • Amazon close Fullscreen on original close buttons
  • +
+
+
+

1.1.33

  • Separated the Speedslider from the subtitle setting on user request.
  • Fixed Amazon double click to Fullscreen.
  • diff --git a/chrome/skipper.js b/chrome/skipper.js index 3f5f74b2..cbb4a6f6 100644 --- a/chrome/skipper.js +++ b/chrome/skipper.js @@ -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.33"; +const version = "1.1.34"; if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO) { /* eslint-env root:true */ // global variables in localStorage @@ -131,6 +131,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO } function startAmazon(Amazon) { AmazonSkipIntroObserver.observe(document, AmazonSkipIntroConfig); + if (settings?.Video?.doubleClick) Amazon_doubleClick(); AmazonObserver.observe(document, config); if (Amazon?.skipAd) Amazon_AdTimeout(); if (Amazon?.blockFreevee) { @@ -177,7 +178,6 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO else if (isCrunchyroll) startCrunchyroll(settings.Crunchyroll); else if (isHBO) HBOObserver.observe(document, config); if (settings?.Video?.playOnFullScreen) startPlayOnFullScreen(); - if (settings?.Video?.doubleClick) startdoubleClick(); getDBCache(); }); chrome.storage.local.onChanged.addListener(function (changes) { @@ -194,7 +194,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO else if (isHBO) HBOSettingsChanged(oldValue?.HBO, newValue?.HBO); if (!oldValue || newValue.Video.playOnFullScreen !== oldValue?.Video?.playOnFullScreen) startPlayOnFullScreen(); - if (!oldValue || newValue.Video.doubleClick !== oldValue?.Video?.doubleClick) startdoubleClick(); + if (!oldValue || newValue.Video.doubleClick !== oldValue?.Video?.doubleClick) Amazon_doubleClick(); if (oldValue?.Video?.userAgent != undefined && newValue.Video.userAgent !== oldValue?.Video?.userAgent) location.reload(); } }); @@ -467,29 +467,6 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO removeEventListener("fullscreenchange", OnFullScreenChange); } } - async function startdoubleClick() { - if (settings.Video?.doubleClick) { - // event listener for double click - document.ondblclick = function () { - let video; - let webPlayer; - if (isPrimeVideo) { - video = document.querySelector(AmazonVideoClass); - webPlayer = document.querySelector(".dv-player-fullscreen"); - } - if (webPlayer && video?.checkVisibility()) { - // video is fullscreen - if (document.fullscreenElement) { - document.exitFullscreen(); - } else { - webPlayer.requestFullscreen(); - } - } - }; - } else { - document.ondblclick = null; - } - } // Disney Observers const DisneyObserver = new MutationObserver(Disney); @@ -854,6 +831,7 @@ 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"); @@ -1116,6 +1094,38 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO async function Amazon_xray() { document.querySelector(".xrayQuickViewList")?.remove(); } + + async function Amazon_doubleClick() { + 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(); + } + } + }; + } 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(); + } + }; + } // Crunchyroll functions function filterQueued(display) { document.querySelectorAll("div.queue-flag:not(.queued)").forEach((element) => { diff --git a/firefox/manifest.json b/firefox/manifest.json index b44ec0a3..c944e35f 100644 --- a/firefox/manifest.json +++ b/firefox/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "__MSG_extensionName__", "description": "__MSG_extensionDescription__", - "version": "1.1.33", + "version": "1.1.34", "homepage_url": "https://github.com/Dreamlinerm/Netflix-Prime-Auto-Skip", "icons": { "16": "icons/NetflixAmazon Auto-Skip.svg", diff --git a/firefox/popup/popup.html b/firefox/popup/popup.html index 04573d0a..fc2f04bf 100644 --- a/firefox/popup/popup.html +++ b/firefox/popup/popup.html @@ -32,7 +32,7 @@

    pageTitle

    -

    v.1.1.33

    +

    v.1.1.34

pageTitle

-

v.1.1.33

+

v.1.1.34

ImportSettings

Changelog

-

1.1.33

+

1.1.34

+
    +
  • Amazon close Fullscreen on original close buttons
  • +
+
+
+

1.1.33

  • Separated the Speedslider from the subtitle setting on user request.
  • Fixed Amazon double click to Fullscreen.
  • diff --git a/firefox/skipper.js b/firefox/skipper.js index 93a37869..77a4499c 100644 --- a/firefox/skipper.js +++ b/firefox/skipper.js @@ -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.33"; +const version = "1.1.34"; if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO) { /* eslint-env root:true */ // global variables in localStorage @@ -131,6 +131,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO } function startAmazon(Amazon) { AmazonSkipIntroObserver.observe(document, AmazonSkipIntroConfig); + if (settings?.Video?.doubleClick) Amazon_doubleClick(); AmazonObserver.observe(document, config); if (Amazon?.skipAd) Amazon_AdTimeout(); if (Amazon?.blockFreevee) { @@ -177,7 +178,6 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO else if (isCrunchyroll) startCrunchyroll(settings.Crunchyroll); else if (isHBO) HBOObserver.observe(document, config); if (settings?.Video?.playOnFullScreen) startPlayOnFullScreen(); - if (settings?.Video?.doubleClick) startdoubleClick(); getDBCache(); }); browser.storage.local.onChanged.addListener(function (changes) { @@ -194,7 +194,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO else if (isHBO) HBOSettingsChanged(oldValue?.HBO, newValue?.HBO); if (!oldValue || newValue.Video.playOnFullScreen !== oldValue?.Video?.playOnFullScreen) startPlayOnFullScreen(); - if (!oldValue || newValue.Video.doubleClick !== oldValue?.Video?.doubleClick) startdoubleClick(); + if (!oldValue || newValue.Video.doubleClick !== oldValue?.Video?.doubleClick) Amazon_doubleClick(); if (oldValue?.Video?.userAgent != undefined && newValue.Video.userAgent !== oldValue?.Video?.userAgent) location.reload(); } }); @@ -467,29 +467,6 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO removeEventListener("fullscreenchange", OnFullScreenChange); } } - async function startdoubleClick() { - if (settings.Video?.doubleClick) { - // event listener for double click - document.ondblclick = function () { - let video; - let webPlayer; - if (isPrimeVideo) { - video = document.querySelector(AmazonVideoClass); - webPlayer = document.querySelector(".dv-player-fullscreen"); - } - if (webPlayer && video?.checkVisibility()) { - // video is fullscreen - if (document.fullscreenElement) { - document.exitFullscreen(); - } else { - webPlayer.requestFullscreen(); - } - } - }; - } else { - document.ondblclick = null; - } - } // Disney Observers const DisneyObserver = new MutationObserver(Disney); @@ -854,6 +831,7 @@ 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"); @@ -1116,6 +1094,38 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO async function Amazon_xray() { document.querySelector(".xrayQuickViewList")?.remove(); } + + async function Amazon_doubleClick() { + 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(); + } + } + }; + } 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(); + } + }; + } // Crunchyroll functions function filterQueued(display) { document.querySelectorAll("div.queue-flag:not(.queued)").forEach((element) => { diff --git a/package.json b/package.json index 6afa84b8..84916ca2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "streaming-enhanced", - "version": "1.1.33", + "version": "1.1.34", "description": "Automatically skip Ads, Intros, Credits and add Speed Control, etc. on Netflix, Prime video, Disney+ & Hotstar and Crunchyroll.", "scripts": { "start": "web-ext run",