diff options
author | hackademix <giorgio@maone.net> | 2019-03-26 22:45:37 +0100 |
---|---|---|
committer | hackademix <giorgio@maone.net> | 2019-03-26 22:45:37 +0100 |
commit | 9884643742b54b88f94111d62f5e89a12a60e604 (patch) | |
tree | f367f5b7aa7ae3b950c26a946b54b737e6014a5c /html | |
parent | 55469c349c3c47c882ee21348ba67780c8291003 (diff) |
Subdomain wildcard support.
Diffstat (limited to 'html')
-rw-r--r-- | html/display_panel/content/main_panel.js | 6 | ||||
-rw-r--r-- | html/preferences_panel/pref.js | 3 | ||||
-rw-r--r-- | html/preferences_panel/preferences_panel.html | 4 |
3 files changed, 10 insertions, 3 deletions
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 @@ <h3>Settings</h3> </div> <div id="widgets"> - <fieldset id="section-lists"><legend>Allow or block scripts matching the following URLs ("*" matches any path)</legend> + <fieldset id="section-lists"><legend>Allow or block scripts matching the following URLs ("*."" matches any subdomain, "/*" matches any path)</legend> <label>Type a new whitelist / blacklist entry:</label> <div id="new-site"> - <input type="text" id="site" value="" placeholder="https://www.gnu.org/*"> + <input type="text" id="site" value="" placeholder="https://*.gnu.org/*"> <button id="cmd-whitelist-site" class="white" title="Whitelist this site" default>Whitelist</button> <button id="cmd-blacklist-site" class="red" title="Blacklist this site">Blacklist</button> </div> |