Background script for setting default options on install
This commit is contained in:
parent
d7b3e01577
commit
bbc18f90de
41
js/background.js
Normal file
41
js/background.js
Normal file
@ -0,0 +1,41 @@
|
||||
chrome.runtime.onInstalled.addListener(function () {
|
||||
let settings = {
|
||||
hotkeys: {
|
||||
codes: {
|
||||
slower: ["F21"],
|
||||
normal: ["F22"],
|
||||
faster: ["F23"],
|
||||
pause: ["k"],
|
||||
"skip-back": ["ArrowLeft"],
|
||||
"skip-forward": ["ArrowRight"],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
chrome.storage.local.set({ "extension-settings": settings }, function () {
|
||||
console.log("Initial setting set...");
|
||||
});
|
||||
});
|
||||
|
||||
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
|
||||
if (msg.from === "content" && msg.subject === "changeIcon") {
|
||||
// let canvas = document.getElementById("icon-making-canvas");
|
||||
// if (!canvas) {
|
||||
// canvas = document.createElement("CANVAS");
|
||||
// canvas.id = "icon-making-canvas";
|
||||
// canvas.width = canvas.height = 16;
|
||||
// }
|
||||
// let ctx = canvas.getContext("2d");
|
||||
// ctx.beginPath();
|
||||
// ctx.rect(0, 0, 16, 16);
|
||||
// ctx.fillStyle = "red";
|
||||
// ctx.fill();
|
||||
// ctx.fillStyle = "white";
|
||||
// ctx.textAlign = "center";
|
||||
// ctx.textBaseline = "middle";
|
||||
// fitTextOnCanvas(ctx, msg.speed, "Roboto Condensed", 9, canvas.width);
|
||||
// let imgData = ctx.getImageData(0, 0, 16, 16);
|
||||
// chrome.pageAction.setIcon({ imageData: imgData, tabId: sender.tab.id });
|
||||
}
|
||||
return Promise.resolve("Dummy response to keep the console quiet");
|
||||
});
|
@ -3,17 +3,22 @@
|
||||
"js": [ "dist/raw/spatial-navigation.js" ],
|
||||
"matches": [ "\u003Call_urls>" ],
|
||||
"run_at": "document_end"
|
||||
} ],
|
||||
"icons": {
|
||||
"32": "dist/raw/icon.png"
|
||||
},
|
||||
"description": "Smart spatial navigation with key map to links. Bind WASDE and Q keys.",
|
||||
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx6DSv4W8kxjs8MIUus8LpnlmyrvwElLfsqUjGBzTpSe0iNNxTrrYR/PtgUHyJOlNxUadmhbg19wePB+b3ly0NE0HwTjJ/kFMVNEkl6wk1jJ7CedIHjAzbFO5oHgcSt8j4hrxh4KopFgAydwSqBT8ssPHFOBfuAl1+3o4fGA06z0wwbi/KUSSFuZFrM3tdv8qkpeSwnFvSaV5aZnF0Y+mEuiYhGBGfFWIpFwZDwTeLxmKJtlt2RD5YghqodfwG4dAIMknEC63OkzA7yMB3ZdEwysm9kAtCwfQdBRP1YuRE7H+lZR4cAspnddFKOnEj+FIifDD8rkw8vqzN8FroUcHRQIDAQAB",
|
||||
"manifest_version": 2,
|
||||
"name": "Spatial Navigation",
|
||||
"permissions": [ "\u003Call_urls>" ],
|
||||
"short_name": "spatial-navigation",
|
||||
"update_url": "https://clients2.google.com/service/update2/crx",
|
||||
"version": "0.4.7"
|
||||
}
|
||||
],
|
||||
"background": {
|
||||
"scripts": ["js/background.js"],
|
||||
"persistent": false
|
||||
},
|
||||
"icons": {
|
||||
"32": "dist/raw/icon.png"
|
||||
},
|
||||
"description": "Smart spatial navigation with key map to links. Bind WASDE and Q keys.",
|
||||
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx6DSv4W8kxjs8MIUus8LpnlmyrvwElLfsqUjGBzTpSe0iNNxTrrYR/PtgUHyJOlNxUadmhbg19wePB+b3ly0NE0HwTjJ/kFMVNEkl6wk1jJ7CedIHjAzbFO5oHgcSt8j4hrxh4KopFgAydwSqBT8ssPHFOBfuAl1+3o4fGA06z0wwbi/KUSSFuZFrM3tdv8qkpeSwnFvSaV5aZnF0Y+mEuiYhGBGfFWIpFwZDwTeLxmKJtlt2RD5YghqodfwG4dAIMknEC63OkzA7yMB3ZdEwysm9kAtCwfQdBRP1YuRE7H+lZR4cAspnddFKOnEj+FIifDD8rkw8vqzN8FroUcHRQIDAQAB",
|
||||
"manifest_version": 2,
|
||||
"name": "Spatial Navigation",
|
||||
"permissions": ["\u003Call_urls>"],
|
||||
"short_name": "spatial-navigation",
|
||||
"update_url": "https://clients2.google.com/service/update2/crx",
|
||||
"version": "0.4.7",
|
||||
"options_page": "options.html"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user