1 // ikiwiki's javascript utility function library
4 window.onload = run_hooks_onload;
6 function run_hooks_onload() {
10 function run_hooks(name) {
11 if (typeof(hooks) != "undefined") {
12 for (var i = 0; i < hooks.length; i++) {
13 if (hooks[i].name == name) {
20 function hook(name, call) {
21 if (typeof(hooks) == "undefined")
23 hooks.push({name: name, call: call});
26 function getElementsByClass(cls, node, tag) {
27 if (document.getElementsByClass)
28 return document.getElementsByClass(cls, node, tag);
29 if (! node) node = document;
31 var ret = new Array();
32 var pattern = new RegExp("(^|\\s)"+cls+"(\\s|$)");
33 var els = node.getElementsByTagName(tag);
34 for (i = 0; i < els.length; i++) {
35 if ( pattern.test(els[i].className) ) {