| ], actions: [ new chrome.declarativeContent.ShowPageAction() ] | ], 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 | |||||
| }); | |||||
| }); | }); |
| return shouldKillSticky; | return shouldKillSticky; | ||||
| } | } | ||||
| function updateIcon(result) { | |||||
| // TODO: code! | |||||
| function updateIcon(shouldKillSticky) { | |||||
| chrome.runtime.sendMessage({ "killingStickies" : shouldKillSticky }); | |||||
| } | } | ||||
| /******************/ | /******************/ | ||||
| chrome.storage.sync.get([ "matchingPatterns", "exclusionPatterns", "mode" ], | chrome.storage.sync.get([ "matchingPatterns", "exclusionPatterns", "mode" ], | ||||
| (result) => { | (result) => { | ||||
| let shouldKillSticky = checkForShouldKillSticky(result); | let shouldKillSticky = checkForShouldKillSticky(result); | ||||
| updateIcon(result); | |||||
| updateIcon(shouldKillSticky); | |||||
| window.onload = () => { | window.onload = () => { | ||||
| if (shouldKillSticky) killSticky(); | if (shouldKillSticky) killSticky(); | ||||
| }; | }; |
| "default_popup": "popup.html", | "default_popup": "popup.html", | ||||
| "default_title": "AlwaysKillSticky - Click the icon to control sticky-killing on this site!", | "default_title": "AlwaysKillSticky - Click the icon to control sticky-killing on this site!", | ||||
| "default_icon": { | "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": { | "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" | "options_page": "options.html" | ||||
| } | } |