diff options
Diffstat (limited to 'xulmus/locale/en-US/help.js')
-rwxr-xr-x | xulmus/locale/en-US/help.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/xulmus/locale/en-US/help.js b/xulmus/locale/en-US/help.js new file mode 100755 index 00000000..ece4273f --- /dev/null +++ b/xulmus/locale/en-US/help.js @@ -0,0 +1,24 @@ + +function checkFragment() +{ + let frag = document.location.hash.substr(1); + if (!frag || document.getElementById(frag)) + return; + let elem = document.evaluate('//*[@class="tag" and text()="' + frag + '"]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0); + if (elem) + window.content.scrollTo(0, elem.getBoundingClientRect().top - 10); // 10px context +} + +document.addEventListener("load", checkFragment, true); +window.addEventListener("message", function (event) { + if (event.data == "fragmentChange") + checkFragment(); +}, true); + +document.addEventListener("click", function (event) { + let evt = document.createEvent("UIEvents"); + evt.initEvent("liberatorHelpLink", true, true); + event.target.dispatchEvent(evt); +}, true); + +// vim: set fdm=marker sw=4 ts=4 et: |