diff options
Diffstat (limited to 'popup.js')
| -rw-r--r-- | popup.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/popup.js b/popup.js new file mode 100644 index 0000000..816f785 --- /dev/null +++ b/popup.js @@ -0,0 +1,48 @@ +const toggles = [ + 'hideHomeFeed', + 'hideVideoSidebar', + 'hideRecommended', + 'hideLiveChat', + 'hidePlaylist', + 'hideFundraiser', + 'hideEndScreenFeed', + 'hideEndScreenCards', + 'hideShorts', + 'hideComments', + 'hideProfilePhotos', + 'hideMixes', + 'hideMerchTickets', + 'hideVideoInfo', + 'hideButtonsBar', + 'hideChannel', + 'hideDescription', + 'hideTopHeader', + 'hideNotifications', + 'hideInaptSearch', + 'hideExploreTrending', + 'hideMoreFromYT', + 'hideSubscriptions', + 'disableAutoplay', + 'disableAnnotations' +]; + +// Load saved settings +browser.storage.local.get(toggles).then((result) => { + toggles.forEach((id) => { + const checkbox = document.getElementById(id); + if (checkbox) { + checkbox.checked = result[id] !== false; + } + }); +}); + +// Save settings on change +document.addEventListener('change', (e) => { + if (e.target.type !== 'checkbox') return; + + const id = e.target.id; + const checked = e.target.checked; + const settings = { [id]: checked }; + + browser.storage.local.set(settings); +}); |
