您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

background.js 817B

12345678910111213141516171819202122232425262728
  1. chrome.runtime.onInstalled.addListener(() => {
  2. chrome.declarativeContent.onPageChanged.removeRules(undefined, () => {
  3. chrome.declarativeContent.onPageChanged.addRules([{
  4. conditions: [ new chrome.declarativeContent.PageStateMatcher({
  5. pageUrl: { },
  6. })
  7. ], actions: [ new chrome.declarativeContent.ShowPageAction() ]
  8. }]);
  9. });
  10. });
  11. chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
  12. let icons = request.killingStickies ? {
  13. "16": "images/ASK_on_16.png",
  14. "32": "images/ASK_on_32.png",
  15. "48": "images/ASK_on_48.png",
  16. "128": "images/ASK_on_128.png"
  17. } : {
  18. "16": "images/ASK_off_16.png",
  19. "32": "images/ASK_off_32.png",
  20. "48": "images/ASK_off_48.png",
  21. "128": "images/ASK_off_128.png"
  22. };
  23. chrome.pageAction.setIcon({
  24. path: icons,
  25. tabId: sender.tab.id
  26. });
  27. });