parent
f51ff8836c
commit
0c4ae5afb8
|
@ -5,6 +5,26 @@ chrome.webNavigation.onBeforeNavigate.addListener(event => main(event, 'onBefore
|
|||
chrome.webNavigation.onCreatedNavigationTarget.addListener(event => main(event, 'onCreatedNavigationTarget'));
|
||||
chrome.webNavigation.onCommitted.addListener(event => main(event, 'onCommitted'));
|
||||
|
||||
// Listen for user turning extension on or off, to update icon
|
||||
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
|
||||
if (msg.action === "updateIcon") {
|
||||
const manifestVersion = chrome.runtime.getManifest().manifest_version;
|
||||
if (msg.value === 'on') {
|
||||
if (manifestVersion === 2) {
|
||||
chrome.browserAction.setIcon({ path: "/images/logo-128.png" });
|
||||
} else {
|
||||
chrome.action.setIcon({ path: "/images/logo-128.png" });
|
||||
}
|
||||
} else {
|
||||
if (manifestVersion === 2) {
|
||||
chrome.browserAction.setIcon({ path: "/images/logo-off.png" });
|
||||
} else {
|
||||
chrome.action.setIcon({ path: "/images/logo-off.png" });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function redirectToBreezeWiki(storage, eventInfo, url) {
|
||||
function processRedirect(host) {
|
||||
const subdomain = url.hostname.split(".")[0];
|
||||
|
@ -64,11 +84,11 @@ async function getData() {
|
|||
|
||||
async function main(eventInfo, eventName) {
|
||||
// Create object prototypes for getting and setting attributes:
|
||||
Object.prototype.get = function(prop) {
|
||||
Object.prototype.get = function (prop) {
|
||||
this[prop] = this[prop] || {};
|
||||
return this[prop];
|
||||
};
|
||||
Object.prototype.set = function(prop, value) {
|
||||
Object.prototype.set = function (prop, value) {
|
||||
this[prop] = value;
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Indie Wiki Buddy",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "Helping you discover quality independent wikis through alerts, redirects, and search filtering",
|
||||
"permissions": [
|
||||
"storage",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Indie Wiki Buddy",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "Helping you discover quality independent wikis through alerts, redirects, and search filtering",
|
||||
"permissions": [
|
||||
"storage",
|
||||
|
|
5
popup.js
5
popup.js
|
@ -305,6 +305,11 @@ function setPower(setting) {
|
|||
powerImage.src = 'images/power-' + setting + '.png';
|
||||
var powerText = document.getElementById('powerText');
|
||||
powerText.textContent = 'Extension is ' + setting;
|
||||
|
||||
chrome.runtime.sendMessage({
|
||||
action: 'updateIcon',
|
||||
value: setting
|
||||
});
|
||||
}
|
||||
|
||||
// Set notifications setting
|
||||
|
|
Loading…
Reference in New Issue