aboutsummaryrefslogtreecommitdiff
path: root/html/display_panel
diff options
context:
space:
mode:
authorhackademix <giorgio@maone.net>2018-09-13 15:56:29 +0200
committerhackademix <giorgio@maone.net>2018-09-13 15:56:29 +0200
commit4acf282ae6d5ae24a956908a87478d944f8519b9 (patch)
treeec3f865c6a00edc1adaaa2d5e4ead85e87c20e11 /html/display_panel
parentf87af55eb50a38ba44fcc0397d93e4989304bc8b (diff)
Brand new general settings page for white/black list management and other preferences.
Diffstat (limited to 'html/display_panel')
-rw-r--r--html/display_panel/content/display-panel.html5
-rw-r--r--html/display_panel/content/main_panel.js27
2 files changed, 19 insertions, 13 deletions
diff --git a/html/display_panel/content/display-panel.html b/html/display_panel/content/display-panel.html
index 2ed0c9c..df153b3 100644
--- a/html/display_panel/content/display-panel.html
+++ b/html/display_panel/content/display-panel.html
@@ -36,8 +36,8 @@
<div>
<a class="libre"
id="ljs-settings"
- href="javascript:void"
- title="LibreJS Whitelist Settings">
+ href= href="https://www.gnu.org/software/librejs/"
+ title="LibreJS Page Settings">
<h1 class="libre">LibreJS</h1>
</a>
</div>
@@ -52,6 +52,7 @@
</div>
<button id="complain">Complain to site owner</button>
<button id="report-tab">Show this report in a new tab</button>
+ <button id="open-options">Settings...</button>
</div>
</div>
<div id="info">
diff --git a/html/display_panel/content/main_panel.js b/html/display_panel/content/main_panel.js
index 930f7f2..c55b167 100644
--- a/html/display_panel/content/main_panel.js
+++ b/html/display_panel/content/main_panel.js
@@ -64,6 +64,11 @@ document.querySelector("#complain").onclick = e => {
close();
}
+document.querySelector("#open-options").onclick = e => {
+ browser.runtime.openOptionsPage();
+ close();
+}
+
document.querySelector("#reload").onclick = async e => {
let {tabId} = currentReport;
if (tabId) {
@@ -72,9 +77,9 @@ document.querySelector("#reload").onclick = async e => {
}
};
-/*
+/*
* Takes in the [[file_id, reason],...] array and the group name for one group
-* of scripts found in this tab, rendering it as a list with management buttons.
+* of scripts found in this tab, rendering it as a list with management buttons.
* Groups are "unknown", "blacklisted", "whitelisted", "accepted", and "blocked".
*/
function createList(data, group){
@@ -98,7 +103,7 @@ function createList(data, group){
let [scriptId, reason] = entry;
let li = liTemplate.cloneNode(true);
let a = li.querySelector("a");
- a.href = scriptId.split("(")[0];
+ a.href = scriptId.split("(")[0];
a.textContent = scriptId;
li.querySelector(".reason").textContent = reason;
let bySite = !!reason.match(/https?:\/\/[^/]+\/\*/);
@@ -116,7 +121,7 @@ function createList(data, group){
/**
* Updates scripts lists and buttons to act on them.
* If return_HTML is true, it returns the HTML of the popup window without updating it.
-* example report argument:
+* example report argument:
* {
* "accepted": [["FILENAME 1","REASON 1"],["FILENAME 2","REASON 2"]],
* "blocked": [["FILENAME 1","REASON 1"],["FILENAME 2","REASON 2"]],
@@ -131,29 +136,29 @@ function refreshUI(report) {
currentReport = report;
document.querySelector("#site").className = report.siteStatus || "";
- document.querySelector("#site h2").textContent =
+ document.querySelector("#site h2").textContent =
`This site ${report.site}`;
-
+
for (let toBeErased of document.querySelectorAll("#info h2:not(.site) > *, #info ul > *")) {
toBeErased.remove();
}
-
+
let scriptsCount = 0;
for (let group of ["unknown", "accepted", "whitelisted", "blocked", "blacklisted"]) {
if (group in report) createList(report, group);
scriptsCount += report[group].length;
}
-
+
for (let b of document.querySelectorAll(`.forget, .whitelist, .blacklist`)) {
b.disabled = false;
}
for (let b of document.querySelectorAll(
- `.unknown .forget, .accepted .forget, .blocked .forget,
+ `.unknown .forget, .accepted .forget, .blocked .forget,
.whitelisted .whitelist, .blacklisted .blacklist`
)) {
b.disabled = true;
- }
-
+ }
+
let noscript = scriptsCount === 0;
document.body.classList.toggle("empty", noscript);
}