mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-12-02 19:01:21 +01:00
add option to disable vote submission
also change the icon of the extension when voting is disabled popup.js, content-script, bg-script listenes to storage change event so that they can all stay in sync without passing messages icon_hold is addded advanced setting is enabled in popup.html add fallback for changing extension icon refactor stateData
This commit is contained in:
1 parent
96f063838d
commit
819c59c5b7
7 files changed
+170
-40
No files matched your search
@@ -3,6 +3,7 @@ const config = {
|
||||
advanced: false,
|
||||
showAdvancedMessage: "Show Settings",
|
||||
hideAdvancedMessage: "Hide Settings",
|
||||
disableVoteSubmission: false,
|
||||
|
||||
links: {
|
||||
website: "https://returnyoutubedislike.com",
|
||||
@@ -29,8 +30,11 @@ document.getElementById("link_donate").addEventListener("click", () => {
|
||||
chrome.tabs.create({ url: config.links.donate });
|
||||
});
|
||||
|
||||
document.getElementById("disable_vote_submission").addEventListener("click", (ev) => {
|
||||
chrome.storage.sync.set({ disableVoteSubmission: ev.target.checked });
|
||||
});
|
||||
|
||||
/* Advanced Toggle */
|
||||
/* Not currently used in this version
|
||||
const advancedToggle = document.getElementById("advancedToggle");
|
||||
advancedToggle.addEventListener("click", () => {
|
||||
const adv = document.getElementById("advancedSettings");
|
||||
@@ -44,7 +48,31 @@ advancedToggle.addEventListener("click", () => {
|
||||
config.advanced = true;
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
initConfig();
|
||||
|
||||
function initConfig() {
|
||||
initializeDisableVoteSubmission();
|
||||
}
|
||||
|
||||
function initializeDisableVoteSubmission() {
|
||||
chrome.storage.sync.get(['disableVoteSubmission'], (res) => {
|
||||
handleDisableVoteSubmissionChangeEvent(res.disableVoteSubmission);
|
||||
});
|
||||
}
|
||||
|
||||
chrome.storage.onChanged.addListener(storageChangeHandler);
|
||||
|
||||
function storageChangeHandler(changes, area) {
|
||||
if (changes.disableVoteSubmission !== undefined) {
|
||||
handleDisableVoteSubmissionChangeEvent(changes.disableVoteSubmission.newValue);
|
||||
}
|
||||
}
|
||||
|
||||
function handleDisableVoteSubmissionChangeEvent(value) {
|
||||
config.disableVoteSubmission = value;
|
||||
document.getElementById("disable_vote_submission").checked = value;
|
||||
}
|
||||
|
||||
/* popup-script.js
|
||||
document.querySelector('#login')
|
||||
|
||||
Reference in new issue
Block a user