1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 21:00:23 +01:00

Cleaned up options page

This commit is contained in:
kkapsner 2017-11-11 23:34:59 +01:00
parent a465303fff
commit b3bb10d334
8 changed files with 80 additions and 8 deletions

View File

@ -26,6 +26,15 @@
"description": "" "description": ""
}, },
"displayDescriptions_title": {
"message": "Beschreibungen anzeigen",
"description": ""
},
"displayDescriptions_description": {
"message": "Zeigt die Beschreibungen der Einstellungen an.",
"description": ""
},
"allowPDFCanvas_description": { "allowPDFCanvas_description": {
"message": "Die native pdf.js verwendet <canvas> um den Inhalt von PDFs anzuzeigen. Wenn viele Nachfragedialoge erscheinen oder die PDF-Ansicht nicht funktioniert, müssen diese erlaubt werden.", "message": "Die native pdf.js verwendet <canvas> um den Inhalt von PDFs anzuzeigen. Wenn viele Nachfragedialoge erscheinen oder die PDF-Ansicht nicht funktioniert, müssen diese erlaubt werden.",
"description": "" "description": ""

View File

@ -26,6 +26,15 @@
"description": "" "description": ""
}, },
"displayDescriptions_title": {
"message": "Display descriptions",
"description": ""
},
"displayDescriptions_description": {
"message": "Displays the descriptions of the settings.",
"description": ""
},
"allowPDFCanvas_description": { "allowPDFCanvas_description": {
"message": "Firefox's native PDF reader uses the API to display PDF content. If too many ask dialogs appear or the PDF reader does not work at all, these have to be allowed.", "message": "Firefox's native PDF reader uses the API to display PDF content. If too many ask dialogs appear or the PDF reader does not work at all, these have to be allowed.",
"description": "" "description": ""

View File

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

View File

@ -1,8 +1,10 @@
.settings { .settings {
table-layout: fixed;
width: 100%; width: 100%;
border-spacing: 0; border-spacing: 0;
} }
.settings.displayDescriptions {
table-layout: fixed;
}
.settings * { .settings * {
vertical-align: top; vertical-align: top;
} }
@ -12,12 +14,46 @@
} }
.settings .settingRow .content { .settings .settingRow .content {
overflow: hidden; overflow: visible;
padding: 0.5em 0; padding: 0.5em 0;
border-top: 1px solid #c1c1c1; border-top: 1px solid #c1c1c1;
position: relative;
} }
.settings .settingRow .description { .settings.hideDescriptions .settingRow .info {
margin: 0 0.5em;
border-radius: 100%;
background-color: gray;
width: 1em;
height: 1em;
display: inline-block;
text-align: center;
line-height: 1em;
font-weight: bold;
color: white;
}
.settings.hideDescriptions .settingRow .info::after {
content: "i";
}
.settings.hideDescriptions .settingRow .info .description {
display: none;
}
.settings.hideDescriptions .settingRow .info:hover .description {
display: block;
position: absolute;
box-sizing: border-box;
top: 90%;
left: 5%;
max-width: 90%;
z-index: 10;
border: 1px solid black;
color: black;
background-color: lightgrey;
padding: 0.5em;
text-align: left;
font-weight: normal;
}
.settings.displayDescriptions .settingRow .description {
color: graytext; color: graytext;
margin-inline-start: 2em; margin-inline-start: 2em;
white-space: pre-wrap; white-space: pre-wrap;

View File

@ -26,7 +26,11 @@
}; };
var table = document.createElement("table"); var table = document.createElement("table");
table.className = "settings"; table.className = "settings " + (settings.displayDescriptions? "display": "hide") + "Descriptions";
settings.on("displayDescriptions", function(){
table.className = "settings " + (settings.displayDescriptions? "display": "hide") + "Descriptions";
});
document.body.appendChild(table); document.body.appendChild(table);
settingsDisplay.forEach(function(display){ settingsDisplay.forEach(function(display){
var setting = settings.getDefinition(display.name); var setting = settings.getDefinition(display.name);

View File

@ -24,11 +24,17 @@
title.textContent = browser.i18n.getMessage(setting.name + "_title"); title.textContent = browser.i18n.getMessage(setting.name + "_title");
c.appendChild(title); c.appendChild(title);
var descriptionText = browser.i18n.getMessage(setting.name + "_description");
if (descriptionText){
var info = document.createElement("div");
info.className = "info";
c.appendChild(info);
var description = document.createElement("div"); var description = document.createElement("div");
description.className = "description"; description.className = "description";
description.textContent = browser.i18n.getMessage(setting.name + "_description"); description.textContent = descriptionText;
c.appendChild(description); info.appendChild(description);
}
return c; return c;
} }

View File

@ -7,6 +7,9 @@
{ {
"name": "displayAdvancedSettings" "name": "displayAdvancedSettings"
}, },
{
"name": "displayDescriptions"
},
{ {
"name": "blockMode" "name": "blockMode"
}, },

View File

@ -3,6 +3,7 @@ Version 0.4.1:
- improved design of the page action display - improved design of the page action display
- Enabled Firefox ESR - Enabled Firefox ESR
- persistent random generator data is always stored in the settings but cleared on restart if the store flag is not set - persistent random generator data is always stored in the settings but cleared on restart if the store flag is not set
- cleaned up the options page
new features: new features:
- setting to set an interval to clear the persistent random generator data - setting to set an interval to clear the persistent random generator data