Update page action icon based on state
@ -7,4 +7,22 @@ chrome.runtime.onInstalled.addListener(() => {
|
||||
], actions: [ new chrome.declarativeContent.ShowPageAction() ]
|
||||
}]);
|
||||
});
|
||||
});
|
||||
|
||||
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
let icons = request.killingStickies ? {
|
||||
"16": "images/ASK_on_16.png",
|
||||
"32": "images/ASK_on_32.png",
|
||||
"48": "images/ASK_on_48.png",
|
||||
"128": "images/ASK_on_128.png"
|
||||
} : {
|
||||
"16": "images/ASK_off_16.png",
|
||||
"32": "images/ASK_off_32.png",
|
||||
"48": "images/ASK_off_48.png",
|
||||
"128": "images/ASK_off_128.png"
|
||||
};
|
||||
chrome.pageAction.setIcon({
|
||||
path: icons,
|
||||
tabId: sender.tab.id
|
||||
});
|
||||
});
|
||||
@ -33,8 +33,8 @@ function checkForShouldKillSticky(result) {
|
||||
return shouldKillSticky;
|
||||
}
|
||||
|
||||
function updateIcon(result) {
|
||||
// TODO: code!
|
||||
function updateIcon(shouldKillSticky) {
|
||||
chrome.runtime.sendMessage({ "killingStickies" : shouldKillSticky });
|
||||
}
|
||||
|
||||
/******************/
|
||||
@ -45,7 +45,7 @@ function initialize() {
|
||||
chrome.storage.sync.get([ "matchingPatterns", "exclusionPatterns", "mode" ],
|
||||
(result) => {
|
||||
let shouldKillSticky = checkForShouldKillSticky(result);
|
||||
updateIcon(result);
|
||||
updateIcon(shouldKillSticky);
|
||||
window.onload = () => {
|
||||
if (shouldKillSticky) killSticky();
|
||||
};
|
||||
|
||||
|
Before Width: | Height: | Size: 3.9 KiB |
BIN
images/ASK16.png
|
Before Width: | Height: | Size: 1.3 KiB |
BIN
images/ASK32.png
|
Before Width: | Height: | Size: 1.7 KiB |
BIN
images/ASK48.png
|
Before Width: | Height: | Size: 2.1 KiB |
BIN
images/ASK_off_128.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
images/ASK_off_16.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
images/ASK_off_32.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
images/ASK_off_48.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
images/ASK_on_128.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
images/ASK_on_16.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
images/ASK_on_32.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
images/ASK_on_48.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
@ -20,17 +20,17 @@
|
||||
"default_popup": "popup.html",
|
||||
"default_title": "AlwaysKillSticky - Click the icon to control sticky-killing on this site!",
|
||||
"default_icon": {
|
||||
"16": "images/ASK16.png",
|
||||
"32": "images/ASK32.png",
|
||||
"48": "images/ASK48.png",
|
||||
"128": "images/ASK128.png"
|
||||
"16": "images/ASK_on_16.png",
|
||||
"32": "images/ASK_on_32.png",
|
||||
"48": "images/ASK_on_48.png",
|
||||
"128": "images/ASK_on_128.png"
|
||||
}
|
||||
},
|
||||
"icons": {
|
||||
"16": "images/ASK16.png",
|
||||
"32": "images/ASK32.png",
|
||||
"48": "images/ASK48.png",
|
||||
"128": "images/ASK128.png"
|
||||
"16": "images/ASK_on_16.png",
|
||||
"32": "images/ASK_on_32.png",
|
||||
"48": "images/ASK_on_48.png",
|
||||
"128": "images/ASK_on_128.png"
|
||||
},
|
||||
"options_page": "options.html"
|
||||
}
|
||||