diff --git a/common/content/liberator.js b/common/content/liberator.js index 49b106a4..1bd45690 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -1414,6 +1414,21 @@ const liberator = (function () //{{{ window.liberator = liberator; +// FIXME: Ugly, etc. +window.addEventListener("liberatorHelpLink", function (event) { + let elem = event.target; + liberator.dump(String(elem)); + if (/^(option|mapping|command)$/.test(elem.className)) + var tag = elem.textContent.replace(/\s.*/, ""); + if (elem.className == "command") + tag = tag.replace(/\[.*?\]/g, ""); + if (tag) + var page = liberator.findHelp(tag); + if (page) + elem.href = "chrome://liberator/locale/" + page; + }, + true, true); + // called when the chrome is fully loaded and before the main window is shown window.addEventListener("load", liberator.startup, false); window.addEventListener("unload", liberator.shutdown, false); diff --git a/common/modules/storage.jsm b/common/modules/storage.jsm index c48a0c40..1b6b19a1 100644 --- a/common/modules/storage.jsm +++ b/common/modules/storage.jsm @@ -57,7 +57,7 @@ function Timer(minInterval, maxInterval, callback) }; this.tell = function (arg) { - if (arg !== undefined) + if (arguments.length > 0) this.arg = arg; let now = Date.now(); diff --git a/vimperator/locale/en-US/help.js b/vimperator/locale/en-US/help.js index 8661e34b..ece4273f 100644 --- a/vimperator/locale/en-US/help.js +++ b/vimperator/locale/en-US/help.js @@ -16,13 +16,9 @@ window.addEventListener("message", function (event) { }, true); document.addEventListener("click", function (event) { - let elem = event.target; - if (/^(option|mapping|command)$/.test(elem.className)) - var tag = elem.textContent.replace(/\s.*/, ""); - if (elem.className == "command") - tag = tag.replace(/\[.*?\]/g, ""); - if (tag) - elem.href = "chrome://liberator/content/help.xul?" + encodeURIComponent(tag); + let evt = document.createEvent("UIEvents"); + evt.initEvent("liberatorHelpLink", true, true); + event.target.dispatchEvent(evt); }, true); // vim: set fdm=marker sw=4 ts=4 et: