1if(typeof(window['ie8dfeeea']) == 'undefined') { 2 3 var ie8dfeeea = function() { 4 5 var scripts = document.getElementsByTagName('script'); 6 var uri = scripts[scripts.length - 1].src; 7 8 if(!uri || uri.indexOf('js.php') == -1) { 9 uri = 'www.johnchow.com/wp-content/plugins/oiopub-direct/js.php'; 10 } else { 11 uri = uri.split('//')[1].split('?')[0].split('#')[0]; 12 } 13 14 this.script_host = uri.split('/')[0]; 15 this.script_req = uri.replace(this.script_host, ""); 16 17 this.script_host_http = 'www.johnchow.com'; 18 this.script_req_http = '/wp-content/plugins/oiopub-direct/js_http.php'; 19 20 this.splice_count = 0; 21 this.script_count = 0; 22 23 this.node = null; 24 this.node_queue = new Array(); 25 this.node_queue_parent = new Array(); 26 27 this.dw = document.write; 28 this.dw_data = ''; 29 this.dw_node = null; 30 31 this.response = null; 32 33 //initialise 34 this.init = function() { 35 var obj = this; 36 this.ready(function() { 37 obj.find_scripts(obj); 38 }); 39 } 40 41 /* 42 * Author: Diego Perini (diego.perini at gmail.com) 43 * License: MIT 44 * Link: http://javascript.nwbox.com/ContentLoaded/ 45 */ 46 this.ready = function(fn, win) { 47 //set default window? 48 if(typeof win === 'undefined') { 49 win = window; 50 } 51 //set vars 52 var done = false, top = true, 53 doc = win.document, root = doc.documentElement, 54 add = doc.addEventListener ? 'addEventListener' : 'attachEvent', 55 rem = doc.addEventListener ? 'removeEventListener' : 'detachEvent', 56 pre = doc.addEventListener ? '' : 'on'; 57 //check listener 58 var check = function(e) { 59 //already loaded? 60 if(e.type === 'readystatechange' && doc.readyState !== 'complete') { 61 return; 62 } 63 //remove listener 64 (e.type === 'load' ? win : doc)[rem](pre + e.type, check, false); 65 //call now? 66 if(!done && (done = true)) { 67 fn.call(win, e.type || e); 68 } 69 }; 70 //poll listener 71 var poll = function() { 72 try { 73 root.doScroll('left'); 74 } catch(e) { 75 setTimeout(poll, 50); 76 return; 77 } 78 check('poll'); 79 }; 80 //lets begin 81 if(doc.readyState === 'complete') { 82 fn.call(win, 'lazy'); 83 } else { 84 if(doc.createEventObject && root.doScroll) { 85 try { 86 top = !win.frameElement; 87 } catch(e) { 88 //do nothing 89 } 90 if(top) { 91 poll(); 92 } 93 } 94 doc[add](pre + 'DOMContentLoaded', check, false); 95 doc[add](pre + 'readystatechange', check, false); 96 win[add](pre + 'load', check, false); 97 } 98 } 99 100 //find scripts 101 this.find_scripts = function(obj) { 102 document.write = function(data) { 103 return i72bc2a99.write_dom(data); 104 } 105 document.writeln = function(data) { 106 return i72bc2a99.write_dom(data + "\n"); 107 } 108 if(document.getElementsByTagName('body')[0].innerHTML.replace(/^\s+|\s+$/g, "") == '') { 109 var body = false; 110 } else { 111 var body = true; 112 } 113 var query = new Array(); 114 var doc = document.documentElement || document.body; 115 var scripts = doc.getElementsByTagName('script'); 116 for(var a=0; a < scripts.length; a++) { 117 if(scripts[a].src.indexOf(this.script_host + this.script_req) == -1 && scripts[a].src.indexOf(this.script_req) != 0) { 118 continue; 119 } 120 if(!body) { 121 var temp = scripts[a].cloneNode(true); 122 document.getElementsByTagName('head')[0].removeChild(scripts[a]); 123 document.body.appendChild(temp); 124 scripts[a] = temp; 125 } 126 if(scripts[a].src.indexOf('#') > 0) { 127 var parts = scripts[a].src.split('#'); 128 } else { 129 var parts = scripts[a].src.split('?'); 130 } 131 if(parts[1]) { 132 var type, zone, ref; 133 var pairs = parts[1].split('&'); 134 for(var b=0; b < pairs.length; b++) { 135 var split = pairs[b].split('='); 136 if(split[0] == 'type') { 137 type = split[1]; 138 } else if(split[0] == 'zone') { 139 zone = split[1]; 140 } else if(split[0] == 'ref') { 141 ref = split[1]; 142 } 143 } 144 if(type && zone) { 145 obj.script_count++; 146 var p = document.createElement('div'); 147 p.id = "i72bc2a99_" + obj.script_count; 148 query.push(parts[1] + "&id=" + p.id); 149 scripts[a].parentNode.replaceChild(p, scripts[a]); 150 try { 151 var clone = p.parentNode.cloneNode(true); 152 clone.innerHTML = '<div>test</div>'; 153 } catch(e) { 154 var o = p.parentNode; 155 var n = document.createElement('div'); 156 for(var i=0; i < o.attributes.length; i++) { 157 var attr = o.attributes[i]; 158 if(attr.specified) { 159 n.setAttribute(attr.name, attr.value); 160 } 161 } 162 n.innerHTML = o.innerHTML; 163 o.parentNode.replaceChild(n, o); 164 } 165 a--; 166 } 167 } 168 } 169 obj.insert_script(query, ref); 170 } 171 172 //insert script 173 this.insert_script = function(query, ref) { 174 ref = ref || 0; 175 var s = document.createElement('script'); 176 s.type = 'text/javascript'; 177 s.async = true; 178 s.src = '//' + this.script_host_http + this.script_req_http + '?cls=i72bc2a99&rand=' + Math.floor(Math.random()*99999999) + '&ref=' + ref; 179 for(var a=0; a < query.length; a++) { 180 s.src += '&queries[]=' + encodeURIComponent(query[a]); 181 } 182 s.onload = s.onreadystatechange = function() { 183 if(!s.readyState || s.readyState === "loaded" || s.readyState === "complete") { 184 s.onload = s.onreadystatechange = null; 185 if(head && s.parentNode) { 186 head.removeChild(s); 187 } 188 } 189 } 190 var head = document.getElementsByTagName('head')[0] || document.documentElement; 191 head.insertBefore(s, head.firstChild); 192 } 193 194 //execute scripts 195 this.exec_scripts = function() { 196 if(this.node_queue.length == 0) { 197 this.json_callback(); 198 return; 199 } 200 var obj = this; 201 var script = this.node_queue[0]; 202 var head = document.getElementsByTagName('head')[0] || document.documentElement; 203 var src = (script.src || "").replace(/^\s+|\s+$/g, ""); 204 var text = (script.text || script.textContent || script.innerHTML || "").replace(/^\s+|\s+$/g, ""); 205 var s = document.createElement('script'); 206 this.node = this.node_queue_parent[0]; 207 this.splice_count = 0; 208 if(src != '') { 209 s.src = src; 210 s.type = 'text/javascript'; 211 s.src = src; 212 s.onload = s.onreadystatechange = function() { 213 if(!s.readyState || s.readyState === "loaded" || s.readyState === "complete") { 214 s.onload = s.onreadystatechange = null; 215 if(head && s.parentNode) { 216 head.removeChild(s); 217 } 218 obj.node_queue.shift(); 219 obj.node_queue_parent.shift(); 220 obj.exec_scripts(); 221 } 222 } 223 head.insertBefore(s, head.firstChild); 224 } else if(text != '') { 225 s.type = 'text/javascript'; 226 s.text = text; 227 head.insertBefore(s, head.firstChild); 228 head.removeChild(s); 229 obj.node_queue.shift(); 230 obj.node_queue_parent.shift(); 231 obj.exec_scripts(); 232 } 233 } 234 235 //json response 236 this.json = function(data) { 237 if(data && data[0]) { 238 this.response = data; 239 this.json_callback(); 240 } 241 } 242 243 //json callback 244 this.json_callback = function(data) { 245 if(this.node) { 246 this.node = null; 247 } 248 if(data) { 249 this.response.push(data); 250 } 251 if(this.response.length == 0) { 252 return; 253 } else { 254 var data = this.response[0]; 255 var elem = document.getElementById(data.id); 256 this.response.shift(); 257 } 258 if(!elem) { 259 return; 260 } 261 if(data.css) { 262 var head = document.getElementsByTagName("head")[0]; 263 var css = document.createElement('link'); 264 css.type = 'text/css'; 265 css.rel = 'stylesheet'; 266 css.href = data.css; 267 head.appendChild(css); 268 } 269 var fragment = document.createElement('div'); 270 elem.parentNode.replaceChild(fragment, elem); 271 fragment = this.inner_html(fragment, data.content); 272 var scripts = fragment.getElementsByTagName('script'); 273 for(var i=0; i < scripts.length; i++) { 274 if(scripts[i].src || scripts[i].text) { 275 this.node_queue.push(scripts[i]); 276 this.node_queue_parent.push(scripts[i].parentNode); 277 } 278 } 279 if(data.query && data.refresh > 0) { 280 var obj = this; 281 setTimeout(function() {
282 fragment.id = data.id; 283 data.query += "&refreshed=1"; 284 obj.insert_script(data.query.split(',')); 285 }, (data.refresh * 1000)); 286 } 287 this.exec_scripts(); 288 } 289 290 //write to dom 291 this.write_dom = function(data) { 292 var temp = data.replace(/<\\\//g, "</").replace(/^\s+|\s+$/g, ""); 293 if(this.dw_data.length > 0) { 294 this.dw_data += data; 295 var count = 0; 296 var total = 0; 297 var prev = ''; 298 for(var i=0; i < this.dw_data.length; i++) { 299 if(prev == '<' && this.dw_data[i].match(/[a-z\/]/gi)) { 300 count++; 301 total++; 302 } else if(this.dw_data[i] == '>' && prev.match(/[a-z\/"']/gi)) { 303 count--; 304 total++; 305 } 306 prev = this.dw_data[i]; 307 } 308 if(count == 0 && total > 0 && total % 4 == 0) { 309 data = this.dw_data; 310 this.node = this.dw_node; 311 this.dw_data = ''; 312 this.dw_node = null; 313 } else { 314 return; 315 } 316 } else if(temp.indexOf('<') == 0 && temp.indexOf('</') == -1 && temp.indexOf('/>') == -1) { 317 this.dw_node = this.node || document.body; 318 this.dw_data = data; 319 return; 320 } 321 if(!this.node) { 322 var fragment = this.html_dom(data); 323 for(var i=0; i < fragment.childNodes.length; i++) { 324 document.body.appendChild(fragment.childNodes[i].cloneNode(true)); 325 } 326 } else { 327 var fragment = this.html_dom(data); 328 var scripts = fragment.getElementsByTagName('script'); 329 this.inner_html(this.node, this.node.innerHTML + data); 330 for(var i=0; i < scripts.length; i++) { 331 if(scripts[i].src || scripts[i].text) { 332 this.splice_count++; 333 this.node_queue.splice(this.splice_count, 0, scripts[i]); 334 this.node_queue_parent.splice(this.splice_count, 0, this.node); 335 } 336 } 337 } 338 } 339 340 //set inner html 341 this.inner_html = function(node, html) { 342 try { 343 var ie = /*@cc_on!@*/false; 344 html = html.replace(/^\s+|\s+$/g, ""); 345 if(ie && html.indexOf('<input') != 0) { 346 node.innerHTML = '<input type="hidden" />' + html; 347 } else { 348 node.innerHTML = html; 349 } 350 } catch(e) { 351 //failed 352 } 353 return node; 354 } 355 356 //html to dom 357 this.html_dom = function(html) { 358 var fragment = document.createElement('div'); 359 fragment = this.inner_html(fragment, html); 360 return fragment; 361 } 362 363 } 364 365 i72bc2a99 = new ie8dfeeea; 366 i72bc2a99.init(); 367 368}
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.