diff options
author | hackademix | 2018-09-09 23:46:49 +0200 |
---|---|---|
committer | hackademix | 2018-09-09 23:46:49 +0200 |
commit | 050aa8b83bf83b83ce76bf69112f4fd29b732ba8 (patch) | |
tree | 85c3ce5b24b26d0330cd0667b9241b1cdf0dc759 /src | |
parent | 16d1b030625ab8c7ca478080f242d0df369a2951 (diff) | |
download | noscript-050aa8b83bf83b83ce76bf69112f4fd29b732ba8.tar.gz noscript-050aa8b83bf83b83ce76bf69112f4fd29b732ba8.tar.xz noscript-050aa8b83bf83b83ce76bf69112f4fd29b732ba8.zip |
SUpport for protocol-only entries in UI.
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/ui.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/ui/ui.js b/src/ui/ui.js index 49d5dc1..4a9c7c8 100644 --- a/src/ui/ui.js +++ b/src/ui/ui.js @@ -590,16 +590,21 @@ var UI = (() => { try { url = new URL(site); } catch (e) { - let protocol = Sites.isSecureDomainKey(site) ? "https:" : "http:"; - let hostname = Sites.toggleSecureDomainKey(site, false); - url = {protocol, hostname, origin: `${protocol}://${site}`, pathname: "/"}; + if (/^(\w+:)\/*$/.test(site)) { + url = {protocol: RegExp.$1, hostname: "", origin: site, pathname:""}; + let hostname = Sites.toExternal(url.hostname); + debug("Lonely %o", url, Sites.isSecureDomainKey(siteMatch) || !hostname && url.protocol === "https:"); + } else { + let protocol = Sites.isSecureDomainKey(site) ? "https:" : "http:"; + let hostname = Sites.toggleSecureDomainKey(site, false); + url = {protocol, hostname, origin: `${protocol}://${site}`, pathname: "/"}; + } } let hostname = Sites.toExternal(url.hostname); let domain = tld.getDomain(hostname); if (!siteMatch) { - // siteMatch = url.protocol === "https:" ? Sites.secureDomainKey(domain) : site; siteMatch = site; } let secure = Sites.isSecureDomainKey(siteMatch); @@ -628,12 +633,12 @@ var UI = (() => { row.querySelector(".domain").textContent = domain; row.querySelector(".path").textContent = siteMatch.length > url.origin.length ? url.pathname : ""; - let httpsOnly = row.querySelector("input.https-only"); - httpsOnly.checked = keyStyle === "full" || keyStyle === "secure"; } else { row._label = siteMatch; urlContainer.querySelector(".full-address").textContent = siteMatch; } + let httpsOnly = row.querySelector("input.https-only"); + httpsOnly.checked = keyStyle === "full" || keyStyle === "secure"; let presets = row.querySelectorAll("input.preset"); let idSuffix = `-${this.uiCount}-${sitesCount}`; |