1function JCSmartFilterVertical1(ajaxURL, viewMode, params) 2{ 3 this.ajaxURL = ajaxURL; 4 this.form = null; 5 this.timer = null; 6 this.cacheKey = ''; 7 this.cache = []; 8 this.viewMode = viewMode; 9 this.id = params.id; 10 this.variable = params.variable; 11 12 if (params && params.SEF_SET_FILTER_URL) 13 { 14 this.bindUrlToButton(this.id.setFilter, params.SEF_SET_FILTER_URL); 15 this.sef = true; 16 } 17 if (params && params.SEF_DEL_FILTER_URL) 18 { 19 this.bindUrlToButton(this.id.delFilter, params.SEF_DEL_FILTER_URL); 20 } 21 22 var _ = template.getLibrary('_'); 23 var events = template.getLibrary('events'); 24 25 _.assignIn(this, new events()); 26} 27 28JCSmartFilterVertical1.prototype.keyup = function(input) 29{ 30 if(!!this.timer) 31 { 32 clearTimeout(this.timer); 33 } 34 this.timer = setTimeout(BX.delegate(function(){ 35 this.reload(input); 36 }, this), 500); 37}; 38 39JCSmartFilterVertical1.prototype.click = function(checkbox) 40{ 41 if(!!this.timer) 42 { 43 clearTimeout(this.timer); 44 } 45 46 this.timer = setTimeout(BX.delegate(function(){ 47 this.reload(checkbox); 48 }, this), 500); 49}; 50 51JCSmartFilterVertical1.prototype.reload = function(input) 52{ 53 if (this.cacheKey !== '') 54 { 55 //Postprone backend query 56 if(!!this.timer) 57 { 58 clearTimeout(this.timer); 59 } 60 this.timer = setTimeout(BX.delegate(function(){ 61 this.reload(input); 62 }, this), 1000); 63 return; 64 } 65 this.cacheKey = '|'; 66 67 this.position = BX.pos(input, true); 68 this.form = BX.findParent(input, {'tag':'form'}); 69 if (this.form) 70 { 71 var values = []; 72 values[0] = {name: 'ajax', value: 'y'}; 73 this.gatherInputsValues(values, BX.findChildren(this.form, {'tag': new RegExp('^(input|select)$', 'i')}, true)); 74 75 for (var i = 0; i < values.length; i++) 76 this.cacheKey += values[i].name + ':' + values[i].value + '|'; 77 78 if (this.cache[this.cacheKey]) 79 { 80 this.curFilterinput = input; 81 this.postHandler(this.cache[this.cacheKey], true); 82 } 83 else 84 { 85 if (this.sef) 86 { 87 var set_filter = BX(this.id.setFilter); 88 89 if (set_filter) 90 set_filter.disabled = true; 91 } 92 93 this.curFilterinput = input; 94 BX.ajax.loadJSON( 95 this.ajaxURL, 96 this.values2post(values), 97 BX.delegate(this.postHandler, this) 98 ); 99 } 100 } 101}; 102 103JCSmartFilterVertical1.prototype.updateItem = function (PID, arItem) 104{ 105 if (arItem.PROPERTY_TYPE === 'N' || arItem.PRICE) 106 { 107 var trackBar = window['trackBar' + PID]; 108 if (!trackBar && arItem.ENCODED_ID) 109 trackBar = window['trackBar' + arItem.ENCODED_ID]; 110 111 if (trackBar && arItem.VALUES) 112 { 113 if (arItem.VALUES.MIN) 114 { 115 if (arItem.VALUES.MIN.FILTERED_VALUE) 116 trackBar.setMinFilteredValue(arItem.VALUES.MIN.FILTERED_VALUE); 117 else 118 trackBar.setMinFilteredValue(arItem.VALUES.MIN.VALUE); 119 } 120 121 if (arItem.VALUES.MAX) 122 { 123 if (arItem.VALUES.MAX.FILTERED_VALUE) 124 trackBar.setMaxFilteredValue(arItem.VALUES.MAX.FILTERED_VALUE); 125 else 126 trackBar.setMaxFilteredValue(arItem.VALUES.MAX.VALUE); 127 } 128 } 129 } 130 else if (arItem.VALUES) 131 { 132 for (var i in arItem.VALUES) 133 { 134 if (arItem.VALUES.hasOwnProperty(i)) 135 { 136 var value = arItem.VALUES[i]; 137 var control = BX(value.CONTROL_ID); 138 139 if (!!control) 140 { 141 var label = document.querySelector('[data-role="label_'+value.CONTROL_ID+'"]'); 142 if (value.DISABLED) 143 { 144 control.setAttribute('disabled', 'disabled'); 145 146 if (label) 147 BX.addClass(label, 'disabled'); 148 else 149 BX.addClass(control.parentNode, 'disabled'); 150 } 151 else 152 { 153 control.removeAttribute('disabled'); 154 155 if (label) 156 BX.removeClass(label, 'disabled'); 157 else 158 BX.removeClass(control.parentNode, 'disabled'); 159 } 160 161 if (value.CHECKED) { 162 control.removeAttribute('disabled'); 163 164 if (label) 165 BX.removeClass(label, 'disabled'); 166 else 167 BX.removeClass(control.parentNode, 'disabled'); 168 } 169 170 if (value.hasOwnProperty('ELEMENT_COUNT')) 171 { 172 label = document.querySelector('[data-role="count_'+value.CONTROL_ID+'"]'); 173 if (label) 174 label.innerHTML = value.ELEMENT_COUNT; 175 } 176 } 177 } 178 } 179 } 180}; 181 182JCSmartFilterVertical1.prototype.postHandler = function (result, fromCache) 183{ 184 var hrefFILTER, url, curProp; 185 var modef = BX('modef'); 186 var modef_num = BX('modef_num'); 187 188 if (!!result && !!result.ITEMS) 189 { 190 for(var PID in result.ITEMS) 191 { 192 if (result.ITEMS.hasOwnProperty(PID)) 193 { 194 this.updateItem(PID, result.ITEMS[PID]); 195 } 196 } 197 198 if (!!modef && !!modef_num) 199 { 200 modef_num.innerHTML = result.ELEMENT_COUNT; 201 hrefFILTER = BX.findChildren(modef, {tag: 'A'}, true); 202 203 if (result.FILTER_URL && hrefFILTER) 204 { 205 hrefFILTER[0].href = BX.util.htmlspecialcharsback(result.FILTER_URL); 206 } 207 208 if (result.FILTER_AJAX_URL && result.COMPONENT_CONTAINER_ID) 209 { 210 BX.unbindAll(hrefFILTER[0]); 211 BX.bind(hrefFILTER[0], 'click', function(e) 212 { 213 url = BX.util.htmlspecialcharsback(result.FILTER_AJAX_URL); 214 BX.ajax.insertToNode(url, result.COMPONENT_CONTAINER_ID); 215 return BX.PreventDefault(e); 216 }); 217 } 218 219 if (result.INSTANT_RELOAD && result.COMPONENT_CONTAINER_ID) 220 { 221 url = BX.util.htmlspecialcharsback(result.FILTER_AJAX_URL); 222 BX.ajax.insertToNode(url, result.COMPONENT_CONTAINER_ID); 223 } 224 else 225 {
226 this.emit('refresh', BX.util.htmlspecialcharsback(result.FILTER_AJAX_URL)); 227 228 if (modef.style.display === 'none') 229 { 230 modef.style.display = 'inline-block'; 231 } 232 233 if (this.viewMode === "VERTICAL") 234 { 235 curProp = BX.findChild(BX.findParent(this.curFilterinput, {'class':'bx-filter-parameters-box'}), {'class':'bx-filter-container-modef'}, true, false); 236 curProp.appendChild(modef); 237 } 238 239 if (result.SEF_SET_FILTER_URL) 240 { 241 this.bindUrlToButton(this.id.setFilter, result.SEF_SET_FILTER_URL); 242 } 243 } 244 } 245 } 246 247 if (this.sef) 248 { 249 var set_filter = BX(this.id.setFilter); 250 251 if (set_filter) 252 set_filter.disabled = false; 253 } 254 255 if (!fromCache && this.cacheKey !== '') 256 { 257 this.cache[this.cacheKey] = result; 258 } 259 this.cacheKey = ''; 260}; 261 262JCSmartFilterVertical1.prototype.bindUrlToButton = function (buttonId, url) 263{ 264 var button = BX(buttonId); 265 if (button) 266 { 267 var proxy = function(j, func) 268 { 269 return function() 270 { 271 return func(j); 272 } 273 }; 274 275 if (button.type === 'submit') 276 button.type = 'button'; 277 278 BX.bind(button, 'click', proxy(url, function(url) 279 { 280 window.location.href = url; 281 return false; 282 })); 283 } 284}; 285 286JCSmartFilterVertical1.prototype.gatherInputsValues = function (values, elements) 287{ 288 if(elements) 289 { 290 for(var i = 0; i < elements.length; i++) 291 { 292 var el = elements[i]; 293 if (el.disabled || !el.type) 294 continue; 295 296 switch(el.type.toLowerCase()) 297 { 298 case 'text': 299 case 'textarea': 300 case 'password': 301 case 'hidden': 302 case 'select-one': 303 if(el.value.length) 304 values[values.length] = {name : el.name, value : el.value}; 305 break; 306 case 'radio': 307 case 'checkbox': 308 if(el.checked) 309 values[values.length] = {name : el.name, value : el.value}; 310 break; 311 case 'select-multiple': 312 for (var j = 0; j < el.options.length; j++) 313 { 314 if (el.options[j].selected) 315 values[values.length] = {name : el.name, value : el.options[j].value}; 316 } 317 break; 318 default: 319 break; 320 } 321 } 322 } 323}; 324 325JCSmartFilterVertical1.prototype.values2post = function (values) 326{ 327 var post = []; 328 var current = post; 329 var i = 0; 330 331 while(i < values.length) 332 { 333 var p = values[i].name.indexOf('['); 334 if(p === -1) 335 { 336 current[values[i].name] = values[i].value; 337 current = post; 338 i++; 339 } 340 else 341 { 342 var name = values[i].name.substring(0, p); 343 var rest = values[i].name.substring(p+1); 344 if(!current[name]) 345 current[name] = []; 346 347 var pp = rest.indexOf(']'); 348 if(pp === -1) 349 { 350 //Error - not balanced brackets 351 current = post; 352 i++; 353 } 354 else if(pp === 0) 355 { 356 //No index specified - so take the next integer 357 current = current[name]; 358 values[i].name = '' + current.length; 359 } 360 else 361 { 362 //Now index name becomes and name and we go deeper into the array 363 current = current[name]; 364 values[i].name = rest.substring(0, pp) + rest.substring(pp+1); 365 } 366 } 367 } 368 return post; 369}; 370 371JCSmartFilterVertical1.prototype.hideFilterProps = function(element) 372{ 373 var obj = element.parentNode, 374 filterBlock = obj.querySelector("[data-role='bx_filter_block']"), 375 propAngle = obj.querySelector("[data-role='prop_angle']"); 376 377 if(BX.hasClass(obj, "bx-active")) 378 { 379 new BX.easing({ 380 duration : 300, 381 start : { opacity: 1, height: filterBlock.offsetHeight }, 382 finish : { opacity: 0, height:0 }, 383 transition : BX.easing.transitions.quart, 384 step : function(state){ 385 filterBlock.style.opacity = state.opacity; 386 filterBlock.style.height = state.height + "px"; 387 }, 388 complete : function() { 389 filterBlock.setAttribute("style", ""); 390 BX.removeClass(obj, "bx-active"); 391 } 392 }).animate(); 393 394 BX.removeClass(propAngle, "property-expanded"); 395 } 396 else 397 { 398 filterBlock.style.display = "block"; 399 filterBlock.style.opacity = 0; 400 filterBlock.style.height = "auto"; 401 402 var obj_children_height = filterBlock.offsetHeight; 403 filterBlock.style.height = 0; 404 405 new BX.easing({ 406 duration : 300, 407 start : { opacity: 0, height: 0 }, 408 finish : { opacity: 1, height: obj_children_height }, 409 transition : BX.easing.transitions.quart, 410 step : function(state){ 411 filterBlock.style.opacity = state.opacity; 412 filterBlock.style.height = state.height + "px"; 413 },
414 complete : function() { 415 } 416 }).animate(); 417 418 BX.addClass(obj, "bx-active"); 419 BX.addClass(propAngle, "property-expanded"); 420 } 421}; 422 423JCSmartFilterVertical1.prototype.showDropDownPopup = function(element, popupId) 424{ 425 var contentNode = element.querySelector('[data-role="dropdownContent"]'); 426 BX.PopupWindowManager.create("smartFilterDropDown"+popupId, element, { 427 autoHide: true, 428 offsetLeft: 0, 429 offsetTop: 3, 430 overlay : false, 431 draggable: {restrict:true}, 432 closeByEsc: true, 433 content: contentNode 434 }).show(); 435}; 436 437JCSmartFilterVertical1.prototype.selectDropDownItem = function(element, controlId) 438{ 439 this.keyup(BX(controlId)); 440 441 var wrapContainer = BX.findParent(BX(controlId), {className:"bx-filter-select-container"}, false); 442 443 var currentOption = wrapContainer.querySelector('[data-role="currentOption"]'); 444 currentOption.innerHTML = element.innerHTML; 445 BX.PopupWindowManager.getCurrentPopup().close(); 446}; 447 448BX.namespace("BX.Iblock.SmartFilterVertical1"); 449BX.Iblock.SmartFilterVertical1 = (function() 450{ 451 var SmartFilter = function(arParams) 452 { 453 if (typeof arParams === 'object') 454 { 455 this.variable = arParams.variable; 456 this.leftSlider = BX(arParams.leftSlider); 457 this.rightSlider = BX(arParams.rightSlider); 458 this.tracker = BX(arParams.tracker); 459 this.trackerWrap = BX(arParams.trackerWrap); 460 461 this.minInput = BX(arParams.minInputId); 462 this.maxInput = BX(arParams.maxInputId); 463 464 this.minPrice = parseFloat(arParams.minPrice); 465 this.maxPrice = parseFloat(arParams.maxPrice); 466 467 this.curMinPrice = parseFloat(arParams.curMinPrice); 468 this.curMaxPrice = parseFloat(arParams.curMaxPrice); 469 470 this.fltMinPrice = arParams.fltMinPrice ? parseFloat(arParams.fltMinPrice) : parseFloat(arParams.curMinPrice); 471 this.fltMaxPrice = arParams.fltMaxPrice ? parseFloat(arParams.fltMaxPrice) : parseFloat(arParams.curMaxPrice); 472 473 this.precision = arParams.precision || 0; 474 475 this.priceDiff = this.maxPrice - this.minPrice; 476 477 this.leftPercent = 0; 478 this.rightPercent = 0; 479 480 this.fltMinPercent = 0; 481 this.fltMaxPercent = 0; 482 483 this.colorUnavailableActive = BX(arParams.colorUnavailableActive);//gray 484 this.colorAvailableActive = BX(arParams.colorAvailableActive);//blue 485 this.colorAvailableInactive = BX(arParams.colorAvailableInactive);//light blue 486 487 this.isTouch = false; 488 489 this.init(); 490 491 if ('ontouchstart' in document.documentElement) 492 { 493 this.isTouch = true; 494 495 BX.bind(this.leftSlider, "touchstart", BX.proxy(function(event){ 496 this.onMoveLeftSlider(event) 497 }, this)); 498 499 BX.bind(this.rightSlider, "touchstart", BX.proxy(function(event){ 500 this.onMoveRightSlider(event) 501 }, this)); 502 } 503 else 504 { 505 BX.bind(this.leftSlider, "mousedown", BX.proxy(function(event){ 506 this.onMoveLeftSlider(event) 507 }, this)); 508 509 BX.bind(this.rightSlider, "mousedown", BX.proxy(function(event){ 510 this.onMoveRightSlider(event) 511 }, this)); 512 } 513 514 BX.bind(this.minInput, "keyup", BX.proxy(function(event){ 515 this.onInputChange(); 516 }, this)); 517 518 BX.bind(this.maxInput, "keyup", BX.proxy(function(event){ 519 this.onInputChange(); 520 }, this)); 521 } 522 }; 523 524 SmartFilter.prototype.init = function() 525 { 526 var priceDiff; 527 528 if (this.curMinPrice > this.minPrice) 529 { 530 priceDiff = this.curMinPrice - this.minPrice; 531 this.leftPercent = (priceDiff*100)/this.priceDiff; 532 533 this.leftSlider.style.left = this.leftPercent + "%"; 534 this.colorUnavailableActive.style.left = this.leftPercent + "%"; 535 } 536 537 this.setMinFilteredValue(this.fltMinPrice); 538 539 if (this.curMaxPrice < this.maxPrice) 540 { 541 priceDiff = this.maxPrice - this.curMaxPrice; 542 this.rightPercent = (priceDiff*100)/this.priceDiff; 543 544 this.rightSlider.style.right = this.rightPercent + "%"; 545 this.colorUnavailableActive.style.right = this.rightPercent + "%"; 546 } 547 548 this.setMaxFilteredValue(this.fltMaxPrice); 549 }; 550 551 SmartFilter.prototype.setMinFilteredValue = function (fltMinPrice) 552 { 553 this.fltMinPrice = parseFloat(fltMinPrice); 554 if (this.fltMinPrice >= this.minPrice) 555 { 556 var priceDiff = this.fltMinPrice - this.minPrice; 557 this.fltMinPercent = (priceDiff*100)/this.priceDiff; 558 559 if (this.leftPercent > this.fltMinPercent) 560 this.colorAvailableActive.style.left = this.leftPercent + "%"; 561 else 562 this.colorAvailableActive.style.left = this.fltMinPercent + "%"; 563 564 this.colorAvailableInactive.style.left = this.fltMinPercent + "%"; 565 } 566 else 567 { 568 this.colorAvailableActive.style.left = "0%"; 569 this.colorAvailableInactive.style.left = "0%"; 570 } 571 }; 572 573 SmartFilter.prototype.setMaxFilteredValue = function (fltMaxPrice) 574 { 575 this.fltMaxPrice = parseFloat(fltMaxPrice); 576 if (this.fltMaxPrice <= this.maxPrice) 577 { 578 var priceDiff = this.maxPrice - this.fltMaxPrice; 579 this.fltMaxPercent = (priceDiff*100)/this.priceDiff; 580 581 if (this.rightPercent > this.fltMaxPercent) 582 this.colorAvailableActive.style.right = this.rightPercent + "%"; 583 else 584 this.colorAvailableActive.style.right = this.fltMaxPercent + "%"; 585 586 this.colorAvailableInactive.style.right = this.fltMaxPercent + "%"; 587 } 588 else 589 { 590 this.colorAvailableActive.style.right = "0%"; 591 this.colorAvailableInactive.style.right = "0%"; 592 } 593 }; 594 595 SmartFilter.prototype.getXCoord = function(elem) 596 { 597 var box = elem.getBoundingClientRect(); 598 var body = document.body; 599 var docElem = document.documentElement; 600 601 var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft; 602 var clientLeft = docElem.clientLeft || body.clientLeft || 0; 603 var left = box.left + scrollLeft - clientLeft; 604 605 return Math.round(left); 606 }; 607 608 SmartFilter.prototype.getPageX = function(e) 609 { 610 e = e || window.event; 611 var pageX = null; 612 613 if (this.isTouch && event.targetTouches[0] !== null) 614 { 615 pageX = e.targetTouches[0].pageX; 616 } 617 else if (e.pageX !== null) 618 { 619 pageX = e.pageX; 620 } 621 else if (e.clientX !== null) 622 { 623 var html = document.documentElement; 624 var body = document.body; 625 626 pageX = e.clientX + (html.scrollLeft || body && body.scrollLeft || 0); 627 pageX -= html.clientLeft || 0; 628 } 629 630 return pageX; 631 }; 632 633 SmartFilter.prototype.recountMinPrice = function() 634 { 635 var newMinPrice = (this.priceDiff*this.leftPercent)/100; 636 newMinPrice = (this.minPrice + newMinPrice).toFixed(this.precision); 637 638 if (newMinPrice !== this.minPrice) 639 this.minInput.value = newMinPrice; 640 else 641 this.minInput.value = this.minPrice; 642 window[this.variable].keyup(this.minInput); 643 }; 644 645 SmartFilter.prototype.recountMaxPrice = function() 646 { 647 var newMaxPrice = (this.priceDiff*this.rightPercent)/100; 648 newMaxPrice = (this.maxPrice - newMaxPrice).toFixed(this.precision); 649 650 if (newMaxPrice !== this.maxPrice) 651 this.maxInput.value = newMaxPrice; 652 else 653 this.maxInput.value = this.maxPrice; 654 window[this.variable].keyup(this.maxInput); 655 }; 656 657 SmartFilter.prototype.onInputChange = function () 658 { 659 var priceDiff; 660 if (this.minInput.value) 661 { 662 var leftInputValue = this.minInput.value; 663 if (leftInputValue < this.minPrice) 664 leftInputValue = this.minPrice; 665 666 if (leftInputValue > this.maxPrice) 667 leftInputValue = this.maxPrice; 668 669 priceDiff = leftInputValue - this.minPrice; 670 this.leftPercent = (priceDiff*100)/this.priceDiff; 671 672 this.makeLeftSliderMove(false); 673 } 674 675 if (this.maxInput.value) 676 { 677 var rightInputValue = this.maxInput.value; 678 if (rightInputValue < this.minPrice) 679 rightInputValue = this.minPrice; 680 681 if (rightInputValue > this.maxPrice) 682 rightInputValue = this.maxPrice; 683 684 priceDiff = this.maxPrice - rightInputValue; 685 this.rightPercent = (priceDiff*100)/this.priceDiff; 686 687 this.makeRightSliderMove(false); 688 } 689 690 if (this.maxInput) { 691 window[this.variable].keyup(this.maxInput); 692 } else if (this.minInput) { 693 window[this.variable].keyup(this.minInput); 694 } 695 }; 696 697 SmartFilter.prototype.makeLeftSliderMove = function(recountPrice) 698 { 699 recountPrice = (recountPrice !== false); 700 701 this.leftSlider.style.left = this.leftPercent + "%"; 702 this.colorUnavailableActive.style.left = this.leftPercent + "%"; 703 704 var areBothSlidersMoving = false;
705 if (this.leftPercent + this.rightPercent >= 100) 706 { 707 areBothSlidersMoving = true; 708 this.rightPercent = 100 - this.leftPercent; 709 this.rightSlider.style.right = this.rightPercent + "%"; 710 this.colorUnavailableActive.style.right = this.rightPercent + "%"; 711 } 712 713 if (this.leftPercent >= this.fltMinPercent && this.leftPercent <= (100-this.fltMaxPercent)) 714 { 715 this.colorAvailableActive.style.left = this.leftPercent + "%"; 716 if (areBothSlidersMoving) 717 { 718 this.colorAvailableActive.style.right = 100 - this.leftPercent + "%"; 719 } 720 } 721 else if(this.leftPercent <= this.fltMinPercent) 722 { 723 this.colorAvailableActive.style.left = this.fltMinPercent + "%"; 724 if (areBothSlidersMoving) 725 { 726 this.colorAvailableActive.style.right = 100 - this.fltMinPercent + "%"; 727 } 728 } 729 else if(this.leftPercent >= this.fltMaxPercent) 730 { 731 this.colorAvailableActive.style.left = 100-this.fltMaxPercent + "%"; 732 if (areBothSlidersMoving) 733 { 734 this.colorAvailableActive.style.right = this.fltMaxPercent + "%"; 735 } 736 } 737 738 if (recountPrice) 739 { 740 this.recountMinPrice(); 741 if (areBothSlidersMoving) 742 this.recountMaxPrice(); 743 } 744 }; 745 746 SmartFilter.prototype.countNewLeft = function(event) 747 { 748 var pageX = this.getPageX(event); 749 750 var trackerXCoord = this.getXCoord(this.trackerWrap); 751 var rightEdge = this.trackerWrap.offsetWidth; 752 753 var newLeft = pageX - trackerXCoord; 754 755 if (newLeft < 0) 756 newLeft = 0; 757 else if (newLeft > rightEdge) 758 newLeft = rightEdge; 759 760 return newLeft; 761 }; 762 763 SmartFilter.prototype.onMoveLeftSlider = function(e) 764 { 765 if (!this.isTouch) 766 { 767 this.leftSlider.ondragstart = function() { 768 return false; 769 }; 770 } 771 772 if (!this.isTouch) 773 { 774 document.onmousemove = BX.proxy(function(event) { 775 this.leftPercent = ((this.countNewLeft(event)*100)/this.trackerWrap.offsetWidth); 776 this.makeLeftSliderMove(); 777 }, this); 778 779 document.onmouseup = function() { 780 document.onmousemove = document.onmouseup = null; 781 }; 782 } 783 else 784 { 785 document.ontouchmove = BX.proxy(function(event) { 786 this.leftPercent = ((this.countNewLeft(event)*100)/this.trackerWrap.offsetWidth); 787 this.makeLeftSliderMove(); 788 }, this); 789 790 document.ontouchend = function() { 791 document.ontouchmove = document.touchend = null; 792 }; 793 } 794 795 return false; 796 }; 797 798 SmartFilter.prototype.makeRightSliderMove = function(recountPrice) 799 { 800 recountPrice = (recountPrice !== false); 801 802 this.rightSlider.style.right = this.rightPercent + "%"; 803 this.colorUnavailableActive.style.right = this.rightPercent + "%"; 804 805 var areBothSlidersMoving = false; 806 if (this.leftPercent + this.rightPercent >= 100) 807 { 808 areBothSlidersMoving = true; 809 this.leftPercent = 100 - this.rightPercent; 810 this.leftSlider.style.left = this.leftPercent + "%"; 811 this.colorUnavailableActive.style.left = this.leftPercent + "%"; 812 } 813 814 if ((100-this.rightPercent) >= this.fltMinPercent && this.rightPercent >= this.fltMaxPercent) 815 { 816 this.colorAvailableActive.style.right = this.rightPercent + "%"; 817 if (areBothSlidersMoving) 818 { 819 this.colorAvailableActive.style.left = 100 - this.rightPercent + "%"; 820 } 821 } 822 else if(this.rightPercent <= this.fltMaxPercent) 823 { 824 this.colorAvailableActive.style.right = this.fltMaxPercent + "%"; 825 if (areBothSlidersMoving) 826 { 827 this.colorAvailableActive.style.left = 100 - this.fltMaxPercent + "%"; 828 } 829 } 830 else if((100-this.rightPercent) <= this.fltMinPercent) 831 { 832 this.colorAvailableActive.style.right = 100-this.fltMinPercent + "%"; 833 if (areBothSlidersMoving) 834 { 835 this.colorAvailableActive.style.left = this.fltMinPercent + "%"; 836 } 837 } 838 839 if (recountPrice) 840 { 841 this.recountMaxPrice(); 842 if (areBothSlidersMoving) 843 this.recountMinPrice(); 844 } 845 }; 846 847 SmartFilter.prototype.onMoveRightSlider = function(e) 848 { 849 if (!this.isTouch) 850 { 851 this.rightSlider.ondragstart = function() { 852 return false; 853 }; 854 } 855 856 if (!this.isTouch) 857 { 858 document.onmousemove = BX.proxy(function(event) { 859 this.rightPercent = 100-(((this.countNewLeft(event))*100)/(this.trackerWrap.offsetWidth)); 860 this.makeRightSliderMove(); 861 }, this); 862 863 document.onmouseup = function() { 864 document.onmousemove = document.onmouseup = null; 865 }; 866 } 867 else 868 { 869 document.ontouchmove = BX.proxy(function(event) { 870 this.rightPercent = 100-(((this.countNewLeft(event))*100)/(this.trackerWrap.offsetWidth)); 871 this.makeRightSliderMove(); 872 }, this); 873 874 document.ontouchend = function() { 875 document.ontouchmove = document.ontouchend = null; 876 }; 877 } 878 879 return false;
880 }; 881 882 return SmartFilter; 883})();
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.