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