mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-27 05:15:46 +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) {
|
setter: function (value) {
|
||||||
let win = document.documentElement;
|
let win = document.documentElement;
|
||||||
function updateTitle(old, current) {
|
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")) {
|
if (services.has("privateBrowsing")) {
|
||||||
|
|||||||
@@ -1811,6 +1811,17 @@
|
|||||||
</description>
|
</description>
|
||||||
</item>
|
</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>
|
</document>
|
||||||
|
|
||||||
<!-- vim:se sts=4 sw=4 et: -->
|
<!-- vim:se sts=4 sw=4 et: -->
|
||||||
|
|||||||
@@ -1835,8 +1835,9 @@ var Buffer = Module("Buffer", {
|
|||||||
mappings.add([modes.NORMAL],
|
mappings.add([modes.NORMAL],
|
||||||
["y", "<yank-location>"], "Yank current location to the clipboard",
|
["y", "<yank-location>"], "Yank current location to the clipboard",
|
||||||
function () {
|
function () {
|
||||||
let link = DOM("link[href][rev=canonical], link[href][rel=shortlink]", buffer.doc);
|
let { doc, uri } = buffer;
|
||||||
let url = link.length ? link.attr("href") : buffer.uri.spec;
|
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);
|
dactyl.clipboardWrite(url, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2329,6 +2330,10 @@ var Buffer = Module("Buffer", {
|
|||||||
setter: function (value) buffer.contentViewer.authorStyleDisabled = value,
|
setter: function (value) buffer.contentViewer.authorStyleDisabled = value,
|
||||||
getter: function () buffer.contentViewer.authorStyleDisabled
|
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")
|
if (this.type === "string")
|
||||||
defaultValue = Commands.quote(defaultValue);
|
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(",");
|
defaultValue = iter(defaultValue).map(function (val) val.map(Option.quote).join(":")).join(",");
|
||||||
|
|
||||||
if (isArray(defaultValue))
|
if (isArray(defaultValue))
|
||||||
|
|||||||
@@ -251,6 +251,7 @@
|
|||||||
- Added 'spelllang' option. [b8]
|
- Added 'spelllang' option. [b8]
|
||||||
- Make 'showmode' a [stringlist] option. [b7]
|
- Make 'showmode' a [stringlist] option. [b7]
|
||||||
- Added 'wildanchor' option. [b2]
|
- Added 'wildanchor' option. [b2]
|
||||||
|
- Added 'yankshort' option. [b8]
|
||||||
• Added BookmarkChange, BookmarkRemove autocommands. [b2]
|
• Added BookmarkChange, BookmarkRemove autocommands. [b2]
|
||||||
• Removed the :source line at the end of files generated by
|
• Removed the :source line at the end of files generated by
|
||||||
:mkpentadactylrc. [b2]
|
:mkpentadactylrc. [b2]
|
||||||
|
|||||||
Reference in New Issue
Block a user