mirror of
https://github.com/lawrencehook/remove-youtube-suggestions.git
synced 2026-07-25 06:54:31 +00:00
Start emojification effort
This commit is contained in:
+64
-6
@@ -1,11 +1,59 @@
|
||||
body {
|
||||
border-width: 4.5px;
|
||||
border-style: solid;
|
||||
border-color: black;
|
||||
|
||||
padding: 2px 2px 2px 2px;
|
||||
.active {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* Setting is enabled. */
|
||||
html[remove_homepage="true"] .remove_homepage .inactive,
|
||||
html[remove_sidebar="true"] .remove_sidebar .inactive,
|
||||
html[remove_sidebar="true"] .remove_sidebar .inactive,
|
||||
html[remove_end_of_video="true"] .remove_end_of_video .inactive,
|
||||
html[remove_info_cards="true"] .remove_info_cards .inactive,
|
||||
html[remove_trending="true"] .remove_trending .inactive,
|
||||
html[remove_trending="true"] .remove_trending .inactive,
|
||||
html[remove_comments="true"] .remove_comments .inactive,
|
||||
html[remove_chat="true"] .remove_chat .inactive,
|
||||
html[redirect_off="true"] .redirect_off .inactive,
|
||||
html[redirect_to_subs="true"] .redirect_to_subs .inactive,
|
||||
html[redirect_to_wl="true"] .redirect_to_wl .inactive,
|
||||
html[foo=bar]
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Setting is not enabled. */
|
||||
html[remove_homepage="false"] .remove_homepage .active,
|
||||
html[remove_sidebar="false"] .remove_sidebar .active,
|
||||
html[remove_sidebar="false"] .remove_sidebar .active,
|
||||
html[remove_end_of_video="false"] .remove_end_of_video .active,
|
||||
html[remove_info_cards="false"] .remove_info_cards .active,
|
||||
html[remove_trending="false"] .remove_trending .active,
|
||||
html[remove_trending="false"] .remove_trending .active,
|
||||
html[remove_comments="false"] .remove_comments .active,
|
||||
html[remove_chat="false"] .remove_chat .active,
|
||||
html[global_enable="false"] .active,
|
||||
html[foo=bar]
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
html[redirect_off="false"] .redirect_off .active,
|
||||
html[redirect_to_subs="false"] .redirect_to_subs .active,
|
||||
html[redirect_to_wl="false"] .redirect_to_wl .active,
|
||||
html[foo=bar]
|
||||
{
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
html[global_enable="false"] input.global_enable.enabled,
|
||||
html[global_enable="true"] input.global_enable.disabled,
|
||||
|
||||
html[foo=bar]
|
||||
{
|
||||
display: none !important;
|
||||
background-color: gray;
|
||||
}
|
||||
|
||||
|
||||
html[global_enable="false"] #primary_options
|
||||
{
|
||||
background-color: gray;
|
||||
@@ -14,9 +62,19 @@ html[global_enable="false"] #primary_options
|
||||
|
||||
html[global_enable="false"] #primary_options *
|
||||
{
|
||||
background-color: gray;
|
||||
color: white;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
body {
|
||||
border-width: 4.5px;
|
||||
border-style: solid;
|
||||
border-color: black;
|
||||
|
||||
padding: 2px 2px 2px 2px;
|
||||
}
|
||||
|
||||
#header_legend {
|
||||
font-size: larger;
|
||||
text-align: center;
|
||||
|
||||
+19
-27
@@ -1,16 +1,16 @@
|
||||
const HTML = document.documentElement;
|
||||
const SETTINGS_LIST = {
|
||||
"global_enable": { default: true, eventType: 'click' },
|
||||
"remove_homepage": { default: true, eventType: 'change' },
|
||||
"remove_sidebar": { default: true, eventType: 'change' },
|
||||
"remove_end_of_video": { default: true, eventType: 'change' },
|
||||
"remove_info_cards": { default: false, eventType: 'change' },
|
||||
"remove_trending": { default: false, eventType: 'change' },
|
||||
"remove_comments": { default: false, eventType: 'change' },
|
||||
"remove_chat": { default: false, eventType: 'change' },
|
||||
"redirect_off": { default: true, eventType: 'change' },
|
||||
"redirect_to_subs": { default: false, eventType: 'change' },
|
||||
"redirect_to_wl": { default: false, eventType: 'change' },
|
||||
"remove_homepage": { default: true, eventType: 'click' },
|
||||
"remove_sidebar": { default: true, eventType: 'click' },
|
||||
"remove_end_of_video": { default: true, eventType: 'click' },
|
||||
"remove_info_cards": { default: false, eventType: 'click' },
|
||||
"remove_trending": { default: false, eventType: 'click' },
|
||||
"remove_comments": { default: false, eventType: 'click' },
|
||||
"remove_chat": { default: false, eventType: 'click' },
|
||||
"redirect_off": { default: true, eventType: 'click' },
|
||||
"redirect_to_subs": { default: false, eventType: 'click' },
|
||||
"redirect_to_wl": { default: false, eventType: 'click' },
|
||||
};
|
||||
|
||||
const REDIRECT_URLS = {
|
||||
@@ -24,13 +24,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
Object.keys(localSettings).forEach(key => {
|
||||
const value = localSettings[key];
|
||||
if (!Object.keys(SETTINGS_LIST).includes(key)) return;
|
||||
const settingButton = document.getElementById(key);
|
||||
settingButton.checked = value;
|
||||
|
||||
if (key === 'global_enable') {
|
||||
settingButton.value = value ? 'Disable' : 'Enable';
|
||||
HTML.setAttribute(key, value);
|
||||
}
|
||||
HTML.setAttribute(key, value);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -40,11 +34,12 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
// 2. Send messages to main.js which updates the HTML attributes.
|
||||
// 3. (optional) Dynamically change options.html.
|
||||
Object.keys(SETTINGS_LIST).forEach(key => {
|
||||
const settingButton = document.getElementById(key);
|
||||
const { eventType } = SETTINGS_LIST[key];
|
||||
settingButton.addEventListener(eventType, async e => {
|
||||
const key = e.target.id;
|
||||
const value = e.target.checked;
|
||||
const settingElements = Array.from(document.getElementsByClassName(key));
|
||||
settingElements.forEach(button => button.addEventListener(eventType, async e => {
|
||||
|
||||
const value = !(String(HTML.getAttribute(key)).toLowerCase() === "true");
|
||||
HTML.setAttribute(key, value);
|
||||
|
||||
// Handle changes to a standard option.
|
||||
if (key.includes('remove')) {
|
||||
@@ -68,8 +63,10 @@ Object.keys(SETTINGS_LIST).forEach(key => {
|
||||
filter(key => key.includes('redirect'));
|
||||
const saveObj = redirectKeys.reduce((acc, curr) => {
|
||||
acc[curr] = false;
|
||||
HTML.setAttribute(curr, false);
|
||||
return acc;
|
||||
}, { redirect: false });
|
||||
HTML.setAttribute(key, true);
|
||||
saveObj[key] = true;
|
||||
|
||||
// Set the redirect URL.
|
||||
@@ -81,7 +78,6 @@ Object.keys(SETTINGS_LIST).forEach(key => {
|
||||
|
||||
// Handle changes to a global option.
|
||||
if (key === 'global_enable') {
|
||||
const value = settingButton.value === "Enable";
|
||||
|
||||
const saveObj = { [key]: value };
|
||||
browser.storage.local.set(saveObj);
|
||||
@@ -92,11 +88,7 @@ Object.keys(SETTINGS_LIST).forEach(key => {
|
||||
tabs.forEach(tab => {
|
||||
browser.tabs.sendMessage(tab.id, messageObj);
|
||||
});
|
||||
|
||||
// Update button text, and change option page's HTML attribute.
|
||||
settingButton.value = value ? "Disable" : "Enable";
|
||||
HTML.setAttribute(key, value);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
+52
-41
@@ -14,7 +14,8 @@
|
||||
<img src="images/64.png"></img>
|
||||
</div>
|
||||
<div id="enable_container">
|
||||
<input type=button id="global_enable" value=Disable />
|
||||
<input type=button class="global_enable enabled" value=Disable />
|
||||
<input type=button class="global_enable disabled" value=Enable />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
@@ -23,71 +24,81 @@
|
||||
<fieldset>
|
||||
<legend>Choose suggestions to remove</legend>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="remove_homepage" name="feature"
|
||||
value="remove_homepage" checked />
|
||||
<label for="remove_homepage">Homepage</label>
|
||||
<div class="remove_homepage">
|
||||
<!-- <input type="checkbox" class="remove_homepage enabled" name="feature" value="remove_homepage" checked /> -->
|
||||
<!-- <input type="checkbox" class="remove_homepage disabled" name="feature" value="remove_homepage" unecked /> -->
|
||||
<!-- <label for="remove_homepage">Homepage</label> -->
|
||||
<div class="option_name_container"><a class="active">🚫</a><a class="inactive">🟢</a> Homepage</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="remove_sidebar" name="feature"
|
||||
value="remove_sidebar" checked />
|
||||
<label for="remove_sidebar">Sidebar</label>
|
||||
<div class="remove_sidebar">
|
||||
<!-- <input type="checkbox" class="remove_sidebar enabled" name="feature" value="remove_sidebar" checked /> -->
|
||||
<!-- <input type="checkbox" class="remove_sidebar disabled" name="feature" value="remove_sidebar" unecked /> -->
|
||||
<!-- <label for="remove_sidebar">Sidebar</label> -->
|
||||
<div class="option_name_container"><a class="active">🚫</a><a class="inactive">🟢</a> Sidebar</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="remove_end_of_video" name="feature"
|
||||
value="remove_end_of_video" checked />
|
||||
<label for="remove_end_of_video">End of Video</label>
|
||||
<div class="remove_end_of_video">
|
||||
<!-- <input type="checkbox" class="remove_end_of_video enabled" name="feature" value="remove_end_of_video" checked /> -->
|
||||
<!-- <input type="checkbox" class="remove_end_of_video disabled" name="feature" value="remove_end_of_video" unecked /> -->
|
||||
<!-- <label for="remove_end_of_video">End of Video</label> -->
|
||||
<div class="option_name_container"><a class="active">🚫</a><a class="inactive">🟢</a> End of video</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>More removal options</legend>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="remove_trending" name="feature"
|
||||
value="remove_trending" unchecked />
|
||||
<label for="remove_trending">Link to Explore Page</label>
|
||||
<div class="remove_trending">
|
||||
<!-- <input type="checkbox" class="remove_trending enabled" name="feature" value="remove_trending" checked /> -->
|
||||
<!-- <input type="checkbox" class="remove_trending disabled" name="feature" value="remove_trending" unchecked /> -->
|
||||
<!-- <label for="remove_trending">Link to Explore Page</label> -->
|
||||
<div class="option_name_container"><a class="active">🚫</a><a class="inactive">🟢</a> Link to explore page</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="remove_info_cards" name="feature"
|
||||
value="remove_info_cards" unchecked />
|
||||
<label for="remove_info_cards">In-Video Info Cards</label>
|
||||
<div class="remove_info_cards">
|
||||
<!-- <input type="checkbox" class="remove_info_cards enabled" name="feature" value="remove_info_cards" checked /> -->
|
||||
<!-- <input type="checkbox" class="remove_info_cards disabled" name="feature" value="remove_info_cards" unchecked /> -->
|
||||
<!-- <label for="remove_info_cards">In-Video Info Cards</label> -->
|
||||
<div class="option_name_container"><a class="active">🚫</a><a class="inactive">🟢</a> In-video info cards</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="remove_comments" name="feature"
|
||||
value="remove_comments" unchecked />
|
||||
<label for="remove_comments">Video Comments</label>
|
||||
<div class="remove_comments">
|
||||
<!-- <input type="checkbox" class="remove_comments enabled" name="feature" value="remove_comments" checked /> -->
|
||||
<!-- <input type="checkbox" class="remove_comments disabled" name="feature" value="remove_comments" unchecked /> -->
|
||||
<!-- <label for="remove_comments">Video Comments</label> -->
|
||||
<div class="option_name_container"><a class="active">🚫</a><a class="inactive">🟢</a> Video comments</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="remove_chat" name="feature"
|
||||
value="remove_chat" unchecked />
|
||||
<label for="remove_chat">Live-Stream Chat</label>
|
||||
<div class="remove_chat">
|
||||
<!-- <input type="checkbox" class="remove_chat enabled" name="feature" value="remove_chat" checked /> -->
|
||||
<!-- <input type="checkbox" class="remove_chat disabled" name="feature" value="remove_chat" unchecked /> -->
|
||||
<!-- <label for="remove_chat">Live-Stream Chat</label> -->
|
||||
<div class="option_name_container"><a class="active">🚫</a><a class="inactive">🟢</a> Live-stream chat</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Redirect Homepage</legend>
|
||||
<div>
|
||||
<input type="radio" id="redirect_off" name="redirect"
|
||||
value="redirect_off" checked />
|
||||
<label for="redirect_off">Off</label>
|
||||
<div class="redirect_off">
|
||||
<!-- <input type="radio" class="redirect_off enabled" name="redirect" value="redirect_off" checked /> -->
|
||||
<!-- <input type="radio" class="redirect_off disabled" name="redirect" value="redirect_off" unecked /> -->
|
||||
<!-- <label for="redirect_off">Off</label> -->
|
||||
<div class="option_name_container"><a class="active">❌</a> Off</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="radio" id="redirect_to_subs" name="redirect"
|
||||
value="redirect_to_subs" unchecked />
|
||||
<label for="redirect_to_subs">to Subscriptions</label>
|
||||
<div class="redirect_to_subs">
|
||||
<!-- <input type="radio" class="redirect_to_subs enabled" name="redirect" value="redirect_to_subs" checked /> -->
|
||||
<!-- <input type="radio" class="redirect_to_subs disabled" name="redirect" value="redirect_to_subs" unchecked /> -->
|
||||
<!-- <label for="redirect_to_subs">to Subscriptions</label> -->
|
||||
<div class="option_name_container"><a class="active">↪️</a> to Subscriptions</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="radio" id="redirect_to_wl" name="redirect"
|
||||
value="redirect_to_wl" unchecked />
|
||||
<label for="redirect_to_wl">to Watch Later</label>
|
||||
<div class="redirect_to_wl">
|
||||
<!-- <input type="radio" class="redirect_to_wl enabled" name="redirect" value="redirect_to_wl" checked /> -->
|
||||
<!-- <input type="radio" class="redirect_to_wl disabled" name="redirect" value="redirect_to_wl" unchecked /> -->
|
||||
<!-- <label for="redirect_to_wl">to Watch Later</label> -->
|
||||
<div class="option_name_container"><a class="active">↪️</a> to Watch Later</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user