1 2; /* Start:"a:4:{s:4:"full";s:104:"/local/templates/universe_si/components/bitrix/catalog.smart.filter/vertical.2/script.js?169831924922564";s:6:"source";s:88:"/local/templates/universe_si/components/bitrix/catalog.smart.filter/vertical.2/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 3function JCSmartFilterVertical2(ajaxURL, viewMode, params) 4{ 5 this.ajaxURL = ajaxURL; 6 this.form = null; 7 this.timer = null; 8 this.cacheKey = ''; 9 this.cache = []; 10 this.viewMode = viewMode; 11 this.id = params.id; 12 this.variable = params.variable; 13 14 if (params && params.SEF_SET_FILTER_URL) 15 { 16 this.bindUrlToButton(this.id.setFilter, params.SEF_SET_FILTER_URL); 17 this.sef = true; 18 } 19 if (params && params.SEF_DEL_FILTER_URL) 20 { 21 this.bindUrlToButton(this.id.delFilter, params.SEF_DEL_FILTER_URL); 22 } 23 24 var _ = template.getLibrary('_'); 25 var events = template.getLibrary('events'); 26 27 _.assignIn(this, new events()); 28} 29 30JCSmartFilterVertical2.prototype.keyup = function(input) 31{ 32 if(!!this.timer) 33 { 34 clearTimeout(this.timer); 35 } 36 this.timer = setTimeout(BX.delegate(function(){ 37 this.reload(input); 38 }, this), 500); 39}; 40 41JCSmartFilterVertical2.prototype.click = function(checkbox) 42{ 43 if(!!this.timer) 44 { 45 clearTimeout(this.timer); 46 } 47 48 this.timer = setTimeout(BX.delegate(function(){ 49 this.reload(checkbox); 50 }, this), 500); 51}; 52 53JCSmartFilterVertical2.prototype.reload = function(input) 54{ 55 if (this.cacheKey !== '') 56 { 57 //Postprone backend query 58 if(!!this.timer) 59 { 60 clearTimeout(this.timer); 61 } 62 this.timer = setTimeout(BX.delegate(function(){ 63 this.reload(input); 64 }, this), 1000); 65 return; 66 } 67 this.cacheKey = '|'; 68 69 this.position = BX.pos(input, true); 70 this.form = BX.findParent(input, {'tag':'form'}); 71 if (this.form) 72 { 73 var values = []; 74 values[0] = {name: 'ajax', value: 'y'}; 75 this.gatherInputsValues(values, BX.findChildren(this.form, {'tag': new RegExp('^(input|select)$', 'i')}, true)); 76 77 for (var i = 0; i < values.length; i++) 78 this.cacheKey += values[i].name + ':' + values[i].value + '|'; 79 80 if (this.cache[this.cacheKey]) 81 { 82 this.curFilterinput = input; 83 this.postHandler(this.cache[this.cacheKey], true); 84 } 85 else 86 { 87 if (this.sef) 88 { 89 var set_filter = BX(this.id.setFilter); 90 91 if (set_filter) 92 set_filter.disabled = true; 93 } 94 this.curFilterinput = input; 95 BX.ajax.loadJSON( 96 this.ajaxURL, 97 this.values2post(values), 98 BX.delegate(this.postHandler, this) 99 ); 100 } 101 } 102}; 103 104JCSmartFilterVertical2.prototype.updateItem = function (PID, arItem) 105{ 106 if (arItem.PROPERTY_TYPE === 'N' || arItem.PRICE) 107 { 108 var trackBar = window['trackBar' + PID]; 109 if (!trackBar && arItem.ENCODED_ID) 110 trackBar = window['trackBar' + arItem.ENCODED_ID]; 111 112 if (trackBar && arItem.VALUES) 113 { 114 if (arItem.VALUES.MIN) 115 { 116 if (arItem.VALUES.MIN.FILTERED_VALUE) 117 trackBar.setMinFilteredValue(arItem.VALUES.MIN.FILTERED_VALUE); 118 else 119 trackBar.setMinFilteredValue(arItem.VALUES.MIN.VALUE); 120 } 121 122 if (arItem.VALUES.MAX) 123 { 124 if (arItem.VALUES.MAX.FILTERED_VALUE) 125 trackBar.setMaxFilteredValue(arItem.VALUES.MAX.FILTERED_VALUE); 126 else 127 trackBar.setMaxFilteredValue(arItem.VALUES.MAX.VALUE); 128 } 129 } 130 } 131 else if (arItem.VALUES) 132 { 133 for (var i in arItem.VALUES) 134 { 135 if (arItem.VALUES.hasOwnProperty(i)) 136 { 137 var value = arItem.VALUES[i]; 138 var control = BX(value.CONTROL_ID); 139 140 if (!!control) 141 { 142 var label = document.querySelector('[data-role="label_'+value.CONTROL_ID+'"]'); 143 if (value.DISABLED) 144 { 145 control.setAttribute('disabled', 'disabled'); 146 147 if (label) 148 BX.addClass(label, 'disabled'); 149 else 150 BX.addClass(control.parentNode, 'disabled'); 151 } 152 else 153 { 154 control.removeAttribute('disabled'); 155 156 if (label) 157 BX.removeClass(label, 'disabled'); 158 else 159 BX.removeClass(control.parentNode, 'disabled'); 160 } 161 162 if (value.CHECKED) { 163 control.removeAttribute('disabled'); 164 165 if (label) 166 BX.removeClass(label, 'disabled'); 167 else 168 BX.removeClass(control.parentNode, 'disabled'); 169 } 170 171 if (value.hasOwnProperty('ELEMENT_COUNT')) 172 { 173 label = document.querySelector('[data-role="count_'+value.CONTROL_ID+'"]'); 174 if (label) 175 label.innerHTML = value.ELEMENT_COUNT; 176 } 177 } 178 } 179 } 180 } 181}; 182 183JCSmartFilterVertical2.prototype.postHandler = function (result, fromCache) 184{ 185 var hrefFILTER, url, curProp; 186 var modef = BX('SmartFilterVertical2-modef'); 187 var modef_num = BX('SmartFilterVertical2-modef-num'); 188 189 if (!!result && !!result.ITEMS) 190 { 191 for(var PID in result.ITEMS) 192 { 193 if (result.ITEMS.hasOwnProperty(PID)) 194 { 195 this.updateItem(PID, result.ITEMS[PID]); 196 } 197 } 198 199 if (!!modef && !!modef_num) 200 { 201 modef_num.innerHTML = result.ELEMENT_COUNT; 202 hrefFILTER = BX.findChildren(modef, {tag: 'A'}, true); 203 204 if (result.FILTER_URL && hrefFILTER) 205 { 206 hrefFILTER[0].href = BX.util.htmlspecialcharsback(result.FILTER_URL); 207 } 208 209 if (result.FILTER_AJAX_URL && result.COMPONENT_CONTAINER_ID) 210 { 211 BX.unbindAll(hrefFILTER[0]); 212 BX.bind(hrefFILTER[0], 'click', function(e) 213 { 214 url = BX.util.htmlspecialcharsback(result.FILTER_AJAX_URL); 215 BX.ajax.insertToNode(url, result.COMPONENT_CONTAINER_ID); 216 return BX.PreventDefault(e); 217 }); 218 } 219 220 if (result.INSTANT_RELOAD && result.COMPONENT_CONTAINER_ID) 221 { 222 url = BX.util.htmlspecialcharsback(result.FILTER_AJAX_URL); 223 BX.ajax.insertToNode(url, result.COMPONENT_CONTAINER_ID); 224 } 225 else 226 {
227 this.emit('refresh', BX.util.htmlspecialcharsback(result.FILTER_AJAX_URL)); 228 229 if (modef.style.display === 'none') 230 { 231 modef.style.top = this.curFilterinput.offsetTop - 8 + "px"; 232 modef.style.display = 'inline-block'; 233 } 234 235 if (this.viewMode === "VERTICAL") 236 { 237 curProp = BX.findChild(BX.findParent(this.curFilterinput, {'class':'bx-filter-parameters-box'}), {'class':'bx-filter-container-modef'}, true, false); 238 curProp.appendChild(modef); 239 modef.style.top = this.curFilterinput.offsetTop - 8 + "px"; 240 } 241 242 if (result.SEF_SET_FILTER_URL) 243 { 244 this.bindUrlToButton(this.id.setFilter, result.SEF_SET_FILTER_URL); 245 } 246 } 247 } 248 } 249 250 if (this.sef) 251 { 252 var set_filter = BX(this.id.setFilter); 253 254 if (set_filter) 255 set_filter.disabled = false; 256 } 257 258 if (!fromCache && this.cacheKey !== '') 259 { 260 this.cache[this.cacheKey] = result; 261 } 262 this.cacheKey = ''; 263}; 264 265JCSmartFilterVertical2.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 289JCSmartFilterVertical2.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 328JCSmartFilterVertical2.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 374JCSmartFilterVertical2.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(obj.getAttribute('data-expanded') === 'true') 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 obj.setAttribute('data-expanded', 'false'); 394 } 395 }).animate(); 396 397 BX.removeClass(propAngle, "property-expanded"); 398 } 399 else 400 { 401 filterBlock.style.display = "block"; 402 filterBlock.style.opacity = 0; 403 filterBlock.style.height = "auto"; 404 405 var obj_children_height = filterBlock.offsetHeight; 406 filterBlock.style.height = 0; 407 408 new BX.easing({ 409 duration : 300, 410 start : { opacity: 0, height: 0 }, 411 finish : { opacity: 1, height: obj_children_height }, 412 transition : BX.easing.transitions.quart, 413 step : function(state){ 414 filterBlock.style.opacity = state.opacity; 415 filterBlock.style.height = state.height + "px"; 416 },
417 complete : function() { 418 } 419 }).animate(); 420 421 obj.setAttribute('data-expanded', 'true'); 422 BX.addClass(propAngle, "property-expanded"); 423 } 424}; 425 426JCSmartFilterVertical2.prototype.showDropDownPopup = function(element, popupId) 427{ 428 var contentNode = element.querySelector('[data-role="dropdownContent"]'); 429 var popup = BX.PopupWindowManager.create("smartFilterDropDown"+popupId, element, { 430 autoHide: true, 431 offsetLeft: 0, 432 offsetTop: 3, 433 overlay : false, 434 draggable: {restrict:true}, 435 closeByEsc: true, 436 content: contentNode, 437 className: 'popup-window-catalog-smart-filter popup-window-catalog-smart-filter-vertical-2' 438 }); 439 440 popup.popupContainer.style.maxWidth = element.offsetWidth + 'px'; 441 popup.show(); 442}; 443 444JCSmartFilterVertical2.prototype.selectDropDownItem = function(element, controlId) 445{ 446 this.keyup(BX(controlId)); 447 448 var wrapContainer = BX.findParent(BX(controlId), {className:"catalog-smart-filter-item-select-wrapper"}, false); 449 450 var currentOption = wrapContainer.querySelector('[data-role="currentOption"]'); 451 currentOption.innerHTML = element.innerHTML; 452 BX.PopupWindowManager.getCurrentPopup().close(); 453}; 454 455BX.namespace("BX.Iblock.SmartFilterVertical2"); 456BX.Iblock.SmartFilterVertical2 = (function() 457{ 458 var SmartFilter = function(arParams) 459 { 460 if (typeof arParams === 'object') 461 { 462 this.variable = arParams.variable; 463 this.leftSlider = BX(arParams.leftSlider); 464 this.rightSlider = BX(arParams.rightSlider); 465 this.tracker = BX(arParams.tracker); 466 this.trackerWrap = BX(arParams.trackerWrap); 467 468 this.minInput = BX(arParams.minInputId); 469 this.maxInput = BX(arParams.maxInputId); 470 471 this.minPrice = parseFloat(arParams.minPrice); 472 this.maxPrice = parseFloat(arParams.maxPrice); 473 474 this.curMinPrice = parseFloat(arParams.curMinPrice); 475 this.curMaxPrice = parseFloat(arParams.curMaxPrice); 476 477 this.fltMinPrice = arParams.fltMinPrice ? parseFloat(arParams.fltMinPrice) : parseFloat(arParams.curMinPrice); 478 this.fltMaxPrice = arParams.fltMaxPrice ? parseFloat(arParams.fltMaxPrice) : parseFloat(arParams.curMaxPrice); 479 480 this.precision = arParams.precision || 0; 481 482 this.priceDiff = this.maxPrice - this.minPrice; 483 484 this.leftPercent = 0; 485 this.rightPercent = 0; 486 487 this.fltMinPercent = 0; 488 this.fltMaxPercent = 0; 489 490 this.colorUnavailableActive = BX(arParams.colorUnavailableActive);//gray 491 this.colorAvailableActive = BX(arParams.colorAvailableActive);//blue 492 this.colorAvailableInactive = BX(arParams.colorAvailableInactive);//light blue 493 494 this.isTouch = false; 495 496 this.init(); 497 498 if ('ontouchstart' in document.documentElement) 499 { 500 this.isTouch = true; 501 502 BX.bind(this.leftSlider, "touchstart", BX.proxy(function(event){ 503 this.onMoveLeftSlider(event) 504 }, this)); 505 506 BX.bind(this.rightSlider, "touchstart", BX.proxy(function(event){ 507 this.onMoveRightSlider(event) 508 }, this)); 509 } 510 else 511 { 512 BX.bind(this.leftSlider, "mousedown", BX.proxy(function(event){ 513 this.onMoveLeftSlider(event) 514 }, this)); 515 516 BX.bind(this.rightSlider, "mousedown", BX.proxy(function(event){ 517 this.onMoveRightSlider(event) 518 }, this)); 519 } 520 521 BX.bind(this.minInput, "keyup", BX.proxy(function(event){ 522 this.onInputChange(); 523 }, this)); 524 525 BX.bind(this.maxInput, "keyup", BX.proxy(function(event){ 526 this.onInputChange(); 527 }, this)); 528 } 529 }; 530 531 SmartFilter.prototype.init = function() 532 { 533 var priceDiff; 534 535 if (this.curMinPrice > this.minPrice) 536 { 537 priceDiff = this.curMinPrice - this.minPrice; 538 this.leftPercent = (priceDiff*100)/this.priceDiff; 539 540 this.leftSlider.style.left = this.leftPercent + "%"; 541 this.colorUnavailableActive.style.left = this.leftPercent + "%"; 542 } 543 544 this.setMinFilteredValue(this.fltMinPrice); 545 546 if (this.curMaxPrice < this.maxPrice) 547 { 548 priceDiff = this.maxPrice - this.curMaxPrice; 549 this.rightPercent = (priceDiff*100)/this.priceDiff; 550 551 this.rightSlider.style.right = this.rightPercent + "%"; 552 this.colorUnavailableActive.style.right = this.rightPercent + "%"; 553 } 554 555 this.setMaxFilteredValue(this.fltMaxPrice); 556 }; 557 558 SmartFilter.prototype.setMinFilteredValue = function (fltMinPrice) 559 { 560 this.fltMinPrice = parseFloat(fltMinPrice); 561 562 if (this.fltMinPrice >= this.minPrice) 563 { 564 var priceDiff = this.fltMinPrice - this.minPrice; 565 this.fltMinPercent = (priceDiff*100)/this.priceDiff; 566 567 if (this.leftPercent > this.fltMinPercent) 568 this.colorAvailableActive.style.left = this.leftPercent + "%"; 569 else 570 this.colorAvailableActive.style.left = this.fltMinPercent + "%"; 571 572 this.colorAvailableInactive.style.left = this.fltMinPercent + "%"; 573 } 574 else 575 { 576 this.colorAvailableActive.style.left = "0%"; 577 this.colorAvailableInactive.style.left = "0%"; 578 } 579 }; 580 581 SmartFilter.prototype.setMaxFilteredValue = function (fltMaxPrice) 582 { 583 this.fltMaxPrice = parseFloat(fltMaxPrice); 584 if (this.fltMaxPrice <= this.maxPrice) 585 { 586 var priceDiff = this.maxPrice - this.fltMaxPrice; 587 this.fltMaxPercent = (priceDiff*100)/this.priceDiff; 588 589 if (this.rightPercent > this.fltMaxPercent) 590 this.colorAvailableActive.style.right = this.rightPercent + "%"; 591 else 592 this.colorAvailableActive.style.right = this.fltMaxPercent + "%"; 593 594 this.colorAvailableInactive.style.right = this.fltMaxPercent + "%"; 595 } 596 else 597 { 598 this.colorAvailableActive.style.right = "0%"; 599 this.colorAvailableInactive.style.right = "0%"; 600 } 601 }; 602 603 SmartFilter.prototype.getXCoord = function(elem) 604 { 605 var box = elem.getBoundingClientRect(); 606 var body = document.body; 607 var docElem = document.documentElement; 608 609 var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft; 610 var clientLeft = docElem.clientLeft || body.clientLeft || 0; 611 var left = box.left + scrollLeft - clientLeft; 612 613 return Math.round(left); 614 }; 615 616 SmartFilter.prototype.getPageX = function(e) 617 { 618 e = e || window.event; 619 var pageX = null; 620 621 if (this.isTouch && event.targetTouches[0] !== null) 622 { 623 pageX = e.targetTouches[0].pageX; 624 } 625 else if (e.pageX !== null) 626 { 627 pageX = e.pageX; 628 } 629 else if (e.clientX !== null) 630 { 631 var html = document.documentElement; 632 var body = document.body; 633 634 pageX = e.clientX + (html.scrollLeft || body && body.scrollLeft || 0); 635 pageX -= html.clientLeft || 0; 636 } 637 638 return pageX; 639 }; 640 641 SmartFilter.prototype.recountMinPrice = function() 642 { 643 var newMinPrice = (this.priceDiff*this.leftPercent)/100; 644 newMinPrice = (this.minPrice + newMinPrice).toFixed(this.precision); 645 646 if (newMinPrice !== this.minPrice) 647 this.minInput.value = newMinPrice; 648 else 649 this.minInput.value = this.minPrice; 650 window[this.variable].keyup(this.minInput); 651 }; 652 653 SmartFilter.prototype.recountMaxPrice = function() 654 { 655 var newMaxPrice = (this.priceDiff*this.rightPercent)/100; 656 newMaxPrice = (this.maxPrice - newMaxPrice).toFixed(this.precision); 657 658 if (newMaxPrice !== this.maxPrice) 659 this.maxInput.value = newMaxPrice; 660 else 661 this.maxInput.value = this.maxPrice; 662 window[this.variable].keyup(this.maxInput); 663 }; 664 665 SmartFilter.prototype.onInputChange = function () 666 { 667 var priceDiff; 668 if (this.minInput.value) 669 { 670 var leftInputValue = this.minInput.value; 671 if (leftInputValue < this.minPrice) 672 leftInputValue = this.minPrice; 673 674 if (leftInputValue > this.maxPrice) 675 leftInputValue = this.maxPrice; 676 677 priceDiff = leftInputValue - this.minPrice; 678 this.leftPercent = (priceDiff*100)/this.priceDiff; 679 680 this.makeLeftSliderMove(false); 681 } 682 683 if (this.maxInput.value) 684 { 685 var rightInputValue = this.maxInput.value; 686 if (rightInputValue < this.minPrice) 687 rightInputValue = this.minPrice; 688 689 if (rightInputValue > this.maxPrice) 690 rightInputValue = this.maxPrice; 691 692 priceDiff = this.maxPrice - rightInputValue; 693 this.rightPercent = (priceDiff*100)/this.priceDiff; 694 695 this.makeRightSliderMove(false); 696 } 697 698 if (this.maxInput) { 699 window[this.variable].keyup(this.maxInput); 700 } else if (this.minInput) { 701 window[this.variable].keyup(this.minInput); 702 } 703 }; 704 705 SmartFilter.prototype.makeLeftSliderMove = function(recountPrice) 706 { 707 recountPrice = (recountPrice !== false); 708 709 this.leftSlider.style.left = this.leftPercent + "%"; 710 this.colorUnavailableActive.style.left = this.leftPercent + "%"; 711 712 var areBothSlidersMoving = false;
713 if (this.leftPercent + this.rightPercent >= 100) 714 { 715 areBothSlidersMoving = true; 716 this.rightPercent = 100 - this.leftPercent; 717 this.rightSlider.style.right = this.rightPercent + "%"; 718 this.colorUnavailableActive.style.right = this.rightPercent + "%"; 719 } 720 721 if (this.leftPercent >= this.fltMinPercent && this.leftPercent <= (100-this.fltMaxPercent)) 722 { 723 this.colorAvailableActive.style.left = this.leftPercent + "%"; 724 if (areBothSlidersMoving) 725 { 726 this.colorAvailableActive.style.right = 100 - this.leftPercent + "%"; 727 } 728 } 729 else if(this.leftPercent <= this.fltMinPercent) 730 { 731 this.colorAvailableActive.style.left = this.fltMinPercent + "%"; 732 if (areBothSlidersMoving) 733 { 734 this.colorAvailableActive.style.right = 100 - this.fltMinPercent + "%"; 735 } 736 } 737 else if(this.leftPercent >= this.fltMaxPercent) 738 { 739 this.colorAvailableActive.style.left = 100-this.fltMaxPercent + "%"; 740 if (areBothSlidersMoving) 741 { 742 this.colorAvailableActive.style.right = this.fltMaxPercent + "%"; 743 } 744 } 745 746 if (recountPrice) 747 { 748 this.recountMinPrice(); 749 if (areBothSlidersMoving) 750 this.recountMaxPrice(); 751 } 752 }; 753 754 SmartFilter.prototype.countNewLeft = function(event) 755 { 756 var pageX = this.getPageX(event); 757 758 var trackerXCoord = this.getXCoord(this.trackerWrap); 759 var rightEdge = this.trackerWrap.offsetWidth; 760 761 var newLeft = pageX - trackerXCoord; 762 763 if (newLeft < 0) 764 newLeft = 0; 765 else if (newLeft > rightEdge) 766 newLeft = rightEdge; 767 768 return newLeft; 769 }; 770 771 SmartFilter.prototype.onMoveLeftSlider = function(e) 772 { 773 if (!this.isTouch) 774 { 775 this.leftSlider.ondragstart = function() { 776 return false; 777 }; 778 } 779 780 if (!this.isTouch) 781 { 782 document.onmousemove = BX.proxy(function(event) { 783 this.leftPercent = ((this.countNewLeft(event)*100)/this.trackerWrap.offsetWidth); 784 this.makeLeftSliderMove(); 785 }, this); 786 787 document.onmouseup = function() { 788 document.onmousemove = document.onmouseup = null; 789 }; 790 } 791 else 792 { 793 document.ontouchmove = BX.proxy(function(event) { 794 this.leftPercent = ((this.countNewLeft(event)*100)/this.trackerWrap.offsetWidth); 795 this.makeLeftSliderMove(); 796 }, this); 797 798 document.ontouchend = function() { 799 document.ontouchmove = document.touchend = null; 800 }; 801 } 802 803 return false; 804 }; 805 806 SmartFilter.prototype.makeRightSliderMove = function(recountPrice) 807 { 808 recountPrice = (recountPrice !== false); 809 810 this.rightSlider.style.right = this.rightPercent + "%"; 811 this.colorUnavailableActive.style.right = this.rightPercent + "%"; 812 813 var areBothSlidersMoving = false; 814 if (this.leftPercent + this.rightPercent >= 100) 815 { 816 areBothSlidersMoving = true; 817 this.leftPercent = 100 - this.rightPercent; 818 this.leftSlider.style.left = this.leftPercent + "%"; 819 this.colorUnavailableActive.style.left = this.leftPercent + "%"; 820 } 821 822 if ((100-this.rightPercent) >= this.fltMinPercent && this.rightPercent >= this.fltMaxPercent) 823 { 824 this.colorAvailableActive.style.right = this.rightPercent + "%"; 825 if (areBothSlidersMoving) 826 { 827 this.colorAvailableActive.style.left = 100 - this.rightPercent + "%"; 828 } 829 } 830 else if(this.rightPercent <= this.fltMaxPercent) 831 { 832 this.colorAvailableActive.style.right = this.fltMaxPercent + "%"; 833 if (areBothSlidersMoving) 834 { 835 this.colorAvailableActive.style.left = 100 - this.fltMaxPercent + "%"; 836 } 837 } 838 else if((100-this.rightPercent) <= this.fltMinPercent) 839 { 840 this.colorAvailableActive.style.right = 100-this.fltMinPercent + "%"; 841 if (areBothSlidersMoving) 842 { 843 this.colorAvailableActive.style.left = this.fltMinPercent + "%"; 844 } 845 } 846 847 if (recountPrice) 848 { 849 this.recountMaxPrice(); 850 if (areBothSlidersMoving) 851 this.recountMinPrice(); 852 } 853 }; 854 855 SmartFilter.prototype.onMoveRightSlider = function(e) 856 { 857 if (!this.isTouch) 858 { 859 this.rightSlider.ondragstart = function() { 860 return false; 861 }; 862 } 863 864 if (!this.isTouch) 865 { 866 document.onmousemove = BX.proxy(function(event) { 867 this.rightPercent = 100-(((this.countNewLeft(event))*100)/(this.trackerWrap.offsetWidth)); 868 this.makeRightSliderMove(); 869 }, this); 870 871 document.onmouseup = function() { 872 document.onmousemove = document.onmouseup = null; 873 }; 874 } 875 else 876 { 877 document.ontouchmove = BX.proxy(function(event) { 878 this.rightPercent = 100-(((this.countNewLeft(event))*100)/(this.trackerWrap.offsetWidth)); 879 this.makeRightSliderMove(); 880 }, this); 881 882 document.ontouchend = function() { 883 document.ontouchmove = document.ontouchend = null; 884 }; 885 } 886 887 return false;
888 }; 889 890 return SmartFilter; 891})(); 892/* End */ 893; 894; /* Start:"a:4:{s:4:"full";s:103:"/local/templates/universe_si/components/bitrix/catalog.section/catalog.list.1/script.js?169831924911140";s:6:"source";s:87:"/local/templates/universe_si/components/bitrix/catalog.section/catalog.list.1/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 895(function() { 896 'use strict'; 897 898 if (!!window.JCCatalogSectionComponent) 899 return; 900 901 window.JCCatalogSectionComponent = function(params) { 902 this.formPosting = false; 903 this.siteId = params.siteId || ''; 904 this.ajaxId = params.ajaxId || ''; 905 this.template = params.template || ''; 906 this.componentPath = params.componentPath || ''; 907 this.parameters = params.parameters || ''; 908 909 if (params.navParams) 910 { 911 this.navParams = { 912 NavNum: params.navParams.NavNum || 1, 913 NavPageNomer: parseInt(params.navParams.NavPageNomer) || 1, 914 NavPageCount: parseInt(params.navParams.NavPageCount) || 1 915 }; 916 } 917 918 this.bigData = params.bigData || {enabled: false}; 919 this.container = document.querySelector('[data-entity="' + params.container + '"]'); 920 this.showMoreButton = null; 921 this.showMoreButtonMessage = null; 922 923 if (this.bigData.enabled && BX.util.object_keys(this.bigData.rows).length > 0) 924 { 925 BX.cookie_prefix = this.bigData.js.cookiePrefix || ''; 926 BX.cookie_domain = this.bigData.js.cookieDomain || ''; 927 BX.current_server_time = this.bigData.js.serverTime; 928 929 BX.ready(BX.delegate(this.bigDataLoad, this)); 930 } 931 932 if (params.initiallyShowHeader) 933 { 934 BX.ready(BX.delegate(this.showHeader, this)); 935 } 936 937 if (params.deferredLoad) 938 { 939 BX.ready(BX.delegate(this.deferredLoad, this)); 940 } 941 942 if (params.lazyLoad) 943 { 944 this.showMoreButton = document.querySelector('[data-use="show-more-' + this.navParams.NavNum + '"]'); 945 this.showMoreButtonMessage = this.showMoreButton.innerHTML; 946 BX.bind(this.showMoreButton, 'click', BX.proxy(this.showMore, this)); 947 } 948 949 if (params.loadOnScroll) 950 { 951 BX.bind(window, 'scroll', BX.proxy(this.loadOnScroll, this)); 952 } 953 }; 954 955 window.JCCatalogSectionComponent.prototype = 956 { 957 checkButton: function() 958 { 959 if (this.showMoreButton) 960 { 961 if (this.navParams.NavPageNomer == this.navParams.NavPageCount) 962 { 963 BX.remove(this.showMoreButton); 964 } 965 } 966 }, 967 968 enableButton: function() 969 { 970 if (this.showMoreButton) 971 { 972 BX.removeClass(this.showMoreButton, 'disabled'); 973 this.showMoreButton.innerHTML = this.showMoreButtonMessage; 974 } 975 }, 976 977 disableButton: function() 978 { 979 if (this.showMoreButton) 980 { 981 BX.addClass(this.showMoreButton, 'disabled'); 982 this.showMoreButton.innerHTML = BX.message('BTN_MESSAGE_LAZY_LOAD_WAITER'); 983 } 984 }, 985 986 loadOnScroll: function() 987 { 988 var scrollTop = BX.GetWindowScrollPos().scrollTop, 989 containerBottom = BX.pos(this.container).bottom; 990 991 if (scrollTop + window.innerHeight > containerBottom) 992 { 993 this.showMore(); 994 } 995 }, 996 997 showMore: function() 998 { 999 if (this.navParams.NavPageNomer < this.navParams.NavPageCount) 1000 { 1001 var data = {}; 1002 data['action'] = 'showMore'; 1003 data['PAGEN_' + this.navParams.NavNum] = this.navParams.NavPageNomer + 1; 1004 1005 if (!this.formPosting) 1006 { 1007 this.formPosting = true; 1008 this.disableButton(); 1009 this.sendRequest(data); 1010 } 1011 } 1012 }, 1013 1014 bigDataLoad: function() 1015 { 1016 var url = 'https://analytics.bitrix.info/crecoms/v1_0/recoms.php',
1017 data = BX.ajax.prepareData(this.bigData.params); 1018 1019 if (data) 1020 { 1021 url += (url.indexOf('?') !== -1 ? '&' : '?') + data; 1022 } 1023 1024 var onReady = BX.delegate(function(result){ 1025 this.sendRequest({ 1026 action: 'deferredLoad', 1027 bigData: 'Y', 1028 items: result && result.items || [], 1029 rid: result && result.id, 1030 count: this.bigData.count, 1031 rowsRange: this.bigData.rowsRange, 1032 shownIds: this.bigData.shownIds 1033 }); 1034 }, this); 1035 1036 BX.ajax({ 1037 method: 'GET', 1038 dataType: 'json', 1039 url: url, 1040 timeout: 3, 1041 onsuccess: onReady, 1042 onfailure: onReady 1043 }); 1044 }, 1045 1046 deferredLoad: function() 1047 { 1048 this.sendRequest({action: 'deferredLoad'}); 1049 }, 1050 1051 sendRequest: function(data) { 1052 var defaultData = { 1053 siteId: this.siteId, 1054 template: this.template, 1055 parameters: this.parameters 1056 }; 1057 if (this.ajaxId) 1058 { 1059 defaultData.AJAX_ID = this.ajaxId; 1060 } 1061 BX.ajax({ 1062 url: this.componentPath + '/ajax.php' + (document.location.href.indexOf('clear_cache=Y') !== -1 ? '?clear_cache=Y' : ''), 1063 method: 'POST', 1064 dataType: 'json', 1065 timeout: 60, 1066 data: BX.merge(defaultData, data), 1067 onsuccess: BX.delegate(function(result){ 1068 if (!result || !result.JS) 1069 return; 1070 1071 BX.ajax.processScripts( 1072 BX.processHTML(result.JS).SCRIPT, 1073 false, 1074 BX.delegate(function(){this.showAction(result, data);}, this) 1075 ); 1076 }, this) 1077 }); 1078 }, 1079 1080 showAction: function(result, data) 1081 { 1082 if (!data) 1083 return; 1084 1085 switch (data.action) 1086 { 1087 case 'showMore': 1088 this.processShowMoreAction(result); 1089 break; 1090 case 'deferredLoad': 1091 this.processDeferredLoadAction(result, data.bigData === 'Y'); 1092 break; 1093 } 1094 }, 1095 1096 processShowMoreAction: function(result) 1097 { 1098 this.formPosting = false; 1099 this.enableButton(); 1100 1101 if (result) 1102 { 1103 this.navParams.NavPageNomer++; 1104 this.processItems(result.items); 1105 this.processPagination(result.pagination); 1106 this.checkButton(); 1107 } 1108 }, 1109 1110 processDeferredLoadAction: function(result, bigData) 1111 { 1112 if (!result) 1113 return; 1114 1115 var position = bigData ? this.bigData.rows : {}; 1116 1117 this.processItems(result.items, BX.util.array_keys(position)); 1118 }, 1119 1120 processItems: function(itemsHtml, position) 1121 { 1122 if (!itemsHtml) 1123 return; 1124 1125 var processed = BX.processHTML(itemsHtml, false), 1126 temporaryNode = BX.create('DIV'); 1127 1128 var items, k, origRows; 1129 1130 temporaryNode.innerHTML = processed.HTML; 1131 items = temporaryNode.querySelectorAll('[data-entity="items-row"]'); 1132 1133 if (items.length) 1134 { 1135 this.showHeader(true); 1136 1137 for (k in items) 1138 { 1139 if (items.hasOwnProperty(k)) 1140 { 1141 origRows = position ? this.container.querySelectorAll('[data-entity="items-row"]') : false; 1142 //items[k].style.opacity = 0; 1143 1144 if (origRows && BX.type.isDomNode(origRows[position[k]])) 1145 { 1146 origRows[position[k]].parentNode.insertBefore(items[k], origRows[position[k]]); 1147 } 1148 else 1149 { 1150 this.container.appendChild(items[k]); 1151 } 1152 } 1153 } 1154 1155 /*new BX.easing({ 1156 duration: 2000,
1157 start: {opacity: 0}, 1158 finish: {opacity: 100}, 1159 transition: BX.easing.makeEaseOut(BX.easing.transitions.quad), 1160 step: function(state){ 1161 for (var k in items) 1162 { 1163 if (items.hasOwnProperty(k)) 1164 { 1165 items[k].style.opacity = state.opacity / 100; 1166 } 1167 } 1168 }, 1169 complete: function(){ 1170 for (var k in items) 1171 { 1172 if (items.hasOwnProperty(k)) 1173 { 1174 items[k].removeAttribute('style'); 1175 } 1176 } 1177 } 1178 }).animate();*/ 1179 } 1180 1181 BX.ajax.processScripts(processed.SCRIPT); 1182 }, 1183 1184 processPagination: function(paginationHtml) 1185 { 1186 if (!paginationHtml) 1187 return; 1188 1189 var pagination = document.querySelectorAll('[data-pagination-num="' + this.navParams.NavNum + '"]'); 1190 for (var k in pagination) 1191 { 1192 if (pagination.hasOwnProperty(k)) 1193 { 1194 pagination[k].innerHTML = paginationHtml; 1195 } 1196 } 1197 }, 1198 1199 showHeader: function(animate) 1200 { 1201 var parentNode = BX.findParent(this.container, {attr: {'data-entity': 'parent-container'}}), 1202 header; 1203 1204 if (parentNode && BX.type.isDomNode(parentNode)) 1205 { 1206 header = parentNode.querySelector('[data-entity="header"'); 1207 1208 if (header && header.getAttribute('data-showed') != 'true') 1209 { 1210 header.style.display = ''; 1211 1212 if (animate) 1213 { 1214 new BX.easing({ 1215 duration: 2000, 1216 start: {opacity: 0}, 1217 finish: {opacity: 100}, 1218 transition: BX.easing.makeEaseOut(BX.easing.transitions.quad), 1219 step: function(state){ 1220 header.style.opacity = state.opacity / 100; 1221 }, 1222 complete: function(){ 1223 header.removeAttribute('style'); 1224 header.setAttribute('data-showed', 'true'); 1225 } 1226 }).animate(); 1227 } 1228 else 1229 { 1230 header.style.opacity = 100; 1231 } 1232 } 1233 } 1234 } 1235 }; 1236})(); 1237/* End */ 1238;; /* /local/templates/universe_si/components/bitrix/catalog.smart.filter/vertical.2/script.js?169831924922564*/ 1239; /* /local/templates/universe_si/components/bitrix/catalog.section/catalog.list.1/script.js?169831924911140*/
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.