1;(function($) { 2 // wrap tables in content for swipe on mobile devices 3 $(function() { 4 $('article.content').find('table').wrap('<div class="for-mobile-view"></div>'); 5 }); 6}(jQuery));$(function () { 7 $(document).click(function (event) { 8 $('.contacts-block').each(function() { 9 if ($(event.target).closest($(this)).length) { 10 return; 11 } else { 12 $(this).find('.tgl-but').prop("checked", false); 13 $(this).find('.icon').removeClass('active'); 14 } 15 }); 16 }); 17 18 function setMargin($block) { 19 if ($(window).width() > 960) { 20 $block.find(".block-body-drop").css({ 21 "margin-left": "0px" 22 }); 23 } else { 24 var left = $block.offset().left * -1; 25 $block.find(".block-body-drop").css({ 26 "margin-left": left + "px" 27 }); 28 } 29 } 30 31 $('.contacts-block').each(function() { 32 var $block = $(this), 33 allClasses = $block.attr("class").split(" "), 34 mainClass = allClasses[0], 35 mainSelector = ".side-panel ."+mainClass+" .block-body-drop", 36 styles = document.styleSheets; 37 38 for(var i = 0; i < styles.length; i++) { 39 if (styles[i].href && styles[i].href.indexOf("styles.css") !== -1) { 40 for(var j = 0; j < styles[i].cssRules.length; j++) { 41 if (styles[i].cssRules[j].selectorText == mainSelector && styles[i].cssRules[j].style.width == "100vw") { 42 $block.data("fullwidth", 1); 43 setMargin($block); 44 break; 45 } 46 } 47 break; 48 } 49 } 50 }); 51 52 $(window).resize(function() { 53 $('.contacts-block').each(function() { 54 var $block = $(this); 55 if ($block.data("fullwidth") == 1) { 56 setMargin($block); 57 } 58 }); 59 }); 60 61 $('.contacts-block').each(function() { 62 var $block = $(this); 63 $block.find('.icon').click(function() { 64 if ($block.data("fullwidth") == 1) { 65 setMargin($block); 66 } 67 if ($block.find('.tgl-but').prop("checked")) { 68 $(this).removeClass('active'); 69 } else { 70 $(this).addClass('active'); 71 } 72 }); 73 }); 74}); 75/* 76 * wmS3Menu v1.0.0 77 * K.I. 433 78 */ 79;(function ($, window, document, undefined ) { 80 var pluginName = 'wmS3Menu', 81 defaults = { 82 screenButton: false, 83 responsiveTl: false, 84 responsiveTp: false, 85 responsiveMl: false, 86 moreText: '...', 87 childIcons: false, 88 childIconsClass: 'has-child-icon' 89 }; 90 // ÐÑовеÑка на каÑание 91 var isTouchable = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch; 92 var $win = $(window); 93 var winWidth = $win.width(); 94 var $doc = $(document); 95 96 var pluginObj = { 97 _events: { 98 hover: function(menuWrap, item, settings){ 99 var link = item.find('> a'); 100 var linkIcon = link.find('.' + settings.childIconsClass); 101 var iconLen = linkIcon.length; 102 var subMenu = item.find('> ul'); 103 var showTimeout; 104 // ÐÑобÑажение 105 function menuShow() { 106 clearTimeout(showTimeout); 107 item.siblings().find('> ul').css('display', ''); 108 // ÐпÑеделение Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²ÑпадаÑки ÑÑÐ¾Ð±Ñ Ð½Ðµ вÑводилоÑÑ Ð·Ð° пÑÐµÐ´ÐµÐ»Ñ Ð¾ÐºÐ½Ð° 109 pluginObj._menuPosition(subMenu); 110 111 link.addClass('hover'); 112 if (iconLen) { 113 linkIcon.addClass('hover'); 114 } 115 } 116 // СкÑÑÑие 117 function menuHide() { 118 showTimeout = setTimeout(function(){ 119 link.removeClass('hover'); 120 subMenu.css('display', ''); 121 if (iconLen) { 122 linkIcon.removeClass('hover'); 123 } 124 }, 500); 125 } 126 // ÐÑклÑÑение и подклÑÑение ÑобÑÑий 127 item.off({ 128 'mouseenter.wmS3Menu': menuShow, 129 'mouseleave.wmS3Menu': menuHide 130 }); 131 item.on({ 132 'mouseenter.wmS3Menu': menuShow, 133 'mouseleave.wmS3Menu': menuHide 134 }); 135 }, 136 click: function(menuWrap, item, settings){ 137 var link = item.find('> a'); 138 var linkIcon = link.find('.' + settings.childIconsClass); 139 var iconLen = linkIcon.length; 140 var subMenu = item.find('> ul'); 141 // ÐеÑеклÑÑение оÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ 142 function menuToggle() { 143 if (subMenu.is(':visible')) { 144 if (isTouchable) { 145 document.location = link.attr('href'); 146 } 147 link.removeClass('hover'); 148 subMenu.css('display', ''); 149 item.removeClass('submenu-opened'); 150 if (iconLen) { 151 linkIcon.removeClass('hover'); 152 } 153 } else { 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 // ÐÑовеÑка на налиÑие Ð¼ÐµÐ½Ñ Ð² Side panel 261 if (menuWrap.closest('.side-panel-content').length) { 262 moreButFlag = false; 263 } 264 265 menuMainUl.children().addClass('first-level'); 266 // ÐаÑÑÑойки Ð´Ð»Ñ Ð³Ð¾ÑизонÑалÑного Ð¼ÐµÐ½Ñ 267 if (!!menuClass.match(/horizontal/i)) { 268 var menuWidth = menuMainUl.width(); 269 var itemsWidth = 0, hideArr = [], hideLength; 270 // Ðнопка More 271 var moreBut = menuMainUl.find('.more-button'); 272 if (!moreBut.length) { 273 moreBut = $('<li class="more-button"><a href="#"><span>' + settings.moreText + '</span></a></li>');// data-trigger="click" 274 menuMainUl.append(moreBut); 275 } 276 // ÐÐµÐ½Ñ More 277 var moreMenu = moreBut.find('> ul'); 278 if (!moreMenu.length) { 279 moreMenu = $('<ul></ul>'); 280 moreBut.append(moreMenu); 281 } 282 283 moreBut.removeClass('removed').attr('data-trigger', 'hover'); 284 menuMainUl.children().css('display', ''); 285 286 var firstLevelItems = menuMainUl.children(':visible').not('.more-button'); 287 moreMenu.html(''); 288 289 if (moreButFlag === 'more' || moreButFlag === 'button') { 290 moreBut.removeClass('disabled'); 291 292 menuWidth -= moreBut.outerWidth(); 293 294 firstLevelItems.each(function(){ 295 var thisItem = $(this); 296 itemsWidth += thisItem.outerWidth(true); 297 if (itemsWidth >= menuWidth) { 298 hideArr.push(thisItem.clone()); 299 thisItem.hide(); 300 } 301 }); 302 303 hideLength = hideArr.length; 304 if (hideLength) { 305 for (var ind = 0; ind < hideLength; ind++) { 306 moreMenu.append(hideArr[ind]); 307 } 308 moreBut.removeClass('disabled'); 309 } else { 310 moreBut.addClass('disabled'); 311 } 312 } else { 313 moreBut.addClass('disabled'); 314 } 315 } 316 // ÐложеннÑе подÑÑовни Ð¼ÐµÐ½Ñ 317 var menuInner = menuMainUl.find('ul'); 318 var menuItems = menuInner.parent(); 319 var menuLinks = menuItems.find('> a'); 320 // СÑÑелоÑки Ð´Ð»Ñ Ð¿Ð¾Ð´ÑÑовней 321 var menuLinksIcons = menuLinks.find('.' + settings.childIconsClass); 322 var childIconLen = menuLinksIcons.length; 323 // Тип оÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð¼ÐµÐ½Ñ 324 var mShow = 'popup'; 325 if (!!menuClass.match(/dropdown/i)) { 326 mShow = 'dropdown'; 327 } else if (!!menuClass.match(/treemenu/i)) { 328 mShow = 'treemenu'; 329 } 330 if (mShow === 'popup') { 331 menuInner.hide(); 332 } 333 if (childIconLen) { 334 menuLinksIcons.remove(); 335 } 336 if (!!settings.childIcons) { 337 // Ðобавление ÑÑÑелоÑек Ð´Ð»Ñ Ð¿Ð¾Ð´ÑÑовней 338 var childIconHTML = '<em class="' + settings.childIconsClass + '"></em>'; 339 340 if (mShow === 'treemenu') { 341 childIconHTML = '<em class="' + settings.childIconsClass + '"><b style="position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px;"></b></em>'; 342 } 343 344 var childIconTag = $(childIconHTML); 345 menuLinks.append(childIconTag.clone()); 346 347 menuLinksIcons = menuLinks.find('.' + settings.childIconsClass); 348 childIconLen = menuLinksIcons.length; 349 } 350 // Удаление вÑÐµÑ ÑобÑÑий на ÑÑÑÐ»ÐºÐ°Ñ 351 menuLinks.removeClass('hover').off('click.wmS3Menu'); 352 menuInner.css('display', ''); 353 if (childIconLen) { 354 menuLinksIcons.removeClass('hover'); 355 } 356 357 menuItems.each(function() { 358 var thisItem = $(this); 359 var trigger = thisItem.data('trigger') || 'hover'; 360 361 if (mShow === 'dropdown' || isTouchable) { 362 trigger = 'click'; 363 } else if (mShow === 'treemenu') { 364 trigger = 'click_tree';
365 } 366 pluginObj._events[trigger](menuWrap, thisItem, settings); 367 }); 368 // Ðлик по докÑменÑÑ 369 if (isTouchable) { 370 function docClick(e) { 371 var target = $(e.target); 372 if (target.closest(menuWrap).length === 0) { 373 menuLinks.removeClass('hover'); 374 menuInner.css('display', ''); 375 menuItems.removeClass('submenu-opened'); 376 377 if (childIconLen) { 378 menuLinksIcons.removeClass('hover'); 379 } 380 } 381 } 382 $doc.off('touchstart.wmS3Menu', docClick); 383 $doc.on('touchstart.wmS3Menu', docClick); 384 } 385 }, 386 update: function () { 387 this.init(); 388 } 389 }; 390 if (!$.fn[pluginName]) { 391 $.fn[pluginName] = function (options) { 392 var args = arguments; 393 if (options === undefined || typeof options === 'object') { 394 return this.each(function () { 395 if (!$.data(this, 'plugin_' + pluginName)) { 396 $.data(this, 'plugin_' + pluginName, new Plugin(this, options)); 397 } 398 }); 399 } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') { 400 var returns; 401 this.each(function () { 402 var instance = $.data(this, 'plugin_' + pluginName); 403 if (instance instanceof Plugin && typeof instance[options] === 'function') { 404 returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1)); 405 } 406 if (options === 'destroy') { 407 $.data(this, 'plugin_' + pluginName, null); 408 } 409 }); 410 return returns !== undefined ? returns : this; 411 } 412 }; 413 } 414 $(function () { 415 var wmMenuWrap = $('.wm-widget-menu.horizontal'); 416 wmMenuWrap[pluginName](); 417 418 $win.on('resize.wmS3Menu', function(){ 419 wmMenuWrap[pluginName]('update'); 420 }); 421 }); 422 423 setTimeout(function(){ 424 $win.trigger('resize'); 425 }, 300); 426}(jQuery, window, document)); 427/* 428 * wmS3Menu v1.0.0 429 * K.I. 433 430 */ 431;(function ($, window, document, undefined ) { 432 var pluginName = 'wmS3Menu', 433 defaults = { 434 screenButton: false, 435 responsiveTl: false, 436 responsiveTp: false, 437 responsiveMl: false, 438 moreText: '...', 439 childIcons: false, 440 childIconsClass: 'has-child-icon' 441 }; 442 // ÐÑовеÑка на каÑание 443 var isTouchable = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch; 444 var $win = $(window); 445 var winWidth = $win.width(); 446 var $doc = $(document); 447 448 var pluginObj = { 449 _events: { 450 hover: function(menuWrap, item, settings){ 451 var link = item.find('> a'); 452 var linkIcon = link.find('.' + settings.childIconsClass); 453 var iconLen = linkIcon.length; 454 var subMenu = item.find('> ul'); 455 var showTimeout; 456 // ÐÑобÑажение 457 function menuShow() { 458 clearTimeout(showTimeout); 459 item.siblings().find('> ul').css('display', ''); 460 // ÐпÑеделение Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²ÑпадаÑки ÑÑÐ¾Ð±Ñ Ð½Ðµ вÑводилоÑÑ Ð·Ð° пÑÐµÐ´ÐµÐ»Ñ Ð¾ÐºÐ½Ð° 461 pluginObj._menuPosition(subMenu); 462 463 link.addClass('hover'); 464 if (iconLen) { 465 linkIcon.addClass('hover'); 466 } 467 } 468 // СкÑÑÑие 469 function menuHide() { 470 showTimeout = setTimeout(function(){ 471 link.removeClass('hover'); 472 subMenu.css('display', ''); 473 if (iconLen) { 474 linkIcon.removeClass('hover'); 475 } 476 }, 500); 477 } 478 // ÐÑклÑÑение и подклÑÑение ÑобÑÑий 479 item.off({ 480 'mouseenter.wmS3Menu': menuShow, 481 'mouseleave.wmS3Menu': menuHide 482 }); 483 item.on({ 484 'mouseenter.wmS3Menu': menuShow, 485 'mouseleave.wmS3Menu': menuHide 486 }); 487 }, 488 click: function(menuWrap, item, settings){ 489 var link = item.find('> a'); 490 var linkIcon = link.find('.' + settings.childIconsClass); 491 var iconLen = linkIcon.length; 492 var subMenu = item.find('> ul'); 493 // ÐеÑеклÑÑение оÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ 494 function menuToggle() { 495 if (subMenu.is(':visible')) { 496 if (isTouchable) { 497 document.location = link.attr('href'); 498 } 499 link.removeClass('hover'); 500 subMenu.css('display', ''); 501 item.removeClass('submenu-opened'); 502 if (iconLen) { 503 linkIcon.removeClass('hover'); 504 } 505 } else { 506 // ÐпÑеделение Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²ÑпадаÑки ÑÑÐ¾Ð±Ñ Ð½Ðµ вÑводилоÑÑ Ð·Ð° пÑÐµÐ´ÐµÐ»Ñ Ð¾ÐºÐ½Ð° 507 pluginObj._menuPosition(subMenu); 508 509 link.addClass('hover'); 510 item.addClass('submenu-opened'); 511 if (iconLen) { 512 linkIcon.addClass('hover'); 513 } 514 } 515 return false;
516 } 517 // ÐÑклÑÑение и подклÑÑение ÑобÑÑий 518 link.off('click.wmS3Menu'); 519 link.on('click.wmS3Menu', menuToggle); 520 }, 521 click_tree: function(menuWrap, item, settings){ 522 var link = item.find('> a'); 523 var linkIcon = link.find('.' + settings.childIconsClass); 524 var subMenu = item.find('> ul'); 525 // ÐеÑеклÑÑение оÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ 526 function menuToggle(event) { 527 var targ = $(event.target); 528 529 if (targ.closest(linkIcon).length) { 530 if (subMenu.is(':visible')) { 531 link.removeClass('hover'); 532 subMenu.css('display', ''); 533 item.removeClass('submenu-opened'); 534 linkIcon.removeClass('hover'); 535 } else { 536 // ÐпÑеделение Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²ÑпадаÑки ÑÑÐ¾Ð±Ñ Ð½Ðµ вÑводилоÑÑ Ð·Ð° пÑÐµÐ´ÐµÐ»Ñ Ð¾ÐºÐ½Ð° 537 pluginObj._menuPosition(subMenu); 538 539 link.addClass('hover'); 540 item.addClass('submenu-opened'); 541 linkIcon.addClass('hover'); 542 } 543 return false; 544 } 545 } 546 // ÐÑклÑÑение и подклÑÑение ÑобÑÑий 547 link.off('click.wmS3Menu'); 548 link.on('click.wmS3Menu', menuToggle); 549 } 550 }, 551 _menuPosition: function(subMenu) { 552 // ÐпÑеделение Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²ÑпадаÑки ÑÑÐ¾Ð±Ñ Ð½Ðµ вÑводилоÑÑ Ð·Ð° пÑÐµÐ´ÐµÐ»Ñ Ð¾ÐºÐ½Ð° 553 winWidth = $win.width(); 554 555 subMenu.css('display', 'block'); 556 557 if (subMenu.parent().hasClass('first-level') === false) { 558 subMenu.css({ 559 'visibility': 'hidden', 560 'opacity': 0 561 }); 562 563 var menuRect = subMenu[0].getBoundingClientRect(); 564 var marginR = parseInt(subMenu.css('margin-right')); 565 var parentWidth = subMenu.parent().width(); 566 567 if (marginR > parentWidth) { 568 subMenu.css('margin-right', parentWidth); 569 } 570 571 if (menuRect.right >= winWidth) { 572 subMenu.css({ 573 'left': '-100%', 574 'margin-left': 0 575 }); 576 } 577 subMenu.css({ 578 'visibility': '', 579 'opacity': '' 580 }); 581 } 582 } 583 }; 584 function Plugin(element, options) { 585 this.element = element; 586 587 this.options = $.extend({}, defaults, options, $(this.element).data()) ; 588 589 this._defaults = defaults; 590 this._name = pluginName; 591 592 this.init(); 593 } 594 Plugin.prototype = { 595 init: function () { 596 var settings = this.options; 597 // ÐпÑеделение ÑиÑÐ¸Ð½Ñ Ð¼ÐµÐ´Ð¸Ð° 598 var moreButFlag = false; 599 if (window.matchMedia('all and (max-width: 640px)').matches) { 600 moreButFlag = settings.responsiveMl; 601 } else if (window.matchMedia('all and (max-width: 768px)').matches) { 602 moreButFlag = settings.responsiveTp; 603 } else if (window.matchMedia('all and (max-width: 960px)').matches) { 604 moreButFlag = settings.responsiveTl; 605 } else { 606 moreButFlag = settings.screenButton; 607 } 608 // ÐбеÑÑка Ð¼ÐµÐ½Ñ 609 var menuWrap = $(this.element); 610 var menuClass = menuWrap.attr('class'); 611 var menuMainUl = $(this.element.querySelector('ul')); 612 // ÐÑовеÑка на налиÑие Ð¼ÐµÐ½Ñ Ð² Side panel 613 if (menuWrap.closest('.side-panel-content').length) { 614 moreButFlag = false; 615 } 616 617 menuMainUl.children().addClass('first-level'); 618 // ÐаÑÑÑойки Ð´Ð»Ñ Ð³Ð¾ÑизонÑалÑного Ð¼ÐµÐ½Ñ 619 if (!!menuClass.match(/horizontal/i)) { 620 var menuWidth = menuMainUl.width(); 621 var itemsWidth = 0, hideArr = [], hideLength; 622 // Ðнопка More 623 var moreBut = menuMainUl.find('.more-button'); 624 if (!moreBut.length) { 625 moreBut = $('<li class="more-button"><a href="#"><span>' + settings.moreText + '</span></a></li>');// data-trigger="click" 626 menuMainUl.append(moreBut); 627 } 628 // ÐÐµÐ½Ñ More 629 var moreMenu = moreBut.find('> ul'); 630 if (!moreMenu.length) { 631 moreMenu = $('<ul></ul>'); 632 moreBut.append(moreMenu); 633 } 634 635 moreBut.removeClass('removed').attr('data-trigger', 'hover'); 636 menuMainUl.children().css('display', ''); 637 638 var firstLevelItems = menuMainUl.children(':visible').not('.more-button'); 639 moreMenu.html(''); 640 641 if (moreButFlag === 'more' || moreButFlag === 'button') { 642 moreBut.removeClass('disabled'); 643 644 menuWidth -= moreBut.outerWidth(); 645 646 firstLevelItems.each(function(){ 647 var thisItem = $(this); 648 itemsWidth += thisItem.outerWidth(true); 649 if (itemsWidth >= menuWidth) { 650 hideArr.push(thisItem.clone()); 651 thisItem.hide(); 652 } 653 }); 654 655 hideLength = hideArr.length; 656 if (hideLength) { 657 for (var ind = 0; ind < hideLength; ind++) { 658 moreMenu.append(hideArr[ind]); 659 } 660 moreBut.removeClass('disabled'); 661 } else { 662 moreBut.addClass('disabled'); 663 } 664 } else { 665 moreBut.addClass('disabled'); 666 } 667 } 668 // ÐложеннÑе подÑÑовни Ð¼ÐµÐ½Ñ 669 var menuInner = menuMainUl.find('ul'); 670 var menuItems = menuInner.parent(); 671 var menuLinks = menuItems.find('> a'); 672 // СÑÑелоÑки Ð´Ð»Ñ Ð¿Ð¾Ð´ÑÑовней 673 var menuLinksIcons = menuLinks.find('.' + settings.childIconsClass); 674 var childIconLen = menuLinksIcons.length; 675 // Тип оÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð¼ÐµÐ½Ñ 676 var mShow = 'popup'; 677 if (!!menuClass.match(/dropdown/i)) { 678 mShow = 'dropdown'; 679 } else if (!!menuClass.match(/treemenu/i)) { 680 mShow = 'treemenu'; 681 } 682 if (mShow === 'popup') { 683 menuInner.hide(); 684 } 685 if (childIconLen) { 686 menuLinksIcons.remove(); 687 } 688 if (!!settings.childIcons) { 689 // Ðобавление ÑÑÑелоÑек Ð´Ð»Ñ Ð¿Ð¾Ð´ÑÑовней 690 var childIconHTML = '<em class="' + settings.childIconsClass + '"></em>'; 691 692 if (mShow === 'treemenu') { 693 childIconHTML = '<em class="' + settings.childIconsClass + '"><b style="position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px;"></b></em>'; 694 } 695 696 var childIconTag = $(childIconHTML); 697 menuLinks.append(childIconTag.clone()); 698 699 menuLinksIcons = menuLinks.find('.' + settings.childIconsClass); 700 childIconLen = menuLinksIcons.length; 701 } 702 // Удаление вÑÐµÑ ÑобÑÑий на ÑÑÑÐ»ÐºÐ°Ñ 703 menuLinks.removeClass('hover').off('click.wmS3Menu'); 704 menuInner.css('display', ''); 705 if (childIconLen) { 706 menuLinksIcons.removeClass('hover'); 707 } 708 709 menuItems.each(function() { 710 var thisItem = $(this); 711 var trigger = thisItem.data('trigger') || 'hover'; 712 713 if (mShow === 'dropdown' || isTouchable) { 714 trigger = 'click'; 715 } else if (mShow === 'treemenu') { 716 trigger = 'click_tree';
717 } 718 pluginObj._events[trigger](menuWrap, thisItem, settings); 719 }); 720 // Ðлик по докÑменÑÑ 721 if (isTouchable) { 722 function docClick(e) { 723 var target = $(e.target); 724 if (target.closest(menuWrap).length === 0) { 725 menuLinks.removeClass('hover'); 726 menuInner.css('display', ''); 727 menuItems.removeClass('submenu-opened'); 728 729 if (childIconLen) { 730 menuLinksIcons.removeClass('hover'); 731 } 732 } 733 } 734 $doc.off('touchstart.wmS3Menu', docClick); 735 $doc.on('touchstart.wmS3Menu', docClick); 736 } 737 }, 738 update: function () { 739 this.init(); 740 } 741 }; 742 if (!$.fn[pluginName]) { 743 $.fn[pluginName] = function (options) { 744 var args = arguments; 745 if (options === undefined || typeof options === 'object') { 746 return this.each(function () { 747 if (!$.data(this, 'plugin_' + pluginName)) { 748 $.data(this, 'plugin_' + pluginName, new Plugin(this, options)); 749 } 750 }); 751 } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') { 752 var returns; 753 this.each(function () { 754 var instance = $.data(this, 'plugin_' + pluginName); 755 if (instance instanceof Plugin && typeof instance[options] === 'function') { 756 returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1)); 757 } 758 if (options === 'destroy') { 759 $.data(this, 'plugin_' + pluginName, null); 760 } 761 }); 762 return returns !== undefined ? returns : this; 763 } 764 }; 765 } 766 $(function () { 767 var wmMenuWrap = $('.wm-widget-menu.vertical'); 768 wmMenuWrap[pluginName](); 769 770 $win.on('resize.wmS3Menu', function(){ 771 wmMenuWrap[pluginName]('update'); 772 }); 773 }); 774 775 setTimeout(function(){ 776 $win.trigger('resize'); 777 }, 300); 778}(jQuery, window, document)); 779$(function() { 780 781 var debounce = (function () { 782 return function (fn, time) { 783 var timer, func; 784 func = function() { 785 var args = [].slice.call(arguments, 0); 786 window.clearTimeout(timer); 787 timer = window.setTimeout(function () { 788 window.requestAnimationFrame && window.requestAnimationFrame(function() { 789 fn.apply(null, args); 790 }) || fn.apply(null, args); 791 }, time) 792 }; 793 return func; 794 } 795 }()); 796 797 var throttle = (function() { 798 return function (fn, threshhold, scope) { 799 threshhold || (threshhold = 250); 800 var last, 801 deferTimer, 802 func; 803 func = function () { 804 var context = scope || this; 805 var now = +new Date, 806 args = arguments; 807 if (last && now < last + threshhold) { 808 // hold on to it 809 clearTimeout(deferTimer); 810 deferTimer = setTimeout(function () { 811 last = now; 812 fn.apply(context, args); 813 }, threshhold); 814 } else { 815 last = now; 816 fn.apply(context, args); 817 } 818 }; 819 return func; 820 } 821 }()); 822 823 $('.news-block').each(function() { 824 var $newsblock = $(this), 825 $items = $newsblock.find('.item-outer'), 826 $list = $newsblock.find('.news__list'), 827 $body = $newsblock.find('.body'), 828 $controls = $newsblock.find('.controls'), 829 $pagers = $newsblock.find('.pager-wrap'), 830 options = {}, 831 count, 832 col_arr, pager_arr, controls_arr, 833 bxslider, 834 containerWidth, 835 isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 836 837 if ($newsblock.attr('data-slider') === '1' && $.fn.bxSlider) { 838 839 options.pagerSelector= $newsblock.attr('data-setting-pager_selector'); 840 options.prevSelector = $newsblock.attr('data-setting-prev_selector'); 841 options.nextSelector = $newsblock.attr('data-setting-next_selector'); 842 options.prevText = $newsblock.attr('data-setting-prev_text') || ''; 843 options.nextText = $newsblock.attr('data-setting-next_text') || ''; 844 options.auto = !!parseInt($newsblock.attr('data-setting-auto')); 845 options.controls = !!parseInt($newsblock.attr('data-setting-controls')); 846 options.pager = !!parseInt($newsblock.attr('data-setting-pager').split(',')[0]); 847 options.pause = parseInt($newsblock.attr('data-setting-pause'), 10) || 4000; 848 options.useCSS = isMobile; 849 options.infiniteLoop = true; 850 options.adaptiveHeight = false; 851 options.mode = $newsblock.attr('data-setting-mode') || 'horizontal'; 852 options.touchEnabled = options.mode === 'horizontal'; 853 options.slideMargin = 0; 854 options.maxSlides = parseInt($newsblock.attr('data-setting-count'), 10) || 1;
855 options.minSlides = options.mode === 'horizontal' ? 1 : options.maxSlides; 856 options.moveSlides = $newsblock.attr('data-setting-move') || 0; 857 858 col_arr = $newsblock.attr('data-setting-columns').split(","); 859 pager_arr = $newsblock.attr('data-setting-pager').split(","); 860 controls_arr = $newsblock.attr('data-setting-controls').split(","); 861 862 if (!options.autoControls && options.auto) { 863 options.onSlideAfter = function() { 864 bxslider.startAuto(); 865 } 866 } 867 868 $items.removeClass('hidden'); 869 if ($list.parent().hasClass('bx-viewport')) { 870 $list.unwrap(); 871 $list.unwrap(); 872 } 873 874 function init(force) { 875 var media_type, 876 body_width = $('body').width(); 877 878 var mediaList = ["screen", "tablet_landscape", "tablet_portrait", "mobile_landscape", "mobile_portrait"]; 879 var media_ind, setting_columns, 880 isJustify, space_between; 881 882 var newContainerWidth = $newsblock.width(), itemHeight, viewportHeight; 883 if (!$newsblock.is(':visible')) { 884 if (bxslider) { 885 bxslider.destroySlider(); 886 } 887 return; 888 } 889 if (!force && containerWidth && containerWidth === newContainerWidth) { 890 return; 891 } 892 containerWidth = newContainerWidth; 893 894 if (bxslider) {
895 bxslider.destroySlider(); 896 } 897 898 if (body_width >= 961) { 899 media_type = "screen"; 900 } else if (body_width <= 960 && body_width >= 769) { 901 media_type = "tablet_landscape"; 902 } else if (body_width <= 768 && body_width >= 641) { 903 media_type = "tablet_portrait"; 904 } else if (body_width <= 640 && body_width >= 481) { 905 media_type = "mobile_landscape"; 906 } else if (body_width <= 480) { 907 media_type = "mobile_portrait"; 908 } 909 media_ind = mediaList.indexOf(media_type); 910 count = parseInt($newsblock.attr('data-setting-count'), 10); 911 912 isJustify = $body.css('justify-content') == "space-between" ? true : false; 913 914 $list.width('auto'); 915 $items 916 .attr('style', '') 917 .slice(1).addClass('hidden').end() 918 .width(options.slideWidth = $items.width()) 919 .removeClass('hidden'); 920 921 if (pager_arr.length > 1) { 922 options.pager = pager_arr[0] == false ? false : !!parseInt(pager_arr[media_ind]); 923 } 924 if (controls_arr.length > 1) { 925 options.controls = controls_arr[0] == false ? false : !!parseInt(controls_arr[media_ind]); 926 } 927 928 $(options.pagerSelector).css({"display": options.pager == true ? "flex" : "none"}); 929 $newsblock.find(".controls").css({"display": options.controls == true ? "flex" : "none"}); 930 931 if (options.mode === 'vertical') { 932 itemHeight = Math.max.apply(Math, $items.map(function() { 933 return $(this).height() 934 }).get()); 935 $items.css('min-height', itemHeight); 936 viewportHeight = itemHeight * count; 937 } else { 938 setting_columns = col_arr[media_ind] == "auto" ? false : parseInt(col_arr[media_ind]); 939 if (setting_columns) { 940 count = setting_columns; 941 } 942 options.maxSlides = Math.min(count, Math.ceil($items.parent().width() / $items.width())); 943 } 944 945 if (isJustify) { 946 if (options.maxSlides > 1) { 947 space_between = Math.floor(($body.width() - $items.width() * options.maxSlides)/ (options.maxSlides-1)); 948 space_between = space_between < 0 ? 0 : space_between; 949 } else { 950 space_between = 0; 951 } 952 options.slideMargin = space_between; 953 } 954 955 if ($items.length > options.maxSlides) { 956 $list.css({'justify-content': 'flex-start'}); 957 if (bxslider) { 958 bxslider.reloadSlider(options); 959 } else { 960 $list.data('bxslider', (bxslider = $list.bxSlider(options))); 961 } 962 } else { 963 $list.css({'justify-content': isJustify ? 'space-between' : 'inherit', 'flex-wrap': 'nowrap'}); 964 $pagers.hide(); 965 $controls.hide(); 966 } 967 968 if (viewportHeight) { 969 $list.parent().css('min-height', viewportHeight); 970 } 971 if (options.mode === 'horizontal') { 972 var align = {}; 973 switch ($body.css('justify-content')) { 974 case 'flex-end': 975 align['margin-left'] = 'auto'; 976 align['margin-right'] = '0px'; 977 break; 978 case 'center': 979 align['margin-left'] = 'auto'; 980 align['margin-right'] = 'auto'; 981 break; 982 default: 983 align['margin-left'] = '0px'; 984 align['margin-right'] = 'auto'; 985 } 986 $newsblock.find('.bx-wrapper').css(align); 987 } 988 } 989 990 $(window).on('resize', debounce(init, 300)); 991 $(window).on('load', function(){ 992 init(true); 993 }); 994 995 init(); 996 } 997 998 $(window).on('resize', debounce(swipeScrollInit, 300)); 999 swipeScrollInit(); 1000 1001 function swipeScrollInit() { 1002 var $shadowLeft = $newsblock.find(".swipe-shadow-left"); 1003 var $shadowRight = $newsblock.find(".swipe-shadow-right"); 1004 if ($list.css("overflow-x") == "auto") { 1005 var scroll_width = $list.get(0).scrollWidth; 1006 var view_width = $list.width(); 1007 $shadowLeft.css("pointer-events","none"); 1008 $shadowRight.css("pointer-events","none"); 1009 1010 $list.off('scroll'); 1011 $list.on('scroll', throttle(swipeScrollCheack, 200)); 1012 1013 swipeScrollCheack(); 1014 1015 function swipeScrollCheack() { 1016 var scroll_left = $list.scrollLeft(); 1017 1018 if (scroll_left > 0) { 1019 $shadowLeft.show(); 1020 } else { 1021 $shadowLeft.hide(); 1022 } 1023 1024 if (scroll_left + view_width >= scroll_width - 1) { 1025 $shadowRight.hide(); 1026 } else { 1027 $shadowRight.show(); 1028 } 1029 } 1030 } else { 1031 $shadowLeft.hide(); 1032 $shadowRight.hide(); 1033 } 1034 } 1035 1036 }); 1037}); 1038/** 1039 * BxSlider v4.1.2 - Fully loaded, responsive content slider 1040 * http://bxslider.com 1041 * 1042 * Copyright 2014, Steven Wanderski - http://stevenwanderski.com - http://bxcreative.com 1043 * Written while drinking Belgian ales and listening to jazz 1044 * 1045 * Released under the MIT license - http://opensource.org/licenses/MIT 1046 */ 1047!function(t){var e={},s={mode:"horizontal",slideSelector:"",infiniteLoop:!0,hideControlOnEnd:!1,speed:500,easing:null,slideMargin:0,startSlide:0,randomStart:!1,captions:!1,ticker:!1,tickerHover:!1,adaptiveHeight:!1,adaptiveHeightSpeed:500,video:!1,useCSS:!0,preloadImages:"visible",responsive:!0,slideZIndex:50,wrapperClass:"bx-wrapper",touchEnabled:!0,swipeThreshold:50,oneToOneTouch:!0,preventDefaultSwipeX:!0,preventDefaultSwipeY:!1,pager:!0,pagerType:"full",pagerShortSeparator:" / ",pagerSelector:null,buildPager:null,pagerCustom:null,controls:!0,nextText:"Next",prevText:"Prev",nextSelector:null,prevSelector:null,autoControls:!1,startText:"Start",stopText:"Stop",autoControlsCombine:!1,autoControlsSelector:null,auto:!1,pause:4e3,autoStart:!0,autoDirection:"next",autoHover:!1,autoDelay:0,autoSlideForOnePage:!1,minSli
1047des:1,maxSlides:1,moveSlides:0,slideWidth:0,onSliderLoad:function(){},onSlideBefore:function(){},onSlideAfter:function(){},onSlideNext:function(){},onSlidePrev:function(){},onSliderResize:function(){}};t.fn.bxSlider=function(n){if(0==this.length)return this;if(this.length>1)return this.each(function(){t(this).bxSlider(n)}),this;var o={},r=this;e.el=this;var a=t(window).width(),l=t(window).height(),d=function(){o.settings=t.extend({},s,n),o.settings.slideWidth=parseInt(o.settings.slideWidth),o.children=r.children(o.settings.slideSelector),o.children.length<o.settings.minSlides&&(o.settings.minSlides=o.children.length),o.children.length<o.settings.maxSlides&&(o.settings.maxSlides=o.children.length),o.settings.randomStart&&(o.settings.startSlide=Math.floor(Math.random()*o.children.length)),o.active={index:o.settings.startSlide},o.carousel=o.settings.minSlides>1||o.settings.maxSlides>1,o.carousel&&(o.settings.preloadImages="all"),o.minThreshold=o.settings.minSlides*o.settings.slideWidth+(o.settings.minSlides-1)*o.settings.slideMargin,o.maxThreshold=o.settings.maxSlides*o.settings.slideWidth+(o.settings.maxSlides-1)*o.settings.slideMargin,o.working=!1,o.controls={},o.interval=null,o.animProp="vertical"==o.settings.mode?"top":"left",o.usingCSS=o.settings.useCSS&&"fade"!=o.settings.mode&&function(){var t=document.createElement("div"),e=["WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var i in e)if(void 0!==t.style[e[i]])return o.cssPrefix=e[i].replace("Perspective","").toLowerCase(),o.animProp="-"+o.cssPrefix+"-transform",!0;return!1}(),"vertical"==o.settings.mode&&(o.settings.maxSlides=o.settings.minSlides),r.data("origStyle",r.attr("style")),r.children(o.settings.slideSelector).each(function(){t(this).data("origStyle",t(this).attr("style"))}),c()},c=function(){r.wrap('<div class="'+o.settings.wrapperClass+'"><div class="bx-viewport"></div></div>'),o.viewport=r.parent(),o.loader=t('<div class="bx-loading" />'),o.viewport.prepend(o.loader),r.css({width:"horizontal"==o.settings.mode?100*o.children.length+215+"%":"auto",position:"relative"}),o.usingCSS&&o.settings.easing?r.css("-"+o.cssPrefix+"-transition-timing-function",o.settings.easing):o.settings.easing||(o.settings.easing="swing");f();o.viewport.css({width:"100%",overflow:"hidden",position:"relative"}),o.viewport.parent().css({maxWidth:v()}),o.settings.pager||o.viewport.parent().css({margin:"0 auto 0px"}),o.children.css({"float":"horizontal"==o.settings.mode?"left":"none",listStyle:"none",position:"relative"}),o.children.css("width",u()),"horizontal"==o.settings.mode&&o.settings.slideMargin>0&&o.children.css("marginRight",o.settings.slideMargin),"vertical"==o.settings.mode&&o.settings.slideMargin>0&&o.children.css("marginBottom",o.settings.slideMargin),"fade"==o.settings.mode&&(o.children.css({position:"absolute",zIndex:0,display:"none"}),o.children.eq(o.settings.startSlide).css({zIndex:o.settings.slideZIndex,display:"block"})),o.controls.el=t('<div class="bx-controls" />'),o.settings.captions&&P(),o.active.last=o.settings.startSlide==x()-1,o.settings.video&&r.fitVids();var e=o.children.eq(o.settings.startSlide);"all"==o.settings.preloadImages&&(e=o.children),o.settings.ticker?o.settings.pager=!1:(o.settings.pager&&T(),o.settings.controls&&C(),o.settings.auto&&o.settings.autoControls&&E(),(o.settings.controls||o.settings.autoControls||o.settings.pager)&&o.viewport.after(o.controls.el)),g(e,h)},g=function(e,i){var s=e.find("img, iframe").length;if(0==s)return void i();var n=0;e.find("img, iframe").each(function(){t(this).one("load",function(){++n==s&&i()}).each(function(){this.complete&&t(this).load()})})},h=function(){if(o.settings.infiniteLoop&&"fade"!=o.settings.mode&&!o.settings.ticker){var e="vertical"==o.settings.mode?o.settings.minSlides:o.settings.maxSlides,i=o.children.slice(0,e).clone().addClass("bx-clone"),s=o.children.slice(-e).clone().addClass("bx-clone");r.append(i).prepend(s)}o.loader.remove(),S(),"vertical"==o.settings.mode&&(o.settings.adaptiveHeight=!0),o.viewport.height(p()),r.redrawSlider(),o.settings.onSliderLoad(o.active.index),o.initialized=!0,o.settings.responsive&&t(window).bind("resize",V),o.settings.auto&&o.settings.autoStart&&(x()>1||o.settings.autoSlideForOnePage)&&H(),o.settings.ticker&&L(),o.settings.pager&&q(o.settings.startSlide),o.settings.controls&&W(),o.settings.touchEnabled&&!o.settings.ticker&&N()},p=function(){var e=0,s=t();if("vertical"==o.settings.mode||o.settings.adaptiveHeight)if(o.carousel){var n=1==o.settings.moveSlides?o.active.index:o.active.index*m();for(s=o.children.eq(n),i=1;i<=o.settings.maxSlides-1;i++)s=n+i>=o.children.length?s.add(o.children.eq(i-1)):s.add(o.children.eq(n+i))}else s=o.children.eq(o.active.index);else s=o.children;return"vertical"==o.settings.mode?(s.each(function(i){e+=t(this).outerHeight()}),o.settings.slideMargin>0&&(e+=o.settings.slideMargin*(o.settings.minSlides-1))):e=Math.max.apply(Math,s.map(function(){return t(this).outerHeight(!1)}).get()),"border-box"==o.viewport.css("box-sizing")?e+=parseFloat(o.viewport.css("padding-top"))+parseFloat(o.viewport.css("padding-bottom"))+parseFloat(o.viewport.css("border-top-width"))+parseFloat(o.viewport.css("border-bottom-width")):"padding-box"==o.viewport.css("box-sizing")&&(e+=parseFloat(o.viewport.css("padding-top"))+parseFloat(o.viewport.css("padding-bottom"))),e},v=function(){var t="100%";return o.settings.slideWidth>0&&(t="horizontal"==o.settings.mode?o.settings.maxSlides*o.settings.slideWidth+(o.settings.maxSlides-1)*o.settings.slideMargin:o.settings.slideWidth),t},u=function(){var t=o.settings.slideWidth,e=o.viewport.width();return 0==o.settings.slideWidth||o.settings.slideWidth>e&&!o.carousel||"vertical"==o.settings.mode?t=e:o.settings.maxSlides>1&&"horizontal"==o.settings.mode&&(e>o.maxThreshold||e<o.minThreshold&&(t=(e-o.settings.slideMargin*(o.settings.minSlides-1))/o.settings.minSlides)),t},f=function(){var t=1;if("horizontal"==o.settings.mode&&o.settings.slideWidth>0)if(o.viewport.width()<o.minThreshold)t=o.settings.minSlides;else if(o.viewport.width()>o.maxThreshold)t=o.settings.maxSlides;else{var e=o.children.first().width()+o.settings.slideMargin;t=Math.floor((o.viewport.width()+o.settings.slideMargin)/e)}else"vertical"==o.settings.mode&&(t=o.settings.minSlides);return t},x=function(){var t=0;if(o.settings.moveSlides>0)if(o.settings.infiniteLoop)t=Math.ceil(o.children.length/m());else for(var e=0,i=0;e<o.children.length;)++t,e=i+f(),i+=o.settings.moveSlides<=f()?o.settings.moveSlides:f();else t=Math.ceil(o.children.length/f());return t},m=function(){return o.settings.moveSlides>0&&o.settings.moveSlides<=f()?o.settings.moveSlides:f()},S=function(){if(o.children.length>o.settings.maxSlides&&o.active.last&&!o.settings.infiniteLoop){if("horizontal"==o.settings.mode){var t=o.children.last(
1047),e=t.position();b(-(e.left-(o.viewport.width()-t.outerWidth())),"reset",0)}else if("vertical"==o.settings.mode){var i=o.children.length-o.settings.minSlides,e=o.children.eq(i).position();b(-e.top,"reset",0)}}else{var e=o.children.eq(o.active.index*m()).position();o.active.index==x()-1&&(o.active.last=!0),void 0!=e&&("horizontal"==o.settings.mode?b(-e.left,"reset",0):"vertical"==o.settings.mode&&b(-e.top,"reset",0))}},b=function(t,e,i,s){if(o.usingCSS){var n="vertical"==o.settings.mode?"translate3d(0, "+t+"px, 0)":"translate3d("+t+"px, 0, 0)";r.css("-"+o.cssPrefix+"-transition-duration",i/1e3+"s"),"slide"==e?(r.css(o.animProp,n),r.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){r.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),D()})):"reset"==e?r.css(o.animProp,n):"ticker"==e&&(r.css("-"+o.cssPrefix+"-transition-timing-function","linear"),r.css(o.animProp,n),r.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){r.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),b(s.resetValue,"reset",0),F()}))}else{var a={};a[o.animProp]=t,"slide"==e?r.animate(a,i,o.settings.easing,function(){D()}):"reset"==e?r.css(o.animProp,t):"ticker"==e&&r.animate(a,speed,"linear",function(){b(s.resetValue,"reset",0),F()})}},w=function(){for(var e="",i=x(),s=0;i>s;s++){var n="";o.settings.buildPager&&t.isFunction(o.settings.buildPager)?(n=o.settings.buildPager(s),o.pagerEl.addClass("bx-custom-pager")):(n=s+1,o.pagerEl.addClass("bx-default-pager")),e+='<div class="bx-pager-item"><a href="" data-slide-index="'+s+'" class="bx-pager-link">'+n+"</a></div>"}o.pagerEl.html(e)},T=function(){o.settings.pagerCustom?o.pagerEl=t(o.settings.pagerCustom):(o.pagerEl=t('<div class="bx-pager" />'),o.settings.pagerSelector?t(o.settings.pagerSelector).html(o.pagerEl):o.controls.el.addClass("bx-has-pager").append(o.pagerEl),w()),o.pagerEl.on("click","a",I)},C=function(){o.controls.next=t('<a class="bx-next" href="">'+o.settings.nextText+"</a>"),o.controls.prev=t('<a class="bx-prev" href="">'+o.settings.prevText+"</a>"),o.controls.next.bind("click",z),o.controls.prev.bind("click",y),o.settings.nextSelector&&t(o.settings.nextSelector).append(o.controls.next),o.settings.prevSelector&&t(o.settings.prevSelector).append(o.controls.prev),o.settings.nextSelector||o.settings.prevSelector||(o.controls.directionEl=t('<div class="bx-controls-direction" />'),o.controls.directionEl.append(o.controls.prev).append(o.controls.next),o.controls.el.addClass("bx-has-controls-direction").append(o.controls.directionEl))},E=function(){o.controls.start=t('<div class="bx-controls-auto-item"><a class="bx-start" href="">'+o.settings.startText+"</a></div>"),o.controls.stop=t('<div class="bx-controls-auto-item"><a class="bx-stop" href="">'+o.settings.stopText+"</a></div>"),o.controls.autoEl=t('<div class="bx-controls-auto" />'),o.controls.autoEl.on("click",".bx-start",M),o.controls.autoEl.on("click",".bx-stop",k),o.settings.autoControlsCombine?o.controls.autoEl.append(o.controls.start):o.controls.autoEl.append(o.controls.start).append(o.controls.stop),o.settings.autoControlsSelector?t(o.settings.autoControlsSelector).html(o.controls.autoEl):o.controls.el.addClass("bx-has-controls-auto").append(o.controls.autoEl),A(o.settings.autoStart?"stop":"start")},P=function(){o.children.each(function(e){var i=t(this).find("img:first").attr("title");void 0!=i&&(""+i).length&&t(this).append('<div class="bx-caption"><span>'+i+"</span></div>")})},z=function(t){o.settings.auto&&r.stopAuto(),r.goToNextSlide(),t.preventDefault()},y=function(t){o.settings.auto&&r.stopAuto(),r.goToPrevSlide(),t.preventDefault()},M=function(t){r.startAuto(),t.preventDefault()},k=function(t){r.stopAuto(),t.preventDefault()},I=function(e){o.settings.auto&&r.stopAuto();var i=t(e.currentTarget);if(void 0!==i.attr("data-slide-index")){var s=parseInt(i.attr("data-slide-index"));s!=o.active.index&&r.goToSlide(s),e.preventDefault()}},q=function(e){var i=o.children.length;return"short"==o.settings.pagerType?(o.settings.maxSlides>1&&(i=Math.ceil(o.children.length/o.settings.maxSlides)),void o.pagerEl.html(e+1+o.settings.pagerShortSeparator+i)):(o.pagerEl.find("a").removeClass("active"),void o.pagerEl.each(function(i,s){t(s).find("a").eq(e).addClass("active")}))},D=function(){if(o.settings.infiniteLoop){var t="";0==o.active.index?t=o.children.eq(0).position():o.active.index==x()-1&&o.carousel?t=o.children.eq((x()-1)*m()).position():o.active.index==o.children.length-1&&(t=o.children.eq(o.children.length-1).position()),t&&("horizontal"==o.settings.mode?b(-t.left,"reset",0):"vertical"==o.settings.mode&&b(-t.top,"reset",0))}o.working=!1,o.settings.onSlideAfter(o.children.eq(o.active.index),o.oldIndex,o.active.index)},A=function(t){o.settings.autoControlsCombine?o.controls.autoEl.html(o.controls[t]):(o.controls.autoEl.find("a").removeClass("active"),o.controls.autoEl.find("a:not(.bx-"+t+")").addClass("active"))},W=function(){1==x()?(o.controls.prev.addClass("disabled"),o.controls.next.addClass("disabled")):!o.settings.infiniteLoop&&o.settings.hideControlOnEnd&&(0==o.active.index?(o.controls.prev.addClass("disabled"),o.controls.next.removeClass("disabled")):o.active.index==x()-1?(o.controls.next.addClass("disabled"),o.controls.prev.removeClass("disabled")):(o.controls.prev.removeClass("disabled"),o.controls.next.removeClass("disabled")))},H=function(){if(o.settings.autoDelay>0){setTimeout(r.startAuto,o.settings.autoDelay)}else r.startAuto();o.settings.autoHover&&r.hover(function(){o.interval&&(r.stopAuto(!0),o.autoPaused=!0)},function(){o.autoPaused&&(r.startAuto(!0),o.autoPaused=null)})},L=function(){var e=0;if("next"==o.settings.autoDirection)r.append(o.children.clone().addClass("bx-clone"));else{r.prepend(o.children.clone().addClass("bx-clone"));var i=o.children.first().position();e="horizontal"==o.settings.mode?-i.left:-i.top}b(e,"reset",0),o.settings.pager=!1,o.settings.controls=!1,o.settings.autoControls=!1,o.settings.tickerHover&&!o.usingCSS&&o.viewport.hover(function(){r.stop()},function(){var e=0;o.children.each(function(i){e+="horizontal"==o.settings.mode?t(this).outerWidth(!0):t(this).outerHeight(!0)});
1047var i=o.settings.speed/e,s="horizontal"==o.settings.mode?"left":"top",n=i*(e-Math.abs(parseInt(r.css(s))));F(n)}),F()},F=function(t){speed=t?t:o.settings.speed;var e={left:0,top:0},i={left:0,top:0};"next"==o.settings.autoDirection?e=r.find(".bx-clone").first().position():i=o.children.first().position();var s="horizontal"==o.settings.mode?-e.left:-e.top,n="horizontal"==o.settings.mode?-i.left:-i.top,a={resetValue:n};b(s,"ticker",speed,a)},N=function(){o.touch={start:{x:0,y:0},end:{x:0,y:0}},o.viewport.bind("touchstart",O)},O=function(t){if(o.working)t.preventDefault();else{o.touch.originalPos=r.position();var e=t.originalEvent;o.touch.start.x=e.changedTouches[0].pageX,o.touch.start.y=e.changedTouches[0].pageY,o.viewport.bind("touchmove",X),o.viewport.bind("touchend",Y)}},X=function(t){var e=t.originalEvent,i=Math.abs(e.changedTouches[0].pageX-o.touch.start.x),s=Math.abs(e.changedTouches[0].pageY-o.touch.start.y);if(3*i>s&&o.settings.preventDefaultSwipeX?t.preventDefault():3*s>i&&o.settings.preventDefaultSwipeY&&t.preventDefault(),"fade"!=o.settings.mode&&o.settings.oneToOneTouch){var n=0;if("horizontal"==o.settings.mode){var r=e.changedTouches[0].pageX-o.touch.start.x;n=o.touch.originalPos.left+r}else{var r=e.changedTouches[0].pageY-o.touch.start.y;n=o.touch.originalPos.top+r}b(n,"reset",0)}},Y=function(t){o.viewport.unbind("touchmove",X);var e=t.originalEvent,i=0;if(o.touch.end.x=e.changedTouches[0].pageX,o.touch.end.y=e.changedTouches[0].pageY,"fade"==o.settings.mode){var s=Math.abs(o.touch.start.x-o.touch.end.x);s>=o.settings.swipeThreshold&&(o.touch.start.x>o.touch.end.x?r.goToNextSlide():r.goToPrevSlide(),r.stopAuto())}else{var s=0;"horizontal"==o.settings.mode?(s=o.touch.end.x-o.touch.start.x,i=o.touch.originalPos.left):(s=o.touch.end.y-o.touch.start.y,i=o.touch.originalPos.top),!o.settings.infiniteLoop&&(0==o.active.index&&s>0||o.active.last&&0>s)?b(i,"reset",200):Math.abs(s)>=o.settings.swipeThreshold?(0>s?r.goToNextSlide():r.goToPrevSlide(),r.stopAuto()):b(i,"reset",200)}o.viewport.unbind("touchend",Y)},V=function(e){if(o.initialized){var i=t(window).width(),s=t(window).height();(a!=i||l!=s)&&(a=i,l=s,r.redrawSlider(),o.settings.onSliderResize.call(r,o.active.index))}};return r.goToSlide=function(e,i){if(!o.working&&o.active.index!=e)if(o.working=!0,o.oldIndex=o.active.index,0>e?o.active.index=x()-1:e>=x()?o.active.index=0:o.active.index=e,o.settings.onSlideBefore(o.children.eq(o.active.index),o.oldIndex,o.active.index),"next"==i?o.settings.onSlideNext(o.children.eq(o.active.index),o.oldIndex,o.active.index):"prev"==i&&o.settings.onSlidePrev(o.children.eq(o.active.index),o.oldIndex,o.active.index),o.active.last=o.active.index>=x()-1,o.settings.pager&&q(o.active.index),o.settings.controls&&W(),"fade"==o.settings.mode)o.settings.adaptiveHeight&&o.viewport.height()!=p()&&o.viewport.animate({height:p()},o.settings.adaptiveHeightSpeed),o.children.filter(":visible").fadeOut(o.settings.speed).css({zIndex:0}),o.children.eq(o.active.index).css("zIndex",o.settings.slideZIndex+1).fadeIn(o.settings.speed,function(){t(this).css("zIndex",o.settings.slideZIndex),D()});else{o.settings.adaptiveHeight&&o.viewport.height()!=p()&&o.viewport.animate({height:p()},o.settings.adaptiveHeightSpeed);var s=0,n={left:0,top:0};if(!o.settings.infiniteLoop&&o.carousel&&o.active.last)if("horizontal"==o.settings.mode){var a=o.children.eq(o.children.length-1);n=a.position(),s=o.viewport.width()-a.outerWidth()}else{var l=o.children.length-o.settings.minSlides;n=o.children.eq(l).position()}else if(o.carousel&&o.active.last&&"prev"==i){var d=1==o.settings.moveSlides?o.settings.maxSlides-m():(x()-1)*m()-(o.children.length-o.settings.maxSlides),a=r.children(".bx-clone").eq(d);n=a.position()}else if("next"==i&&0==o.active.index)n=r.find("> .bx-clone").eq(o.settings.maxSlides).position(),o.active.last=!1;else if(e>=0){var c=e*m();n=o.children.eq(c).position()}if("undefined"!=typeof n){var g="horizontal"==o.settings.mode?-(n.left-s):-n.top;b(g,"slide",o.settings.speed)}}},r.goToNextSlide=function(){if(o.settings.infiniteLoop||!o.active.last){var t=parseInt(o.active.index)+1;r.goToSlide(t,"next")}},r.goToPrevSlide=function(){if(o.settings.infiniteLoop||0!=o.active.index){var t=parseInt(o.active.index)-1;r.goToSlide(t,"prev")}},r.startAuto=function(t){o.interval||(o.interval=setInterval(function(){"next"==o.settings.autoDirection?r.goToNextSlide():r.goToPrevSlide()},o.settings.pause),o.settings.autoControls&&1!=t&&A("stop"))},r.stopAuto=function(t){o.interval&&(clearInterval(o.interval),o.interval=null,o.settings.autoControls&&1!=t&&A("start"))},r.getCurrentSlide=function(){return o.active.index},r.getCurrentSlideElement=function(){return o.children.eq(o.active.index)},r.getSlideCount=function(){return o.children.length},r.redrawSlider=function(){o.children.add(r.find(".bx-clone")).width(u()),o.viewport.css("height",p()),o.settings.ticker||S(),o.active.last&&(o.active.index=x()-1),o.active.index>=x()&&(o.active.last=!0),o.settings.pager&&!o.settings.pagerCustom&&(w(),q(o.active.index))},r.destroySlider=function(){o.initialized&&(o.initialized=!1,t(".bx-clone",this).remove(),o.children.each(function(){void 0!=t(this).data("origStyle")?t(this).attr("style",t(this).data("origStyle")):t(this).removeAttr("style")}),void 0!=t(this).data("origStyle")?this.attr("style",t(this).data("origStyle")):t(this).removeAttr("style"),t(this).unwrap().unwrap(),o.controls.el&&o.controls.el.remove(),o.controls.next&&o.controls.next.remove(),o.controls.prev&&o.controls.prev.remove(),o.pagerEl&&o.settings.controls&&o.pagerEl.remove(),t(".bx-caption",this).remove(),o.controls.autoEl&&o.controls.autoEl.remove(),clearInterval(o.interval),o.settings.responsive&&t(window).unbind("resize",V))},r.reloadSlider=function(t){void 0!=t&&(n=t),r.destroySlider(),d()},d(),this}}(jQuery); 1048$(function() { 1049 1050 var debounce = (function () { 1051 return function (fn, time) { 1052 var timer, func; 1053 func = function() { 1054 var args = [].slice.call(arguments, 0); 1055 window.clearTimeout(timer); 1056 timer = window.setTimeout(function () { 1057 window.requestAnimationFrame && window.requestAnimationFrame(function() {
1058 fn.apply(null, args); 1059 }) || fn.apply(null, args); 1060 }, time) 1061 }; 1062 return func; 1063 } 1064 }()); 1065 1066 var throttle = (function() { 1067 return function (fn, threshhold, scope) { 1068 threshhold || (threshhold = 250); 1069 var last, 1070 deferTimer, 1071 func; 1072 func = function () { 1073 var context = scope || this; 1074 var now = +new Date, 1075 args = arguments; 1076 if (last && now < last + threshhold) { 1077 // hold on to it 1078 clearTimeout(deferTimer); 1079 deferTimer = setTimeout(function () { 1080 last = now; 1081 fn.apply(context, args); 1082 }, threshhold); 1083 } else { 1084 last = now; 1085 fn.apply(context, args); 1086 } 1087 }; 1088 return func; 1089 } 1090 }()); 1091 1092 $('.bx-reviews').each(function() { 1093 var $reviews = $(this), 1094 $items = $reviews.find('.item-outer'), 1095 $list = $reviews.find('.list'), 1096 $body = $reviews.find('.body'), 1097 $controls = $reviews.find('.controls'), 1098 $pagers = $reviews.find('.pager-wrap'), 1099 options = {}, 1100 count, 1101 col_arr, pager_arr, controls_arr, 1102 bxslider, 1103 containerWidth, 1104 isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 1105 1106 if ($reviews.attr('data-slider') === '1' && $.fn.bxSlider) { 1107 1108 options.pagerSelector= $reviews.attr('data-setting-pager_selector'); 1109 options.prevSelector = $reviews.attr('data-setting-prev_selector'); 1110 options.nextSelector = $reviews.attr('data-setting-next_selector'); 1111 options.prevText = $reviews.attr('data-setting-prev_text') || ''; 1112 options.nextText = $reviews.attr('data-setting-next_text') || ''; 1113 options.auto = !!parseInt($reviews.attr('data-setting-auto')); 1114 options.controls = !!parseInt($reviews.attr('data-setting-controls')); 1115 options.pager = !!parseInt($reviews.attr('data-setting-pager').split(',')[0]); 1116 options.pause = parseInt($reviews.attr('data-setting-pause'), 10) || 4000; 1117 options.useCSS = isMobile; 1118 options.infiniteLoop = true; 1119 options.adaptiveHeight = false; 1120 options.mode = $reviews.attr('data-setting-mode') || 'horizontal'; 1121 options.touchEnabled = options.mode === 'horizontal'; 1122 options.slideMargin = 0; 1123 options.maxSlides = parseInt($reviews.attr('data-setting-count'), 10) || 1; 1124 options.minSlides = options.mode === 'horizontal' ? 1 : options.maxSlides; 1125 options.moveSlides = $reviews.attr('data-setting-move') || 0; 1126 1127 col_arr = $reviews.attr('data-setting-columns').split(","); 1128 pager_arr = $reviews.attr('data-setting-pager').split(","); 1129 controls_arr = $reviews.attr('data-setting-controls').split(","); 1130 1131 if (!options.autoControls && options.auto) { 1132 options.onSlideAfter = function() {
1133 bxslider.startAuto(); 1134 } 1135 } 1136 1137 $items.removeClass('hidden'); 1138 if ($list.parent().hasClass('bx-viewport')) { 1139 $list.unwrap(); 1140 $list.unwrap(); 1141 } 1142 1143 function init(force) { 1144 var media_type, 1145 body_width = $('body').width(); 1146 1147 var mediaList = ["screen", "tablet_landscape", "tablet_portrait", "mobile_landscape", "mobile_portrait"]; 1148 var media_ind, setting_columns, 1149 isJustify, space_between; 1150 1151 var newContainerWidth = $reviews.width(), itemHeight, viewportHeight; 1152 if (!$reviews.is(':visible')) { 1153 if (bxslider) { 1154 bxslider.destroySlider(); 1155 } 1156 return; 1157 } 1158 if (!force && containerWidth && containerWidth === newContainerWidth) { 1159 return; 1160 } 1161 containerWidth = newContainerWidth; 1162 1163 if (bxslider) { 1164 bxslider.destroySlider(); 1165 } 1166 1167 if (body_width >= 961) { 1168 media_type = "screen"; 1169 } else if (body_width <= 960 && body_width >= 769) { 1170 media_type = "tablet_landscape"; 1171 } else if (body_width <= 768 && body_width >= 641) { 1172 media_type = "tablet_portrait"; 1173 } else if (body_width <= 640 && body_width >= 481) { 1174 media_type = "mobile_landscape"; 1175 } else if (body_width <= 480) { 1176 media_type = "mobile_portrait"; 1177 } 1178 media_ind = mediaList.indexOf(media_type); 1179 count = parseInt($reviews.attr('data-setting-count'), 10); 1180 1181 isJustify = $body.css('justify-content') == "space-between" ? true : false; 1182 1183 $list.width('auto'); 1184 $items 1185 .attr('style', '') 1186 .slice(1).addClass('hidden').end() 1187 .width(options.slideWidth = $items.width()) 1188 .removeClass('hidden'); 1189 1190 if (pager_arr.length > 1) { 1191 options.pager = pager_arr[0] == false ? false : !!parseInt(pager_arr[media_ind]); 1192 } 1193 if (controls_arr.length > 1) { 1194 options.controls = controls_arr[0] == false ? false : !!parseInt(controls_arr[media_ind]); 1195 } 1196 1197 $(options.pagerSelector).css({"display": options.pager == true ? "flex" : "none"}); 1198 $reviews.find(".controls").css({"display": options.controls == true ? "flex" : "none"}); 1199 1200 if (options.mode === 'vertical') { 1201 itemHeight = Math.max.apply(Math, $items.map(function() { 1202 return $(this).height() 1203 }).get()); 1204 $items.css('min-height', itemHeight); 1205 viewportHeight = itemHeight * count; 1206 } else { 1207 setting_columns = col_arr[media_ind] == "auto" ? false : parseInt(col_arr[media_ind]); 1208 if (setting_columns) { 1209 count = setting_columns; 1210 } 1211 options.maxSlides = Math.min(count, Math.ceil($items.parent().width() / $items.width())); 1212 } 1213 1214 if (isJustify) { 1215 if (options.maxSlides > 1) { 1216 space_between = Math.floor(($body.width() - $items.width() * options.maxSlides)/ (options.maxSlides-1)); 1217 space_between = space_between < 0 ? 0 : space_between; 1218 } else { 1219 space_between = 0; 1220 } 1221 options.slideMargin = space_between; 1222 } 1223 1224 if ($items.length > options.maxSlides) { 1225 $list.css({'justify-content': 'flex-start'}); 1226 if (bxslider) { 1227 bxslider.reloadSlider(options); 1228 } else { 1229 $list.data('bxslider', (bxslider = $list.bxSlider(options))); 1230 } 1231 } else { 1232 $list.css({'justify-content': isJustify ? 'space-between' : 'inherit', 'flex-wrap': 'nowrap'}); 1233 $pagers.hide(); 1234 $controls.hide(); 1235 } 1236 1237 if (viewportHeight) { 1238 $list.parent().css('min-height', viewportHeight); 1239 } 1240 if (options.mode === 'horizontal') { 1241 var align = {}; 1242 switch ($body.css('justify-content')) { 1243 case 'flex-end': 1244 align['margin-left'] = 'auto'; 1245 align['margin-right'] = '0px'; 1246 break; 1247 case 'center': 1248 align['margin-left'] = 'auto'; 1249 align['margin-right'] = 'auto'; 1250 break; 1251 default: 1252 align['margin-left'] = '0px'; 1253 align['margin-right'] = 'auto'; 1254 } 1255 $reviews.find('.bx-wrapper').css(align); 1256 } 1257 } 1258 1259 $(window).on('resize', debounce(init, 300)); 1260 $(window).on('load', function(){ 1261 init(true); 1262 }); 1263 1264 init(); 1265 } 1266 1267 $(window).on('resize', debounce(swipeScrollInit, 300)); 1268 swipeScrollInit(); 1269 1270 function swipeScrollInit() { 1271 var $shadowLeft = $reviews.find(".swipe-shadow-left"); 1272 var $shadowRight = $reviews.find(".swipe-shadow-right"); 1273 if ($list.css("overflow-x") == "auto") { 1274 var scroll_width = $list.get(0).scrollWidth; 1275 var view_width = $list.width(); 1276 $shadowLeft.css("pointer-events","none"); 1277 $shadowRight.css("pointer-events","none"); 1278 1279 $list.off('scroll'); 1280 $list.on('scroll', throttle(swipeScrollCheack, 200)); 1281 1282 swipeScrollCheack(); 1283 1284 function swipeScrollCheack() { 1285 var scroll_left = $list.scrollLeft(); 1286 1287 if (scroll_left > 0) { 1288 $shadowLeft.show(); 1289 } else { 1290 $shadowLeft.hide(); 1291 } 1292 1293 if (scroll_left + view_width >= scroll_width - 1) { 1294 $shadowRight.hide(); 1295 } else { 1296 $shadowRight.show(); 1297 } 1298 } 1299 } else { 1300 $shadowLeft.hide(); 1301 $shadowRight.hide(); 1302 } 1303 } 1304 1305 }); 1306}); 1307/** 1308 * BxSlider v4.1.2 - Fully loaded, responsive content slider 1309 * http://bxslider.com 1310 * 1311 * Copyright 2014, Steven Wanderski - http://stevenwanderski.com - http://bxcreative.com 1312 * Written while drinking Belgian ales and listening to jazz 1313 * 1314 * Released under the MIT license - http://opensource.org/licenses/MIT 1315 */ 1316!function(t){var e={},s={mode:"horizontal",slideSelector:"",infiniteLoop:!0,hideControlOnEnd:!1,speed:500,easing:null,slideMargin:0,startSlide:0,randomStart:!1,captions:!1,ticker:!1,tickerHover:!1,adaptiveHeight:!1,adaptiveHeightSpeed:500,video:!1,useCSS:!0,preloadImages:"visible",responsive:!0,slideZIndex:50,wrapperClass:"bx-wrapper",touchEnabled:!0,swipeThreshold:50,oneToOneTouch:!0,preventDefaultSwipeX:!0,preventDefaultSwipeY:!1,pager:!0,pagerType:"full",pagerShortSeparator:" / ",pagerSelector:null,buildPager:null,pagerCustom:null,controls:!0,nextText:"Next",prevText:"Prev",nextSelector:null,prevSelector:null,autoControls:!1,startText:"Start",stopText:"Stop",autoControlsCombine:!1,autoControlsSelector:null,auto:!1,pause:4e3,autoStart:!0,autoDirection:"next",autoHover:!1,autoDelay:0,autoSlideForOnePage:!1,minSli
1316des:1,maxSlides:1,moveSlides:0,slideWidth:0,onSliderLoad:function(){},onSlideBefore:function(){},onSlideAfter:function(){},onSlideNext:function(){},onSlidePrev:function(){},onSliderResize:function(){}};t.fn.bxSlider=function(n){if(0==this.length)return this;if(this.length>1)return this.each(function(){t(this).bxSlider(n)}),this;var o={},r=this;e.el=this;var a=t(window).width(),l=t(window).height(),d=function(){o.settings=t.extend({},s,n),o.settings.slideWidth=parseInt(o.settings.slideWidth),o.children=r.children(o.settings.slideSelector),o.children.length<o.settings.minSlides&&(o.settings.minSlides=o.children.length),o.children.length<o.settings.maxSlides&&(o.settings.maxSlides=o.children.length),o.settings.randomStart&&(o.settings.startSlide=Math.floor(Math.random()*o.children.length)),o.active={index:o.settings.startSlide},o.carousel=o.settings.minSlides>1||o.settings.maxSlides>1,o.carousel&&(o.settings.preloadImages="all"),o.minThreshold=o.settings.minSlides*o.settings.slideWidth+(o.settings.minSlides-1)*o.settings.slideMargin,o.maxThreshold=o.settings.maxSlides*o.settings.slideWidth+(o.settings.maxSlides-1)*o.settings.slideMargin,o.working=!1,o.controls={},o.interval=null,o.animProp="vertical"==o.settings.mode?"top":"left",o.usingCSS=o.settings.useCSS&&"fade"!=o.settings.mode&&function(){var t=document.createElement("div"),e=["WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var i in e)if(void 0!==t.style[e[i]])return o.cssPrefix=e[i].replace("Perspective","").toLowerCase(),o.animProp="-"+o.cssPrefix+"-transform",!0;return!1}(),"vertical"==o.settings.mode&&(o.settings.maxSlides=o.settings.minSlides),r.data("origStyle",r.attr("style")),r.children(o.settings.slideSelector).each(function(){t(this).data("origStyle",t(this).attr("style"))}),c()},c=function(){r.wrap('<div class="'+o.settings.wrapperClass+'"><div class="bx-viewport"></div></div>'),o.viewport=r.parent(),o.loader=t('<div class="bx-loading" />'),o.viewport.prepend(o.loader),r.css({width:"horizontal"==o.settings.mode?100*o.children.length+215+"%":"auto",position:"relative"}),o.usingCSS&&o.settings.easing?r.css("-"+o.cssPrefix+"-transition-timing-function",o.settings.easing):o.settings.easing||(o.settings.easing="swing");f();o.viewport.css({width:"100%",overflow:"hidden",position:"relative"}),o.viewport.parent().css({maxWidth:v()}),o.settings.pager||o.viewport.parent().css({margin:"0 auto 0px"}),o.children.css({"float":"horizontal"==o.settings.mode?"left":"none",listStyle:"none",position:"relative"}),o.children.css("width",u()),"horizontal"==o.settings.mode&&o.settings.slideMargin>0&&o.children.css("marginRight",o.settings.slideMargin),"vertical"==o.settings.mode&&o.settings.slideMargin>0&&o.children.css("marginBottom",o.settings.slideMargin),"fade"==o.settings.mode&&(o.children.css({position:"absolute",zIndex:0,display:"none"}),o.children.eq(o.settings.startSlide).css({zIndex:o.settings.slideZIndex,display:"block"})),o.controls.el=t('<div class="bx-controls" />'),o.settings.captions&&P(),o.active.last=o.settings.startSlide==x()-1,o.settings.video&&r.fitVids();var e=o.children.eq(o.settings.startSlide);"all"==o.settings.preloadImages&&(e=o.children),o.settings.ticker?o.settings.pager=!1:(o.settings.pager&&T(),o.settings.controls&&C(),o.settings.auto&&o.settings.autoControls&&E(),(o.settings.controls||o.settings.autoControls||o.settings.pager)&&o.viewport.after(o.controls.el)),g(e,h)},g=function(e,i){var s=e.find("img, iframe").length;if(0==s)return void i();var n=0;e.find("img, iframe").each(function(){t(this).one("load",function(){++n==s&&i()}).each(function(){this.complete&&t(this).load()})})},h=function(){if(o.settings.infiniteLoop&&"fade"!=o.settings.mode&&!o.settings.ticker){var e="vertical"==o.settings.mode?o.settings.minSlides:o.settings.maxSlides,i=o.children.slice(0,e).clone().addClass("bx-clone"),s=o.children.slice(-e).clone().addClass("bx-clone");r.append(i).prepend(s)}o.loader.remove(),S(),"vertical"==o.settings.mode&&(o.settings.adaptiveHeight=!0),o.viewport.height(p()),r.redrawSlider(),o.settings.onSliderLoad(o.active.index),o.initialized=!0,o.settings.responsive&&t(window).bind("resize",V),o.settings.auto&&o.settings.autoStart&&(x()>1||o.settings.autoSlideForOnePage)&&H(),o.settings.ticker&&L(),o.settings.pager&&q(o.settings.startSlide),o.settings.controls&&W(),o.settings.touchEnabled&&!o.settings.ticker&&N()},p=function(){var e=0,s=t();if("vertical"==o.settings.mode||o.settings.adaptiveHeight)if(o.carousel){var n=1==o.settings.moveSlides?o.active.index:o.active.index*m();for(s=o.children.eq(n),i=1;i<=o.settings.maxSlides-1;i++)s=n+i>=o.children.length?s.add(o.children.eq(i-1)):s.add(o.children.eq(n+i))}else s=o.children.eq(o.active.index);else s=o.children;return"vertical"==o.settings.mode?(s.each(function(i){e+=t(this).outerHeight()}),o.settings.slideMargin>0&&(e+=o.settings.slideMargin*(o.settings.minSlides-1))):e=Math.max.apply(Math,s.map(function(){return t(this).outerHeight(!1)}).get()),"border-box"==o.viewport.css("box-sizing")?e+=parseFloat(o.viewport.css("padding-top"))+parseFloat(o.viewport.css("padding-bottom"))+parseFloat(o.viewport.css("border-top-width"))+parseFloat(o.viewport.css("border-bottom-width")):"padding-box"==o.viewport.css("box-sizing")&&(e+=parseFloat(o.viewport.css("padding-top"))+parseFloat(o.viewport.css("padding-bottom"))),e},v=function(){var t="100%";return o.settings.slideWidth>0&&(t="horizontal"==o.settings.mode?o.settings.maxSlides*o.settings.slideWidth+(o.settings.maxSlides-1)*o.settings.slideMargin:o.settings.slideWidth),t},u=function(){var t=o.settings.slideWidth,e=o.viewport.width();return 0==o.settings.slideWidth||o.settings.slideWidth>e&&!o.carousel||"vertical"==o.settings.mode?t=e:o.settings.maxSlides>1&&"horizontal"==o.settings.mode&&(e>o.maxThreshold||e<o.minThreshold&&(t=(e-o.settings.slideMargin*(o.settings.minSlides-1))/o.settings.minSlides)),t},f=function(){var t=1;if("horizontal"==o.settings.mode&&o.settings.slideWidth>0)if(o.viewport.width()<o.minThreshold)t=o.settings.minSlides;else if(o.viewport.width()>o.maxThreshold)t=o.settings.maxSlides;else{var e=o.children.first().width()+o.settings.slideMargin;t=Math.floor((o.viewport.width()+o.settings.slideMargin)/e)}else"vertical"==o.settings.mode&&(t=o.settings.minSlides);return t},x=function(){var t=0;if(o.settings.moveSlides>0)if(o.settings.infiniteLoop)t=Math.ceil(o.children.length/m());else for(var e=0,i=0;e<o.children.length;)++t,e=i+f(),i+=o.settings.moveSlides<=f()?o.settings.moveSlides:f();else t=Math.ceil(o.children.length/f());return t},m=function(){return o.settings.moveSlides>0&&o.settings.moveSlides<=f()?o.settings.moveSlides:f()},S=function(){if(o.children.length>o.settings.maxSlides&&o.active.last&&!o.settings.infiniteLoop){if("horizontal"==o.settings.mode){var t=o.children.last(
1316),e=t.position();b(-(e.left-(o.viewport.width()-t.outerWidth())),"reset",0)}else if("vertical"==o.settings.mode){var i=o.children.length-o.settings.minSlides,e=o.children.eq(i).position();b(-e.top,"reset",0)}}else{var e=o.children.eq(o.active.index*m()).position();o.active.index==x()-1&&(o.active.last=!0),void 0!=e&&("horizontal"==o.settings.mode?b(-e.left,"reset",0):"vertical"==o.settings.mode&&b(-e.top,"reset",0))}},b=function(t,e,i,s){if(o.usingCSS){var n="vertical"==o.settings.mode?"translate3d(0, "+t+"px, 0)":"translate3d("+t+"px, 0, 0)";r.css("-"+o.cssPrefix+"-transition-duration",i/1e3+"s"),"slide"==e?(r.css(o.animProp,n),r.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){r.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),D()})):"reset"==e?r.css(o.animProp,n):"ticker"==e&&(r.css("-"+o.cssPrefix+"-transition-timing-function","linear"),r.css(o.animProp,n),r.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){r.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),b(s.resetValue,"reset",0),F()}))}else{var a={};a[o.animProp]=t,"slide"==e?r.animate(a,i,o.settings.easing,function(){D()}):"reset"==e?r.css(o.animProp,t):"ticker"==e&&r.animate(a,speed,"linear",function(){b(s.resetValue,"reset",0),F()})}},w=function(){for(var e="",i=x(),s=0;i>s;s++){var n="";o.settings.buildPager&&t.isFunction(o.settings.buildPager)?(n=o.settings.buildPager(s),o.pagerEl.addClass("bx-custom-pager")):(n=s+1,o.pagerEl.addClass("bx-default-pager")),e+='<div class="bx-pager-item"><a href="" data-slide-index="'+s+'" class="bx-pager-link">'+n+"</a></div>"}o.pagerEl.html(e)},T=function(){o.settings.pagerCustom?o.pagerEl=t(o.settings.pagerCustom):(o.pagerEl=t('<div class="bx-pager" />'),o.settings.pagerSelector?t(o.settings.pagerSelector).html(o.pagerEl):o.controls.el.addClass("bx-has-pager").append(o.pagerEl),w()),o.pagerEl.on("click","a",I)},C=function(){o.controls.next=t('<a class="bx-next" href="">'+o.settings.nextText+"</a>"),o.controls.prev=t('<a class="bx-prev" href="">'+o.settings.prevText+"</a>"),o.controls.next.bind("click",z),o.controls.prev.bind("click",y),o.settings.nextSelector&&t(o.settings.nextSelector).append(o.controls.next),o.settings.prevSelector&&t(o.settings.prevSelector).append(o.controls.prev),o.settings.nextSelector||o.settings.prevSelector||(o.controls.directionEl=t('<div class="bx-controls-direction" />'),o.controls.directionEl.append(o.controls.prev).append(o.controls.next),o.controls.el.addClass("bx-has-controls-direction").append(o.controls.directionEl))},E=function(){o.controls.start=t('<div class="bx-controls-auto-item"><a class="bx-start" href="">'+o.settings.startText+"</a></div>"),o.controls.stop=t('<div class="bx-controls-auto-item"><a class="bx-stop" href="">'+o.settings.stopText+"</a></div>"),o.controls.autoEl=t('<div class="bx-controls-auto" />'),o.controls.autoEl.on("click",".bx-start",M),o.controls.autoEl.on("click",".bx-stop",k),o.settings.autoControlsCombine?o.controls.autoEl.append(o.controls.start):o.controls.autoEl.append(o.controls.start).append(o.controls.stop),o.settings.autoControlsSelector?t(o.settings.autoControlsSelector).html(o.controls.autoEl):o.controls.el.addClass("bx-has-controls-auto").append(o.controls.autoEl),A(o.settings.autoStart?"stop":"start")},P=function(){o.children.each(function(e){var i=t(this).find("img:first").attr("title");void 0!=i&&(""+i).length&&t(this).append('<div class="bx-caption"><span>'+i+"</span></div>")})},z=function(t){o.settings.auto&&r.stopAuto(),r.goToNextSlide(),t.preventDefault()},y=function(t){o.settings.auto&&r.stopAuto(),r.goToPrevSlide(),t.preventDefault()},M=function(t){r.startAuto(),t.preventDefault()},k=function(t){r.stopAuto(),t.preventDefault()},I=function(e){o.settings.auto&&r.stopAuto();var i=t(e.currentTarget);if(void 0!==i.attr("data-slide-index")){var s=parseInt(i.attr("data-slide-index"));s!=o.active.index&&r.goToSlide(s),e.preventDefault()}},q=function(e){var i=o.children.length;return"short"==o.settings.pagerType?(o.settings.maxSlides>1&&(i=Math.ceil(o.children.length/o.settings.maxSlides)),void o.pagerEl.html(e+1+o.settings.pagerShortSeparator+i)):(o.pagerEl.find("a").removeClass("active"),void o.pagerEl.each(function(i,s){t(s).find("a").eq(e).addClass("active")}))},D=function(){if(o.settings.infiniteLoop){var t="";0==o.active.index?t=o.children.eq(0).position():o.active.index==x()-1&&o.carousel?t=o.children.eq((x()-1)*m()).position():o.active.index==o.children.length-1&&(t=o.children.eq(o.children.length-1).position()),t&&("horizontal"==o.settings.mode?b(-t.left,"reset",0):"vertical"==o.settings.mode&&b(-t.top,"reset",0))}o.working=!1,o.settings.onSlideAfter(o.children.eq(o.active.index),o.oldIndex,o.active.index)},A=function(t){o.settings.autoControlsCombine?o.controls.autoEl.html(o.controls[t]):(o.controls.autoEl.find("a").removeClass("active"),o.controls.autoEl.find("a:not(.bx-"+t+")").addClass("active"))},W=function(){1==x()?(o.controls.prev.addClass("disabled"),o.controls.next.addClass("disabled")):!o.settings.infiniteLoop&&o.settings.hideControlOnEnd&&(0==o.active.index?(o.controls.prev.addClass("disabled"),o.controls.next.removeClass("disabled")):o.active.index==x()-1?(o.controls.next.addClass("disabled"),o.controls.prev.removeClass("disabled")):(o.controls.prev.removeClass("disabled"),o.controls.next.removeClass("disabled")))},H=function(){if(o.settings.autoDelay>0){setTimeout(r.startAuto,o.settings.autoDelay)}else r.startAuto();o.settings.autoHover&&r.hover(function(){o.interval&&(r.stopAuto(!0),o.autoPaused=!0)},function(){o.autoPaused&&(r.startAuto(!0),o.autoPaused=null)})},L=function(){var e=0;if("next"==o.settings.autoDirection)r.append(o.children.clone().addClass("bx-clone"));else{r.prepend(o.children.clone().addClass("bx-clone"));var i=o.children.first().position();e="horizontal"==o.settings.mode?-i.left:-i.top}b(e,"reset",0),o.settings.pager=!1,o.settings.controls=!1,o.settings.autoControls=!1,o.settings.tickerHover&&!o.usingCSS&&o.viewport.hover(function(){r.stop()},function(){var e=0;o.children.each(function(i){e+="horizontal"==o.settings.mode?t(this).outerWidth(!0):t(this).outerHeight(!0)});
1316var i=o.settings.speed/e,s="horizontal"==o.settings.mode?"left":"top",n=i*(e-Math.abs(parseInt(r.css(s))));F(n)}),F()},F=function(t){speed=t?t:o.settings.speed;var e={left:0,top:0},i={left:0,top:0};"next"==o.settings.autoDirection?e=r.find(".bx-clone").first().position():i=o.children.first().position();var s="horizontal"==o.settings.mode?-e.left:-e.top,n="horizontal"==o.settings.mode?-i.left:-i.top,a={resetValue:n};b(s,"ticker",speed,a)},N=function(){o.touch={start:{x:0,y:0},end:{x:0,y:0}},o.viewport.bind("touchstart",O)},O=function(t){if(o.working)t.preventDefault();else{o.touch.originalPos=r.position();var e=t.originalEvent;o.touch.start.x=e.changedTouches[0].pageX,o.touch.start.y=e.changedTouches[0].pageY,o.viewport.bind("touchmove",X),o.viewport.bind("touchend",Y)}},X=function(t){var e=t.originalEvent,i=Math.abs(e.changedTouches[0].pageX-o.touch.start.x),s=Math.abs(e.changedTouches[0].pageY-o.touch.start.y);if(3*i>s&&o.settings.preventDefaultSwipeX?t.preventDefault():3*s>i&&o.settings.preventDefaultSwipeY&&t.preventDefault(),"fade"!=o.settings.mode&&o.settings.oneToOneTouch){var n=0;if("horizontal"==o.settings.mode){var r=e.changedTouches[0].pageX-o.touch.start.x;n=o.touch.originalPos.left+r}else{var r=e.changedTouches[0].pageY-o.touch.start.y;n=o.touch.originalPos.top+r}b(n,"reset",0)}},Y=function(t){o.viewport.unbind("touchmove",X);var e=t.originalEvent,i=0;if(o.touch.end.x=e.changedTouches[0].pageX,o.touch.end.y=e.changedTouches[0].pageY,"fade"==o.settings.mode){var s=Math.abs(o.touch.start.x-o.touch.end.x);s>=o.settings.swipeThreshold&&(o.touch.start.x>o.touch.end.x?r.goToNextSlide():r.goToPrevSlide(),r.stopAuto())}else{var s=0;"horizontal"==o.settings.mode?(s=o.touch.end.x-o.touch.start.x,i=o.touch.originalPos.left):(s=o.touch.end.y-o.touch.start.y,i=o.touch.originalPos.top),!o.settings.infiniteLoop&&(0==o.active.index&&s>0||o.active.last&&0>s)?b(i,"reset",200):Math.abs(s)>=o.settings.swipeThreshold?(0>s?r.goToNextSlide():r.goToPrevSlide(),r.stopAuto()):b(i,"reset",200)}o.viewport.unbind("touchend",Y)},V=function(e){if(o.initialized){var i=t(window).width(),s=t(window).height();(a!=i||l!=s)&&(a=i,l=s,r.redrawSlider(),o.settings.onSliderResize.call(r,o.active.index))}};return r.goToSlide=function(e,i){if(!o.working&&o.active.index!=e)if(o.working=!0,o.oldIndex=o.active.index,0>e?o.active.index=x()-1:e>=x()?o.active.index=0:o.active.index=e,o.settings.onSlideBefore(o.children.eq(o.active.index),o.oldIndex,o.active.index),"next"==i?o.settings.onSlideNext(o.children.eq(o.active.index),o.oldIndex,o.active.index):"prev"==i&&o.settings.onSlidePrev(o.children.eq(o.active.index),o.oldIndex,o.active.index),o.active.last=o.active.index>=x()-1,o.settings.pager&&q(o.active.index),o.settings.controls&&W(),"fade"==o.settings.mode)o.settings.adaptiveHeight&&o.viewport.height()!=p()&&o.viewport.animate({height:p()},o.settings.adaptiveHeightSpeed),o.children.filter(":visible").fadeOut(o.settings.speed).css({zIndex:0}),o.children.eq(o.active.index).css("zIndex",o.settings.slideZIndex+1).fadeIn(o.settings.speed,function(){t(this).css("zIndex",o.settings.slideZIndex),D()});else{o.settings.adaptiveHeight&&o.viewport.height()!=p()&&o.viewport.animate({height:p()},o.settings.adaptiveHeightSpeed);var s=0,n={left:0,top:0};if(!o.settings.infiniteLoop&&o.carousel&&o.active.last)if("horizontal"==o.settings.mode){var a=o.children.eq(o.children.length-1);n=a.position(),s=o.viewport.width()-a.outerWidth()}else{var l=o.children.length-o.settings.minSlides;n=o.children.eq(l).position()}else if(o.carousel&&o.active.last&&"prev"==i){var d=1==o.settings.moveSlides?o.settings.maxSlides-m():(x()-1)*m()-(o.children.length-o.settings.maxSlides),a=r.children(".bx-clone").eq(d);n=a.position()}else if("next"==i&&0==o.active.index)n=r.find("> .bx-clone").eq(o.settings.maxSlides).position(),o.active.last=!1;else if(e>=0){var c=e*m();n=o.children.eq(c).position()}if("undefined"!=typeof n){var g="horizontal"==o.settings.mode?-(n.left-s):-n.top;b(g,"slide",o.settings.speed)}}},r.goToNextSlide=function(){if(o.settings.infiniteLoop||!o.active.last){var t=parseInt(o.active.index)+1;r.goToSlide(t,"next")}},r.goToPrevSlide=function(){if(o.settings.infiniteLoop||0!=o.active.index){var t=parseInt(o.active.index)-1;r.goToSlide(t,"prev")}},r.startAuto=function(t){o.interval||(o.interval=setInterval(function(){"next"==o.settings.autoDirection?r.goToNextSlide():r.goToPrevSlide()},o.settings.pause),o.settings.autoControls&&1!=t&&A("stop"))},r.stopAuto=function(t){o.interval&&(clearInterval(o.interval),o.interval=null,o.settings.autoControls&&1!=t&&A("start"))},r.getCurrentSlide=function(){return o.active.index},r.getCurrentSlideElement=function(){return o.children.eq(o.active.index)},r.getSlideCount=function(){return o.children.length},r.redrawSlider=function(){o.children.add(r.find(".bx-clone")).width(u()),o.viewport.css("height",p()),o.settings.ticker||S(),o.active.last&&(o.active.index=x()-1),o.active.index>=x()&&(o.active.last=!0),o.settings.pager&&!o.settings.pagerCustom&&(w(),q(o.active.index))},r.destroySlider=function(){o.initialized&&(o.initialized=!1,t(".bx-clone",this).remove(),o.children.each(function(){void 0!=t(this).data("origStyle")?t(this).attr("style",t(this).data("origStyle")):t(this).removeAttr("style")}),void 0!=t(this).data("origStyle")?this.attr("style",t(this).data("origStyle")):t(this).removeAttr("style"),t(this).unwrap().unwrap(),o.controls.el&&o.controls.el.remove(),o.controls.next&&o.controls.next.remove(),o.controls.prev&&o.controls.prev.remove(),o.pagerEl&&o.settings.controls&&o.pagerEl.remove(),t(".bx-caption",this).remove(),o.controls.autoEl&&o.controls.autoEl.remove(),clearInterval(o.interval),o.settings.responsive&&t(window).unbind("resize",V))},r.reloadSlider=function(t){void 0!=t&&(n=t),r.destroySlider(),d()},d(),this}}(jQuery); 1317$(function() { 1318 var $search = $('.wm-search'); 1319 var curMedia; 1320 1321 var debounce = (function () { 1322 return function (fn, time) { 1323 var timer, func; 1324 func = function() { 1325 var args = [].slice.call(arguments, 0); 1326 window.clearTimeout(timer); 1327 timer = window.setTimeout(function () { 1328 window.requestAnimationFrame && window.requestAnimationFrame(function() {
1329 fn.apply(null, args); 1330 }) || fn.apply(null, args); 1331 }, time) 1332 }; 1333 return func; 1334 } 1335 }()); 1336 1337 function init() { 1338 $search.each(function() { 1339 var $this = $(this), 1340 options = {}; 1341 if ($this.attr('data-setting-animate_list')) { 1342 var media_type, 1343 body_width = $('body').width(); 1344 var mediaList = ["screen", "tablet_landscape", "tablet_portrait", "mobile_landscape", "mobile_portrait"]; 1345 var media_ind, animate_list_arr; 1346 1347 1348 if (body_width >= 961) { 1349 media_type = "screen"; 1350 } else if (body_width <= 960 && body_width >= 769) { 1351 media_type = "tablet_landscape"; 1352 } else if (body_width <= 768 && body_width >= 641) { 1353 media_type = "tablet_portrait"; 1354 } else if (body_width <= 640 && body_width >= 481) { 1355 media_type = "mobile_landscape"; 1356 } else if (body_width <= 480) { 1357 media_type = "mobile_portrait"; 1358 } 1359 1360 media_ind = mediaList.indexOf(media_type); 1361 animate_list_arr = $this.attr('data-setting-animate_list').split(","); 1362 1363 options.animation = $this.attr('data-setting-type'); 1364 if(curMedia != media_type) { 1365 if (animate_list_arr[media_ind] == 1) { 1366 curMedia = media_type; 1367 $this.find('.wm-search-inner').wmSearch(options); 1368 } else { 1369 $this.find('.wm-search-inner').wmSearch('destroy'); 1370 } 1371 } 1372 } 1373 }); 1374 } 1375 1376 $(window).on('resize', debounce(init, 300)); 1377 1378 init(); 1379 1380}); 1381(function($) { 1382 function getInternetExplorerVersion(){ 1383 var rv = -1; 1384 if (navigator.appName == 'Microsoft Internet Explorer') { 1385 var ua = navigator.userAgent; 1386 var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); 1387 if (re.exec(ua) != null) 1388 rv = parseFloat( RegExp.$1 ); 1389 } else if (navigator.appName == 'Netscape') { 1390 var ua = navigator.userAgent; 1391 var re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})"); 1392 if (re.exec(ua) != null) 1393 rv = parseFloat( RegExp.$1 ); 1394 } 1395 return rv; 1396 } 1397 1398 $.fn.wmSearch = function(options){ 1399 if (options === 'destroy') { 1400 return this.each(function () { 1401 var $this = $(this); 1402 var inp = $this.find('input[name=search]'); 1403 var search_but = $this.find('button'); 1404 var $wrap = $this.parent('div'); 1405 1406 $this.css('justify-content','flex-start'); 1407 $wrap.css('visibility','visible'); 1408 search_but.css('visibility','visible'); 1409 inp.stop(true).show().css({ 1410 'opacity': '', 1411 'max-width':'' 1412 }); 1413 1414 if ($this.data('wm_search')) { 1415 search_but.off('.' + $this.data('wm_search')); 1416 $(document).off('.' + $this.data('wm_search')); 1417 $this.removeData('wm_search'); 1418 } 1419 }); 1420 } else { 1421 var defaults = $.extend({ 1422 animation : 'fade' 1423 }, options); 1424 1425 return this.each(function () { 1426 var clss = 'wm_search_' + Date.now(); 1427 var $this = $(this); 1428 var inp = $this.find('input[name=search]'); 1429 var search_but = $this.find('button'); 1430 var $wrap = $this.parent('div'); 1431 1432 $this.css('justify-content','flex-end'); 1433 $wrap.css('visibility','hidden'); 1434 search_but.css('visibility','visible'); 1435 1436 if ($this.data('wm_search')) { 1437 return; 1438 } 1439 1440 1441 if (defaults.animation == 'slide') { 1442 var iebrw = getInternetExplorerVersion(); 1443 if (iebrw == 9 || iebrw == 10 || iebrw == 11) { 1444 inp.hide(); 1445 search_but.on('click.' + clss, function () { 1446 var wrapVis = $wrap.css('visibility'); 1447 if(wrapVis=="hidden"){ 1448 $wrap.css('visibility','visible'); 1449 inp.fadeIn().focus(); 1450 return false; 1451 } 1452 }); 1453 1454 $(document).on('click.' + clss, function(event){ 1455 if( $(event.target).closest('.wm-search-inner').length ) 1456 return; 1457 inp.fadeOut(); 1458 $wrap.css('visibility','hidden'); 1459 event.stopPropagation(); 1460 }); 1461 } else { 1462 inp.css({ 1463 'max-width':'0px', 1464 'opacity':'0' 1465 }); 1466 search_but.on('click.' + clss, function () { 1467 var wrapVis = $wrap.css('visibility'); 1468 if(wrapVis=="hidden"){ 1469 $wrap.css('visibility','visible'); 1470 inp.addClass('slide_search').css({ 1471 'opacity': '1', 1472 'max-width':'100%' 1473 }).focus(); 1474 return false; 1475 } 1476 1477 }); 1478 $(document).on('click.' + clss, function(event){ 1479 if( $(event.target).closest('.wm-search-inner').length ) 1480 return; 1481 inp.css({ 1482 'opacity': '0', 1483 'max-width':'0' 1484 }); 1485 $wrap.css('visibility','hidden'); 1486 event.stopPropagation(); 1487 }); 1488 } 1489 } else { 1490 search_but.on('click.' + clss, function () { 1491 var wrapVis = $wrap.css('visibility'); 1492 if(wrapVis=="hidden"){ 1493 $wrap.css('visibility','visible'); 1494 inp.fadeIn().focus(); 1495 return false;
1496 } 1497 }); 1498 inp.hide(); 1499 $(document).on('click.' + clss, function(event){ 1500 if( $(event.target).closest('.wm-search-inner').length ) 1501 return; 1502 inp.fadeOut(); 1503 $wrap.css('visibility','hidden'); 1504 event.stopPropagation(); 1505 }); 1506 } 1507 1508 $this.data('wm_search', clss); 1509 1510 }); 1511 } 1512 } 1513})(jQuery); 1514document.addEventListener('DOMContentLoaded', function() { 1515 var bodyScrollBarWidth = (function () { 1516 var widthHidden, widthScroll, currentValue, currentPriority; 1517 currentValue = document.body.style.getPropertyValue('overflow'); 1518 currentPriority = document.body.style.getPropertyPriority('overflow'); 1519 document.body.style.setProperty('overflow', 'hidden', 'important'); 1520 widthHidden = document.body.clientWidth; 1521 document.body.style.setProperty('overflow', 'scroll', 'important'); 1522 widthScroll = document.body.clientWidth; 1523 document.body.style.setProperty('overflow', currentValue ? currentValue : '', currentPriority); 1524 return widthHidden - widthScroll; 1525 }()); 1526 var media = { 1527 'tablet-landscape': 960, 1528 'tablet-portrait': 768, 1529 'mobile-landscape': 640, 1530 'mobile-portrait': 480 1531 }; 1532 var side_panel = document.querySelector('.side-panel'); 1533 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; 1534 var layers, elements = {}, comments = {}; 1535 1536 if (!side_panel || side_panel.classList.contains('removed')) { 1537 return; 1538 } 1539 1540 try { 1541 layers = JSON.parse(side_panel.getAttribute('data-layers').replace(/\[/g, '{').replace(/\]/g, '}').replace(/\'/g, '"')); 1542 } catch(e) { 1543 console.error(e); 1544 } 1545 1546 if (typeof layers !== 'object' || Object.keys(layers).length === 0) { 1547 return; 1548 } 1549 1550 Object.keys(layers).forEach(function(clss) { 1551 elements[clss] = document.querySelector('.' + clss); 1552 comments[clss] = document.createComment(clss); 1553 if (elements[clss]) { 1554 elements[clss].parentNode.insertBefore(comments[clss], elements[clss]); 1555 } else { 1556 delete layers[clss]; 1557 } 1558 }); 1559 1560 side_panel_button = side_panel.querySelector('.side-panel-button'); 1561 side_panel_close = side_panel.querySelector('.side-panel-close'); 1562 side_panel_content = side_panel.querySelector('.side-panel-content'); 1563 side_panel_content_inner = side_panel.querySelector('.side-panel-content-inner') || side_panel_content; 1564 side_panel_mask = side_panel.querySelector('.side-panel-mask'); 1565 side_panel_top = side_panel.querySelector('.side-panel-top-inner'); 1566 1567 side_panel.classList.remove('hidden'); 1568 side_panel_button.classList.remove('hidden'); 1569 side_panel_button.style.display = 'none'; 1570 side_panel_content.classList.remove('hidden'); 1571 side_panel_content.style.display = 'none'; 1572 side_panel_mask.classList.remove('hidden'); 1573 side_panel_mask.style.display = 'none'; 1574 1575 leftEdge = 0; 1576 rightEdge = parseInt(getComputedStyle(side_panel_content, null).width) + 50; 1577 1578 window.side_panel_controller = side_panel_controller = new DrawerController({ 1579 target: side_panel, 1580 left: leftEdge, 1581 right: rightEdge, 1582 position: 0, 1583 curve: 'ease-in-out', 1584 willOpen: function() { 1585 side_panel_mask.style.display = 'block'; 1586 side_panel_content.style.display = 'block'; 1587 document.body.classList.add('noscroll'); 1588 if (bodyScrollBarWidth && document.documentElement.scrollHeight > document.documentElement.clientHeight) { 1589 document.body.style.borderRight = bodyScrollBarWidth + 'px solid transparent' 1590 } 1591 }, 1592 didClose: function() { 1593 side_panel_mask.style.display = 'none'; 1594 side_panel_content.style.display = 'none'; 1595 document.body.classList.remove('noscroll'); 1596 if (bodyScrollBarWidth && document.documentElement.scrollHeight > document.documentElement.clientHeight) { 1597 document.body.style.borderRight = '' 1598 } 1599 }, 1600 onAnimate: function(position) { 1601 side_panel_mask.style.opacity = (position ) / rightEdge; 1602 side_panel_content.style.transform = 'translate3d(' + (position - rightEdge) + 'px,0,0)' 1603 } 1604 }); 1605 1606 side_panel_controller.inPanel = function(clss) { 1607 var viewportWidth; 1608 var current_media; 1609 1610 if (typeof clss !== 'string') { 1611 return false; 1612 } 1613 1614 if (clss.charAt(0) === '.') { 1615 clss = clss.slice(1); 1616 } 1617 1618 viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 1619
1620 Object.keys(media).forEach(function(key) { 1621 if (viewportWidth <= media[key]) { 1622 current_media = key; 1623 } 1624 }); 1625 1626 if (typeof current_media === 'undefined') { 1627 current_media = 'screen'; 1628 } 1629 1630 return layers[clss] && layers[clss][current_media]; 1631 }; 1632 1633 side_panel_button.addEventListener('click', function(e) { 1634 e.preventDefault(); 1635 side_panel_controller.toggle(); 1636 return false; 1637 }); 1638 1639 if (side_panel_close) { 1640 side_panel_close.addEventListener('click', function(e) { 1641 e.preventDefault(); 1642 side_panel_controller.close(); 1643 return false; 1644 }); 1645 } 1646 1647 side_panel_mask.addEventListener('click', function() { 1648 side_panel_controller.close(); 1649 return false; 1650 }); 1651 1652 1653 var debounce = (function () { 1654 return function (fn, time) { 1655 var timer, func; 1656 if (window.requestAnimationFrame) { 1657 func = function() { 1658 timer && cancelAnimationFrame(timer); 1659 timer = requestAnimationFrame(fn); 1660 } 1661 } else { 1662 func = function() { 1663 window.clearTimeout(timer); 1664 timer = window.setTimeout(function () { 1665 fn(); 1666 }, time) 1667 }; 1668 } 1669 return func; 1670 } 1671 }()); 1672 1673 function checkSidePanel() { 1674 var viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 1675 var current_media; 1676 var emptySide = true; 1677 var emptyTop = true; 1678 1679 if (checkSidePanel.viewportWidth === viewportWidth) { 1680 return; 1681 } 1682 1683 checkSidePanel.viewportWidth = viewportWidth; 1684 1685 Object.keys(media).forEach(function(key) { 1686 if (viewportWidth <= media[key]) { 1687 current_media = key; 1688 } 1689 }); 1690 1691 if (typeof current_media === 'undefined') { 1692 current_media = 'screen'; 1693 } 1694 1695 Object.keys(layers).forEach(function(clss){ 1696 var element, comment; 1697 1698 element = elements[clss]; 1699 comment = comments[clss]; 1700 1701 if (current_media in layers[clss]) { 1702 if (layers[clss][current_media] == 'onTop') { 1703 side_panel_top.appendChild(element); 1704 emptyTop = false; 1705 } else { 1706 side_panel_content_inner.appendChild(element); 1707 emptySide = false;
1708 } 1709 } else { 1710 if (comment) { 1711 comment.parentNode.insertBefore(element, comment); 1712 } 1713 } 1714 }); 1715 1716 if (emptySide) { 1717 side_panel_button.style.display = 'none'; 1718 } else { 1719 side_panel_button.style.display = 'block'; 1720 } 1721 1722 if (!emptyTop || !emptySide) { 1723 side_panel.style.display = 'block'; 1724 } else { 1725 side_panel.style.display = 'none'; 1726 side_panel_controller.close(); 1727 } 1728 } 1729 1730 checkSidePanel = debounce(checkSidePanel, 40); 1731 1732 checkSidePanel(); 1733 window.addEventListener('resize', checkSidePanel); 1734}); 1735/* 1736 * @license 1737 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. 1738 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 1739 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 1740 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 1741 * Code distributed by Google as part of the polymer project is also 1742 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 1743 */ 1744 1745"use strict"; 1746 1747(function (exports) { 1748 1749 function sign(number) { 1750 if (number < 0) 1751 return -1; 1752 if (number > 0) 1753 return 1; 1754 return 0; 1755 } 1756 1757 function Animator(delegate) { 1758 this.delegate = delegate; 1759 this.startTimeStamp = 0; 1760 this.request_ = null; 1761 }; 1762 1763 Animator.prototype.scheduleAnimation = function () { 1764 if (this.request_) 1765 return; 1766 this.request_ = requestAnimationFrame(this.onAnimation_.bind(this)); 1767 }; 1768 1769 Animator.prototype.startAnimation = function () { 1770 this.startTimeStamp = 0; 1771 this.scheduleAnimation(); 1772 }; 1773 1774 Animator.prototype.stopAnimation = function () { 1775 cancelAnimationFrame(this.request_); 1776 this.startTimeStamp = 0; 1777 this.request_ = null; 1778 }; 1779 1780 Animator.prototype.onAnimation_ = function (timeStamp) { 1781 this.request_ = null; 1782 if (!this.startTimeStamp) 1783 this.startTimeStamp = timeStamp; 1784 if (this.delegate.onAnimation(timeStamp)) 1785 this.scheduleAnimation(); 1786 }; 1787 1788 function VelocityTracker() { 1789 this.recentTouchMoves_ = []; 1790 this.velocityX = 0; 1791 this.velocityY = 0; 1792 } 1793 1794 VelocityTracker.kTimeWindow = 50; 1795 1796 VelocityTracker.prototype.pruneHistory_ = function (timeStamp) { 1797 for (var i = 0; i < this.recentTouchMoves_.length; ++i) { 1798 if (this.recentTouchMoves_[i].timeStamp > timeStamp - VelocityTracker.kTimeWindow) { 1799 this.recentTouchMoves_ = this.recentTouchMoves_.slice(i); 1800 return; 1801 } 1802 } 1803 // All touchmoves are old. 1804 this.recentTouchMoves_ = []; 1805 }; 1806 1807 VelocityTracker.prototype.update_ = function (e) { 1808 this.pruneHistory_(e.timeStamp); 1809 this.recentTouchMoves_.push(e); 1810 1811 var oldestTouchMove = this.recentTouchMoves_[0]; 1812 1813 var deltaX = e.changedTouches[0].clientX - oldestTouchMove.changedTouches[0].clientX; 1814 var deltaY = e.changedTouches[0].clientY - oldestTouchMove.changedTouches[0].clientY; 1815 var deltaT = e.timeStamp - oldestTouchMove.timeStamp; 1816 1817 if (deltaT > 0) { 1818 this.velocityX = deltaX / deltaT; 1819 this.velocityY = deltaY / deltaT; 1820 } else { 1821 this.velocityX = 0; 1822 this.velocityY = 0; 1823 } 1824 }; 1825 1826 VelocityTracker.prototype.onTouchStart = function (e) { 1827 this.recentTouchMoves_.push(e); 1828 this.velocityX = 0; 1829 this.velocityY = 0; 1830 }; 1831 1832 VelocityTracker.prototype.onTouchMove = function (e) { 1833 this.update_(e); 1834 }; 1835 1836 VelocityTracker.prototype.onTouchEnd = function (e) { 1837 this.update_(e); 1838 this.recentTouchMoves_ = []; 1839 }; 1840 1841 function LinearTimingFunction() { 1842 }; 1843 1844 LinearTimingFunction.prototype.scaleTime = function (fraction) { 1845 return fraction; 1846 }; 1847 1848 function CubicBezierTimingFunction(spec) { 1849 this.map = []; 1850 for (var ii = 0; ii <= 100; ii += 1) { 1851 var i = ii / 100; 1852 this.map.push([ 1853 3 * i * (1 - i) * (1 - i) * spec[0] + 1854 3 * i * i * (1 - i) * spec[2] + i * i * i, 1855 3 * i * (1 - i) * (1 - i) * spec[1] + 1856 3 * i * i * (1 - i) * spec[3] + i * i * i 1857 ]); 1858 } 1859 }; 1860 1861 CubicBezierTimingFunction.prototype.scaleTime = function (fraction) { 1862 var fst = 0; 1863 while (fst !== 100 && fraction > this.map[fst][0]) { 1864 fst += 1; 1865 } 1866 if (fraction === this.map[fst][0] || fst === 0) { 1867 return this.map[fst][1]; 1868 } 1869 var yDiff = this.map[fst][1] - this.map[fst - 1][1]; 1870 var xDiff = this.map[fst][0] - this.map[fst - 1][0]; 1871 var p = (fraction - this.map[fst - 1][0]) / xDiff; 1872 return this.map[fst - 1][1] + p * yDiff; 1873 }; 1874 1875 var presetTimingFunctions = { 1876 'linear': new LinearTimingFunction(), 1877 'ease': new CubicBezierTimingFunction([0.25, 0.1, 0.25, 1.0]), 1878 'ease-in': new CubicBezierTimingFunction([0.42, 0, 1.0, 1.0]), 1879 'ease-out': new CubicBezierTimingFunction([0, 0, 0.58, 1.0]), 1880 'ease-in-out': new CubicBezierTimingFunction([0.42, 0, 0.58, 1.0]), 1881 }; 1882 1883 function DrawerController(options) { 1884 this.velocityTracker = new VelocityTracker(); 1885 this.animator = new Animator(this); 1886 1887 this.target = options.target; 1888 this.left = options.left; 1889 this.right = options.right; 1890 this.position = options.position; 1891 1892 this.width = this.right - this.left; 1893 this.curve = presetTimingFunctions[options.curve || 'linear']; 1894 1895 this.willOpenCallback = options.willOpen; 1896 this.didCloseCallback = options.didClose; 1897 this.animateCallback = options.onAnimate; 1898 1899 this.state = DrawerController.kClosed; 1900 1901 this.defaultAnimationSpeed = (this.right - this.left) / DrawerController.kBaseSettleDurationMS; 1902 1903 this.onTouchMove = this.onTouchMove.bind(this); 1904 this.onTouchEnd = this.onTouchEnd.bind(this); 1905 1906 this.target.addEventListener('touchstart', this.onTouchStart.bind(this)); 1907 } 1908 1909 DrawerController.kOpened = 'opened'; 1910 DrawerController.kClosed = 'closed'; 1911 DrawerController.kOpening = 'opening'; 1912 DrawerController.kClosing = 'closing'; 1913 DrawerController.kDragging = 'dragging'; 1914 DrawerController.kFlinging = 'flinging'; 1915 1916 DrawerController.kBaseSettleDurationMS = 246; 1917 DrawerController.kMaxSettleDurationMS = 600; 1918 1919 DrawerController.kMinFlingVelocity = 0.4; // Matches Android framework. 1920 DrawerController.kTouchSlop = 5; // Matches Android framework. 1921 DrawerController.kTouchSlopSquare = DrawerController.kTouchSlop * DrawerController.kTouchSlop; 1922 1923 DrawerController.prototype.restrictToCurrent = function (offset) { 1924 return Math.max(this.left, Math.min(this.position, offset)); 1925 }; 1926 1927 DrawerController.prototype.restrictToBounds = function (offset) { 1928 return Math.max(this.left, Math.min(this.right, offset)); 1929 }; 1930 1931 DrawerController.prototype.onTouchStart = function (e) { 1932 this.velocityTracker.onTouchStart(e); 1933 1934 var touchX = e.changedTouches[0].clientX; 1935 var touchY = e.changedTouches[0].clientY; 1936 1937 if (this.state != DrawerController.kOpened) { 1938 if (touchX != this.restrictToCurrent(touchX)) 1939 return; 1940 this.state = DrawerController.kDragging; 1941 } 1942 1943 this.animator.stopAnimation(); 1944 this.target.addEventListener('touchmove', this.onTouchMove); 1945 this.target.addEventListener('touchend', this.onTouchEnd); 1946 // TODO(abarth): Handle touchcancel. 1947 1948 this.startX = touchX; 1949 this.startY = touchY; 1950 this.startPosition = this.position; 1951 this.touchBaseX = Math.min(touchX, this.startPosition); 1952 }; 1953 1954 DrawerController.prototype.onTouchMove = function (e) { 1955 this.velocityTracker.onTouchMove(e); 1956 1957 if (this.state == DrawerController.kOpened) { 1958 var deltaX = e.changedTouches[0].clientX - this.startX; 1959 var deltaY = e.changedTouches[0].clientY - this.startY; 1960 1961 if (deltaX * deltaX + deltaY * deltaY < DrawerController.kTouchSlopSquare) { 1962 e.preventDefault(); 1963 return; 1964 } 1965 1966 if (Math.abs(deltaY) > Math.abs(deltaX)) { 1967 this.target.removeEventListener('touchmove', this.onTouchMove); 1968 this.target.removeEventListener('touchend', this.onTouchEnd); 1969 return; 1970 } 1971 1972 this.state = DrawerController.kDragging; 1973 } 1974 1975 e.preventDefault(); 1976 var touchDeltaX = e.changedTouches[0].clientX - this.touchBaseX; 1977 this.position = this.restrictToBounds(this.startPosition + touchDeltaX); 1978 this.animator.scheduleAnimation(); 1979 }; 1980 1981 DrawerController.prototype.onTouchEnd = function (e) { 1982 this.velocityTracker.onTouchEnd(e); 1983 this.target.removeEventListener('touchmove', this.onTouchMove); 1984 this.target.removeEventListener('touchend', this.onTouchEnd); 1985 1986 var velocityX = this.velocityTracker.velocityX; 1987 if (Math.abs(velocityX) > DrawerController.kMinFlingVelocity) { 1988 this.fling(velocityX); 1989 } else if (this.isOpen()) { 1990 this.open(); 1991 } else { 1992 this.close(); 1993 } 1994 }; 1995 1996 DrawerController.prototype.openFraction = function () { 1997 var width = this.right - this.left; 1998 var offset = this.position - this.left; 1999 return offset / width; 2000 }; 2001 2002 DrawerController.prototype.isOpen = function () { 2003 return this.openFraction() >= 0.5; 2004 }; 2005 2006 DrawerController.prototype.isOpening = function () { 2007 return this.state == DrawerController.kOpening || 2008 (this.state == DrawerController.kFlinging && this.animationVelocityX > 0); 2009 } 2010 2011 DrawerController.prototype.isClosing = function () { 2012 return this.state == DrawerController.kClosing || 2013 (this.state == DrawerController.kFlinging && this.animationVelocityX < 0); 2014 } 2015 2016 DrawerController.prototype.toggle = function () { 2017 if (this.isOpen()) 2018 this.close(); 2019 else 2020 this.open(); 2021 }; 2022 2023 DrawerController.prototype.open = function () { 2024 if (!this.position) 2025 this.willOpenCallback.call(this.target); 2026 2027 this.animator.stopAnimation(); 2028 this.animationDuration = 400; 2029 this.state = DrawerController.kOpening; 2030 this.animate(); 2031 }; 2032 2033 DrawerController.prototype.close = function () { 2034 this.animator.stopAnimation(); 2035 this.animationDuration = 400; 2036 this.state = DrawerController.kClosing; 2037 this.animate(); 2038 }; 2039 2040 DrawerController.prototype.fling = function (velocityX) { 2041 this.animator.stopAnimation(); 2042 this.animationVelocityX = velocityX; 2043 this.state = DrawerController.kFlinging; 2044 this.animate(); 2045 }; 2046 2047 DrawerController.prototype.animate = function () { 2048 this.positionAnimationBase = this.position; 2049 this.animator.startAnimation(); 2050 }; 2051 2052 DrawerController.prototype.targetPosition = function (deltaT) { 2053 if (this.state == DrawerController.kFlinging) 2054 return this.positionAnimationBase + this.animationVelocityX * deltaT; 2055 var targetFraction = this.curve.scaleTime(deltaT / this.animationDuration); 2056 var animationWidth = this.state == DrawerController.kOpening ? 2057 this.width - this.positionAnimationBase : -this.positionAnimationBase; 2058 return this.positionAnimationBase + targetFraction * animationWidth; 2059 }; 2060 2061 DrawerController.prototype.onAnimation = function (timeStamp) { 2062 if (this.state == DrawerController.kDragging) { 2063 this.animateCallback.call(this.target, this.position); 2064 return false;
2065 } 2066 2067 var deltaT = timeStamp - this.animator.startTimeStamp; 2068 var targetPosition = this.targetPosition(deltaT); 2069 this.position = this.restrictToBounds(targetPosition); 2070 2071 this.animateCallback.call(this.target, this.position); 2072 2073 if (targetPosition <= this.left && this.isClosing()) { 2074 this.state = DrawerController.kClosed; 2075 this.didCloseCallback.call(this.target); 2076 return false; 2077 } 2078 if (targetPosition >= this.right && this.isOpening()) { 2079 this.state = DrawerController.kOpened; 2080 return false; 2081 } 2082 2083 return true; 2084 }; 2085 2086 2087 exports.DrawerController = DrawerController; 2088 2089})(window); 2090
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.