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