1function adriver(ph, prm, defer){ 2 var my = this, p = ph; 3 if(this instanceof adriver){ 4 if(typeof(p)=='string')p=document.getElementById(ph); 5 else ph=p.id; 6 7 if(!p){ 8 if(!adriver.isDomReady)adriver.onDomReady(function(){new adriver(ph, prm, defer)}); 9 return null 10 } 11 if(adriver(ph))return adriver(ph); 12 13 my.p = p; 14 my.defer = defer; 15 my.prm = adriver.extend(prm, {ph: ph}); 16 17 my.loadCompleteQueue = new adriver.queue(); 18 my.domReadyQueue = new adriver.queue(adriver.isDomReady); 19 20 adriver.initQueue.push(function(){my.init()}); 21 return adriver.items[ph] = my; 22 }else{ 23 return ph ? adriver.items[ph] : adriver.items; 24 } 25} 26 27adriver.prototype = { 28 isLoading: 0, 29 30 init: function(){}, 31 loadComplete: function(){}, 32 domReady: function(){}, 33 34 onLoadComplete: function(f){var my = this; my.loadCompleteQueue.push(function(){f.call(my)}); return my}, 35 onDomReady: function(f){this.domReadyQueue.push(f); return this}, 36 reset: function(){this.loadCompleteQueue.flush(); this.domReadyQueue.flush(adriver.isDomReady); return this} 37} 38 39adriver.extend = function(){ 40 for(var l = arguments[0], i = 1, len = arguments.length, r, j; i<len; i++){ 41 r = arguments[i]; 42 for(j in r){ 43 if(r.hasOwnProperty(j)){ 44 if(r[j] instanceof Function){l[j] = r[j]} 45 else if(r[j] instanceof Object){if(l[j]){adriver.extend(l[j], r[j])}else{l[j] = adriver.extend(r[j] instanceof Array ? [] : {}, r[j])}} 46 else{l[j] = r[j]} 47 } 48 } 49 } 50 return l 51} 52 53adriver.extend(adriver, { 54 version: '2.3.6', 55 56 defaults: {tail256: escape(document.referrer || 'unknown')}, 57 items: {}, 58 options: {}, 59 plugins: {}, 60 pluginPath: {}, 61 62 redirectHost: '//ad.adriver.ru', 63 defaultMirror: '//content.adriver.ru', 64 65 loadScript: function(req){ 66 try { 67 var head = document.getElementsByTagName('head')[0], 68 s = document.createElement('script'); 69 s.setAttribute('type', 'text/javascript'); 70 s.setAttribute('charset', 'windows-1251'); 71 s.setAttribute('src', req.split('![rnd]').join(Math.round(Math.random()*9999999))); 72 s.onreadystatechange = function(){if(/loaded|complete/.test(this.readyState)){s.onload = null;head.removeChild(s)}}; 73 s.onload = function(e){if(head&&s) head.removeChild(s) }; 74 head.insertBefore(s, head.firstChild); 75 }catch(e){} 76 }, 77 78 isDomReady: false, 79 onDomReady: function(f){adriver.domReadyQueue.push(f)}, 80 onBeforeDomReady: function(f){adriver.domReadyQueue.unshift(f)}, 81 domReady: function(){adriver.isDomReady = true; adriver.domReadyQueue.execute()}, 82 checkDomReady: function(f){ 83 try { 84 var d = document, oldOnload = window.onload; 85 if(/WebKit/i.test(navigator.userAgent)){(function(){/loaded|complete/.test(d.readyState) ? f() : setTimeout (arguments.callee, 100)})()} 86 else if(d.addEventListener){d.addEventListener("DOMContentLoaded", f, false)} 87 else if(document.attachEvent){ 88 var doScrollCheck = function() { 89 if ( adriver.isDomReady ) {return;} 90 try { 91 document.documentElement.doScroll("left"); 92 } catch(e) { 93 setTimeout( doScrollCheck, 1 ); 94 return; 95 } 96 f(); 97 } 98 var DOMContentLoaded = function(){ 99 if ( document.readyState === "complete" ) { 100 document.detachEvent( "onreadystatechange", DOMContentLoaded ); 101 f(); 102 } 103 } 104 document.attachEvent( "onreadystatechange", DOMContentLoaded ); 105 window.attachEvent( "onload", function(){if(adriver.isDomReady)return;f();}); 106 try { 107 toplevel = window.frameElement == null; 108 } catch(e) {} 109 if ( document.documentElement.doScroll && toplevel ) { 110 doScrollCheck(); 111 } 112 } 113 } catch (e){} 114 }, 115 116 onLoadComplete: function(f){adriver.loadCompleteQueue.push(f); return adriver}, 117 loadComplete: function(){adriver.loadCompleteQueue.execute(); return adriver}, 118 119 setDefaults: function(o){adriver.extend(adriver.defaults, o)}, 120 setOptions: function(o){adriver.extend(adriver.options, o)}, 121 setPluginPath: function(o){adriver.extend(adriver.pluginPath, o)}, 122 123 queue: function(flag){this.q = []; this.flag = flag ? true: false}, 124 Plugin: function(id){ 125 if(this instanceof adriver.Plugin){ 126 if(id && !adriver.plugins[id]){ 127 this.id = id; 128 this.q = new adriver.queue(); 129 adriver.plugins[id] = this; 130 } 131 } 132 return adriver.plugins[id] 133 } 134}); 135adriver.sync = function(pair, N){ 136 if(!adriver.syncFlag){ 137 adriver.syncFlag = 1; 138 var ar_duo=[];while(N--){ar_duo[N]=N+1};ar_duo.sort(function(){return 0.5-Math.random()}); 139 adriver.synchArray = ar_duo; 140 } 141 return adriver.synchArray[(!pair||pair<=0?1:pair)-1]; 142} 143adriver.queue.prototype = { 144 push: function(f){this.flag ? f(): this.q.push(f)}, 145 unshift: function(f){this.flag ? f(): this.q.unshift(f)}, 146 execute: function(flag){var f; var undefined; while(f=this.q.shift())f(); if(flag == undefined)flag=true; this.flag = flag ? true : false}, 147 flush: function(flag){this.q.length = 0; this.flag = flag ? true: false} 148} 149adriver.Plugin.prototype = { 150 loadingStatus: 0, 151 load: function(){this.loadingStatus = 1; adriver.loadScript((adriver.pluginPath[this.id.split('.').pop()] || (adriver.defaultMirror + '/plugins/')) + this.id + '.js')}, 152 loadComplete: function(){this.loadingStatus = 2; this.q.execute(); return this}, 153 onLoadComplete: function(f){this.q.push(f); return this} 154} 155adriver.Plugin.require = function(){
156 var my = this, counter = 0; 157 my.q = new adriver.queue(); 158 159 for(var i = 0, len = arguments.length, p; i < len; i ++){ 160 p = new adriver.Plugin(arguments[i]); 161 if(p.loadingStatus != 2){ 162 counter++; 163 p.onLoadComplete(function(){if(counter-- == 1)my.q.execute();}); 164 if(!p.loadingStatus)p.load(); 165 } 166 } 167 if(!counter){my.q.execute()} 168} 169adriver.Plugin.require.prototype.onLoadComplete = function(f){this.q.push(f); return this} 170 171adriver.domReadyQueue = new adriver.queue(); 172adriver.loadCompleteQueue = new adriver.queue(); 173adriver.initQueue = new adriver.queue(); 174 175adriver.checkDomReady(adriver.domReady); 176 177new adriver.Plugin.require('autoUpdate.adriver').onLoadComplete(function(){adriver.initQueue.execute()});
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.