mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 20:27:58 +01:00
Show link target with ;;.
This commit is contained in:
@@ -180,7 +180,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
||||
setOverLink: util.wrapCallback(function setOverLink(link, b) {
|
||||
setOverLink.superapply(this, arguments);
|
||||
dactyl.triggerObserver("browser.overLink", link);
|
||||
}),
|
||||
})
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
@@ -204,6 +204,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
||||
function () {
|
||||
window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
|
||||
.redraw();
|
||||
statusline.overLink = null;
|
||||
statusline.updateStatus();
|
||||
commandline.clear();
|
||||
},
|
||||
|
||||
@@ -1939,7 +1939,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
if (dactyl.commandLineOptions.rcFile == "NONE" || dactyl.commandLineOptions.noPlugins)
|
||||
options["loadplugins"] = [];
|
||||
|
||||
if (options["loadplugins"])
|
||||
if (options["loadplugins"].length)
|
||||
dactyl.loadPlugins();
|
||||
}
|
||||
catch (e) {
|
||||
|
||||
@@ -110,9 +110,11 @@ var StatusLine = Module("statusline", {
|
||||
"browser.overLink": function (link) {
|
||||
switch (options["showstatuslinks"]) {
|
||||
case "status":
|
||||
this.overLink = link ? _("status.link", link) : null;
|
||||
this.status = link ? _("status.link", link) : buffer.uri;
|
||||
break;
|
||||
case "command":
|
||||
this.overLink = null;
|
||||
if (link)
|
||||
dactyl.echo(_("status.link", link), commandline.FORCE_SINGLELINE);
|
||||
else
|
||||
@@ -250,7 +252,7 @@ var StatusLine = Module("statusline", {
|
||||
|
||||
updateStatus: function updateStatus() {
|
||||
this.timeout(function () {
|
||||
this.status = buffer.uri;
|
||||
this.status = this.overLink || buffer.uri;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -191,11 +191,11 @@ var DOM = Class("DOM", {
|
||||
this.each(function (elem) {
|
||||
while(true) {
|
||||
elem = fn.call(this, elem)
|
||||
if (elem instanceof Ci.nsIDOMElement)
|
||||
if (elem instanceof Ci.nsIDOMNode)
|
||||
res[res.length++] = elem;
|
||||
else if (elem && "length" in elem)
|
||||
for (let i = 0; i < tmp.length; i++)
|
||||
res[res.length++] = tmp[j];
|
||||
for (let i = 0; i < elem.length; i++)
|
||||
res[res.length++] = elem[j];
|
||||
else
|
||||
break;
|
||||
}
|
||||
@@ -256,6 +256,9 @@ var DOM = Class("DOM", {
|
||||
get siblingsBefore() this.all(function (elem) elem.previousElementSibling),
|
||||
get siblingsAfter() this.all(function (elem) elem.nextElementSibling),
|
||||
|
||||
get allSiblingsBefore() this.all(function (elem) elem.previousSibling),
|
||||
get allSiblingsAfter() this.all(function (elem) elem.nextSibling),
|
||||
|
||||
get class() let (self = this) ({
|
||||
toString: function () self[0].className,
|
||||
|
||||
|
||||
@@ -317,12 +317,12 @@ var Help = Module("Help", {
|
||||
.split(" "));
|
||||
function fix(node) {
|
||||
switch(node.nodeType) {
|
||||
case Node.ELEMENT_NODE:
|
||||
if (isinstance(node, [HTMLBaseElement]))
|
||||
case Ci.nsIDOMNode.ELEMENT_NODE:
|
||||
if (isinstance(node, [Ci.nsIDOMHTMLBaseElement]))
|
||||
return;
|
||||
|
||||
data.push("<"); data.push(node.localName);
|
||||
if (node instanceof HTMLHtmlElement)
|
||||
if (node instanceof Ci.nsIDOMHTMLHtmlElement)
|
||||
data.push(" xmlns=" + XHTML.uri.quote(),
|
||||
" xmlns:dactyl=" + NS.uri.quote());
|
||||
|
||||
@@ -335,8 +335,14 @@ var Help = Module("Help", {
|
||||
if (name == "href") {
|
||||
value = node.href || value;
|
||||
if (value.indexOf("dactyl://help-tag/") == 0) {
|
||||
let uri = services.io.newChannel(value, null, null).originalURI;
|
||||
value = uri.spec == value ? "javascript:;" : uri.path.substr(1);
|
||||
try {
|
||||
let uri = services.io.newChannel(value, null, null).originalURI;
|
||||
value = uri.spec == value ? "javascript:;" : uri.path.substr(1);
|
||||
}
|
||||
catch (e) {
|
||||
util.dump("Magical tag thingy failure for: " + value);
|
||||
dactyl.reportError(e);
|
||||
}
|
||||
}
|
||||
if (!/^#|[\/](#|$)|^[a-z]+:/.test(value))
|
||||
value = value.replace(/(#|$)/, ".xhtml$1");
|
||||
@@ -354,24 +360,26 @@ var Help = Module("Help", {
|
||||
data.push(" />");
|
||||
else {
|
||||
data.push(">");
|
||||
if (node instanceof HTMLHeadElement)
|
||||
if (node instanceof Ci.nsIDOMHTMLHeadElement)
|
||||
data.push(<link rel="stylesheet" type="text/css" href="help.css"/>.toXMLString());
|
||||
Array.map(node.childNodes, fix);
|
||||
data.push("</", node.localName, ">");
|
||||
}
|
||||
break;
|
||||
case Node.TEXT_NODE:
|
||||
case Ci.nsIDOMNode.TEXT_NODE:
|
||||
data.push(<>{node.textContent}</>.toXMLString());
|
||||
}
|
||||
}
|
||||
|
||||
let { buffer, content, events } = modules;
|
||||
let chromeFiles = {};
|
||||
let styles = {};
|
||||
|
||||
for (let [file, ] in Iterator(help.files)) {
|
||||
let url = "dactyl://help/" + file;
|
||||
dactyl.open(url);
|
||||
util.waitFor(function () content.location.href == url && buffer.loaded
|
||||
&& content.document.documentElement instanceof HTMLHtmlElement,
|
||||
&& content.document.documentElement instanceof Ci.nsIDOMHTMLHtmlElement,
|
||||
15000);
|
||||
events.waitForPageLoad();
|
||||
var data = [
|
||||
|
||||
Reference in New Issue
Block a user