PageSourceSearch

https://www.sustainablehydrogen-cdt.ac.uk/WebResource.axd?d=lE6Q2-…&t=639039891111179092&build=171154

js sustainablehydrogen-cdt.ac.uk collected 2026-10-05 18:24:57 UTC 5,682 bytes, 174 lines download raw bytes

1
2function ContensisElement(htmlElement)
3{
4    if (!htmlElement) { return htmlElement; }  
5    if (!htmlElement.nodeType) { return htmlElement; }
6    if (htmlElement.nodeType != 1) { return htmlElement; }
7         
8    if (htmlElement.IsContensisElement) { return htmlElement; }    
9    
10    window.CCN.RegisterElement(htmlElement)
11    window.CCN.RegisterExtension(htmlElement, 'IsContensisElement');
12    htmlElement.IsContensisElement = true;
13    
14    window.CCN.RegisterExtension(htmlElement, 'get_ClassRegEx');
15    htmlElement.get_ClassRegEx = function(className) { return "(^|\\s)" + className + "(\\s|$)"; };
16    
17    window.CCN.RegisterExtension(htmlElement, 'HasClass');
18    htmlElement.HasClass = function(className){
19        var elClass = this.className;
20        if (elClass.length == 0) { return false; }
21        if (elClass == className) { return true; }
22        var reg = new RegExp(this.get_ClassRegEx(className));
23        return reg.test(elClass);
24    };
25    
26    window.CCN.RegisterExtension(htmlElement, 'AddClass');
27    htmlElement.AddClass = function(className){
28        if (!this.HasClass(className))
29        {
30            var elClass = this.className;
31            if (elClass) { elClass += ' '; }
32            elClass += className;
33            this.className = elClass;                        
34        }
35    };
36    
37    window.CCN.RegisterExtension(htmlElement, 'RemoveClass');
38    htmlElement.RemoveClass = function(className){
39        if (this.HasClass(className))
40        {
41            var elClass = this.className;
42            var reg = new RegExp(this.get_ClassRegEx(className));
43            elClass = elClass.replace(reg, ' ');
44            elClass = elClass.Trim();
45            this.className = elClass;            
46        }
47    };
48    
49    window.CCN.RegisterExtension(htmlElement, 'ToggleClass');
50    htmlElement.ToggleClass = function(className){
51        if (this.HasClass(className))
52        {
53            this.RemoveClass(className);
54        }
55        else 
56        {
57            this.AddClass(className);
58        }
59    };
60    //htmlElement.___getElementsByTagName = htmlElement.getElementsByTagName;
61    
62    window.CCN.RegisterExtension(htmlElement, 'getElementsByTag');
63    htmlElement.getElementsByTag = function(tagName){
64        var elements = this.getElementsByTagName(tagName);
65        var result = [];
66        for (var i=0; i<elements.length; i++)
67        {
68            result[result.length] = ContensisElement(elements[i]);
69        }
70        return result;
71    };
72    
73    window.CCN.RegisterExtension(htmlElement, 'getParentByTagName');
74    htmlElement.getParentByTagName = function(tagName){
75        var el = this.parentNode;
76        while (el)
77        {
78            if (!el.tagName) { return; }
79            if (el.tagName.toUpperCase() == tagName.toUpperCase()) { break; }
80            el = el.parentNode;
81        }
82        return ContensisElement(el);
83    };   
84    
85    window.CCN.RegisterExtension(htmlElement, 'getParentElement');
86    htmlElement.getParentElement = function(){
87        return ContensisElement(this.parentNode);
88    }; 
89    
90    window.CCN.RegisterExtension(htmlElement, 'getChildNodes');
91    htmlElement.getChildNodes = function(){
92        var children = this.childNodes;
93        var result = [];
94        for (var i=0; i<children.length; i++)
95        {
96            result[result.length] = ContensisElement(children[i]);
97        }
98        return result;
99    };
100    
101    window.CCN.RegisterExtension(htmlElement, 'Clone');
102    htmlElement.Clone = function(){
103        return ContensisElement(this.cloneNode(true));
104    };
105    
106    if (htmlElement.tagName == 'TABLE') { ContensisTable(htmlElement); }
107    if (htmlElement.tagName == 'TBODY') { ContensisTableBody(htmlElement); }
108    if (htmlElement.tagName == 'TR') { ContensisTableRow(htmlElement); }
109    
110    return htmlElement;
111}
112
113function ContensisTable(htmlTable)
114{
115    window.CCN.RegisterExtension(htmlTable, 'getRows');
116    htmlTable.getRows = function(){
117        var rows = this.rows;
118        var result = [];
119        for (var i=0; i<rows.length; i++)
120        {
121            result[result.length] = ContensisElement(rows[i]);
122        }
123        return result;
124    };
125    
126    window.CCN.RegisterExtension(htmlTable, 'getBodies');
127    htmlTable.getBodies = function(){
128        var bodies = this.tBodies;
129        var result = [];
130        for (var i=0; i<bodies.length; i++)
131        {
132            result[result.length] = ContensisElement(bodies[i]);
133        }
134        return result;
135    };
136    
137    window.CCN.RegisterExtension(htmlTable, 'getHead');
138    htmlTable.getHead = function(){
139        return ContensisElement(htmlTable.tHead);
140    };
141    
142    window.CCN.RegisterExtension(htmlTable, 'getFoot');
143    htmlTable.getFoot = function(){
144        return ContensisElement(htmlTable.tFoot);
145    };
146}
147
148function ContensisTableBody(htmlTable)
149{
150    window.CCN.RegisterExtension(htmlTable, 'getRows');
151    htmlTable.getRows = function(){
152        var rows = this.rows;
153        var result = [];
154        for (var i=0; i<rows.length; i++)
155        {
156            result[result.length] = ContensisElement(rows[i]);
157        }
158        return result;
159    };
160}    
161
162function ContensisTableRow(htmlRow)
163{
164    window.CCN.RegisterExtension(htmlRow, 'getCells');
165    htmlRow.getCells = function(){
166        var cells = this.cells;
167        var result = [];
168        for (var i=0; i<cells.length; i++)
169        {
170            result[result.length] = ContensisElement(cells[i]);
171        }
172        return result;
173    }
174}

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.