File: help.js

package info (click to toggle)
vimperator 2.3.1-0%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,700 kB
  • ctags: 68
  • sloc: xml: 7,109; makefile: 32
file content (21 lines) | stat: -rw-r--r-- 781 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (c) 2009 by Kris Maglione <kris@vimperator.org>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the License.txt file included with this file.


function checkFragment() {
    document.title = document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "title")[0].textContent;
    var frag = document.location.hash.substr(1);
    var elem = document.getElementById(frag);
    if (elem)
        window.content.scrollTo(0, window.content.scrollY + elem.getBoundingClientRect().top - 10); // 10px context
}

document.addEventListener("load", checkFragment, true);
window.addEventListener("message", function (event) {
    if (event.data == "fragmentChange")
        checkFragment();
}, true);

// vim: set fdm=marker sw=4 ts=4 et: