mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 00:38:00 +01:00
Yank mailto links sans mailto:
This commit is contained in:
@@ -756,6 +756,16 @@ var Hints = Module("hints", {
|
|||||||
Mode.prototype.__defineGetter__("matcher", function ()
|
Mode.prototype.__defineGetter__("matcher", function ()
|
||||||
options.get("extendedhinttags").getKey(this.name, options.get("hinttags").matcher));
|
options.get("extendedhinttags").getKey(this.name, options.get("hinttags").matcher));
|
||||||
|
|
||||||
|
function cleanLoc(loc) {
|
||||||
|
try {
|
||||||
|
let uri = util.newURI(loc);
|
||||||
|
if (uri.scheme == "mailto" && !~uri.path.indexOf("?"))
|
||||||
|
return uri.path;
|
||||||
|
}
|
||||||
|
catch (e) {}
|
||||||
|
return loc;
|
||||||
|
}
|
||||||
|
|
||||||
this.modes = {};
|
this.modes = {};
|
||||||
this.addMode(";", "Focus hint", buffer.bound.focusElement);
|
this.addMode(";", "Focus hint", buffer.bound.focusElement);
|
||||||
this.addMode("?", "Show information for hint", elem => buffer.showElementInfo(elem));
|
this.addMode("?", "Show information for hint", elem => buffer.showElementInfo(elem));
|
||||||
@@ -774,7 +784,7 @@ var Hints = Module("hints", {
|
|||||||
this.addMode("S", "Add a search keyword", elem => bookmarks.addSearchKeyword(elem));
|
this.addMode("S", "Add a search keyword", elem => bookmarks.addSearchKeyword(elem));
|
||||||
this.addMode("v", "View hint source", (elem, loc) => buffer.viewSource(loc, false));
|
this.addMode("v", "View hint source", (elem, loc) => buffer.viewSource(loc, false));
|
||||||
this.addMode("V", "View hint source in external editor", (elem, loc) => buffer.viewSource(loc, true));
|
this.addMode("V", "View hint source in external editor", (elem, loc) => buffer.viewSource(loc, true));
|
||||||
this.addMode("y", "Yank hint location", (elem, loc) => editor.setRegister(null, loc, true));
|
this.addMode("y", "Yank hint location", (elem, loc) => editor.setRegister(null, cleanLoc(loc), true));
|
||||||
this.addMode("Y", "Yank hint description", elem => editor.setRegister(null, elem.textContent || "", true));
|
this.addMode("Y", "Yank hint description", elem => editor.setRegister(null, elem.textContent || "", true));
|
||||||
this.addMode("A", "Yank hint anchor url", function (elem) {
|
this.addMode("A", "Yank hint anchor url", function (elem) {
|
||||||
let uri = elem.ownerDocument.documentURIObject.clone();
|
let uri = elem.ownerDocument.documentURIObject.clone();
|
||||||
|
|||||||
Reference in New Issue
Block a user