mirror of
https://github.com/lawrencehook/remove-youtube-suggestions.git
synced 2026-07-25 06:54:31 +00:00
let users control autoplay
This commit is contained in:
+1
-2
@@ -1,9 +1,8 @@
|
||||
{
|
||||
|
||||
"description": "Removes all suggestions from Youtube.",
|
||||
"manifest_version": 2,
|
||||
"name": "Remove Youtube Suggestions",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"homepage_url": "https://github.com/emumoo/remove-youtube-suggestions",
|
||||
|
||||
"content_scripts": [
|
||||
|
||||
+7
-11
@@ -1,26 +1,17 @@
|
||||
// Lawrence Hook
|
||||
|
||||
function saveHomepageSetting(e) {
|
||||
console.log(e.target.checked);
|
||||
browser.storage.local.set({
|
||||
homepage: e.target.checked
|
||||
});
|
||||
}
|
||||
|
||||
function saveSidebarSetting(e) {
|
||||
console.log(e.target.checked);
|
||||
browser.storage.local.set({
|
||||
sidebar: e.target.checked
|
||||
});
|
||||
}
|
||||
|
||||
var homepage_checkbox = document.getElementById('homepage');
|
||||
var sidebar_checkbox = document.getElementById('sidebar');
|
||||
|
||||
// console.log(homepage_checkbox, sidebar_checkbox);
|
||||
|
||||
homepage_checkbox.addEventListener("change", saveHomepageSetting);
|
||||
sidebar_checkbox.addEventListener("change", saveSidebarSetting);
|
||||
|
||||
|
||||
function restoreOptions() {
|
||||
function setCurrentChoice(result) {
|
||||
}
|
||||
@@ -33,4 +24,9 @@ function restoreOptions() {
|
||||
getting.then(setCurrentChoice, onError);
|
||||
}
|
||||
|
||||
var homepage_checkbox = document.getElementById('homepage');
|
||||
var sidebar_checkbox = document.getElementById('sidebar');
|
||||
homepage_checkbox.addEventListener("change", saveHomepageSetting);
|
||||
sidebar_checkbox.addEventListener("change", saveSidebarSetting);
|
||||
|
||||
document.addEventListener("DOMContentLoaded", restoreOptions);
|
||||
|
||||
@@ -7,7 +7,7 @@ function onError(error) {
|
||||
// remove homepage recommendations
|
||||
function updateStyle(setting) {
|
||||
// the homepage has pathname "/" which is length 1
|
||||
let property = !setting || window.location.pathname.length > 1 ? "flex" : "none";
|
||||
let property = (!setting || window.location.pathname.length > 1) ? "flex" : "none";
|
||||
for (let elt of document.querySelectorAll("ytd-browse")) {
|
||||
if (elt) elt.style.setProperty("display", property);
|
||||
}
|
||||
@@ -53,15 +53,13 @@ function onGotSidebarSetting(item) {
|
||||
|
||||
if (removeSidebar) {
|
||||
let sheets = document.styleSheets;
|
||||
sheets[0].insertRule(".ytd-watch-next-secondary-results-renderer { display: none !important; }");
|
||||
sheets[0].insertRule("ytd-compact-video-renderer.style-scope { display: none !important; }");
|
||||
sheets[0].insertRule("#upnext { display: none !important; }");
|
||||
}
|
||||
}
|
||||
|
||||
console.log('hi');
|
||||
var gettingHomepage = browser.storage.local.get("homepage");
|
||||
gettingHomepage.then(onGotHomepageSetting, onError);
|
||||
|
||||
var gettingSidebar = browser.storage.local.get("sidebar");
|
||||
gettingSidebar.then(onGotSidebarSetting, onError);
|
||||
console.log('bye');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user