PageSourceSearch

http://www.jmmc.fr/twiki/pub/TWiki/TWikiJavascripts/twikilib.js

js jmmc.fr collected 2026-10-02 06:39:48 UTC 1,245 bytes, 38 lines download raw bytes

1// TWiki namespace
2if (twiki == undefined) var twiki = {};
3
4twiki.getMetaTag = function(inKey) {
5    if (twiki.metaTags == null || twiki.metaTags.length == 0) {
6        // Do this the brute-force way because of the problem
7        // seen sporadically on Bugs web where the DOM appears complete, but
8        // the META tags are not all found by getElementsByTagName
9        var head = document.getElementsByTagName("META");
10        head = head[0].parentNode.childNodes;
11        twiki.metaTags = new Array();
12        for (var i = 0; i < head.length; i++) {
13            if (head[i].tagName != null &&
14                head[i].tagName.toUpperCase() == 'META') {
15                twiki.metaTags[head[i].name] = head[i].content;
16            }
17        }
18    }
19    return twiki.metaTags[inKey]; 
20};
21
22// Get all elements under root that have the given tag and include the
23// given class
24twiki.getElementsByClassName = function(root, tag, className) {
25	var elms = root.getElementsByTagName(tag);
26	className = className.replace(/\-/g, "\\-");
27	var re = new RegExp("\\b" + className + "\\b");
28	var el;
29	var hits = new Array();
30	for (var i = 0; i < elms.length; i++) {
31		el = elms[i];
32		if (re.test(el.className)) {
33			hits.push(el);
34		}
35	}
36	return hits;
37}
38

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.