1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-16 14:15:49 +01:00

Fix some errors in :command-complete-custom. Fix some help tags not appearing.

This commit is contained in:
Kris Maglione
2011-01-19 17:54:17 -05:00
parent 067b8d2a6c
commit a0ad529424
10 changed files with 61 additions and 40 deletions

View File

@@ -1103,17 +1103,8 @@ var CommandLine = Module("commandline", {
if (event.type == "click" && (event.target instanceof HTMLAnchorElement ||
event.originalTarget.hasAttributeNS(NS, "command"))) {
let command = event.originalTarget.getAttributeNS(NS, "command");
if (command && event.button == 2)
return PASS;
if (command && dactyl.commands[command]) {
event.preventDefault();
return dactyl.withSavedValues(["forceNewTab"], function () {
dactyl.forceNewTab = event.ctrlKey || event.shiftKey || event.button == 1;
return dactyl.commands[command](event);
});
}
if (event.getPreventDefault())
return;
switch (key) {
case "<LeftMouse>":

View File

@@ -968,6 +968,19 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
}
},
onClick: function onClick(event) {
let command = event.originalTarget.getAttributeNS(NS, "command");
if (command && event.button == 0) {
event.preventDefault();
if (dactyl.commands[command])
dactyl.withSavedValues(["forceNewTab"], function () {
dactyl.forceNewTab = event.ctrlKey || event.shiftKey || event.button == 1;
dactyl.commands[command](event);
});
}
},
/**
* Opens one or more URLs. Returns true when load was initiated, or
* false on error.
@@ -1307,6 +1320,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
return items;
}
}, {
events: function () {
events.addSessionListener(window, "click", dactyl.closure.onClick, true);
},
// Only general options are added here, which are valid for all Dactyl extensions
options: function () {
options.add(["errorbells", "eb"],

View File

@@ -352,6 +352,7 @@
<!-- HTML-ish elements {{{1 -->
<xsl:template match="dactyl:dl" mode="help-2">
<xsl:apply-templates select="@tag" mode="help-1"/>
<dl>
<column style="{@dt}"/>
<column style="{@dd}"/>
@@ -375,7 +376,11 @@
</xsl:otherwise>
</xsl:choose>
<xsl:if test="regexp:match(@topic, '^[a-zA-Z]*:', '')
and not(starts-with(@topic, 'mailto:'))">
and not(starts-with(@topic, 'mailto:') or
starts-with(@topic, 'chrome:') or
starts-with(@topic, 'resource:') or
starts-with(@topic, 'dactyl:'))">
<!-- A regexp does not work for the second test here ↑. :( -->
<xsl:attribute name="rel">external</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="@*|node()" mode="help-1"/>

View File

@@ -422,13 +422,14 @@ var Mappings = Module("mappings", {
<td style="padding-right: 1em;">Command</td>
<td style="padding-right: 1em;">Action</td>
</tr>
<col style="min-width: 6em; padding-right: 1em;"/>
{
template.map(hives, function (hive) let (i = 0)
<tr style="height: .5ex;"/> +
template.map(maps(hive), function (map)
template.map(map.names, function (name)
<tr>
<td highlight="Title" style="padding-right: 1em">{!i++ ? hive.name : ""}</td>
<td highlight="Title">{!i++ ? hive.name : ""}</td>
<td>{modeSign}</td>
<td>{name}</td>
<td>{map.rhs || map.action.toSource()}</td>