mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-03 23:55:55 +01:00
Fix dactyl.initHelp.
--HG-- extra : rebase_source : 5b25fc441e0d0bc7c22820149c73beef4e702e70
This commit is contained in:
@@ -534,35 +534,35 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
* Initialize the help system.
|
||||
*/
|
||||
initHelp: function (force) {
|
||||
// Find help and overlay files with the given name.
|
||||
function findHelpFile(file) {
|
||||
let result = [];
|
||||
for (let [, namespace] in Iterator(namespaces)) {
|
||||
let url = ["dactyl://", namespace, "/", file, ".xml"].join("");
|
||||
let res = util.httpGet(url);
|
||||
if (res) {
|
||||
if (res.responseXML.documentElement.localName == "document")
|
||||
fileMap[file] = url;
|
||||
if (res.responseXML.documentElement.localName == "overlay")
|
||||
overlayMap[file] = url;
|
||||
result.push(res.responseXML);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Find the tags in the document.
|
||||
function addTags(file, doc) {
|
||||
for (let elem in util.evaluateXPath("//@tag|//dactyl:tags/text()|//dactyl:tag/text()", doc))
|
||||
for (let tag in values((elem.value || elem.textContent).split(/\s+/)))
|
||||
tagMap[tag] = file;
|
||||
}
|
||||
|
||||
if (!force && !this.helpInitialized) {
|
||||
if ("noscriptOverlay" in window) {
|
||||
noscriptOverlay.safeAllow("chrome-data:", true, false);
|
||||
noscriptOverlay.safeAllow("dactyl:", true, false);
|
||||
}
|
||||
|
||||
// Find help and overlay files with the given name.
|
||||
let findHelpFile = function findHelpFile(file) {
|
||||
let result = [];
|
||||
for (let [, namespace] in Iterator(namespaces)) {
|
||||
let url = ["dactyl://", namespace, "/", file, ".xml"].join("");
|
||||
let res = util.httpGet(url);
|
||||
if (res) {
|
||||
if (res.responseXML.documentElement.localName == "document")
|
||||
fileMap[file] = url;
|
||||
if (res.responseXML.documentElement.localName == "overlay")
|
||||
overlayMap[file] = url;
|
||||
result.push(res.responseXML);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Find the tags in the document.
|
||||
let addTags = function addTags(file, doc) {
|
||||
for (let elem in util.evaluateXPath("//@tag|//dactyl:tags/text()|//dactyl:tag/text()", doc))
|
||||
for (let tag in values((elem.value || elem.textContent).split(/\s+/)))
|
||||
tagMap[tag] = file;
|
||||
}
|
||||
|
||||
var namespaces = ["locale-local", "locale"];
|
||||
services["dactyl:"].init({});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user