From 4cacb7aa6defaaa3ef770a8aec144349cdffb1a9 Mon Sep 17 00:00:00 2001 From: Fedor Date: Thu, 7 May 2020 14:46:03 +0300 Subject: [PATCH] [Mypal] Add pref to allow copying unescaped URL from the URL bar. --- application/palemoon/app/profile/mypal.js | 4 ++++ application/palemoon/app/profile/palemoon.js | 4 ++++ .../palemoon/base/content/urlbarBindings.xml | 20 +++++++++---------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/application/palemoon/app/profile/mypal.js b/application/palemoon/app/profile/mypal.js index b796ac28a..9fc53d6ee 100644 --- a/application/palemoon/app/profile/mypal.js +++ b/application/palemoon/app/profile/mypal.js @@ -324,6 +324,10 @@ pref("browser.identity.display_punycode", 1); // Address bar RSS icon control, show by default pref("browser.urlbar.rss", true); +// If changed to true, copying the entire URL from the location bar will put +// the human readable (percent-decoded) URL on the clipboard. +pref("browser.urlbar.decodeURLsOnCopy", true); + pref("browser.altClickSave", true); // Enable logging downloads operations to the Error Console. diff --git a/application/palemoon/app/profile/palemoon.js b/application/palemoon/app/profile/palemoon.js index 84c30cc9b..4386c5bdb 100644 --- a/application/palemoon/app/profile/palemoon.js +++ b/application/palemoon/app/profile/palemoon.js @@ -324,6 +324,10 @@ pref("browser.identity.display_punycode", 1); // Address bar RSS icon control, show by default pref("browser.urlbar.rss", true); +// If changed to true, copying the entire URL from the location bar will put +// the human readable (percent-decoded) URL on the clipboard. +pref("browser.urlbar.decodeURLsOnCopy", true); + pref("browser.altClickSave", true); // Enable logging downloads operations to the Error Console. diff --git a/application/palemoon/base/content/urlbarBindings.xml b/application/palemoon/base/content/urlbarBindings.xml index 71a74a036..ae9b8d58f 100644 --- a/application/palemoon/base/content/urlbarBindings.xml +++ b/application/palemoon/base/content/urlbarBindings.xml @@ -521,19 +521,17 @@ uri = uriFixup.createExposableURI(uri); } catch (ex) {} - // If the entire URL is selected, just use the actual loaded URI. - if (inputVal == selectedVal) { - // ... but only if isn't a javascript: or data: URI, since those - // are hard to read when encoded - if (!uri.schemeIs("javascript") && !uri.schemeIs("data")) { - selectedVal = uri.spec; - } - - return selectedVal; + // If the entire URL is selected, just use the actual loaded URI, + // unless we want a decoded URI, or it's a data: or javascript: URI, + // since those are hard to read when encoded. + if (inputVal == selectedVal && + !uri.schemeIs("javascript") && !uri.schemeIs("data") && + !Services.prefs.getBoolPref("browser.urlbar.decodeURLsOnCopy")) { + return uri.spec; } - // Just the beginning of the URL is selected, check for a trimmed - // value + // Just the beginning of the URL is selected, or we want a decoded + // url. First check for a trimmed value. let spec = uri.spec; let trimmedSpec = this.trimValue(spec); if (spec != trimmedSpec) {