1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 22:28:00 +01:00

Show link target with ;;.

This commit is contained in:
Kris Maglione
2011-12-21 22:13:26 -05:00
parent 71048f0970
commit 26ea6fb190
5 changed files with 28 additions and 14 deletions

View File

@@ -180,7 +180,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
setOverLink: util.wrapCallback(function setOverLink(link, b) { setOverLink: util.wrapCallback(function setOverLink(link, b) {
setOverLink.superapply(this, arguments); setOverLink.superapply(this, arguments);
dactyl.triggerObserver("browser.overLink", link); dactyl.triggerObserver("browser.overLink", link);
}), })
} }
}, { }, {
}, { }, {
@@ -204,6 +204,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
function () { function () {
window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils) window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
.redraw(); .redraw();
statusline.overLink = null;
statusline.updateStatus(); statusline.updateStatus();
commandline.clear(); commandline.clear();
}, },

View File

@@ -1939,7 +1939,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
if (dactyl.commandLineOptions.rcFile == "NONE" || dactyl.commandLineOptions.noPlugins) if (dactyl.commandLineOptions.rcFile == "NONE" || dactyl.commandLineOptions.noPlugins)
options["loadplugins"] = []; options["loadplugins"] = [];
if (options["loadplugins"]) if (options["loadplugins"].length)
dactyl.loadPlugins(); dactyl.loadPlugins();
} }
catch (e) { catch (e) {

View File

@@ -110,9 +110,11 @@ var StatusLine = Module("statusline", {
"browser.overLink": function (link) { "browser.overLink": function (link) {
switch (options["showstatuslinks"]) { switch (options["showstatuslinks"]) {
case "status": case "status":
this.overLink = link ? _("status.link", link) : null;
this.status = link ? _("status.link", link) : buffer.uri; this.status = link ? _("status.link", link) : buffer.uri;
break; break;
case "command": case "command":
this.overLink = null;
if (link) if (link)
dactyl.echo(_("status.link", link), commandline.FORCE_SINGLELINE); dactyl.echo(_("status.link", link), commandline.FORCE_SINGLELINE);
else else
@@ -250,7 +252,7 @@ var StatusLine = Module("statusline", {
updateStatus: function updateStatus() { updateStatus: function updateStatus() {
this.timeout(function () { this.timeout(function () {
this.status = buffer.uri; this.status = this.overLink || buffer.uri;
}); });
}, },

View File

@@ -191,11 +191,11 @@ var DOM = Class("DOM", {
this.each(function (elem) { this.each(function (elem) {
while(true) { while(true) {
elem = fn.call(this, elem) elem = fn.call(this, elem)
if (elem instanceof Ci.nsIDOMElement) if (elem instanceof Ci.nsIDOMNode)
res[res.length++] = elem; res[res.length++] = elem;
else if (elem && "length" in elem) else if (elem && "length" in elem)
for (let i = 0; i < tmp.length; i++) for (let i = 0; i < elem.length; i++)
res[res.length++] = tmp[j]; res[res.length++] = elem[j];
else else
break; break;
} }
@@ -256,6 +256,9 @@ var DOM = Class("DOM", {
get siblingsBefore() this.all(function (elem) elem.previousElementSibling), get siblingsBefore() this.all(function (elem) elem.previousElementSibling),
get siblingsAfter() this.all(function (elem) elem.nextElementSibling), 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) ({ get class() let (self = this) ({
toString: function () self[0].className, toString: function () self[0].className,

View File

@@ -317,12 +317,12 @@ var Help = Module("Help", {
.split(" ")); .split(" "));
function fix(node) { function fix(node) {
switch(node.nodeType) { switch(node.nodeType) {
case Node.ELEMENT_NODE: case Ci.nsIDOMNode.ELEMENT_NODE:
if (isinstance(node, [HTMLBaseElement])) if (isinstance(node, [Ci.nsIDOMHTMLBaseElement]))
return; return;
data.push("<"); data.push(node.localName); data.push("<"); data.push(node.localName);
if (node instanceof HTMLHtmlElement) if (node instanceof Ci.nsIDOMHTMLHtmlElement)
data.push(" xmlns=" + XHTML.uri.quote(), data.push(" xmlns=" + XHTML.uri.quote(),
" xmlns:dactyl=" + NS.uri.quote()); " xmlns:dactyl=" + NS.uri.quote());
@@ -335,9 +335,15 @@ var Help = Module("Help", {
if (name == "href") { if (name == "href") {
value = node.href || value; value = node.href || value;
if (value.indexOf("dactyl://help-tag/") == 0) { if (value.indexOf("dactyl://help-tag/") == 0) {
try {
let uri = services.io.newChannel(value, null, null).originalURI; let uri = services.io.newChannel(value, null, null).originalURI;
value = uri.spec == value ? "javascript:;" : uri.path.substr(1); 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)) if (!/^#|[\/](#|$)|^[a-z]+:/.test(value))
value = value.replace(/(#|$)/, ".xhtml$1"); value = value.replace(/(#|$)/, ".xhtml$1");
} }
@@ -354,24 +360,26 @@ var Help = Module("Help", {
data.push(" />"); data.push(" />");
else { else {
data.push(">"); data.push(">");
if (node instanceof HTMLHeadElement) if (node instanceof Ci.nsIDOMHTMLHeadElement)
data.push(<link rel="stylesheet" type="text/css" href="help.css"/>.toXMLString()); data.push(<link rel="stylesheet" type="text/css" href="help.css"/>.toXMLString());
Array.map(node.childNodes, fix); Array.map(node.childNodes, fix);
data.push("</", node.localName, ">"); data.push("</", node.localName, ">");
} }
break; break;
case Node.TEXT_NODE: case Ci.nsIDOMNode.TEXT_NODE:
data.push(<>{node.textContent}</>.toXMLString()); data.push(<>{node.textContent}</>.toXMLString());
} }
} }
let { buffer, content, events } = modules;
let chromeFiles = {}; let chromeFiles = {};
let styles = {}; let styles = {};
for (let [file, ] in Iterator(help.files)) { for (let [file, ] in Iterator(help.files)) {
let url = "dactyl://help/" + file; let url = "dactyl://help/" + file;
dactyl.open(url); dactyl.open(url);
util.waitFor(function () content.location.href == url && buffer.loaded util.waitFor(function () content.location.href == url && buffer.loaded
&& content.document.documentElement instanceof HTMLHtmlElement, && content.document.documentElement instanceof Ci.nsIDOMHTMLHtmlElement,
15000); 15000);
events.waitForPageLoad(); events.waitForPageLoad();
var data = [ var data = [