1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-08 10:04:12 +01:00

Strip utm_* crud from URLs on yank.

This commit is contained in:
Kris Maglione
2011-12-04 12:07:13 -05:00
parent e9b287c83c
commit 7a1ffa5b55

View File

@@ -1836,6 +1836,10 @@ var Buffer = Module("Buffer", {
["y", "<yank-location>"], "Yank current location to the clipboard",
function () {
let { doc, uri } = buffer;
if (uri instanceof Ci.nsIURL)
uri.query = uri.query.replace(/(?:^|&)utm_[^&]+/g, "")
.replace(/^&/, "");
let link = DOM("link[href][rev=canonical], link[href][rel=shortlink]", doc);
let url = link.length && options.get("yankshort").getKey(uri) ? link.attr("href") : uri.spec;
dactyl.clipboardWrite(url, true);