PageSourceSearch

https://chessbc.ca/toc.js

js chessbc.ca collected 2026-10-02 23:13:26 UTC 1,518 bytes, 50 lines download raw bytes

1function H_getText(el) {��
2  var text = "";��
3  for (var i = el.firstChild; i != null; i = i.nextSibling) {��
4    if (i.nodeType == 3 /* Node.TEXT_NODE, IE doesn't speak constants */)��
5      text += i.data;��
6    else if (i.firstChild != null)��
7      text += H_getText(i);��
8  }��
9  return text;��
10}��
11��
12function TOC_EL(el, text, level) {��
13  this.element = el;��
14  this.text = text;��
15  this.level = level;��
16}��
17��
18function getHeadlines(el) {��
19  var l = new Array;��
20  var rx = /[hH]([1-6])/;��
21  // internal recursive function that scans the DOM tree��
22  var rec = function (el) {��
23    for (var i = el.firstChild; i != null; i = i.nextSibling) {��
24      if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {��
25        if (rx.exec(i.tagName))��
26          l[l.length] = new TOC_EL(i, H_getText(i), parseInt(RegExp.$1));��
27        rec(i);��
28      }��
29    }��
30  }��
31  rec(el);��
32  return l;��
33}��
34��
35function generate_TOC(parent_id) {��
36  var parent = document.getElementById(parent_id);��
37  var hs = getHeadlines(document.getElementsByTagName("body")[0]);��
38  for (var i = 0; i < hs.length; ++i) {��
39    var hi = hs[i];��
40    var d = document.createElement("div");��
41    if (hi.element.id == "")��
42      hi.element.id = "gen" + i;��
43    var a = document.createElement("a");��
44    a.href = "#" + hi.element.id;��
45    a.appendChild(document.createTextNode(hi.text));��
46    d.appendChild(a);��
47    d.className = "level" + hi.level;��
48    parent.appendChild(d);��
49  }��
50}��

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.