Skip to content

Commit

Permalink
Merge pull request #17 from wxy/logo
Browse files Browse the repository at this point in the history
默认非激活图标
  • Loading branch information
wxy authored Apr 24, 2024
2 parents 449f498 + be3632b commit 142132c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"web_accessible_resources": [
{
"resources": ["src/assets/logo.png", "src/assets/active.png", "src/assets/main.css"],
"resources": ["src/assets/logo.png", "src/assets/active.png", "src/assets/inactive.png","src/assets/main.css"],
"matches": ["http://*/*", "https://*/*"]
}
]
Expand Down
5 changes: 4 additions & 1 deletion scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ chrome.action.onClicked.addListener((tab) => {
});
} else {
// 取消扩展激活并修改图标
chrome.action.setIcon({path: "../src/assets/logo.png", tabId: tab.id});
chrome.action.setIcon({path: "../src/assets/inactive.png", tabId: tab.id});
// 可能需要编写一些代码来清除或逆转contentScript.js产生的效果
chrome.scripting.executeScript({
target: { tabId: tab.id },
Expand All @@ -26,6 +26,9 @@ chrome.action.onClicked.addListener((tab) => {
});

chrome.runtime.onInstalled.addListener(function() {
// 设置默认图标
chrome.action.setIcon({path: "../src/assets/inactive.png"});

chrome.contextMenus.create({
id: "options",
title: chrome.i18n.getMessage('optionsMenuTitle'),
Expand Down
Binary file added src/assets/inactive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 142132c

Please sign in to comment.