mirror of
https://github.com/lawrencehook/remove-youtube-suggestions.git
synced 2026-07-25 06:54:31 +00:00
Add reload button
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
#button_container {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#help-box {
|
||||
text-align: left;
|
||||
padding: 8px;
|
||||
|
||||
+44
-39
@@ -7,49 +7,54 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<fieldset>
|
||||
<legend>Choose which suggestions to remove</legend>
|
||||
|
||||
<fieldset>
|
||||
<legend>Choose which suggestions to remove</legend>
|
||||
<div>
|
||||
<input type="checkbox" id="homepage" class="RYS_setting_checkbox" name="feature"
|
||||
value="homepage" checked />
|
||||
<label for="homepage">Homepage</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="homepage" name="feature"
|
||||
value="homepage" checked />
|
||||
<label for="homepage">Homepage</label>
|
||||
<div>
|
||||
<input type="checkbox" id="sidebar" class="RYS_setting_checkbox" name="feature"
|
||||
value="sidebar" checked />
|
||||
<label for="sidebar">Sidebar</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="videoEnd" class="RYS_setting_checkbox" name="feature"
|
||||
value="videoEnd" checked />
|
||||
<label for="videoEnd">End of Video</label>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="comments" class="RYS_setting_checkbox" name="feature"
|
||||
value="comments" unchecked />
|
||||
<label for="comments">Comments</label>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="button_container">
|
||||
<button id="reload_button">Reload</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div id="help-box">
|
||||
<div id="help-header">
|
||||
Help us make this addon better!
|
||||
</div>
|
||||
<hr>
|
||||
Submit feedback <a href="https://docs.google.com/forms/d/e/1FAIpQLScdrPlVKpJTGeDhD85HdYD2opsedlPqaMdN3ZW-ZSRwhqBZpw/viewform">here</a>.
|
||||
<br>
|
||||
Donate <a href="https://www.paypal.com/donate/?cmd=_donations&business=FF9K9YD6K6SWG¤cy_code=USD&amount=5">here</a>.
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="sidebar" name="feature"
|
||||
value="sidebar" checked />
|
||||
<label for="sidebar">Sidebar</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="videoEnd" name="feature"
|
||||
value="videoEnd" checked />
|
||||
<label for="videoEnd">End of Video</label>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="comments" name="feature"
|
||||
value="comments" unchecked />
|
||||
<label for="comments">Comments</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div id="help-box">
|
||||
<div id="help-header">
|
||||
Help us make this addon better!
|
||||
</div>
|
||||
<hr>
|
||||
Submit feedback <a href="https://docs.google.com/forms/d/e/1FAIpQLScdrPlVKpJTGeDhD85HdYD2opsedlPqaMdN3ZW-ZSRwhqBZpw/viewform">here</a>.
|
||||
<br>
|
||||
Donate <a href="https://www.paypal.com/donate/?cmd=_donations&business=FF9K9YD6K6SWG¤cy_code=USD&amount=5">here</a>.
|
||||
</div>
|
||||
|
||||
<script src="options.js"></script>
|
||||
|
||||
<script src="reload.js"></script>
|
||||
<script src="options.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+21
-34
@@ -1,40 +1,31 @@
|
||||
// Lawrence Hook
|
||||
// document.querySelectorAll("RYS_setting_checkbox");
|
||||
const homepageCheckbox = document.getElementById('homepage');
|
||||
const sidebarCheckbox = document.getElementById('sidebar');
|
||||
const videoEndCheckbox = document.getElementById('videoEnd');
|
||||
const commentsCheckbox = document.getElementById('comments');
|
||||
homepageCheckbox.addEventListener("change", saveHomepageSetting);
|
||||
sidebarCheckbox.addEventListener("change", saveSidebarSetting);
|
||||
videoEndCheckbox.addEventListener("change", saveVideoEndSetting);
|
||||
commentsCheckbox.addEventListener("change", saveCommentsSetting);
|
||||
|
||||
document.addEventListener("DOMContentLoaded", restoreOptions);
|
||||
|
||||
function saveHomepageSetting(e) {
|
||||
browser.storage.local.set({
|
||||
homepage: e.target.checked
|
||||
});
|
||||
browser.storage.local.set({ homepage: e.target.checked });
|
||||
}
|
||||
|
||||
function saveSidebarSetting(e) {
|
||||
browser.storage.local.set({
|
||||
sidebar: e.target.checked
|
||||
});
|
||||
browser.storage.local.set({ sidebar: e.target.checked });
|
||||
}
|
||||
|
||||
function saveVideoEndSetting(e) {
|
||||
browser.storage.local.set({
|
||||
videoEnd: e.target.checked
|
||||
});
|
||||
browser.storage.local.set({ videoEnd: e.target.checked });
|
||||
}
|
||||
|
||||
function saveCommentsSetting(e) {
|
||||
browser.storage.local.set({
|
||||
comments: e.target.checked
|
||||
});
|
||||
browser.storage.local.set({ comments: e.target.checked });
|
||||
}
|
||||
|
||||
var homepage_checkbox = document.getElementById('homepage');
|
||||
var sidebar_checkbox = document.getElementById('sidebar');
|
||||
var videoEnd_checkbox = document.getElementById('videoEnd');
|
||||
var comments_checkbox = document.getElementById('comments');
|
||||
homepage_checkbox.addEventListener("change", saveHomepageSetting);
|
||||
sidebar_checkbox.addEventListener("change", saveSidebarSetting);
|
||||
videoEnd_checkbox.addEventListener("change", saveVideoEndSetting);
|
||||
comments_checkbox.addEventListener("change", saveCommentsSetting);
|
||||
|
||||
|
||||
|
||||
function restoreOptions() {
|
||||
|
||||
function setCurrentChoice(result) {
|
||||
@@ -47,14 +38,10 @@ function restoreOptions() {
|
||||
console.log(`Error: ${error}`);
|
||||
}
|
||||
|
||||
let gettingHomepage = browser.storage.local.get("homepage");
|
||||
let gettingSidebar = browser.storage.local.get("sidebar");
|
||||
let gettingVideoEnd = browser.storage.local.get("videoEnd");
|
||||
let gettingComments = browser.storage.local.get("comments");
|
||||
gettingHomepage.then(setCurrentChoice, onError);
|
||||
gettingSidebar.then(setCurrentChoice, onError);
|
||||
gettingVideoEnd.then(setCurrentChoice, onError);
|
||||
gettingComments.then(setCurrentChoice, onError);
|
||||
const settings = ["homepage", "sidebar", "videoEnd", "comments"];
|
||||
settings.forEach(setting => {
|
||||
browser.storage.local.
|
||||
get(setting).
|
||||
then(setCurrentChoice, onError);
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", restoreOptions);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
const reloadButton = document.getElementById("reloadButton");
|
||||
reloadButton.addEventListener("click", reload);
|
||||
|
||||
async function reload() {
|
||||
console.log("hi");
|
||||
const tabs = await browser.tabs.query({ active: true, url: "*://www.youtube.com/" });
|
||||
if (tabs.length == 1) {
|
||||
const activeTab = tabs[0];
|
||||
browser.tabs.reload(activeTab.id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user