mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-29 01:52:28 +01:00
Add 'yankshort' option.
This commit is contained in:
@@ -1431,7 +1431,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
setter: function (value) {
|
||||
let win = document.documentElement;
|
||||
function updateTitle(old, current) {
|
||||
document.title = document.title.replace(RegExp("(.*)" + util.regexp.escape(old)), "$1" + current);
|
||||
if (config.browser.updateTitlebar)
|
||||
config.browser.updateTitlebar();
|
||||
else
|
||||
document.title = document.title.replace(RegExp("(.*)" + util.regexp.escape(old)), "$1" + current);
|
||||
}
|
||||
|
||||
if (services.has("privateBrowsing")) {
|
||||
|
||||
@@ -1811,6 +1811,17 @@
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<tags>'ys' 'yankshort'</tags>
|
||||
<spec>'yankshort' 'ys'</spec>
|
||||
<type>&option.yankshort.type;</type>
|
||||
<default>&option.yankshort.default;</default>
|
||||
<description>
|
||||
<p>Yank the canonical short URL of a web page where provided.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
</document>
|
||||
|
||||
<!-- vim:se sts=4 sw=4 et: -->
|
||||
|
||||
@@ -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"]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -336,7 +336,9 @@ var Option = Class("Option", {
|
||||
if (this.type === "string")
|
||||
defaultValue = Commands.quote(defaultValue);
|
||||
|
||||
if (isObject(defaultValue))
|
||||
if (isArray(defaultValue))
|
||||
defaultValue = defaultValue.map(Option.quote).join(",");
|
||||
else if (isObject(defaultValue))
|
||||
defaultValue = iter(defaultValue).map(function (val) val.map(Option.quote).join(":")).join(",");
|
||||
|
||||
if (isArray(defaultValue))
|
||||
|
||||
Reference in New Issue
Block a user