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