mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-14 07:55:48 +01:00
Fix some help linking and exporting bugs.
This commit is contained in:
@@ -22,14 +22,7 @@ const nsIProtocolHandler = Components.interfaces.nsIProtocolHandler;
|
||||
const ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService)
|
||||
.getBranch("extensions.dactyl.");
|
||||
|
||||
let channel = Components.classesByID["{61ba33c0-3031-11d3-8cd0-0060b0fc14a3}"]
|
||||
.getService(Ci.nsIProtocolHandler)
|
||||
.newChannel(ioService.newURI("chrome://dactyl/content/data", null, null))
|
||||
.QueryInterface(Ci.nsIRequest);
|
||||
const systemPrincipal = channel.owner;
|
||||
channel.cancel(NS_BINDING_ABORTED);
|
||||
channel = null;
|
||||
const systemPrincipal = Cc["@mozilla.org/systemprincipal;1"].getService(Ci.nsIPrincipal);
|
||||
|
||||
function dataURL(type, data) "data:" + (type || "application/xml;encoding=UTF-8") + "," + escape(data);
|
||||
function makeChannel(url, orig) {
|
||||
@@ -154,6 +147,8 @@ Dactyl.prototype = {
|
||||
return makeChannel(url, uri);
|
||||
case "help-tag":
|
||||
let tag = decodeURIComponent(uri.path.substr(1));
|
||||
if (tag in this.FILE_MAP)
|
||||
return redirect("dactyl://help/" + tag, uri);
|
||||
if (tag in this.HELP_TAGS)
|
||||
return redirect("dactyl://help/" + this.HELP_TAGS[tag] + "#" + tag, uri);
|
||||
}
|
||||
|
||||
@@ -1183,9 +1183,9 @@ const Commands = Module("commands", {
|
||||
function quote(q, list, map) {
|
||||
map = map || Commands.quoteMap;
|
||||
let re = RegExp("[" + list + "]", "g");
|
||||
let res = function (str) q + String.replace(str, re, function ($0) $0 in map ? map[$0] : ("\\" + $0)) + q;
|
||||
res.list = list;
|
||||
return res;
|
||||
function quote(str) q + String.replace(str, re, function ($0) $0 in map ? map[$0] : ("\\" + $0)) + q;
|
||||
quote.list = list;
|
||||
return quote;
|
||||
};
|
||||
|
||||
Commands.quoteArg = {
|
||||
|
||||
@@ -507,13 +507,14 @@ const Dactyl = Module("dactyl", {
|
||||
'<?xml version="1.0"?>\n' +
|
||||
'<?xml-stylesheet type="text/xsl" href="chrome://dactyl/content/help.xsl"?>\n' +
|
||||
'<!DOCTYPE document SYSTEM "chrome://dactyl/content/dactyl.dtd">\n' +
|
||||
unescape(encodeURI( // UTF-8 handling hack.
|
||||
<document xmlns={NS}
|
||||
name="plugins" title={config.appName + " Plugins"}>
|
||||
<h1 tag="using-plugins">Using Plugins</h1>
|
||||
<toc start="2"/>
|
||||
|
||||
{body}
|
||||
</document>.toXMLString();
|
||||
</document>.toXMLString()));
|
||||
fileMap["plugins"] = function () ['text/xml;charset=UTF-8', help];
|
||||
|
||||
addTags("plugins", util.httpGet("dactyl://help/plugins").responseXML);
|
||||
@@ -551,7 +552,7 @@ const Dactyl = Module("dactyl", {
|
||||
function fix(node) {
|
||||
switch(node.nodeType) {
|
||||
case Node.ELEMENT_NODE:
|
||||
if (node instanceof HTMLScriptElement)
|
||||
if (isinstance(node, [HTMLBaseElement, HTMLScriptElement]))
|
||||
return;
|
||||
|
||||
data.push("<"); data.push(node.localName);
|
||||
@@ -565,10 +566,13 @@ const Dactyl = Module("dactyl", {
|
||||
set.add(styles, value);
|
||||
}
|
||||
if (name == "href") {
|
||||
if (value.indexOf("dactyl://help-tag/") == 0)
|
||||
value = services.get("io").newChannel(value, null, null).originalURI.path.substr(1);
|
||||
if (!/[#\/]/.test(value))
|
||||
value += ".xhtml";
|
||||
value = node.href;
|
||||
if (value.indexOf("dactyl://help-tag/") == 0) {
|
||||
let uri = services.get("io").newChannel(value, null, null).originalURI;
|
||||
value = uri.spec == value ? "javascript:;" : uri.path.substr(1);
|
||||
}
|
||||
if (!/^#|[\/](#|$)|^[a-z]+:/.test(value))
|
||||
value = value.replace(/(#|$)/, ".xhtml$1");
|
||||
}
|
||||
if (name == "src" && value.indexOf(":") > 0) {
|
||||
chrome[value] = value.replace(/.*\//, "");;
|
||||
|
||||
@@ -359,7 +359,15 @@
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="dactyl:link" mode="help-2">
|
||||
<a href="{@topic}">
|
||||
<a>
|
||||
<xsl:choose>
|
||||
<xsl:when test="regexp:match(@topic, '^([a-zA-Z]*:|[^/]*#|/)', '')">
|
||||
<xsl:attribute name="href"><xsl:value-of select="@topic"/></xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="href"><xsl:value-of select="concat('dactyl://help-tag/', @topic)"/></xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="regexp:match(@topic, '^[a-zA-Z]*:', '')
|
||||
and not(starts-with(@topic, 'mailto:'))">
|
||||
<xsl:attribute name="rel">external</xsl:attribute>
|
||||
|
||||
@@ -340,7 +340,7 @@ want to bypass &dactyl.appName;'s key handling and pass keys directly to
|
||||
<p>
|
||||
For example, at the URL
|
||||
<tt>http://www.example.com/dir1/dir2/file.htm</tt>,
|
||||
<k>2gu</k> opens <tt>http://www.example.com/dir1/</tt>.
|
||||
2<k>gu</k> opens <tt>http://www.example.com/dir1/</tt>.
|
||||
</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
<p>
|
||||
Scroll window downwards by the amount specified in the
|
||||
<o>scroll</o> option. With <oa>count</oa>, scroll as if
|
||||
<o>scroll</o> were set to <o>count</o>.
|
||||
<o>scroll</o> were set to <oa>count</oa>.
|
||||
</p>
|
||||
</description>
|
||||
</item>
|
||||
@@ -233,7 +233,7 @@
|
||||
<p>
|
||||
Scroll window upwards by the amount specified in the
|
||||
<o>scroll</o> option. With <oa>count</oa>, scroll as if
|
||||
<o>scroll</o> were set to <o>count</o>.
|
||||
<o>scroll</o> were set to <oa>count</oa>.
|
||||
</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<p>
|
||||
Opens the &dactyl.host; addon manager, where extensions and themes
|
||||
may be installed, removed, disabled, and configured. See also
|
||||
<ex>:extensions</ex>, <ex>:extinstall</ex>, <ex>:extoptions</ex>,
|
||||
<ex>:extensions</ex>, <ex>:extadd</ex>, <ex>:extoptions</ex>,
|
||||
<ex>:extenable</ex>, <ex>:extdisable</ex>, and <ex>:extdelete</ex>.
|
||||
</p>
|
||||
</description>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
title="&dactyl.appName; Insert Mode"
|
||||
xmlns="&xmlns.dactyl;"
|
||||
xmlns:html="&xmlns.html;">
|
||||
<h1 tag="Insert-mode Insert mode-insert">Insert mode</h1>
|
||||
<h1 tag="insert-mode insert mode-insert">Insert mode</h1>
|
||||
<toc start="2"/>
|
||||
|
||||
<!-- TODO: This makes no sense. Rewrite. -->
|
||||
|
||||
@@ -264,7 +264,7 @@
|
||||
<p>&dactyl.host; options can be viewed and set with the following commands:</p>
|
||||
|
||||
<item>
|
||||
<tags>:prefs :preferences</tags>
|
||||
<tags>:pref :prefs :preferences</tags>
|
||||
<spec>:pref<oa>erences</oa></spec>
|
||||
<description>
|
||||
<p>
|
||||
@@ -277,7 +277,7 @@
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<tags>:prefs! :preferences!</tags>
|
||||
<tags>:pref! :prefs! :preferences!</tags>
|
||||
<spec>:pref<oa>erences</oa>!</spec>
|
||||
<description>
|
||||
<p>
|
||||
@@ -1401,7 +1401,7 @@
|
||||
|
||||
|
||||
<item>
|
||||
<tags>'verbose', 'vbs'</tags>
|
||||
<tags>'vbs' 'verbose'</tags>
|
||||
<spec>'verbose' 'vbs'</spec>
|
||||
<type>number</type>
|
||||
<default>1</default>
|
||||
|
||||
@@ -178,7 +178,7 @@
|
||||
line, you can use,
|
||||
</p>
|
||||
|
||||
<code><ex>js</ex> <<<em>EOF</em>
|
||||
<code><ex>:js</ex> <<<em>EOF</em>
|
||||
<hl key="Object">var</hl> hello = <hl key="Key">function</hl> () {
|
||||
alert(<str>Hello world</str>);
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ const Util = Module("Util", {
|
||||
* @param {boolean} asIterator Whether to return the results as an
|
||||
* XPath iterator.
|
||||
*/
|
||||
evaluateXPath: (function () {
|
||||
evaluateXPath: update(
|
||||
function evaluateXPath(expression, doc, elem, asIterator) {
|
||||
if (!doc)
|
||||
doc = util.activeWindow.content.document;
|
||||
@@ -296,15 +296,15 @@ const Util = Module("Util", {
|
||||
: function () { for (let i = 0; i < this.snapshotLength; i++) yield this.snapshotItem(i); }
|
||||
}
|
||||
});
|
||||
}
|
||||
evaluateXPath.resolver = function lookupNamespaceURI(prefix) ({
|
||||
xul: XUL.uri,
|
||||
xhtml: XHTML.uri,
|
||||
xhtml2: "http://www.w3.org/2002/06/xhtml2",
|
||||
dactyl: NS.uri
|
||||
}[prefix] || null);
|
||||
return evaluateXPath;
|
||||
})(),
|
||||
},
|
||||
{
|
||||
resolver: function lookupNamespaceURI(prefix) ({
|
||||
xul: XUL.uri,
|
||||
xhtml: XHTML.uri,
|
||||
xhtml2: "http://www.w3.org/2002/06/xhtml2",
|
||||
dactyl: NS.uri
|
||||
}[prefix] || null)
|
||||
}),
|
||||
|
||||
extend: function extend(dest) {
|
||||
Array.slice(arguments, 1).filter(util.identity).forEach(function (src) {
|
||||
|
||||
Reference in New Issue
Block a user