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