1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 09:24:12 +01:00

Add 'yankshort' option.

This commit is contained in:
Kris Maglione
2011-11-25 09:52:33 -05:00
parent 32973aea75
commit 7d939adf11
5 changed files with 26 additions and 4 deletions

View File

@@ -1835,8 +1835,9 @@ var Buffer = Module("Buffer", {
mappings.add([modes.NORMAL],
["y", "<yank-location>"], "Yank current location to the clipboard",
function () {
let link = DOM("link[href][rev=canonical], link[href][rel=shortlink]", buffer.doc);
let url = link.length ? link.attr("href") : buffer.uri.spec;
let { doc, uri } = buffer;
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);
});
@@ -2329,6 +2330,10 @@ var Buffer = Module("Buffer", {
setter: function (value) buffer.contentViewer.authorStyleDisabled = value,
getter: function () buffer.contentViewer.authorStyleDisabled
});
options.add(["yankshort", "ys"],
"Yank the canonical short URL of a web page where provided",
"sitelist", ["youtube.com", "bugzilla.mozilla.org"]);
}
});