-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
22 lines (19 loc) · 824 Bytes
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
let changeColor = document.getElementById('hideIcons');
// Change event listener
changeColor.onclick = function (element) {
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.storage.sync.get(['display'], function(result) {
var invert = result.display ? 0 : 1;
changeColor.innerHTML = result.display ? "Hide": "Show";
// Invert and updated 'display' option
chrome.storage.sync.set({display: invert}, function(output) {
chrome.tabs.sendMessage(tabs[0].id, {action: invert}, function(output){
console.log(output);
});
});
});
});
};
chrome.storage.sync.get(['display'], function(result) {
changeColor.innerHTML = result.display ? "Hide": "Show";
});