Apply enable/disable state of style to popup itself
This commit is contained in:
parent
94836b92d7
commit
6b49afaa48
6
apply.js
6
apply.js
|
@ -22,7 +22,9 @@ function requestStyles() {
|
|||
chrome.runtime.sendMessage(request, applyStyles);
|
||||
}
|
||||
|
||||
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
|
||||
chrome.runtime.onMessage.addListener(applyOnMessage);
|
||||
|
||||
function applyOnMessage(request, sender, sendResponse) {
|
||||
// Also handle special request just for the pop-up
|
||||
switch (request.method == "updatePopup" ? request.reason : request.method) {
|
||||
case "styleDeleted":
|
||||
|
@ -51,7 +53,7 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
|
|||
disableAll(request.disableAll);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function disableAll(disable) {
|
||||
if (!disable === !g_disableAll) {
|
||||
|
|
|
@ -10,6 +10,10 @@ function notifyAllTabs(request) {
|
|||
// notify all open popups
|
||||
var reqPopup = shallowMerge({}, request, {method: "updatePopup", reason: request.method});
|
||||
chrome.runtime.sendMessage(reqPopup);
|
||||
// notify self: the message no longer is sent to the origin in new Chrome
|
||||
if (typeof applyOnMessage !== 'undefined') {
|
||||
applyOnMessage(reqPopup);
|
||||
}
|
||||
}
|
||||
|
||||
function updateIcon(tab, styles) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user