1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-04-10 07:03:40 +02:00

Fix dactyl.initHelp.

--HG--
extra : rebase_source : 5b25fc441e0d0bc7c22820149c73beef4e702e70
This commit is contained in:
Kris Maglione
2011-01-10 12:47:05 -05:00
parent 5de50b67bb
commit 6a0b0c529b

View File

@@ -534,8 +534,14 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
* Initialize the help system. * Initialize the help system.
*/ */
initHelp: function (force) { initHelp: function (force) {
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. // Find help and overlay files with the given name.
function findHelpFile(file) { let findHelpFile = function findHelpFile(file) {
let result = []; let result = [];
for (let [, namespace] in Iterator(namespaces)) { for (let [, namespace] in Iterator(namespaces)) {
let url = ["dactyl://", namespace, "/", file, ".xml"].join(""); let url = ["dactyl://", namespace, "/", file, ".xml"].join("");
@@ -551,18 +557,12 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
return result; return result;
} }
// Find the tags in the document. // Find the tags in the document.
function addTags(file, doc) { let addTags = function addTags(file, doc) {
for (let elem in util.evaluateXPath("//@tag|//dactyl:tags/text()|//dactyl:tag/text()", 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+/))) for (let tag in values((elem.value || elem.textContent).split(/\s+/)))
tagMap[tag] = file; tagMap[tag] = file;
} }
if (!force && !this.helpInitialized) {
if ("noscriptOverlay" in window) {
noscriptOverlay.safeAllow("chrome-data:", true, false);
noscriptOverlay.safeAllow("dactyl:", true, false);
}
var namespaces = ["locale-local", "locale"]; var namespaces = ["locale-local", "locale"];
services["dactyl:"].init({}); services["dactyl:"].init({});