From 050e6b91c29c6deb58e496d4a0a3a1b36e1495f0 Mon Sep 17 00:00:00 2001 From: Lawrence Hook Date: Sun, 12 Dec 2021 18:51:50 -0500 Subject: [PATCH] Remove play next button and thumbnail mouseover effect (chrome) --- chrome/css/main.css | 6 ++++++ chrome/css/options.css | 4 ++++ chrome/js/content-script.js | 29 ++++++++++++++++------------- chrome/js/options.js | 28 +++++++++++++++------------- chrome/js/reload.js | 6 +++--- chrome/manifest.json | 22 ++++++++++------------ chrome/options.html | 8 ++++++++ 7 files changed, 62 insertions(+), 41 deletions(-) diff --git a/chrome/css/main.css b/chrome/css/main.css index 57a06bd..33901aa 100644 --- a/chrome/css/main.css +++ b/chrome/css/main.css @@ -9,7 +9,13 @@ html[global_enable="true"][remove_home_link="true"] a:not(#logo)[href="/"], html[global_enable="true"][remove_explore_link="true"] a[href="/feed/trending"], html[global_enable="true"][remove_explore_link="true"] a[href="/feed/explore"], +html[global_enable="true"][remove_thumbnail_mouseover_effect="true"] #mouseover-overlay, + +html[global_enable="true"][remove_play_next_button="true"] a.ytp-next-button, + html[global_enable="true"][remove_comments="true"] #comments, +html[global_enable="true"][remove_comments="true"] #comment-teaser, +html[global_enable="true"][remove_comments="true"] ytd-engagement-panel-section-list-renderer[target-id="engagement-panel-comments-section"], html[global_enable="true"][remove_chat="true"] #chat, diff --git a/chrome/css/options.css b/chrome/css/options.css index f3abb98..b35aa82 100644 --- a/chrome/css/options.css +++ b/chrome/css/options.css @@ -8,6 +8,8 @@ html[remove_info_cards="true"] .remove_info_cards .inactive, html[remove_home_link="true"] .remove_home_link .inactive, html[remove_logo_link="true"] .remove_logo_link .inactive, html[remove_explore_link="true"] .remove_explore_link .inactive, +html[remove_thumbnail_mouseover_effect="true"] .remove_thumbnail_mouseover_effect .inactive, +html[remove_play_next_button="true"] .remove_play_next_button .inactive, html[remove_comments="true"] .remove_comments .inactive, html[remove_chat="true"] .remove_chat .inactive, html[redirect_off="true"] .redirect_off .inactive, @@ -27,6 +29,8 @@ html[remove_info_cards="false"] .remove_info_cards .active, html[remove_home_link="false"] .remove_home_link .active, html[remove_logo_link="false"] .remove_logo_link .active, html[remove_explore_link="false"] .remove_explore_link .active, +html[remove_thumbnail_mouseover_effect="false"] .remove_thumbnail_mouseover_effect .active, +html[remove_play_next_button="false"] .remove_play_next_button .active, html[remove_comments="false"] .remove_comments .active, html[remove_chat="false"] .remove_chat .active, html[redirect_off="false"] .redirect_off .active, diff --git a/chrome/js/content-script.js b/chrome/js/content-script.js index 6772e0e..732e73d 100644 --- a/chrome/js/content-script.js +++ b/chrome/js/content-script.js @@ -3,21 +3,24 @@ if (typeof browser === 'undefined') { browser = typeof chrome !== 'undefined' ? chrome : null; } +// Some global constants. const HTML = document.documentElement; const SETTINGS_LIST = { - "global_enable": { defaultValue: true, eventType: 'click' }, - "remove_homepage": { defaultValue: true, eventType: 'change' }, - "remove_sidebar": { defaultValue: true, eventType: 'change' }, - "remove_end_of_video": { defaultValue: true, eventType: 'change' }, - "remove_info_cards": { defaultValue: false, eventType: 'change' }, - "remove_home_link": { defaultValue: false, eventType: 'change' }, - "remove_logo_link": { defaultValue: false, eventType: 'change' }, - "remove_explore_link": { defaultValue: false, eventType: 'change' }, - "remove_comments": { defaultValue: false, eventType: 'change' }, - "remove_chat": { defaultValue: false, eventType: 'change' }, - "redirect_off": { defaultValue: true, eventType: 'change' }, - "redirect_to_subs": { defaultValue: false, eventType: 'change' }, - "redirect_to_wl": { defaultValue: false, eventType: 'change' }, + "global_enable": { defaultValue: true, eventType: 'click' }, + "remove_homepage": { defaultValue: true, eventType: 'change' }, + "remove_sidebar": { defaultValue: true, eventType: 'change' }, + "remove_end_of_video": { defaultValue: true, eventType: 'change' }, + "remove_info_cards": { defaultValue: false, eventType: 'change' }, + "remove_home_link": { defaultValue: false, eventType: 'change' }, + "remove_logo_link": { defaultValue: false, eventType: 'change' }, + "remove_explore_link": { defaultValue: false, eventType: 'change' }, + "remove_thumbnail_mouseover_effect": { defaultValue: false, eventType: 'change' }, + "remove_play_next_button": { defaultValue: false, eventType: 'change' }, + "remove_comments": { defaultValue: false, eventType: 'change' }, + "remove_chat": { defaultValue: false, eventType: 'change' }, + "redirect_off": { defaultValue: true, eventType: 'change' }, + "redirect_to_subs": { defaultValue: false, eventType: 'change' }, + "redirect_to_wl": { defaultValue: false, eventType: 'change' }, }; // Initialize HTML attributes with local settings, or default. diff --git a/chrome/js/options.js b/chrome/js/options.js index 4b43de2..7629d4e 100644 --- a/chrome/js/options.js +++ b/chrome/js/options.js @@ -6,19 +6,21 @@ if (typeof browser === 'undefined') { // Some global constants. const HTML = document.documentElement; const SETTINGS_LIST = { - "global_enable": { defaultValue: true, eventType: 'click' }, - "remove_homepage": { defaultValue: true, eventType: 'click' }, - "remove_sidebar": { defaultValue: true, eventType: 'click' }, - "remove_end_of_video": { defaultValue: true, eventType: 'click' }, - "remove_info_cards": { defaultValue: false, eventType: 'click' }, - "remove_home_link": { defaultValue: false, eventType: 'click' }, - "remove_logo_link": { defaultValue: false, eventType: 'click' }, - "remove_explore_link": { defaultValue: false, eventType: 'click' }, - "remove_comments": { defaultValue: false, eventType: 'click' }, - "remove_chat": { defaultValue: false, eventType: 'click' }, - "redirect_off": { defaultValue: true, eventType: 'click' }, - "redirect_to_subs": { defaultValue: false, eventType: 'click' }, - "redirect_to_wl": { defaultValue: false, eventType: 'click' }, + "global_enable": { defaultValue: true, eventType: 'click' }, + "remove_homepage": { defaultValue: true, eventType: 'click' }, + "remove_sidebar": { defaultValue: true, eventType: 'click' }, + "remove_end_of_video": { defaultValue: true, eventType: 'click' }, + "remove_info_cards": { defaultValue: false, eventType: 'click' }, + "remove_home_link": { defaultValue: false, eventType: 'click' }, + "remove_logo_link": { defaultValue: false, eventType: 'click' }, + "remove_explore_link": { defaultValue: false, eventType: 'click' }, + "remove_thumbnail_mouseover_effect": { defaultValue: false, eventType: 'click' }, + "remove_play_next_button": { defaultValue: false, eventType: 'click' }, + "remove_comments": { defaultValue: false, eventType: 'click' }, + "remove_chat": { defaultValue: false, eventType: 'click' }, + "redirect_off": { defaultValue: true, eventType: 'click' }, + "redirect_to_subs": { defaultValue: false, eventType: 'click' }, + "redirect_to_wl": { defaultValue: false, eventType: 'click' }, }; const VALID_SETTINGS = Object.keys(SETTINGS_LIST); diff --git a/chrome/js/reload.js b/chrome/js/reload.js index 4b79047..381530b 100644 --- a/chrome/js/reload.js +++ b/chrome/js/reload.js @@ -7,7 +7,7 @@ const reloadButton = document.getElementById("reload_button"); reloadButton.addEventListener("click", sendReloadMessage); async function sendReloadMessage() { - browser.tabs.query({ active: true, currentWindow: true }, tabs => { - tabs.forEach(tab => browser.tabs.reload(tab.id)); - }); + browser.tabs.query({ active: true, currentWindow: true }, tabs => { + tabs.forEach(tab => browser.tabs.reload(tab.id)); + }); } diff --git a/chrome/manifest.json b/chrome/manifest.json index 1023a6f..80cd943 100644 --- a/chrome/manifest.json +++ b/chrome/manifest.json @@ -12,27 +12,25 @@ "128": "images/128.png" }, + "background": { + "scripts": ["js/background.js"], + "persistent": true + }, + "content_scripts": [ + { + "js": ["js/content-script.js"], + "matches": ["*://*.youtube.com/*"], + "run_at": "document_start" + }, { "css": ["css/main.css"], "all_frames": true, "matches": ["*://*.youtube.com/*"], "run_at": "document_start" - }, - { - "matches": ["*://*.youtube.com/*"], - "js": ["js/content-script.js"], - "run_at": "document_start" } ], - "background": { - "scripts": [ - "js/background.js" - ], - "persistent": true - }, - "browser_action": { "default_popup": "options.html", "default_title": "Remove Youtube Suggestions", diff --git a/chrome/options.html b/chrome/options.html index 82bd627..3de9279 100644 --- a/chrome/options.html +++ b/chrome/options.html @@ -58,6 +58,14 @@
More removal options +
+
🚫🟢 Thumbnail mouseover effect
+
+ +
+
🚫🟢 Play next button
+
+