Skip to content

Commit

Permalink
replaced deprecated getSelected method and notify all tabs about the …
Browse files Browse the repository at this point in the history
…toggle changes
  • Loading branch information
ganigeorgiev committed May 18, 2020
1 parent e204f69 commit 0022b09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
20 changes: 5 additions & 15 deletions js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 0022b09

Please sign in to comment.