PageSourceSearch

https://www.ipol.im/ikiwiki/ikiwiki.js

js ipol.im collected 2026-10-02 04:04:21 UTC 1,301 bytes, 54 lines download raw bytes

1// ikiwiki's javascript utility function library
2
3var hooks;
4
5// Run onload as soon as the DOM is ready, if possible.
6// gecko, opera 9
7if (document.addEventListener) {
8	document.addEventListener("DOMContentLoaded", run_hooks_onload, false);
9}
10// other browsers
11window.onload = run_hooks_onload;
12
13var onload_done = 0;
14
15function run_hooks_onload() {
16	// avoid firing twice
17	if (onload_done)
18		return;
19	onload_done = true;
20
21	run_hooks("onload");
22}
23
24function run_hooks(name) {
25	if (typeof(hooks) != "undefined") {
26		for (var i = 0; i < hooks.length; i++) {
27			if (hooks[i].name == name) {
28				hooks[i].call();
29			}
30		}
31	}
32}
33
34function hook(name, call) {
35	if (typeof(hooks) == "undefined")
36		hooks = new Array;
37	hooks.push({name: name, call: call});
38}
39
40function getElementsByClass(cls, node, tag) {
41        if (document.getElementsByClass)
42                return document.getElementsByClass(cls, node, tag);
43        if (! node) node = document;
44        if (! tag) tag = '*';
45        var ret = new Array();
46        var pattern = new RegExp("(^|\\s)"+cls+"(\\s|$)");
47        var els = node.getElementsByTagName(tag);
48        for (i = 0; i < els.length; i++) {
49                if ( pattern.test(els[i].className) ) {
50                        ret.push(els[i]);
51                }
52        }
53        return ret;
54}

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.