Separated out disjoint resources by platform

This commit is contained in:
Said Achmiz 2019-02-02 17:05:59 -05:00
parent 8e8052130d
commit 5886bb39b6
9 changed files with 73 additions and 7 deletions

View File

@ -0,0 +1,37 @@
/* Enables the page action (i.e., the browser toolbar icon).
*/
chrome.runtime.onInstalled.addListener(() => {
chrome.declarativeContent.onPageChanged.removeRules(undefined, () => {
chrome.declarativeContent.onPageChanged.addRules([{
conditions: [ new chrome.declarativeContent.PageStateMatcher({
pageUrl: { schemes: [ 'http', 'https' ] },
})
], actions: [ new chrome.declarativeContent.ShowPageAction() ]
}]);
});
});
/* Toggle the toolbar icon based on whether stickies are, or are not, set to
be killed on the current tab.
This listener receives a message from the content script (contentScript.js);
the content script actually determines what the settings for the current
tab are.
*/
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: request.tabID || sender.tab.id
});
});

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 206 B

View File

Before

Width:  |  Height:  |  Size: 338 B

After

Width:  |  Height:  |  Size: 338 B

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,33 @@
/* Enables the page action (i.e., the browser toolbar icon).
*/
chrome.runtime.onInstalled.addListener(() => {
chrome.declarativeContent.onPageChanged.removeRules(undefined, () => {
chrome.declarativeContent.onPageChanged.addRules([{
conditions: [ new chrome.declarativeContent.PageStateMatcher({
pageUrl: { schemes: [ 'http', 'https' ] },
})
], actions: [ new chrome.declarativeContent.ShowPageAction() ]
}]);
});
});
/* Toggle the toolbar icon based on whether stickies are, or are not, set to
be killed on the current tab.
This listener receives a message from the content script (contentScript.js);
the content script actually determines what the settings for the current
tab are.
*/
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
let icons = request.killingStickies ? {
"48": "images/ASK_on_48.png",
"96": "images/ASK_on_96.png",
} : {
"48": "images/ASK_off_48.png",
"96": "images/ASK_off_96.png",
};
chrome.pageAction.setIcon({
path: icons,
tabId: request.tabID || sender.tab.id
});
});

View File

@ -25,17 +25,13 @@
"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/ASK_on_16.png", "48": "images/ASK_on_48.png",
"32": "images/ASK_on_32.png", "96": "images/ASK_on_96.png",
"48": "images/ASK_on_48.png",
"128": "images/ASK_on_128.png"
} }
}, },
"icons": { "icons": {
"16": "images/ASK_on_16.png",
"32": "images/ASK_on_32.png",
"48": "images/ASK_on_48.png", "48": "images/ASK_on_48.png",
"128": "images/ASK_on_128.png" "96": "images/ASK_on_96.png",
}, },
"options_ui": { "options_ui": {
"page": "options.html", "page": "options.html",