1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10/* 11 Behaviour v1.1 by Ben Nolan, June 2005. Based largely on the work 12 of Simon Willison (see comments by Simon below). 13 14 Description: 15 16 Uses css selectors to apply javascript behaviours to enable 17 unobtrusive javascript in html documents. 18 19 Usage: 20 21 var myrules = { 22 'b.someclass' : function(element){ 23 element.onclick = function(){ 24 alert(this.innerHTML); 25 } 26 }, 27 '#someid u' : function(element){ 28 element.onmouseover = function(){ 29 this.innerHTML = "BLAH!"; 30 } 31 } 32 }; 33 34 Behaviour.register(myrules); 35 36 // Call Behaviour.apply() to re-apply the rules (if you 37 // update the dom, etc). 38 39 License: 40 41 This file is entirely BSD licensed. 42 43 More information: 44 45 http://ripcord.co.nz/behaviour/ 46 47*/ 48 49var Behaviour = { 50 list : new Array, 51 52 register : function(sheet){ 53 Behaviour.list.push(sheet); 54 }, 55 56 start : function(){ 57 Behaviour.addLoadEvent(function(){ 58 Behaviour.apply(); 59 }); 60 }, 61 62 apply : function(){ 63 for (h=0;sheet=Behaviour.list[h];h++){ 64 for (selector in sheet){ 65 list = document.getElementsBySelector(selector); 66 67 if (!list){ 68 continue; 69 } 70 71 for (i=0;element=list[i];i++){ 72 sheet[selector](element); 73 } 74 } 75 } 76 }, 77 78 addLoadEvent : function(func){ 79 var oldonload = window.onload; 80 81 if (typeof window.onload != 'function') { 82 window.onload = func; 83 } else { 84 window.onload = function() { 85 oldonload(); 86 func(); 87 } 88 } 89 } 90} 91 92Behaviour.start(); 93 94/* 95 The following code is Copyright (C) Simon Willison 2004. 96 97 document.getElementsBySelector(selector) 98 - returns an array of element objects from the current document 99 matching the CSS selector. Selectors can contain element names, 100 class names and ids and can be nested. For example: 101 102 elements = document.getElementsBySelect('div#main p a.external') 103 104 Will return an array of all 'a' elements with 'external' in their 105 class attribute that are contained inside 'p' elements that are 106 contained inside the 'div' element which has id="main" 107 108 New in version 0.4: Support for CSS2 and CSS3 attribute selectors: 109 See http://www.w3.org/TR/css3-selectors/#attribute-selectors 110 111 Version 0.4 - Simon Willison, March 25th 2003 112 -- Works in Phoenix 0.5, Mozilla 1.3, Opera 7, Internet Explorer 6, Internet Explorer 5 on Windows 113 -- Opera 7 fails 114*/ 115 116function getAllChildren(e) { 117 // Returns all children of element. Workaround required for IE5/Windows. Ugh. 118 return e.all ? e.all : e.getElementsByTagName('*'); 119} 120 121document.getElementsBySelector = function(selector) { 122 // Attempt to fail gracefully in lesser browsers 123 if (!document.getElementsByTagName) { 124 return new Array(); 125 } 126 // Split selector in to tokens 127 var tokens = selector.split(' '); 128 var currentContext = new Array(document); 129 for (var i = 0; i < tokens.length; i++) { 130 token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');; 131 if (token.indexOf('#') > -1) { 132 // Token is an ID selector 133 var bits = token.split('#'); 134 var tagName = bits[0]; 135 var id = bits[1]; 136 var element = document.getElementById(id); 137 if (tagName && element.nodeName.toLowerCase() != tagName) { 138 // tag with that ID not found, return false 139 return new Array(); 140 } 141 // Set currentContext to contain just this element 142 currentContext = new Array(element); 143 continue; // Skip to next token 144 } 145 if (token.indexOf('.') > -1) { 146 // Token contains a class selector 147 var bits = token.split('.'); 148 var tagName = bits[0]; 149 var className = bits[1]; 150 if (!tagName) { 151 tagName = '*'; 152 } 153 // Get elements matching tag, filter them for class selector 154 var found = new Array; 155 var foundCount = 0; 156 for (var h = 0; h < currentContext.length; h++) { 157 var elements; 158 if (tagName == '*') { 159 elements = getAllChildren(currentContext[h]); 160 } else { 161 elements = currentContext[h].getElementsByTagName(tagName); 162 } 163 for (var j = 0; j < elements.length; j++) { 164 found[foundCount++] = elements[j]; 165 } 166 } 167 currentContext = new Array; 168 var currentContextIndex = 0; 169 for (var k = 0; k < found.length; k++) { 170 if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) { 171 currentContext[currentContextIndex++] = found[k]; 172 } 173 } 174 continue; // Skip to next token 175 } 176 // Code to deal with attribute selectors 177 if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) { 178 var tagName = RegExp.$1; 179 var attrName = RegExp.$2; 180 var attrOperator = RegExp.$3; 181 var attrValue = RegExp.$4; 182 if (!tagName) { 183 tagName = '*'; 184 } 185 // Grab all of the tagName elements within current context 186 var found = new Array; 187 var foundCount = 0; 188 for (var h = 0; h < currentContext.length; h++) { 189 var elements; 190 if (tagName == '*') { 191 elements = getAllChildren(currentContext[h]); 192 } else { 193 elements = currentContext[h].getElementsByTagName(tagName); 194 } 195 for (var j = 0; j < elements.length; j++) { 196 found[foundCount++] = elements[j]; 197 } 198 } 199 currentContext = new Array; 200 var currentContextIndex = 0; 201 var checkFunction; // This function will be used to filter the elements 202 switch (attrOperator) { 203 case '=': // Equality 204 checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); }; 205 break; 206 case '~': // Match one of space seperated words 207 checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); }; 208 break; 209 case '|': // Match start with value followed by optional hyphen 210 checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); }; 211 break; 212 case '^': // Match starts with value 213 checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); }; 214 break; 215 case '$': // Match ends with value - fails with "Warning" in Opera 7 216 checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); }; 217 break; 218 case '*': // Match ends with value 219 checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); }; 220 break; 221 default : 222 // Just test for existence of attribute 223 checkFunction = function(e) { return e.getAttribute(attrName); }; 224 } 225 currentContext = new Array; 226 var currentContextIndex = 0; 227 for (var k = 0; k < found.length; k++) { 228 if (checkFunction(found[k])) { 229 currentContext[currentContextIndex++] = found[k]; 230 } 231 } 232 // alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue); 233 continue; // Skip to next token 234 } 235 236 if (!currentContext[0]){ 237 return; 238 } 239 240 // If we get here, token is JUST an element (not a class or ID selector) 241 tagName = token; 242 var found = new Array; 243 var foundCount = 0; 244 for (var h = 0; h < currentContext.length; h++) { 245 var elements = currentContext[h].getElementsByTagName(tagName); 246 for (var j = 0; j < elements.length; j++) { 247 found[foundCount++] = elements[j]; 248 } 249 } 250 currentContext = found; 251 } 252 return currentContext; 253} 254
255/* That revolting regular expression explained 256/^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/ 257 \---/ \---/\-------------/ \-------/ 258 | | | | 259 | | | The value 260 | | ~,|,^,$,* or = 261 | Attribute 262 Tag 263*/ 264 265}
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.