1var trackbar = { 2 archive : {}, 3 getObject : function(id) { 4 if (typeof this.archive[id] == "undefined") { 5 this.archive[id] = new this.hotSearch(id); 6 } 7 return this.archive[id]; 8 } 9}; 10 11trackbar.hotSearch = function(id) { // Constructor 12 // Vars 13 this.id = id; 14 15 this.leftWidth = 0; // px 16 this.rightWidth = 0; // px 17 this.width = 0; // px 18 this.intervalWidth = 0; // px 19 20 this.leftLimit = 0; 21 this.leftValue = 0; 22 this.rightLimit = 0; 23 this.rightValue = 0; 24 this.valueInterval = 0; 25 this.widthRem = 6; 26 this.valueWidth = 0; 27 this.roundUp = 0; 28 29 this.x0 = 0; this.y0 = 0; 30 this.blockX0 = 0; 31 this.rightX0 = 0; 32 this.leftX0 = 0; 33 // Flags 34 this.dual = true; 35 this.moveState = false; 36 this.moveIntervalState = false; 37 this.debugMode = false; 38 this.clearLimits = false; 39 this.clearValues = false; 40 this.nodeInit = false; 41 // Handlers 42 this.onMove = null; 43 // Nodes 44 this.leftBlock = null; 45 this.rightBlock = null; 46 this.leftBegun = null; 47 this.rightBegun = null; 48 this.centerBlock = null; 49 this.itWasMove = false; 50} 51 52trackbar.hotSearch.prototype = { 53// Const 54/* WHAT IS IT??? IE does not work with it 55 ERRORS : { 56 1 : "Îøèáêà ïðè èíèöèàëèçàöèè îáúåêòà", 57 2 : "Ëåâûé áåãóíîê íå íàéäåí", 58 3 : "Ïðàâûé áåãóíîê íå íàéäåí", 59 4 : "Ëåâàÿ îáëàñòü ðåñàéçà íå íàéäåíà", 60 5 : "Ïðàâàÿ îáëàñòü ðåñàéçà íå íàéäåíà", 61 6 : "Íå çàäàíà øèðèíà îáëàñòè áåãóíêà", 62 7 : "Íå óêàçàíî ìàêñèìàëüíîå èçìåíÿåìîå çíà÷åíèå", 63 8 : "Íå óêàçàíà ôóíêöèÿ-îáðàáîò÷èê çíà÷åíèé", 64 9 : "Íå óêàçàíà îáëàñòü êëèêà" 65 }, 66*/ 67 LEFT_BLOCK_PREFIX : "leftBlock_", 68 RIGHT_BLOCK_PREFIX : "rightBlock_", 69 LEFT_BEGUN_PREFIX : "leftBegun_", 70 RIGHT_BEGUN_PREFIX : "rightBegun_", 71 CENTER_BLOCK_PREFIX : "centerBlock_", 72// Methods 73 // Default 74 gebi : function(id) { 75 return document.getElementById(id); 76 }, 77 addHandler : function(object, event, handler, useCapture) { 78 if (object.addEventListener) { 79 object.addEventListener(event, handler, useCapture ? useCapture : false); 80 } else if (object.attachEvent) { 81 object.attachEvent('on' + event, handler); 82 } else alert(this.errorArray[9]); 83 }, 84 defPosition : function(event) { 85 var x = y = 0; 86 if (document.attachEvent != null) { 87 x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft; 88 y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop; 89 } 90 if (!document.attachEvent && document.addEventListener) { // Gecko 91 x = event.clientX + window.scrollX; 92 y = event.clientY + window.scrollY; 93 } 94 return {x:x, y:y}; 95 }, 96 absPosition : function(obj) { 97 var x = y = 0; 98 while(obj) { 99 x += obj.offsetLeft; 100 y += obj.offsetTop; 101 obj = obj.offsetParent; 102 } 103 return {x:x, y:y}; 104 }, 105 /* 106 Method domReady - Copyright http://ajaxian.com/ 107 More fun with DOMContentLoaded 108 http://ajaxian.com/archives/more-fun-with-domcontentloaded 109 */ 110 domReady : function(i) { 111 var u =navigator.userAgent; 112 var e=/*@cc_on!@*/false; 113 var st = setTimeout; 114 if (/webkit/i.test(u)) { 115 st( 116 function() { 117 var dr=document.readyState; 118 if(dr=="loaded"||dr=="complete"){ 119 i() 120 } else { 121 st(arguments.callee,10); 122 } 123 }, 124 10 125 ); 126 } else if ((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))) { 127 document.addEventListener("DOMContentLoaded", i, false); 128 } else if (e) {( 129 function(){ 130 var t=document.createElement('doc:rdy'); 131 try { 132 t.doScroll('left'); 133 i(); 134 t=null; 135 } catch(e) { 136 st(arguments.callee,0); 137 } 138 })(); 139 } else { 140 window.onload=i; 141 } 142 }, 143 // Common 144 debug : function(keys) { 145 if (!this.debugMode) return; 146 var mes = ""; 147 for (var i = 0; i < keys.length; i++) mes += this.ERRORS[keys[i]] + " : "; 148 mes = mes.substring(0, mes.length - 3); 149 alert(mes); 150 }, 151 init : function(hash, node) { 152 if (typeof node != "undefined" && !this.nodeInit) { 153 this.nodeInit = true; 154 var _this = this; 155 this.domReady( 156 function() {_this.init(hash, node)} 157 ); 158 return; 159 } 160 if (typeof node == "string") node = this.gebi(node); 161 else node = false; 162 try { 163 this.dual = typeof hash.dual != "undefined" ? !!hash.dual : this.dual;
164 this.leftLimit = hash.leftLimit || this.leftLimit; 165 this.rightLimit = hash.rightLimit || this.rightLimit; 166 this.width = hash.width || this.width; 167 this.onMove = hash.onMove || this.onMove; 168 this.clearLimits = hash.clearLimits || this.clearLimits; 169 this.clearValues = hash.clearValues || this.clearValues; 170 this.roundUp = hash.roundUp || this.roundUp; 171 // HTML Write 172 var code = '<table' + (this.width ? ' style="width:'+this.width+'px;"' : '') + 'class="trackbar" onSelectStart="return false;" border="0">\ 173 <tr>\ 174 <td class="l"><div id="leftBlock_' + this.id + '"><span></span><span class="limit"></span><img id="leftBegun_' + this.id + '" ondragstart="return false;" src="' + NC_PLUGIN_URL + '/wp-notcaptcha/imgtrackbar/b_l.gif" width="5" height="17" alt="" /></div></td>\ 175 <td class="c" id="centerBlock_' + this.id + '"></td>\ 176 <td class="r"><div id="rightBlock_' + this.id + '"><span></span><span class="limit"></span><img id="rightBegun_' + this.id + '" ondragstart="return false;" src="' + NC_PLUGIN_URL + '/wp-notcaptcha/imgtrackbar/b_r.gif" width="5" height="17" alt="" /></div></td>\ 177 </tr>\ 178 </table>'; 179 if (node) node.innerHTML = code; 180 else document.write(code) 181 // Is all right? 182 if (this.onMove == null) { 183 this.debug([1,8]); 184 return; 185 } 186 // --- 187 this.leftBegun = this.gebi(this.LEFT_BEGUN_PREFIX + this.id); 188 if (this.leftBegun == null) { 189 this.debug([1,2]); 190 return; 191 } 192 this.rightBegun = this.gebi(this.RIGHT_BEGUN_PREFIX + this.id); 193 if (this.rightBegun == null) { 194 this.debug([1,3]); 195 return; 196 } 197 this.leftBlock = this.gebi(this.LEFT_BLOCK_PREFIX + this.id); 198 if (this.leftBlock == null) { 199 this.debug([1,4]); 200 return; 201 } 202 this.rightBlock = this.gebi(this.RIGHT_BLOCK_PREFIX + this.id); 203 if (this.rightBlock == null) { 204 this.debug([1,5]); 205 return; 206 } 207 this.centerBlock = this.gebi(this.CENTER_BLOCK_PREFIX + this.id); 208 if (this.centerBlock == null) { 209 this.debug([1,9]); 210 return; 211 } 212 // --- 213 if (!this.width) { 214 this.debug([1,6]); 215 return; 216 } 217 if (!this.rightLimit) { 218 this.debug([1,7]); 219 return; 220 } 221 // Set default 222 this.valueWidth = this.width - 2 * this.widthRem; 223 this.rightValue = hash.rightValue || this.rightLimit; 224 this.leftValue = hash.leftValue || this.leftLimit; 225 if (!this.dual) this.rightValue = this.leftValue; 226 this.valueInterval = this.rightLimit - this.leftLimit; 227 this.leftWidth = parseInt((this.leftValue - this.leftLimit) / this.valueInterval * this.valueWidth) + this.widthRem; 228 this.rightWidth = this.valueWidth - parseInt((this.rightValue - this.leftLimit) / this.valueInterval * this.valueWidth) + this.widthRem; 229 // Set limits 230 if (!this.clearLimits) { 231 this.leftBlock.firstChild.nextSibling.innerHTML = this.leftLimit; 232 this.rightBlock.firstChild.nextSibling.innerHTML = this.rightLimit; 233 } 234 // Do it! 235 this.setCurrentState(); 236 this.onMove(); 237 // Add handers 238 var _this = this; 239 this.addHandler ( 240 document, 241 "mousemove", 242 function(evt) { 243 if (_this.moveState) _this.moveHandler(evt); 244 if (_this.moveIntervalState) _this.moveIntervalHandler(evt); 245 } 246 ); 247 this.addHandler ( 248 document, 249 "mouseup", 250 function() { 251 _this.moveState = false; 252 _this.moveIntervalState = false; 253 } 254 ); 255 this.addHandler ( 256 this.leftBegun, 257 "mousedown", 258 function(evt) { 259 evt = evt || window.event; 260 if (evt.preventDefault) evt.preventDefault(); 261 evt.returnValue = false; 262 _this.moveState = "left"; 263 _this.x0 = _this.defPosition(evt).x; 264 _this.blockX0 = _this.leftWidth; 265 } 266 ); 267 this.addHandler ( 268 this.rightBegun, 269 "mousedown", 270 function(evt) { 271 evt = evt || window.event; 272 if (evt.preventDefault) evt.preventDefault(); 273 evt.returnValue = false; 274 _this.moveState = "right"; 275 _this.x0 = _this.defPosition(evt).x; 276 _this.blockX0 = _this.rightWidth; 277 } 278 ); 279 this.addHandler ( 280 this.centerBlock, 281 "mousedown", 282 function(evt) { 283 evt = evt || window.event; 284 if (evt.preventDefault) evt.preventDefault(); 285 evt.returnValue = false;
286 _this.moveIntervalState = true; 287 _this.intervalWidth = _this.width - _this.rightWidth - _this.leftWidth; 288 _this.x0 = _this.defPosition(evt).x; 289 _this.rightX0 = _this.rightWidth; 290 _this.leftX0 = _this.leftWidth; 291 } 292 ), 293 this.addHandler ( 294 this.centerBlock, 295 "click", 296 function(evt) { 297 if (!_this.itWasMove) _this.clickMove(evt); 298 _this.itWasMove = false; 299 } 300 ); 301 this.addHandler ( 302 this.leftBlock, 303 "click", 304 function(evt) { 305 if (!_this.itWasMove)_this.clickMoveLeft(evt); 306 _this.itWasMove = false; 307 } 308 ); 309 this.addHandler ( 310 this.rightBlock, 311 "click", 312 function(evt) { 313 if (!_this.itWasMove)_this.clickMoveRight(evt); 314 _this.itWasMove = false; 315 } 316 ); 317 } catch(e) {this.debug([1]);} 318 }, 319 clickMoveRight : function(evt) { 320 evt = evt || window.event; 321 if (evt.preventDefault) evt.preventDefault(); 322 evt.returnValue = false; 323 var x = this.defPosition(evt).x - this.absPosition(this.rightBlock).x; 324 var w = this.rightBlock.offsetWidth; 325 if (x <= 0 || w <= 0 || w < x || (w - x) < this.widthRem) return; 326 this.rightWidth = (w - x); 327 this.rightCounter(); 328 329 this.setCurrentState(); 330 this.onMove(); 331 }, 332 clickMoveLeft : function(evt) { 333 evt = evt || window.event; 334 if (evt.preventDefault) evt.preventDefault(); 335 evt.returnValue = false; 336 var x = this.defPosition(evt).x - this.absPosition(this.leftBlock).x; 337 var w = this.leftBlock.offsetWidth; 338 if (x <= 0 || w <= 0 || w < x || x < this.widthRem) return; 339 this.leftWidth = x; 340 this.leftCounter(); 341 342 this.setCurrentState(); 343 this.onMove(); 344 }, 345 clickMove : function(evt) { 346 evt = evt || window.event; 347 if (evt.preventDefault) evt.preventDefault(); 348 evt.returnValue = false; 349 var x = this.defPosition(evt).x - this.absPosition(this.centerBlock).x; 350 var w = this.centerBlock.offsetWidth; 351 if (x <= 0 || w <= 0 || w < x) return; 352 if (x >= w / 2) { 353 this.rightWidth += (w - x); 354 this.rightCounter(); 355 } else { 356 this.leftWidth += x; 357 this.leftCounter(); 358 } 359 this.setCurrentState(); 360 this.onMove(); 361 }, 362 setCurrentState : function() { 363 this.leftBlock.style.width = this.leftWidth + "px"; 364 if (!this.clearValues) this.leftBlock.firstChild.innerHTML = (!this.dual && this.leftWidth > this.width / 2) ? "" : this.leftValue; 365 if(!this.dual) { 366 var x = this.leftBlock.firstChild.offsetWidth; 367 this.leftBlock.firstChild.style.right = (this.widthRem * (1 - 2 * (this.leftWidth - this.widthRem) / this.width) - ((this.leftWidth - this.widthRem) * x / this.width)) + 'px'; 368 } 369 this.rightBlock.style.width = this.rightWidth + "px"; 370 if (!this.clearValues) this.rightBlock.firstChild.innerHTML = (!this.dual && this.rightWidth >= this.width / 2) ? "" : this.rightValue; 371 if(!this.dual) { 372 var x = this.rightBlock.firstChild.offsetWidth; 373 this.rightBlock.firstChild.style.left = (this.widthRem * (1 - 2 * (this.rightWidth - this.widthRem) / this.width) - ((this.rightWidth - this.widthRem) * x / this.width)) + 'px'; 374 } 375 }, 376 moveHandler : function(evt) { 377 this.itWasMove = true; 378 evt = evt || window.event; 379 if (evt.preventDefault) evt.preventDefault(); 380 evt.returnValue = false; 381 if (this.moveState == "left") { 382 this.leftWidth = this.blockX0 + this.defPosition(evt).x - this.x0; 383 this.leftCounter(); 384 } 385 if (this.moveState == "right") { 386 this.rightWidth = this.blockX0 + this.x0 - this.defPosition(evt).x; 387 this.rightCounter(); 388 } 389 this.setCurrentState(); 390 this.onMove(); 391 }, 392 moveIntervalHandler : function(evt) { 393 this.itWasMove = true; 394 evt = evt || window.event; 395 if (evt.preventDefault) evt.preventDefault(); 396 evt.returnValue = false; 397 var dX = this.defPosition(evt).x - this.x0; 398 if (dX > 0) { 399 this.rightWidth = this.rightX0 - dX > this.widthRem ? this.rightX0 - dX : this.widthRem; 400 this.leftWidth = this.width - this.rightWidth - this.intervalWidth; 401 } else { 402 this.leftWidth = this.leftX0 + dX > this.widthRem ? this.leftX0 + dX : this.widthRem; 403 this.rightWidth = this.width - this.leftWidth - this.intervalWidth; 404 } 405 this.rightCounter(); 406 this.leftCounter(); 407 this.setCurrentState(); 408 this.onMove(); 409 },
410 updateRightValue : function(rightValue) { 411 try { 412 this.rightValue = parseInt(rightValue); 413 this.rightValue = this.rightValue < this.leftLimit ? this.leftLimit : this.rightValue; 414 this.rightValue = this.rightValue > this.rightLimit ? this.rightLimit : this.rightValue; 415 if (this.dual) { 416 this.rightValue = this.rightValue < this.leftValue ? this.leftValue : this.rightValue; 417 } else this.leftValue = this.rightValue; 418 this.rightWidth = this.valueWidth - parseInt((this.rightValue - this.leftLimit) / this.valueInterval * this.valueWidth) + this.widthRem; 419 this.rightWidth = isNaN(this.rightWidth) ? this.widthRem : this.rightWidth; 420 if (!this.dual) this.leftWidth = this.width - this.rightWidth; 421 this.setCurrentState(); 422 } catch(e) {} 423 }, 424 rightCounter : function() { 425 if (this.dual) { 426 this.rightWidth = this.rightWidth > this.width - this.leftWidth ? this.width - this.leftWidth : this.rightWidth; 427 this.rightWidth = this.rightWidth < this.widthRem ? this.widthRem : this.rightWidth; 428 this.rightValue = this.leftLimit + this.valueInterval - parseInt((this.rightWidth - this.widthRem) / this.valueWidth * this.valueInterval); 429 if (this.roundUp) this.rightValue = parseInt(this.rightValue / this.roundUp) * this.roundUp; 430 if (this.leftWidth + this.rightWidth >= this.width) this.rightValue = this.leftValue; 431 } else { 432 this.rightWidth = this.rightWidth > (this.width - this.widthRem) ? this.width - this.widthRem : this.rightWidth; 433 this.rightWidth = this.rightWidth < this.widthRem ? this.widthRem : this.rightWidth; 434 this.leftWidth = this.width - this.rightWidth; 435 this.rightValue = this.leftLimit + this.valueInterval - parseInt((this.rightWidth - this.widthRem) / this.valueWidth * this.valueInterval); 436 if (this.roundUp) this.rightValue = parseInt(this.rightValue / this.roundUp) * this.roundUp; 437 this.leftValue = this.rightValue; 438 } 439 }, 440 updateLeftValue : function(leftValue) { 441 try { 442 this.leftValue = parseInt(leftValue); 443 this.leftValue = this.leftValue < this.leftLimit ? this.leftLimit : this.leftValue; 444 this.leftValue = this.leftValue > this.rightLimit ? this.rightLimit : this.leftValue; 445 if (this.dual) { 446 this.leftValue = this.rightValue < this.leftValue ? this.rightValue : this.leftValue; 447 } else this.rightValue = this.leftValue; 448 this.leftWidth = parseInt((this.leftValue - this.leftLimit) / this.valueInterval * this.valueWidth) + this.widthRem; 449 this.leftWidth = isNaN(this.leftWidth) ? this.widthRem : this.leftWidth; 450 if (!this.dual) this.rightWidth = this.width - this.leftWidth; 451 this.setCurrentState(); 452 } catch(e) {} 453 }, 454 leftCounter : function() { 455 if (this.dual) { 456 this.leftWidth = this.leftWidth > this.width - this.rightWidth ? this.width - this.rightWidth : this.leftWidth; 457 this.leftWidth = this.leftWidth < this.widthRem ? this.widthRem : this.leftWidth; 458 this.leftValue = this.leftLimit + parseInt((this.leftWidth - this.widthRem) / this.valueWidth * this.valueInterval); 459 if (this.roundUp) this.leftValue = parseInt(this.leftValue / this.roundUp) * this.roundUp; 460 if (this.leftWidth + this.rightWidth >= this.width) this.leftValue = this.rightValue; 461 } else { 462 this.leftWidth = this.leftWidth > (this.width - this.widthRem) ? this.width - this.widthRem : this.leftWidth; 463 this.leftWidth = this.leftWidth < this.widthRem ? this.widthRem : this.leftWidth; 464 this.rightWidth = this.width - this.leftWidth; 465 this.leftValue = this.leftLimit + parseInt((this.leftWidth - this.widthRem) / this.valueWidth * this.valueInterval); 466 if (this.roundUp) this.leftValue = parseInt(this.leftValue / this.roundUp) * this.roundUp; 467 this.rightValue = this.leftValue; 468 } 469 } 470}
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.