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