From 9884643742b54b88f94111d62f5e89a12a60e604 Mon Sep 17 00:00:00 2001 From: hackademix Date: Tue, 26 Mar 2019 22:45:37 +0100 Subject: Subdomain wildcard support. --- html/display_panel/content/main_panel.js | 6 +++++- html/preferences_panel/pref.js | 3 +++ html/preferences_panel/preferences_panel.html | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'html') diff --git a/html/display_panel/content/main_panel.js b/html/display_panel/content/main_panel.js index 83c3a6b..9172265 100644 --- a/html/display_panel/content/main_panel.js +++ b/html/display_panel/content/main_panel.js @@ -59,6 +59,7 @@ document.querySelector("#info").addEventListener("click", e => { setTimeout(close, 100); return; } + if (!button.tagName === "BUTTON") button = button.closest("button"); if (button.matches(".toggle-source")) { let parent = button.parentNode; if (!parent.querySelector(".source").textContent) { @@ -69,10 +70,13 @@ document.querySelector("#info").addEventListener("click", e => { return; } if (!button.matches(".buttons > button")) return; + let domain = button.querySelector(".domain"); + let li = button.closest("li"); let entry = li && li._scriptEntry || [currentReport.url, "Page's site"]; let action = button.className; - let site = button.name === "*"; + let site = domain ? domain.textContent : button.name === "*" ? currentReport.site : ""; + if (site) { ([action] = action.split("-")); } diff --git a/html/preferences_panel/pref.js b/html/preferences_panel/pref.js index 9cecbb6..debb468 100644 --- a/html/preferences_panel/pref.js +++ b/html/preferences_panel/pref.js @@ -40,6 +40,9 @@ error = "Only one single trailing path wildcard (/*) allowed"; } } catch (e) { + if (/^https?:\/\/\*\./.test(url)) { + return this.malformedUrl(url.replace("*.", "")); + } error = "Invalid URL"; if (url && !url.includes("://")) error += ": missing protocol, either http:// or https://"; else if (url.endsWith("://")) error += ": missing domain name"; diff --git a/html/preferences_panel/preferences_panel.html b/html/preferences_panel/preferences_panel.html index 3a0ad7a..081ae07 100644 --- a/html/preferences_panel/preferences_panel.html +++ b/html/preferences_panel/preferences_panel.html @@ -45,10 +45,10 @@

Settings

-
Allow or block scripts matching the following URLs ("*" matches any path) +
Allow or block scripts matching the following URLs ("*."" matches any subdomain, "/*" matches any path)
- +
-- cgit v1.2.3 From f128d868d319c45222e451af75e3aa397b7f8144 Mon Sep 17 00:00:00 2001 From: hackademix Date: Mon, 8 Apr 2019 18:37:54 +0200 Subject: Add permanent reload button in the popup UI (in the "whole site" information line). --- html/display_panel/content/display-panel.html | 3 ++- html/display_panel/content/main_panel.js | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'html') diff --git a/html/display_panel/content/display-panel.html b/html/display_panel/content/display-panel.html index 5b9f99f..3221ded 100644 --- a/html/display_panel/content/display-panel.html +++ b/html/display_panel/content/display-panel.html @@ -64,12 +64,13 @@ +

- LibreJS will decide whether blocking these scripts next time this page is loaded. + LibreJS will decide whether blocking these scripts next time this page is loaded.