mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-04 20:34:11 +01:00
Fix help link bugs, needs cleanup
This commit is contained in:
@@ -1414,6 +1414,21 @@ const liberator = (function () //{{{
|
|||||||
|
|
||||||
window.liberator = liberator;
|
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
|
// called when the chrome is fully loaded and before the main window is shown
|
||||||
window.addEventListener("load", liberator.startup, false);
|
window.addEventListener("load", liberator.startup, false);
|
||||||
window.addEventListener("unload", liberator.shutdown, false);
|
window.addEventListener("unload", liberator.shutdown, false);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ function Timer(minInterval, maxInterval, callback)
|
|||||||
};
|
};
|
||||||
this.tell = function (arg)
|
this.tell = function (arg)
|
||||||
{
|
{
|
||||||
if (arg !== undefined)
|
if (arguments.length > 0)
|
||||||
this.arg = arg;
|
this.arg = arg;
|
||||||
|
|
||||||
let now = Date.now();
|
let now = Date.now();
|
||||||
|
|||||||
@@ -16,13 +16,9 @@ window.addEventListener("message", function (event) {
|
|||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
document.addEventListener("click", function (event) {
|
document.addEventListener("click", function (event) {
|
||||||
let elem = event.target;
|
let evt = document.createEvent("UIEvents");
|
||||||
if (/^(option|mapping|command)$/.test(elem.className))
|
evt.initEvent("liberatorHelpLink", true, true);
|
||||||
var tag = elem.textContent.replace(/\s.*/, "");
|
event.target.dispatchEvent(evt);
|
||||||
if (elem.className == "command")
|
|
||||||
tag = tag.replace(/\[.*?\]/g, "");
|
|
||||||
if (tag)
|
|
||||||
elem.href = "chrome://liberator/content/help.xul?" + encodeURIComponent(tag);
|
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
// vim: set fdm=marker sw=4 ts=4 et:
|
// vim: set fdm=marker sw=4 ts=4 et:
|
||||||
|
|||||||
Reference in New Issue
Block a user