fix: minor bugs
This commit is contained in:
parent
95393fde08
commit
08f71fdcbc
@ -21,6 +21,7 @@
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"exclude_matches": ["https://accounts.google.com/*"],
|
||||
"js": ["scripts/content.js"],
|
||||
"matches": ["http://*/*", "https://*/*"],
|
||||
"run_at": "document_start"
|
||||
|
@ -59,20 +59,20 @@ const enablePopup = (tabId) => {
|
||||
*/
|
||||
|
||||
chrome.runtime.onMessage.addListener((request, sender) => {
|
||||
sender.tab = { id: undefined };
|
||||
const tabId = sender.tab ? sender.tab.id : undefined;
|
||||
|
||||
switch (request.type) {
|
||||
case "DISABLE_ICON":
|
||||
disableIcon(sender.tab.id);
|
||||
disableIcon(tabId);
|
||||
break;
|
||||
case "DISABLE_POPUP":
|
||||
disablePopup(sender.tab.id);
|
||||
disablePopup(tabId);
|
||||
break;
|
||||
case "ENABLE_ICON":
|
||||
enableIcon(sender.tab.id);
|
||||
enableIcon(tabId);
|
||||
break;
|
||||
case "ENABLE_POPUP":
|
||||
enablePopup(sender.tab.id);
|
||||
enablePopup(tabId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -81,7 +81,7 @@ const handleStateButtonClick = async () => {
|
||||
() => {
|
||||
const stateButton = document.getElementById("state-button");
|
||||
|
||||
stateButton.innerHTML = state.enabled
|
||||
stateButton.textContent = state.enabled
|
||||
? "Enable extension"
|
||||
: "Disable extension";
|
||||
chrome.runtime.sendMessage({
|
||||
@ -134,7 +134,7 @@ const handleContentLoaded = async () => {
|
||||
const storeLink = document.getElementById("store-link");
|
||||
|
||||
stars.forEach((star) => star.addEventListener("click", handleStarClick));
|
||||
stateButton.innerHTML = state.enabled
|
||||
stateButton.textContent = state.enabled
|
||||
? "Disable extension"
|
||||
: "Enable extension";
|
||||
stateButton.addEventListener("click", handleStateButtonClick);
|
||||
|
Loading…
x
Reference in New Issue
Block a user