Skip to content

Commit

Permalink
Amazon close Fullscreen on original close buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamlinerm committed Aug 25, 2024
1 parent 441c19f commit 2db9507
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 61 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.33",
"version": "1.1.34",

"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.33</p>
<p style="color: grey; font-size: 1em">v.1.1.34</p>
</div>
</div>
<a target="_blank" class="flex-center flex-col" style="text-align: center; text-decoration: none"
Expand Down
10 changes: 8 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.33</p>
<p style="font-size: 1em">v.1.1.34</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,13 @@ <h2 data-i18n>ImportSettings</h2>
<h2>Changelog</h2>
<div>
<div class="line flex">
<h2>1.1.33</h2>
<h2>1.1.34</h2>
<ul>
<li>Amazon close Fullscreen on original close buttons</li>
</ul>
</div>
<div class="line flex">
<p>1.1.33</p>
<ul>
<li>Separated the Speedslider from the subtitle setting on user request.</li>
<li>Fixed Amazon double click to Fullscreen.</li>
Expand Down
62 changes: 36 additions & 26 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.33";
const version = "1.1.34";
if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO) {
/* eslint-env root:true */
// global variables in localStorage
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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();
}
});
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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) => {
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.33",
"version": "1.1.34",
"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.33</p>
<p style="color: grey; font-size: 1em">v.1.1.34</p>
</div>
</div>
<a target="_blank" class="flex-center flex-col" style="text-align: center; text-decoration: none"
Expand Down
10 changes: 8 additions & 2 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.33</p>
<p style="font-size: 1em">v.1.1.34</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,13 @@ <h2 data-i18n>ImportSettings</h2>
<h2>Changelog</h2>
<div>
<div class="line flex">
<h2>1.1.33</h2>
<h2>1.1.34</h2>
<ul>
<li>Amazon close Fullscreen on original close buttons</li>
</ul>
</div>
<div class="line flex">
<p>1.1.33</p>
<ul>
<li>Separated the Speedslider from the subtitle setting on user request.</li>
<li>Fixed Amazon double click to Fullscreen.</li>
Expand Down
62 changes: 36 additions & 26 deletions 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.33";
const version = "1.1.34";
if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO) {
/* eslint-env root:true */
// global variables in localStorage
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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();
}
});
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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) => {
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.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",
Expand Down

0 comments on commit 2db9507

Please sign in to comment.