From 47b90b2c2ea3e8d95de81ca7acc1d4e35a82da98 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sun, 20 Jun 2021 20:45:41 -0400 Subject: Make info button hide automatically --- public/content.css | 16 ++++ public/icons/PlayerInfoIconSponsorBlocker.svg | 124 ++------------------------ public/popup.css | 2 +- src/content.ts | 20 ++++- 4 files changed, 40 insertions(+), 122 deletions(-) diff --git a/public/content.css b/public/content.css index bdafdc32..70b74766 100644 --- a/public/content.css +++ b/public/content.css @@ -75,6 +75,22 @@ vertical-align: top; } +#infoButton.playerButton:not(.hidden) { + transform: translateX(0%) scale(1); + /* opacity is from YouTube page */ + transition: transform 0.2s, opacity .1s cubic-bezier(0.4,0.0,1,1) !important; +} + +#infoButton.playerButton.hidden { + transform: translateX(100%) scale(0); + /* opacity is from YouTube page */ + transition: transform 0.2s, opacity .1s cubic-bezier(0.4,0.0,1,1) !important; +} + +.playerButton.hidden { + display: none; +} + .sponsorSkipObject { font-family: Roboto, Arial, Helvetica, sans-serif; diff --git a/public/icons/PlayerInfoIconSponsorBlocker.svg b/public/icons/PlayerInfoIconSponsorBlocker.svg index 297e82b1..1001c2b7 100644 --- a/public/icons/PlayerInfoIconSponsorBlocker.svg +++ b/public/icons/PlayerInfoIconSponsorBlocker.svg @@ -1,120 +1,6 @@ - - - - - - image/svg+xml - - LogoSponsorBlocker2 - - - - - - - - LogoSponsorBlocker2 - - - - - - - - - - - - - - - - - - - - + + + + + diff --git a/public/popup.css b/public/popup.css index 0fd1f839..1271e24b 100644 --- a/public/popup.css +++ b/public/popup.css @@ -6,7 +6,7 @@ --sb-green-bg: #077B27; } -.hidden { +.sponsorBlockPopupBody .hidden { display: none !important; } diff --git a/src/content.ts b/src/content.ts index 8ecddad1..d4dd3845 100644 --- a/src/content.ts +++ b/src/content.ts @@ -44,6 +44,7 @@ let video: HTMLVideoElement; let videoMutationObserver: MutationObserver = null; // List of videos that have had event listeners added to them const videosWithEventListeners: HTMLVideoElement[] = []; +const controlsWithEventListeners: HTMLElement[] = [] let onInvidious; let onMobileYouTube; @@ -72,7 +73,7 @@ let previewBar: PreviewBar = null; let controls: HTMLElement | null = null; /** Contains buttons created by `createButton()`. */ -const playerButtons: Record = {}; +const playerButtons: Record = {}; // Direct Links after the config is loaded utils.wait(() => Config.config !== null, 1000, 1).then(() => videoIDChange(getYouTubeVideoID(document.URL))); @@ -1080,6 +1081,7 @@ function createButton(baseID: string, title: string, callback: () => void, image playerButtons[baseID] = { button: newButton, image: newButtonImage, + setupListener: false }; return newButton; @@ -1115,9 +1117,23 @@ async function createButtons(): Promise { // Add button if does not already exist in html createButton("startSegment", "sponsorStart", () => closeInfoMenuAnd(() => startOrEndTimingNewSegment()), "PlayerStartIconSponsorBlocker.svg"); createButton("cancelSegment", "sponsorCancel", () => closeInfoMenuAnd(() => cancelCreatingSegment()), "PlayerCancelSegmentIconSponsorBlocker.svg"); - createButton("info", "openPopup", openInfoMenu, "PlayerInfoIconSponsorBlocker.svg"); createButton("delete", "clearTimes", () => closeInfoMenuAnd(() => clearSponsorTimes()), "PlayerDeleteIconSponsorBlocker.svg"); createButton("submit", "SubmitTimes", submitSponsorTimes, "PlayerUploadIconSponsorBlocker.svg"); + createButton("info", "openPopup", openInfoMenu, "PlayerInfoIconSponsorBlocker.svg"); + + const controlsContainer = getControls(); + if (!onInvidious && controlsContainer && playerButtons["info"]?.button && !controlsWithEventListeners.includes(controlsContainer)) { + controlsWithEventListeners.push(controlsContainer); + playerButtons["info"].button.classList.add("hidden"); + + controlsContainer.addEventListener("mouseenter", () => { + playerButtons["info"].button.classList.remove("hidden"); + }); + + controlsContainer.addEventListener("mouseleave", () => { + playerButtons["info"].button.classList.add("hidden"); + }); + } } /** Creates any missing buttons on the player and updates their visiblity. */ -- cgit v1.2.3 From 930911e2b90d3b74a0358345f9109172dc8ff06b Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sun, 20 Jun 2021 20:56:42 -0400 Subject: Add more parameters to make get_video_info api work again --- src/content.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content.ts b/src/content.ts index d4dd3845..d6c47c83 100644 --- a/src/content.ts +++ b/src/content.ts @@ -722,7 +722,7 @@ function startSkipScheduleCheckingForStartSponsors() { * Get the video info for the current tab from YouTube */ async function getVideoInfo(): Promise { - const result = await utils.asyncRequestToCustomServer("GET", "https://www.youtube.com/get_video_info?video_id=" + sponsorVideoID + "&html5=1"); + const result = await utils.asyncRequestToCustomServer("GET", "https://www.youtube.com/get_video_info?video_id=" + sponsorVideoID + "&html5=1&c=TVHTML5&cver=7.20190319"); if (result.ok) { const decodedData = decodeURIComponent(result.responseText).match(/player_response=([^&]*)/)[1]; -- cgit v1.2.3 From a118d80548f66a89810b6d4c4195d11150e281dd Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 22 Jun 2021 15:04:20 -0400 Subject: Hide invidious options on safari --- public/options/options.html | 2 +- src/options.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/options/options.html b/public/options/options.html index c7a3578b..586cdc6a 100644 --- a/public/options/options.html +++ b/public/options/options.html @@ -55,7 +55,7 @@

-
+
__MSG_addInvidiousInstance__
diff --git a/src/options.ts b/src/options.ts index 20a5d244..13a4bfee 100644 --- a/src/options.ts +++ b/src/options.ts @@ -31,7 +31,8 @@ async function init() { const optionsElements = optionsContainer.querySelectorAll("*"); for (let i = 0; i < optionsElements.length; i++) { - if (optionsElements[i].getAttribute("private-mode-only") === "true" && !(await isIncognitoAllowed())) { + if ((optionsElements[i].getAttribute("private-mode-only") === "true" && !(await isIncognitoAllowed())) + || (optionsElements[i].getAttribute("no-safari") === "true" && navigator.vendor !== "Apple Computer, Inc.")) { optionsElements[i].classList.add("hidden"); continue; } -- cgit v1.2.3 From 8fad730a774cfb129cdb33a4f8c06b0a799c82a6 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 22 Jun 2021 15:12:26 -0400 Subject: Fix incorrect negation --- src/options.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/options.ts b/src/options.ts index 13a4bfee..d1f5b37e 100644 --- a/src/options.ts +++ b/src/options.ts @@ -32,7 +32,7 @@ async function init() { for (let i = 0; i < optionsElements.length; i++) { if ((optionsElements[i].getAttribute("private-mode-only") === "true" && !(await isIncognitoAllowed())) - || (optionsElements[i].getAttribute("no-safari") === "true" && navigator.vendor !== "Apple Computer, Inc.")) { + || (optionsElements[i].getAttribute("no-safari") === "true" && navigator.vendor === "Apple Computer, Inc.")) { optionsElements[i].classList.add("hidden"); continue; } -- cgit v1.2.3 From b6d6856ff09ab069bf3cb7260d2c336f360ae8d6 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 22 Jun 2021 15:13:09 -0400 Subject: Increase version number --- manifest/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest/manifest.json b/manifest/manifest.json index 53e87021..2ddd30a6 100644 --- a/manifest/manifest.json +++ b/manifest/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_fullName__", "short_name": "SponsorBlock", - "version": "2.1.0.1", + "version": "2.1.1", "default_locale": "en", "description": "__MSG_Description__", "content_scripts": [{ -- cgit v1.2.3 From 9b8daa7a3e0fae40a4ec1ad7ff5cc12889d0eafb Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 22 Jun 2021 15:17:01 -0400 Subject: Add no safari to invidious checkbox too --- public/options/options.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/options/options.html b/public/options/options.html index 586cdc6a..560e30c9 100644 --- a/public/options/options.html +++ b/public/options/options.html @@ -32,7 +32,7 @@

-
+
-
-
+
+
+
+
@@ -86,10 +87,10 @@ __MSG_currentInstances__
-
-
-
+
+
+
-- cgit v1.2.3 From 5b59864639a7ec1d2efd58f73b209022193c876a Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 22 Jun 2021 17:46:40 -0400 Subject: Add 512 icon and remove $ sign --- manifest/manifest.json | 3 ++- public/icons/LogoSponsorBlocker128px.png | Bin 9282 -> 5237 bytes public/icons/LogoSponsorBlocker256px.png | Bin 11165 -> 11373 bytes public/icons/LogoSponsorBlocker512px.png | Bin 0 -> 26075 bytes public/icons/LogoSponsorBlocker64px.png | Bin 4403 -> 2290 bytes 5 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 public/icons/LogoSponsorBlocker512px.png diff --git a/manifest/manifest.json b/manifest/manifest.json index 2ddd30a6..5b960d64 100644 --- a/manifest/manifest.json +++ b/manifest/manifest.json @@ -68,7 +68,8 @@ "32": "icons/IconSponsorBlocker32px.png", "64": "icons/LogoSponsorBlocker64px.png", "128": "icons/LogoSponsorBlocker128px.png", - "256": "icons/LogoSponsorBlocker256px.png" + "256": "icons/LogoSponsorBlocker256px.png", + "512": "icons/LogoSponsorBlocker512px.png" }, "options_ui": { "page": "options/options.html", diff --git a/public/icons/LogoSponsorBlocker128px.png b/public/icons/LogoSponsorBlocker128px.png index d299a294..2df70b9a 100644 Binary files a/public/icons/LogoSponsorBlocker128px.png and b/public/icons/LogoSponsorBlocker128px.png differ diff --git a/public/icons/LogoSponsorBlocker256px.png b/public/icons/LogoSponsorBlocker256px.png index 06ec5127..eb1d57b2 100644 Binary files a/public/icons/LogoSponsorBlocker256px.png and b/public/icons/LogoSponsorBlocker256px.png differ diff --git a/public/icons/LogoSponsorBlocker512px.png b/public/icons/LogoSponsorBlocker512px.png new file mode 100644 index 00000000..3c9cb8ec Binary files /dev/null and b/public/icons/LogoSponsorBlocker512px.png differ diff --git a/public/icons/LogoSponsorBlocker64px.png b/public/icons/LogoSponsorBlocker64px.png index 87e24791..95167c0a 100644 Binary files a/public/icons/LogoSponsorBlocker64px.png and b/public/icons/LogoSponsorBlocker64px.png differ -- cgit v1.2.3 From a7f4b66e22b9a8ec2980f4bb76f3e81e12ac5801 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 22 Jun 2021 19:22:03 -0400 Subject: Add 1024 icon --- manifest/manifest.json | 3 ++- public/icons/LogoSponsorBlocker1024px.png | Bin 0 -> 57686 bytes 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 public/icons/LogoSponsorBlocker1024px.png diff --git a/manifest/manifest.json b/manifest/manifest.json index 5b960d64..7b920dd3 100644 --- a/manifest/manifest.json +++ b/manifest/manifest.json @@ -69,7 +69,8 @@ "64": "icons/LogoSponsorBlocker64px.png", "128": "icons/LogoSponsorBlocker128px.png", "256": "icons/LogoSponsorBlocker256px.png", - "512": "icons/LogoSponsorBlocker512px.png" + "512": "icons/LogoSponsorBlocker512px.png", + "1024": "icons/LogoSponsorBlocker1024px.png" }, "options_ui": { "page": "options/options.html", diff --git a/public/icons/LogoSponsorBlocker1024px.png b/public/icons/LogoSponsorBlocker1024px.png new file mode 100644 index 00000000..ac8beb21 Binary files /dev/null and b/public/icons/LogoSponsorBlocker1024px.png differ -- cgit v1.2.3 From af5946195a8a409bfd15d770597700f639dcedc4 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 22 Jun 2021 22:28:20 -0400 Subject: Hide donate button on safari --- public/popup.html | 2 +- src/popup.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/public/popup.html b/public/popup.html index c224f573..40d87b0e 100644 --- a/public/popup.html +++ b/public/popup.html @@ -138,7 +138,7 @@ Discord | Matrix | __MSG_help__ | - $ + $ diff --git a/src/popup.ts b/src/popup.ts index 5a9cc8be..ea752620 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -103,8 +103,14 @@ async function runThePopup(messageListener?: MessageListener): Promise { "sponsorMessageTimes", //"downloadedSponsorMessageTimes", "whitelistButton", + "sbDonate" ].forEach(id => PageElements[id] = document.getElementById(id)); + // Hide donate button on safari + if (navigator.vendor === "Apple Computer, Inc.") { + PageElements.sbDonate.style.display = "none"; + } + //setup click listeners PageElements.sponsorStart.addEventListener("click", sendSponsorStartMessage); PageElements.whitelistToggle.addEventListener("change", function() { -- cgit v1.2.3 From 43484ee6566b14a4e99b516eb3160f79bd1f1f4b Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 22 Jun 2021 22:28:29 -0400 Subject: Add back dollar sign to logo --- public/icons/LogoSponsorBlocker1024px.png | Bin 57686 -> 80531 bytes public/icons/LogoSponsorBlocker128px.png | Bin 5237 -> 7453 bytes public/icons/LogoSponsorBlocker256px.png | Bin 11373 -> 17313 bytes public/icons/LogoSponsorBlocker512px.png | Bin 26075 -> 37217 bytes public/icons/LogoSponsorBlocker64px.png | Bin 2290 -> 3454 bytes 5 files changed, 0 insertions(+), 0 deletions(-) diff --git a/public/icons/LogoSponsorBlocker1024px.png b/public/icons/LogoSponsorBlocker1024px.png index ac8beb21..2b15e3f8 100644 Binary files a/public/icons/LogoSponsorBlocker1024px.png and b/public/icons/LogoSponsorBlocker1024px.png differ diff --git a/public/icons/LogoSponsorBlocker128px.png b/public/icons/LogoSponsorBlocker128px.png index 2df70b9a..1126f907 100644 Binary files a/public/icons/LogoSponsorBlocker128px.png and b/public/icons/LogoSponsorBlocker128px.png differ diff --git a/public/icons/LogoSponsorBlocker256px.png b/public/icons/LogoSponsorBlocker256px.png index eb1d57b2..71602e23 100644 Binary files a/public/icons/LogoSponsorBlocker256px.png and b/public/icons/LogoSponsorBlocker256px.png differ diff --git a/public/icons/LogoSponsorBlocker512px.png b/public/icons/LogoSponsorBlocker512px.png index 3c9cb8ec..5445bd6a 100644 Binary files a/public/icons/LogoSponsorBlocker512px.png and b/public/icons/LogoSponsorBlocker512px.png differ diff --git a/public/icons/LogoSponsorBlocker64px.png b/public/icons/LogoSponsorBlocker64px.png index 95167c0a..31094742 100644 Binary files a/public/icons/LogoSponsorBlocker64px.png and b/public/icons/LogoSponsorBlocker64px.png differ -- cgit v1.2.3