1;(function($) { 2 // wrap tables in content for swipe on mobile devices 3 $(function() { 4 var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/i.test(navigator.userAgent); 5 6 $('article.content').find('table').wrap('<div class="for-mobile-view"></div>'); 7 8 if(isMobile){ 9 $('html').addClass('mobile'); 10 } 11 var videos = []; 12 $('[data-video-src]').each(function(i, e) { 13 var video = { 14 src: $(e).data('video-src'), 15 autoplay: $(e).data('video-autoplay'), 16 loop: $(e).data('video-loop'), 17 poster: $(e).data('video-poster') 18 }; 19 if (video.src && !$(e).find('>.wm-video').size()) { 20 var srcs = video.src.split(';'); 21 var wrapper = document.createElement('div'); 22 wrapper.className = 'wm-video'; 23 24 var videoEl = document.createElement('video'); 25 26 if (video.autoplay) { 27 videoEl.autoplay = video.autoplay; 28 } 29 if (video.loop) { 30 videoEl.loop = video.loop; 31 } 32 if (video.poster) { 33 videoEl.poster = video.poster; 34 } 35 videos.push({ 36 el: $(e), 37 wrapper: $(wrapper), 38 video: $(videoEl) 39 }); 40 addEvent(videoEl, i); 41 videoEl.src = video.src; 42 $(wrapper).append(videoEl); 43 $(e).prepend(wrapper); 44 if (video.autoplay) { 45 try { 46 videoEl.play(); 47 } catch (e) {} 48 } 49 } 50 }); 51 function addEvent(v, i) { 52 v.addEventListener( "loadedmetadata", function () { 53 calcPosItem(i); 54 }, false ); 55 } 56 function calcPosItem(i) { 57 var c = videos[i].video[0].videoWidth/videos[i].video[0].videoHeight; 58 var d = videos[i].el.width()/videos[i].el.height(); 59 if(c > d) { 60 videos[i].wrapper.addClass('vertical'); 61 } else { 62 videos[i].wrapper.removeClass('vertical'); 63 } 64 } 65 function calcPos() { 66 for (var i = 0; i < videos.length; i++) { 67 calcPosItem(i); 68 } 69 } 70 $(window).resize(calcPos); 71 }); 72}(jQuery));/* 73 * wmS3Menu v1.0.0 74 * K.I. 433 75 */ 76;(function ($, window, document, undefined ) { 77 var pluginName = 'wmS3Menu', 78 defaults = { 79 screenButton: false, 80 responsiveTl: false, 81 responsiveTp: false, 82 responsiveMl: false, 83 moreText: '...', 84 childIcons: false, 85 childIconsClass: 'has-child-icon' 86 }; 87 // ÐÑовеÑка на каÑание 88 var isTouchable = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch; 89 var $win = $(window); 90 var winWidth = $win.width(); 91 var $doc = $(document); 92 93 var pluginObj = { 94 _events: { 95 hover: function(menuWrap, item, settings){ 96 var link = item.find('> a'); 97 var linkIcon = link.find('.' + settings.childIconsClass); 98 var iconLen = linkIcon.length; 99 var subMenu = item.find('> ul'); 100 var showTimeout; 101 // ÐÑобÑажение 102 function menuShow() { 103 clearTimeout(showTimeout); 104 item.siblings().find('> ul').css('display', ''); 105 // ÐпÑеделение Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²ÑпадаÑки ÑÑÐ¾Ð±Ñ Ð½Ðµ вÑводилоÑÑ Ð·Ð° пÑÐµÐ´ÐµÐ»Ñ Ð¾ÐºÐ½Ð° 106 pluginObj._menuPosition(subMenu); 107 108 link.addClass('hover'); 109 if (iconLen) { 110 linkIcon.addClass('hover'); 111 } 112 } 113 // СкÑÑÑие 114 function menuHide() { 115 showTimeout = setTimeout(function(){ 116 link.removeClass('hover'); 117 subMenu.css('display', ''); 118 if (iconLen) { 119 linkIcon.removeClass('hover'); 120 } 121 }, 500); 122 } 123 // ÐÑклÑÑение и подклÑÑение ÑобÑÑий 124 item.off({ 125 'mouseenter.wmS3Menu': menuShow, 126 'mouseleave.wmS3Menu': menuHide 127 }); 128 item.on({ 129 'mouseenter.wmS3Menu': menuShow, 130 'mouseleave.wmS3Menu': menuHide 131 }); 132 }, 133 click: function(menuWrap, item, settings){ 134 var link = item.find('> a'); 135 var linkIcon = link.find('.' + settings.childIconsClass); 136 var iconLen = linkIcon.length; 137 var subMenu = item.find('> ul'); 138 // ÐеÑеклÑÑение оÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ 139 function menuToggle() { 140 if (subMenu.is(':visible')) { 141 if (isTouchable) { 142 document.location = link.attr('href'); 143 } 144 link.removeClass('hover'); 145 subMenu.css('display', ''); 146 item.removeClass('submenu-opened'); 147 if (iconLen) { 148 linkIcon.removeClass('hover'); 149 } 150 } else { 151 item.siblings().find('> ul').css('display', ''); 152 item.siblings().find('> a').removeClass('hover'); 153 item.siblings().find('> a .' + settings.childIconsClass).removeClass('hover'); 154 // ÐпÑеделение Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²ÑпадаÑки ÑÑÐ¾Ð±Ñ Ð½Ðµ вÑводилоÑÑ Ð·Ð° пÑÐµÐ´ÐµÐ»Ñ Ð¾ÐºÐ½Ð° 155 pluginObj._menuPosition(subMenu); 156 157 link.addClass('hover'); 158 item.addClass('submenu-opened'); 159 if (iconLen) { 160 linkIcon.addClass('hover'); 161 } 162 } 163 return false; 164 } 165 // ÐÑклÑÑение и подклÑÑение ÑобÑÑий 166 link.off('click.wmS3Menu'); 167 link.on('click.wmS3Menu', menuToggle); 168 }, 169 click_tree: function(menuWrap, item, settings){ 170 var link = item.find('> a'); 171 var linkIcon = link.find('.' + settings.childIconsClass); 172 var subMenu = item.find('> ul'); 173 // ÐеÑеклÑÑение оÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ 174 function menuToggle(event) { 175 var targ = $(event.target); 176 177 if (targ.closest(linkIcon).length) { 178 if (subMenu.is(':visible')) { 179 link.removeClass('hover'); 180 subMenu.css('display', ''); 181 item.removeClass('submenu-opened'); 182 linkIcon.removeClass('hover'); 183 } else { 184 // ÐпÑеделение Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²ÑпадаÑки ÑÑÐ¾Ð±Ñ Ð½Ðµ вÑводилоÑÑ Ð·Ð° пÑÐµÐ´ÐµÐ»Ñ Ð¾ÐºÐ½Ð° 185 pluginObj._menuPosition(subMenu); 186 187 link.addClass('hover'); 188 item.addClass('submenu-opened'); 189 linkIcon.addClass('hover'); 190 } 191 return false; 192 } 193 } 194 // ÐÑклÑÑение и подклÑÑение ÑобÑÑий 195 link.off('click.wmS3Menu'); 196 link.on('click.wmS3Menu', menuToggle); 197 } 198 }, 199 _menuPosition: function(subMenu) { 200 // ÐпÑеделение Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²ÑпадаÑки ÑÑÐ¾Ð±Ñ Ð½Ðµ вÑводилоÑÑ Ð·Ð° пÑÐµÐ´ÐµÐ»Ñ Ð¾ÐºÐ½Ð° 201 winWidth = $win.width(); 202 203 subMenu.css('display', 'block'); 204 205 // if (subMenu.parent().hasClass('first-level') === false) { 206 subMenu.css({ 207 'visibility': 'hidden', 208 'opacity': 0 209 }); 210 211 var menuRect = subMenu[0].getBoundingClientRect(); 212 var marginR = parseInt(subMenu.css('margin-right')); 213 var parentWidth = subMenu.parent().width(); 214 215 if (marginR > parentWidth) { 216 subMenu.css('margin-right', parentWidth);
217 } 218 219 if (menuRect.right >= winWidth) { 220 subMenu.css({ 221 'left': '-100%', 222 'margin-left': 0 223 }); 224 } 225 subMenu.css({ 226 'visibility': '', 227 'opacity': '' 228 }); 229 // } 230 } 231 }; 232 function Plugin(element, options) { 233 this.element = element; 234 235 this.options = $.extend({}, defaults, options, $(this.element).data()) ; 236 237 this._defaults = defaults; 238 this._name = pluginName; 239 240 this.init(); 241 } 242 Plugin.prototype = { 243 init: function () { 244 var settings = this.options; 245 // ÐпÑеделение ÑиÑÐ¸Ð½Ñ Ð¼ÐµÐ´Ð¸Ð° 246 var moreButFlag = false; 247 if (window.matchMedia('all and (max-width: 640px)').matches) { 248 moreButFlag = settings.responsiveMl; 249 } else if (window.matchMedia('all and (max-width: 768px)').matches) { 250 //moreButFlag = settings.responsiveTp; 251 } else if (window.matchMedia('all and (max-width: 960px)').matches) { 252 moreButFlag = settings.responsiveTl; 253 } else { 254 moreButFlag = settings.screenButton; 255 } 256 // ÐбеÑÑка Ð¼ÐµÐ½Ñ 257 var menuWrap = $(this.element); 258 var menuClass = menuWrap.attr('class'); 259 var menuMainUl = $(this.element.querySelector('ul')); 260 var widgetClass = menuClass.match(/widget-\d+/)[0]; 261 // ÐÑовеÑка на налиÑие Ð¼ÐµÐ½Ñ Ð² Side panel 262 if (window.side_panel_controller && side_panel_controller.inPanel(widgetClass)) { 263 moreButFlag = false; 264 } 265 266 menuMainUl.children().addClass('first-level'); 267 // ÐаÑÑÑойки Ð´Ð»Ñ Ð³Ð¾ÑизонÑалÑного Ð¼ÐµÐ½Ñ 268 if (!!menuClass.match(/horizontal/i)) { 269 var menuWidth = menuMainUl.width(); 270 var itemsWidth = 0, hideArr = [], hideLength; 271 // Ðнопка More 272 var moreBut = menuMainUl.find('.more-button'); 273 if (!moreBut.length) { 274 moreBut = $('<li class="more-button"><a href="#" onclick="return false;"><span>' + settings.moreText + '</span></a></li>');// data-trigger="click" 275 menuMainUl.append(moreBut); 276 } 277 // ÐÐµÐ½Ñ More 278 var moreMenu = moreBut.find('> ul'); 279 if (!moreMenu.length) { 280 moreMenu = $('<ul></ul>'); 281 moreBut.append(moreMenu); 282 } 283 284 moreBut.removeClass('removed').attr('data-trigger', 'hover'); 285 menuMainUl.children().css('display', ''); 286 287 var firstLevelItems = menuMainUl.children(':visible').not('.more-button'); 288 moreMenu.html(''); 289 290 if (moreButFlag === 'more' || moreButFlag === 'button') { 291 moreBut.removeClass('disabled'); 292 293 menuWidth -= moreBut.outerWidth(); 294 295 firstLevelItems.each(function(){ 296 var thisItem = $(this); 297 itemsWidth += thisItem.outerWidth(true); 298 if (itemsWidth > menuWidth) { 299 hideArr.push(thisItem.clone()); 300 thisItem.hide(); 301 } 302 }); 303 304 hideLength = hideArr.length; 305 if (hideLength) { 306 for (var ind = 0; ind < hideLength; ind++) { 307 moreMenu.append(hideArr[ind]); 308 } 309 moreBut.removeClass('disabled'); 310 } else { 311 moreBut.addClass('disabled'); 312 } 313 } else { 314 moreBut.addClass('disabled'); 315 } 316 } 317 // ÐложеннÑе подÑÑовни Ð¼ÐµÐ½Ñ 318 var menuInner = menuMainUl.find('ul'); 319 var menuItems = menuInner.parent(); 320 var menuLinks = menuItems.find('> a'); 321 // СÑÑелоÑки Ð´Ð»Ñ Ð¿Ð¾Ð´ÑÑовней 322 var menuLinksIcons = menuLinks.find('.' + settings.childIconsClass); 323 var childIconLen = menuLinksIcons.length; 324 // Тип оÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð¼ÐµÐ½Ñ 325 var mShow = 'popup'; 326 if (!!menuClass.match(/dropdown/i)) { 327 mShow = 'dropdown'; 328 } else if (!!menuClass.match(/treemenu/i)) { 329 mShow = 'treemenu'; 330 } 331 if (mShow === 'popup') { 332 menuInner.hide(); 333 } 334 if (childIconLen) { 335 menuLinksIcons.remove(); 336 } 337 if (!!settings.childIcons) { 338 // Ðобавление ÑÑÑелоÑек Ð´Ð»Ñ Ð¿Ð¾Ð´ÑÑовней 339 var childIconHTML = '<em class="' + settings.childIconsClass + '"></em>'; 340 341 if (mShow === 'treemenu') { 342 childIconHTML = '<em class="' + settings.childIconsClass + '"><b style="position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px;"></b></em>'; 343 } 344 345 var childIconTag = $(childIconHTML); 346 menuLinks.append(childIconTag.clone()); 347 348 menuLinksIcons = menuLinks.find('.' + settings.childIconsClass); 349 childIconLen = menuLinksIcons.length; 350 } 351 // Удаление вÑÐµÑ ÑобÑÑий на ÑÑÑÐ»ÐºÐ°Ñ 352 menuLinks.removeClass('hover').off('click.wmS3Menu'); 353 menuInner.css('display', ''); 354 if (childIconLen) { 355 menuLinksIcons.removeClass('hover'); 356 } 357 358 menuItems.each(function() { 359 var thisItem = $(this); 360 var trigger = thisItem.data('trigger') || 'hover'; 361 362 if (mShow === 'dropdown' || isTouchable) { 363 trigger = 'click'; 364 } else if (mShow === 'treemenu') { 365 trigger = 'click_tree'; 366 } 367 pluginObj._events[trigger](menuWrap, thisItem, settings); 368 });
369 // Ðлик по докÑменÑÑ 370 if (isTouchable) { 371 function docClick(e) { 372 var target = $(e.target); 373 if (target.closest(menuWrap).length === 0) { 374 menuLinks.removeClass('hover'); 375 menuInner.css('display', ''); 376 menuItems.removeClass('submenu-opened'); 377 378 if (childIconLen) { 379 menuLinksIcons.removeClass('hover'); 380 } 381 } 382 } 383 $doc.off('touchstart.wmS3Menu', docClick); 384 $doc.on('touchstart.wmS3Menu', docClick); 385 } 386 }, 387 update: function () { 388 this.init(); 389 } 390 }; 391 if (!$.fn[pluginName]) { 392 $.fn[pluginName] = function (options) { 393 var args = arguments; 394 if (options === undefined || typeof options === 'object') { 395 return this.each(function () { 396 if (!$.data(this, 'plugin_' + pluginName)) { 397 $.data(this, 'plugin_' + pluginName, new Plugin(this, options)); 398 } 399 }); 400 } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') { 401 var returns; 402 this.each(function () { 403 var instance = $.data(this, 'plugin_' + pluginName); 404 if (instance instanceof Plugin && typeof instance[options] === 'function') { 405 returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1)); 406 } 407 if (options === 'destroy') { 408 $.data(this, 'plugin_' + pluginName, null); 409 } 410 }); 411 return returns !== undefined ? returns : this; 412 } 413 }; 414 } 415 $(function () { 416 var wmMenuWrap = $('.wm-widget-menu.horizontal'); 417 wmMenuWrap[pluginName](); 418 419 $win.on('resize.wmS3Menu', function(){ 420 wmMenuWrap[pluginName]('update'); 421 }); 422 }); 423 424 setTimeout(function(){ 425 $win.trigger('resize'); 426 }, 500); 427}(jQuery, window, document)); 428$(function () { 429 $(document).click(function (event) { 430 $('.contacts-block').each(function() { 431 if ($(event.target).closest($(this)).length) { 432 return; 433 } else { 434 $(this).find('.tgl-but').prop("checked", false); 435 $(this).find('.icon').removeClass('active'); 436 } 437 }); 438 }); 439 440 function setMargin($block) { 441 if (Math.max(document.documentElement.clientWidth, window.innerWidth || 0) > 960) { 442 $block.find(".block-body-drop").css({ 443 "margin-left": "0px" 444 }); 445 } else { 446 var left = $block.offset().left * -1; 447 $block.find(".block-body-drop").css({ 448 "margin-left": left + "px" 449 }); 450 } 451 } 452 453 $('.contacts-block').each(function() { 454 var $block = $(this), 455 allClasses = $block.attr("class").split(" "), 456 mainClass = allClasses[0], 457 mainSelector = document.location.pathname == "/" ? ".title-page .side-panel ."+mainClass+" .block-body-drop" : ".side-panel ."+mainClass+" .block-body-drop", 458 styles = document.styleSheets; 459 460 for(var i = 0; i < styles.length; i++) { 461 if (styles[i].href && styles[i].href.indexOf("styles.css") !== -1) { 462 for(var j = 0; j < styles[i].cssRules.length; j++) { 463 if (styles[i].cssRules[j].selectorText == mainSelector && styles[i].cssRules[j].style.width == "100vw") { 464 $block.data("fullwidth", 1); 465 setMargin($block); 466 break; 467 } 468 } 469 break; 470 } 471 } 472 }); 473 474 $(window).resize(function() { 475 $('.contacts-block').each(function() { 476 var $block = $(this); 477 if ($block.data("fullwidth") == 1) { 478 setMargin($block); 479 } 480 }); 481 }); 482 483 $('.contacts-block').each(function() { 484 var $block = $(this); 485 $block.find('.icon').click(function() { 486 if ($block.data("fullwidth") == 1) { 487 setMargin($block); 488 } 489 if ($block.find('.tgl-but').prop("checked")) { 490 $(this).removeClass('active'); 491 } else { 492 $(this).addClass('active'); 493 } 494 }); 495 }); 496}); 497;(function(window, document) { 498 if (!window.photoSwipeSettings) { 499 window.photoSwipeSettings = {}; 500 } 501 502 var psSettings = window.photoSwipeSettings; 503 504 function initPhotoSwipeFunc(settings) { 505 if (!settings.preloadImages) { 506 settings.preloadImages = false; 507 } 508 509 var settingsKeys = Object.keys(psSettings); 510 511 if (settingsKeys.length) { 512 settingsKeys.forEach(function(key) { 513 if (key !== 'hashData') { 514 psSettings[key].push(settings[key]); 515 } 516 }); 517 } else {
518 Object.keys(settings).forEach(function(key) { 519 psSettings[key] = []; 520 521 psSettings[key].push(settings[key]); 522 }); 523 } 524 525 var galleryIteration = 0; 526 527 psSettings.gallery.forEach(function(str){ 528 if (str === settings.gallery) { 529 galleryIteration++; 530 } 531 var index = psSettings.gallery.indexOf(settings.gallery); 532 533 if (galleryIteration > 1) { 534 settingsKeys.forEach(function(key) { 535 if (key !== 'hashData') { 536 psSettings[key].splice(index, 1); 537 } 538 }); 539 galleryIteration = 0; 540 } 541 }); 542 543 if (!psSettings.hashData) { 544 psSettings.hashData = photoswipeParseHash(); 545 } 546 547 var hashData = psSettings.hashData; 548 var hashDataKeys = Object.keys(hashData); 549 550 if (hashDataKeys.length) { 551 settings.preloadImages = true; 552 } 553 554 var galleryElements = document.querySelectorAll(psSettings.gallery.join(',')); 555 var galleryLength = galleryElements.length; 556 557 var pswpHTML = '<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true"><div class="pswp__bg"></div><div class="pswp__scroll-wrap"><div class="pswp__container"><div class="pswp__item"></div><div class="pswp__item"></div><div class="pswp__item"></div></div><div class="pswp__ui pswp__ui--hidden"><div class="pswp__top-bar"><div class="pswp__counter"></div><button class="pswp__button pswp__button--close" title="Close (Esc)"></button>'; 558 var pswpHTMLEnd = '<div class="pswp__preloader"><div class="pswp__preloader__icn"><div class="pswp__preloader__cut"><div class="pswp__preloader__donut"></div></div></div></div></div><div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap"><div class="pswp__share-tooltip"></div></div><button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)"></button><button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)"></button><div class="pswp__caption"><div class="pswp__caption__center"></div></div></div></div></div>'; 559 var pswpShare = '', pswpFullscreen = '', pswpZoom = '', curGallery; 560 561 for(var i = 0; i < galleryLength; i++) { 562 curGallery = galleryElements[i]; 563 564 if (curGallery.getAttribute('data-popup-share') === '1') { 565 pswpShare = '<button class="pswp__button pswp__button--share" title="Share"></button>' 566 } 567 if (curGallery.getAttribute('data-popup-fullscreen') === '1') { 568 pswpFullscreen = '<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>'; 569 } 570 if (curGallery.getAttribute('data-popup-zoom') === '1') { 571 pswpZoom = '<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>'; 572 } 573 574 curGallery.setAttribute('data-pswp-uid', i+1); 575 curGallery.dataGID = i+1; 576 577 if (settings.preloadImages) { 578 parseGalleryImages(curGallery); 579 } else { 580 parseGalleryThumbs(curGallery); 581 582 if (hashData.pid && hashData.gid && hashData.gid === curGallery.dataGID) { 583 openPhotoSwipe(hashData.pid, galleryElements[hashData.gid - 1], true, true); 584 } 585 } 586 } 587 588 var pswpOverlay = document.querySelectorAll('.pswp'); 589 590 if (pswpOverlay.length === 0) { 591 pswpHTML = pswpHTML + pswpShare + pswpFullscreen + pswpZoom + pswpHTMLEnd; 592 593 var pswpContainer = document.createElement('div'); 594 pswpContainer.innerHTML = pswpHTML; 595 596 document.body.appendChild(pswpContainer); 597 } 598 599 function parseGalleryImages(gallery){ 600 var images = gallery.querySelectorAll(settings.item + ' img'); 601 var imagesLen = images.length; 602 var loadedArr = []; 603 604 for (var ind = 0; ind < imagesLen; ind++) { 605 setDataSize(images[ind]); 606 } 607 function setDataSize(img) { 608 var tempImg = new Image(); 609 610 var link = closest(img, function(el) { 611 return (el.tagName && el.tagName === 'A'); 612 }); 613 614 if(link){ 615 tempImg.src = link.getAttribute('href'); 616 } 617 618 if (!link) {return false;} 619 620 621 tempImg.addEventListener('load', function() { 622 link.setAttribute('data-size', tempImg.naturalWi
622dth + 'x' + tempImg.naturalHeight); 623 tempImg = null; 624 625 loadedArr.push('loaded'); 626 627 if (loadedArr.length === imagesLen) { 628 parseGalleryThumbs(gallery); 629 630 if (hashData.pid && hashData.gid && hashData.gid === gallery.dataGID) { 631 openPhotoSwipe(hashData.pid, galleryElements[hashData.gid - 1], true, true); 632 } 633 } 634 }); 635 } 636 } 637 function parseGalleryThumbs(gallery) { 638 var thumbs = gallery.querySelectorAll(settings.item); 639 var thumbsLen = thumbs.length; 640 var items = []; 641 var item, link, image, title, desc, size, obj; 642 643 for (var i = 0; i < thumbsLen; i++) { 644 item = thumbs[i]; 645 646 item.dataPSIndex = i; 647 item.addEventListener('click', onThumbsClick); 648 649 image = item.querySelector('img'); 650 link = item.querySelector('a[data-size]'); 651 652 title = link.getAttribute('data-title'); 653 desc = item.querySelector(settings.itemDesc); 654 655 size = link.getAttribute('data-size').split('x'); 656 657 obj = { 658 src: link.getAttribute('href'), 659 w: parseInt(size[0], 10), 660 h: parseInt(size[1], 10) 661 }; 662 663 if (title) { 664 obj.title = title; 665 } 666 667 if (desc && desc.innerHTML) { 668 obj.title += '<br /><small>' + desc.innerHTML + '</small>'; 669 } 670 671 if (link.children.length > 0) { 672 obj.msrc = image.getAttribute('src'); 673 } 674 675 obj.el = item; 676 677 items.push(obj); 678 } 679 680 return items; 681 } 682 function onThumbsClick(e) { 683 e = e || window.event; 684 685 e.preventDefault ? e.preventDefault() : e.returnValue = false; 686 687 var eTarget = e.target || e.srcElement; 688 689 var clickedItem = closest(eTarget, function(el) { 690 return ('dataPSIndex' in el); 691 }); 692 693 var clickedGallery = closest(clickedItem, function(el) { 694 return el.getAttribute('data-pswp-uid'); 695 }); 696 697 var index = clickedItem.dataPSIndex; 698 699 openPhotoSwipe(index, clickedGallery); 700 701 return false; 702 } 703 function closest(el, fn) { 704 return el && (fn(el) ? el : closest(el.parentNode, fn)); 705 } 706 function openPhotoSwipe(index, gallery, disableAnimation, fromURL) { 707 var pswpElement = document.querySelectorAll('.pswp')[0]; 708 if (!gallery) { 709 return false; 710 } 711 var items = parseGalleryThumbs(gallery); 712 var options = { 713 galleryUID: gallery.getAttribute('data-pswp-uid'), 714 getThumbBoundsFn: function(index) { 715 var thumbnail = items[index].el.getElementsByTagName('img')[0]; 716 var pageYScroll = window.pageYOffset || document.documentElement.scrollTop; 717 var rect = thumbnail.getBoundingClientRect(); 718 719 return {x:rect.left, y:rect.top + pageYScroll, w:rect.width}; 720 } 721 }; 722 if (fromURL) { 723 if(options['galleryPIDs']) { 724 for (var j = 0; j < items.length; j++) { 725 if (items[j].pid === index) { 726 options.index = j; 727 break; 728 } 729 } 730 } else { 731 options.index = parseInt(index, 10) - 1; 732 } 733 } else { 734 options.index = parseInt(index, 10); 735 } 736 if (isNaN(options.index) ) { 737 return; 738 } 739 if (disableAnimation) { 740 options.showAnimationDuration = 0; 741 options.hideAnimationDuration = 0; 742 } 743 var pswpGallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options); 744 pswpGallery.init(); 745 pswpGallery.listen('close', function() { 746 setTimeout(function(){ 747 pswpElement.classList.remove('pswp--open'); 748 }, 500); 749 }); 750 } 751 function photoswipeParseHash() { 752 var hash = location.hash.substring(1), params = {}; 753 754 if (hash.length < 5) { 755 return params; 756 } 757 758 var vars = hash.split('&'), varsL = vars.length, pair; 759 760 for (var i = 0; i < varsL; i++) {
761 if (!vars[i]) {continue;} 762 763 pair = vars[i].split('='); 764 765 if (pair.length < 2) {continue;} 766 767 params[pair[0]] = pair[1]; 768 } 769 770 if (params.gid) { 771 params.gid = parseInt(params.gid, 10); 772 } 773 774 return params; 775 } 776 } 777 778 if (!window.initPhotoSwipeFunc) { 779 window.initPhotoSwipeFunc = initPhotoSwipeFunc; 780 } 781}(window, document)); 782 783$(function() { 784 785 var $win = $(window); 786 787 var debounce = (function () { 788 return function (fn, time) { 789 var timer, func; 790 func = function() { 791 var args = [].slice.call(arguments, 0); 792 window.clearTimeout(timer); 793 timer = window.setTimeout(function () { 794 window.requestAnimationFrame && window.requestAnimationFrame(function() { 795 fn.apply(null, args); 796 }) || fn.apply(null, args); 797 }, time) 798 }; 799 return func; 800 } 801 }()); 802 803 var throttle = (function() { 804 return function (fn, threshhold, scope) { 805 threshhold || (threshhold = 250); 806 var last, 807 deferTimer, 808 func; 809 func = function () { 810 var context = scope || this; 811 var now = +new Date, 812 args = arguments; 813 if (last && now < last + threshhold) { 814 // hold on to it 815 clearTimeout(deferTimer); 816 deferTimer = setTimeout(function () { 817 last = now; 818 fn.apply(context, args); 819 }, threshhold); 820 } else { 821 last = now; 822 fn.apply(context, args); 823 } 824 }; 825 return func; 826 } 827 }()); 828 829 var psSettings = { 830 gallery: '.blocklist .body', 831 item: '.image', 832 itemDesc: '.text', 833 preloadImages: true 834 }; 835 836 $('.blocklist').each(function() { 837 var $blocklist = $(this), 838 $items = $blocklist.find('.item-outer'), 839 $list = $blocklist.find('.list'), 840 $body = $blocklist.find('.body'), 841 $controls = $blocklist.find('.controls'), 842 $pagers = $blocklist.find('.bx-pager-wrap'), 843 //$auto_controls = $blocklist.find('.auto_controls'), 844 options = {}, 845 count, 846 col_arr, pager_arr, controls_arr, 847 bxslider, 848 auto_controls_arr, 849 containerWidth, 850 isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), 851 media_type, 852 //id = $blocklist.attr('data-layer_id') ? $blocklist.attr('data-layer_id') : $blocklist.attr('item_id'), 853 slider_arr = $blocklist.attr('data-slider').split(","), 854 swipe_arr = $blocklist.attr('data-swipe').split(","); 855 856 // Equal height 857 858 var equalizerSelector = $blocklist.attr('data-setting-vertical_aligner'), 859 isItemFlex; 860 861 function columnConform() { 862 var rowDivs = [], 863 currentTallest = 0, 864 currentRowStart = 0; 865 866 isItemFlex = $items.find('.item').css('display') == 'flex'; 867 868 $items.each(function(index) { 869 // Refresh 870 $(this).find(equalizerSelector).css('min-height', ''); 871 $(this).find(equalizerSelector).css('margin-top', ''); 872 873 var $itemOuter = $(this), 874 $item = $itemOuter.find('.item'), 875 itemHeight = sumChildrenHeight($item); 876 877 $item.data("originalHeight", itemHeight); 878 879 if (currentRowStart != $itemOuter.position().top) { 880 if (rowDivs.length > 1) { 881 for (var currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) { 882 setConformingHeight(rowDivs[currentDiv], currentTallest); 883 } 884 } 885 886 // set the variables for the new row 887 rowDivs = []; 888 currentRowStart = $itemOuter.position().top; 889 currentTallest = itemHeight; 890 rowDivs.push($item); 891 892 } else { 893 rowDivs.push($item); 894 895 currentTallest = (currentTallest < itemHeight) ? (itemHeight) : (currentTallest); 896 } 897 898 }); 899 900 // do the last row 901 if (rowDivs.length > 1) { 902 for (var currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) { 903 setConformingHeight(rowDivs[currentDiv], currentTallest); 904 } 905 } 906 } 907 908 function setConformingHeight(el, newHeight) { 909 var $equalizer = el.find(equalizerSelector); 910 911 if (!$equalizer.length) return; 912 913 var $beforeEqualizer = $equalizer.prev(), 914 elHeight = (el.data("originalHeight") == undefined) ? (sumChildrenHeight(el)) : (el.data("originalHeight")), 915 differHeight = newHeight - elHeight; 916 917 if (differHeight == 0) return; 918 919 var equalizerMargin = parseInt(document.defaultView.getComputedStyle($equalizer[0], "").marginTop), 920 beforeEqualizerMargin = !isItemFlex && $beforeEqualizer.length ? parseInt(document.defaultView.getComputedStyle($beforeEqualizer[0], "").marginBottom) : 0, 921 newMargin = equalizerMargin>beforeEqualizerMargin ? equalizerMargin : beforeEqualizerMargin; 922
923 $equalizer.css('margin-top', differHeight+newMargin); 924 } 925 926 function sumChildrenHeight(el) { 927 var sum = 0; 928 el.children().each(function() { 929 sum += $(this).outerHeight(); 930 }); 931 return sum; 932 } 933 934 if (equalizerSelector && equalizerSelector !== "none") { 935 setTimeout(function () { 936 columnConform(); 937 }, 0); 938 939 $win.on('resize', debounce(columnConform, 300)); 940 } 941 942 if (slider_arr.indexOf('1')>-1 && $.fn.bxSlider) { 943 944 options.pagerSelector= $blocklist.attr('data-setting-pager_selector'); 945 options.prevSelector = $blocklist.attr('data-setting-prev_selector'); 946 options.nextSelector = $blocklist.attr('data-setting-next_selector'); 947 options.prevText = $blocklist.attr('data-setting-prev_text') || ''; 948 options.nextText = $blocklist.attr('data-setting-next_text') || ''; 949 options.auto = !!parseInt($blocklist.attr('data-setting-auto')); 950 options.controls = !!parseInt($blocklist.attr('data-setting-controls')); 951 options.pager = !!parseInt($blocklist.attr('data-setting-pager').split(',')[0]); 952 options.pause = parseInt($blocklist.attr('data-setting-pause'), 10) || 4000; 953 options.useCSS = isMobile; 954 options.infiniteLoop = true; 955 options.adaptiveHeight = false; 956 options.mode = $blocklist.attr('data-setting-mode') || 'horizontal'; 957 options.touchEnabled = options.mode === 'horizontal'; 958 options.slideMargin = 0; 959 options.maxSlides = parseInt($blocklist.attr('data-setting-count').split(',')[0], 10) || 1; 960 options.minSlides = options.mode === 'horizontal' ? 1 : options.maxSlides; 961 options.moveSlides = $blocklist.attr('data-setting-move') || 0; 962 options.autoControlsSelector = $blocklist.attr('data-setting-auto_controls_selector'); 963 options.autoControls = !!parseInt($blocklist.attr('data-setting-auto_controls').split(',')[0]); 964 options.autoControlsCombine = !!parseInt($blocklist.attr('data-setting-autoControlsCombine')); 965 options.autoHover = true; 966 967 col_arr = $blocklist.attr('data-setting-columns').split(","); 968 pager_arr = $blocklist.attr('data-setting-pager').split(","); 969 controls_arr = $blocklist.attr('data-setting-controls').split(","); 970 auto_controls_arr = $blocklist.attr('data-setting-auto_controls').split(","); 971 972 if (!options.autoControls && options.auto) { 973 options.onSlideAfter = function() {
974 bxslider.startAuto(); 975 } 976 } 977 978 $items.removeClass('hidden'); 979 if ($list.parent().hasClass('bx-viewport')) { 980 $list.unwrap(); 981 $list.unwrap(); 982 } 983 984 function init(force) { 985 var setting_columns, 986 isJustify, space_between, 987 body_width = $('body').width(), 988 mediaList = ["screen", "tablet_landscape", "tablet_portrait", "mobile_landscape", "mobile_portrait"], 989 slider_arr = $blocklist.attr('data-slider').split(","); 990 991 992 if (body_width >= 961) { 993 media_type = "screen"; 994 } else if (body_width <= 960 && body_width >= 769) { 995 media_type = "tablet_landscape"; 996 } else if (body_width <= 768 && body_width >= 641) { 997 media_type = "tablet_portrait"; 998 } else if (body_width <= 640 && body_width >= 481) { 999 media_type = "mobile_landscape"; 1000 } else if (body_width <= 480) { 1001 media_type = "mobile_portrait"; 1002 } 1003 var media_ind = mediaList.indexOf(media_type); 1004 var newContainerWidth = $blocklist.width(), itemHeight, viewportHeight; 1005 1006 if (!$blocklist.is(':visible')) { 1007 if (bxslider) { 1008 bxslider.destroySlider(); 1009 } 1010 return; 1011 } 1012 if (force!=='force' && containerWidth && containerWidth === newContainerWidth) { 1013 return; 1014 } 1015 containerWidth = newContainerWidth; 1016 1017 if (bxslider) {
1018 bxslider.destroySlider(); 1019 } 1020 1021 count = parseInt($blocklist.attr('data-setting-count').split(',')[media_ind], 10); 1022 isJustify = $body.css('justify-content') === "space-between"; 1023 1024 $controls.css("pointer-events","none"); 1025 $controls.find('.prev').css("pointer-events","auto"); 1026 $controls.find('.next').css("pointer-events","auto"); 1027 1028 $list.width('auto'); 1029 1030 $items 1031 .attr('style', '') 1032 .slice(1).addClass('hidden').end() 1033 .width(options.slideWidth = $items.width()) 1034 .removeClass('hidden'); 1035 1036 if (pager_arr.length > 1) { 1037 options.pager = !!parseInt(pager_arr[media_ind]); 1038 } 1039 if (controls_arr.length > 1) { 1040 options.controls = !!parseInt(controls_arr[media_ind]); 1041 } 1042 if (auto_controls_arr.length > 1) { 1043 options.autoControls = !!parseInt(auto_controls_arr[media_ind]); 1044 } 1045 1046 $(options.pagerSelector).css({"display": options.pager == true ? "flex" : "none"}); 1047 $blocklist.find(".controls").css({"display": options.controls == true ? "flex" : "none"}); 1048 1049 if (options.mode === 'vertical') { 1050 itemHeight = Math.max.apply(Math, $items.map(function() { 1051 return $(this).height() 1052 }).get()); 1053 $items.css('min-height', itemHeight); 1054 viewportHeight = itemHeight * count; 1055 options.maxSlides = options.minSlides = count; 1056 } else { 1057 setting_columns = col_arr[media_ind] == "auto" ? false : parseInt(col_arr[media_ind]); 1058 if (setting_columns) { 1059 count = setting_columns; 1060 } 1061 options.maxSlides = Math.min(count, Math.ceil($items.parent().width() / $items.width())); 1062 } 1063 1064 if (isJustify) { 1065 if (options.maxSlides > 1) { 1066 space_between = Math.floor(($body.width() - $items.width() * options.maxSlides)/ (options.maxSlides-1)); 1067 space_between = space_between < 0 ? 0 : space_between; 1068 } else { 1069 space_between = 0; 1070 } 1071 options.slideMargin = space_between; 1072 } 1073 if ($items.length > options.maxSlides && slider_arr[media_ind] == 1) { 1074 $list.css({'justify-content': 'flex-start'}); 1075 if (bxslider) { 1076 bxslider.reloadSlider(options); 1077 } else { 1078 $list.data('bxslider', (bxslider = $list.bxSlider(options))); 1079 } 1080 if(options.pager){ 1081 $pagers.css('display', 'flex'); 1082 } 1083 } else { 1084 if(swipe_arr[media_ind]!=1){ 1085 $list.css({'justify-content': isJustify ? 'space-between' : 'inherit', 'flex-wrap': 'wrap'}); 1086 if($list.width()/count < $items.width()) { 1087 $items.css('width', $items.width()-1); 1088 } else { 1089 $items.css('width', $items.width()); 1090 } 1091 } else { 1092 $list.css({'flex-wrap': 'nowrap'}); 1093 } 1094 $pagers.hide(); 1095 $controls.hide(); 1096 } 1097 1098 /*if (parseInt(slider_arr[media_ind]) === 0 || parseInt(swipe_arr[media_ind]) === 0) { 1099 $items.css('width', ''); 1100 }*/ 1101 1102 if (viewportHeight && slider_arr[media_ind] == 1) { 1103 $list.parent().css('min-height', viewportHeight); 1104 } 1105 if (options.mode === 'horizontal') { 1106 var align = {}; 1107 switch ($body.css('justify-content')) { 1108 case 'flex-end': 1109 align['margin-left'] = 'auto'; 1110 align['margin-right'] = '0px'; 1111 break; 1112 case 'center': 1113 align['margin-left'] = 'auto'; 1114 align['margin-right'] = 'auto'; 1115 break; 1116 default: 1117 align['margin-left'] = '0px'; 1118 align['margin-right'] = 'auto'; 1119 } 1120 $blocklist.find('.bx-wrapper').css(align); 1121 } 1122 1123 $blocklist.wm_img_convert(); 1124 } 1125 1126 $win.on('resize', debounce(init, 300)); 1127 $win.on('load', function(){ 1128 init('force'); 1129 $win.trigger('resize'); 1130 }); 1131 1132 init(); 1133 } else { 1134 $pagers.hide(); 1135 $controls.hide(); 1136 } 1137 1138 $win.on('resize', debounce(swipeScrollInit, 300)); 1139 swipeScrollInit(); 1140 1141 function swipeScrollInit() { 1142 var $shadowLeft = $blocklist.find(".swipe-shadow-left"); 1143 var $shadowRight = $blocklist.find(".swipe-shadow-right"); 1144 if ($list.css("overflow-x") == "auto") { 1145 var scroll_width = $list.get(0).scrollWidth; 1146 var view_width = $list.width(); 1147 $shadowLeft.css("pointer-events","none"); 1148 $shadowRight.css("pointer-events","none"); 1149 1150 $list.off('scroll'); 1151 $list.on('scroll', throttle(swipeScrollCheack, 200)); 1152 1153 swipeScrollCheack(); 1154 1155 function swipeScrollCheack() { 1156 var scroll_left = $list.scrollLeft(); 1157 1158 if (scroll_left > 0) { 1159 $shadowLeft.show(); 1160 } else { 1161 $shadowLeft.hide(); 1162 } 1163 1164 if (scroll_left + view_width >= scroll_width - 1) { 1165 $shadowRight.hide(); 1166 } else { 1167 $shadowRight.show(); 1168 } 1169 } 1170 } else { 1171 $shadowLeft.hide(); 1172 $shadowRight.hide(); 1173 } 1174 } 1175 if($blocklist.attr('data_photo_swipe') == 1){ 1176 //$('.pswp').appendTo('body'); 1177 initPhotoSwipeFunc(psSettings); 1178 $win.on('resize', function() { 1179 initPhotoSwipeFunc(psSettings); 1180 }); 1181 } 1182 1183 $(document).on('click', '.shop2-product-btn2', function(e) { 1184 1185 var $this = $(this), 1186 $form = $this.closest('form'), 1187 form = $form.get(0), 1188 adds = $form.find('.additional-cart-params'), 1189 len = adds.length, 1190 i, el, 1191 a4 = form.amount.value, 1192 kind_id = form.kind_id.value; 1193 1194 e.preventDefault(); 1195 1196 if (len) { 1197 a4 = { 1198 amount: a4 1199 }; 1200 1201 for (i = 0; i < len; i += 1) { 1202 el = adds[i]; 1203 if (el.value) { 1204 a4[el.name] = el.value; 1205 } 1206 } 1207 } 1208 1209 shop2.cart.add(kind_id, a4, function(d) { 1210 1211 $('#shop2-cart-preview').replaceWith(d.data); 1212 1213 if (d.errstr) { 1214 shop2.msg(d.errstr, $this); 1215 } else { 1216 shop2.msg(window._s3Lang.JS_ADDED, $this); 1217 } 1218 1219 if (d.panel) { 1220 $('#shop2-panel').replaceWith(d.panel); 1221 } 1222 }); 1223 1224 }); 1225 1226 }); 1227 1228 var blockListBody = document.querySelectorAll('.blocklist .body-outer'); 1229 1230 s3ContentColumns(blockListBody, { 1231 body: '.list', 1232 items: '.item-outer' 1233 }); 1234}); 1235// s3ContentColumns v1.0.0 1236(function(window, document, undefined) { 1237 var vendors = ['ms', 'moz', 'webkit', 'o'], vendorsLength = 4; 1238 var docElem = document.documentElement; 1239 var winWidth = window.innerWidth || docElem.clientWidth || document.body.clientWidth; 1240 var classListFlag = ('classList' in docElem); 1241 var defaults = { 1242 body: false, 1243 items: 'random', 1244 columns: '0,0,0,0,0', 1245 onBeforeInit: function() {}, 1246 onAfterInit: function() {} 1247 }; 1248 var elementMethods = { 1249 sHasClass: function(classN) { 1250 var elem = this; 1251 if (classListFlag) { 1252 return elem.classList.contains(classN);
1253 } else { 1254 return elem.className && new RegExp('\\b' + classN + '\\b').test(elem.className); 1255 } 1256 }, 1257 sAddClass: function(classes) { 1258 var elem = this, classArr = classes.split(/\s/g), classLength = classArr.length, clInd; 1259 if (classListFlag) { 1260 for (clInd = 0; clInd < classLength; clInd++) {elem.classList.add(classArr[clInd]);} 1261 } else { 1262 for (clInd = 0; clInd < classLength; clInd++) { 1263 if (!elem.sHasClass(classArr[clInd])) {elem.className += ' ' + classArr[clInd];} 1264 } 1265 } 1266 return elem; 1267 }, 1268 sRemoveClass: function(classes) { 1269 var elem = this, classArr = classes.split(/\s/g), classLength = classArr.length, clInd; 1270 if (classListFlag) { 1271 for (clInd = 0; clInd < classLength; clInd++) {elem.classList.remove(classArr[clInd]);} 1272 } else { 1273 var reg; 1274 for (clInd = 0; clInd < classLength; clInd++) { 1275 reg = new RegExp('\\b' + classArr[clInd] + '\\b', 'g'); 1276 elem.className = elem.className.replace(reg, ' ').replace(/^\s\s*|\s\s*$/, ''); 1277 } 1278 } 1279 return elem; 1280 }, 1281 sCSS: function(property, value) { 1282 var elem = this, css3Reg = new RegExp('perspective|transform|box-sizing|user-select', 'g'); 1283 function cssPrefix(prop) { 1284 if (prop.match(css3Reg) && !(prop in elem.style)) { 1285 for (var v = 0; v < vendorsLength; v++) { 1286 if ('-'+vendors[v]+'-'+prop in elem.style) { 1287 prop = '-'+vendors[v]+'-'+prop; 1288 break; 1289 } 1290 } 1291 } 1292 return prop; 1293 } 1294 if (typeof property === 'string' && value !== undefined) { 1295 elem.style[cssPrefix(property)] = value; 1296 } else if (typeof property === 'string' && value === undefined) { 1297 return getComputedStyle(elem)[property]; 1298 } else if (typeof property === 'object') { 1299 for (var cssProp in property) { 1300 if (property.hasOwnProperty(cssProp)) { 1301 elem.style[cssPrefix(cssProp)] = property[cssProp]; 1302 } 1303 } 1304 } 1305 return elem; 1306 }, 1307 sDataset: function(){ 1308 var elem = this, tempData = {}; 1309 function setValue(val) { 1310 var num = parseInt(val), nanVal = NaN; 1311 if (val === 'false') { 1312 return false; 1313 } else if (val === 'true') { 1314 return true; 1315 } else if (!(/\D/.test(val)) && typeof num === 'number' && num !== nanVal) { 1316 return num; 1317 } else { 1318 return val; 1319 } 1320 } 1321 if (elem.dataset) { 1322 for (var propName in elem.dataset) { 1323 if (!elem.dataset.hasOwnProperty(propName)) {continue;} 1324 tempData[propName] = setValue(elem.dataset[propName]); 1325 } 1326 } else { 1327 var elAttr = elem.attributes, attrLen = elAttr.length; 1328 for (var ati = 0; ati < attrLen; ati++) { 1329 if (/data-/.test(elAttr[ati].name) === false) {continue;} 1330 var dOpt = elAttr[ati].name.replace(/data-|-\w/gi, function(str) { 1331 if (str === 'data-') {return '';} 1332 return str.replace('-', '').toUpperCase(); 1333 }); 1334 tempData[dOpt] = setValue(elAttr[ati].value); 1335 } 1336 } 1337 return tempData; 1338 }, 1339 sClosest: function(fn) { 1340 var elem = this, prnt = elem.parentNode; 1341 return elem && (fn(elem) ? elem : ('sClosest' in prnt ? prnt.sClosest(fn) : prnt)); 1342 } 1343 }; 1344 for (var method in elementMethods) { 1345 if (elementMethods.hasOwnProperty(method) && !Element.prototype[method]) { 1346 Object.defineProperty(Element.prototype, method, { 1347 enumerable: false, 1348 value: elementMethods[method] 1349 }); 1350 } 1351 } 1352 var pluginObj = { 1353 getDOMEl: function(selector) { 1354 if (selector && typeof(selector) === 'string' && /[.\-]\b/g.test(selector)) { 1355 return document.querySelector(selector); 1356 } else if (selector && typeof(selector) === 'object' && selector.tagName) { 1357 return selector; 1358 } else { 1359 return false; 1360 } 1361 }, 1362 extend: function(out) { 1363 out = out || {}; 1364 var i = 1, argLen = arguments.length; 1365 for (; i < argLen; i++) { 1366 if (!arguments[i]) {continue;} 1367 for (var key in arguments[i]) { 1368 if (arguments[i].hasOwnProperty(key)) {out[key] = arguments[i][key];} 1369 } 1370 } 1371 return out; 1372 }, 1373 getMedia: function() { 1374 var mediaType = 'screen', mediaIndex = 0; 1375 if (window.matchMedia('all and (max-width: 480px)').matches) { 1376 mediaType = 'mobile_portrait'; 1377 mediaIndex = 4; 1378 } else if (window.matchMedia('all and (max-width: 640px)').matches) { 1379 mediaType = 'mobile_landscape'; 1380 mediaIndex = 3; 1381 } else if (window.matchMedia('all and (max-width: 768px)').matches) { 1382 mediaType = 'tablet_portrait'; 1383 mediaIndex = 2; 1384 } else if (window.matchMedia('all and (max-width: 960px)').matches) { 1385 mediaType = 'tablet_landscape'; 1386 mediaIndex = 1; 1387 } 1388 return [mediaIndex, mediaType]; 1389 }, 1390 getArray: function(arg) { 1391 var arr = [], len, ind, tempArr = []; 1392 function setValue(val) { 1393 var num = parseInt(val), nanVal = NaN; 1394 if (val === 'false') { 1395 return false; 1396 } else if (val === 'true') { 1397 return true; 1398 } else if (!(/\D/.test(val)) && typeof num === 'number' && num !== nanVal) { 1399 return num; 1400 } else { 1401 return val; 1402 } 1403 } 1404 if (typeof arg === 'string') { 1405 arr = arg.split(','); 1406 } 1407 len = arr.length; 1408 for (ind = 0; ind < len; ind++) { 1409 tempArr.push(setValue(arr[ind])); 1410 } 1411 return tempArr; 1412 }, 1413 createColumnsTable: function(wrap) { 1414 var data = wrap.dataColumns, index; 1415 1416 data.options.onBeforeInit(wrap, data); 1417 1418 var columnsAmount = data.columnsArr[data.media[0]]; 1419 var columnsTable = wrap.querySelector('.columns-table'); 1420 1421 if (columnsTable) { 1422 var itemsTable = data.items[0].sClosest(function(elem){return elem.sHasClass('columns-table');}); 1423 1424 if (itemsTable && itemsTable.sHasClass('columns-table')) { 1425 for (index = 0; index < data.itemsAmount; index++) { 1426 data.body.appendChild(data.items[index]); 1427 } 1428 } 1429 if (columnsAmount) { 1430 columnsTable.innerHTML = ''; 1431 } else { 1432 data.body.removeChild(columnsTable); 1433 } 1434 } else { 1435 if (columnsAmount) { 1436 columnsTable = document.createElement('div').sAddClass('columns-table'); 1437 data.body.appendChild(columnsTable); 1438 } 1439 } 1440 1441 if (columnsAmount) { 1442 var cellStr = ''; 1443 if (data.itemsAmount < columnsAmount) { 1444 columnsAmount = data.itemsAmount; 1445 } 1446 1447 for (index = 0; index < columnsAmount; index++) { 1448 cellStr += '<div class="columns-cell"></div>'; 1449 } 1450 1451 columnsTable.innerHTML = cellStr; 1452 1453 var columnsCells = wrap.querySelectorAll('.columns-cell'); 1454 1455 if (columnsAmount === 1) { 1456 for (index = 0; index < data.itemsAmount; index++) { 1457 columnsCells[0].appendChild(data.items[index]); 1458 } 1459 } else { 1460 var cellWidth = columnsCells[0].clientWidth || parseFloat(columnsCells[0].sCSS('width')); 1461 1462 data.body.sCSS('width', cellWidth + 'px'); 1463 1464 var totalHeight = data.body.offsetHeight; 1465 var avgColumn = Math.ceil(totalHeight / columnsAmount); 1466 var heightCounter = 0; 1467 var columnArrInd = 0; 1468 var remColumn, remItems, newAvgColumn; 1469 var currItem, currHeight, nextItem, nextHeight; 1470 1471 for (var itemInd = 0; itemInd < data.itemsAmount; itemInd++) { 1472 currItem = data.items[itemInd]; 1473 1474 if (currItem === undefined || currItem.sHasClass('columns-table')) {continue;} 1475 1476 currHeight = currItem.offsetHeight; 1477 1478 nextItem = data.items[itemInd + 1];
1479 nextHeight = 0; 1480 if (nextItem) { 1481 nextHeight = nextItem.offsetHeight; 1482 } 1483 if (columnArrInd >= columnsAmount) { 1484 columnArrInd = columnsAmount - 1; 1485 } 1486 columnsCells[columnArrInd].appendChild(currItem); 1487 1488 totalHeight -= currHeight; 1489 heightCounter += currHeight; 1490 1491 if (totalHeight) { 1492 remColumn = columnsAmount - (columnArrInd + 1); 1493 remItems = data.itemsAmount - (itemInd + 1); 1494 newAvgColumn = totalHeight / remColumn; 1495 1496 var surplus = newAvgColumn - heightCounter; 1497 1498 var testA = remItems <= remColumn; 1499 var testB = nextHeight >= newAvgColumn; 1500 var testC = surplus <= nextHeight/2; 1501 var testD = avgColumn >= newAvgColumn && heightCounter >= newAvgColumn; 1502 1503 if (testA || testB || testC || testD) { 1504 heightCounter = 0; 1505 columnArrInd++; 1506 } 1507 } 1508 } 1509 1510 data.body.sCSS('width', ''); 1511 } 1512 } 1513 1514 data.options.onAfterInit(wrap, data); 1515 } 1516 }; 1517 var pluginMethods = { 1518 init: function(element, params) { 1519 var wrap = pluginObj.getDOMEl(element); 1520 1521 if (!wrap) {return false;} 1522 1523 var data = wrap.dataColumns, body, items, itemsAmount; 1524 1525 if (wrap && typeof(params) === 'string') { 1526 if (data && data.status === 'inited') { 1527 return false; 1528 } else if (data && data.options) { 1529 params = pluginObj.extend({}, data.options); 1530 } 1531 } 1532 if (wrap && typeof(params) !== 'string') { 1533 var options = pluginObj.extend({}, defaults, params, wrap.sDataset()); 1534 1535 body = wrap.querySelector(options.body) || wrap; 1536 1537 items = wrap.querySelectorAll(options.items); 1538 if (items && !items.length) { 1539 items = []; 1540 var contentNodes = body.childNodes; 1541 var nodesLength = contentNodes.length; 1542 var tempTag, key, tempArr = []; 1543 for (key = 0; key < nodesLength; key++) { 1544 if (!contentNodes[key].tagName && contentNodes[key].nodeValue && /[\wа-ÑÑ]+/gi.test(contentNodes[key].nodeValue)) { 1545 tempTag = document.createElement('span'); 1546 tempTag.innerHTML = contentNodes[key].nodeValue.replace(/^\s+|\s+$/g, ''); 1547 tempArr.push([contentNodes[key], tempTag]); 1548 } 1549 } 1550 nodesLength = tempArr.length; 1551 for (key = 0; key < nodesLength; key++) { 1552 body.insertBefore(tempArr[key][1], tempArr[key][0].nextSibling); 1553 tempArr[key][0].nodeValue = ''; 1554 } 1555 nodesLength = body.children.length; 1556 for (key = 0; key < nodesLength; key++) { 1557 items.push(body.children[key]); 1558 } 1559 } 1560 itemsAmount = items.length; 1561 1562 data = wrap.dataColumns = { 1563 options: options, 1564 status: 'inited', 1565 media: pluginObj.getMedia(), 1566 body: body, 1567 items: items, 1568 itemsAmount: itemsAmount, 1569 columnsArr: pluginObj.getArray(options.columns), 1570 handlers: { 1571 resizeWindow: function() { 1572 var newWinWidth = window.innerWidth || docElem.clientWidth || document.body.clientWidth; 1573 if (newWinWidth !== winWidth) { 1574 var newMedia = pluginObj.getMedia(); 1575 if (newMedia[1] !== data.media[1]) { 1576 data.media = newMedia; 1577 pluginObj.createColumnsTable(wrap); 1578 } 1579 } 1580 } 1581 } 1582 }; 1583 1584 var contentImages = wrap.querySelectorAll('img'); 1585 var imagesLength = contentImages.length, hasSVG = false; 1586 1587 if (imagesLength) { 1588 var imagesLoadCounter = 0, currentImg, curSrc; 1589 1590 for (var imgInd = 0; imgInd < imagesLength; imgInd++) { 1591 currentImg = contentImages[imgInd]; 1592 if (/image\/svg\+xml|\.svg$/g.test(currentImg.getAttribute('src'))) { 1593 hasSVG = true; 1594 break; 1595 } 1596 if (currentImg.complete || currentImg.complete === undefined){ 1597 curSrc = currentImg.src + '?imgsrc=' + (new Date()).getTime(); 1598 currentImg.src = curSrc; 1599 } 1600 currentImg.addEventListener('load', function() { 1601 imagesLoadCounter++; 1602 if (imagesLoadCounter === imagesLength) { 1603 initPlugin(); 1604 } 1605 }); 1606 } 1607 if (hasSVG) { 1608 initPlugin(); 1609 } 1610 } else { 1611 initPlugin(); 1612 } 1613 } 1614 1615 function initPlugin() { 1616 if (items && itemsAmount) { 1617 pluginObj.createColumnsTable(wrap); 1618 1619 window.addEventListener('resize', data.handlers.resizeWindow); 1620 } 1621 } 1622 1623 return wrap; 1624 } 1625 }; 1626 function s3ContentColumnsPlugin(element, method) { 1627 if (!element) {return false;} 1628 if (pluginMethods[method]) { 1629 return pluginMethods[method].apply(this, arguments); 1630 } else if (typeof method === 'object' || !method) { 1631 if (pluginObj.getDOMEl(element)) { 1632 return pluginMethods.init.apply(this, arguments); 1633 } else if (element.length) { 1634 var elementsLen = element.length; 1635 for (var argInd = 0; argInd < elementsLen; argInd++) { 1636 pluginMethods.init(element[argInd], method); 1637 } 1638 } 1639 } else { 1640 return console.error('ÐеÑод ' + method + ' не найден в плагине s3ContentColumns'); 1641 } 1642 } 1643 if (!window.s3ContentColumns) { 1644 window.s3ContentColumns = s3ContentColumnsPlugin; 1645 } 1646}(window, document)); 1647$(function() { 1648 1649 var debounce = (function () { 1650 return function (fn, time) { 1651 var timer, func; 1652 func = function() { 1653 var args = [].slice.call(arguments, 0); 1654 window.clearTimeout(timer); 1655 timer = window.setTimeout(function () { 1656 window.requestAnimationFrame && window.requestAnimationFrame(function() {
1657 fn.apply(null, args); 1658 }) || fn.apply(null, args); 1659 }, time) 1660 }; 1661 return func; 1662 } 1663 }()); 1664 1665 $('.slider').each(function() { 1666 var $this = $(this), 1667 options = {}, 1668 bxslider, 1669 $slider_item = $this.find('.slider-item'); 1670 options.mode = $this.attr('data-setting-mode'); 1671 options.pagerCustom = $this.attr('data-setting-pager_selector'); 1672 options.prevSelector = $this.attr('data-setting-prev_selector'); 1673 options.nextSelector = $this.attr('data-setting-next_selector'); 1674 options.prevText = $this.attr('data-setting-prev_text') || ''; 1675 options.nextText = $this.attr('data-setting-next_text') || ''; 1676 options.auto = !!parseInt($this.attr('data-setting-auto')); 1677 options.controls = !!parseInt($this.attr('data-setting-controls')); 1678 options.pager = !!parseInt($this.attr('data-setting-pager')); 1679 options.pause = parseInt($this.attr('data-setting-pause'), 10) || 4000; 1680 options.autoControlsSelector = $this.attr('data-setting-auto_controls_selector'); 1681 options.autoControls = !!parseInt($this.attr('data-setting-auto_controls').split(',')[0]); 1682 options.autoControlsCombine = !!parseInt($this.attr('data-setting-autoControlsCombine')); 1683 options.useCSS = false; 1684 options.responsive = false; 1685 options.autoHover = true; 1686 1687 var itemLength = $slider_item.length; 1688 var $pager_wrap = $this.find('.slider-pager-wrap'); 1689 var $pager = '<a href="" data-slide-index=""><span></span></a>'; 1690 var $dotsType = $this.attr('data-type-pager'); 1691 var textPosition = $this.attr('data-text_position'); 1692 var dataTextBlock = $this.attr('data-text-block'); 1693 var $pager_wrap_inner = $('<div class="slider-pager"></div>'); 1694 var force = true; 1695 1696 var $new_pagers_html = ''+ 1697 '<div class="bx-auto_controls">'+ 1698 '<div class="auto_controls">'+ 1699 '<div class="bx-controls-auto">'+ 1700 '<div class="bx-controls-auto-item"><a class="bx-start"></a></div>'+ 1701 '<div class="bx-controls-auto-item"><a class="bx-stop"></a></div>'+ 1702 '</div>'+ 1703 '</div>'+ 1704 '</div>'; 1705 1706 if (!options.autoControls && options.auto) { 1707 options.onSlideAfter = function () { 1708 bxslider.startAuto(); 1709 } 1710 } 1711 1712 function init() { 1713 1714 if (bxslider) { 1715 bxslider.destroySlider(); 1716 } 1717 if (!$this.is(':visible')) { 1718 return; 1719 } 1720 1721 $this.find('.slider-item[data-src]').each(function () { 1722 $(this).css('background-image', 'url("' + $(this).data('src') + '")'); 1723 }); 1724 1725 if ($this.find('.slider-item .overfill').length == 0) { 1726 $this.find('.slider-item').prepend('<div class="overfill"></div>'); 1727 } 1728 1729 var bg_attc = $this.css('background-attachment'); 1730 var bg_cl = $this.css('background-clip'); 1731 var bg_colr = $this.css('background-color'); 1732 var bg_image = $this.css('background-image'); 1733 var bg_org = $this.css('background-origin'); 1734 var bg_rep = $this.css('background-repeat'); 1735 var bg_size = $this.css('background-size'); 1736 1737 1738 $this.find('.overfill').css({ 1739 'background-attachment': bg_attc, 1740 'background-clip': bg_cl, 1741 'background-color': bg_colr, 1742 'background-image': bg_image, 1743 'background-origin': bg_org, 1744 'background-repeat': bg_rep, 1745 'background-size': bg_size 1746 }); 1747 1748 $this.find('>.overfill').remove(); 1749 1750 if(textPosition=='out' && force){ 1751 var $textWrap = $this.find('.text_wrapper'); 1752 var text_options = {}; 1753 var $textInner = $textWrap.find('.text_inner'); 1754 var clone_text = $textInner.find('.text_slider').clone(); 1755 text_options.mode = $this.attr('data-setting-mode'); 1756 text_options.auto = false; 1757 text_options.controls = false; 1758 text_options.pager = false; 1759 text_options.autoControlsSelector = false; 1760 text_options.autoControls = false; 1761 text_options.autoControlsCombine = false; 1762 1763 1764 if($this.find('>.wrap_text_dm').length > 0){ 1765 for (var i = 1; i < itemLength; i++) { 1766 $textInner.append(clone_text.clone()); 1767 } 1768 $this.find('>.wrap_text_dm').remove(); 1769 } 1770 1771 if(text_options.mode=="fade"){ 1772 var itemHeight = Math.max.apply(Math, $textInner.find('.text_slider').map(function() { 1773 return $(this).height() 1774 }).get()); 1775 $textInner.css('min-height', itemHeight); 1776 } 1777 1778 var textSlider = $textInner.bxSlider(text_options);
1779 $textInner.data('bxslider', textSlider); 1780 1781 options.onSlideNext = function(){ 1782 if (textSlider.goToNextSlide) { 1783 textSlider.goToNextSlide(); 1784 } 1785 }; 1786 1787 options.onSlidePrev = function(){ 1788 if (textSlider.goToPrevSlide) { 1789 textSlider.goToPrevSlide(); 1790 } 1791 }; 1792 1793 options.onSlideBefore = function($slideElement, oldIndex, newIndex){ 1794 if (textSlider.getSlideCount) { 1795 if (newIndex == 0 && oldIndex == textSlider.getSlideCount() - 1 || newIndex - oldIndex == 1) { 1796 if (textSlider.goToNextSlide) { 1797 textSlider.goToNextSlide(); 1798 } 1799 } else if (oldIndex == 0 && newIndex == textSlider.getSlideCount() - 1 || oldIndex - newIndex == 1) { 1800 if (textSlider.goToPrevSlide) { 1801 textSlider.goToPrevSlide(); 1802 } 1803 } else { 1804 if (textSlider.goToSlide) { 1805 textSlider.goToSlide(newIndex); 1806 } 1807 } 1808 } 1809 }; 1810 force = false; 1811 1812 } else if(textPosition=='in' && $this.find('>.wrap_text_dm').length > 0){ 1813 var clone_text = $this.find('.text-slider').clone(); 1814 $this.find('.slider-item .overfill').after(clone_text); 1815 $this.find('>.wrap_text_dm').remove(); 1816 } 1817 1818 1819 if(itemLength>1){ 1820 if (bxslider) { 1821 if (options.pager && $pager_wrap.find('.slider-pager').length==0) { 1822 if($pager_wrap.find('.bx-auto_controls').length==0){ 1823 $pager_wrap.append($new_pagers_html); 1824 } 1825 $pager_wrap.find('.bx-auto_controls').append($pager_wrap_inner); 1826 1827 for (var i = 0; i < itemLength; i++) { 1828 $pager_wrap_inner.append($pager); 1829 } 1830 1831 $pager = $pager_wrap_inner.find('a'); 1832 $pager.each(function () { 1833 var $this = $(this); 1834 var index = $this.index(); 1835 $this.attr('data-slide-index', index); 1836 if ($dotsType == 'figures') { 1837 $this.find('span').html(index + 1); 1838 } 1839 }); 1840 } 1841 1842 bxslider.reloadSlider(options); 1843 1844 } else { 1845 $this.find('.slider-inner').data('bxslider', (bxslider = $this.find('.slider-inner').bxSlider(options))); 1846 } 1847 } 1848 else{ 1849 $this.find('.slider-controls').addClass('hidden'); 1850 $this.find('.slider-pager-wrap').addClass('hidden'); 1851 } 1852 } 1853 1854 $(window).on('resize', debounce(init, 300)); 1855 1856 init(); 1857 }); 1858}); 1859$(function() { 1860 1861 var debounce = (function () { 1862 return function (fn, time) { 1863 var timer, func; 1864 func = function() { 1865 var args = [].slice.call(arguments, 0); 1866 window.clearTimeout(timer); 1867 timer = window.setTimeout(function () { 1868 window.requestAnimationFrame && window.requestAnimationFrame(function() { 1869 fn.apply(null, args); 1870 }) || fn.apply(null, args); 1871 }, time) 1872 }; 1873 return func; 1874 } 1875 }()); 1876 1877 var throttle = (function() { 1878 return function (fn, threshhold, scope) { 1879 threshhold || (threshhold = 250); 1880 var last, 1881 deferTimer, 1882 func; 1883 func = function () { 1884 var context = scope || this; 1885 var now = +new Date, 1886 args = arguments; 1887 if (last && now < last + threshhold) { 1888 // hold on to it 1889 clearTimeout(deferTimer); 1890 deferTimer = setTimeout(function () { 1891 last = now; 1892 fn.apply(context, args); 1893 }, threshhold); 1894 } else { 1895 last = now; 1896 fn.apply(context, args); 1897 } 1898 }; 1899 return func; 1900 } 1901 }()); 1902 1903 $('.bx-reviews').each(function() { 1904 var $reviews = $(this), 1905 $items = $reviews.find('.item-outer'), 1906 $list = $reviews.find('.list'), 1907 $body = $reviews.find('.body'), 1908 $controls = $reviews.find('.controls'), 1909 $pagers = $reviews.find('.bx-pager-wrap'), 1910 options = {}, 1911 auto_controls_arr, 1912 count, 1913 col_arr, pager_arr, controls_arr, 1914 bxslider, 1915 containerWidth, 1916 isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), 1917 slider_arr = $reviews.attr('data-slider').split(","), 1918 swipe_arr = $reviews.attr('data-swipe').split(","); 1919 1920 if (slider_arr.indexOf('1')>-1 && $.fn.bxSlider) { 1921 1922 options.pagerSelector= $reviews.attr('data-setting-pager_selector'); 1923 options.prevSelector = $reviews.attr('data-setting-prev_selector'); 1924 options.nextSelector = $reviews.attr('data-setting-next_selector'); 1925 options.prevText = $reviews.attr('data-setting-prev_text') || ''; 1926 options.nextText = $reviews.attr('data-setting-next_text') || ''; 1927 options.auto = !!parseInt($reviews.attr('data-setting-auto')); 1928 options.controls = !!parseInt($reviews.attr('data-setting-control
1928s')); 1929 options.pager = !!parseInt($reviews.attr('data-setting-pager').split(',')[0]); 1930 options.pause = parseInt($reviews.attr('data-setting-pause'), 10) || 4000; 1931 options.useCSS = isMobile; 1932 options.infiniteLoop = true; 1933 options.adaptiveHeight = false; 1934 options.mode = $reviews.attr('data-setting-mode') || 'horizontal'; 1935 options.touchEnabled = options.mode === 'horizontal'; 1936 options.slideMargin = 0; 1937 options.maxSlides = parseInt($reviews.attr('data-setting-count').split(',')[0], 10) || 1; 1938 options.minSlides = options.mode === 'horizontal' ? 1 : options.maxSlides; 1939 options.moveSlides = $reviews.attr('data-setting-move') || 0; 1940 options.autoControlsSelector = $reviews.attr('data-setting-auto_controls_selector'); 1941 options.autoControls = !!parseInt($reviews.attr('data-setting-auto_controls').split(',')[0]); 1942 options.autoControlsCombine = !!parseInt($reviews.attr('data-setting-autoControlsCombine')); 1943 options.autoHover = true; 1944 1945 col_arr = $reviews.attr('data-setting-columns').split(","); 1946 pager_arr = $reviews.attr('data-setting-pager').split(","); 1947 controls_arr = $reviews.attr('data-setting-controls').split(","); 1948 auto_controls_arr = $reviews.attr('data-setting-auto_controls').split(","); 1949 1950 if (!options.autoControls && options.auto) { 1951 options.onSlideAfter = function() {
1952 bxslider.startAuto(); 1953 } 1954 } 1955 1956 $items.removeClass('hidden'); 1957 if ($list.parent().hasClass('bx-viewport')) { 1958 $list.unwrap(); 1959 $list.unwrap(); 1960 } 1961 1962 function init(force) { 1963 var media_type, 1964 body_width = $('body').width(); 1965 1966 var mediaList = ["screen", "tablet_landscape", "tablet_portrait", "mobile_landscape", "mobile_portrait"]; 1967 var media_ind, setting_columns, 1968 isJustify, space_between; 1969 var slider_arr = $reviews.attr('data-slider').split(","); 1970 1971 var newContainerWidth = $reviews.width(), itemHeight, viewportHeight; 1972 if (!$reviews.is(':visible')) { 1973 if (bxslider) { 1974 bxslider.destroySlider(); 1975 } 1976 return; 1977 } 1978 if (force!='force' && containerWidth && containerWidth === newContainerWidth) { 1979 return; 1980 } 1981 containerWidth = newContainerWidth; 1982 1983 if (bxslider) { 1984 bxslider.destroySlider(); 1985 } 1986 1987 if (body_width >= 961) { 1988 media_type = "screen"; 1989 } else if (body_width <= 960 && body_width >= 769) { 1990 media_type = "tablet_landscape"; 1991 } else if (body_width <= 768 && body_width >= 641) { 1992 media_type = "tablet_portrait"; 1993 } else if (body_width <= 640 && body_width >= 481) { 1994 media_type = "mobile_landscape"; 1995 } else if (body_width <= 480) { 1996 media_type = "mobile_portrait"; 1997 } 1998 media_ind = mediaList.indexOf(media_type); 1999 count = parseInt($reviews.attr('data-setting-count').split(',')[media_ind], 10); 2000 2001 isJustify = $body.css('justify-content') == "space-between" ? true : false; 2002 2003 $controls.css("pointer-events","none"); 2004 $controls.find('.prev').css("pointer-events","auto"); 2005 $controls.find('.next').css("pointer-events","auto"); 2006 2007 $list.width('auto'); 2008 $items 2009 .attr('style', '') 2010 .slice(1).addClass('hidden').end() 2011 .width(options.slideWidth = $items.width()) 2012 .removeClass('hidden'); 2013 2014 if (pager_arr.length > 1) { 2015 options.pager = !!parseInt(pager_arr[media_ind]); 2016 } 2017 if (controls_arr.length > 1) { 2018 options.controls = !!parseInt(controls_arr[media_ind]); 2019 } 2020 if (auto_controls_arr.length > 1) { 2021 options.autoControls = !!parseInt(auto_controls_arr[media_ind]); 2022 } 2023 2024 $(options.pagerSelector).css({"display": options.pager == true ? "flex" : "none"}); 2025 $reviews.find(".controls").css({"display": options.controls == true ? "flex" : "none"}); 2026 2027 if (options.mode === 'vertical') { 2028 itemHeight = Math.max.apply(Math, $items.map(function() { 2029 return $(this).height() 2030 }).get()); 2031 $items.css('min-height', itemHeight); 2032 viewportHeight = itemHeight * count; 2033 options.maxSlides = options.minSlides = count; 2034 } else { 2035 setting_columns = col_arr[media_ind] == "auto" ? false : parseInt(col_arr[media_ind]); 2036 if (setting_columns) { 2037 count = setting_columns; 2038 } 2039 options.maxSlides = Math.min(count, Math.ceil($items.parent().width() / $items.width())); 2040 } 2041 2042 if (isJustify) { 2043 if (options.maxSlides > 1) { 2044 space_between = Math.floor(($body.width() - $items.width() * options.maxSlides)/ (options.maxSlides-1)); 2045 space_between = space_between < 0 ? 0 : space_between; 2046 } else { 2047 space_between = 0; 2048 } 2049 options.slideMargin = space_between; 2050 } 2051 2052 if ($items.length > options.maxSlides && slider_arr[media_ind] == 1) { 2053 $list.css({'justify-content': 'flex-start'}); 2054 if (bxslider) { 2055 bxslider.reloadSlider(options); 2056 } else { 2057 $list.data('bxslider', (bxslider = $list.bxSlider(options))); 2058 } 2059 if(options.pager){ 2060 $pagers.css('display', 'flex'); 2061 } 2062 } else { 2063 if(swipe_arr[media_ind]!=1){ 2064 $list.css({'justify-content': isJustify ? 'space-between' : 'inherit', 'flex-wrap': 'wrap'}); 2065 $items.css('width', $items.width()-1); 2066 } else { 2067 $list.css({'flex-wrap': 'nowrap'}); 2068 } 2069 $pagers.hide(); 2070 $controls.hide(); 2071 } 2072 2073 if (viewportHeight && slider_arr[media_ind] == 1) {
2074 $list.parent().css('min-height', viewportHeight); 2075 } 2076 if (options.mode === 'horizontal') { 2077 var align = {}; 2078 switch ($body.css('justify-content')) { 2079 case 'flex-end': 2080 align['margin-left'] = 'auto'; 2081 align['margin-right'] = '0px'; 2082 break; 2083 case 'center': 2084 align['margin-left'] = 'auto'; 2085 align['margin-right'] = 'auto'; 2086 break; 2087 default: 2088 align['margin-left'] = '0px'; 2089 align['margin-right'] = 'auto'; 2090 } 2091 $reviews.find('.bx-wrapper').css(align); 2092 } 2093 2094 $reviews.wm_img_convert(); 2095 } 2096 2097 $(window).on('resize', debounce(init, 300)); 2098 $(window).on('load', function(){ 2099 init('force'); 2100 }); 2101 2102 init(); 2103 } else { 2104 $pagers.hide(); 2105 $controls.hide(); 2106 } 2107 2108 $(window).on('resize', debounce(swipeScrollInit, 300)); 2109 swipeScrollInit(); 2110 2111 function swipeScrollInit() { 2112 var $shadowLeft = $reviews.find(".swipe-shadow-left"); 2113 var $shadowRight = $reviews.find(".swipe-shadow-right"); 2114 if ($list.css("overflow-x") == "auto") { 2115 var scroll_width = $list.get(0).scrollWidth; 2116 var view_width = $list.width(); 2117 $shadowLeft.css("pointer-events","none"); 2118 $shadowRight.css("pointer-events","none"); 2119 2120 $list.off('scroll'); 2121 $list.on('scroll', throttle(swipeScrollCheack, 200)); 2122 2123 swipeScrollCheack(); 2124 2125 function swipeScrollCheack() { 2126 var scroll_left = $list.scrollLeft(); 2127 2128 if (scroll_left > 0) { 2129 $shadowLeft.show(); 2130 } else { 2131 $shadowLeft.hide(); 2132 } 2133 2134 if (scroll_left + view_width >= scroll_width - 1) { 2135 $shadowRight.hide(); 2136 } else { 2137 $shadowRight.show(); 2138 } 2139 } 2140 } else { 2141 $shadowLeft.hide(); 2142 $shadowRight.hide(); 2143 } 2144 } 2145 2146 }); 2147}); 2148$(function() { 2149 $('.up_button').click(function () { 2150 var up_speed = $(this).data('speed') 2151 $('body, html').animate({ 2152 scrollTop: 0 2153 }, up_speed); 2154 }); 2155}); 2156$(function () { 2157 $(document).click(function (event) { 2158 $('.contacts-block').each(function() { 2159 if ($(event.target).closest($(this)).length) { 2160 return; 2161 } else { 2162 $(this).find('.tgl-but').prop("checked", false); 2163 $(this).find('.icon').removeClass('active'); 2164 } 2165 }); 2166 }); 2167 2168 function setMargin($block) { 2169 if (Math.max(document.documentElement.clientWidth, window.innerWidth || 0) > 960) { 2170 $block.find(".block-body-drop").css({ 2171 "margin-left": "0px" 2172 }); 2173 } else { 2174 var left = $block.offset().left * -1; 2175 $block.find(".block-body-drop").css({ 2176 "margin-left": left + "px" 2177 }); 2178 } 2179 } 2180 2181 $('.contacts-block').each(function() { 2182 var $block = $(this), 2183 allClasses = $block.attr("class").split(" "), 2184 mainClass = allClasses[0], 2185 mainSelector = document.location.pathname == "/" ? ".title-page .side-panel ."+mainClass+" .block-body-drop" : ".side-panel ."+mainClass+" .block-body-drop", 2186 styles = document.styleSheets; 2187 2188 for(var i = 0; i < styles.length; i++) { 2189 if (styles[i].href && styles[i].href.indexOf("styles.css") !== -1) { 2190 for(var j = 0; j < styles[i].cssRules.length; j++) { 2191 if (styles[i].cssRules[j].selectorText == mainSelector && styles[i].cssRules[j].style.width == "100vw") { 2192 $block.data("fullwidth", 1); 2193 setMargin($block); 2194 break; 2195 } 2196 } 2197 break; 2198 } 2199 } 2200 }); 2201 2202 $(window).resize(function() { 2203 $('.contacts-block').each(function() { 2204 var $block = $(this); 2205 if ($block.data("fullwidth") == 1) { 2206 setMargin($block); 2207 } 2208 }); 2209 }); 2210 2211 $('.contacts-block').each(function() { 2212 var $block = $(this); 2213 $block.find('.icon').click(function() { 2214 if ($block.data("fullwidth") == 1) { 2215 setMargin($block); 2216 } 2217 if ($block.find('.tgl-but').prop("checked")) { 2218 $(this).removeClass('active'); 2219 } else { 2220 $(this).addClass('active'); 2221 } 2222 }); 2223 }); 2224}); 2225/* 2226 * wmS3Menu v1.0.0 2227 * K.I. 433 2228 */ 2229;(function ($, window, document, undefined ) { 2230 var pluginName = 'wmS3Menu', 2231 defaults = { 2232 screenButton: false, 2233 responsiveTl: false,
2234 responsiveTp: false, 2235 responsiveMl: false, 2236 moreText: '...', 2237 childIcons: false, 2238 childIconsClass: 'has-child-icon' 2239 }; 2240 // ÐÑовеÑка на каÑание 2241 var isTouchable = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch; 2242 var $win = $(window); 2243 var winWidth = $win.width(); 2244 var $doc = $(document); 2245 2246 var pluginObj = { 2247 _events: { 2248 hover: function(menuWrap, item, settings){ 2249 var link = item.find('> a'); 2250 var linkIcon = link.find('.' + settings.childIconsClass); 2251 var iconLen = linkIcon.length; 2252 var subMenu = item.find('> ul'); 2253 var showTimeout; 2254 // ÐÑобÑажение 2255 function menuShow() { 2256 clearTimeout(showTimeout); 2257 item.siblings().find('> ul').css('display', ''); 2258 // ÐпÑеделение Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²ÑпадаÑки ÑÑÐ¾Ð±Ñ Ð½Ðµ вÑводилоÑÑ Ð·Ð° пÑÐµÐ´ÐµÐ»Ñ Ð¾ÐºÐ½Ð° 2259 pluginObj._menuPosition(subMenu); 2260 2261 link.addClass('hover'); 2262 if (iconLen) { 2263 linkIcon.addClass('hover'); 2264 } 2265 } 2266 // СкÑÑÑие 2267 function menuHide() { 2268 showTimeout = setTimeout(function(){ 2269 link.removeClass('hover'); 2270 subMenu.css('display', ''); 2271 if (iconLen) { 2272 linkIcon.removeClass('hover'); 2273 } 2274 }, 500); 2275 } 2276 // ÐÑклÑÑение и подклÑÑение ÑобÑÑий 2277 item.off({ 2278 'mouseenter.wmS3Menu': menuShow, 2279 'mouseleave.wmS3Menu': menuHide 2280 }); 2281 item.on({ 2282 'mouseenter.wmS3Menu': menuShow, 2283 'mouseleave.wmS3Menu': menuHide 2284 }); 2285 }, 2286 click: function(menuWrap, item, settings){ 2287 var link = item.find('> a'); 2288 var linkIcon = link.find('.' + settings.childIconsClass); 2289 var iconLen = linkIcon.length; 2290 var subMenu = item.find('> ul'); 2291 // ÐеÑеклÑÑение оÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ 2292 function menuToggle() { 2293 if (subMenu.is(':visible')) { 2294 if (isTouchable) { 2295 document.location = link.attr('href'); 2296 } 2297 link.removeClass('hover'); 2298 subMenu.css('display', ''); 2299 item.removeClass('submenu-opened'); 2300 if (iconLen) { 2301 linkIcon.removeClass('hover'); 2302 } 2303 } else { 2304 item.siblings().find('> ul').css('display', ''); 2305 item.siblings().find('> a').removeClass('hover'); 2306 item.siblings().find('> a .' + settings.childIconsClass).removeClass('hover'); 2307 // ÐпÑеделение Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²ÑпадаÑки ÑÑÐ¾Ð±Ñ Ð½Ðµ вÑводилоÑÑ Ð·Ð° пÑÐµÐ´ÐµÐ»Ñ Ð¾ÐºÐ½Ð° 2308 pluginObj._menuPosition(subMenu); 2309 2310 link.addClass('hover'); 2311 item.addClass('submenu-opened'); 2312 if (iconLen) { 2313 linkIcon.addClass('hover'); 2314 } 2315 } 2316 return false; 2317 } 2318 // ÐÑклÑÑение и подклÑÑение ÑобÑÑий 2319 link.off('click.wmS3Menu'); 2320 link.on('click.wmS3Menu', menuToggle); 2321 }, 2322 click_tree: function(menuWrap, item, settings){ 2323 var link = item.find('> a'); 2324 var linkIcon = link.find('.' + settings.childIconsClass); 2325 var subMenu = item.find('> ul'); 2326 // ÐеÑеклÑÑение оÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ 2327 function menuToggle(event) { 2328 var targ = $(event.target); 2329 2330 if (targ.closest(linkIcon).length) { 2331 if (subMenu.is(':visible')) { 2332 link.removeClass('hover'); 2333 subMenu.css('display', ''); 2334 item.removeClass('submenu-opened'); 2335 linkIcon.removeClass('hover'); 2336 } else { 2337 // ÐпÑеделение Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²ÑпадаÑки ÑÑÐ¾Ð±Ñ Ð½Ðµ вÑводилоÑÑ Ð·Ð° пÑÐµÐ´ÐµÐ»Ñ Ð¾ÐºÐ½Ð° 2338 pluginObj._menuPosition(subMenu); 2339 2340 link.addClass('hover'); 2341 item.addClass('submenu-opened'); 2342 linkIcon.addClass('hover'); 2343 } 2344 return false; 2345 } 2346 } 2347 // ÐÑклÑÑение и подклÑÑение ÑобÑÑий 2348 link.off('click.wmS3Menu'); 2349 link.on('click.wmS3Menu', menuToggle); 2350 } 2351 }, 2352 _menuPosition: function(subMenu) { 2353 // ÐпÑеделение Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²ÑпадаÑки ÑÑÐ¾Ð±Ñ Ð½Ðµ вÑводилоÑÑ Ð·Ð° пÑÐµÐ´ÐµÐ»Ñ Ð¾ÐºÐ½Ð° 2354 winWidth = $win.width(); 2355 2356 subMenu.css('display', 'block'); 2357 2358 // if (subMenu.parent().hasClass('first-level') === false) { 2359 subMenu.css({ 2360 'visibility': 'hidden', 2361 'opacity': 0 2362 }); 2363 2364 var menuRect = subMenu[0].getBoundingClientRect(); 2365 var marginR = parseInt(subMenu.css('margin-right')); 2366 var parentWidth = subMenu.parent().width(); 2367 2368 if (marginR > parentWidth) { 2369 subMenu.css('margin-right', parentWidth);
2370 } 2371 2372 if (menuRect.right >= winWidth) { 2373 subMenu.css({ 2374 'left': '-100%', 2375 'margin-left': 0 2376 }); 2377 } 2378 subMenu.css({ 2379 'visibility': '', 2380 'opacity': '' 2381 }); 2382 // } 2383 } 2384 }; 2385 function Plugin(element, options) { 2386 this.element = element; 2387 2388 this.options = $.extend({}, defaults, options, $(this.element).data()) ; 2389 2390 this._defaults = defaults; 2391 this._name = pluginName; 2392 2393 this.init(); 2394 } 2395 Plugin.prototype = { 2396 init: function () { 2397 var settings = this.options; 2398 // ÐпÑеделение ÑиÑÐ¸Ð½Ñ Ð¼ÐµÐ´Ð¸Ð° 2399 var moreButFlag = false; 2400 if (window.matchMedia('all and (max-width: 640px)').matches) { 2401 moreButFlag = settings.responsiveMl; 2402 } else if (window.matchMedia('all and (max-width: 768px)').matches) { 2403 //moreButFlag = settings.responsiveTp; 2404 } else if (window.matchMedia('all and (max-width: 960px)').matches) { 2405 moreButFlag = settings.responsiveTl; 2406 } else { 2407 moreButFlag = settings.screenButton; 2408 } 2409 // ÐбеÑÑка Ð¼ÐµÐ½Ñ 2410 var menuWrap = $(this.element); 2411 var menuClass = menuWrap.attr('class'); 2412 var menuMainUl = $(this.element.querySelector('ul')); 2413 var widgetClass = menuClass.match(/widget-\d+/)[0]; 2414 // ÐÑовеÑка на налиÑие Ð¼ÐµÐ½Ñ Ð² Side panel 2415 if (window.side_panel_controller && side_panel_controller.inPanel(widgetClass)) { 2416 moreButFlag = false; 2417 } 2418 2419 menuMainUl.children().addClass('first-level'); 2420 // ÐаÑÑÑойки Ð´Ð»Ñ Ð³Ð¾ÑизонÑалÑного Ð¼ÐµÐ½Ñ 2421 if (!!menuClass.match(/horizontal/i)) { 2422 var menuWidth = menuMainUl.width(); 2423 var itemsWidth = 0, hideArr = [], hideLength; 2424 // Ðнопка More 2425 var moreBut = menuMainUl.find('.more-button'); 2426 if (!moreBut.length) { 2427 moreBut = $('<li class="more-button"><a href="#" onclick="return false;"><span>' + settings.moreText + '</span></a></li>');// data-trigger="click" 2428 menuMainUl.append(moreBut); 2429 } 2430 // ÐÐµÐ½Ñ More 2431 var moreMenu = moreBut.find('> ul'); 2432 if (!moreMenu.length) { 2433 moreMenu = $('<ul></ul>'); 2434 moreBut.append(moreMenu); 2435 } 2436 2437 moreBut.removeClass('removed').attr('data-trigger', 'hover'); 2438 menuMainUl.children().css('display', ''); 2439 2440 var firstLevelItems = menuMainUl.children(':visible').not('.more-button'); 2441 moreMenu.html(''); 2442 2443 if (moreButFlag === 'more' || moreButFlag === 'button') { 2444 moreBut.removeClass('disabled'); 2445 2446 menuWidth -= moreBut.outerWidth(); 2447 2448 firstLevelItems.each(function(){ 2449 var thisItem = $(this); 2450 itemsWidth += thisItem.outerWidth(true); 2451 if (itemsWidth >= menuWidth) { 2452 hideArr.push(thisItem.clone()); 2453 thisItem.hide(); 2454 } 2455 }); 2456 2457 hideLength = hideArr.length; 2458 if (hideLength) { 2459 for (var ind = 0; ind < hideLength; ind++) { 2460 moreMenu.append(hideArr[ind]); 2461 } 2462 moreBut.removeClass('disabled'); 2463 } else { 2464 moreBut.addClass('disabled'); 2465 } 2466 } else { 2467 moreBut.addClass('disabled'); 2468 } 2469 } 2470 // ÐложеннÑе подÑÑовни Ð¼ÐµÐ½Ñ 2471 var menuInner = menuMainUl.find('ul'); 2472 var menuItems = menuInner.parent(); 2473 var menuLinks = menuItems.find('> a'); 2474 // СÑÑелоÑки Ð´Ð»Ñ Ð¿Ð¾Ð´ÑÑовней 2475 var menuLinksIcons = menuLinks.find('.' + settings.childIconsClass); 2476 var childIconLen = menuLinksIcons.length; 2477 // Тип оÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð¼ÐµÐ½Ñ 2478 var mShow = 'popup'; 2479 if (!!menuClass.match(/dropdown/i)) { 2480 mShow = 'dropdown'; 2481 } else if (!!menuClass.match(/treemenu/i)) { 2482 mShow = 'treemenu'; 2483 } 2484 if (mShow === 'popup') { 2485 menuInner.hide(); 2486 } 2487 if (childIconLen) { 2488 menuLinksIcons.remove(); 2489 } 2490 if (!!settings.childIcons) { 2491 // Ðобавление ÑÑÑелоÑек Ð´Ð»Ñ Ð¿Ð¾Ð´ÑÑовней 2492 var childIconHTML = '<em class="' + settings.childIconsClass + '"></em>'; 2493 2494 if (mShow === 'treemenu') { 2495 childIconHTML = '<em class="' + settings.childIconsClass + '"><b style="position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px;"></b></em>'; 2496 } 2497 2498 var childIconTag = $(childIconHTML); 2499 menuLinks.append(childIconTag.clone()); 2500 2501 menuLinksIcons = menuLinks.find('.' + settings.childIconsClass); 2502 childIconLen = menuLinksIcons.length; 2503 } 2504 // Удаление вÑÐµÑ ÑобÑÑий на ÑÑÑÐ»ÐºÐ°Ñ 2505 menuLinks.removeClass('hover').off('click.wmS3Menu'); 2506 menuInner.css('display', ''); 2507 if (childIconLen) { 2508 menuLinksIcons.removeClass('hover'); 2509 } 2510 2511 menuItems.each(function() { 2512 var thisItem = $(this); 2513 var trigger = thisItem.data('trigger') || 'hover'; 2514 2515 if (mShow === 'dropdown' || isTouchable) { 2516 trigger = 'click'; 2517 } else if (mShow === 'treemenu') { 2518 trigger = 'click_tree'; 2519 } 2520 pluginObj._events[trigger](menuWrap, thisItem, settings); 2521 });
2522 // Ðлик по докÑменÑÑ 2523 if (isTouchable) { 2524 function docClick(e) { 2525 var target = $(e.target); 2526 if (target.closest(menuWrap).length === 0) { 2527 menuLinks.removeClass('hover'); 2528 menuInner.css('display', ''); 2529 menuItems.removeClass('submenu-opened'); 2530 2531 if (childIconLen) { 2532 menuLinksIcons.removeClass('hover'); 2533 } 2534 } 2535 } 2536 $doc.off('touchstart.wmS3Menu', docClick); 2537 $doc.on('touchstart.wmS3Menu', docClick); 2538 } 2539 }, 2540 update: function () { 2541 this.init(); 2542 } 2543 }; 2544 if (!$.fn[pluginName]) { 2545 $.fn[pluginName] = function (options) { 2546 var args = arguments; 2547 if (options === undefined || typeof options === 'object') { 2548 return this.each(function () { 2549 if (!$.data(this, 'plugin_' + pluginName)) { 2550 $.data(this, 'plugin_' + pluginName, new Plugin(this, options)); 2551 } 2552 }); 2553 } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') { 2554 var returns; 2555 this.each(function () { 2556 var instance = $.data(this, 'plugin_' + pluginName); 2557 if (instance instanceof Plugin && typeof instance[options] === 'function') { 2558 returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1)); 2559 } 2560 if (options === 'destroy') { 2561 $.data(this, 'plugin_' + pluginName, null); 2562 } 2563 }); 2564 return returns !== undefined ? returns : this; 2565 } 2566 }; 2567 } 2568 $(function () { 2569 var wmMenuWrap = $('.wm-widget-menu.vertical'); 2570 wmMenuWrap[pluginName](); 2571 2572 $win.on('resize.wmS3Menu', function(){ 2573 wmMenuWrap[pluginName]('update'); 2574 }); 2575 }); 2576 2577 setTimeout(function(){ 2578 $win.trigger('resize'); 2579 }, 500); 2580}(jQuery, window, document)); 2581/* 2582 * @license 2583 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. 2584 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 2585 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 2586 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 2587 * Code distributed by Google as part of the polymer project is also 2588 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 2589 */ 2590 2591"use strict"; 2592 2593(function (exports) { 2594 2595 function sign(number) { 2596 if (number < 0) 2597 return -1; 2598 if (number > 0) 2599 return 1; 2600 return 0; 2601 } 2602 2603 function Animator(delegate) { 2604 this.delegate = delegate; 2605 this.startTimeStamp = 0; 2606 this.request_ = null; 2607 }; 2608 2609 Animator.prototype.scheduleAnimation = function () { 2610 if (this.request_) 2611 return; 2612 this.request_ = requestAnimationFrame(this.onAnimation_.bind(this)); 2613 }; 2614 2615 Animator.prototype.startAnimation = function () { 2616 this.startTimeStamp = 0; 2617 this.scheduleAnimation(); 2618 }; 2619 2620 Animator.prototype.stopAnimation = function () { 2621 cancelAnimationFrame(this.request_); 2622 this.startTimeStamp = 0; 2623 this.request_ = null; 2624 }; 2625 2626 Animator.prototype.onAnimation_ = function (timeStamp) { 2627 this.request_ = null; 2628 if (!this.startTimeStamp) 2629 this.startTimeStamp = timeStamp; 2630 if (this.delegate.onAnimation(timeStamp)) 2631 this.scheduleAnimation(); 2632 }; 2633 2634 function VelocityTracker() { 2635 this.recentTouchMoves_ = []; 2636 this.velocityX = 0; 2637 this.velocityY = 0; 2638 } 2639 2640 VelocityTracker.kTimeWindow = 50; 2641 2642 VelocityTracker.prototype.pruneHistory_ = function (timeStamp) { 2643 for (var i = 0; i < this.recentTouchMoves_.length; ++i) { 2644 if (this.recentTouchMoves_[i].timeStamp > timeStamp - VelocityTracker.kTimeWindow) { 2645 this.recentTouchMoves_ = this.recentTouchMoves_.slice(i); 2646 return; 2647 } 2648 } 2649 // All touchmoves are old. 2650 this.recentTouchMoves_ = []; 2651 }; 2652 2653 VelocityTracker.prototype.update_ = function (e) { 2654 this.pruneHistory_(e.timeStamp); 2655 this.recentTouchMoves_.push(e); 2656 2657 var oldestTouchMove = this.recentTouchMoves_[0]; 2658 2659 var deltaX = e.changedTouches[0].clientX - oldestTouchMove.changedTouches[0].clientX; 2660 var deltaY = e.changedTouches[0].clientY - oldestTouchMove.changedTouches[0].clientY; 2661 var deltaT = e.timeStamp - oldestTouchMove.timeStamp; 2662 2663 if (deltaT > 0) { 2664 this.velocityX = deltaX / deltaT; 2665 this.velocityY = deltaY / deltaT; 2666 } else { 2667 this.velocityX = 0; 2668 this.velocityY = 0; 2669 } 2670 }; 2671 2672 VelocityTracker.prototype.onTouchStart = function (e) { 2673 this.recentTouchMoves_.push(e); 2674 this.velocityX = 0; 2675 this.velocityY = 0; 2676 }; 2677 2678 VelocityTracker.prototype.onTouchMove = function (e) { 2679 this.update_(e); 2680 }; 2681 2682 VelocityTracker.prototype.onTouchEnd = function (e) { 2683 this.update_(e); 2684 this.recentTouchMoves_ = []; 2685 }; 2686 2687 function LinearTimingFunction() { 2688 }; 2689 2690 LinearTimingFunction.prototype.scaleTime = function (fraction) { 2691 return fraction; 2692 }; 2693 2694 function CubicBezierTimingFunction(spec) { 2695 this.map = []; 2696 for (var ii = 0; ii <= 100; ii += 1) { 2697 var i = ii / 100; 2698 this.map.push([ 2699 3 * i * (1 - i) * (1 - i) * spec[0] + 2700 3 * i * i * (1 - i) * spec[2] + i * i * i, 2701 3 * i * (1 - i) * (1 - i) * spec[1] + 2702 3 * i * i * (1 - i) * spec[3] + i * i * i 2703 ]); 2704 } 2705 }; 2706 2707 CubicBezierTimingFunction.prototype.scaleTime = function (fraction) { 2708 var fst = 0; 2709 while (fst !== 100 && fraction > this.map[fst][0]) { 2710 fst += 1; 2711 } 2712 if (fraction === this.map[fst][0] || fst === 0) { 2713 return this.map[fst][1]; 2714 } 2715 var yDiff = this.map[fst][1] - this.map[fst - 1][1]; 2716 var xDiff = this.map[fst][0] - this.map[fst - 1][0]; 2717 var p = (fraction - this.map[fst - 1][0]) / xDiff; 2718 return this.map[fst - 1][1] + p * yDiff; 2719 }; 2720 2721 var presetTimingFunctions = { 2722 'linear': new LinearTimingFunction(), 2723 'ease': new CubicBezierTimingFunction([0.25, 0.1, 0.25, 1.0]), 2724 'ease-in': new CubicBezierTimingFunction([0.42, 0, 1.0, 1.0]), 2725 'ease-out': new CubicBezierTimingFunction([0, 0, 0.58, 1.0]), 2726 'ease-in-out': new CubicBezierTimingFunction([0.42, 0, 0.58, 1.0]), 2727 }; 2728 2729 function DrawerController(options) { 2730 this.velocityTracker = new VelocityTracker(); 2731 this.animator = new Animator(this); 2732 2733 this.target = options.target; 2734 this.left = options.left; 2735 this.right = options.right; 2736 this.position = options.position; 2737 this.flip = options.flip; 2738 this.full_width = options.full_width; 2739 2740 this.width = this.right - this.left; 2741 this.curve = presetTimingFunctions[options.curve || 'linear']; 2742 2743 this.willOpenCallback = options.willOpen; 2744 this.didCloseCallback = options.didClose; 2745 this.animateCallback = options.onAnimate; 2746 2747 this.state = DrawerController.kClosed; 2748 2749 this.defaultAnimationSpeed = (this.right - this.left) / DrawerController.kBaseSettleDurationMS; 2750 2751 this.onTouchMove = this.onTouchMove.bind(this); 2752 this.onTouchEnd = this.onTouchEnd.bind(this); 2753 2754 if (!this.full_width) { 2755 this.target.addEventListener('touchstart', this.onTouchStart.bind(this)); 2756 } 2757 } 2758 2759 DrawerController.kOpened = 'opened'; 2760 DrawerController.kClosed = 'closed'; 2761 DrawerController.kOpening = 'opening'; 2762 DrawerController.kClosing = 'closing'; 2763 DrawerController.kDragging = 'dragging'; 2764 DrawerController.kFlinging = 'flinging'; 2765 2766 DrawerController.kBaseSettleDurationMS = 246; 2767 DrawerController.kMaxSettleDurationMS = 600; 2768 2769 DrawerController.kMinFlingVelocity = 0.4; // Matches Android framework. 2770 DrawerController.kTouchSlop = 5; // Matches Android framework. 2771 DrawerController.kTouchSlopSquare = DrawerController.kTouchSlop * DrawerController.kTouchSlop; 2772 2773 DrawerController.prototype.restrictToCurrent = function (offset) { 2774 return Math.max(this.left, Math.min(this.position, offset)); 2775 }; 2776 2777 DrawerController.prototype.restrictToBounds = function (offset) { 2778 return Math.max(this.left, Math.min(this.right, offset)); 2779 }; 2780 2781 DrawerController.prototype.onTouchStart = function (e) { 2782 this.velocityTracker.onTouchStart(e); 2783 2784 var touchX; 2785 if (this.flip) { 2786 touchX = document.documentElement.clientWidth - e.changedTouches[0].clientX; 2787 } else { 2788 touchX = e.changedTouches[0].clientX; 2789 } 2790 var touchY = e.changedTouches[0].clientY; 2791 2792 if (this.state != DrawerController.kOpened) { 2793 if (touchX != this.restrictToCurrent(touchX)) 2794 return; 2795 this.state = DrawerController.kDragging; 2796 } 2797 2798 this.animator.stopAnimation(); 2799 this.target.addEventListener('touchmove', this.onTouchMove); 2800 this.target.addEventListener('touchend', this.onTouchEnd); 2801 // TODO(abarth): Handle touchcancel. 2802 2803 this.startX = touchX; 2804 this.startY = touchY; 2805 this.startPosition = this.position; 2806 this.touchBaseX = Math.min(touchX, this.startPosition); 2807 }; 2808 2809 DrawerController.prototype.onTouchMove = function (e) { 2810 this.velocityTracker.onTouchMove(e); 2811 2812 if (this.state == DrawerController.kOpened) { 2813 var deltaX; 2814 if (this.flip) { 2815 deltaX = document.documentElement.clientWidth - e.changedTouches[0].clientX - this.startX; 2816 } else { 2817 deltaX = e.changedTouches[0].clientX - this.startX; 2818 } 2819 var deltaY = e.changedTouches[0].clientY - this.startY; 2820 2821 if (deltaX * deltaX + deltaY * deltaY < DrawerController.kTouchSlopSquare) { 2822 e.preventDefault(); 2823 return; 2824 } 2825 2826 if (Math.abs(deltaY) > Math.abs(deltaX)) { 2827 this.target.removeEventListener('touchmove', this.onTouchMove); 2828 this.target.removeEventListener('touchend', this.onTouchEnd); 2829 return; 2830 } 2831 2832 this.state = DrawerController.kDragging; 2833 } 2834 2835 e.preventDefault(); 2836 var touchDeltaX; 2837 if (this.flip) { 2838 touchDeltaX = document.documentElement.clientWidth - e.changedTouches[0].clientX - this.touchBaseX;
2839 } else { 2840 touchDeltaX = e.changedTouches[0].clientX - this.touchBaseX; 2841 } 2842 this.position = this.restrictToBounds(this.startPosition + touchDeltaX); 2843 this.animator.scheduleAnimation(); 2844 }; 2845 2846 DrawerController.prototype.onTouchEnd = function (e) { 2847 this.velocityTracker.onTouchEnd(e); 2848 this.target.removeEventListener('touchmove', this.onTouchMove); 2849 this.target.removeEventListener('touchend', this.onTouchEnd); 2850 2851 var velocityX = this.velocityTracker.velocityX; 2852 2853 if (this.flip) { 2854 velocityX *= -1; 2855 } 2856 2857 if (Math.abs(velocityX) > DrawerController.kMinFlingVelocity) { 2858 this.fling(velocityX); 2859 } else if (this.isOpen()) { 2860 this.open(); 2861 } else { 2862 this.close(); 2863 } 2864 }; 2865 2866 DrawerController.prototype.openFraction = function () { 2867 var width = this.right - this.left; 2868 var offset = this.position - this.left; 2869 return offset / width; 2870 }; 2871 2872 DrawerController.prototype.isOpen = function () { 2873 return this.openFraction() >= 0.5; 2874 }; 2875 2876 DrawerController.prototype.isOpening = function () { 2877 return this.state == DrawerController.kOpening || 2878 (this.state == DrawerController.kFlinging && this.animationVelocityX > 0); 2879 } 2880 2881 DrawerController.prototype.isClosing = function () { 2882 return this.state == DrawerController.kClosing || 2883 (this.state == DrawerController.kFlinging && this.animationVelocityX < 0); 2884 } 2885 2886 DrawerController.prototype.toggle = function () { 2887 if (this.isOpen()) 2888 this.close(); 2889 else 2890 this.open(); 2891 }; 2892 2893 DrawerController.prototype.open = function () { 2894 if (this.full_width) { 2895 this.willOpenCallback.call(this.target); 2896 return; 2897 } 2898 if (!this.position) 2899 this.willOpenCallback.call(this.target); 2900 2901 this.animator.stopAnimation(); 2902 this.animationDuration = 400; 2903 this.state = DrawerController.kOpening; 2904 this.animate(); 2905 }; 2906 2907 DrawerController.prototype.close = function () { 2908 if (this.full_width) { 2909 this.didCloseCallback.call(this.target); 2910 return; 2911 } 2912 this.animator.stopAnimation(); 2913 this.animationDuration = 400; 2914 this.state = DrawerController.kClosing; 2915 this.animate(); 2916 }; 2917 2918 DrawerController.prototype.fling = function (velocityX) { 2919 this.animator.stopAnimation(); 2920 this.animationVelocityX = velocityX; 2921 this.state = DrawerController.kFlinging; 2922 this.animate(); 2923 }; 2924 2925 DrawerController.prototype.animate = function () { 2926 this.positionAnimationBase = this.position; 2927 this.animator.startAnimation(); 2928 }; 2929 2930 DrawerController.prototype.targetPosition = function (deltaT) { 2931 if (this.state == DrawerController.kFlinging) 2932 return this.positionAnimationBase + this.animationVelocityX * deltaT; 2933 var targetFraction = this.curve.scaleTime(deltaT / this.animationDuration); 2934 var animationWidth = this.state == DrawerController.kOpening ? 2935 this.width - this.positionAnimationBase : -this.positionAnimationBase; 2936 return this.positionAnimationBase + targetFraction * animationWidth; 2937 }; 2938 2939 DrawerController.prototype.onAnimation = function (timeStamp) { 2940 if (this.state == DrawerController.kDragging) { 2941 this.animateCallback.call(this.target, this.position); 2942 return false; 2943 } 2944 2945 var deltaT = timeStamp - this.animator.startTimeStamp; 2946 var targetPosition = this.targetPosition(deltaT); 2947 this.position = this.restrictToBounds(targetPosition); 2948 2949 this.animateCallback.call(this.target, this.position); 2950 2951 if (targetPosition <= this.left && this.isClosing()) { 2952 this.state = DrawerController.kClosed; 2953 this.didCloseCallback.call(this.target); 2954 return false; 2955 } 2956 if (targetPosition >= this.right && this.isOpening()) { 2957 this.state = DrawerController.kOpened; 2958 return false; 2959 } 2960 2961 return true; 2962 }; 2963 2964 2965 exports.DrawerController = DrawerController; 2966 2967})(window); 2968document.addEventListener('DOMContentLoaded', function() { 2969 var bodyScrollBarWidth = (function () { 2970 var widthHidden, widthScroll, currentValue, currentPriority; 2971 currentValue = document.body.style.getPropertyValue('overflow'); 2972 currentPriority = document.body.style.getPropertyPriority('overflow'); 2973 document.body.style.setProperty('overflow', 'hidden', 'important'); 2974 widthHidden = document.body.clientWidth; 2975 document.body.style.setProperty('overflow', 'scroll', 'important'); 2976 widthScroll = document.body.clientWidth; 2977 document.body.style.setProperty('overflow', currentValue ? currentValue : '', currentPriority); 2978 return widthHidden - widthScroll; 2979 }()); 2980 var media = { 2981 'tablet-landscape': 960, 2982 'tablet-portrait': 768, 2983 'mobile-landscape': 640, 2984 'mobile-portrait': 480 2985 }; 2986 var side_panel = document.querySelector('.side-panel'); 2987 var side_panel_content, side_panel_content_inner, side_panel_top, side_panel_mask, side_panel_button, side_panel_close, side_panel_controller, leftEdge, rightEdge, isPhantom; 2988 var layers, content_width, flip, full_width, elements = {}, comments = {}; 2989 2990 if (!side_panel || side_panel.classList.contains('removed')) { 2991 return; 2992 } 2993 2994 flip = side_panel.getAttribute('data-position') === 'right'; 2995 2996 try { 2997 layers = side_panel.getAttribute('data-layers'); 2998 if (layers !== "") { 2999 layers = JSON.parse(layers.replace(/\[/g, '{').replace(/\]/g, '}').replace(/\'/g, '"')); 3000 } 3001 } catch(e) { 3002 console.error(e); 3003 } 3004 3005 if (typeof layers !== 'object' || Object.keys(layers).length === 0) { 3006 return; 3007 } 3008
3009 Object.keys(layers).forEach(function(clss) { 3010 elements[clss] = document.querySelector('.' + clss); 3011 comments[clss] = document.createComment(clss); 3012 if (elements[clss]) { 3013 elements[clss].parentNode.insertBefore(comments[clss], elements[clss]); 3014 } else { 3015 delete layers[clss]; 3016 } 3017 }); 3018 3019 side_panel_button = side_panel.querySelector('.side-panel-button'); 3020 side_panel_close = side_panel.querySelector('.side-panel-close'); 3021 side_panel_content = side_panel.querySelector('.side-panel-content'); 3022 side_panel_content_inner = side_panel.querySelector('.side-panel-content-inner') || side_panel_content; 3023 side_panel_mask = side_panel.querySelector('.side-panel-mask'); 3024 side_panel_top = side_panel.querySelector('.side-panel-top-inner'); 3025 3026 side_panel.classList.remove('hidden'); 3027 side_panel_button.classList.remove('hidden'); 3028 side_panel_button.style.display = 'none'; 3029 side_panel_content.classList.remove('hidden'); 3030 side_panel_content.style.display = 'none'; 3031 side_panel_mask.classList.remove('hidden'); 3032 side_panel_mask.style.display = 'none'; 3033 3034 content_width = getComputedStyle(side_panel_content, null).width; 3035 3036 leftEdge = 0; 3037 rightEdge = parseInt(content_width) + 50; 3038 3039 if (content_width === 'auto') { 3040 rightEdge = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 3041 full_width = true; 3042 } 3043 3044 isPhantom = !!parseInt($(side_panel).attr("data-phantom")); 3045 3046 if (isPhantom) { 3047 $(side_panel).css({"pointer-events": "none"}); 3048 } else { 3049 $(side_panel).css({"pointer-events": "auto"}); 3050 } 3051 3052 if (flip) { 3053 side_panel_content.style.left = 'auto'; 3054 side_panel_content.style.right = '0'; 3055 } 3056 3057 if (full_width) { 3058 side_panel_content.style.left = '0'; 3059 side_panel_content.style.right = '0'; 3060 } 3061 3062 window.side_panel_controller = side_panel_controller = new DrawerController({ 3063 target: side_panel, 3064 full_width: full_width, 3065 left: leftEdge, 3066 right: rightEdge, 3067 position: 0, 3068 flip: flip, 3069 curve: 'ease-in-out', 3070 willOpen: function() { 3071 side_panel_mask.style.display = 'block'; 3072 side_panel_content.style.display = 'block'; 3073 document.body.classList.add('noscroll'); 3074 if (bodyScrollBarWidth && document.documentElement.scrollHeight > document.documentElement.clientHeight) { 3075 document.body.style.borderRight = bodyScrollBarWidth + 'px solid transparent' 3076 } 3077 }, 3078 didClose: function() { 3079 side_panel_mask.style.display = 'none'; 3080 side_panel_content.style.display = 'none'; 3081 document.body.classList.remove('noscroll'); 3082 if (bodyScrollBarWidth && document.documentElement.scrollHeight > document.documentElement.clientHeight) { 3083 document.body.style.borderRight = '' 3084 } 3085 }, 3086 onAnimate: function(position) { 3087 side_panel_mask.style.opacity = position / rightEdge; 3088 side_panel_content.style.transform = 'translate3d(' + (flip ? rightEdge - position : position - rightEdge) + 'px,0,0)'; 3089 } 3090 }); 3091 3092 side_panel_controller.inPanel = function(clss) { 3093 var viewportWidth; 3094 var current_media; 3095 3096 if (typeof clss !== 'string') { 3097 return false; 3098 } 3099 3100 if (clss.charAt(0) === '.') { 3101 clss = clss.slice(1); 3102 } 3103 3104 viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 3105 3106 Object.keys(media).forEach(function(key) { 3107 if (viewportWidth <= media[key]) { 3108 current_media = key; 3109 } 3110 }); 3111 3112 if (typeof current_media === 'undefined') { 3113 current_media = 'screen'; 3114 } 3115 3116 return layers[clss] && layers[clss][current_media]; 3117 }; 3118 3119 side_panel_button.addEventListener('click', function(e) { 3120 e.preventDefault();
3121 side_panel_controller.toggle(); 3122 return false; 3123 }); 3124 3125 if (side_panel_close) { 3126 side_panel_close.addEventListener('click', function(e) { 3127 e.preventDefault(); 3128 side_panel_controller.close(); 3129 return false; 3130 }); 3131 } 3132 3133 side_panel_mask.addEventListener('click', function() { 3134 side_panel_controller.close(); 3135 return false; 3136 }); 3137 3138 document.addEventListener('keyup', function(e) { 3139 if (e.keyCode === 27) { 3140 side_panel_controller.close(); 3141 return false; 3142 } 3143 }); 3144 3145 var debounce = (function () { 3146 return function (fn, time) { 3147 var timer, func; 3148 if (window.requestAnimationFrame) { 3149 func = function() { 3150 timer && cancelAnimationFrame(timer); 3151 timer = requestAnimationFrame(fn); 3152 } 3153 } else { 3154 func = function() { 3155 window.clearTimeout(timer); 3156 timer = window.setTimeout(function () { 3157 fn(); 3158 }, time) 3159 }; 3160 } 3161 return func; 3162 } 3163 }()); 3164 3165 function checkSidePanel() { 3166 var viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 3167 var current_media; 3168 var emptySide = true; 3169 var emptyTop = true; 3170 3171 if (checkSidePanel.viewportWidth === viewportWidth) { 3172 return; 3173 } 3174 3175 checkSidePanel.viewportWidth = viewportWidth; 3176 3177 Object.keys(media).forEach(function(key) { 3178 if (viewportWidth <= media[key]) { 3179 current_media = key; 3180 } 3181 }); 3182 3183 if (typeof current_media === 'undefined') { 3184 current_media = 'screen'; 3185 } 3186 3187 Object.keys(layers).forEach(function(clss){ 3188 var element, comment; 3189 3190 element = elements[clss]; 3191 comment = comments[clss]; 3192 3193 if (current_media in layers[clss]) { 3194 if (layers[clss][current_media] === 'onTop') { 3195 side_panel_top.appendChild(element); 3196 emptyTop = false; 3197 } else { 3198 side_panel_content_inner.appendChild(element); 3199 emptySide = false; 3200 } 3201 } else { 3202 if (comment) { 3203 comment.parentNode.insertBefore(element, comment); 3204 } 3205 } 3206 }); 3207 3208 if (emptySide) { 3209 side_panel_button.style.display = 'none'; 3210 } else { 3211 side_panel_button.style.display = 'block'; 3212 } 3213 3214 if (!emptyTop || !emptySide) { 3215 side_panel.style.display = 'block'; 3216 } else { 3217 side_panel.style.display = 'none'; 3218 side_panel_controller.close(); 3219 } 3220 } 3221 3222 checkSidePanel = debounce(checkSidePanel, 40); 3223 3224 checkSidePanel(); 3225 window.addEventListener('resize', checkSidePanel); 3226}); 3227$(window).load(function() { 3228 try { 3229 setTimeout(function(){ 3230 $('.lg .img-convert').lightGallery({ 3231 selector: 'a' 3232 }); 3233 }, 1500); 3234 } catch (err) { 3235 console.log('qwe') 3236 } 3237});
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.