1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-10-31 18:38:45 +01:00

Added option "Don't show again on update." for options page.

Fixes #227.
This commit is contained in:
kkapsner 2018-08-19 00:13:43 +02:00
parent 34019f2515
commit cedd2137e2
7 changed files with 48 additions and 2 deletions

View File

@ -43,6 +43,10 @@
"message": "CanvasBlocker wurde aktualisiert. Wenn Sie diese Seite in Zukunft erreichen wollen und noch kein Lesezeichen erstellt haben, erstellen Sie bitte eines.",
"description": ""
},
"dontShowOptionsOnUpdate":{
"message": "Bei Aktualisierung nicht wieder anzeigen.",
"description": ""
},
"openInTab": {
"message": "In separatem Tab öffnen",
"description": ""

View File

@ -43,6 +43,10 @@
"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": ""
},
"dontShowOptionsOnUpdate":{
"message": "Don't show again on update.",
"description": ""
},
"openInTab": {
"message": "Open in separate tab",
"description": ""

View File

@ -181,10 +181,14 @@
openOptions(details.reason);
break;
case "update":
settings.onloaded(function(){
if (!settings.dontShowOptionsOnUpdate){
message("CanvasBlocker updated");
openOptions(details.reason);
}
});
}
});
message("end");
}());

View File

@ -222,6 +222,10 @@
name: "displayDescriptions",
defaultValue: false
},
{
name: "dontShowOptionsOnUpdate",
defaultValue: false
},
{
name: "isStillDefault",
defaultValue: true

View File

@ -13,6 +13,12 @@ header .bookmarkNotice {
color: #880000;
}
header .bookmarkNotice .dontShowOptionsOnUpdate {
display: block;
margin-top: 0.5em;
font-size: 0.8em;
}
.settings {
width: 100%;
border-spacing: 0;

View File

@ -65,7 +65,30 @@
let bookmarkingNotice = document.createElement("div");
bookmarkingNotice.className = noticeName + " bookmarkNotice";
bookmarkingNotice.textContent = notice;
const dontShowAgain = document.createElement("label");
dontShowAgain.className = "dontShowOptionsOnUpdate";
const dontShowAgainInput = document.createElement("input");
dontShowAgainInput.type = "checkbox";
settings.onloaded(function(){
dontShowAgainInput.checked = settings.dontShowOptionsOnUpdate;
});
dontShowAgainInput.addEventListener("change", function(){
settings.dontShowOptionsOnUpdate = this.checked;
});
dontShowAgain.appendChild(dontShowAgainInput);
dontShowAgain.appendChild(
document.createTextNode(
browser.i18n.getMessage("dontShowOptionsOnUpdate")
)
);
bookmarkingNotice.appendChild(dontShowAgain);
head.appendChild(bookmarkingNotice);
const newUrl = new URL(window.location.href);
newUrl.search = "";
window.history.pushState({}, "", newUrl.href);
}
}

View File

@ -5,6 +5,7 @@ Version 0.5.3:
new features:
- display version in options page
- added link to open options page in separate tab
- added option "Don't show again on update." for options page
fixes:
- CSP did not work properly for worker-src