diff --git a/js/options.js b/js/options.js index 3a82254..2c25981 100644 --- a/js/options.js +++ b/js/options.js @@ -31,8 +31,8 @@ } chrome.storage.sync.set(data, function () { - chrome.tabs.getSelected(function (tab) { - if (tab && tab.url) { + chrome.tabs.query({}, function (tabs) { + for (let tab of tabs) { chrome.tabs.sendMessage(tab.id, data); } }); @@ -61,25 +61,15 @@ chrome.storage.sync.get(keys, function (items) { var values = Object.assign({}, sourcesDefault, items); - for (let i in keys) { - let key = keys[i]; - - if (values[key] === true) { - document.getElementById(key + '_toggle').classList.remove('active'); - } else { - document.getElementById(key + '_toggle').classList.add('active'); - } + for (let key of keys) { + document.getElementById(key + '_toggle').classList.toggle('active', !values[key]); } }); } // Switch on/off single toggle item function toggle(el) { - if (el.classList.contains('active')) { - el.classList.remove('active'); - } else { - el.classList.add('active'); - } + el.classList.toggle('active'); saveToggleValues(); } diff --git a/manifest.json b/manifest.json index 7fb13ad..d073187 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Hide ratings (IMDB,Goodreads,MyAnimeList,...)", "description": "Prevents you from other people influence by hiding the rating bars from IMDB, Goodreads, MyAnimeList and Letterboxd.", - "version": "1.6.1", + "version": "1.6.2", "browser_action": { "default_icon": "images/icon64.png", "default_popup": "options.html"