1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-01-03 10:31:54 +01:00

Show options page on install or update

But only when pageAction is not available (i.e. Fennec)
This commit is contained in:
kkapsner 2018-01-08 17:07:46 +01:00
parent 77e079e5cc
commit 2b92481004
6 changed files with 44 additions and 12 deletions

View File

@ -25,8 +25,12 @@
"message": "Über diese Seite können Sie die Einstellungen des Add-ons CanvasBlocker verändern.", "message": "Über diese Seite können Sie die Einstellungen des Add-ons CanvasBlocker verändern.",
"description": "" "description": ""
}, },
"installedNotice": { "installNotice": {
"message": "CanvasBlocker wurde installiert oder aktualisiert. Wenn Sie diese Seite in Zukunft erreichen wollen, erstellen Sie bitte ein Lesezeichen.", "message": "CanvasBlocker wurde installiert. Wenn Sie diese Seite in Zukunft erreichen wollen, erstellen Sie bitte ein Lesezeichen.",
"description": ""
},
"updateNotice": {
"message": "CanvasBlocker wurde aktualisiert. Wenn Sie diese Seite in Zukunft erreichen wollen und noch kein Lesezeichen erstellt ahben, erstellen Sie bitte eines.",
"description": "" "description": ""
}, },

View File

@ -25,8 +25,12 @@
"message": "This page provides a way to change the settings of the CanvasBlocker add-on.", "message": "This page provides a way to change the settings of the CanvasBlocker add-on.",
"description": "" "description": ""
}, },
"installedNotice": { "installNotice": {
"message": "CanvasBlocker was installed or updated. If you want to be able to access this page in the future, please bookmark it.", "message": "CanvasBlocker was installed. If you want to be able to access this page in the future, please bookmark it.",
"description": ""
},
"updateNotice": {
"message": "CanvasBlocker was updated. If you want to be able to access this page in the future and have not bookmarked it, please bookmark it.",
"description": "" "description": ""
}, },

View File

@ -138,8 +138,27 @@
} }
}); });
browser.runtime.onInstalled.addListener(function(){ browser.runtime.onInstalled.addListener(function(details){
message("CanvasBlocker installed"); function openOptions(reason){
if (
!browser.pageAction ||
!browser.pageAction.show ||
!browser.pageAction.openPopup
){
browser.tabs.create({
url: browser.extension.getURL("options/options.html?" + reason)
});
}
}
switch (details.reason){
case "install":
message("CanvasBlocker installed");
openOptions(details.reason);
break;
case "update":
message("CanvasBlocker updated");
openOptions(details.reason);
}
}); });
message("end"); message("end");

View File

@ -6,7 +6,7 @@ header {
margin-bottom: 1em; margin-bottom: 1em;
} }
header .installedNotice { header .bookmarkNotice {
margin: 0.5em; margin: 0.5em;
padding: 0.5em; padding: 0.5em;
border: 1px dotted #880000; border: 1px dotted #880000;

View File

@ -44,11 +44,15 @@
introduction.textContent = browser.i18n.getMessage("optionsIntroduction"); introduction.textContent = browser.i18n.getMessage("optionsIntroduction");
head.appendChild(introduction); head.appendChild(introduction);
if (window.location.search === "?installed"){ if (window.location.search){
let bookmarkingNotice = document.createElement("div"); let noticeName = window.location.search.substr(1).trim() + "Notice";
bookmarkingNotice.className = "installedNotice"; let notice = browser.i18n.getMessage(noticeName);
bookmarkingNotice.textContent = browser.i18n.getMessage("installedNotice"); if (notice){
head.appendChild(bookmarkingNotice); let bookmarkingNotice = document.createElement("div");
bookmarkingNotice.className = noticeName + " bookmarkNotice";
bookmarkingNotice.textContent = notice;
head.appendChild(bookmarkingNotice);
}
} }
document.body.appendChild(head); document.body.appendChild(head);

View File

@ -4,6 +4,7 @@ Version 0.4.5:
new features: new features:
- Added way to inspect canvas content in ask mode while being asked - Added way to inspect canvas content in ask mode while being asked
- Open options page on install or update if the options page cannot be accessed in another way
fixes: fixes:
- prevent possible double faking - prevent possible double faking