Skip to content

Commit 92d0af0

Browse files
committed
Update extension icon when adding/removing custom setting
1 parent bc00a8c commit 92d0af0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

background.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ browser.runtime.onMessage.addListener((message, sender) => {
9696
restoreOptions(tab); // Apply new settings in each tab
9797
});
9898
});
99+
case "update-action-icon": // When the user adds a new custom setting
100+
browser.tabs.query({ active: true, currentWindow: true }, tabs => {
101+
update_action_icon({ tabId: tabs[0].id })// Update icon
102+
});
99103
break;
100104
// case "display-notification": // When the user saves the settings (from popup)
101105
// browser.notifications.create(message.notificationName, message.notification);

popup.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ function addCustom() {
6969
select.appendChild(optionToAdd); // Append new option to select
7070
select.value = custom_url;
7171
select.dispatchEvent(new Event('change'));
72+
browser.runtime.sendMessage({ // Send message to background script asking to update the action icon
73+
request: "update-action-icon"
74+
});
7275
}, onError);
7376
};
7477

@@ -98,6 +101,9 @@ function removeCustom() {
98101
document.querySelector('div#textShadowOptions').style.display = "none";
99102
}
100103
updatePreview(); // Update preview
104+
browser.runtime.sendMessage({ // Send message to background script asking to update the action icon
105+
request: "update-action-icon"
106+
});
101107
}, onError);
102108
};
103109

0 commit comments

Comments
 (0)