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