mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 10:47:58 +01:00
Closes issue #531.
This commit is contained in:
@@ -1757,28 +1757,32 @@ var Buffer = Module("buffer", {
|
|||||||
},
|
},
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
|
function url() {
|
||||||
|
let url = dactyl.clipboardRead();
|
||||||
|
dactyl.assert(url, _("error.clipboardEmpty"));
|
||||||
|
|
||||||
|
let proto = /^([-\w]+):/.exec(url);
|
||||||
|
if (proto && "@mozilla.org/network/protocol;1?name=" + proto[1] in Cc && !RegExp(options["urlseparator"]).test(url))
|
||||||
|
return url.replace(/\s+/g, "");
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
mappings.add([modes.NORMAL], ["gP"],
|
mappings.add([modes.NORMAL], ["gP"],
|
||||||
"Open (]put) a URL based on the current clipboard contents in a new buffer",
|
"Open (]put) a URL based on the current clipboard contents in a new buffer",
|
||||||
function () {
|
function () {
|
||||||
let url = dactyl.clipboardRead();
|
dactyl.open(url(), { from: "paste", where: dactyl.NEW_TAB, background: true });
|
||||||
dactyl.assert(url, _("error.clipboardEmpty"));
|
|
||||||
dactyl.open(url, { from: "paste", where: dactyl.NEW_TAB, background: true });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
mappings.add([modes.NORMAL], ["p", "<MiddleMouse>", "<open-clipboard-url>"],
|
mappings.add([modes.NORMAL], ["p", "<MiddleMouse>", "<open-clipboard-url>"],
|
||||||
"Open (put) a URL based on the current clipboard contents in the current buffer",
|
"Open (put) a URL based on the current clipboard contents in the current buffer",
|
||||||
function () {
|
function () {
|
||||||
let url = dactyl.clipboardRead();
|
dactyl.open(url());
|
||||||
dactyl.assert(url, _("error.clipboardEmpty"));
|
|
||||||
dactyl.open(url.replace(/\s+/g, ""));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
mappings.add([modes.NORMAL], ["P", "<tab-open-clipboard-url>"],
|
mappings.add([modes.NORMAL], ["P", "<tab-open-clipboard-url>"],
|
||||||
"Open (put) a URL based on the current clipboard contents in a new buffer",
|
"Open (put) a URL based on the current clipboard contents in a new buffer",
|
||||||
function () {
|
function () {
|
||||||
let url = dactyl.clipboardRead();
|
dactyl.open(url(), { from: "paste", where: dactyl.NEW_TAB });
|
||||||
dactyl.assert(url, _("error.clipboardEmpty"));
|
|
||||||
dactyl.open(url.replace(/\s+/g, ""), { from: "paste", where: dactyl.NEW_TAB });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// reloading
|
// reloading
|
||||||
|
|||||||
Reference in New Issue
Block a user