浏览代码

Fixes for Firefox, part I

master
Said Achmiz 6 年前
父节点
当前提交
62f613fab5
共有 4 个文件被更改,包括 10 次插入26 次删除
  1. 1
    0
      src/options.css
  2. 4
    8
      src/platform/chrome/background.js
  3. 0
    13
      src/platform/firefox/background.js
  4. 5
    5
      src/platform/firefox/manifest.json

+ 1
- 0
src/options.css 查看文件

min-height: 100vh; min-height: 100vh;
padding: 10px 20px; padding: 10px 20px;
font-size: 1rem; font-size: 1rem;
font-family: sans-serif;
} }
body.noscroll { body.noscroll {
overflow: hidden; overflow: hidden;

+ 4
- 8
src/platform/chrome/background.js 查看文件

*/ */
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
let icons = request.killingStickies ? { let icons = request.killingStickies ? {
"16": "images/ASK_on_16.png",
"32": "images/ASK_on_32.png",
"48": "images/ASK_on_48.png",
"128": "images/ASK_on_128.png"
"19": "images/ASK_on_19.png",
"38": "images/ASK_on_38.png",
} : { } : {
"16": "images/ASK_off_16.png",
"32": "images/ASK_off_32.png",
"48": "images/ASK_off_48.png",
"128": "images/ASK_off_128.png"
"19": "images/ASK_off_19.png",
"38": "images/ASK_off_38.png",
}; };
chrome.pageAction.setIcon({ chrome.pageAction.setIcon({
path: icons, path: icons,

+ 0
- 13
src/platform/firefox/background.js 查看文件

/* Enables the page action (i.e., the browser toolbar icon).
*/
chrome.runtime.onInstalled.addListener(() => {
chrome.declarativeContent.onPageChanged.removeRules(undefined, () => {
chrome.declarativeContent.onPageChanged.addRules([{
conditions: [ new chrome.declarativeContent.PageStateMatcher({
pageUrl: { schemes: [ 'http', 'https' ] },
})
], actions: [ new chrome.declarativeContent.ShowPageAction() ]
}]);
});
});

/* Toggle the toolbar icon based on whether stickies are, or are not, set to /* Toggle the toolbar icon based on whether stickies are, or are not, set to
be killed on the current tab. be killed on the current tab.



+ 5
- 5
src/platform/firefox/manifest.json 查看文件

"homepage_url": "https://git.sr.ht/~achmizs/AlwaysKillSticky.git", "homepage_url": "https://git.sr.ht/~achmizs/AlwaysKillSticky.git",
"permissions": [ "activeTab", "storage" ], "permissions": [ "activeTab", "storage" ],
"background": { "background": {
"scripts": ["background.js"]
"scripts": [ "background.js" ]
}, },
"content_scripts": [ { "content_scripts": [ {
"matches": [ "http://*/*", "https://*/*" ], "matches": [ "http://*/*", "https://*/*" ],
"js": [ "functions.js", "contentScript.js" ] "js": [ "functions.js", "contentScript.js" ]
} }
], ],
"page_action": {
"browser_action": {
"default_popup": "popup.html", "default_popup": "popup.html",
"default_title": "AlwaysKillSticky - Click the icon to control sticky-killing on this site!", "default_title": "AlwaysKillSticky - Click the icon to control sticky-killing on this site!",
"default_icon": { "default_icon": {
"48": "images/ASK_on_48.png",
"96": "images/ASK_on_96.png",
"19": "images/ASK_on_19.png",
"38": "images/ASK_on_38.png"
} }
}, },
"icons": { "icons": {
"48": "images/ASK_on_48.png", "48": "images/ASK_on_48.png",
"96": "images/ASK_on_96.png",
"96": "images/ASK_on_96.png"
}, },
"options_ui": { "options_ui": {
"page": "options.html", "page": "options.html",

正在加载...
取消
保存