From b9f373c58c9d7ad91accc662549701488f19cdd1 Mon Sep 17 00:00:00 2001 From: Marvin Alexander Krebber Date: Fri, 28 Jun 2024 22:37:30 +0200 Subject: [PATCH] fix --- chrome/_locales/de/messages.json | 2 +- chrome/_locales/en/messages.json | 2 +- chrome/_locales/mk/messages.json | 2 +- chrome/_locales/pt_BR/messages.json | 2 +- chrome/cr.js | 5 ++- chrome/manifest.json | 2 +- chrome/popup/popup.html | 2 +- chrome/popup/settings.html | 4 +-- chrome/popup/settings.js | 1 - chrome/skipper.js | 46 +++++++++++++++------------- firefox/_locales/de/messages.json | 2 +- firefox/_locales/en/messages.json | 2 +- firefox/_locales/mk/messages.json | 2 +- firefox/_locales/pt_BR/messages.json | 2 +- firefox/badge.js | 3 +- firefox/cr.js | 5 ++- firefox/manifest.json | 2 +- firefox/popup/popup.html | 2 +- firefox/popup/settings.html | 4 +-- firefox/popup/settings.js | 1 - firefox/skipper.js | 46 +++++++++++++++------------- package.json | 2 +- 22 files changed, 72 insertions(+), 69 deletions(-) diff --git a/chrome/_locales/de/messages.json b/chrome/_locales/de/messages.json index 85a36ac8..fe15d14a 100644 --- a/chrome/_locales/de/messages.json +++ b/chrome/_locales/de/messages.json @@ -156,7 +156,7 @@ "message": "Automatisch das letztes Profil auswählen:" }, "ProfileSwitchDescription": { - "message": "Das zuletzt verwendete Netflix-Profil wird direkt beim Start der Seite ausgewählt" + "message": "Das zuletzt verwendete Profil wird direkt beim Start der Seite ausgewählt" }, "User": { "message": "Benutzer:" diff --git a/chrome/_locales/en/messages.json b/chrome/_locales/en/messages.json index e01fa2a1..b4adfb2b 100644 --- a/chrome/_locales/en/messages.json +++ b/chrome/_locales/en/messages.json @@ -156,7 +156,7 @@ "message": "Auto pick last profile:" }, "ProfileSwitchDescription": { - "message": "The last used Netflix profile is directly chosen when the page is launched" + "message": "The last used profile is directly chosen when the page is launched" }, "User": { "message": "User:" diff --git a/chrome/_locales/mk/messages.json b/chrome/_locales/mk/messages.json index b73fc178..1da614a4 100644 --- a/chrome/_locales/mk/messages.json +++ b/chrome/_locales/mk/messages.json @@ -156,7 +156,7 @@ "message": "Автоматски избирање на последниот одберен профил на Netflix:" }, "ProfileSwitchDescription": { - "message": "Последниот користен профил на Netflix автоматски се избира кога ќе се одбере прв пат на Netflix" + "message": "Последниот користен профил на автоматски се избира кога ќе се одбере прв пат на" }, "User": { "message": "Профил:" diff --git a/chrome/_locales/pt_BR/messages.json b/chrome/_locales/pt_BR/messages.json index 2ff6a082..cae32b5d 100644 --- a/chrome/_locales/pt_BR/messages.json +++ b/chrome/_locales/pt_BR/messages.json @@ -156,7 +156,7 @@ "message": "Seleção automática do último perfil:" }, "ProfileSwitchDescription": { - "message": "O último perfil da Netflix usado é escolhido diretamente quando a página é iniciada" + "message": "O último perfil da usado é escolhido diretamente quando a página é iniciada" }, "User": { "message": "Usuário:" diff --git a/chrome/cr.js b/chrome/cr.js index fe4df446..8f9b3f78 100644 --- a/chrome/cr.js +++ b/chrome/cr.js @@ -54,8 +54,8 @@ const defaultSettings = { }, }, }; -let settings = defaultSettings.settings; -const version = "1.1.18"; +let settings = { ...defaultSettings.settings }; +const version = "1.1.19"; chrome.storage.sync.get("settings", function (result) { console.log( "%cNetflix%c/%cPrime%c Auto-Skip", @@ -66,7 +66,6 @@ chrome.storage.sync.get("settings", function (result) { ); console.log("version:", version); // overwrite default settings with user settings - settings = { ...defaultSettings.settings, ...result.settings }; // List of keys to merge individually Object.keys(defaultSettings.settings).forEach((key) => { if (result?.settings[key]) { diff --git a/chrome/manifest.json b/chrome/manifest.json index 54b9cc86..bd314de4 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.18", + "version": "1.1.19", "homepage_url": "https://github.com/Dreamlinerm/Netflix-Prime-Auto-Skip", "icons": { diff --git a/chrome/popup/popup.html b/chrome/popup/popup.html index 3cda0f46..fcf484fe 100644 --- a/chrome/popup/popup.html +++ b/chrome/popup/popup.html @@ -32,7 +32,7 @@

pageTitle

-

v.1.1.18

+

v.1.1.19

pageTitle

-

v.1.1.18

+

v.1.1.19

ImportSettings

Changelog

-

1.1.18

+

1.1.18-19

  • Profile Pick not working the same in deployed version
  • diff --git a/chrome/popup/settings.js b/chrome/popup/settings.js index 4d352883..bb40e1a5 100644 --- a/chrome/popup/settings.js +++ b/chrome/popup/settings.js @@ -109,7 +109,6 @@ console.log("isMobile", isMobile, navigator.userAgent); let settings = { ...defaultSettings.settings }; chrome.storage.sync.get("settings", function (result) { // overwrite default settings with user settings - settings = { ...defaultSettings.settings, ...result.settings }; // List of keys to merge individually Object.keys(defaultSettings.settings).forEach((key) => { if (result?.settings[key]) { diff --git a/chrome/skipper.js b/chrome/skipper.js index 1aabd5c5..1f42bd7b 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.18"; +const version = "1.1.19"; if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO) { /* eslint-env root:true */ // global variables in localStorage @@ -76,7 +76,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO }, }, }; - let settings = defaultSettings.settings; + let settings = { ...defaultSettings.settings }; let DBCache = {}; let lastAdTimeText = 0; let videoSpeed = 1; @@ -133,9 +133,21 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO if (Amazon?.continuePosition) setTimeout(() => Amazon_continuePosition(), 500); if (settings.Video?.userAgent && isMobile) Amazon_customizeMobileView(); } + function startCrunchyroll(Crunchyroll) { + if (Crunchyroll?.releaseCalendar) Crunchyroll_ReleaseCalendar(); + if (Crunchyroll?.profile) { + let pickInterval = setInterval(function () { + Crunchyroll_AutoPickProfile(); + }, 100); + // only click on profile on page load not when switching profiles + setTimeout(function () { + clearInterval(pickInterval); + }, 2000); + CrunchyrollObserver.observe(document, config); + } + } chrome.storage.sync.get("settings", function (result) { // overwrite default settings with user settings - settings = { ...defaultSettings.settings, ...result.settings }; // List of keys to merge individually Object.keys(defaultSettings.settings).forEach((key) => { if (result?.settings[key]) { @@ -148,11 +160,8 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO if (isNetflix) startNetflix(settings.Netflix); else if (isPrimeVideo) startAmazon(settings.Amazon); else if (isDisney || isHotstar) DisneyObserver.observe(document, config); - else if (isCrunchyroll) { - Crunchyroll_ReleaseCalendar(); - Crunchyroll_AutoPickProfile(); - CrunchyrollObserver.observe(document, config); - } else if (isHBO) HBOObserver.observe(document, config); + else if (isCrunchyroll) startCrunchyroll(settings.Crunchyroll); + else if (isHBO) HBOObserver.observe(document, config); if (settings?.Video?.playOnFullScreen) startPlayOnFullScreen(); }); chrome.storage.local.onChanged.addListener(function (changes) { @@ -1176,7 +1185,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO } } async function Crunchyroll_ReleaseCalendar() { - if (settings.Crunchyroll?.releaseCalendar && url.includes("simulcastcalendar")) { + if (url.includes("simulcastcalendar")) { // Show playlist only filterQueued(settings.General.filterQueued ? "none" : "block"); filterDub(settings.General.filterDub ? "none" : "block"); @@ -1199,18 +1208,13 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO } } async function Crunchyroll_AutoPickProfile() { - if (settings.Crunchyroll?.profile) { - window.addEventListener("load", function () { - log("Window Loaded"); - // click on profile picture - if (document.querySelector(".profile-item-name")) { - document.querySelectorAll(".erc-profile-item img")?.forEach((img) => { - if (img.src === settings.General.Crunchyroll_profilePicture) { - img.click(); - log("Profile automatically chosen:", img.src); - increaseBadge(); - } - }); + // click on profile picture + if (document.querySelector(".profile-item-name")) { + document.querySelectorAll(".erc-profile-item img")?.forEach((img) => { + if (img.src === settings.General.Crunchyroll_profilePicture) { + img.click(); + log("Profile automatically chosen:", img.src); + increaseBadge(); } }); } diff --git a/firefox/_locales/de/messages.json b/firefox/_locales/de/messages.json index 12f66f78..da18e34d 100644 --- a/firefox/_locales/de/messages.json +++ b/firefox/_locales/de/messages.json @@ -156,7 +156,7 @@ "message": "Automatisch das letztes Profil auswählen:" }, "ProfileSwitchDescription": { - "message": "Das zuletzt verwendete Netflix-Profil wird direkt beim Start der Seite ausgewählt" + "message": "Das zuletzt verwendete Profil wird direkt beim Start der Seite ausgewählt" }, "User": { "message": "Benutzer:" diff --git a/firefox/_locales/en/messages.json b/firefox/_locales/en/messages.json index ab2c1b1f..8b55693f 100644 --- a/firefox/_locales/en/messages.json +++ b/firefox/_locales/en/messages.json @@ -156,7 +156,7 @@ "message": "Auto pick last profile:" }, "ProfileSwitchDescription": { - "message": "The last used Netflix profile is directly chosen when the page is launched" + "message": "The last used profile is directly chosen when the page is launched" }, "User": { "message": "User:" diff --git a/firefox/_locales/mk/messages.json b/firefox/_locales/mk/messages.json index b73fc178..1da614a4 100644 --- a/firefox/_locales/mk/messages.json +++ b/firefox/_locales/mk/messages.json @@ -156,7 +156,7 @@ "message": "Автоматски избирање на последниот одберен профил на Netflix:" }, "ProfileSwitchDescription": { - "message": "Последниот користен профил на Netflix автоматски се избира кога ќе се одбере прв пат на Netflix" + "message": "Последниот користен профил на автоматски се избира кога ќе се одбере прв пат на" }, "User": { "message": "Профил:" diff --git a/firefox/_locales/pt_BR/messages.json b/firefox/_locales/pt_BR/messages.json index 2ff6a082..cae32b5d 100644 --- a/firefox/_locales/pt_BR/messages.json +++ b/firefox/_locales/pt_BR/messages.json @@ -156,7 +156,7 @@ "message": "Seleção automática do último perfil:" }, "ProfileSwitchDescription": { - "message": "O último perfil da Netflix usado é escolhido diretamente quando a página é iniciada" + "message": "O último perfil da usado é escolhido diretamente quando a página é iniciada" }, "User": { "message": "Usuário:" diff --git a/firefox/badge.js b/firefox/badge.js index 48812447..592ce1f3 100644 --- a/firefox/badge.js +++ b/firefox/badge.js @@ -120,10 +120,9 @@ if (isMobile) { }, }, }; - let settings = defaultSettings.settings; + let settings = { ...defaultSettings.settings }; browser.storage.sync.get("settings", function (result) { // overwrite default settings with user settings - settings = { ...defaultSettings.settings, ...result.settings }; // List of keys to merge individually Object.keys(defaultSettings.settings).forEach((key) => { if (result?.settings[key]) { diff --git a/firefox/cr.js b/firefox/cr.js index 17691af0..47a5fb5d 100644 --- a/firefox/cr.js +++ b/firefox/cr.js @@ -54,8 +54,8 @@ const defaultSettings = { }, }, }; -let settings = defaultSettings.settings; -const version = "1.1.18"; +let settings = { ...defaultSettings.settings }; +const version = "1.1.19"; browser.storage.sync.get("settings", function (result) { console.log( "%cNetflix%c/%cPrime%c Auto-Skip", @@ -66,7 +66,6 @@ browser.storage.sync.get("settings", function (result) { ); console.log("version:", version); // overwrite default settings with user settings - settings = { ...defaultSettings.settings, ...result.settings }; // List of keys to merge individually Object.keys(defaultSettings.settings).forEach((key) => { if (result?.settings[key]) { diff --git a/firefox/manifest.json b/firefox/manifest.json index e22ecfbe..dfde2924 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.18", + "version": "1.1.19", "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 a48d8318..4656e75a 100644 --- a/firefox/popup/popup.html +++ b/firefox/popup/popup.html @@ -32,7 +32,7 @@

    pageTitle

    -

    v.1.1.18

    +

    v.1.1.19

pageTitle

-

v.1.1.18

+

v.1.1.19

ImportSettings

Changelog

-

1.1.18

+

1.1.18-19

  • Profile Pick not working the same in deployed version
  • diff --git a/firefox/popup/settings.js b/firefox/popup/settings.js index a47bf9ea..2276f5fe 100644 --- a/firefox/popup/settings.js +++ b/firefox/popup/settings.js @@ -109,7 +109,6 @@ console.log("isMobile", isMobile, navigator.userAgent); let settings = { ...defaultSettings.settings }; browser.storage.sync.get("settings", function (result) { // overwrite default settings with user settings - settings = { ...defaultSettings.settings, ...result.settings }; // List of keys to merge individually Object.keys(defaultSettings.settings).forEach((key) => { if (result?.settings[key]) { diff --git a/firefox/skipper.js b/firefox/skipper.js index d71ac9e9..1eca534e 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.18"; +const version = "1.1.19"; if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO) { /* eslint-env root:true */ // global variables in localStorage @@ -76,7 +76,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO }, }, }; - let settings = defaultSettings.settings; + let settings = { ...defaultSettings.settings }; let DBCache = {}; let lastAdTimeText = 0; let videoSpeed = 1; @@ -133,9 +133,21 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO if (Amazon?.continuePosition) setTimeout(() => Amazon_continuePosition(), 500); if (settings.Video?.userAgent && isMobile) Amazon_customizeMobileView(); } + function startCrunchyroll(Crunchyroll) { + if (Crunchyroll?.releaseCalendar) Crunchyroll_ReleaseCalendar(); + if (Crunchyroll?.profile) { + let pickInterval = setInterval(function () { + Crunchyroll_AutoPickProfile(); + }, 100); + // only click on profile on page load not when switching profiles + setTimeout(function () { + clearInterval(pickInterval); + }, 2000); + CrunchyrollObserver.observe(document, config); + } + } browser.storage.sync.get("settings", function (result) { // overwrite default settings with user settings - settings = { ...defaultSettings.settings, ...result.settings }; // List of keys to merge individually Object.keys(defaultSettings.settings).forEach((key) => { if (result?.settings[key]) { @@ -148,11 +160,8 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO if (isNetflix) startNetflix(settings.Netflix); else if (isPrimeVideo) startAmazon(settings.Amazon); else if (isDisney || isHotstar) DisneyObserver.observe(document, config); - else if (isCrunchyroll) { - Crunchyroll_ReleaseCalendar(); - Crunchyroll_AutoPickProfile(); - CrunchyrollObserver.observe(document, config); - } else if (isHBO) HBOObserver.observe(document, config); + else if (isCrunchyroll) startCrunchyroll(settings.Crunchyroll); + else if (isHBO) HBOObserver.observe(document, config); if (settings?.Video?.playOnFullScreen) startPlayOnFullScreen(); }); browser.storage.local.onChanged.addListener(function (changes) { @@ -1176,7 +1185,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO } } async function Crunchyroll_ReleaseCalendar() { - if (settings.Crunchyroll?.releaseCalendar && url.includes("simulcastcalendar")) { + if (url.includes("simulcastcalendar")) { // Show playlist only filterQueued(settings.General.filterQueued ? "none" : "block"); filterDub(settings.General.filterDub ? "none" : "block"); @@ -1199,18 +1208,13 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO } } async function Crunchyroll_AutoPickProfile() { - if (settings.Crunchyroll?.profile) { - window.addEventListener("load", function () { - log("Window Loaded"); - // click on profile picture - if (document.querySelector(".profile-item-name")) { - document.querySelectorAll(".erc-profile-item img")?.forEach((img) => { - if (img.src === settings.General.Crunchyroll_profilePicture) { - img.click(); - log("Profile automatically chosen:", img.src); - increaseBadge(); - } - }); + // click on profile picture + if (document.querySelector(".profile-item-name")) { + document.querySelectorAll(".erc-profile-item img")?.forEach((img) => { + if (img.src === settings.General.Crunchyroll_profilePicture) { + img.click(); + log("Profile automatically chosen:", img.src); + increaseBadge(); } }); } diff --git a/package.json b/package.json index 2feafcbd..0aab9020 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "streaming-enhanced", - "version": "1.1.18", + "version": "1.1.19", "description": "Automatically skip Ads, Intros, Credits and add Speed Control, etc. on Netflix, Prime video, Disney+ & Hotstar and Crunchyroll.", "scripts": { "start": "web-ext run",