1var googleMapPopUp = new function () { 2 var gMapPopUp = this; 3 this.init = function (settings) { 4 gMapPopUp.locationData = settings.locationData; 5 gMapPopUp.mapsDisplayDomain = settings.mapsDisplayDomain; 6 gMapPopUp.longFreeCustomer = settings.longFreeCustomer; 7 gMapPopUp.language = settings.language; 8 var location = gMapPopUp.locationData.data('location'); 9 gMapPopUp.locationData.on('click', function () { 10 buildPopup('popupRestaurantReservations', '', '', gMapPopUp.mapsDisplayDomain + '/include/globalMapDisplay.php?cad=1&q=' + encodeURIComponent(location) + '&fl=1&l=' + encodeURIComponent(gMapPopUp.language) + '&ilfc=' + encodeURIComponent(gMapPopUp.longFreeCustomer), true, false, true, '', ''); 11 }); 12 }; 13}; 14jQuery(function ($) { 15 AgendaModuleInitialize(); 16}); 17 18function AgendaModuleInitialize() { 19 $(document).on("s123.page.ready", function (event) { 20 var $sections = $('.s123-module-agenda.layout-2'); 21 $sections.each(function (index) { 22 var $s = $(this); 23 var $categories = $s.find('.filter a'); 24 $categories.off('click').on('click', function (event, initialize) { 25 var $category = $(this); 26 var $agenda = $s.find('.agenda-category'); 27 $s.find('.filter li').removeClass('active'); 28 $category.parent().addClass('active'); 29 var $filtered = $agenda.filter('[data-filter=' + $category.data('filter') + ']'); 30 if (initialize) { 31 $agenda.hide(); 32 $filtered.show(); 33 } else { 34 $agenda.fadeOut(200).promise().done(function () { 35 $filtered.fadeIn(200); 36 $(window).trigger('scroll'); 37 }); 38 } 39 return false; 40 }); 41 $categories.first().trigger('click', true); 42 }); 43 }); 44} 45jQuery(function ($) { 46 AgendaModuleInitialize_Layout3(); 47}); 48 49function AgendaModuleInitialize_Layout3() { 50 $(document).on("s123.page.ready", function (event) { 51 var $sections = $('.s123-module-agenda.layout-3'); 52 $sections.each(function (index) { 53 var $s = $(this); 54 var $categories = $s.find('.agenda-categories-container li'); 55 var $agenda = $s.find('.agenda-category'); 56 $categories.off('click').on('click', function (event, initialize) { 57 var $category = $(this); 58 $categories.removeClass('active'); 59 $category.addClass('active'); 60 var $filtered = $agenda.filter('[data-filter=' + $category.data('filter') + ']'); 61 if (initialize) { 62 $agenda.hide(); 63 $filtered.show(); 64 } else { 65 $agenda.fadeOut(200).promise().done(function () { 66 $filtered.fadeIn(200); 67 $(window).trigger('scroll'); 68 }); 69 } 70 return false; 71 }); 72 $categories.first().trigger('click', true); 73 $s.find('.agenda-responsive-filter').off('click').on('click', function () { 74 var $category = $(this); 75 $s.find('.categories-panel').slideToggle('slow'); 76 $category.toggleClass('active'); 77 return false; 78 }); 79 }); 80 }); 81}(function (factory) { 82 if (typeof define === "function" && define.amd) { 83 define(["jquery"], function ($) { 84 factory($, window, document); 85 }); 86 } else if (typeof module === "object" && module.exports) { 87 module.exports = factory(require("jquery"), window, document); 88 } else { 89 factory(jQuery, window, document); 90 } 91})(function ($, window, document, undefined) { 92 "use strict"; 93 var pluginName = "intlTelInput", 94 id = 1, // give each instance it's own id for namespaced event handling 95 defaults = { 96 allowDropdown: true, 97 autoHideDialCode: true, 98 autoPlaceholder: true, 99 customPlaceholder: null, 100 dropdownContainer: "", 101 excludeCountries: [], 102 formatOnInit: true, 103 geoIpLookup: null, 104 initialCountry: "", 105 nationalMode: true, 106 numberType: "MOBILE", 107 onlyCountries: [], 108 preferredCountries: ["us", "gb"], 109 separateDialCode: false, 110 utilsScript: "" 111 }, 112 keys = { 113 UP: 38, 114 DOWN: 40, 115 ENTER: 13, 116 ESC: 27, 117 PLUS: 43, 118 A: 65, 119 Z: 90, 120 SPACE: 32, 121 TAB: 9 122 }; 123 $(window).load(function () { 124 $.fn[pluginName].windowLoaded = true; 125 }); 126 127 function Plugin(element, options) { 128 this.telInput = $(element); 129 this.options = $.extend({}, defaults, options); 130 this.ns = "." + pluginName + id++; 131 this.isGoodBrowser = Boolean(element.setSelectionRange); 132 this.hadInitialPlaceholder = Boolean($(element).attr("placeholder")); 133 } 134 Plugin.prototype = { 135 _init: function () { 136 if (this.options.nationalMode) { 137 this.options.autoHideDialCode = false;
138 } 139 if (this.options.separateDialCode) { 140 this.options.autoHideDialCode = this.options.nationalMode = false; 141 this.options.allowDropdown = true; 142 } 143 this.isMobile = /Android.+Mobile|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 144 if (this.isMobile) { 145 $("body").addClass("iti-mobile"); 146 if (!this.options.dropdownContainer) { 147 this.options.dropdownContainer = "body"; 148 } 149 } 150 this.autoCountryDeferred = new $.Deferred(); 151 this.utilsScriptDeferred = new $.Deferred(); 152 this._processCountryData(); 153 this._generateMarkup(); 154 this._setInitialState(); 155 this._initListeners(); 156 this._initRequests(); 157 return [this.autoCountryDeferred, this.utilsScriptDeferred]; 158 }, 159 _processCountryData: function () { 160 this._processAllCountries(); 161 this._processCountryCodes(); 162 this._processPreferredCountries(); 163 }, 164 _addCountryCode: function (iso2, dialCode, priority) { 165 if (!(dialCode in this.countryCodes)) { 166 this.countryCodes[dialCode] = []; 167 } 168 var index = priority || 0; 169 this.countryCodes[dialCode][index] = iso2; 170 }, 171 _filterCountries: function (countryArray, processFunc) { 172 var i; 173 for (i = 0; i < countryArray.length; i++) { 174 countryArray[i] = countryArray[i].toLowerCase(); 175 } 176 this.countries = []; 177 for (i = 0; i < allCountries.length; i++) { 178 if (processFunc($.inArray(allCountries[i].iso2, countryArray))) { 179 this.countries.push(allCountries[i]); 180 } 181 } 182 }, 183 _processAllCountries: function () { 184 if (this.options.onlyCountries.length) { 185 this._filterCountries(this.options.onlyCountries, function (inArray) { 186 return inArray != -1; 187 }); 188 } else if (this.options.excludeCountries.length) { 189 this._filterCountries(this.options.excludeCountries, function (inArray) { 190 return inArray == -1; 191 }); 192 } else { 193 this.countries = allCountries; 194 } 195 }, 196 _processCountryCodes: function () { 197 this.countryCodes = {}; 198 for (var i = 0; i < this.countries.length; i++) { 199 var c = this.countries[i]; 200 this._addCountryCode(c.iso2, c.dialCode, c.priority); 201 if (c.areaCodes) { 202 for (var j = 0; j < c.areaCodes.length; j++) { 203 this._addCountryCode(c.iso2, c.dialCode + c.areaCodes[j]); 204 } 205 } 206 } 207 }, 208 _processPreferredCountries: function () { 209 this.preferredCountries = []; 210 for (var i = 0; i < this.options.preferredCountries.length; i++) { 211 var countryCode = this.options.preferredCountries[i].toLowerCase(), 212 countryData = this._getCountryData(countryCode, false, true); 213 if (countryData) { 214 this.preferredCountries.push(countryData); 215 } 216 } 217 }, 218 _generateMarkup: function () { 219 this.telInput.attr("autocomplete", "off"); 220 var parentClass = "intl-tel-input"; 221 if (this.options.allowDropdown) { 222 parentClass += " allow-dropdown"; 223 } 224 if (this.options.separateDialCode) { 225 parentClass += " separate-dial-code"; 226 } 227 this.telInput.wrap($("<div>", { 228 "class": parentClass 229 })); 230 this.flagsContainer = $("<div>", { 231 "class": "flag-container" 232 }).insertBefore(this.telInput); 233 var selectedFlag = $("<div>", { 234 "class": "selected-flag" 235 }); 236 selectedFlag.appendTo(this.flagsContainer); 237 this.selectedFlagInner = $("<div>", { 238 "class": "iti-flag" 239 }).appendTo(selectedFlag); 240 if (this.options.separateDialCode) { 241 this.selectedDialCode = $("<div>", { 242 "class": "selected-dial-code" 243 }).appendTo(selectedFlag); 244 } 245 if (this.options.allowDropdown) { 246 selectedFlag.attr("tabindex", "0"); 247 $("<div>", { 248 "class": "iti-arrow" 249 }).appendTo(selectedFlag); 250 this.countryList = $("<ul>", { 251 "class": "country-list hide" 252 }); 253 if (this.preferredCountries.length) { 254 this._appendListItems(this.preferredCountries, "preferred"); 255 $("<li>", { 256 "class": "divider" 257 }).appendTo(this.countryList); 258 } 259 this._appendListItems(this.countries, ""); 260 this.countryListItems = this.countryList.children(".country"); 261 if (this.options.dropdownContainer) { 262 this.dropdown = $("<div>", { 263 "class": "intl-tel-input iti-container" 264 }).append(this.countryList); 265 } else { 266 this.countryList.appendTo(this.flagsContainer); 267 } 268 } else { 269 this.countryListItems = $(); 270 } 271 }, 272 _appendListItems: function (countries, className) { 273 var tmp = ""; 274 for (var i = 0; i < countries.length; i++) { 275 var c = countries[i]; 276 tmp += "<li class='country " + className + "' data-dial-code='" + c.dialCode + "' data-country-code='" + c.iso2 + "'>"; 277 tmp += "<div class='flag-box'><div class='iti-flag " + c.iso2 + "'></div></div>"; 278 tmp += "<span class='country-name'>" + c.name + "</span>"; 279 tmp += "<span class='dial-code'>+" + c.dialCode + "</span>"; 280 tmp += "</li>"; 281 } 282 this.countryList.append(tmp); 283 }, 284 _setInitialState: function () { 285 var val = this.telInput.val(); 286 if (this._getDialCode(val)) { 287 this._updateFlagFromNumber(val, true); 288 } else if (this.options.initialCountry !== "auto") { 289 if (this.options.initialCountry) { 290 this._setFlag(this.options.initialCountry, true); 291 } else { 292 this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2; 293 if (!val) { 294 this._setFlag(this.defaultCountry, true); 295 } 296 } 297 if (!val && !this.options.nationalMode && !this.options.autoHideDialCode && !this.options.separateDialCode) { 298 this.telInput.val("+" + this.selectedCountryData.dialCode); 299 } 300 } 301 if (val) {
302 this._updateValFromNumber(val, this.options.formatOnInit); 303 } 304 }, 305 _initListeners: function () { 306 this._initKeyListeners(); 307 if (this.options.autoHideDialCode) { 308 this._initFocusListeners(); 309 } 310 if (this.options.allowDropdown) { 311 this._initDropdownListeners(); 312 } 313 }, 314 _initDropdownListeners: function () { 315 var that = this; 316 var label = this.telInput.closest("label"); 317 if (label.length) { 318 label.on("click" + this.ns, function (e) { 319 if (that.countryList.hasClass("hide")) { 320 that.telInput.focus(); 321 } else { 322 e.preventDefault(); 323 } 324 }); 325 } 326 var selectedFlag = this.selectedFlagInner.parent(); 327 selectedFlag.on("click" + this.ns, function (e) { 328 if (that.countryList.hasClass("hide") && !that.telInput.prop("disabled") && !that.telInput.prop("readonly")) { 329 that._showDropdown(); 330 } 331 }); 332 this.flagsContainer.on("keydown" + that.ns, function (e) { 333 var isDropdownHidden = that.countryList.hasClass("hide"); 334 if (isDropdownHidden && (e.which == keys.UP || e.which == keys.DOWN || e.which == keys.SPACE || e.which == keys.ENTER)) { 335 e.preventDefault(); 336 e.stopPropagation(); 337 that._showDropdown(); 338 } 339 if (e.which == keys.TAB) { 340 that._closeDropdown(); 341 } 342 }); 343 }, 344 _initRequests: function () { 345 var that = this; 346 if (this.options.utilsScript) { 347 if ($.fn[pluginName].windowLoaded) { 348 $.fn[pluginName].loadUtils(this.options.utilsScript, this.utilsScriptDeferred); 349 } else { 350 $(window).load(function () { 351 $.fn[pluginName].loadUtils(that.options.utilsScript, that.utilsScriptDeferred); 352 }); 353 } 354 } else { 355 this.utilsScriptDeferred.resolve(); 356 } 357 if (this.options.initialCountry === "auto") { 358 this._loadAutoCountry(); 359 } else { 360 this.autoCountryDeferred.resolve(); 361 } 362 }, 363 _loadAutoCountry: function () { 364 var that = this; 365 var cookieAutoCountry = window.Cookies ? Cookies.get("itiAutoCountry") : ""; 366 if (cookieAutoCountry) { 367 $.fn[pluginName].autoCountry = cookieAutoCountry; 368 } 369 if ($.fn[pluginName].autoCountry) { 370 this.handleAutoCountry(); 371 } else if (!$.fn[pluginName].startedLoadingAutoCountry) { 372 $.fn[pluginName].startedLoadingAutoCountry = true; 373 if (typeof this.options.geoIpLookup === "function") { 374 this.options.geoIpLookup(function (countryCode) { 375 $.fn[pluginName].autoCountry = countryCode.toLowerCase(); 376 if (window.Cookies) { 377 Cookies.set("itiAutoCountry", $.fn[pluginName].autoCountry, { 378 path: "/" 379 }); 380 } 381 setTimeout(function () { 382 $(".intl-tel-input input").intlTelInput("handleAutoCountry"); 383 }); 384 }); 385 } 386 } 387 }, 388 _initKeyListeners: function () { 389 var that = this; 390 this.telInput.on("keyup" + this.ns, function () { 391 that._updateFlagFromNumber(that.telInput.val()); 392 }); 393 this.telInput.on("cut" + this.ns + " paste" + this.ns + " keyup" + this.ns, function () { 394 setTimeout(function () { 395 that._updateFlagFromNumber(that.telInput.val()); 396 }); 397 }); 398 }, 399 _cap: function (number) { 400 var max = this.telInput.attr("maxlength"); 401 return max && number.length > max ? number.substr(0, max) : number; 402 }, 403 _initFocusListeners: function () { 404 var that = this; 405 this.telInput.on("mousedown" + this.ns, function (e) { 406 if (!that.telInput.is(":focus") && !that.telInput.val()) { 407 e.preventDefault(); 408 that.telInput.focus(); 409 } 410 }); 411 this.telInput.on("focus" + this.ns, function (e) { 412 if (!that.telInput.val() && !that.telInput.prop("readonly") && that.selectedCountryData.dialCode) { 413 that.telInput.val("+" + that.selectedCountryData.dialCode); 414 that.telInput.one("keypress.plus" + that.ns, function (e) { 415 if (e.which == keys.PLUS) { 416 that.telInput.val(""); 417 } 418 }); 419 setTimeout(function () { 420 var input = that.telInput[0]; 421 if (that.isGoodBrowser) { 422 var len = that.telInput.val().length; 423 input.setSelectionRange(len, len); 424 } 425 }); 426 } 427 }); 428 var form = this.telInput.prop("form"); 429 if (form) { 430 $(form).on("submit" + this.ns, function () { 431 that._removeEmptyDialCode(); 432 }); 433 } 434 this.telInput.on("blur" + this.ns, function () { 435 that._removeEmptyDialCode(); 436 }); 437 }, 438 _removeEmptyDialCode: function () { 439 var value = this.telInput.val(), 440 startsPlus = value.charAt(0) == "+"; 441 if (startsPlus) { 442 var numeric = this._getNumeric(value); 443 if (!numeric || this.selectedCountryData.dialCode == numeric) { 444 this.telInput.val(""); 445 } 446 } 447 this.telInput.off("keypress.plus" + this.ns); 448 }, 449 _getNumeric: function (s) { 450 return s.replace(/\D/g, ""); 451 }, 452 _showDropdown: function () { 453 this._setDropdownPosition(); 454 var activeListItem = this.countryList.children(".active"); 455 if (activeListItem.length) {
456 this._highlightListItem(activeListItem); 457 this._scrollTo(activeListItem); 458 } 459 this._bindDropdownListeners(); 460 this.selectedFlagInner.children(".iti-arrow").addClass("up"); 461 }, 462 _setDropdownPosition: function () { 463 var that = this; 464 if (this.options.dropdownContainer) { 465 this.dropdown.appendTo(this.options.dropdownContainer); 466 } 467 this.dropdownHeight = this.countryList.removeClass("hide").outerHeight(); 468 if (!this.isMobile) { 469 var pos = this.telInput.offset(), 470 inputTop = pos.top, 471 windowTop = $(window).scrollTop(), // dropdownFitsBelow = (dropdownBottom < windowBottom) 472 dropdownFitsBelow = inputTop + this.telInput.outerHeight() + this.dropdownHeight < windowTop + $(window).height(), 473 dropdownFitsAbove = inputTop - this.dropdownHeight > windowTop; 474 this.countryList.toggleClass("dropup", !dropdownFitsBelow && dropdownFitsAbove); 475 if (this.options.dropdownContainer) { 476 var extraTop = !dropdownFitsBelow && dropdownFitsAbove ? 0 : this.telInput.innerHeight(); 477 this.dropdown.css({ 478 top: inputTop + extraTop, 479 left: pos.left 480 }); 481 $(window).on("scroll" + this.ns, function () { 482 that._closeDropdown(); 483 }); 484 } 485 } 486 }, 487 _bindDropdownListeners: function () { 488 var that = this; 489 this.countryList.on("mouseover" + this.ns, ".country", function (e) { 490 that._highlightListItem($(this)); 491 }); 492 this.countryList.on("click" + this.ns, ".country", function (e) { 493 that._selectListItem($(this)); 494 }); 495 var isOpening = true; 496 $("html").on("click" + this.ns, function (e) { 497 if (!isOpening) { 498 that._closeDropdown(); 499 } 500 isOpening = false; 501 }); 502 var query = "", 503 queryTimer = null; 504 $(document).on("keydown" + this.ns, function (e) { 505 e.preventDefault(); 506 if (e.which == keys.UP || e.which == keys.DOWN) { 507 that._handleUpDownKey(e.which); 508 } else if (e.which == keys.ENTER) { 509 that._handleEnterKey(); 510 } else if (e.which == keys.ESC) { 511 that._closeDropdown(); 512 } else if (e.which >= keys.A && e.which <= keys.Z || e.which == keys.SPACE) { 513 if (queryTimer) { 514 clearTimeout(queryTimer); 515 } 516 query += String.fromCharCode(e.which); 517 that._searchForCountry(query); 518 queryTimer = setTimeout(function () { 519 query = ""; 520 }, 1e3); 521 } 522 }); 523 }, 524 _handleUpDownKey: function (key) { 525 var current = this.countryList.children(".highlight").first(); 526 var next = key == keys.UP ? current.prev() : current.next(); 527 if (next.length) { 528 if (next.hasClass("divider")) { 529 next = key == keys.UP ? next.prev() : next.next(); 530 } 531 this._highlightListItem(next); 532 this._scrollTo(next); 533 } 534 }, 535 _handleEnterKey: function () { 536 var currentCountry = this.countryList.children(".highlight").first(); 537 if (currentCountry.length) { 538 this._selectListItem(currentCountry); 539 } 540 }, 541 _searchForCountry: function (query) { 542 for (var i = 0; i < this.countries.length; i++) { 543 if (this._startsWith(this.countries[i].name, query)) { 544 var listItem = this.countryList.children("[data-country-code=" + this.countries[i].iso2 + "]").not(".preferred"); 545 this._highlightListItem(listItem); 546 this._scrollTo(listItem, true); 547 break; 548 } 549 } 550 }, 551 _startsWith: function (a, b) { 552 return a.substr(0, b.length).toUpperCase() == b; 553 },
554 _updateValFromNumber: function (number, doFormat, format) { 555 if (doFormat && window.intlTelInputUtils && this.selectedCountryData) { 556 if (!$.isNumeric(format)) { 557 format = !this.options.separateDialCode && (this.options.nationalMode || number.charAt(0) != "+") ? intlTelInputUtils.numberFormat.NATIONAL : intlTelInputUtils.numberFormat.INTERNATIONAL; 558 } 559 number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format); 560 } 561 number = this._beforeSetNumber(number); 562 this.telInput.val(number); 563 }, 564 _updateFlagFromNumber: function (number, isInit) { 565 if (number && this.options.nationalMode && this.selectedCountryData && this.selectedCountryData.dialCode == "1" && number.charAt(0) != "+") { 566 if (number.charAt(0) != "1") { 567 number = "1" + number; 568 } 569 number = "+" + number; 570 } 571 var dialCode = this._getDialCode(number), 572 countryCode = null; 573 if (dialCode) { 574 var countryCodes = this.countryCodes[this._getNumeric(dialCode)], 575 alreadySelected = this.selectedCountryData && $.inArray(this.selectedCountryData.iso2, countryCodes) != -1; 576 if (!alreadySelected || this._isUnknownNanp(number, dialCode)) { 577 for (var j = 0; j < countryCodes.length; j++) { 578 if (countryCodes[j]) { 579 countryCode = countryCodes[j]; 580 break; 581 } 582 } 583 } 584 } else if (number.charAt(0) == "+" && this._getNumeric(number).length) { 585 countryCode = ""; 586 } else if (!number || number == "+") { 587 countryCode = this.defaultCountry; 588 } 589 if (countryCode !== null) { 590 this._setFlag(countryCode, isInit); 591 } 592 }, 593 _isUnknownNanp: function (number, dialCode) { 594 return dialCode == "+1" && this._getNumeric(number).length >= 4; 595 }, 596 _highlightListItem: function (listItem) { 597 this.countryListItems.removeClass("highlight"); 598 listItem.addClass("highlight"); 599 }, 600 _getCountryData: function (countryCode, ignoreOnlyCountriesOption, allowFail) { 601 var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries; 602 for (var i = 0; i < countryList.length; i++) { 603 if (countryList[i].iso2 == countryCode) { 604 return countryList[i]; 605 } 606 } 607 if (allowFail) { 608 return null; 609 } else { 610 throw new Error("No country data for '" + countryCode + "'"); 611 } 612 }, 613 _setFlag: function (countryCode, isInit) { 614 var prevCountry = this.selectedCountryData && this.selectedCountryData.iso2 ? this.selectedCountryData : {}; 615 this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {}; 616 if (this.selectedCountryData.iso2) { 617 this.defaultCountry = this.selectedCountryData.iso2; 618 } 619 this.selectedFlagInner.attr("class", "iti-flag " + countryCode); 620 var title = countryCode ? this.selectedCountryData.name + ": +" + this.selectedCountryData.dialCode : "Unknown"; 621 this.selectedFlagInner.parent().attr("title", title); 622 if (this.options.separateDialCode) { 623 var dialCode = this.selectedCountryData.dialCode ? "+" + this.selectedCountryData.dialCode : "", 624 parent = this.telInput.parent(); 625 if (prevCountry.dialCode) { 626 parent.removeClass("iti-sdc-" + (prevCountry.dialCode.length + 1)); 627 } 628 if (dialCode) { 629 parent.addClass("iti-sdc-" + dialCode.length); 630 } 631 this.selectedDialCode.text(dialCode); 632 } 633 this._updatePlaceholder(); 634 this.countryListItems.removeClass("active"); 635 if (countryCode) { 636 this.countryListItems.find(".iti-flag." + countryCode).first().closest(".country").addClass("active"); 637 } 638 if (!isInit && prevCountry.iso2 !== countryCode) { 639 this.telInput.trigger("countrychange", this.selectedCountryData); 640 } 641 }, 642 _updatePlaceholder: function () { 643 if (window.intlTelInputUtils && !this.hadInitialPlaceholder && this.options.autoPlaceholder && this.selectedCountryData) { 644 var numberType = intlTelInputUtils.numberType[this.options.numberType], 645 placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, numberType) : ""; 646 placeholder = this._beforeSetNumber(placeholder); 647 if (typeof this.options.customPlaceholder === "function") { 648 placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData); 649 } 650 this.telInput.attr("placeholder", placeholder); 651 } 652 }, 653 _selectListItem: function (listItem) { 654 this._setFlag(listItem.attr("data-country-code")); 655 this._closeDropdown(); 656 this._updateDialCode(listItem.attr("data-dial-code"), true); 657 this.telInput.focus(); 658 if (this.isGoodBrowser) { 659 var len = this.telInput.val().length; 660 this.telInput[0].setSelectionRange(len, len); 661 } 662 }, 663 _closeDropdown: function () { 664 this.countryList.addClass("hide"); 665 this.selectedFlagInner.children(".iti-arrow").removeClass("up"); 666 $(document).off(this.ns); 667 $("html").off(this.ns); 668 this.countryList.off(this.ns); 669 if (this.options.dropdownContainer) { 670 if (!this.isMobile) { 671 $(window).off("scroll" + this.ns); 672 } 673 this.dropdown.detach(); 674 } 675 }, 676 _scrollTo: function (element, middle) { 677 var container = this.countryList, 678 containerHeight = container.height(), 679 containerTop = container.offset().top, 680 containerBottom = containerTop + containerHeight, 681 elementHeight = element.outerHeight(), 682 elementTop = element.offset().top, 683 elementBottom = elementTop + elementHeight, 684 newScrollTop = elementTop - containerTop + container.scrollTop(), 685 middleOffset = containerHeight / 2 - elementHeight / 2;
686 if (elementTop < containerTop) { 687 if (middle) { 688 newScrollTop -= middleOffset; 689 } 690 container.scrollTop(newScrollTop); 691 } else if (elementBottom > containerBottom) { 692 if (middle) { 693 newScrollTop += middleOffset; 694 } 695 var heightDifference = containerHeight - elementHeight; 696 container.scrollTop(newScrollTop - heightDifference); 697 } 698 }, 699 _updateDialCode: function (newDialCode, hasSelectedListItem) { 700 var inputVal = this.telInput.val(), 701 newNumber; 702 newDialCode = "+" + newDialCode; 703 if (inputVal.charAt(0) == "+") { 704 var prevDialCode = this._getDialCode(inputVal); 705 if (prevDialCode) { 706 newNumber = inputVal.replace(prevDialCode, newDialCode); 707 } else { 708 newNumber = newDialCode; 709 } 710 } else if (this.options.nationalMode || this.options.separateDialCode) { 711 return; 712 } else { 713 if (inputVal) { 714 newNumber = newDialCode + inputVal; 715 } else if (hasSelectedListItem || !this.options.autoHideDialCode) { 716 newNumber = newDialCode; 717 } else { 718 return; 719 } 720 } 721 this.telInput.val(newNumber); 722 }, 723 _getDialCode: function (number) { 724 var dialCode = ""; 725 if (number.charAt(0) == "+") { 726 var numericChars = ""; 727 for (var i = 0; i < number.length; i++) { 728 var c = number.charAt(i); 729 if ($.isNumeric(c)) { 730 numericChars += c; 731 if (this.countryCodes[numericChars]) { 732 dialCode = number.substr(0, i + 1); 733 } 734 if (numericChars.length == 4) { 735 break; 736 } 737 } 738 } 739 } 740 return dialCode; 741 }, 742 _getFullNumber: function () { 743 var prefix = this.options.separateDialCode ? "+" + this.selectedCountryData.dialCode : ""; 744 return prefix + this.telInput.val(); 745 }, 746 _beforeSetNumber: function (number) { 747 if (this.options.separateDialCode) { 748 var dialCode = this._getDialCode(number); 749 if (dialCode) { 750 if (this.selectedCountryData.areaCodes !== null) { 751 dialCode = "+" + this.selectedCountryData.dialCode; 752 } 753 var start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length; 754 number = number.substr(start); 755 } 756 } 757 return this._cap(number); 758 }, 759 handleAutoCountry: function () { 760 if (this.options.initialCountry === "auto") { 761 this.defaultCountry = $.fn[pluginName].autoCountry; 762 if (!this.telInput.val()) { 763 this.setCountry(this.defaultCountry); 764 } 765 this.autoCountryDeferred.resolve(); 766 } 767 }, 768 destroy: function () { 769 if (this.allowDropdown) { 770 this._closeDropdown(); 771 this.selectedFlagInner.parent().off(this.ns); 772 this.telInput.closest("label").off(this.ns); 773 } 774 if (this.options.autoHideDialCode) { 775 var form = this.telInput.prop("form"); 776 if (form) { 777 $(form).off(this.ns); 778 } 779 } 780 this.telInput.off(this.ns); 781 var container = this.telInput.parent(); 782 container.before(this.telInput).remove(); 783 }, 784 getExtension: function () { 785 if (window.intlTelInputUtils) { 786 return intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2); 787 } 788 return ""; 789 }, 790 getNumber: function (format) { 791 if (window.intlTelInputUtils) { 792 return intlTelInputUtils.formatNumber(this._getFullNumber(), this.selectedCountryData.iso2, format); 793 } 794 return ""; 795 }, 796 getNumberType: function () { 797 if (window.intlTelInputUtils) { 798 return intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2); 799 } 800 return -99; 801 }, 802 getSelectedCountryData: function () { 803 return this.selectedCountryData || {}; 804 }, 805 getValidationError: function () { 806 if (window.intlTelInputUtils) { 807 return intlTelInputUtils.getValidationError(this._getFullNumber(), this.selectedCountryData.iso2); 808 } 809 return -99; 810 }, 811 isValidNumber: function () { 812 var val = $.trim(this._getFullNumber()), 813 countryCode = this.options.nationalMode ? this.selectedCountryData.iso2 : ""; 814 return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, countryCode) : null; 815 }, 816 setCountry: function (countryCode) { 817 countryCode = countryCode.toLowerCase(); 818 if (!this.selectedFlagInner.hasClass(countryCode)) { 819 this._setFlag(countryCode); 820 this._updateDialCode(this.selectedCountryData.dialCode, false); 821 } 822 }, 823 setNumber: function (number, format) { 824 this._updateFlagFromNumber(number);
825 this._updateValFromNumber(number, $.isNumeric(format), format); 826 }, 827 handleUtils: function () { 828 if (window.intlTelInputUtils) { 829 if (this.telInput.val()) { 830 this._updateValFromNumber(this.telInput.val(), this.options.formatOnInit); 831 } 832 this._updatePlaceholder(); 833 } 834 this.utilsScriptDeferred.resolve(); 835 } 836 }; 837 $.fn[pluginName] = function (options) { 838 var args = arguments; 839 if (options === undefined || typeof options === "object") { 840 var deferreds = []; 841 this.each(function () { 842 if (!$.data(this, "plugin_" + pluginName)) { 843 var instance = new Plugin(this, options); 844 var instanceDeferreds = instance._init(); 845 deferreds.push(instanceDeferreds[0]); 846 deferreds.push(instanceDeferreds[1]); 847 $.data(this, "plugin_" + pluginName, instance); 848 } 849 }); 850 return $.when.apply(null, deferreds); 851 } else if (typeof options === "string" && options[0] !== "_") { 852 var returns; 853 this.each(function () { 854 var instance = $.data(this, "plugin_" + pluginName); 855 if (instance instanceof Plugin && typeof instance[options] === "function") { 856 returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1)); 857 } 858 if (options === "destroy") { 859 $.data(this, "plugin_" + pluginName, null); 860 } 861 }); 862 return returns !== undefined ? returns : this; 863 } 864 }; 865 $.fn[pluginName].getCountryData = function () { 866 return allCountries; 867 }; 868 $.fn[pluginName].loadUtils = function (path, utilsScriptDeferred) { 869 if (!$.fn[pluginName].loadedUtilsScript) { 870 $.fn[pluginName].loadedUtilsScript = true; 871 $.ajax({ 872 url: path, 873 complete: function () { 874 $(".intl-tel-input input").intlTelInput("handleUtils"); 875 }, 876 dataType: "script", 877 cache: true 878 }); 879 } else if (utilsScriptDeferred) { 880 utilsScriptDeferred.resolve(); 881 } 882 }; 883 $.fn[pluginName].version = "8.5.2"; 884 var allCountries = [ 885 ["Afghanistan (â«Ø§ÙØºØ§ÙØ³ØªØ§Ùâ¬â)", "af", "93"], 886 ["Albania (Shqipëri)", "al", "355"], 887 ["Algeria (â«Ø§Ùجزائرâ¬â)", "dz", "213"], 888 ["American Samoa", "as", "1684"], 889 ["Andorra", "ad", "376"], 890 ["Angola", "ao", "244"], 891 ["Anguilla", "ai", "1264"], 892 ["Antigua and Barbuda", "ag", "1268"], 893 ["Argentina", "ar", "54"], 894 ["Armenia (ÕÕ¡ÕµÕ¡Õ½Õ¿Õ¡Õ¶)", "am", "374"], 895 ["Aruba", "aw", "297"], 896 ["Australia", "au", "61", 0], 897 ["Austria (Ãsterreich)", "at", "43"], 898 ["Azerbaijan (AzÉrbaycan)", "az", "994"], 899 ["Bahamas", "bs", "1242"], 900 ["Bahrain (â«Ø§ÙØ¨ØØ±ÙÙâ¬â)", "bh", "973"], 901 ["Bangladesh (বাà¦à¦²à¦¾à¦¦à§à¦¶)", "bd", "880"], 902 ["Barbados", "bb", "1246"], 903 ["Belarus (ÐелаÑÑÑÑ)", "by", "375"], 904 ["Belgium (België)", "be", "32"], 905 ["Belize", "bz", "501"], 906 ["Benin (Bénin)", "bj", "229"], 907 ["Bermuda", "bm", "1441"], 908 ["Bhutan (འà½à¾²à½´à½)", "bt", "975"], 909 ["Bolivia", "bo", "591"], 910 ["Bosnia and Herzegovina (ÐоÑна и ХеÑÑеговина)", "ba", "387"], 911 ["Botswana", "bw", "267"], 912 ["Brazil (Brasil)", "br", "55"], 913 ["British Indian Ocean Territory", "io", "246"], 914 ["British Virgin Islands", "vg", "1284"], 915 ["Brunei", "bn", "673"], 916 ["Bulgaria (ÐÑлгаÑиÑ)", "bg", "359"], 917 ["Burkina Faso", "bf", "226"], 918 ["Burundi (Uburundi)", "bi", "257"], 919 ["Cambodia (ááááá»áá¶)", "kh", "855"], 920 ["Cameroon (Cameroun)", "cm", "237"], 921 ["Canada", "ca", "1", 1, ["204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905"]], 922 ["Cape Verde (Kabu Verdi)", "cv", "238"], 923 ["Caribbean Netherlands", "bq", "599", 1], 924 ["Cayman Islands", "ky", "1345"], 925 ["Central African Republic (République centrafricaine)", "cf", "236"], 926 ["Chad (Tchad)", "td", "235"], 927 ["Chile", "cl", "56"], 928 ["China (ä¸å½)", "cn", "86"], 929 ["Christmas Island", "cx", "61", 2], 930 ["Cocos (Keeling) Islands", "cc", "61", 1], 931 ["Colombia", "co", "57"], 932 ["Comoros (â«Ø¬Ø²Ø± اÙÙ٠رâ¬â)", "km", "269"], 933 ["Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243"], 934 ["Congo (Republic) (Congo-Brazzaville)", "cg", "242"], 935 ["Cook Islands", "ck", "682"], 936 ["Costa Rica", "cr", "506"], 937 ["Côte dâIvoire", "ci", "225"], 938 ["Croatia (Hrvatska)", "hr", "385"], 939 ["Cuba", "cu", "53"], 940 ["Curaçao", "cw", "599", 0], 941 ["Cyprus (ÎÏÏÏοÏ)", "cy", "357"], 942 ["Czech Republic (Äeská republika)", "cz", "420"], 943 ["Denmark (Danmark)", "dk", "45"], 944 ["Djibouti", "dj", "253"], 945 ["Dominica", "dm", "1767"], 946 ["Dominican Republic (República Dominicana)", "do", "1", 2, ["809", "829", "849"]], 947 ["Ecuador", "ec", "593"], 948 ["Egypt (â«Ù صرâ¬â)", "eg", "20"], 949 ["El Salvador", "sv", "503"], 950 ["Equatorial Guinea (Guinea Ecuatorial)", "gq", "240"], 951 ["Eritrea", "er", "291"], 952 ["Estonia (Eesti)", "ee", "372"], 953 ["Ethiopia", "et", "251"], 954 ["Falkland Islands (Islas Malvinas)", "fk", "500"], 955 ["Faroe Islands (Føroyar)", "fo", "298"], 956 ["Fiji", "fj", "679"], 957 ["Finland (Suomi)", "fi", "358", 0], 958 ["France", "fr", "33"], 959 ["French Guiana (Guyane française)", "gf", "594"], 960 ["French Polynesia (Polynésie française)", "pf", "689"], 961 ["Gabon", "ga", "241"], 962 ["Gambia", "gm", "220"], 963 ["Georgia (á¡áá¥áá ááááá)", "ge", "995"], 964 ["Germany (Deutschland)", "de", "49"], 965 ["Ghana (Gaana)", "gh", "233"], 966 ["Gibraltar", "gi", "350"], 967 ["Greece (Îλλάδα)", "gr", "30"],
968 ["Greenland (Kalaallit Nunaat)", "gl", "299"], 969 ["Grenada", "gd", "1473"], 970 ["Guadeloupe", "gp", "590", 0], 971 ["Guam", "gu", "1671"], 972 ["Guatemala", "gt", "502"], 973 ["Guernsey", "gg", "44", 1], 974 ["Guinea (Guinée)", "gn", "224"], 975 ["Guinea-Bissau (Guiné Bissau)", "gw", "245"], 976 ["Guyana", "gy", "592"], 977 ["Haiti", "ht", "509"], 978 ["Honduras", "hn", "504"], 979 ["Hong Kong (馿¸¯)", "hk", "852"], 980 ["Hungary (Magyarország)", "hu", "36"], 981 ["Iceland (Ãsland)", "is", "354"], 982 ["India (à¤à¤¾à¤°à¤¤)", "in", "91"], 983 ["Indonesia", "id", "62"], 984 ["Iran (â«Ø§ÛراÙâ¬â)", "ir", "98"], 985 ["Iraq (â«Ø§ÙعراÙâ¬â)", "iq", "964"], 986 ["Ireland", "ie", "353"], 987 ["Isle of Man", "im", "44", 2], 988 ["Israel (â«×שר××â¬â)", "il", "972"], 989 ["Italy (Italia)", "it", "39", 0], 990 ["Jamaica", "jm", "1876"], 991 ["Japan (æ¥æ¬)", "jp", "81"], 992 ["Jersey", "je", "44", 3], 993 ["Jordan (â«Ø§ÙأردÙâ¬â)", "jo", "962"], 994 ["Kazakhstan (ÐÐ°Ð·Ð°Ñ ÑÑан)", "kz", "7", 1], 995 ["Kenya", "ke", "254"], 996 ["Kiribati", "ki", "686"], 997 ["Kuwait (â«Ø§ÙÙÙÙØªâ¬â)", "kw", "965"], 998 ["Kyrgyzstan (ÐÑÑгÑзÑÑан)", "kg", "996"], 999 ["Laos (ລາວ)", "la", "856"], 1000 ["Latvia (Latvija)", "lv", "371"], 1001 ["Lebanon (â«ÙØ¨ÙØ§Ùâ¬â)", "lb", "961"], 1002 ["Lesotho", "ls", "266"], 1003 ["Liberia", "lr", "231"], 1004 ["Libya (â«ÙÙØ¨Ùاâ¬â)", "ly", "218"], 1005 ["Liechtenstein", "li", "423"], 1006 ["Lithuania (Lietuva)", "lt", "370"], 1007 ["Luxembourg", "lu", "352"], 1008 ["Macau (æ¾³é)", "mo", "853"], 1009 ["Macedonia (FYROM) (ÐакедониÑа)", "mk", "389"], 1010 ["Madagascar (Madagasikara)", "mg", "261"], 1011 ["Malawi", "mw", "265"], 1012 ["Malaysia", "my", "60"], 1013 ["Maldives", "mv", "960"], 1014 ["Mali", "ml", "223"], 1015 ["Malta", "mt", "356"], 1016 ["Marshall Islands", "mh", "692"], 1017 ["Martinique", "mq", "596"], 1018 ["Mauritania (â«Ù ÙØ±ÙتاÙÙØ§â¬â)", "mr", "222"], 1019 ["Mauritius (Moris)", "mu", "230"], 1020 ["Mayotte", "yt", "262", 1], 1021 ["Mexico (México)", "mx", "52"], 1022 ["Micronesia", "fm", "691"], 1023 ["Moldova (Republica Moldova)", "md", "373"], 1024 ["Monaco", "mc", "377"], 1025 ["Mongolia (Ðонгол)", "mn", "976"], 1026 ["Montenegro (Crna Gora)", "me", "382"], 1027 ["Montserrat", "ms", "1664"], 1028 ["Morocco (â«Ø§Ù٠غربâ¬â)", "ma", "212", 0], 1029 ["Mozambique (Moçambique)", "mz", "258"], 1030 ["Myanmar (Burma) (áá¼ááºáá¬)", "mm", "95"], 1031 ["Namibia (Namibië)", "na", "264"], 1032 ["Nauru", "nr", "674"], 1033 ["Nepal (नà¥à¤ªà¤¾à¤²)", "np", "977"], 1034 ["Netherlands (Nederland)", "nl", "31"], 1035 ["New Caledonia (Nouvelle-Calédonie)", "nc", "687"], 1036 ["New Zealand", "nz", "64"], 1037 ["Nicaragua", "ni", "505"], 1038 ["Niger (Nijar)", "ne", "227"], 1039 ["Nigeria", "ng", "234"], 1040 ["Niue", "nu", "683"], 1041 ["Norfolk Island", "nf", "672"], 1042 ["North Korea (ì¡°ì 민주주ì ì¸ë¯¼ ê³µíêµ)", "kp", "850"], 1043 ["Northern Mariana Islands", "mp", "1670"], 1044 ["Norway (Norge)", "no", "47", 0], 1045 ["Oman (â«Ø¹Ù٠اÙâ¬â)", "om", "968"], 1046 ["Pakistan (â«Ù¾Ø§Ú©Ø³ØªØ§Ùâ¬â)", "pk", "92"], 1047 ["Palau", "pw", "680"], 1048 ["Palestine (â«ÙÙØ³Ø·ÙÙâ¬â)", "ps", "970"], 1049 ["Panama (Panamá)", "pa", "507"], 1050 ["Papua New Guinea", "pg", "675"], 1051 ["Paraguay", "py", "595"], 1052 ["Peru (Perú)", "pe", "51"], 1053 ["Philippines", "ph", "63"], 1054 ["Poland (Polska)", "pl", "48"], 1055 ["Portugal", "pt", "351"], 1056 ["Puerto Rico", "pr", "1", 3, ["787", "939"]], 1057 ["Qatar (â«Ùطرâ¬â)", "qa", "974"], 1058 ["Réunion (La Réunion)", "re", "262", 0], 1059 ["Romania (România)", "ro", "40"], 1060 ["Russia (РоÑÑиÑ)", "ru", "7", 0], 1061 ["Rwanda", "rw", "250"], 1062 ["Saint Barthélemy (Saint-Barthélemy)", "bl", "590", 1], 1063 ["Saint Helena", "sh", "290"], 1064 ["Saint Kitts and Nevis", "kn", "1869"], 1065 ["Saint Lucia", "lc", "1758"], 1066 ["Saint Martin (Saint-Martin (partie française))", "mf", "590", 2], 1067 ["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508"], 1068 ["Saint Vincent and the Grenadines", "vc", "1784"], 1069 ["Samoa", "ws", "685"], 1070 ["San Marino", "sm", "378"], 1071 ["São Tomé and PrÃncipe (São Tomé e PrÃncipe)", "st", "239"], 1072 ["Saudi Arabia (â«Ø§ÙÙ Ù ÙÙØ© Ø§ÙØ¹Ø±Ø¨ÙØ© Ø§ÙØ³Ø¹ÙØ¯ÙØ©â¬â)", "sa", "966"], 1073 ["Senegal (Sénégal)", "sn", "221"], 1074 ["Serbia (СÑбиÑа)", "rs", "381"], 1075 ["Seychelles", "sc", "248"],
1076 ["Sierra Leone", "sl", "232"], 1077 ["Singapore", "sg", "65"], 1078 ["Sint Maarten", "sx", "1721"], 1079 ["Slovakia (Slovensko)", "sk", "421"], 1080 ["Slovenia (Slovenija)", "si", "386"], 1081 ["Solomon Islands", "sb", "677"], 1082 ["Somalia (Soomaaliya)", "so", "252"], 1083 ["South Africa", "za", "27"], 1084 ["South Korea (ëí민êµ)", "kr", "82"], 1085 ["South Sudan (â«Ø¬ÙÙØ¨ Ø§ÙØ³ÙداÙâ¬â)", "ss", "211"], 1086 ["Spain (España)", "es", "34"], 1087 ["Sri Lanka (à·à·âර෠ලà¶à¶à·à·)", "lk", "94"], 1088 ["Sudan (â«Ø§ÙØ³ÙØ¯Ø§Ùâ¬â)", "sd", "249"], 1089 ["Suriname", "sr", "597"], 1090 ["Svalbard and Jan Mayen", "sj", "47", 1], 1091 ["Swaziland", "sz", "268"], 1092 ["Sweden (Sverige)", "se", "46"], 1093 ["Switzerland (Schweiz)", "ch", "41"], 1094 ["Syria (â«Ø³ÙØ±ÙØ§â¬â)", "sy", "963"], 1095 ["Taiwan (å°ç£)", "tw", "886"], 1096 ["Tajikistan", "tj", "992"], 1097 ["Tanzania", "tz", "255"], 1098 ["Thailand (à¹à¸à¸¢)", "th", "66"], 1099 ["Timor-Leste", "tl", "670"], 1100 ["Togo", "tg", "228"], 1101 ["Tokelau", "tk", "690"], 1102 ["Tonga", "to", "676"], 1103 ["Trinidad and Tobago", "tt", "1868"], 1104 ["Tunisia (â«ØªÙÙØ³â¬â)", "tn", "216"], 1105 ["Turkey (Türkiye)", "tr", "90"], 1106 ["Turkmenistan", "tm", "993"], 1107 ["Turks and Caicos Islands", "tc", "1649"], 1108 ["Tuvalu", "tv", "688"], 1109 ["U.S. Virgin Islands", "vi", "1340"], 1110 ["Uganda", "ug", "256"], 1111 ["Ukraine (УкÑаÑна)", "ua", "380"], 1112 ["United Arab Emirates (â«Ø§Ùإ٠ارات Ø§ÙØ¹Ø±Ø¨ÙØ© اÙÙ ØªØØ¯Ø©â¬â)", "ae", "971"], 1113 ["United Kingdom", "gb", "44", 0], 1114 ["United States", "us", "1", 0], 1115 ["Uruguay", "uy", "598"], 1116 ["Uzbekistan (OÊ»zbekiston)", "uz", "998"], 1117 ["Vanuatu", "vu", "678"], 1118 ["Vatican City (Città del Vaticano)", "va", "39", 1], 1119 ["Venezuela", "ve", "58"], 1120 ["Vietnam (Viá»t Nam)", "vn", "84"], 1121 ["Wallis and Futuna", "wf", "681"], 1122 ["Western Sahara (â«Ø§ÙØµØØ±Ø§Ø¡ Ø§ÙØºØ±Ø¨ÙØ©â¬â)", "eh", "212", 1], 1123 ["Yemen (â«Ø§ÙÙÙ Ùâ¬â)", "ye", "967"], 1124 ["Zambia", "zm", "260"], 1125 ["Zimbabwe", "zw", "263"], 1126 ["à land Islands", "ax", "358", 1] 1127 ]; 1128 for (var i = 0; i < allCountries.length; i++) { 1129 var c = allCountries[i]; 1130 allCountries[i] = { 1131 name: c[0], 1132 iso2: c[1], 1133 dialCode: c[2], 1134 priority: c[3] || 0, 1135 areaCodes: c[4] || null 1136 }; 1137 } 1138}); 1139! function (t) { 1140 if ("object" == typeof exports && "undefined" != typeof module) module.exports = t(); 1141 else if ("function" == typeof define && define.amd) define([], t); 1142 else { 1143 var e; 1144 e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this, e.Clipboard = t() 1145 } 1146}(function () { 1147 var t, e, n; 1148 return function t(e, n, o) { 1149 function i(c, a) { 1150 if (!n[c]) { 1151 if (!e[c]) { 1152 var s = "function" == typeof require && require; 1153 if (!a && s) return s(c, !0); 1154 if (r) return r(c, !0); 1155 var l = new Error("Cannot find module '" + c + "'"); 1156 throw l.code = "MODULE_NOT_FOUND", l 1157 } 1158 var u = n[c] = { 1159 exports: {} 1160 }; 1161 e[c][0].call(u.exports, function (t) { 1162 var n = e[c][1][t]; 1163 return i(n ? n : t) 1164 }, u, u.exports, t, e, n, o) 1165 } 1166 return n[c].exports 1167 } 1168 for (var r = "function" == typeof require && require, c = 0; c < o.length; c++) i(o[c]); 1169 return i 1170 }({ 1171 1: [function (t, e, n) { 1172 var o = t("matches-selector"); 1173 e.exports = function (t, e, n) { 1174 for (var i = n ? t : t.parentNode; i && i !== document;) { 1175 if (o(i, e)) return i; 1176 i = i.parentNode 1177 } 1178 } 1179 }, { 1180 "matches-selector": 5 1181 }], 1182 2: [function (t, e, n) { 1183 function o(t, e, n, o, r) { 1184 var c = i.apply(this, arguments); 1185 return t.addEventListener(n, c, r), { 1186 destroy: function () { 1187 t.removeEventListener(n, c, r) 1188 } 1189 } 1190 } 1191 1192 function i(t, e, n, o) { 1193 return function (n) { 1194 n.delegateTarget = r(n.target, e, !0), n.delegateTarget && o.call(t, n) 1195 } 1196 } 1197 var r = t("closest"); 1198 e.exports = o 1199 }, { 1200 closest: 1 1201 }], 1202 3: [function (t, e, n) { 1203 n.node = function (t) { 1204 return void 0 !== t && t instanceof HTMLElement && 1 === t.nodeType 1205 }, n.nodeList = function (t) { 1206 var e = Object.prototype.toString.call(t); 1207 return void 0 !== t && ("[object NodeList]" === e || "[object HTMLCollection]" === e) && "length" in t && (0 === t.length || n.node(t[0])) 1208 }, n.string = function (t) { 1209 return "string" == typeof t || t instanceof String 1210 }, n.fn = function (t) { 1211 var e = Object.prototype.toString.call(t); 1212 return "[object Function]" === e 1213 } 1214 }, {}], 1215 4: [function (t, e, n) { 1216 function o(t, e, n) { 1217 if (!t && !e && !n) throw new Error("Missing required arguments"); 1218 if (!a.string(e)) throw new TypeError("Second argument must be a String"); 1219 if (!a.fn(n)) throw new TypeError("Third argument must be a Function"); 1220 if (a.node(t)) return i(t, e, n); 1221 if (a.nodeList(t)) return r(t, e, n);
1222 if (a.string(t)) return c(t, e, n); 1223 throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList") 1224 } 1225 1226 function i(t, e, n) { 1227 return t.addEventListener(e, n), { 1228 destroy: function () { 1229 t.removeEventListener(e, n) 1230 } 1231 } 1232 } 1233 1234 function r(t, e, n) { 1235 return Array.prototype.forEach.call(t, function (t) { 1236 t.addEventListener(e, n) 1237 }), { 1238 destroy: function () { 1239 Array.prototype.forEach.call(t, function (t) { 1240 t.removeEventListener(e, n) 1241 }) 1242 } 1243 } 1244 } 1245 1246 function c(t, e, n) { 1247 return s(document.body, t, e, n) 1248 } 1249 var a = t("./is"), 1250 s = t("delegate"); 1251 e.exports = o 1252 }, { 1253 "./is": 3, 1254 delegate: 2 1255 }], 1256 5: [function (t, e, n) { 1257 function o(t, e) { 1258 if (r) return r.call(t, e); 1259 for (var n = t.parentNode.querySelectorAll(e), o = 0; o < n.length; ++o) 1260 if (n[o] == t) return !0; 1261 return !1 1262 } 1263 var i = Element.prototype, 1264 r = i.matchesSelector || i.webkitMatchesSelector || i.mozMatchesSelector || i.msMatchesSelector || i.oMatchesSelector; 1265 e.exports = o 1266 }, {}], 1267 6: [function (t, e, n) { 1268 function o(t) { 1269 var e; 1270 if ("INPUT" === t.nodeName || "TEXTAREA" === t.nodeName) t.focus(), t.setSelectionRange(0, t.value.length), e = t.value; 1271 else { 1272 t.hasAttribute("contenteditable") && t.focus(); 1273 var n = window.getSelection(), 1274 o = document.createRange(); 1275 o.selectNodeContents(t), n.removeAllRanges(), n.addRange(o), e = n.toString() 1276 } 1277 return e 1278 } 1279 e.exports = o 1280 }, {}], 1281 7: [function (t, e, n) { 1282 function o() {} 1283 o.prototype = { 1284 on: function (t, e, n) { 1285 var o = this.e || (this.e = {}); 1286 return (o[t] || (o[t] = [])).push({ 1287 fn: e, 1288 ctx: n 1289 }), this 1290 }, 1291 once: function (t, e, n) { 1292 function o() { 1293 i.off(t, o), e.apply(n, arguments) 1294 } 1295 var i = this; 1296 return o._ = e, this.on(t, o, n) 1297 }, 1298 emit: function (t) { 1299 var e = [].slice.call(arguments, 1), 1300 n = ((this.e || (this.e = {}))[t] || []).slice(), 1301 o = 0, 1302 i = n.length; 1303 for (o; i > o; o++) n[o].fn.apply(n[o].ctx, e); 1304 return this 1305 }, 1306 off: function (t, e) { 1307 var n = this.e || (this.e = {}), 1308 o = n[t], 1309 i = []; 1310 if (o && e) 1311 for (var r = 0, c = o.length; c > r; r++) o[r].fn !== e && o[r].fn._ !== e && i.push(o[r]); 1312 return i.length ? n[t] = i : delete n[t], this 1313 } 1314 }, e.exports = o 1315 }, {}], 1316 8: [function (e, n, o) { 1317 ! function (i, r) { 1318 if ("function" == typeof t && t.amd) t(["module", "select"], r); 1319 else if ("undefined" != typeof o) r(n, e("select")); 1320 else { 1321 var c = { 1322 exports: {} 1323 }; 1324 r(c, i.select), i.clipboardAction = c.exports 1325 } 1326 }(this, function (t, e) { 1327 "use strict"; 1328 1329 function n(t) { 1330 return t && t.__esModule ? t : { 1331 "default": t 1332 } 1333 } 1334 1335 function o(t, e) { 1336 if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") 1337 } 1338 var i = n(e), 1339 r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { 1340 return typeof t 1341 } : function (t) { 1342 return t && "function" == typeof Symbol && t.constructor === Symbol ? "symbol" : typeof t 1343 }, 1344 c = function () { 1345 function t(t, e) { 1346 for (var n = 0; n < e.length; n++) { 1347 var o = e[n]; 1348 o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(t, o.key, o) 1349 } 1350 } 1351 return function (e, n, o) { 1352 return n && t(e.prototype, n), o && t(e, o), e 1353 } 1354 }(), 1355 a = function () { 1356 function t(e) { 1357 o(this, t), this.resolveOptions(e), this.initSelection() 1358 } 1359 return t.prototype.resolveOptions = function t() { 1360 var e = arguments.length <= 0 || void 0 === arguments[0] ? {}
1360 : arguments[0]; 1361 this.action = e.action, this.emitter = e.emitter, this.target = e.target, this.text = e.text, this.trigger = e.trigger, this.selectedText = "" 1362 }, t.prototype.initSelection = function t() { 1363 this.text ? this.selectFake() : this.target && this.selectTarget() 1364 }, t.prototype.selectFake = function t() { 1365 var e = this, 1366 n = "rtl" == document.documentElement.getAttribute("dir"); 1367 this.removeFake(), this.fakeHandler = document.body.addEventListener("click", function () { 1368 return e.removeFake() 1369 }), this.fakeElem = document.createElement("textarea"), this.fakeElem.style.fontSize = "12pt", this.fakeElem.style.border = "0", this.fakeElem.style.padding = "0", this.fakeElem.style.margin = "0", this.fakeElem.style.position = "fixed", this.fakeElem.style[n ? "right" : "left"] = "-9999px", this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + "px", this.fakeElem.setAttribute("readonly", ""), this.fakeElem.value = this.text, document.body.appendChild(this.fakeElem), this.selectedText = (0, i.default)(this.fakeElem), this.copyText() 1370 }, t.prototype.removeFake = function t() { 1371 this.fakeHandler && (document.body.removeEventListener("click"), this.fakeHandler = null), this.fakeElem && (document.body.removeChild(this.fakeElem), this.fakeElem = null) 1372 }, t.prototype.selectTarget = function t() { 1373 this.selectedText = (0, i.default)(this.target), this.copyText() 1374 }, t.prototype.copyText = function t() { 1375 var e = void 0; 1376 try { 1377 e = document.execCommand(this.action) 1378 } catch (n) { 1379 e = !1 1380 } 1381 this.handleResult(e) 1382 }, t.prototype.handleResult = function t(e) { 1383 e ? this.emitter.emit("success", { 1384 action: this.action, 1385 text: this.selectedText, 1386 trigger: this.trigger, 1387 clearSelection: this.clearSelection.bind(this) 1388 }) : this.emitter.emit("error", { 1389 action: this.action, 1390 trigger: this.trigger, 1391 clearSelection: this.clearSelection.bind(this) 1392 }) 1393 }, t.prototype.clearSelection = function t() { 1394 this.target && this.target.blur(), window.getSelection().removeAllRanges() 1395 }, t.prototype.destroy = function t() { 1396 this.removeFake() 1397 }, c(t, [{ 1398 key: "action", 1399 set: function t() { 1400 var e = arguments.length <= 0 || void 0 === arguments[0] ? "copy" : arguments[0]; 1401 if (this._action = e, "copy" !== this._action && "cut" !== this._action) throw new Error('Invalid "action" value, use either "copy" or "cut"') 1402 }, 1403 get: function t() { 1404 return this._action 1405 } 1406 }, { 1407 key: "target", 1408 set: function t(e) { 1409 if (void 0 !== e) { 1410 if (!e || "object" !== ("undefined" == typeof e ? "undefined" : r(e)) || 1 !== e.nodeType) throw new Error('Invalid "target" value, use a valid Element'); 1411 if ("copy" === this.action && e.hasAttribute("disabled")) throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); 1412 if ("cut" === this.action && (e.hasAttribute("readonly") || e.hasAttribute("disabled"))) throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); 1413 this._target = e 1414 } 1415 }, 1416 get: function t() { 1417 return this._target 1418 } 1419 }]), t 1420 }(); 1421 t.exports = a 1422 }) 1423 }, { 1424 select: 6 1425 }], 1426 9: [function (e, n, o) { 1427 ! function (i, r) { 1428 if ("function" == typeof t && t.amd) t(["module", "./clipboard-action", "tiny-emitter", "good-l
1428istener"], r); 1429 else if ("undefined" != typeof o) r(n, e("./clipboard-action"), e("tiny-emitter"), e("good-listener")); 1430 else { 1431 var c = { 1432 exports: {} 1433 }; 1434 r(c, i.clipboardAction, i.tinyEmitter, i.goodListener), i.clipboard = c.exports 1435 } 1436 }(this, function (t, e, n, o) { 1437 "use strict"; 1438 1439 function i(t) { 1440 return t && t.__esModule ? t : { 1441 "default": t 1442 } 1443 } 1444 1445 function r(t, e) { 1446 if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") 1447 } 1448 1449 function c(t, e) { 1450 if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 1451 return !e || "object" != typeof e && "function" != typeof e ? t : e 1452 } 1453 1454 function a(t, e) { 1455 if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e); 1456 t.prototype = Object.create(e && e.prototype, { 1457 constructor: { 1458 value: t, 1459 enumerable: !1, 1460 writable: !0, 1461 configurable: !0 1462 } 1463 }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e) 1464 } 1465 1466 function s(t, e) { 1467 var n = "data-clipboard-" + t; 1468 if (e.hasAttribute(n)) return e.getAttribute(n) 1469 } 1470 var l = i(e), 1471 u = i(n), 1472 f = i(o), 1473 d = function (t) { 1474 function e(n, o) { 1475 r(this, e); 1476 var i = c(this, t.call(this)); 1477 return i.resolveOptions(o), i.listenClick(n), i 1478 } 1479 return a(e, t), e.prototype.resolveOptions = function t() { 1480 var e = arguments.length <= 0 || void 0 === arguments[0] ? {} : arguments[0]; 1481 this.action = "function" == typeof e.action ? e.action : this.defaultAction, this.target = "function" == typeof e.target ? e.target : this.defaultTarget, this.text = "function" == typeof e.text ? e.text : this.defaultText 1482 }, e.prototype.listenClick = function t(e) { 1483 var n = this; 1484 this.listener = (0, f.default)(e, "click", function (t) { 1485 return n.onClick(t) 1486 }) 1487 }, e.prototype.onClick = function t(e) { 1488 var n = e.delegateTarget || e.currentTarget; 1489 this.clipboardAction && (this.clipboardAction = null), this.clipboardAction = new l.default({ 1490 action: this.action(n), 1491 target: this.target(n), 1492 text: this.text(n), 1493 trigger: n, 1494 emitter: this 1495 }) 1496 }, e.prototype.defaultAction = function t(e) { 1497 return s("action", e) 1498 }, e.prototype.defaultTarget = function t(e) { 1499 var n = s("target", e); 1500 return n ? document.querySelector(n) : void 0 1501 }, e.prototype.defaultText = function t(e) { 1502 return s("text", e) 1503 }, e.prototype.destroy = function t() { 1504 this.listener.destroy(), this.clipboardAction && (this.clipboardAction.destroy(), this.clipboardAction = null) 1505 }, e 1506 }(u.default); 1507 t.exports = d 1508 }) 1509 }, { 1510 "./clipboard-action": 8,
1511 "good-listener": 4, 1512 "tiny-emitter": 7 1513 }] 1514 }, {}, [9])(9) 1515}); 1516(function (factory) { 1517 if (typeof define === 'function' && define.amd) { 1518 define(['jquery'], factory); 1519 } else if (typeof exports === 'object') { 1520 module.exports = factory(require('jquery')); 1521 } else { 1522 factory(jQuery); 1523 } 1524}(function ($) { 1525 var pluses = /\+/g; 1526 1527 function encode(s) { 1528 return config.raw ? s : encodeURIComponent(s); 1529 } 1530 1531 function decode(s) { 1532 return config.raw ? s : decodeURIComponent(s); 1533 } 1534 1535 function stringifyCookieValue(value) { 1536 return encode(config.json ? JSON.stringify(value) : String(value)); 1537 } 1538 1539 function parseCookieValue(s) { 1540 if (s.indexOf('"') === 0) { 1541 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 1542 } 1543 try { 1544 s = decodeURIComponent(s.replace(pluses, ' ')); 1545 return config.json ? JSON.parse(s) : s; 1546 } catch (e) {} 1547 } 1548 1549 function read(s, converter) { 1550 var value = config.raw ? s : parseCookieValue(s); 1551 return $.isFunction(converter) ? converter(value) : value; 1552 } 1553 var config = $.cookie = function (key, value, options) { 1554 if (arguments.length > 1 && !$.isFunction(value)) { 1555 options = $.extend({}, config.defaults, options); 1556 if (typeof options.expires === 'number') { 1557 var days = options.expires, 1558 t = options.expires = new Date(); 1559 t.setMilliseconds(t.getMilliseconds() + days * 864e+5); 1560 } 1561 return (document.cookie = [encode(key), '=', stringifyCookieValue(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 1562 options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : '' 1563 ].join('')); 1564 } 1565 var result = key ? undefined : {}, 1566 cookies = document.cookie ? document.cookie.split('; ') : [], 1567 i = 0, 1568 l = cookies.length; 1569 for (; i < l; i++) { 1570 var parts = cookies[i].split('='), 1571 name = decode(parts.shift()), 1572 cookie = parts.join('='); 1573 if (key === name) { 1574 result = read(cookie, value); 1575 break; 1576 } 1577 if (!key && (cookie = read(cookie)) !== undefined) { 1578 result[name] = cookie; 1579 } 1580 } 1581 return result; 1582 }; 1583 config.defaults = {}; 1584 $.removeCookie = function (key, options) { 1585 $.cookie(key, '', $.extend({}, options, { 1586 expires: -1 1587 })); 1588 return !$.cookie(key); 1589 }; 1590})); 1591! function (i) { 1592 "use strict"; 1593 "function" == typeof define && define.amd ? define(["jquery"], i) : "undefined" != typeof exports ? module.exports = i(require("jquery")) : i(jQuery) 1594}(function (i) { 1595 "use strict"; 1596 var e = window.Slick || {}; 1597 (e = function () { 1598 var e = 0; 1599 return function (t, o) { 1600 var s, n = this; 1601 n.defaults = { 1602 accessibility: !0, 1603 adaptiveHeight: !1, 1604 appendArrows: i(t), 1605 appendDots: i(t), 1606 arrows: !0, 1607 asNavFor: null, 1608 prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', 1609 nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>', 1610 autoplay: !1, 1611 autoplaySpeed: 3e3, 1612 centerMode: !1, 1613 centerPadding: "50px", 1614 cssEase: "ease", 1615 customPaging: function (e, t) { 1616 return i('<button type="button" />').text(t + 1) 1617 }, 1618 dots: !1, 1619 dotsClass: "slick-dots", 1620 draggable: !0, 1621 easing: "linear", 1622 edgeFriction: .35, 1623 fade: !1, 1624 focusOnSelect: !1, 1625 focusOnChange: !1, 1626 infinite: !0, 1627 initialSlide: 0, 1628 lazyLoad: "ondemand", 1629 mobileFirst: !1, 1630 pauseOnHover: !0, 1631 pauseOnFocus: !0, 1632 pauseOnDotsHover: !1, 1633 respondTo: "window", 1634 responsive: null, 1635 rows: 1, 1636 rtl: !1, 1637 slide: "", 1638 slidesPerRow: 1, 1639 slidesToShow: 1, 1640 slidesToScroll: 1, 1641 speed: 500, 1642 swipe: !0, 1643 swipeToSlide: !1, 1644 touchMove: !0, 1645 touchThreshold: 5, 1646 useCSS: !0, 1647 useTransform: !0, 1648 variableWidth: !1, 1649 vertical: !1, 1650 verticalSwiping: !1, 1651 waitForAnimate: !0, 1652 zIndex: 1e3 1653 }, n.initials = { 1654 animating: !1, 1655 dragging: !1, 1656 autoPlayTimer: null, 1657 currentDirection: 0, 1658 currentLeft: null, 1659 currentSlide: 0, 1660 direction: 1, 1661 $dots: null, 1662 listWidth: null, 1663 listHeight: null, 1664 loadIndex: 0, 1665 $nextArrow: null, 1666 $prevArrow: null, 1667 scrolling: !1, 1668 slideCount: null, 1669 slideWidth: null, 1670 $slideTrack: null, 1671 $slides: null, 1672 sliding: !1, 1673 slideOffset: 0, 1674 swipeLeft: null, 1675 swiping: !1, 1676 $list: null, 1677 touchObject: {}, 1678 transformsEnabled: !1, 1679 unslicked: !1 1680 }, i.extend(n, n.initials), n.activeBreakpoint = null, n.animType = null, n.animProp = null, n.breakpoints = [], n.breakpointSettings = [], n.cssTransitions = !1, n.focussed = !1, n.interrupted = !1, n.hidden = "hidden", n.paused = !0, n.positionProp = null, n.respondTo = null, n.rowCount = 1, n.shouldClick = !0, n.$slider = i(t), n.$slidesCache = null, n.transformType = null, n.transitionType = null, n.visibilityChange = "visibilitychange", n.windowWidth = 0, n.windowTimer = null, s = i(t).data("slick") || {}, n.options = i.extend({}, n.defaults, o, s), n.currentSlide = n.options.initialSlide, n.originalSettings = n.options, void 0 !== document.mozHidden ? (n.hidden = "mozHidden", n.visibilityChange = "mozvisibilitychange") : void 0 !== document.webkitHidden && (n.hidden = "webkitHidden", n.visibilityChange = "webkitvisibilitychange"), n.autoPlay = i.proxy(n.autoPlay, n), n.autoPlayClear = i.proxy(n.autoPlayClear, n), n.autoPlayIterator = i.proxy(n.autoPlayIterator, n), n.changeSlide = i.proxy(n.changeSlide, n), n.clickHandler = i.proxy(n.clickHandler, n), n.selectHandler = i.proxy(n.selectHandler, n), n.setPosition = i.proxy(n.setPosition, n), n.swipeHandler = i.proxy(n.swipeHandler, n), n.dragHandler = i.proxy(n.dragHandler, n), n.keyHandler = i.proxy(n.keyHandler, n), n.instanceUid = e++, n.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/, n.registerBreakpoints(), n.init(!0) 1681 } 1682 }()).prototype.activateADA = function () { 1683 this.$slideTrack.find(".slick-active").attr({ 1684 "aria-hidden": "false" 1685 }).find("a, input, button, select").attr({ 1686 tabindex: "0" 1687 }) 1688 }, e.prototype.addSlide = e.prototype.slickAdd = function (e, t, o) { 1689 var s = this; 1690 if ("boolean" == typeof t) o = t, t = null; 1691 else if (t < 0 || t >= s.slideCount) return !1; 1692 s.unload(), "number" == typeof t ? 0 === t && 0 === s.$slides.length ? i(e).appendTo(s.$slideTrack) : o ? i(e).insertBefore(s.$slides.eq(t)) : i(e).insertAfter(s.$slides.eq(t)) : !0 === o ? i(e).prependTo(s.$slideTrack) : i(e).appendTo(s.$slideTrack), s.$slides = s.$slideTrack.children(this.options.slide), s.$slideTrack.children(this.options.slide).detach(), s.$slideTrack.append(s.$slides), s.$slides.each(function (e, t) { 1693 i(t).attr("data-slick-index", e) 1694 }), s.$slidesCache = s.$slides, s.reinit() 1695 }, e.prototype.animateHeight = function () { 1696 var i = this; 1697 if (1 === i.options.slidesToShow && !0 === i.options.adaptiveHeight && !1 === i.options.vertical) { 1698 var e = i.$slides.eq(i.currentSlide).outerHeight(!0); 1699 i.$list.animate({ 1700 height: e 1701 }, i.options.speed) 1702 } 1703 }, e.prototype.animateSlide = function (e, t) { 1704 var o = {}, 1705 s = this; 1706 s.animateHeight(), !0 === s.options.rtl && !1 === s.options.vertical && (e = -e), !1 === s.transformsEnabled ? !1 === s.options.vertical ? s.$slideTrack.animate({ 1707 left: e 1708 }, s.options.speed, s.options.easing, t) : s.$slideTrack.animate({ 1709 top: e 1710 }, s.options.speed, s.options.easing, t) : !1 === s.cssTransitions ? (!0 === s.options.rtl && (s.currentLeft = -s.currentLeft), i({ 1711 animStart: s.currentLeft 1712 }).animate({ 1713 animStart: e
vendor: 6,406 bytes, lines 1714-1795
1714 }, { 1715 duration: s.options.speed, 1716 easing: s.options.easing, 1717 step: function (i) { 1718 i = Math.ceil(i), !1 === s.options.vertical ? (o[s.animType] = "translate(" + i + "px, 0px)", s.$slideTrack.css(o)) : (o[s.animType] = "translate(0px," + i + "px)", s.$slideTrack.css(o)) 1719 }, 1720 complete: function () { 1721 t && t.call() 1722 } 1723 })) : (s.applyTransition(), e = Math.ceil(e), !1 === s.options.vertical ? o[s.animType] = "translate3d(" + e + "px, 0px, 0px)" : o[s.animType] = "translate3d(0px," + e + "px, 0px)", s.$slideTrack.css(o), t && setTimeout(function () { 1724 s.disableTransition(), t.call() 1725 }, s.options.speed)) 1726 }, e.prototype.getNavTarget = function () { 1727 var e = this, 1728 t = e.options.asNavFor; 1729 return t && null !== t && (t = i(t).not(e.$slider)), t 1730 }, e.prototype.asNavFor = function (e) { 1731 var t = this.getNavTarget(); 1732 null !== t && "object" == typeof t && t.each(function () { 1733 var t = i(this).slick("getSlick"); 1734 t.unslicked || t.slideHandler(e, !0) 1735 }) 1736 }, e.prototype.applyTransition = function (i) { 1737 var e = this, 1738 t = {}; 1739 !1 === e.options.fade ? t[e.transitionType] = e.transformType + " " + e.options.speed + "ms " + e.options.cssEase : t[e.transitionType] = "opacity " + e.options.speed + "ms " + e.options.cssEase, !1 === e.options.fade ? e.$slideTrack.css(t) : e.$slides.eq(i).css(t) 1740 }, e.prototype.autoPlay = function () { 1741 var i = this; 1742 i.autoPlayClear(), i.slideCount > i.options.slidesToShow && (i.autoPlayTimer = setInterval(i.autoPlayIterator, i.options.autoplaySpeed)) 1743 }, e.prototype.autoPlayClear = function () { 1744 var i = this; 1745 i.autoPlayTimer && clearInterval(i.autoPlayTimer) 1746 }, e.prototype.autoPlayIterator = function () { 1747 var i = this, 1748 e = i.currentSlide + i.options.slidesToScroll; 1749 i.paused || i.interrupted || i.focussed || (!1 === i.options.infinite && (1 === i.direction && i.currentSlide + 1 === i.slideCount - 1 ? i.direction = 0 : 0 === i.direction && (e = i.currentSlide - i.options.slidesToScroll, i.currentSlide - 1 == 0 && (i.direction = 1))), i.slideHandler(e)) 1750 }, e.prototype.buildArrows = function () { 1751 var e = this; 1752 !0 === e.options.arrows && (e.$prevArrow = i(e.options.prevArrow).addClass("slick-arrow"), e.$nextArrow = i(e.options.nextArrow).addClass("slick-arrow"), e.slideCount > e.options.slidesToShow ? (e.$prevArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"), e.$nextArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"), e.htmlExpr.test(e.options.prevArrow) && e.$prevArrow.prependTo(e.options.appendArrows), e.htmlExpr.test(e.options.nextArrow) && e.$nextArrow.appendTo(e.options.appendArrows), !0 !== e.options.infinite && e.$prevArrow.addClass("slick-disabled").attr("aria-disabled", "true")) : e.$prevArrow.add(e.$nextArrow).addClass("slick-hidden").attr({ 1753 "aria-disabled": "true", 1754 tabindex: "-1" 1755 })) 1756 }, e.prototype.buildDots = function () { 1757 var e, t, o = this; 1758 if (!0 === o.options.dots) { 1759 for (o.$slider.addClass("slick-dotted"), t = i("<ul />").addClass(o.options.dotsClass), e = 0; e <= o.getDotCount(); e += 1) t.append(i("<li />").append(o.options.customPaging.call(this, o, e))); 1760 o.$dots = t.appendTo(o.options.appendDots), o.$dots.find("li").first().addClass("slick-active") 1761 } 1762 }, e.prototype.buildOut = function () { 1763 var e = this; 1764 e.$slides = e.$slider.children(e.options.slide + ":not(.slick-cloned)").addClass("slick-slide"), e.slideCount = e.$slides.length, e.$slides.each(function (e, t) { 1765 i(t).attr("data-slick-index", e).data("originalStyling", i(t).attr("style") || "") 1766 }), e.$slider.addClass("slick-slider"), e.$slideTrack = 0 === e.slideCount ? i('<div class="slick-track"/>').appendTo(e.$slider) : e.$slides.wrapAll('<div class="slick-track"/>').parent(), e.$list = e.$slideTrack.wrap('<div class="slick-list"/>').parent(), e.$slideTrack.css("opacity", 0), !0 !== e.options.centerMode && !0 !== e.options.swipeToSlide || (e.options.slidesToScroll = 1), i("img[data-lazy]", e.$slider).not("[src]").addClass("slick-loading"), e.setupInfinite(), e.buildArrows(), e.buildDots(), e.updateDots(), e.setSlideClasses("number" == typeof e.currentSlide ? e.currentSlide : 0), !0 === e.options.draggable && e.$list.addClass("draggable") 1767 }, e.prototype.buildRows = function () { 1768 var i, e, t, o, s, n, r, l = this; 1769 if (o = document.createDocumentFragment(), n = l.$slider.children(), l.options.rows > 1) { 1770 for (r = l.options.slidesPerRow * l.options.rows, s = Math.ceil(n.length / r), i = 0; i < s; i++) { 1771 var d = document.createElement("div"); 1772 for (e = 0; e < l.options.rows; e++) { 1773 var a = document.createElement("div"); 1774 for (t = 0; t < l.options.slidesPerRow; t++) { 1775 var c = i * r + (e * l.options.slidesPerRow + t); 1776 n.get(c) && a.appendChild(n.get(c)) 1777 } 1778 d.appendChild(a) 1779 } 1780 o.appendChild(d) 1781 } 1782 l.$slider.empty().append(o), l.$slider.children().children().children().css({ 1783 width: 100 / l.options.slidesPerRow + "%", 1784 display: "inline-block" 1785 }) 1786 } 1787 }, e.prototype.checkResponsive = function (e, t) { 1788 var o, s, n, r = this, 1789 l = !1, 1790 d = r.$slider.width(), 1791 a = window.innerWidth || i(window).width(); 1792 if ("window" === r.respondTo ? n = a : "slider" === r.respondTo ? n = d : "min" === r.respondTo && (n = Math.min(a, d)), r.options.responsive && r.options.responsive.length && null !== r.options.responsive) { 1793 s = null; 1794 for (o in r.breakpoints) r.breakpoints.hasOwnProperty(o) && (!1 === r.originalSettings.mobileFirst ? n < r.breakpoints[o] && (s = r.breakpoints[o]) : n > r.breakpoints[o] && (s = r.breakpoints[o])); 1795 null !== s ? null !== r.activeBreakpoint ? (s !== r.activeBreakpoint || t) && (r.activeBreakpoint = s, "unslick" === r.breakpointSettings[s] ? r.unslick(s) : (r.o
1795ptions = i.extend({}, r.originalSettings, r.breakpointSettings[s]), !0 === e && (r.currentSlide = r.options.initialSlide), r.refresh(e)), l = s) : (r.activeBreakpoint = s, "unslick" === r.breakpointSettings[s] ? r.unslick(s) : (r.options = i.extend({}, r.originalSettings, r.breakpointSettings[s]), !0 === e && (r.currentSlide = r.options.initialSlide), r.refresh(e)), l = s) : null !== r.activeBreakpoint && (r.activeBreakpoint = null, r.options = r.originalSettings, !0 === e && (r.currentSlide = r.options.initialSlide), r.refresh(e), l = s), e || !1 === l || r.$slider.trigger("breakpoint", [r, l]) 1796 } 1797 }, e.prototype.changeSlide = function (e, t) { 1798 var o, s, n, r = this, 1799 l = i(e.currentTarget); 1800 switch (l.is("a") && e.preventDefault(), l.is("li") || (l = l.closest("li")), n = r.slideCount % r.options.slidesToScroll != 0, o = n ? 0 : (r.slideCount - r.currentSlide) % r.options.slidesToScroll, e.data.message) { 1801 case "previous": 1802 s = 0 === o ? r.options.slidesToScroll : r.options.slidesToShow - o, r.slideCount > r.options.slidesToShow && r.slideHandler(r.currentSlide - s, !1, t); 1803 break; 1804 case "next": 1805 s = 0 === o ? r.options.slidesToScroll : o, r.slideCount > r.options.slidesToShow && r.slideHandler(r.currentSlide + s, !1, t); 1806 break; 1807 case "index": 1808 var d = 0 === e.data.index ? 0 : e.data.index || l.index() * r.options.slidesToScroll; 1809 r.slideHandler(r.checkNavigable(d), !1, t), l.children().trigger("focus"); 1810 break; 1811 default: 1812 return 1813 } 1814 }, e.prototype.checkNavigable = function (i) { 1815 var e, t; 1816 if (e = this.getNavigableIndexes(), t = 0, i > e[e.length - 1]) i = e[e.length - 1]; 1817 else 1818 for (var o in e) { 1819 if (i < e[o]) { 1820 i = t; 1821 break 1822 } 1823 t = e[o] 1824 } 1825 return i 1826 }, e.prototype.cleanUpEvents = function () { 1827 var e = this; 1828 e.options.dots && null !== e.$dots && (i("li", e.$dots).off("click.slick", e.changeSlide).off("mouseenter.slick", i.proxy(e.interrupt, e, !0)).off("mouseleave.slick", i.proxy(e.interrupt, e, !1)), !0 === e.options.accessibility && e.$dots.off("keydown.slick", e.keyHandler)), e.$slider.off("focus.slick blur.slick"), !0 === e.options.arrows && e.slideCount > e.options.slidesToShow && (e.$prevArrow && e.$prevArrow.off("click.slick", e.changeSlide), e.$nextArrow && e.$nextArrow.off("click.slick", e.changeSlide), !0 === e.options.accessibility && (e.$prevArrow && e.$prevArrow.off("keydown.slick", e.keyHandler), e.$nextArrow && e.$nextArrow.off("keydown.slick", e.keyHandler))), e.$list.off("touchstart.slick mousedown.slick", e.swipeHandler), e.$list.off("touchmove.slick mousemove.slick", e.swipeHandler), e.$list.off("touchend.slick mouseup.slick", e.swipeHandler), e.$list.off("touchcancel.slick mouseleave.
1828slick", e.swipeHandler), e.$list.off("click.slick", e.clickHandler), i(document).off(e.visibilityChange, e.visibility), e.cleanUpSlideEvents(), !0 === e.options.accessibility && e.$list.off("keydown.slick", e.keyHandler), !0 === e.options.focusOnSelect && i(e.$slideTrack).children().off("click.slick", e.selectHandler), i(window).off("orientationchange.slick.slick-" + e.instanceUid, e.orientationChange), i(window).off("resize.slick.slick-" + e.instanceUid, e.resize), i("[draggable!=true]", e.$slideTrack).off("dragstart", e.preventDefault), i(window).off("load.slick.slick-" + e.instanceUid, e.setPosition) 1829 }, e.prototype.cleanUpSlideEvents = function () { 1830 var e = this; 1831 e.$list.off("mouseenter.slick", i.proxy(e.interrupt, e, !0)), e.$list.off("mouseleave.slick", i.proxy(e.interrupt, e, !1)) 1832 }, e.prototype.cleanUpRows = function () { 1833 var i, e = this; 1834 e.options.rows > 1 && ((i = e.$slides.children().children()).removeAttr("style"), e.$slider.empty().append(i)) 1835 }, e.prototype.clickHandler = function (i) { 1836 !1 === this.shouldClick && (i.stopImmediatePropagation(), i.stopPropagation(), i.preventDefault()) 1837 }, e.prototype.destroy = function (e) { 1838 var t = this; 1839 t.autoPlayClear(), t.touchObject = {}, t.cleanUpEvents(), i(".slick-cloned", t.$slider).detach(), t.$dots && t.$dots.remove(), t.$prevArrow && t.$prevArrow.length && (t.$prevArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display", ""), t.htmlExpr.test(t.options.prevArrow) && t.$prevArrow.remove()), t.$nextArrow && t.$nextArrow.length && (t.$nextArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display", ""), t.htmlExpr.test(t.options.nextArrow) && t.$nextArrow.remove()), t.$slides && (t.$slides.removeClass("slick-slide slick-active slick-center slick-visible slick-current").removeAttr("aria-hidden").removeAttr("data-slick-index").each(function () { 1840 i(this).attr("style", i(this).data("originalStyling")) 1841 }), t.$slideTrack.children(this.options.slide).detach(), t.$slideTrack.detach(), t.$list.detach(), t.$slider.append(t.$slides)), t.cleanUpRows(), t.$slider.removeClass("slick-slider"), t.$slider.removeClass("slick-initialized"), t.$slider.removeClass("slick-dotted"), t.unslicked = !0, e || t.$slider.trigger("destroy", [t]) 1842 }, e.prototype.disableTransition = function (i) { 1843 var e = this, 1844 t = {}; 1845 t[e.transitionType] = "", !1 === e.options.fade ? e.$slideTrack.css(t) : e.$slides.eq(i).css(t) 1846 }, e.prototype.fadeSlide = function (i, e) { 1847 var t = this; 1848 !1 === t.cssTransitions ? (t.$slides.eq(i).css({ 1849 zIndex: t.options.zIndex 1850 }), t.$slides.eq(i).animate({ 1851 opacity: 1 1852 }, t.options.speed, t.options.easing, e)) : (t.applyTransition(i), t.$slides.eq(i).css({ 1853 opacity: 1, 1854 zIndex: t.options.zIndex 1855 }), e && setTimeout(function () { 1856 t.disableTransition(i), e.call() 1857 }, t.options.speed)) 1858 }, e.prototype.fadeSlideOut = function (i) { 1859 var e = this; 1860 !1 === e.cssTransitions ? e.$slides.eq(i).animate({ 1861 opacity: 0, 1862 zIndex: e.options.zIndex - 2 1863 }, e.options.speed, e.options.easing) : (e.applyTransition(i), e.$slides.eq(i).css({ 1864 opacity: 0, 1865 zIndex: e.options.zIndex - 2 1866 })) 1867 }, e.prototype.filterSlides = e.prototype.slickFilter = function (i) { 1868 var e = this; 1869 null !== i && (e.$slidesCache = e.$slides, e.unload(), e.$slideTrack.children(this.options.slide).detach(), e.$slidesCache.filter(i).appendTo(e.$slideTrack), e.reinit()) 1870 }, e.prototype.focusHandler = function () { 1871 var e = this; 1872 e.$slider.off("focus.slick blur.slick").on("focus.slick blur.slick", "*", function (t) { 1873 t.stopImmediatePropagation(); 1874 var o = i(this); 1875 setTimeout(function () { 1876 e.options.pauseOnFocus && (e.focussed = o.is(":focus"), e.autoPlay()) 1877 }, 0) 1878 }) 1879 }, e.prototype.getCurrent = e.prototype.slickCurrentSlide = function () { 1880 return this.currentSlide 1881 }, e.prototype.getDotCount = function () { 1882 var i = this, 1883 e = 0, 1884 t = 0, 1885 o = 0; 1886 if (!0 === i.options.infinite) 1887 if (i.slideCount <= i.options.slidesToShow) ++o; 1888 else 1889 for (; e < i.slideCount;) ++o, e = t + i.options.slidesToScroll, t += i.options.slidesToScroll <= i.options.slidesToShow ? i.options.slidesToScroll : i.options.slidesToShow;
vendor: 4,749 bytes, lines 1890-1926
1890 else if (!0 === i.options.centerMode) o = i.slideCount; 1891 else if (i.options.asNavFor) 1892 for (; e < i.slideCount;) ++o, e = t + i.options.slidesToScroll, t += i.options.slidesToScroll <= i.options.slidesToShow ? i.options.slidesToScroll : i.options.slidesToShow; 1893 else o = 1 + Math.ceil((i.slideCount - i.options.slidesToShow) / i.options.slidesToScroll); 1894 return o - 1 1895 }, e.prototype.getLeft = function (i) { 1896 var e, t, o, s, n = this, 1897 r = 0; 1898 return n.slideOffset = 0, t = n.$slides.first().outerHeight(!0), !0 === n.options.infinite ? (n.slideCount > n.options.slidesToShow && (n.slideOffset = n.slideWidth * n.options.slidesToShow * -1, s = -1, !0 === n.options.vertical && !0 === n.options.centerMode && (2 === n.options.slidesToShow ? s = -1.5 : 1 === n.options.slidesToShow && (s = -2)), r = t * n.options.slidesToShow * s), n.slideCount % n.options.slidesToScroll != 0 && i + n.options.slidesToScroll > n.slideCount && n.slideCount > n.options.slidesToShow && (i > n.slideCount ? (n.slideOffset = (n.options.slidesToShow - (i - n.slideCount)) * n.slideWidth * -1, r = (n.options.slidesToShow - (i - n.slideCount)) * t * -1) : (n.slideOffset = n.slideCount % n.options.slidesToScroll * n.slideWidth * -1, r = n.slideCount % n.options.slidesToScroll * t * -1))) : i + n.options.slidesToShow > n.slideCount && (n.slideOffset = (i + n.options.slidesToShow - n.slideCount) * n.slideWidth, r = (i + n.options.slidesToShow - n.slideCount) * t), n.slideCount <= n.options.slidesToShow && (n.slideOffset = 0, r = 0), !0 === n.options.centerMode && n.slideCount <= n.options.slidesToShow ? n.slideOffset = n.slideWidth * Math.floor(n.options.slidesToShow) / 2 - n.slideWidth * n.slideCount / 2 : !0 === n.options.centerMode && !0 === n.options.infinite ? n.slideOffset += n.slideWidth * Math.floor(n.options.slidesToShow / 2) - n.slideWidth : !0 === n.options.centerMode && (n.slideOffset = 0, n.slideOffset += n.slideWidth * Math.floor(n.options.slidesToShow / 2)), e = !1 === n.options.vertical ? i * n.slideWidth * -1 + n.slideOffset : i * t * -1 + r, !0 === n.options.variableWidth && (o = n.slideCount <= n.options.slidesToShow || !1 === n.options.infinite ? n.$slideTrack.children(".slick-slide").eq(i) : n.$slideTrack.children(".slick-slide").eq(i + n.options.slidesToShow), e = !0 === n.options.rtl ? o[0] ? -1 * (n.$slideTrack.width() - o[0].offsetLeft - o.width()) : 0 : o[0] ? -1 * o[0].offsetLeft : 0, !0 === n.options.centerMode && (o = n.slideCount <= n.options.slidesToShow || !1 === n.options.infinite ? n.$slideTrack.children(".slick-slide").eq(i) : n.$slideTrack.children(".slick-slide").eq(i + n.options.slidesToShow + 1), e = !0 === n.options.rtl ? o[0] ? -1 * (n.$slideTrack.width() - o[0].offsetLeft - o.width()) : 0 : o[0] ? -1 * o[0].offsetLeft : 0, e += (n.$list.width() - o.outerWidth()) / 2)), e 1899 }, e.prototype.getOption = e.prototype.slickGetOption = function (i) { 1900 return this.options[i] 1901 }, e.prototype.getNavigableIndexes = function () { 1902 var i, e = this, 1903 t = 0, 1904 o = 0, 1905 s = []; 1906 for (!1 === e.options.infinite ? i = e.slideCount : (t = -1 * e.options.slidesToScroll, o = -1 * e.options.slidesToScroll, i = 2 * e.slideCount); t < i;) s.push(t), t = o + e.options.slidesToScroll, o += e.options.slidesToScroll <= e.options.slidesToShow ? e.options.slidesToScroll : e.options.slidesToShow; 1907 return s 1908 }, e.prototype.getSlick = function () { 1909 return this 1910 }, e.prototype.getSlideCount = function () { 1911 var e, t, o = this; 1912 return t = !0 === o.options.centerMode ? o.slideWidth * Math.floor(o.options.slidesToShow / 2) : 0, !0 === o.options.swipeToSlide ? (o.$slideTrack.find(".slick-slide").each(function (s, n) { 1913 if (n.offsetLeft - t + i(n).outerWidth() / 2 > -1 * o.swipeLeft) return e = n, !1 1914 }), Math.abs(i(e).attr("data-slick-index") - o.currentSlide) || 1) : o.options.slidesToScroll 1915 }, e.prototype.goTo = e.prototype.slickGoTo = function (i, e) { 1916 this.changeSlide({ 1917 data: { 1918 message: "index", 1919 index: parseInt(i) 1920 } 1921 }, e) 1922 }, e.prototype.init = function (e) { 1923 var t = this; 1924 i(t.$slider).hasClass("slick-initialized") || (i(t.$slider).addClass("slick-initialized"), t.buildRows(), t.buildOut(), t.setProps(), t.startLoad(), t.loadSlider(), t.initializeEvents(), t.updateArrows(), t.updateDots(), t.checkResponsive(!0), t.focusHandler()), e && t.$slider.trigger("init", [t]), !0 === t.options.accessibility && t.initADA(), t.options.autoplay && (t.paused = !1, t.autoPlay()) 1925 }, e.prototype.initADA = function () { 1926 var e = this,
1927 t = Math.ceil(e.slideCount / e.options.slidesToShow), 1928 o = e.getNavigableIndexes().filter(function (i) { 1929 return i >= 0 && i < e.slideCount 1930 }); 1931 e.$slides.add(e.$slideTrack.find(".slick-cloned")).attr({ 1932 "aria-hidden": "true", 1933 tabindex: "-1" 1934 }).find("a, input, button, select").attr({ 1935 tabindex: "-1" 1936 }), null !== e.$dots && (e.$slides.not(e.$slideTrack.find(".slick-cloned")).each(function (t) { 1937 var s = o.indexOf(t); 1938 i(this).attr({ 1939 role: "tabpanel", 1940 id: "slick-slide" + e.instanceUid + t, 1941 tabindex: -1 1942 }), -1 !== s && i(this).attr({ 1943 "aria-describedby": "slick-slide-control" + e.instanceUid + s 1944 }) 1945 }), e.$dots.attr("role", "tablist").find("li").each(function (s) { 1946 var n = o[s]; 1947 i(this).attr({ 1948 role: "presentation" 1949 }), i(this).find("button").first().attr({ 1950 role: "tab", 1951 id: "slick-slide-control" + e.instanceUid + s, 1952 "aria-controls": "slick-slide" + e.instanceUid + n, 1953 "aria-label": s + 1 + " of " + t, 1954 "aria-selected": null, 1955 tabindex: "-1" 1956 }) 1957 }).eq(e.currentSlide).find("button").attr({ 1958 "aria-selected": "true", 1959 tabindex: "0" 1960 }).end()); 1961 for (var s = e.currentSlide, n = s + e.options.slidesToShow; s < n; s++) e.$slides.eq(s).attr("tabindex", 0); 1962 e.activateADA() 1963 }, e.prototype.initArrowEvents = function () { 1964 var i = this; 1965 !0 === i.options.arrows && i.slideCount > i.options.slidesToShow && (i.$prevArrow.off("click.slick").on("click.slick", { 1966 message: "previous" 1967 }, i.changeSlide), i.$nextArrow.off("click.slick").on("click.slick", { 1968 message: "next" 1969 }, i.changeSlide), !0 === i.options.accessibility && (i.$prevArrow.on("keydown.slick", i.keyHandler), i.$nextArrow.on("keydown.slick", i.keyHandler))) 1970 }, e.prototype.initDotEvents = function () { 1971 var e = this; 1972 !0 === e.options.dots && (i("li", e.$dots).on("click.slick", { 1973 message: "index" 1974 }, e.changeSlide), !0 === e.options.accessibility && e.$dots.on("keydown.slick", e.keyHandler)), !0 === e.options.dots && !0 === e.options.pauseOnDotsHover && i("li", e.$dots).on("mouseenter.slick", i.proxy(e.interrupt, e, !0)).on("mouseleave.slick", i.proxy(e.interrupt, e, !1)) 1975 }, e.prototype.initSlideEvents = function () { 1976 var e = this; 1977 e.options.pauseOnHover && (e.$list.on("mouseenter.slick", i.proxy(e.interrupt, e, !0)), e.$list.on("mouseleave.slick", i.proxy(e.interrupt, e, !1))) 1978 }, e.prototype.initializeEvents = function () { 1979 var e = this; 1980 e.initArrowEvents(), e.initDotEvents(), e.initSlideEvents(), e.$list.on("touchstart.slick mousedown.slick", { 1981 action: "start" 1982 }, e.swipeHandler), e.$list.on("touchmove.slick mousemove.slick", { 1983 action: "move" 1984 }, e.swipeHandler), e.$list.on("touchend.slick mouseup.slick", { 1985 action: "end" 1986 }
vendor: 14,191 bytes, lines 1986-2166
1986, e.swipeHandler), e.$list.on("touchcancel.slick mouseleave.slick", { 1987 action: "end" 1988 }, e.swipeHandler), e.$list.on("click.slick", e.clickHandler), i(document).on(e.visibilityChange, i.proxy(e.visibility, e)), !0 === e.options.accessibility && e.$list.on("keydown.slick", e.keyHandler), !0 === e.options.focusOnSelect && i(e.$slideTrack).children().on("click.slick", e.selectHandler), i(window).on("orientationchange.slick.slick-" + e.instanceUid, i.proxy(e.orientationChange, e)), i(window).on("resize.slick.slick-" + e.instanceUid, i.proxy(e.resize, e)), i("[draggable!=true]", e.$slideTrack).on("dragstart", e.preventDefault), i(window).on("load.slick.slick-" + e.instanceUid, e.setPosition), i(e.setPosition) 1989 }, e.prototype.initUI = function () { 1990 var i = this; 1991 !0 === i.options.arrows && i.slideCount > i.options.slidesToShow && (i.$prevArrow.show(), i.$nextArrow.show()), !0 === i.options.dots && i.slideCount > i.options.slidesToShow && i.$dots.show() 1992 }, e.prototype.keyHandler = function (i) { 1993 var e = this; 1994 i.target.tagName.match("TEXTAREA|INPUT|SELECT") || (37 === i.keyCode && !0 === e.options.accessibility ? e.changeSlide({ 1995 data: { 1996 message: !0 === e.options.rtl ? "next" : "previous" 1997 } 1998 }) : 39 === i.keyCode && !0 === e.options.accessibility && e.changeSlide({ 1999 data: { 2000 message: !0 === e.options.rtl ? "previous" : "next" 2001 } 2002 })) 2003 }, e.prototype.lazyLoad = function () { 2004 function e(e) { 2005 i("img[data-lazy]", e).each(function () { 2006 var e = i(this), 2007 t = i(this).attr("data-lazy"), 2008 o = i(this).attr("data-srcset"), 2009 s = i(this).attr("data-sizes") || n.$slider.attr("data-sizes"), 2010 r = document.createElement("img"); 2011 r.onload = function () { 2012 e.animate({ 2013 opacity: 0 2014 }, 100, function () { 2015 o && (e.attr("srcset", o), s && e.attr("sizes", s)), e.attr("src", t).animate({ 2016 opacity: 1 2017 }, 200, function () { 2018 e.removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading") 2019 }), n.$slider.trigger("lazyLoaded", [n, e, t]) 2020 }) 2021 }, r.onerror = function () { 2022 e.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"), n.$slider.trigger("lazyLoadError", [n, e, t]) 2023 }, r.src = t 2024 }) 2025 } 2026 var t, o, s, n = this; 2027 if (!0 === n.options.centerMode ? !0 === n.options.infinite ? s = (o = n.currentSlide + (n.options.slidesToShow / 2 + 1)) + n.options.slidesToShow + 2 : (o = Math.max(0, n.currentSlide - (n.options.slidesToShow / 2 + 1)), s = n.options.slidesToShow / 2 + 1 + 2 + n.currentSlide) : (o = n.options.infinite ? n.options.slidesToShow + n.currentSlide : n.currentSlide, s = Math.ceil(o + n.options.slidesToShow), !0 === n.options.fade && (o > 0 && o--, s <= n.slideCount && s++)), t = n.$slider.find(".slick-slide").slice(o, s), "anticipated" === n.options.lazyLoad) 2028 for (var r = o - 1, l = s, d = n.$slider.find(".slick-slide"), a = 0; a < n.options.slidesToScroll; a++) r < 0 && (r = n.slideCount - 1), t = (t = t.add(d.eq(r))).add(d.eq(l)), r--, l++; 2029 e(t), n.slideCount <= n.options.slidesToShow ? e(n.$slider.find(".slick-slide")) : n.currentSlide >= n.slideCount - n.options.slidesToShow ? e(n.$slider.find(".slick-cloned").slice(0, n.options.slidesToShow)) : 0 === n.currentSlide && e(n.$slider.find(".slick-cloned").slice(-1 * n.options.slidesToShow)) 2030 }, e.prototype.loadSlider = function () { 2031 var i = this; 2032 i.setPosition(), i.$slideTrack.css({ 2033 opacity: 1 2034 }), i.$slider.removeClass("slick-loading"), i.initUI(), "progressive" === i.options.lazyLoad && i.progressiveLazyLoad() 2035 }, e.prototype.next = e.prototype.slickNext = function () { 2036 this.changeSlide({ 2037 data: { 2038 message: "next" 2039 } 2040 }) 2041 }, e.prototype.orientationChange = function () { 2042 var i = this; 2043 i.checkResponsive(), i.setPosition() 2044 }, e.prototype.pause = e.prototype.slickPause = function () { 2045 var i = this; 2046 i.autoPlayClear(), i.paused = !0 2047 }, e.prototype.play = e.prototype.slickPlay = function () { 2048 var i = this; 2049 i.autoPlay(), i.options.autoplay = !0, i.paused = !1, i.focussed = !1, i.interrupted = !1 2050 }, e.prototype.postSlide = function (e) { 2051 var t = this; 2052 t.unslicked || (t.$slider.trigger("afterChange", [t, e]), t.animating = !1, t.slideCount > t.options.slidesToShow && t.setPosition(), t.swipeLeft = null, t.options.autoplay && t.autoPlay(), !0 === t.options.accessibility && (t.initADA(), t.options.focusOnChange && i(t.$slides.get(t.currentSlide)).attr("tabindex", 0).focus())) 2053 }, e.prototype.prev = e.prototype.slickPrev = function () { 2054 this.changeSlide({ 2055 data: { 2056 message: "previous" 2057 } 2058 }) 2059 }, e.prototype.preventDefault = function (i) { 2060 i.preventDefault() 2061 }, e.prototype.progressiveLazyLoad = function (e) { 2062 e = e || 1; 2063 var t, o, s, n, r, l = this, 2064 d = i("img[data-lazy]", l.$slider); 2065 d.length ? (t = d.first(), o = t.attr("data-lazy"), s = t.attr("data-srcset"), n = t.attr("data-sizes") || l.$slider.attr("data-sizes"), (r = document.createElement("img")).onload = function () { 2066 s && (t.attr("srcset", s), n && t.attr("sizes", n)), t.attr("src", o).removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading"), !0 === l.options.adaptiveHeight && l.setPosition(), l.$slider.trigger("lazyLoaded", [l, t, o]), l.progressiveLazyLoad() 2067 }, r.onerror = function () { 2068 e < 3 ? setTimeout(function () { 2069 l.progressiveLazyLoad(e + 1) 2070 }, 500) : (t.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"), l.$slider.trigger("lazyLoadError", [l, t, o]), l.progressiveLazyLoad()) 2071 }, r.src = o) : l.$slider.trigger("allImagesLoaded", [l]) 2072 }, e.prototype.refresh = function (e) { 2073 var t, o, s = this; 2074 o = s.slideCount - s.options.slidesToShow, !s.options.infinite && s.currentSlide > o && (s.currentSlide = o), s.slideCount <= s.options.slidesToShow && (s.currentSlide = 0), t = s.currentSlide, s.destroy(!0), i.extend(s, s.initials, { 2075 currentSlide: t 2076 }), s.init(), e || s.changeSlide({ 2077 data: { 2078 message: "index", 2079 index: t 2080 } 2081 }, !1) 2082 }, e.prototype.registerBreakpoints = function () { 2083 var e, t, o, s = this, 2084 n = s.options.responsive || null; 2085 if ("array" === i.type(n) && n.length) { 2086 s.respondTo = s.options.respondTo || "window"; 2087 for (e in n) 2088 if (o = s.breakpoints.length - 1, n.hasOwnProperty(e)) { 2089 for (t = n[e].breakpoint; o >= 0;) s.breakpoints[o] && s.breakpoints[o] === t && s.breakpoints.splice(o, 1), o--; 2090 s.breakpoints.push(t), s.breakpointSettings[t] = n[e].settings 2091 } s.breakpoints.sort(function (i, e) { 2092 return s.options.mobileFirst ? i - e : e - i 2093 }) 2094 } 2095 }, e.prototype.reinit = function () { 2096 var e = this; 2097 e.$slides = e.$slideTrack.children(e.options.slide).addClass("slick-slide"), e.slideCount = e.$slides.length, e.currentSlide >= e.slideCount && 0 !== e.currentSlide && (e.currentSlide = e.currentSlide - e.options.slidesToScroll), e.slideCount <= e.options.slidesToShow && (e.currentSlide = 0), e.registerBreakpoints(), e.setProps(), e.setupInfinite(), e.buildArrows(), e.updateArrows(), e.initArrowEvents(), e.buildDots(), e.updateDots(), e.initDotEvents(), e.cleanUpSlideEvents(), e.initSlideEvents(), e.checkResponsive(!1, !0), !0 === e.options.focusOnSelect && i(e.$slideTrack).children().on("click.slick", e.selectHandler), e.setSlideClasses("number" == typeof e.currentSlide ? e.currentSlide : 0), e.setPosition(), e.focusHandler(), e.paused = !e.options.autoplay, e.autoPlay(), e.$slider.trigger("reInit", [e]) 2098 }, e.prototype.resize = function () { 2099 var e = this; 2100 i(window).width() !== e.windowWidth && (clearTimeout(e.windowDelay), e.windowDelay = window.setTimeout(function () { 2101 e.windowWidth = i(window).width(), e.checkResponsive(), e.unslicked || e.setPosition() 2102 }, 50)) 2103 }, e.prototype.removeSlide = e.prototype.slickRemove = function (i, e, t) { 2104 var o = this; 2105 if (i = "boolean" == typeof i ? !0 === (e = i) ? 0 : o.slideCount - 1 : !0 === e ? --i : i, o.slideCount < 1 || i < 0 || i > o.slideCount - 1) return !1; 2106 o.unload(), !0 === t ? o.$slideTrack.children().remove() : o.$slideTrack.children(this.options.slide).eq(i).remove(), o.$slides = o.$slideTrack.children(this.options.slide), o.$slideTrack.children(this.options.slide).detach(), o.$slideTrack.append(o.$slides), o.$slidesCache = o.$slides, o.reinit() 2107 }, e.prototype.setCSS = function (i) { 2108 var e, t, o = this, 2109 s = {}; 2110 !0 === o.options.rtl && (i = -i), e = "left" == o.positionProp ? Math.ceil(i) + "px" : "0px", t = "top" == o.positionProp ? Math.ceil(i) + "px" : "0px", s[o.positionProp] = i, !1 === o.transformsEnabled ? o.$slideTrack.css(s) : (s = {}, !1 === o.cssTransitions ? (s[o.animType] = "translate(" + e + ", " + t + ")", o.$slideTrack.css(s)) : (s[o.animType] = "translate3d(" + e + ", " + t + ", 0px)", o.$slideTrack.css(s))) 2111 }, e.prototype.setDimensions = function () { 2112 var i = this; 2113 !1 === i.options.vertical ? !0 === i.options.centerMode && i.$list.css({ 2114 padding: "0px " + i.options.centerPadding 2115 }) : (i.$list.height(i.$slides.first().outerHeight(!0) * i.options.slidesToShow), !0 === i.options.centerMode && i.$list.css({ 2116 padding: i.options.centerPadding + " 0px" 2117 })), i.listWidth = i.$list.width(), i.listHeight = i.$list.height(), !1 === i.options.vertical && !1 === i.options.variableWidth ? (i.slideWidth = Math.ceil(i.listWidth / i.options.slidesToShow), i.$slideTrack.width(Math.ceil(i.slideWidth * i.$slideTrack.children(".slick-slide").length))) : !0 === i.options.variableWidth ? i.$slideTrack.width(5e3 * i.slideCount) : (i.slideWidth = Math.ceil(i.listWidth), i.$slideTrack.height(Math.ceil(i.$slides.first().outerHeight(!0) * i.$slideTrack.children(".slick-slide").length))); 2118 var e = i.$slides.first().outerWidth(!0) - i.$slides.first().width(); 2119 !1 === i.options.variableWidth && i.$slideTrack.children(".slick-slide").width(i.slideWidth - e) 2120 }, e.prototype.setFade = function () { 2121 var e, t = this; 2122 t.$slides.each(function (o, s) { 2123 e = t.slideWidth * o * -1, !0 === t.options.rtl ? i(s).css({ 2124 position: "relative", 2125 right: e, 2126 top: 0, 2127 zIndex: t.options.zIndex - 2, 2128 opacity: 0 2129 }) : i(s).css({ 2130 position: "relative", 2131 left: e, 2132 top: 0, 2133 zIndex: t.options.zIndex - 2, 2134 opacity: 0 2135 }) 2136 }), t.$slides.eq(t.currentSlide).css({ 2137 zIndex: t.options.zIndex - 1, 2138 opacity: 1 2139 }) 2140 }, e.prototype.setHeight = function () { 2141 var i = this; 2142 if (1 === i.options.slidesToShow && !0 === i.options.adaptiveHeight && !1 === i.options.vertical) { 2143 var e = i.$slides.eq(i.currentSlide).outerHeight(!0); 2144 i.$list.css("height", e) 2145 } 2146 }, e.prototype.setOption = e.prototype.slickSetOption = function () { 2147 var e, t, o, s, n, r = this, 2148 l = !1; 2149 if ("object" === i.type(arguments[0]) ? (o = arguments[0], l = arguments[1], n = "multiple") : "string" === i.type(arguments[0]) && (o = arguments[0], s = arguments[1], l = arguments[2], "responsive" === arguments[0] && "array" === i.type(arguments[1]) ? n = "responsive" : void 0 !== arguments[1] && (n = "single")), "single" === n) r.options[o] = s; 2150 else if ("multiple" === n) i.each(o, function (i, e) { 2151 r.options[i] = e 2152 }); 2153 else if ("responsive" === n) 2154 for (t in s) 2155 if ("array" !== i.type(r.options.responsive)) r.options.responsive = [s[t]]; 2156 else { 2157 for (e = r.options.responsive.length - 1; e >= 0;) r.options.responsive[e].breakpoint === s[t].breakpoint && r.options.responsive.splice(e, 1), e--; 2158 r.options.responsive.push(s[t]) 2159 } l && (r.unload(), r.reinit()) 2160 }, e.prototype.setPosition = function () { 2161 var i = this; 2162 i.setDimensions(), i.setHeight(), !1 === i.options.fade ? i.setCSS(i.getLeft(i.currentSlide)) : i.setFade(), i.$slider.trigger("setPosition", [i]) 2163 }, e.prototype.setProps = function () { 2164 var i = this, 2165 e = document.body.style; 2166 i.positionProp = !0 === i.options.vertical ? "top" : "left", "top" === i.positionProp ? i.$slider.addClass("slick-vertical") : i.$slider.removeClass("slick-vertical"), void 0 === e.WebkitTransition && void 0 === e.MozTransition && void 0 === e.msTransition || !0 === i.options.useCSS && (i.cssTransitions = !0), i.options.fade && ("number" == typeof i.options.zIndex ? i.options.zIndex < 3 && (i.options.zIndex = 3) : i.options.zIndex = i.defaults.zIndex), void 0 !== e.OTransform && (i.animType = "OTransform", i.transformType = "-o-transform", i.transitionType = "OTransition", void 0 === e.perspectiveProperty && void 0 === e.webkitPerspective && (i.animType = !1)), void 0 !== e.MozTransform && (i.animType = "MozTransform", i.transformType = "-moz-transform", i.transitionType = "MozTransition", void 0 === e.perspectiveProperty && void 0 === e.MozPerspective && (i.animType = !1)), void 0 !== e.webkitTransform && (i.animType = "
2166webkitTransform", i.transformType = "-webkit-transform", i.transitionType = "webkitTransition", void 0 === e.perspectiveProperty && void 0 === e.webkitPerspective && (i.animType = !1)), void 0 !== e.msTransform && (i.animType = "msTransform", i.transformType = "-ms-transform", i.transitionType = "msTransition", void 0 === e.msTransform && (i.animType = !1)), void 0 !== e.transform && !1 !== i.animType && (i.animType = "transform", i.transformType = "transform", i.transitionType = "transition"), i.transformsEnabled = i.options.useTransform && null !== i.animType && !1 !== i.animType 2167 }, e.prototype.setSlideClasses = function (i) { 2168 var e, t, o, s, n = this; 2169 if (t = n.$slider.find(".slick-slide").removeClass("slick-active slick-center slick-current").attr("aria-hidden", "true"), n.$slides.eq(i).addClass("slick-current"), !0 === n.options.centerMode) { 2170 var r = n.options.slidesToShow % 2 == 0 ? 1 : 0; 2171 e = Math.floor(n.options.slidesToShow / 2), !0 === n.options.infinite && (i >= e && i <= n.slideCount - 1 - e ? n.$slides.slice(i - e + r, i + e + 1).addClass("slick-active").attr("aria-hidden", "false") : (o = n.options.slidesToShow + i, t.slice(o - e + 1 + r, o + e + 2).addClass("slick-active").attr("aria-hidden", "false")), 0 === i ? t.eq(t.length - 1 - n.options.slidesToShow).addClass("slick-center") : i === n.slideCount - 1 && t.eq(n.options.slidesToShow).addClass("slick-center")), n.$slides.eq(i).addClass("slick-center") 2172 } else i >= 0 && i <= n.slideCount - n.options.slidesToShow ? n.$slides.slice(i, i + n.options.slidesToShow).addClass("slick-active").attr("aria-hidden", "false") : t.length <= n.options.slidesToShow ? t.addClass("slick-active").attr("aria-hidden", "false") : (s = n.slideCount % n.options.slidesToShow, o = !0 === n.options.infinite ? n.options.slidesToShow + i : i, n.options.slidesToShow == n.options.slidesToScroll && n.slideCount - i < n.options.slidesToShow ? t.slice(o - (n.options.slidesToShow - s), o + s).addClass("slick-active").attr("aria-hidden", "false") : t.slice(o, o + n.options.slidesToShow).addClass("slick-active").attr("aria-hidden", "false")); 2173 "ondemand" !== n.options.lazyLoad && "anticipated" !== n.options.lazyLoad || n.lazyLoad() 2174 }, e.prototype.setupInfinite = function () { 2175 var e, t, o, s = this; 2176 if (!0 === s.options.fade && (s.options.centerMode = !1), !0 === s.options.infinite && !1 === s.options.fade && (t = null, s.slideCount > s.options.slidesToShow)) { 2177 for (o = !0 === s.options.centerMode ? s.options.slidesToShow + 1 : s.options.slidesToShow, e = s.slideCount; e > s.slideCount - o; e -= 1) t = e - 1, i(s.$slides[t]).clone(!0).attr("id", "").attr("data-slick-index", t - s.slideCount).prependTo(s.$slideTrack).addClass("slick-cloned"); 2178 for (e = 0; e < o + s.slideCount; e += 1) t = e, i(s.$slides[t]).clone(!0).attr("id", "").attr("data-slick-index", t + s.slideCount).appendTo(s.$slideTrack).addClass("slick-cloned"); 2179 s.$slideTrack.find(".slick-cloned").find("[id]").each(function () { 2180 i(this).attr("id", "") 2181 }) 2182 } 2183 }, e.prototype.interrupt = function (i) { 2184 var e = this; 2185 i || e.autoPlay(), e.interrupted = i 2186 }, e.prototype.selectHandler = function (e) { 2187 var t = this, 2188 o = i(e.target).is(".slick-slide") ? i(e.target) : i(e.target).parents(".slick-slide"), 2189 s = parseInt(o.attr("data-slick-index")); 2190 s || (s = 0), t.slideCount <= t.options.slidesToShow ? t.slideHandler(s, !1, !0) : t.slideHandler(s) 2191 }, e.prototype.slideHandler = function (i, e, t) { 2192 var o, s, n, r, l, d = null, 2193 a = this; 2194 if (e = e || !1, !(!0 === a.animating && !0 === a.options.waitForAnimate || !0 === a.options.fade && a.currentSlide === i)) 2195 if (!1 === e && a.asNavFor(i), o = i, d = a.getLeft(o), r = a.getLeft(a.currentSlide), a.currentLeft = null === a.swipeLeft ? r : a.swipeLeft, !1 === a.options.infinite && !1 === a.options.centerMode && (i < 0 || i > a.getDotCount() * a.options.slidesToScroll)) !1 === a.options.fade && (o = a.currentSlide, !0 !== t ? a.animateSlide(r, function () { 2196 a.postSlide(o) 2197 }) : a.postSlide(o)); 2198 else if (!1 === a.options.infinite && !0 === a.options.centerMode && (i < 0 || i > a.slideCount - a.options.slidesToScroll)) !1 === a.options.fade && (o = a.currentSlide, !0 !== t ? a.animateSlide(r, function () { 2199 a.postSlide(o) 2200 }) : a.postSlide(o)); 2201 else { 2202 if (a.options.autoplay && clearInterval(a.autoPlayTimer), s = o < 0 ? a.slideCount % a.options.slidesToScroll != 0 ? a.slideCount - a.slideCount % a.options.slidesToScroll : a.slideCount + o : o >= a.slideCount ? a.slideCount % a.options.slidesToScroll != 0 ? 0 : o - a.slideCount : o, a.animating = !0, a.$slider.trigger("beforeChange", [a, a.currentSlide, s]), n = a.currentSlide, a.currentSlide = s, a.setSlideClasses(a.currentSlide), a.options.asNavFor && (l = (l = a.getNavTarget()).slick("getSlick")).slideCount <= l.options.slidesToShow && l.setSlideClasses(a.currentSlide), a.updateDots(), a.updateArrows(), !0 === a.options.fade) return !0 !== t ? (a.fadeSlideOut(n), a.fadeSlide(s, function () { 2203 a.postSlide(s) 2204 })) : a.postSlide(s), void a.animateHeight(); 2205 !0 !== t ? a.animateSlide(d, function () { 2206 a.postSlide(s) 2207 }) : a.postSlide(s) 2208 } 2209 }, e.prototype.startLoad = function () { 2210 var i = this; 2211 !0 === i.options.arrows && i.slideCount > i.options.slidesToShow && (i.$prevArrow.hide(), i.$nextArrow.hide()), !0 === i.options.dots && i.slideCount > i.options.slidesToShow && i.$dots.hide(), i.$slider.addClass("slick-loading") 2212 }, e.prototype.swipeDirection = function () { 2213 var i, e, t, o, s = this; 2214 return i = s.touchObject.startX - s.touchObject.curX, e = s.touchObject.startY - s.touchObject.curY, t = Math.atan2(e, i), (o = Math.round(180 * t / Math.PI)) < 0 && (o = 360 - Math.abs(o)), o <= 45 && o >= 0 ? !1 === s.options.rtl ? "left" : "right" : o <= 360 && o >= 315 ? !1 === s.options.rtl ? "left" : "right" : o >= 135 && o <= 225 ? !1 === s.options.rtl ? "right" : "left" : !0 === s.options.verticalSwiping ? o >= 35 && o <= 135 ? "down" : "up" : "vertical" 2215 }, e.prototype.swipeEnd = function (i) { 2216 var e, t, o = this; 2217 if (o.dragging = !1, o.swiping = !1, o.scrolling) return o.scrolling = !1, !1; 2218 if (o.interrupted = !1, o.shouldClick = !(o.touchObject.swipeLength > 10), void 0 === o.touchObject.curX) return !1; 2219 if (!0 === o.touchObject.edgeHit && o.$slider.trigger("edge", [o, o.swipeDirection()]), o.touchObject.swipeLength >= o.touchObject.minSwipe) { 2220 switch (t = o.swipeDirection()) {
vendor: 4,252 bytes, lines 2221-2256
2221 case "left": 2222 case "down": 2223 e = o.options.swipeToSlide ? o.checkNavigable(o.currentSlide + o.getSlideCount()) : o.currentSlide + o.getSlideCount(), o.currentDirection = 0; 2224 break; 2225 case "right": 2226 case "up": 2227 e = o.options.swipeToSlide ? o.checkNavigable(o.currentSlide - o.getSlideCount()) : o.currentSlide - o.getSlideCount(), o.currentDirection = 1 2228 } 2229 "vertical" != t && (o.slideHandler(e), o.touchObject = {}, o.$slider.trigger("swipe", [o, t])) 2230 } else o.touchObject.startX !== o.touchObject.curX && (o.slideHandler(o.currentSlide), o.touchObject = {}) 2231 }, e.prototype.swipeHandler = function (i) { 2232 var e = this; 2233 if (!(!1 === e.options.swipe || "ontouchend" in document && !1 === e.options.swipe || !1 === e.options.draggable && -1 !== i.type.indexOf("mouse"))) switch (e.touchObject.fingerCount = i.originalEvent && void 0 !== i.originalEvent.touches ? i.originalEvent.touches.length : 1, e.touchObject.minSwipe = e.listWidth / e.options.touchThreshold, !0 === e.options.verticalSwiping && (e.touchObject.minSwipe = e.listHeight / e.options.touchThreshold), i.data.action) { 2234 case "start": 2235 e.swipeStart(i); 2236 break; 2237 case "move": 2238 e.swipeMove(i); 2239 break; 2240 case "end": 2241 e.swipeEnd(i) 2242 } 2243 }, e.prototype.swipeMove = function (i) { 2244 var e, t, o, s, n, r, l = this; 2245 return n = void 0 !== i.originalEvent ? i.originalEvent.touches : null, !(!l.dragging || l.scrolling || n && 1 !== n.length) && (e = l.getLeft(l.currentSlide), l.touchObject.curX = void 0 !== n ? n[0].pageX : i.clientX, l.touchObject.curY = void 0 !== n ? n[0].pageY : i.clientY, l.touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(l.touchObject.curX - l.touchObject.startX, 2))), r = Math.round(Math.sqrt(Math.pow(l.touchObject.curY - l.touchObject.startY, 2))), !l.options.verticalSwiping && !l.swiping && r > 4 ? (l.scrolling = !0, !1) : (!0 === l.options.verticalSwiping && (l.touchObject.swipeLength = r), t = l.swipeDirection(), void 0 !== i.originalEvent && l.touchObject.swipeLength > 4 && (l.swiping = !0, i.preventDefault()), s = (!1 === l.options.rtl ? 1 : -1) * (l.touchObject.curX > l.touchObject.startX ? 1 : -1), !0 === l.options.verticalSwiping && (s = l.touchObject.curY > l.touchObject.startY ? 1 : -1), o = l.touchObject.swipeLength, l.touchObject.edgeHit = !1, !1 === l.options.infinite && (0 === l.currentSlide && "right" === t || l.currentSlide >= l.getDotCount() && "left" === t) && (o = l.touchObject.swipeLength * l.options.edgeFriction, l.touchObject.edgeHit = !0), !1 === l.options.vertical ? l.swipeLeft = e + o * s : l.swipeLeft = e + o * (l.$list.height() / l.listWidth) * s, !0 === l.options.verticalSwiping && (l.swipeLeft = e + o * s), !0 !== l.options.fade && !1 !== l.options.touchMove && (!0 === l.animating ? (l.swipeLeft = null, !1) : void l.setCSS(l.swipeLeft)))) 2246 }, e.prototype.swipeStart = function (i) { 2247 var e, t = this; 2248 if (t.interrupted = !0, 1 !== t.touchObject.fingerCount || t.slideCount <= t.options.slidesToShow) return t.touchObject = {}, !1; 2249 void 0 !== i.originalEvent && void 0 !== i.originalEvent.touches && (e = i.originalEvent.touches[0]), t.touchObject.startX = t.touchObject.curX = void 0 !== e ? e.pageX : i.clientX, t.touchObject.startY = t.touchObject.curY = void 0 !== e ? e.pageY : i.clientY, t.dragging = !0 2250 }, e.prototype.unfilterSlides = e.prototype.slickUnfilter = function () { 2251 var i = this; 2252 null !== i.$slidesCache && (i.unload(), i.$slideTrack.children(this.options.slide).detach(), i.$slidesCache.appendTo(i.$slideTrack), i.reinit()) 2253 }, e.prototype.unload = function () { 2254 var e = this; 2255 i(".slick-cloned", e.$slider).remove(), e.$dots && e.$dots.remove(), e.$prevArrow && e.htmlExpr.test(e.options.prevArrow) && e.$prevArrow.remove(), e.$nextArrow && e.htmlExpr.test(e.options.nextArrow) && e.$nextArrow.remove(), e.$slides.removeClass("slick-slide slick-active slick-visible slick-current").attr("aria-hidden", "true").css("width", "") 2256 }
2256, e.prototype.unslick = function (i) { 2257 var e = this; 2258 e.$slider.trigger("unslick", [e, i]), e.destroy() 2259 }, e.prototype.updateArrows = function () { 2260 var i = this; 2261 Math.floor(i.options.slidesToShow / 2), !0 === i.options.arrows && i.slideCount > i.options.slidesToShow && !i.options.infinite && (i.$prevArrow.removeClass("slick-disabled").attr("aria-disabled", "false"), i.$nextArrow.removeClass("slick-disabled").attr("aria-disabled", "false"), 0 === i.currentSlide ? (i.$prevArrow.addClass("slick-disabled").attr("aria-disabled", "true"), i.$nextArrow.removeClass("slick-disabled").attr("aria-disabled", "false")) : i.currentSlide >= i.slideCount - i.options.slidesToShow && !1 === i.options.centerMode ? (i.$nextArrow.addClass("slick-disabled").attr("aria-disabled", "true"), i.$prevArrow.removeClass("slick-disabled").attr("aria-disabled", "false")) : i.currentSlide >= i.slideCount - 1 && !0 === i.options.centerMode && (i.$nextArrow.addClass("slick-disabled").attr("aria-disabled", "true"), i.$prevArrow.removeClass("slick-disabled").attr("aria-disabled", "false"))) 2262 }, e.prototype.updateDots = function () { 2263 var i = this; 2264 null !== i.$dots && (i.$dots.find("li").removeClass("slick-active").end(), i.$dots.find("li").eq(Math.floor(i.currentSlide / i.options.slidesToScroll)).addClass("slick-active")) 2265 }, e.prototype.visibility = function () { 2266 var i = this; 2267 i.options.autoplay && (document[i.hidden] ? i.interrupted = !0 : i.interrupted = !1) 2268 }, i.fn.slick = function () { 2269 var i, t, o = this, 2270 s = arguments[0], 2271 n = Array.prototype.slice.call(arguments, 1), 2272 r = o.length; 2273 for (i = 0; i < r; i++) 2274 if ("object" == typeof s || void 0 === s ? o[i].slick = new e(o[i], s) : t = o[i].slick[s].apply(o[i].slick, n), void 0 !== t) return t; 2275 return o 2276 } 2277}); 2278(function ($) { 2279 'use strict'; 2280 var methods = { 2281 init: function (options) { 2282 return this.each(function () { 2283 this.self = $(this); 2284 methods.destroy.call(this.self); 2285 this.opt = $.extend(true, {}, $.fn.raty.defaults, options, this.self.data()); 2286 methods._adjustCallback.call(this); 2287 methods._adjustNumber.call(this); 2288 methods._adjustHints.call(this); 2289 this.opt.score = methods._adjustedScore.call(this, this.opt.score); 2290 if (this.opt.starType !== 'img') { 2291 methods._adjustStarType.call(this); 2292 } 2293 methods._adjustPath.call(this); 2294 methods._createStars.call(this); 2295 if (this.opt.cancel) { 2296 methods._createCancel.call(this); 2297 } 2298 if (this.opt.precision) { 2299 methods._adjustPrecision.call(this); 2300 } 2301 methods._createScore.call(this); 2302 methods._apply.call(this, this.opt.score); 2303 methods._setTitle.call(this, this.opt.score); 2304 methods._target.call(this, this.opt.score); 2305 if (this.opt.readOnly) { 2306 methods._lock.call(this); 2307 } else { 2308 this.style.cursor = 'pointer'; 2309 methods._binds.call(this); 2310 } 2311 }); 2312 }, 2313 _adjustCallback: function () { 2314 var options = ['number', 'readOnly', 'score', 'scoreName', 'target', 'path']; 2315 for (var i = 0; i < options.length; i++) { 2316 if (typeof this.opt[options[i]] === 'function') { 2317 this.opt[options[i]] = this.opt[options[i]].call(this); 2318 } 2319 } 2320 }, 2321 _adjustedScore: function (score) { 2322 if (!score) { 2323 return score; 2324 } 2325 return methods._between(score, 0, this.opt.number); 2326 }, 2327 _adjustHints: function () { 2328 if (!this.opt.hints) { 2329 this.opt.hints = []; 2330 } 2331 if (!this.opt.halfShow && !this.opt.half) { 2332 return; 2333 } 2334 var steps = this.opt.precision ? 10 : 2; 2335 for (var i = 0; i < this.opt.number; i++) { 2336 var group = this.opt.hints[i]; 2337 if (Object.prototype.toString.call(group) !== '[object Array]') { 2338 group = [group]; 2339 } 2340 this.opt.hints[i] = []; 2341 for (var j = 0; j < steps; j++) { 2342 var 2343 hint = group[j], 2344 last = group[group.length - 1]; 2345 if (last === undefined) { 2346 last = null; 2347 } 2348 this.opt.hints[i][j] = hint === undefined ? last : hint; 2349 } 2350 } 2351 }, 2352 _adjustNumber: function () { 2353 this.opt.number = methods._between(this.opt.number, 1, this.opt.numberMax); 2354 }, 2355 _adjustPath: function () { 2356 this.opt.path = this.opt.path || ''; 2357 if (this.opt.path && this.opt.path.charAt(this.opt.path.length - 1) !== '/') { 2358 this.opt.path += '/'; 2359 } 2360 }, 2361 _adjustPrecision: function () { 2362 this.opt.half = true; 2363 }, 2364 _adjustStarType: function () { 2365 var replaces = ['cancelOff', 'cancelOn', 'starHalf', 'starOff', 'starOn']; 2366 this.opt.path = ''; 2367 for (var i = 0; i < replaces.length; i++) { 2368 this.opt[replaces[i]] = this.opt[replaces[i]].replace('.', '-'); 2369 } 2370 }, 2371 _apply: function (score) { 2372 methods._fill.call(this, score); 2373 if (score) { 2374 if (score > 0) { 2375 this.score.val(score); 2376 }
2377 methods._roundStars.call(this, score); 2378 } 2379 }, 2380 _between: function (value, min, max) { 2381 return Math.min(Math.max(parseFloat(value), min), max); 2382 }, 2383 _binds: function () { 2384 if (this.cancel) { 2385 methods._bindOverCancel.call(this); 2386 methods._bindClickCancel.call(this); 2387 methods._bindOutCancel.call(this); 2388 } 2389 methods._bindOver.call(this); 2390 methods._bindClick.call(this); 2391 methods._bindOut.call(this); 2392 }, 2393 _bindClick: function () { 2394 var that = this; 2395 that.stars.on('click.raty', function (evt) { 2396 var 2397 execute = true, 2398 score = (that.opt.half || that.opt.precision) ? that.self.data('score') : (this.alt || $(this).data('alt')); 2399 if (that.opt.click) { 2400 execute = that.opt.click.call(that, +score, evt); 2401 } 2402 if (execute || execute === undefined) { 2403 if (that.opt.half && !that.opt.precision) { 2404 score = methods._roundHalfScore.call(that, score); 2405 } 2406 methods._apply.call(that, score); 2407 } 2408 }); 2409 }, 2410 _bindClickCancel: function () { 2411 var that = this; 2412 that.cancel.on('click.raty', function (evt) { 2413 that.score.removeAttr('value'); 2414 if (that.opt.click) { 2415 that.opt.click.call(that, null, evt); 2416 } 2417 }); 2418 }, 2419 _bindOut: function () { 2420 var that = this; 2421 that.self.on('mouseleave.raty', function (evt) { 2422 var score = +that.score.val() || undefined; 2423 methods._apply.call(that, score); 2424 methods._target.call(that, score, evt); 2425 methods._resetTitle.call(that); 2426 if (that.opt.mouseout) { 2427 that.opt.mouseout.call(that, score, evt); 2428 } 2429 }); 2430 }, 2431 _bindOutCancel: function () { 2432 var that = this; 2433 that.cancel.on('mouseleave.raty', function (evt) { 2434 var icon = that.opt.cancelOff; 2435 if (that.opt.starType !== 'img') { 2436 icon = that.opt.cancelClass + ' ' + icon; 2437 } 2438 methods._setIcon.call(that, this, icon); 2439 if (that.opt.mouseout) { 2440 var score = +that.score.val() || undefined; 2441 that.opt.mouseout.call(that, score, evt); 2442 } 2443 }); 2444 }, 2445 _bindOver: function () { 2446 var 2447 that = this, 2448 action = that.opt.half ? 'mousemove.raty' : 'mouseover.raty'; 2449 that.stars.on(action, function (evt) { 2450 var score = methods._getScoreByPosition.call(that, evt, this); 2451 methods._fill.call(that, score); 2452 if (that.opt.half) { 2453 methods._roundStars.call(that, score, evt); 2454 methods._setTitle.call(that, score, evt); 2455 that.self.data('score', score); 2456 } 2457 methods._target.call(that, score, evt); 2458 if (that.opt.mouseover) { 2459 that.opt.mouseover.call(that, score, evt); 2460 } 2461 }); 2462 }, 2463 _bindOverCancel: function () { 2464 var that = this; 2465 that.cancel.on('mouseover.raty', function (evt) { 2466 var 2467 starOff = that.opt.path + that.opt.starOff, 2468 icon = that.opt.cancelOn; 2469 if (that.opt.starType === 'img') { 2470 that.stars.attr('src', starOff); 2471 } else { 2472 icon = that.opt.cancelClass + ' ' + icon; 2473 that.stars.attr('class', starOff); 2474 } 2475 methods._setIcon.call(that, this, icon); 2476 methods._target.call(that, null, evt); 2477 if (that.opt.mouseover) { 2478 that.opt.mouseover.call(that, null); 2479 } 2480 }); 2481 }, 2482 _buildScoreField: function () { 2483 return $('<input />', { 2484 name: this.opt.scoreName, 2485 type: 'hidden' 2486 }).appendTo(this); 2487 }, 2488 _createCancel: function () { 2489 var 2490 icon = this.opt.path + this.opt.cancelOff, 2491 cancel = $('<' + this.opt.starType + ' />', { 2492 title: this.opt.cancelHint, 2493 'class': this.opt.cancelClass 2494 }); 2495 if (this.opt.starType === 'img') { 2496 cancel.attr({ 2497 src: icon, 2498 alt: 'x' 2499 }); 2500 } else { 2501 cancel.attr('data-alt', 'x').addClass(icon); 2502 } 2503 if (this.opt.cancelPlace === 'left') { 2504 this.self.prepend(' ').prepend(cancel); 2505 } else { 2506 this.self.append(' ').append(cancel); 2507 } 2508 this.cancel = cancel; 2509 }, 2510 _createScore: function () { 2511 var score = $(this.opt.targetScore); 2512 this.score = score.length ? score : methods._buildScoreField.call(this); 2513 }, 2514 _createStars: function () { 2515 for (var i = 1; i <= this.opt.number; i++) { 2516 var 2517 name = methods._nameForIndex.call(this, i), 2518 attrs = { 2519 alt: i, 2520 src: this.opt.path + this.opt[name] 2521 };
2522 if (this.opt.starType !== 'img') { 2523 attrs = { 2524 'data-alt': i, 2525 'class': attrs.src 2526 }; // TODO: use $.data. 2527 } 2528 attrs.title = methods._getHint.call(this, i); 2529 $('<' + this.opt.starType + ' />', attrs).appendTo(this); 2530 if (this.opt.space) { 2531 this.self.append(i < this.opt.number ? ' ' : ''); 2532 } 2533 } 2534 this.stars = this.self.children(this.opt.starType); 2535 }, 2536 _error: function (message) { 2537 $(this).text(message); 2538 $.error(message); 2539 }, 2540 _fill: function (score) { 2541 var hash = 0; 2542 for (var i = 1; i <= this.stars.length; i++) { 2543 var 2544 icon, star = this.stars[i - 1], 2545 turnOn = methods._turnOn.call(this, i, score); 2546 if (this.opt.iconRange && this.opt.iconRange.length > hash) { 2547 var irange = this.opt.iconRange[hash]; 2548 icon = methods._getRangeIcon.call(this, irange, turnOn); 2549 if (i <= irange.range) { 2550 methods._setIcon.call(this, star, icon); 2551 } 2552 if (i === irange.range) { 2553 hash++; 2554 } 2555 } else { 2556 icon = this.opt[turnOn ? 'starOn' : 'starOff']; 2557 methods._setIcon.call(this, star, icon); 2558 } 2559 } 2560 }, 2561 _getFirstDecimal: function (number) { 2562 var 2563 decimal = number.toString().split('.')[1], 2564 result = 0; 2565 if (decimal) { 2566 result = parseInt(decimal.charAt(0), 10); 2567 if (decimal.slice(1, 5) === '9999') { 2568 result++; 2569 } 2570 } 2571 return result; 2572 }, 2573 _getRangeIcon: function (irange, turnOn) { 2574 return turnOn ? irange.on || this.opt.starOn : irange.off || this.opt.starOff; 2575 }, 2576 _getScoreByPosition: function (evt, icon) { 2577 var score = parseInt(icon.alt || icon.getAttribute('data-alt'), 10); 2578 if (this.opt.half) { 2579 var 2580 size = methods._getWidth.call(this), 2581 percent = parseFloat((evt.pageX - $(icon).offset().left) / size); 2582 score = score - 1 + percent; 2583 } 2584 return score; 2585 }, 2586 _getHint: function (score, evt) { 2587 if (score !== 0 && !score) { 2588 return this.opt.noRatedMsg; 2589 } 2590 var 2591 decimal = methods._getFirstDecimal.call(this, score), 2592 integer = Math.ceil(score), 2593 group = this.opt.hints[(integer || 1) - 1], 2594 hint = group, 2595 set = !evt || this.move; 2596 if (this.opt.precision) { 2597 if (set) { 2598 decimal = decimal === 0 ? 9 : decimal - 1; 2599 } 2600 hint = group[decimal]; 2601 } else if (this.opt.halfShow || this.opt.half) { 2602 decimal = set && decimal === 0 ? 1 : decimal > 5 ? 1 : 0; 2603 hint = group[decimal]; 2604 } 2605 return hint === '' ? '' : hint || score; 2606 }, 2607 _getWidth: function () { 2608 var width = this.stars[0].width || parseFloat(this.stars.eq(0).css('font-size')); 2609 if (!width) { 2610 methods._error.call(this, 'Could not get the icon width!'); 2611 } 2612 return width; 2613 }, 2614 _lock: function () { 2615 var hint = methods._getHint.call(this, this.score.val()); 2616 this.style.cursor = ''; 2617 this.title = hint; 2618 this.score.prop('readonly', true); 2619 this.stars.prop('title', hint); 2620 if (this.cancel) { 2621 this.cancel.hide(); 2622 } 2623 this.self.data('readonly', true); 2624 }, 2625 _nameForIndex: function (i) { 2626 return this.opt.score && this.opt.score >= i ? 'starOn' : 'starOff'; 2627 }, 2628 _resetTitle: function () { 2629 for (var i = 0; i < this.opt.number; i++) { 2630 this.stars[i].title = methods._getHint.call(this, i + 1); 2631 } 2632 }, 2633 _roundHalfScore: function (score) { 2634 var 2635 integer = parseInt(score, 10), 2636 decimal = methods._getFirstDecimal.call(this, score); 2637 if (decimal !== 0) { 2638 decimal = decimal > 5 ? 1 : 0.5; 2639 } 2640 return integer + decimal; 2641 }, 2642 _roundStars: function (score, evt) { 2643 var 2644 decimal = (score % 1).toFixed(2), 2645 name; 2646 if (evt || this.move) { 2647 name = decimal > 0.5 ? 'starOn' : 'starHalf'; 2648 } else if (decimal > this.opt.round.down) { // Up: [x.76 .. x.99] 2649 name = 'starOn'; 2650 if (this.opt.halfShow && decimal < this.opt.round.up) { // Half: [x.26 .. x.75] 2651 name = 'starHalf'; 2652 } else if (decimal < this.opt.round.full) { // Down: [x.00 .. x.5] 2653 name = 'starOff'; 2654 } 2655 } 2656 if (name) { 2657 var 2658 icon = this.opt[name], 2659 star = this.stars[Math.ceil(score) - 1]; 2660 methods._setIcon.call(this, star, icon); 2661 } // Full down: [x.00 .. x.25] 2662 }, 2663 _setIcon: function (star, icon) { 2664 star[this.opt.starType === 'img' ? 'src' : 'className'] = this.opt.path + icon; 2665 }, 2666 _setTarget: function (target, score) { 2667 if (score) { 2668 score = this.opt.targetFormat.toString().replace('{score}', score); 2669 } 2670 if (target.is(':input')) { 2671 target.val(score); 2672 } else { 2673 target.html(score); 2674 } 2675 }, 2676 _setTitle: function (score, evt) { 2677 if (score) { 2678 var 2679 integer = parseInt(Math.ceil(score), 10), 2680 star = this.stars[integer - 1]; 2681 star.title = methods._getHint.call(this, score, evt); 2682 } 2683 }, 2684 _target: function (score, evt) { 2685 if (this.opt.target) { 2686 var target = $(this.opt.target); 2687 if (!target.length) { 2688 methods._error.call(this, 'Target selector invalid or missing!'); 2689 } 2690 var mouseover = evt && evt.type === 'mouseover'; 2691 if (score === undefined) { 2692 score = this.opt.targetText; 2693 } else if (score === null) { 2694 score = mouseover ? this.opt.cancelHint : this.opt.targetText; 2695 } else { 2696 if (this.opt.targetType === 'hint') { 2697 score = methods._getHint.call(this, score, evt); 2698 } else if (this.opt.precision) { 2699 score = parseFloat(score).toFixed(1); 2700 } 2701 var mousemove = evt && evt.type === 'mousemove'; 2702 if (!mouseover && !mousemove && !this.opt.targetKeep) { 2703 score = this.opt.targetText; 2704 } 2705 } 2706 methods._setTarget.call(this, target, score); 2707 } 2708 }, 2709 _turnOn: function (i, score) { 2710 return this.opt.single ? (i === score) : (i <= score); 2711 }, 2712 _unlock: function () { 2713 this.style.cursor = 'pointer'; 2714 this.removeAttribute('title'); 2715 this.score.removeAttr('readonly'); 2716 this.self.data('readonly', false); 2717 for (var i = 0; i < this.opt.number; i++) { 2718 this.stars[i].title = methods._getHint.call(this, i + 1); 2719 } 2720 if (this.cancel) { 2721 this.cancel.css('display', ''); 2722 } 2723 }, 2724 cancel: function (click) { 2725 return this.each(function () { 2726 var self = $(this); 2727 if (self.data('readonly') !== true) { 2728 methods[click ? 'click' : 'score'].call(self, null); 2729 this.score.removeAttr('value'); 2730 } 2731 }); 2732 }, 2733 click: function (score) { 2734 return this.each(function () { 2735 if ($(this).data('readonly') !== true) {
2736 score = methods._adjustedScore.call(this, score); 2737 methods._apply.call(this, score); 2738 if (this.opt.click) { 2739 this.opt.click.call(this, score, $.Event('click')); 2740 } 2741 methods._target.call(this, score); 2742 } 2743 }); 2744 }, 2745 destroy: function () { 2746 return this.each(function () { 2747 var 2748 self = $(this), 2749 raw = self.data('raw'); 2750 if (raw) { 2751 self.off('.raty').empty().css({ 2752 cursor: raw.style.cursor 2753 }).removeData('readonly'); 2754 } else { 2755 self.data('raw', self.clone()[0]); 2756 } 2757 }); 2758 }, 2759 getScore: function () { 2760 var 2761 score = [], 2762 value; 2763 this.each(function () { 2764 value = this.score.val(); 2765 score.push(value ? +value : undefined); 2766 }); 2767 return (score.length > 1) ? score : score[0]; 2768 }, 2769 move: function (score) { 2770 return this.each(function () { 2771 var 2772 integer = parseInt(score, 10), 2773 decimal = methods._getFirstDecimal.call(this, score); 2774 if (integer >= this.opt.number) { 2775 integer = this.opt.number - 1; 2776 decimal = 10; 2777 } 2778 var 2779 width = methods._getWidth.call(this), 2780 steps = width / 10, 2781 star = $(this.stars[integer]), 2782 percent = star.offset().left + steps * decimal, 2783 evt = $.Event('mousemove', { 2784 pageX: percent 2785 }); 2786 this.move = true; 2787 star.trigger(evt); 2788 this.move = false; 2789 }); 2790 }, 2791 readOnly: function (readonly) { 2792 return this.each(function () { 2793 var self = $(this); 2794 if (self.data('readonly') !== readonly) { 2795 if (readonly) { 2796 self.off('.raty').children(this.opt.starType).off('.raty'); 2797 methods._lock.call(this); 2798 } else { 2799 methods._binds.call(this); 2800 methods._unlock.call(this); 2801 } 2802 self.data('readonly', readonly); 2803 } 2804 }); 2805 }, 2806 reload: function () { 2807 return methods.set.call(this, {}); 2808 }, 2809 score: function () { 2810 var self = $(this); 2811 return arguments.length ? methods.setScore.apply(self, arguments) : methods.getScore.call(self); 2812 }, 2813 set: function (options) { 2814 return this.each(function () { 2815 $(this).raty($.extend({}, this.opt, options)); 2816 }); 2817 }, 2818 setScore: function (score) { 2819 return this.each(function () { 2820 if ($(this).data('readonly') !== true) { 2821 score = methods._adjustedScore.call(this, score); 2822 methods._apply.call(this, score); 2823 methods._target.call(this, score); 2824 } 2825 }); 2826 } 2827 }; 2828 $.fn.raty = function (method) { 2829 if (methods[method]) { 2830 return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 2831 } else if (typeof method === 'object' || !method) { 2832 return methods.init.apply(this, arguments); 2833 } else { 2834 $.error('Method ' + method + ' does not exist!'); 2835 } 2836 }; 2837 $.fn.raty.defaults = { 2838 cancel: false, 2839 cancelClass: 'raty-cancel', 2840 cancelHint: 'Cancel this rating!', 2841 cancelOff: 'cancel-off.png', 2842 cancelOn: 'cancel-on.png', 2843 cancelPlace: 'left', 2844 click: undefined, 2845 half: false, 2846 halfShow: true, 2847 hints: ['bad', 'poor', 'regular', 'good', 'gorgeous'], 2848 iconRange: undefined, 2849 mouseout: undefined, 2850 mouseover: undefined, 2851 noRatedMsg: 'Not rated yet!', 2852 number: 5, 2853 numberMax: 20, 2854 path: undefined, 2855 precision: false, 2856 readOnly: false, 2857 round: { 2858 down: 0.25, 2859 full: 0.6, 2860 up: 0.76 2861 }, 2862 score: undefined, 2863 scoreName: 'score', 2864 single: false, 2865 space: true, 2866 starHalf: 'star-half.png', 2867 starOff: 'star-off.png', 2868 starOn: 'star-on.png', 2869 starType: 'img', 2870 target: undefined, 2871 targetFormat: '{score}', 2872 targetKeep: false, 2873 targetScore: undefined, 2874 targetText: '', 2875 targetType: 'hint' 2876 }; 2877})(jQuery); 2878 2879function calendar_handler() { 2880 var that = this; 2881 that.init = function (settings) { 2882 that.$fakeInput = settings.$fakeInput; 2883 that.$hiddenInput = settings.$hiddenInput; 2884 that.$fakeInputIcon = settings.$fakeInputIcon; 2885 that.type = settings.type; 2886 that.title = settings.title; 2887 that.calendarSettings = settings.calendarSettings; 2888 that.onInit = settings.onInit; 2889 that.onSubmit = settings.onSubmit; 2890 that.customClass = settings.customClass ? settings.customClass : ''; 2891 if (that.$fakeInput.length === 0) return; 2892 that.addPluginAbilityToInput(); 2893 if (that.calendarSettings) { 2894 that.calendarSettings.format = that.getDatePickerSupportedFormat(sett
2894ings.calendarSettings.format); 2895 if (that.calendarSettings.startDate) { 2896 var dayObj = dayjs(new Date(that.calendarSettings.startDate)); 2897 dayObj = dayObj.format(that.calendarSettings.format); 2898 that.$fakeInput.html(dayObj); 2899 that.$hiddenInput.val(dayObj); 2900 } 2901 } 2902 if (that.onInit) { 2903 that.onInit.call(); 2904 } 2905 }; 2906 that.setDate = function (date) { 2907 var dayObj = dayjs(date); 2908 dayObj = dayObj.format(that.calendarSettings.format); 2909 that.$fakeInput.html(dayObj); 2910 that.$hiddenInput.val(dayObj); 2911 }; 2912 that.addPluginAbilityToInput = function () { 2913 that.$fakeInput.addClass('s123-calendar-handler-input'); 2914 that.$fakeInput.off('click').on('click', function () { 2915 that.showPopUp(); 2916 }); 2917 that.$fakeInputIcon.off('click').on('click', function () { 2918 that.showPopUp(); 2919 }); 2920 }; 2921 that.showPopUp = function () { 2922 var title = ''; 2923 var $message = that.getMessageBody(); 2924 switch (that.type) { 2925 case 'datePicker': 2926 that.$calendar = that.getCalendar(); 2927 $message.find('.date-picker-container').append(that.$calendar); 2928 break; 2929 case 'timePicker': 2930 that.$time = that.getTime(); 2931 $message.find('.time-picker-container').append(that.$time); 2932 break; 2933 case 'dateTimePicker': 2934 that.$calendar = that.getCalendar(); 2935 that.$time = that.getTime(); 2936 $message.find('.date-picker-container').append(that.$calendar); 2937 $message.find('.time-picker-container').append(that.$time); 2938 break; 2939 } 2940 var buttons = { 2941 confirm: { 2942 label: translations.popupButtonSelected, 2943 className: 'confirm-selection btn btn-success', 2944 callback: function () { 2945 if (!that.onSubmit) return; 2946 switch (that.type) { 2947 case 'timePicker': 2948 that.onSubmit.call($modal, that.$time.val()); 2949 break; 2950 case 'dateTimePicker': 2951 var selectedDate = that.$calendar.datepicker('getDate'); 2952 if (!selectedDate) selectedDate = new Date(); 2953 var dayObj = dayjs(selectedDate); 2954 selectedDate = dayObj.format(that.calendarSettings.format); 2955 that.onSubmit.call($modal, selectedDate, that.$time.val()); 2956 break; 2957 } 2958 } 2959 } 2960 } 2961 if (that.type == 'datePicker') buttons = ''; 2962 var $modal = bootbox.dialog({ 2963 title: that.title, 2964 message: $message, 2965 className: `s123-calendar-handler ${that.customClass}`, 2966 size: that.type == 'timePicker' ? 'small' : 'medium', 2967 closeButton: true, 2968 backdrop: true, 2969 show: false, 2970 buttons: buttons, 2971 onEscape: function () {}, 2972 callback: function () {} 2973 }) 2974 .on('show.bs.modal', function () { 2975 that.loadDateAndTimeFromInput(); 2976 }); 2977 $modal.find('.modal-header').addClass('background-primary-color btn-primary-text-color'); 2978 $modal.find('.modal-header .bootbox-close-button').addClass('btn-primary-text-color'); 2979 if (that.type == 'datePicker') { 2980 that.datePickerSubmit(that.$calendar, $modal); 2981 } 2982 $modal.modal('show'); 2983 }; 2984 that.loadDateAndTimeFromInput = function () { 2985 if (that.$hiddenInput.val().length === 0) return; 2986 switch (that.type) { 2987 case 'datePicker': 2988 that.$calendar.datepicker('setDates', new Date(that.getDateAsIso(that.$hiddenInput.val()))); 2989 break; 2990 case 'timePicker': 2991 that.$time.val(that.$hiddenInput.val()); 2992 break; 2993 case 'dateTimePicker': 2994 var dateAndTime = that.$hiddenInput.val().split(' '); 2995 that.$calendar.datepicker('setDates', new Date(that.getDateAsIso(dateAndTime[0])
2995)); 2996 that.$time.val(dateAndTime[1]); 2997 break; 2998 } 2999 }; 3000 that.getCalendar = function () { 3001 var $calendar = $('<div></div>'); 3002 $.fn.datepicker.dates[that.calendarSettings.language] = that.getCalendarTranslations(); 3003 if (that.calendarSettings.language == 'he' || that.calendarSettings.language == 'ar') { 3004 $.fn.datepicker.dates[that.calendarSettings.language].rtl = true; 3005 } 3006 $calendar.datepicker({ 3007 format: that.calendarSettings.format, 3008 weekStart: that.calendarSettings.weekStart, 3009 todayBtn: that.calendarSettings.todayBtn, 3010 clearBtn: that.calendarSettings.clearBtn, 3011 language: that.calendarSettings.language, 3012 startDate: that.calendarSettings.startDate, 3013 daysOfWeekDisabled: that.calendarSettings.daysOfWeekDisabled, 3014 todayHighlight: that.calendarSettings.todayHighlight 3015 }); 3016 return $calendar; 3017 }; 3018 that.getTime = function () { 3019 var $time = $('<select class="clock form-control"></select>'); 3020 var settings = { 3021 hours: { 3022 start: 0, 3023 end: 23, 3024 steps: 1 3025 }, 3026 minutes: { 3027 start: 0, 3028 end: 59, 3029 steps: 15 3030 } 3031 } 3032 for (var hours = settings.hours.start; hours <= settings.hours.end; hours += settings.hours.steps) { 3033 for (var minutes = settings.minutes.start; minutes <= settings.minutes.end; minutes += settings.minutes.steps) { 3034 var tmpH = hours < 10 ? '0' + hours : hours; 3035 var tmpM = minutes < 10 ? '0' + minutes : minutes; 3036 var selected = (hours == 8 && minutes == 0) ? 'selected' : ''; 3037 $time.append('<option ' + selected + ' value="' + tmpH + ':' + tmpM + '">' + tmpH + ':' + tmpM + '</option>'); 3038 } 3039 } 3040 return $time; 3041 }; 3042 that.getMessageBody = function () { 3043 var html = ''; 3044 html += '<div class="row calendar-handler-container">'; 3045 switch (that.type) { 3046 case 'datePicker': 3047 html += '<div class="col-xs-12 date-picker-container"></div>'; 3048 break; 3049 case 'timePicker': 3050 html += '<div class="col-xs-12 set-item-to-center">'; 3051 html += '<div class="time-picker-container"></div>'; 3052 html += '</div>'; 3053 break; 3054 case 'dateTimePicker': 3055 html += '<div class="col-xs-12 calendar-handler-time">'; 3056 html += '<div class="row">'; 3057 html += '<div class="col-xs-12 time-picker-title">'; 3058 html += '<label>' + translations.chooseTime + '</label>'; 3059 html += '</div>'; 3060 html += '<div class="col-xs-12 time-picker-container"></div>'; 3061 html += '</div>'; 3062 html += '</div>'; 3063 html += '<div class="col-xs-12 calendar-handler-date">'; 3064 html += '<div class="row">'; 3065 html += '<div class="col-xs-12 date-picker-container"></div>'; 3066 html += '</div>'; 3067 html += '</div>'; 3068 break; 3069 } 3070 html += '</div>'; 3071 return $(html); 3072 }; 3073 that.getDatePickerSupportedFormat = function (format) { 3074 return format == 'd/m/Y' ? 'DD/MM/YYYY' : 'MM/DD/YYYY'; 3075 }; 3076 that.getDateAsIso = function (date) { 3077 switch (that.calendarSettings.format) { 3078 case 'MM/DD/YYYY': 3079 date = dayjs(date).format("YYYY-MM-DD"); 3080 break; 3081 case 'DD/MM/YYYY': 3082 var newdate = date.split("/").reverse().join("-"); 3083 date = dayjs(newdate).format("YYYY-MM-DD"); 3084 break; 3085 } 3086 return date; 3087 }; 3088 that.datePickerSubmit = function (calendar, modal) { 3089 calendar.off('changeDate').on('changeDate', function (ev) { 3090 if (!that.onSubmit) return; 3091 var selectedDate = calendar.datepicker('getDate'); 3092 if (!selectedDate) selectedDate = new Date(); 3093 var dayObj = dayjs(selectedDate); 3094 selectedDate = dayObj.format(that.calendarSettings.format); 3095 that.onSubmit.call(modal, selectedDate); 3096 modal.modal('hide'); 3097 }); 3098 }; 3099 that.getCalendarTranslations = function () { 3100 return { 3101 days: [translations.calendarHandler.days.sunday, translations.calendarHandler.days.monday, translations.calendarHandler.days.tuesday, translations.calendarHandler.days.wednesday, translations.calendarHandler.days.thursday, translations.calendarHandler.days.friday, translations.calendarHandler.days.saturday], 3102 daysShort: [translations.calendarHandler.daysShort.sun, translations.calendarHandler.daysShort.mon, translations.calendarHandler.daysShort.tue, translations.calendarHandler.daysShort.wed, translations.calendarHandler.daysShort.thu, translations.calendarHandler.daysShort.fri, translations.calendarHandler.daysShort.sat, ], 3103 daysMin: [translations.calendarHandler.daysMin.su, translations.calendarHandler.daysMin.mo, translations.calendarHandler.daysMin.tu, translations.calendarHandler.daysMin.we, translations.calendarHandler.daysMin.th, translations.calendarHandler.daysMin.fr, translations.calendarHandler.daysMin.sa, ], 3104 months: [translations.calendarHandler.months.january, translations.calendarHandler.months.february, translations.calendarHandler.months.march, translations.calendarHandler.months.april, translations.calendarHandler.months.may, translations.calendarHandler.months.june, translations.calendarHandler.months.july, translations.calendarHandler.months.august, translations.calendarHandler.months.september, translations.calendarHandler.months.october, translations.calendarHandler.months.november, translations.calendarHandler.months.december], 3105 monthsShort: [translations.calendarHandler.monthsShort.jan, translations.calendarHandler.monthsShort.feb, translations.calendarHandler.monthsShort.mar, translations.calendarHandler.monthsShort.apr, translations.calendarHandler.monthsShort.may, translations.calendarHandler.monthsShort.jun, translations.calendarHandler.monthsShort.jul, translations.calendarHandler.monthsShort.aug, translations.calendarHandler.monthsShort.sep, translations.calendarHandler.monthsShort.oct, translations.calendarHandler.monthsShort.nov, translations.calendarHandler.monthsShort.dec], 3106 today: translations.calendarHandler.today,
3107 clear: translations.calendarHandler.clear, 3108 titleFormat: 'MM yyyy', 3109 }; 3110 }; 3111} 3112 3113function CalendarWidget(settings) { 3114 var that = this; 3115 that.init = function () { 3116 that.maxShiftsAmount = settings.maxShiftsAmount ? settings.maxShiftsAmount : 3; 3117 that.$fakeInput = settings.$fakeInput; 3118 that.$hiddenInput = settings.$hiddenInput; 3119 that.$fakeInputIcon = settings.$fakeInputIcon; 3120 that.type = settings.type; 3121 that.title = settings.title; 3122 that.calendarSettings = settings.calendarSettings; 3123 that.onInit = settings.onInit; 3124 that.onSubmit = settings.onSubmit; 3125 that.customClass = settings.customClass ? settings.customClass : ''; 3126 that.hoursInputSettings = settings.hoursInputSettings ? settings.hoursInputSettings : false; 3127 that.moduleID = settings.moduleID ? settings.moduleID : false; 3128 that.moduleTypeNUM = settings.moduleTypeNUM ? settings.moduleTypeNUM : false; 3129 that.isAdmin = settings.isAdmin ? settings.isAdmin : false; 3130 that.$rootContainer = $('#ch-' + that.moduleID); 3131 that.calendarModalParent = settings.calendarModalParent ? settings.calendarModalParent : window; 3132 if (that.$fakeInput.length === 0) return; 3133 that.addPluginAbilityToInput(); 3134 if (that.calendarSettings) { 3135 if (that.calendarSettings.businessHours) { 3136 initializeBusinessHours(); 3137 } 3138 that.calendarSettings.originalFormat = that.calendarSettings.format; 3139 that.calendarSettings.format = that.getDatePickerSupportedFormat(settings.calendarSettings.format); 3140 if (that.calendarSettings.startDate) { 3141 var dayObj = dayjs(new Date(that.calendarSettings.startDate)); 3142 dayObj = dayObj.format(that.calendarSettings.format); 3143 that.$fakeInput.html(dayObj); 3144 that.$hiddenInput.val(dayObj); 3145 } 3146 if (that.hoursInputSettings) { 3147 that.HoursInput.init({ 3148 calendarSettings: that.calendarSettings, 3149 hoursInputSettings: that.hoursInputSettings, 3150 moduleID: that.moduleID, 3151 moduleTypeNUM: that.moduleTypeNUM, 3152 onInit: function () { 3153 if (that.onInit) that.onInit.call(this); 3154 } 3155 }); 3156 } else { 3157 if (that.onInit) that.onInit.call(this); 3158 } 3159 } else { 3160 if (that.onInit) that.onInit.call(this); 3161 } 3162 that.$rootContainer.find('.c-h-widget').removeClass('hidden'); 3163 }; 3164 that.setDate = function (date) { 3165 var dayObj = dayjs(date); 3166 dayObj = dayObj.format(that.calendarSettings.format); 3167 that.$fakeInput.html(dayObj); 3168 that.$hiddenInput.val(dayObj); 3169 }; 3170 that.addPluginAbilityToInput = function () { 3171 that.$fakeInput.addClass('s123-calendar-handler-widget-input'); 3172 that.$fakeInput.off('click').on('click', function () { 3173 that.showPopUp(); 3174 }); 3175 that.$fakeInputIcon.off('click').on('click', function () { 3176 that.showPopUp(); 3177 }); 3178 }; 3179 that.showPopUp = function () { 3180 if (that.isShown) return; 3181 var title = ''; 3182 var $message = that.getMessageBody(); 3183 switch (that.type) { 3184 case 'datePicker': 3185 that.$calendar = that.getCalendar(); 3186 $message.find('.date-picker-container').append(that.$calendar); 3187 break; 3188 case 'timePicker': 3189 that.$time = that.getTime(); 3190 $message.find('.time-picker-container').append(that.$time); 3191 break; 3192 case 'dateTimePicker': 3193 that.$calendar = that.getCalendar(); 3194 that.$time = that.getTime(); 3195 $message.find('.date-picker-container').append(that.$calendar); 3196 $message.find('.time-picker-container').append(that.$time); 3197 break; 3198 } 3199 var buttons = { 3200 confirm: { 3201 label: translations.popupButtonSelected, 3202 className: 'confirm-selection btn btn-success', 3203 callback: function () { 3204 if (!that.onSubmit) return; 3205 switch (that.type) { 3206 case 'timePicker': 3207 that.onSubmit.call($modal, that.$time.val()); 3208 if (that.hoursInputSettings) that.HoursInput.refreshBusinessHours(); 3209 break; 3210 case 'dateTimePicker': 3211 var selectedDate = that.$calendar.datepicker('getDate'); 3212 if (!selectedDate) selectedDate = new Date(); 3213 var dayObj = dayjs(selectedDate); 3214 selectedDate = dayObj.format(that.calendarSettings.format); 3215 that.onSubmit.call($modal, selectedDate, that.$time.val()); 3216 if (that.hoursInputSettings) that.HoursInput.refreshBusinessHours(); 3217 break; 3218 } 3219 } 3220 } 3221 } 3222 if (that.type == 'datePicker') buttons = ''; 3223 var $modal = that.calendarModalParent.bootbox.dialog({ 3224 title: that.title, 3225 message: $message, 3226 className: `s123-calendar-handler-widget ${that.customClass}`, 3227 size: that.type == 'timePicker' ? 'small' : 'medium', 3228 closeButton: true, 3229 backdrop: true, 3230 show: false, 3231 buttons: buttons, 3232 onEscape: function () {}, 3233 callback: function () {} 3234 }) 3235 .on('show.bs.modal', function () { 3236 that.loadDateAndTimeFromInput(); 3237 that.isShown = true; 3238 }) 3239 .on('hide.bs.modal', function () { 3240 that.isShown = false;
3241 }); 3242 $modal.find('.modal-header').addClass('background-primary-color btn-primary-text-color'); 3243 $modal.find('.modal-header .bootbox-close-button').addClass('btn-primary-text-color'); 3244 if (that.isAdmin) { 3245 $modal.find('.modal-header .bootbox-close-button').click(function () { 3246 $modal.modal('hide'); 3247 }); 3248 } 3249 if (that.type == 'datePicker') { 3250 that.datePickerSubmit(that.$calendar, $modal); 3251 } 3252 $modal.modal('show'); 3253 }; 3254 that.loadDateAndTimeFromInput = function () { 3255 if (that.$hiddenInput.val().length === 0) return; 3256 switch (that.type) { 3257 case 'datePicker': 3258 that.$calendar.datepicker('setDates', new Date(that.getDateAsIso(that.$hiddenInput.val()))); 3259 break; 3260 case 'timePicker': 3261 that.$time.val(that.$hiddenInput.val()); 3262 break; 3263 case 'dateTimePicker': 3264 var dateAndTime = that.$hiddenInput.val().split(' '); 3265 that.$calendar.datepicker('setDates', new Date(that.getDateAsIso(dateAndTime[0]))); 3266 that.$time.val(dateAndTime[1]); 3267 break; 3268 } 3269 }; 3270 that.getCalendar = function () { 3271 var $calendar = $('<div></div>'); 3272 $.fn.datepicker.dates[that.calendarSettings.language] = that.getCalendarTranslations(); 3273 if (that.calendarSettings.language == 'he' || that.calendarSettings.language == 'ar') { 3274 $.fn.datepicker.dates[that.calendarSettings.language].rtl = true; 3275 } 3276 if (that.calendarSettings.autoDisableWeekDays) { 3277 var disabledDays = ''; 3278 if (that.calendarSettings.availability != 'fullTime') { 3279 var total = that.calendarSettings.businessHours.length; 3280 $.each(that.calendarSettings.businessHours, function (index) { 3281 if (!that.calendarSettings.businessHours[index].isActive) { 3282 if (that.calendarSettings.weekStart == 0) { 3283 disabledDays += index; 3284 } else { 3285 disabledDays += (index + 1) % 7; 3286 } 3287 if (index < (total - 1)) { 3288 disabledDays += ','; 3289 } 3290 } 3291 }); 3292 } 3293 if (disabledDays.slice(-1) === ',') { 3294 disabledDays = disabledDays.slice(0, disabledDays.length - 1); 3295 } 3296 that.calendarSettings.daysOfWeekDisabled = disabledDays; 3297 } 3298 $calendar.datepicker({ 3299 format: that.calendarSettings.format, 3300 weekStart: that.calendarSettings.weekStart, 3301 todayBtn: that.calendarSettings.todayBtn, 3302 clearBtn: that.calendarSettings.clearBtn, 3303 language: that.calendarSettings.language, 3304 startDate: that.calendarSettings.startDate, 3305 daysOfWeekDisabled: that.calendarSettings.daysOfWeekDisabled, 3306 todayHighlight: that.calendarSettings.todayHighlight 3307 }); 3308 return $calendar; 3309 }; 3310 that.getTime = function () { 3311 var $time = $('<select class="clock form-control"></select>'); 3312 var settings = { 3313 hours: { 3314 start: 0, 3315 end: 23, 3316 steps: 1 3317 }, 3318 minutes: { 3319 start: 0, 3320 end: 59, 3321 steps: 15 3322 } 3323 } 3324 for (var hours = settings.hours.start; hours <= settings.hours.end; hours += settings.hours.steps) { 3325 for (var minutes = settings.minutes.start; minutes <= settings.minutes.end; minutes += settings.minutes.steps) { 3326 var tmpH = hours < 10 ? '0' + hours : hours; 3327 var tmpM = minutes < 10 ? '0' + minutes : minutes; 3328 var selected = (hours == 8 && minutes == 0) ? 'selected' : ''; 3329 $time.append('<option ' + selected + ' value="' + tmpH + ':' + tmpM + '">' + tmpH + ':' + tmpM + '</option>'); 3330 } 3331 } 3332 return $time; 3333 }; 3334 that.getMessageBody = function () { 3335 var html = ''; 3336 html += `<link rel="stylesheet" type="text/css" href="${$GLOBALS["cdn-system-files"]}/files/vendor/site123/calendarHandler/css/calendarHandlerWidget.css?v=${$GLOBALS['v-cache']}" crossorigin="anonymous">`; 3337 html += '<div class="row calendar-handler-container">'; 3338 switch (that.type) { 3339 case 'datePicker': 3340 html += '<div class="col-xs-12 date-picker-container"></div>'; 3341 break; 3342 case 'timePicker': 3343 html += '<div class="col-xs-12 set-item-to-center">'; 3344 html += '<div class="time-picker-container"></div>'; 3345 html += '</div>'; 3346 break; 3347 case 'dateTimePicker': 3348 html += '<div class="col-xs-12 calendar-handler-time">'; 3349 html += '<div class="row">'; 3350 html += '<div class="col-xs-12 time-picker-title">'; 3351 html += '<label>' + translations.chooseTime + '</label>'; 3352 html += '</div>'; 3353 html += '<div class="col-xs-12 time-picker-container"></div>'; 3354 html += '</div>'; 3355 html += '</div>'; 3356 html += '<div class="col-xs-12 calendar-handler-date">'; 3357 html += '<div class="row">'; 3358 html += '<div class="col-xs-12 date-picker-container"></div>'; 3359 html += '</div>'; 3360 html += '</div>'; 3361 break; 3362 } 3363 html += '</div>'; 3364 return $(html); 3365 }; 3366 that.getDatePickerSupportedFormat = function (format) { 3367 return format == 'd/m/Y' ? 'DD/MM/YYYY' : 'MM/DD/YYYY'; 3368 }; 3369 that.getDateAsIso = function (date) { 3370 switch (that.calendarSettings.format) { 3371 case 'MM/DD/YYYY': 3372 date = dayjs(date).format("YYYY-MM-DD"); 3373 break; 3374 case 'DD/MM/YYYY': 3375 var newdate = date.split("/").reverse().join("-"); 3376 date = dayjs(newdate).format("YYYY-MM-DD"); 3377 break; 3378 } 3379 return date; 3380 }; 3381 that.datePickerSubmit = function (calendar, modal) { 3382 calendar.off('changeDate').on('changeDate', function (ev) { 3383 if (!that.onSubmit) return; 3384 var selectedDate = calendar.datepicker('getDate'); 3385 if (!selectedDate) selectedDate = new Date(); 3386 var dayObj = dayjs(selectedDate); 3387 selectedDate = dayObj.format(that.calendarSettings.format); 3388 that.onSubmit.call(modal, selectedDate); 3389 if (that.hoursInputSettings) that.HoursInput.refreshBusinessHours(); 3390 modal.modal('hide'); 3391 }); 3392 }; 3393 that.getCalendarTranslations = function () { 3394 return { 3395 days: [translations.calendarHandler.days.sunday, translations.calendarHandler.days.monday, translations.calendarHandler.days.tuesday, translations.calendarHandler.days.wednesday, translations.calendarHandler.days.thursday, translations.calendarHandler.days.friday, translations.calendarHandler.days.saturday], 3396 daysShort: [translations.calendarHandler.daysShort.sun, translations.calendarHandler.daysShort.mon, translations.calendarHandler.daysShort.tue, translations.calendarHandler.daysShort.wed, translations.calendarHandler.daysShort.thu, translations.calendarHandler.daysShort.fri, translations.calendarHandler.daysShort.sat, ], 3397 daysMin: [translations.calendarHandler.daysMin.su, translations.calendarHandler.daysMin.mo, translations.calendarHandler.daysMin.tu, translations.calendarHandler.daysMin.we, translations.calendarHandler.daysMin.th, translations.calendarHandler.daysMin.fr, translations.calendarHandler.daysMin.sa, ], 3398 months: [translations.calendarHandler.months.january, translations.calendarHandler.months.february, translations.calendarHandler.months.march, translations.calendarHandler.months.april, translations.calendarHandler.months.may, translations.calendarHandler.months.june, translations.calendarHandler.months.july, translations.calendarHandler.months.august, translations.calendarHandler.months.september, translations.calendarHandler.months.october, translations.calendarHandler.months.november, translations.calendarHandler.months.december], 3399 monthsShort: [translations.calendarHandler.monthsShort.jan, translations.calendarHandler.monthsShort.feb, translations.calendarHandler.monthsShort.mar, translations.calendarHandler.monthsShort.apr, translations.calendarHandler.monthsShort.may, translations.calendarHandler.monthsShort.jun, translations.calendarHandler.monthsShort.jul, translations.calendarHandler.monthsShort.aug, translations.calendarHandler.monthsShort.sep, translations.calendarHandler.monthsShort.oct, translations.calendarHandler.monthsShort.nov, translations.calendarHandler.monthsShort.dec], 3400 today: translations.calendarHandler.today,
3401 clear: translations.calendarHandler.clear, 3402 titleFormat: 'MM yyyy', 3403 }; 3404 }; 3405 that.getInActiveDays = function () { 3406 return that.inActiveDays; 3407 }; 3408 that.isUnAvalible = function () { 3409 return that.inActiveDays == 7 || that.calendarSettings.availability == 'unavailable'; 3410 }; 3411 that.showUnavailableMsg = function () { 3412 that.$rootContainer.find('.c-h-widget').addClass('hidden'); 3413 that.$rootContainer.find('.c-h-note-container').removeClass('hidden'); 3414 }; 3415 that.getSelectedDateTime = function () { 3416 var date = that.$rootContainer.find('.real-input.c-h-input').val(); 3417 date = changeDateFormat('YYYY-mm-DD ' + that.calendarSettings.originalFormat, date); 3418 return dayjs(date + ' ' + that.$rootContainer.find('.service-hour').val()).format("YYYY-MM-DD HH:mm:ss"); 3419 }; 3420 that.getSelectedHour = function () { 3421 return that.$rootContainer.find('.service-hour').val(); 3422 }; 3423 that.getSelectedDate = function (formatDate) { 3424 var date = that.$rootContainer.find('.real-input.c-h-input').val(); 3425 if (formatDate) { 3426 date = changeDateFormat('YYYY-mm-DD ' + that.calendarSettings.originalFormat, date); 3427 } 3428 return date; 3429 }; 3430 3431 function initializeBusinessHours() { 3432 that.inActiveDays = 0; 3433 if (that.calendarSettings.availability == 'custom') { 3434 $.each(that.calendarSettings.businessHours, function (index, dayOfWeek) { 3435 if (!dayOfWeek.isActive) { 3436 that.inActiveDays++; 3437 } 3438 }); 3439 } 3440 if (that.calendarSettings.availability == 'custom') { 3441 $.each(that.calendarSettings.businessHours, function (index, day) { 3442 let lastShift = getLastActiveShift(day); 3443 var startShift = lastShift.start.name; 3444 var endShift = lastShift.end.name; 3445 if (that.calendarSettings.businessHours[index].isActive && !day.hasNoShifts && day[endShift] <= day[startShift]) { 3446 var startHour = parseInt(day[startShift].substring(0, 2)); 3447 var startMin = day[startShift].substring(3, 5); 3448 var endHour = parseInt(day[endShift].substring(0, 2)); 3449 var endMin = day[endShift].substring(3, 5); 3450 that.calendarSettings.businessHours[index][endShift] = '23:59'; 3451 var dayIndex = (index + 1); 3452 if (index == 6) { 3453 dayIndex = 0; 3454 } 3455 if (endHour < 10) endHour = '0' + endHour.toString(); 3456 that.calendarSettings.businessHours[dayIndex].startTime0 = '00:' + startMin; 3457 that.calendarSettings.businessHours[dayIndex].endTime0 = endHour + ':' + endMin; 3458 if (!that.calendarSettings.businessHours[dayIndex].isActive) { 3459 that.calendarSettings.businessHours[dayIndex].isActive = true; 3460 that.calendarSettings.businessHours[dayIndex].startTime1 = ''; 3461 that.calendarSettings.businessHours[dayIndex].endTime1 = ''; 3462 that.calendarSettings.businessHours[dayIndex].startTime2 = ''; 3463 that.calendarSettings.businessHours[dayIndex].endTime2 = ''; 3464 that.calendarSettings.businessHours[dayIndex].startTime3 = ''; 3465 that.calendarSettings.businessHours[dayIndex].endTime3 = ''; 3466 that.calendarSettings.businessHours[dayIndex].hasNoShifts = true; 3467 } 3468 } 3469 }); 3470 } else if (that.calendarSettings.availability == 'fullTime') { 3471 $.each(that.calendarSettings.businessHours, function (index, weekday) { 3472 weekday.isActive = true; 3473 weekday.startTime1 = '00:00'; 3474 weekday.endTime1 = '24:00'; 3475 weekday.startTime2 = ''; 3476 weekday.endTime2 = ''; 3477 weekday.startTime3 = ''; 3478 weekday.endTime3 = ''; 3479 }); 3480 } 3481 } 3482 3483 function getLastActiveShift(day) { 3484 var businessDay = JSON.parse(JSON.stringify(day)); 3485 delete businessDay.isActive; 3486 delete businessDay.startTime0; 3487 delete businessDay.endTime0; 3488 let lastShift = { 3489 start: { 3490 name: '', 3491 value: '' 3492 }, 3493 end: { 3494 name: '', 3495 value: '' 3496 } 3497 }; 3498 let numberOfShifts = (Object.keys(businessDay).length) / 2; 3499 for (let i = numberOfShifts; i >= 0; i--) { 3500 if (businessDay[`startTime${i}`] !== "" && businessDay[`endTime${i}`] !== "") { 3501 lastShift.start.name = `startTime${i}`; 3502 lastShift.start.value = businessDay[`startTime${i}`]; 3503 lastShift.end.name = `endTime${i}`; 3504 lastShift.end.value = businessDay[`endTime${i}`]; 3505 break; 3506 } 3507 } 3508 return lastShift; 3509 } 3510 3511 function changeDateFormat(websiteDateFormat, date) { 3512 switch (websiteDateFormat) { 3513 case 'YYYY-mm-DD m/d/Y': 3514 return dayjs(date).format("YYYY-MM-DD"); 3515 break; 3516 case 'YYYY-mm-DD d/m/Y': 3517 var newdate = date.split("/").reverse().join("-"); 3518 return dayjs(newdate).format("YYYY-MM-DD"); 3519 break; 3520 } 3521 } 3522 that.HoursInput = function () { 3523 var _ = { 3524 isInitialized: false, 3525 calendarSettings: {}, 3526 onInit: false, 3527 onHoursLoad: false, 3528 onHoursChage: false, 3529 $input: null, 3530 moduleID: null, 3531 moduleTypeNUM: null, 3532 }; 3533 _.init = function (settings) { 3534 _.onInit = settings.onInit; 3535 _.moduleID = settings.moduleID; 3536 _.moduleTypeNUM = settings.moduleTypeNUM; 3537 _.calendarSettings = settings.calendarSettings; 3538 _.$form = settings.hoursInputSettings.$form; 3539 _.onHoursLoad = settings.hoursInputSettings.onHoursLoad; 3540 _.onHoursChage = settings.hoursInputSettings.onHoursChage; 3541 _.serviceType = settings.hoursInputSettings.serviceType; 3542 _.maxParticipants = settings.hoursInputSettings.maxParticipants; 3543 _.timeInterval = settings.hoursInputSettings.timeInterval; 3544 _.$rootContainer = $('#ch-' + _.moduleID); 3545 _.serviceDuration = _.$rootContainer.find('.serviceDuration').val(); 3546 _.timeBetweenService = _.$rootContainer.find('.timeBetweenService').val(); 3547 _.$serviceDatesContainer = _.$rootContainer.find('.serviceDatesContainer'); 3548 _.$serviceHourContainer = _.$rootContainer.find('.serviceHourContainer'); 3549 _.$tableHour = _.$rootContainer.find('.service-hour');
3550 _.$input = _.$rootContainer.find('.real-input.c-h-input'); 3551 _.refreshBusinessHours(); 3552 }; 3553 _.refreshBusinessHours = function () { 3554 var $input = _.$input; 3555 var selectedDate = $input.val(); 3556 selectedDate = changeDateFormat('YYYY-mm-DD ' + _.calendarSettings.originalFormat, selectedDate); 3557 var today = new Date(selectedDate); 3558 var lastDateOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0, 23, 59, 59); 3559 lastDateOfMonth = getDateFormat(lastDateOfMonth) + ' ' + getHourFromDate(lastDateOfMonth); 3560 _.$tableHour.empty(); 3561 if (_.moduleTypeNUM == 96) { 3562 $.ajax({ 3563 url: '/versions/2/wizard/modules/scheduleBooking/get-scheduled-orders.php', 3564 method: 'post', 3565 data: _.$form.serialize() + '&selectedDate=' + encodeURIComponent(selectedDate) + '&lastDateOfMonth=' + encodeURIComponent(lastDateOfMonth) + '&cartType=' + encodeURIComponent(_.moduleTypeNUM) + '&serviceTimeInterval=' + encodeURIComponent(_.timeInterval), 3566 }) 3567 .done(function (data) { 3568 data = tryParseJSON(data); 3569 _.$serviceDatesContainer.data('corrent-time', data.userTime); 3570 buildHourSelectBox(); 3571 removeUnavailableHours(data.orders); 3572 if (_.$tableHour.text().length <= 0) { 3573 _.$tableHour.addClass('hidden'); 3574 _.$serviceHourContainer.find('.no-time-available').removeClass('hidden'); 3575 } else { 3576 _.$tableHour.removeClass('hidden'); 3577 _.$serviceHourContainer.find('.no-time-available').addClass('hidden'); 3578 } 3579 if (!_.isInitialized) { 3580 if (_.onInit) _.onInit.call(this); 3581 _.isInitialized = true; 3582 } 3583 if (_.onHoursLoad) _.onHoursLoad.call(this, _.$tableHour); 3584 }); 3585 } else { 3586 buildHourSelectBox(); 3587 if (!_.isInitialized) { 3588 if (_.onInit) _.onInit.call(this); 3589 _.isInitialized = true; 3590 } 3591 if (_.onHoursLoad) _.onHoursLoad.call(this, _.$tableHour); 3592 } 3593 3594 function getHourFromDate(DateChoosed) { 3595 var hourFormat = DateChoosed; 3596 var hours = hourFormat.getHours(); 3597 if (hours < 10) hours = '0' + hours; 3598 var minutes = hourFormat.getMinutes(); 3599 if (minutes < 10) minutes = '0' + minutes; 3600 miliSeconds = hourFormat.getMilliseconds(); 3601 if (miliSeconds < 10) miliSeconds = '0' + miliSeconds; 3602 return hours + ':' + minutes + ':' + miliSeconds; 3603 } 3604 3605 function removeUnavailableHours(unavailableHours) { 3606 var selectedDate = _.$input.val(); 3607 selectedDate = changeDateFormat('YYYY-mm-DD ' + _.calendarSettings.originalFormat, selectedDate); 3608 var serviceDurationHour = _.serviceDuration.substring(0, 2); 3609 var serviceDurationMin = _.serviceDuration.substring(3, 5); 3610 var timeBetweenService = parseInt(_.timeBetweenService) * 60 * 1000; 3611 var serviceDurationHourMili = parseInt(serviceDurationHour) * 60 * 60 * 1000; 3612 var serviceDurationMinutesMili = parseInt(serviceDurationMin) * 60 * 1000; 3613 var serviceDurationInMili = serviceDurationHourMili + serviceDurationMinutesMili + timeBetweenService; 3614 if (_.serviceType == 'Classes') { 3615 var hoursToRemove = new Array(); 3616 $.each(_.$tableHour.find('option'), function (index, option) { 3617 var schedualed = 0; 3618 var timeFromOption = dayjs(selectedDate + ' ' + option.value).valueOf(); 3619 var dateFromPage = dayjs(selectedDate + ' ' + option.value).format("YYYY-MM-DD HH:mm:ss"); 3620 $.each(unavailableHours, function (index, date) { 3621 if (date.isExternalCalendar && date.isAllDayEvent && selectedDate == dayjs(date.orderDate).format("YYYY-MM-DD")) { 3622 hoursToRemove.push(option.value); 3623 } else { 3624 if (dateFromPage.valueOf() == date.orderDate.valueOf()) { 3625 schedualed++; 3626 } 3627 if (schedualed >= _.maxParticipants) { 3628 var unavailableTime = dayjs(date.orderDate).valueOf(); 3629 if (timeFromOption == unavailableTime) { 3630 hoursToRemove.push(option.value); 3631 } 3632 } 3633 } 3634 }); 3635 }); 3636 for (var i = 0; i < hoursToRemove.length; i++) { 3637 var Hour = hoursToRemove[i].substring(0, 2); 3638 var Min = hoursToRemove[i].substring(3, 5); 3639 Hour = parseInt(Hour) * 60 * 60 * 1000; 3640 Min = parseInt(Min) * 60 * 1000; 3641 var unavailableTime = Hour + Min; 3642 $.each(_.$tableHour.find('option'), function (index, option) { 3643 Hour = option.value.substring(0, 2); 3644 Min = option.value.substring(3, 5); 3645 Hour = parseInt(Hour) * 60 * 60 * 1000; 3646 Min = parseInt(Min) * 60 * 1000; 3647 var timeFromOption = Hour + Min; 3648 if ((timeFromOption >= unavailableTime && timeFromOption < (unavailableTime + serviceDurationInMil
3648i)) || 3649 (timeFromOption > (unavailableTime - serviceDurationInMili) && timeFromOption < unavailableTime)) { 3650 $(option).remove(); 3651 } 3652 }); 3653 } 3654 } else { 3655 $.each(unavailableHours, function (index, date) { 3656 let orderDate = dayjs(date.orderDate).valueOf(); 3657 let serviceDuration = serviceDurationInMili; 3658 if (date.isExternalCalendar) { 3659 serviceDuration = dayjs(date.endOrderDate).valueOf() - orderDate; 3660 } 3661 $.each(_.$tableHour.find('option'), function (index, option) { 3662 var timeFromOption = dayjs(selectedDate + ' ' + option.value).valueOf(); 3663 if ((timeFromOption >= orderDate && timeFromOption < (orderDate + serviceDuration)) || (timeFromOption > (orderDate - serviceDuration) && timeFromOption < orderDate)) { 3664 $(option).remove(); 3665 } 3666 }); 3667 }); 3668 } 3669 } 3670 3671 function buildHourSelectBox() { 3672 var serviceDurationHour = _.serviceDuration.substring(0, 2); 3673 var serviceDurationHourMili = parseInt(serviceDurationHour) * 60 * 60 * 1000; 3674 var serviceDurationMin = _.serviceDuration.substring(3, 5); 3675 var serviceDurationMinutesMili = parseInt(serviceDurationMin) * 60 * 1000; 3676 var timeBetweenService = parseInt(_.timeBetweenService) * 60 * 1000; 3677 var serviceInterval = parseInt(_.timeInterval) * 60 * 1000; 3678 var dateFromCalendar = changeDateFormat('YYYY-mm-DD ' + _.calendarSettings.originalFormat, _.$input.val()); 3679 if (!dateFromCalendar) throw 'Missing date parameter'; 3680 for (var i = 0; i <= that.maxShiftsAmount; i++) { 3681 var dayOfWeek = dayjs(dateFromCalendar).day(); 3682 if (dayOfWeek == 0) { 3683 if (parseInt(_.calendarSettings.weekStart) == 1) { 3684 var dataIndex = 6; 3685 } else { 3686 var dataIndex = dayOfWeek; 3687 } 3688 } else { 3689 var dataIndex = dayOfWeek - parseInt(_.calendarSettings.weekStart); 3690 } 3691 var startTime = 'startTime' + i; 3692 var endTime = 'endTime' + i; 3693 startTime = _.calendarSettings.businessHours[dataIndex][startTime]; 3694 endTime = _.calendarSettings.businessHours[dataIndex][endTime]; 3695 if (startTime == '' || endTime == '' || !_.calendarSettings.businessHours[dataIndex].isActive) 3696 continue; 3697 var selectedDate = new Date(dateFromCalendar); 3698 if (getDateFormat(selectedDate) == getDateFormat(new Date()) && new Date().getTime() >= dayjs(dateFromCalendar + " " + startTime).valueOf()) { 3699 startTime = dayjs(dateFromCalendar + " " + _.$serviceDatesContainer.data('corrent-time')).valueOf(); 3700 } else { 3701 startTime = dayjs(dateFromCalendar + " " + startTime).valueOf(); 3702 } 3703 endTime = dayjs(dateFromCalendar + " " + endTime).valueOf(); 3704 for (; startTime <= (endTime - serviceDurationHourMili - serviceDurationMinutesMili - timeBetweenService); startTime += serviceInterval) { 3705 var newdate = new Date(startTime); 3706 var newHour = newdate.getHours(); 3707 var newMinutes = newdate.getMinutes(); 3708 if (newHour.toString().length == 1) 3709 newHour = '0' + newHour; 3710 if (newMinutes.toString().length == 1) 3711 newMinutes = '0' + newMinutes; 3712 var fullHour = newHour + ':' + newMinutes; 3713 var hourExists = false;
3714 $.each(_.$tableHour.find('option'), function (index) { 3715 $optionVal = $(this).val(); 3716 if ($optionVal == fullHour) { 3717 hourExists = true; 3718 return false; 3719 } 3720 }); 3721 if (!hourExists) _.$tableHour.append('<option value="' + newHour + ':' + newMinutes + '">' + changeTimeFormat(_.calendarSettings.timeFormat, newdate) + '</option>'); 3722 else continue; 3723 } 3724 } 3725 3726 function changeTimeFormat(websiteTimeFormat, date) { 3727 var dayObj = dayjs(date); 3728 if (websiteTimeFormat === 'H:i') { 3729 return dayObj.format('HH:mm'); 3730 } else if (websiteTimeFormat === 'h:i A') { 3731 return dayObj.format('hh:mm A'); 3732 } 3733 } 3734 _.$tableHour.off('change').on('change', function (event) { 3735 if (_.onHoursChage) _.onHoursChage.call(this, $(this).val()); 3736 }); 3737 } 3738 }; 3739 _.isServiceAvalible = function () { 3740 return _.$tableHour.find('option').length > 0; 3741 }; 3742 3743 function getDateFormat(DateChoosed) { 3744 var formattedDate = DateChoosed; 3745 var day = formattedDate.getDate(); 3746 if (day < 10) day = '0' + day; 3747 var month = (formattedDate.getMonth() + 1); 3748 if (month < 10) month = '0' + month; 3749 var year = formattedDate.getFullYear(); 3750 return year + '-' + month + '-' + day; 3751 } 3752 3753 function tryParseJSON(str) { 3754 try { 3755 var Obj = JSON.parse(str); 3756 if (Obj && typeof Obj === "object") { 3757 return Obj; 3758 } 3759 } catch (e) {} 3760 return false; 3761 } 3762 return _; 3763 }(); 3764 that.init(); 3765}(function (f) { 3766 if (typeof exports === "object" && typeof module !== "undefined") { 3767 module.exports = f() 3768 } else if (typeof define === "function" && define.amd) { 3769 define([], f) 3770 } else { 3771 var g; 3772 if (typeof window !== "undefined") { 3773 g = window 3774 } else if (typeof global !== "undefined") { 3775 g = global 3776 } else if (typeof self !== "undefined") { 3777 g = self 3778 } else { 3779 g = this 3780 } 3781 g.Pjax = f() 3782 } 3783})(function () { 3784 var define, module, exports; 3785 return function () { 3786 function r(e, n, t) { 3787 function o(i, f) { 3788 if (!n[i]) { 3789 if (!e[i]) { 3790 var c = "function" == typeof require && require; 3791 if (!f && c) return c(i, !0); 3792 if (u) return u(i, !0); 3793 var a = new Error("Cannot find module '" + i + "'"); 3794 throw a.code = "MODULE_NOT_FOUND", a 3795 } 3796 var p = n[i] = { 3797 exports: {} 3798 }; 3799 e[i][0].call(p.exports, function (r) { 3800 var n = e[i][1][r]; 3801 return o(n || r) 3802 }, p, p.exports, r, e, n, t) 3803 } 3804 return n[i].exports 3805 } 3806 for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) o(t[i]); 3807 return o 3808 } 3809 return r 3810 }()({ 3811 1: [function (require, module, exports) { 3812 var executeScripts = require("./lib/execute-scripts"); 3813 var forEachEls = require("./lib/foreach-els"); 3814 var parseOptions = require("./lib/parse-options"); 3815 var switches = require("./lib/switches"); 3816 var newUid = require("./lib/uniqueid"); 3817 var on = require("./lib/events/on"); 3818 var trigger = require("./lib/events/trigger"); 3819 var clone = require("./lib/util/clone"); 3820 var contains = require("./lib/util/contains"); 3821 var extend = require("./lib/util/extend"); 3822 var noop = require("./lib/util/noop"); 3823 var Pjax = function (options) { 3824 this.state = { 3825 numPendingSwitches: 0, 3826 href: null, 3827 options: null 3828 }; 3829 this.options = parseOptions(options); 3830 this.log("Pjax options", this.options); 3831 if (this.options.scrollRestoration && "scrollRestoration" in history) { 3832 history.scrollRestoration = "manual" 3833 } 3834 this.maxUid = this.lastUid = newUid(); 3835 this.parseDOM(document); 3836 on(window, "popstate", function (st) { 3837 if (st.state) { 3838 var opt = clone(this.options); 3839 opt.url = st.state.url;
vendor: 37,466 bytes, lines 3840-4618
3840 opt.title = st.state.title; 3841 opt.history = false; 3842 opt.scrollPos = st.state.scrollPos; 3843 if (st.state.uid < this.lastUid) { 3844 opt.backward = true 3845 } else { 3846 opt.forward = true 3847 } 3848 this.lastUid = st.state.uid; 3849 this.loadUrl(st.state.url, opt) 3850 } 3851 }.bind(this)) 3852 }; 3853 Pjax.switches = switches; 3854 Pjax.prototype = { 3855 log: require("./lib/proto/log"), 3856 getElements: function (el) { 3857 return el.querySelectorAll(this.options.elements) 3858 }, 3859 parseDOM: function (el) { 3860 var parseElement = require("./lib/proto/parse-element"); 3861 forEachEls(this.getElements(el), parseElement, this) 3862 }, 3863 refresh: function (el) { 3864 this.parseDOM(el || document) 3865 }, 3866 reload: function () { 3867 window.location.reload() 3868 }, 3869 attachLink: require("./lib/proto/attach-link"), 3870 attachForm: require("./lib/proto/attach-form"), 3871 forEachSelectors: function (cb, context, DOMcontext) { 3872 return require("./lib/foreach-selectors").bind(this)(this.options.selectors, cb, context, DOMcontext) 3873 }, 3874 switchSelectors: function (selectors, fromEl, toEl, options) { 3875 return require("./lib/switches-selectors").bind(this)(this.options.switches, this.options.switchesOptions, selectors, fromEl, toEl, options) 3876 }, 3877 latestChance: function (href) { 3878 window.location = href 3879 }, 3880 onSwitch: function () { 3881 trigger(window, "resize scroll"); 3882 this.state.numPendingSwitches--; 3883 if (this.state.numPendingSwitches === 0) { 3884 this.afterAllSwitches() 3885 } 3886 }, 3887 loadContent: function (html, options) { 3888 if (typeof html !== "string") { 3889 trigger(document, "pjax:complete pjax:error", options); 3890 return 3891 } 3892 var tmpEl = document.implementation.createHTMLDocument("pjax"); 3893 var htmlRegex = /<html[^>]+>/gi; 3894 var htmlAttribsRegex = /\s?[a-z:]+(?:=['"][^'">]+['"])*/gi; 3895 var matches = html.match(htmlRegex); 3896 if (matches && matches.length) { 3897 matches = matches[0].match(htmlAttribsRegex); 3898 if (matches.length) { 3899 matches.shift(); 3900 matches.forEach(function (htmlAttrib) { 3901 var attr = htmlAttrib.trim().split("="); 3902 if (attr.length === 1) { 3903 tmpEl.documentElement.setAttribute(attr[0], true) 3904 } else { 3905 tmpEl.documentElement.setAttribute(attr[0], attr[1].slice(1, -1)) 3906 } 3907 }) 3908 } 3909 } 3910 tmpEl.documentElement.innerHTML = html; 3911 this.log("load content", tmpEl.documentElement.attributes, tmpEl.documentElement.innerHTML.length); 3912 if (document.activeElement && contains(document, this.options.selectors, document.activeElement)) { 3913 try { 3914 document.activeElement.blur() 3915 } catch (e) {} 3916 } 3917 this.switchSelectors(this.options.selectors, tmpEl, document, options) 3918 }, 3919 abortRequest: require("./lib/abort-request"), 3920 doRequest: require("./lib/send-request"), 3921 handleResponse: require("./lib/proto/handle-response"), 3922 loadUrl: function (href, options) { 3923 options = typeof options === "object" ? extend({}, this.options, options) : clone(this.options); 3924 this.log("load href", href, options); 3925 this.abortRequest(this.request); 3926 trigger(document, "pjax:send", options); 3927 this.request = this.doRequest(href, options, this.handleResponse.bind(this)) 3928 }, 3929 afterAllSwitches: function () { 3930 var autofocusEl = Array.prototype.slice.call(document.querySelectorAll("[autofocus]")).pop(); 3931 if (autofocusEl && document.activeElement !== autofocusEl) { 3932 autofocusEl.focus() 3933 } 3934 this.options.selectors.forEach(function (selector) { 3935 forEachEls(document.querySelectorAll(selector), function (el) { 3936 executeScripts(el) 3937 }) 3938 }); 3939 var state = this.state; 3940 if (state.options.history) { 3941 if (!window.history.state) { 3942 this.lastUid = this.maxUid = newUid(); 3943 window.history.replaceState({ 3944 url: window.location.href, 3945 title: document.title, 3946 uid: this.maxUid, 3947 scrollPos: [0, 0] 3948 }, document.title) 3949 } 3950 this.lastUid = this.maxUid = newUid(); 3951 window.history.pushState({ 3952 url: state.href, 3953 title: state.options.title, 3954 uid: this.maxUid, 3955 scrollPos: [0, 0] 3956 }, state.options.title, state.href) 3957 } 3958 this.forEachSelectors(function (el) { 3959 this.parseDOM(el) 3960 }, this); 3961 trigger(document, "pjax:complete pjax:success", state.options); 3962 if (typeof state.options.analytics === "function") { 3963 state.options.analytics() 3964 } 3965 if (state.options.history) { 3966 var a = document.createElement("a"); 3967 a.href = this.state.href; 3968 if (a.hash) { 3969 var name = a.hash.slice(1); 3970 name = decodeURIComponent(name); 3971 var curtop = 0; 3972 var target = document.getElementById(name) || document.getElementsByName(name)[0]; 3973 if (target) { 3974 if (target.offsetParent) { 3975 do { 3976 curtop += target.offsetTop; 3977 target = target.offsetParent 3978 } while (target) 3979 } 3980 } 3981 window.scrollTo(0, curtop) 3982 } else if (state.options.scrollTo !== false) { 3983 if (state.options.scrollTo.length > 1) { 3984 window.scrollTo(state.options.scrollTo[0], state.options.scrollTo[1]) 3985 } else { 3986 window.scrollTo(0, state.options.scrollTo) 3987 } 3988 } 3989 } else if (state.options.scrollRestoration && state.options.scrollPos) { 3990 window.scrollTo(state.options.scrollPos[0], state.options.scrollPos[1]) 3991 } 3992 this.state = { 3993 numPendingSwitches: 0, 3994 href: null, 3995 options: null 3996 } 3997 } 3998 }; 3999 Pjax.isSupported = require("./lib/is-supported"); 4000 if (Pjax.isSupported()) { 4001 module.exports = Pjax 4002 } else { 4003 var stupidPjax = noop; 4004 for (var key in Pjax.prototype) { 4005 if (Pjax.prototype.hasOwnProperty(key) && typeof Pjax.prototype[key] === "function") { 4006 stupidPjax[key] = noop 4007 } 4008 } 4009 module.exports = stupidPjax 4010 } 4011 }, { 4012 "./lib/abort-request": 2, 4013 "./lib/events/on": 4, 4014 "./lib/events/trigger": 5, 4015 "./lib/execute-scripts": 6, 4016 "./lib/foreach-els": 7, 4017 "./lib/foreach-selectors": 8, 4018 "./lib/is-supported": 9, 4019 "./lib/parse-options": 10, 4020 "./lib/proto/attach-form": 11, 4021 "./lib/proto/attach-link": 12, 4022 "./lib/proto/handle-response": 13, 4023 "./lib/proto/log": 14, 4024 "./lib/proto/parse-element": 15, 4025 "./lib/send-request": 16, 4026 "./lib/switches": 18, 4027 "./lib/switches-selectors": 17, 4028 "./lib/uniqueid": 19, 4029 "./lib/util/clone": 20, 4030 "./lib/util/contains": 21, 4031 "./lib/util/extend": 22, 4032 "./lib/util/noop": 23 4033 }], 4034 2: [function (require, module, exports) { 4035 var noop = require("./util/noop"); 4036 module.exports = function (request) { 4037 if (request && request.readyState < 4) { 4038 request.onreadystatechange = noop; 4039 request.abort() 4040 } 4041 } 4042 }, { 4043 "./util/noop": 23 4044 }], 4045 3: [function (require, module, exports) { 4046 module.exports = function (el) { 4047 var code = el.text || el.textContent || el.innerHTML || ""; 4048 var src = el.src || ""; 4049 var parent = el.parentNode || document.querySelector("head") || document.documentElement; 4050 var script = document.createElement("script"); 4051 if (code.match("document.write")) { 4052 if (console && console.log) { 4053 console.log("Script contains document.write. Canât be executed correctly. Code skipped ", el) 4054 } 4055 return false 4056 } 4057 script.type = "text/javascript"; 4058 script.id = el.id; 4059 if (src !== "") { 4060 script.src = src; 4061 script.async = false 4062 } 4063 if (code !== "") { 4064 try { 4065 script.appendChild(document.createTextNode(code)) 4066 } catch (e) { 4067 script.text = code 4068 } 4069 } 4070 parent.appendChild(script); 4071 if ((parent instanceof HTMLHeadElement || parent instanceof HTMLBodyElement) && parent.contains(script)) { 4072 parent.removeChild(script) 4073 } 4074 return true 4075 } 4076 }, {}], 4077 4: [function (require, module, exports) { 4078 var forEachEls = require("../foreach-els"); 4079 module.exports = function (els, events, listener, useCapture) { 4080 events = typeof events === "string" ? events.split(" ") : events; 4081 events.forEach(function (e) { 4082 forEachEls(els, function (el) { 4083 el.addEventListener(e, listener, useCapture) 4084 }) 4085 }) 4086 } 4087 }, { 4088 "../foreach-els": 7 4089 }], 4090 5: [function (require, module, exports) { 4091 var forEachEls = require("../foreach-els"); 4092 module.exports = function (els, events, opts) { 4093 events = typeof events === "string" ? events.split(" ") : events; 4094 events.forEach(function (e) { 4095 var event; 4096 event = document.createEvent("HTMLEvents"); 4097 event.initEvent(e, true, true); 4098 event.eventName = e; 4099 if (opts) { 4100 Object.keys(opts).forEach(function (key) { 4101 event[key] = opts[key] 4102 }) 4103 } 4104 forEachEls(els, function (el) { 4105 var domFix = false; 4106 if (!el.parentNode && el !== document && el !== window) { 4107 domFix = true; 4108 document.body.appendChild(el) 4109 } 4110 el.dispatchEvent(event); 4111 if (domFix) { 4112 el.parentNode.removeChild(el) 4113 } 4114 }) 4115 }) 4116 } 4117 }, { 4118 "../foreach-els": 7 4119 }], 4120 6: [function (require, module, exports) { 4121 var forEachEls = require("./foreach-els"); 4122 var evalScript = require("./eval-script"); 4123 module.exports = function (el) { 4124 if (el.tagName.toLowerCase() === "script") { 4125 evalScript(el) 4126 } 4127 forEachEls(el.querySelectorAll("script"), function (script) { 4128 if (!script.type || script.type.toLowerCase() === "text/javascript") { 4129 if (script.parentNode) { 4130 script.parentNode.removeChild(script) 4131 } 4132 evalScript(script) 4133 } 4134 }) 4135 } 4136 }, { 4137 "./eval-script": 3, 4138 "./foreach-els": 7 4139 }], 4140 7: [function (require, module, exports) { 4141 module.exports = function (els, fn, context) { 4142 if (els instanceof HTMLCollection || els instanceof NodeList || els instanceof Array) { 4143 return Array.prototype.forEach.call(els, fn, context) 4144 } 4145 return fn.call(context, els) 4146 } 4147 }, {}], 4148 8: [function (require, module, exports) { 4149 var forEachEls = require("./foreach-els"); 4150 module.exports = function (selectors, cb, context, DOMcontext) { 4151 DOMcontext = DOMcontext || document; 4152 selectors.forEach(function (selector) { 4153 forEachEls(DOMcontext.querySelectorAll(selector), cb, context) 4154 }) 4155 } 4156 }, { 4157 "./foreach-els": 7 4158 }], 4159 9: [function (require, module, exports) { 4160 module.exports = function () { 4161 return window.history && window.history.pushState && window.history.replaceState && !navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/) 4162 } 4163 }, {}], 4164 10: [function (require, module, exports) { 4165 var defaultSwitches = require("./switches"); 4166 module.exports = function (options) { 4167 options = options || {}; 4168 options.elements = options.elements || "a[href], form[action]"; 4169 options.selectors = options.selectors || ["title", ".js-Pjax"]; 4170 options.switches = options.switches || {}; 4171 options.switchesOptions = options.switchesOptions || {}; 4172 options.history = typeof options.history === "undefined" ? true : options.history; 4173 options.analytics = typeof options.analytics === "function" || options.analytics === false ? options.analytics : defaultAnalytics; 4174 options.scrollTo = typeof options.scrollTo === "undefined" ? 0 : options.scrollTo; 4175 options.scrollRestoration = typeof options.scrollRestoration !== "undefined" ? options.scrollRestoration : true; 4176 options.cacheBust = typeof options.cacheBust === "undefined" ? true : options.cacheBust; 4177 options.debug = options.debug || false; 4178 options.timeout = options.timeout || 0; 4179 options.currentUrlFullReload = typeof options.currentUrlFullReload === "undefined" ? false : options.currentUrlFullReload; 4180 if (!options.switches.head) { 4181 options.switches.head = defaultSwitches.switchElementsAlt 4182 } 4183 if (!options.switches.body) { 4184 options.switches.body = defaultSwitches.switchElementsAlt 4185 } 4186 return options 4187 }; 4188 4189 function defaultAnalytics() { 4190 if (window._gaq) { 4191 _gaq.push(["_trackPageview"]) 4192 } 4193 if (window.ga) { 4194 ga("send", "pageview", { 4195 page: location.pathname, 4196 title: document.title 4197 }) 4198 } 4199 } 4200 }, { 4201 "./switches": 18 4202 }], 4203 11: [function (require, module, exports) { 4204 var on = require("../events/on"); 4205 var clone = require("../util/clone"); 4206 var attrState = "data-pjax-state"; 4207 var formAction = function (el, event) { 4208 if (isDefaultPrevented(event)) { 4209 return 4210 } 4211 var options = clone(this.options); 4212 options.requestOptions = { 4213 requestUrl: el.getAttribute("action") || window.location.href, 4214 requestMethod: el.getAttribute("method") || "GET" 4215 }; 4216 var virtLinkElement = document.createElement("a"); 4217 virtLinkElement.setAttribute("href", options.requestOptions.requestUrl); 4218 var attrValue = checkIfShouldAbort(virtLinkElement, options); 4219 if (attrValue) { 4220 el.setAttribute(attrState, attrValue); 4221 return 4222 } 4223 event.preventDefault(); 4224 if (el.enctype === "multipart/form-data") { 4225 options.requestOptions.formData = new FormData(el) 4226 } else { 4227 options.requestOptions.requestParams = parseFormElements(el) 4228 } 4229 el.setAttribute(attrState, "submit"); 4230 options.triggerElement = el; 4231 this.loadUrl(virtLinkElement.href, options) 4232 }; 4233 4234 function parseFormElements(el) { 4235 var requestParams = []; 4236 var formElements = el.elements; 4237 for (var i = 0; i < formElements.length; i++) { 4238 var element = formElements[i]; 4239 var tagName = element.tagName.toLowerCase(); 4240 if (!!element.name && element.attributes !== undefined && tagName !== "button") { 4241 var type = element.attributes.type; 4242 if (!type || type.value !== "checkbox" && type.value !== "radio" || element.checked) { 4243 var values = []; 4244 if (tagName === "select") { 4245 var opt; 4246 for (var j = 0; j < element.options.length; j++) { 4247 opt = element.options[j]; 4248 if (opt.selected && !opt.disabled) { 4249 values.push(opt.hasAttribute("value") ? opt.value : opt.text) 4250 } 4251 } 4252 } else { 4253 values.push(element.value) 4254 } 4255 for (var k = 0; k < values.length; k++) { 4256 requestParams.push({ 4257 name: encodeURIComponent(element.name), 4258 value: encodeURIComponent(values[k]) 4259 }) 4260 } 4261 } 4262 } 4263 } 4264 return requestParams 4265 } 4266 4267 function checkIfShouldAbort(virtLinkElement, options) { 4268 if (virtLinkElement.protocol !== window.location.protocol || virtLinkElement.host !== window.location.host) { 4269 return "external" 4270 } 4271 if (virtLinkElement.hash && virtLinkElement.href.replace(virtLinkElement.hash, "") === window.location.href.replace(location.hash, "")) { 4272 return "anchor" 4273 } 4274 if (virtLinkElement.href === window.location.href.split("#")[0] + "#") { 4275 return "anchor-empty" 4276 } 4277 if (options.currentUrlFullReload && virtLinkElement.href === window.location.href.split("#")[0]) { 4278 return "reload" 4279 } 4280 } 4281 var isDefaultPrevented = function (event) { 4282 return event.defaultPrevented || event.returnValue === false 4283 }; 4284 module.exports = function (el) { 4285 var that = this; 4286 el.setAttribute(attrState, ""); 4287 on(el, "submit", function (event) { 4288 formAction.call(that, el, event) 4289 }) 4290 } 4291 }, { 4292 "../events/on": 4, 4293 "../util/clone": 20 4294 }], 4295 12: [function (require, module, exports) { 4296 var on = require("../events/on"); 4297 var clone = require("../util/clone"); 4298 var attrState = "data-pjax-state"; 4299 var linkAction = function (el, event) { 4300 if (isDefaultPrevented(event)) { 4301 return 4302 } 4303 var options = clone(this.options); 4304 var attrValue = checkIfShouldAbort(el, event); 4305 if (attrValue) { 4306 el.setAttribute(attrState, attrValue); 4307 return 4308 } 4309 event.preventDefault(); 4310 if (this.options.currentUrlFullReload && el.href === window.location.href.split("#")[0]) { 4311 el.setAttribute(attrState, "reload"); 4312 this.reload(); 4313 return 4314 } 4315 el.setAttribute(attrState, "load"); 4316 options.triggerElement = el; 4317 this.loadUrl(el.href, options) 4318 }; 4319 4320 function checkIfShouldAbort(el, event) { 4321 if (event.which > 1 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) { 4322 return "modifier" 4323 } 4324 if (el.protocol !== window.location.protocol || el.host !== window.location.host) { 4325 return "external" 4326 } 4327 if (el.hash && el.href.replace(el.hash, "") === window.location.href.replace(location.hash, "")) { 4328 return "anchor" 4329 } 4330 if (el.href === window.location.href.split("#")[0] + "#") { 4331 return "anchor-empty" 4332 } 4333 } 4334 var isDefaultPrevented = function (event) { 4335 return event.defaultPrevented || event.returnValue === false 4336 }; 4337 module.exports = function (el) { 4338 var that = this; 4339 el.setAttribute(attrState, ""); 4340 on(el, "click", function (event) { 4341 linkAction.call(that, el, event) 4342 }); 4343 on(el, "keyup", function (event) { 4344 if (event.keyCode === 13) { 4345 linkAction.call(that, el, event) 4346 } 4347 }.bind(this)) 4348 } 4349 }, { 4350 "../events/on": 4, 4351 "../util/clone": 20 4352 }], 4353 13: [function (require, module, exports) { 4354 var clone = require("../util/clone"); 4355 var newUid = require("../uniqueid"); 4356 var trigger = require("../events/trigger"); 4357 module.exports = function (responseText, request, href, options) { 4358 options = clone(options || this.options); 4359 options.request = request; 4360 if (responseText === false) { 4361 trigger(document, "pjax:complete pjax:error", options); 4362 return 4363 } 4364 var currentState = window.history.state || {}; 4365 window.history.replaceState({ 4366 url: currentState.url || window.location.href, 4367 title: currentState.title || document.title, 4368 uid: currentState.uid || newUid(), 4369 scrollPos: [document.documentElement.scrollLeft || document.body.scrollLeft, document.documentElement.scrollTop || document.body.scrollTop] 4370 }, document.title, window.location.href); 4371 var oldHref = href; 4372 if (request.responseURL) { 4373 if (href !== request.responseURL) { 4374 href = request.responseURL 4375 } 4376 } else if (request.getResponseHeader("X-PJAX-URL")) { 4377 href = request.getResponseHeader("X-PJAX-URL") 4378 } else if (request.getResponseHeader("X-XHR-Redirected-To")) { 4379 href = request.getResponseHeader("X-XHR-Redirected-To") 4380 } 4381 var a = document.createElement("a"); 4382 a.href = oldHref; 4383 var oldHash = a.hash; 4384 a.href = href; 4385 if (oldHash && !a.hash) { 4386 a.hash = oldHash; 4387 href = a.href 4388 } 4389 this.state.href = href; 4390 this.state.options = options; 4391 try { 4392 this.loadContent(responseText, options) 4393 } catch (e) { 4394 trigger(document, "pjax:error", options); 4395 if (!this.options.debug) { 4396 if (console && console.error) { 4397 console.error("Pjax switch fail: ", e) 4398 } 4399 return this.latestChance(href) 4400 } else { 4401 throw e 4402 } 4403 } 4404 } 4405 }, { 4406 "../events/trigger": 5, 4407 "../uniqueid": 19, 4408 "../util/clone": 20 4409 }], 4410 14: [function (require, module, exports) { 4411 module.exports = function () { 4412 if (this.options.debug && console) { 4413 if (typeof console.log === "function") { 4414 console.log.apply(console, arguments) 4415 } else if (console.log) { 4416 console.log(arguments) 4417 } 4418 } 4419 } 4420 }, {}], 4421 15: [function (require, module, exports) { 4422 var attrState = "data-pjax-state"; 4423 module.exports = function (el) { 4424 switch (el.tagName.toLowerCase()) { 4425 case "a": 4426 if (!el.hasAttribute(attrState)) { 4427 this.attachLink(el) 4428 } 4429 break; 4430 case "form": 4431 if (!el.hasAttribute(attrState)) { 4432 this.attachForm(el) 4433 } 4434 break; 4435 default: 4436 throw "Pjax can only be applied on <a> or <form> submit" 4437 } 4438 } 4439 }, {}], 4440 16: [function (require, module, exports) { 4441 var updateQueryString = require("./util/update-query-string"); 4442 module.exports = function (location, options, callback) { 4443 options = options || {}; 4444 var queryString; 4445 var requestOptions = options.requestOptions || {}; 4446 var requestMethod = (requestOptions.requestMethod || "GET").toUpperCase(); 4447 var requestParams = requestOptions.requestParams || null; 4448 var formData = requestOptions.formData || null; 4449 var requestPayload = null; 4450 var request = new XMLHttpRequest; 4451 var timeout = options.timeout || 0; 4452 request.onreadystatechange = function () { 4453 if (request.readyState === 4) { 4454 if (request.status === 200) { 4455 callback(request.responseText, request, location, options) 4456 } else if (request.status !== 0) { 4457 callback(null, request, location, options) 4458 } 4459 } 4460 }; 4461 request.onerror = function (e) { 4462 console.log(e); 4463 callback(null, request, location, options) 4464 }; 4465 request.ontimeout = function () { 4466 callback(null, request, location, options) 4467 }; 4468 if (requestParams && requestParams.length) { 4469 queryString = requestParams.map(function (param) { 4470 return param.name + "=" + param.value 4471 }).join("&"); 4472 switch (requestMethod) { 4473 case "GET": 4474 location = location.split("?")[0]; 4475 location += "?" + queryString; 4476 break; 4477 case "POST": 4478 requestPayload = queryString; 4479 break 4480 } 4481 } else if (formData) { 4482 requestPayload = formData 4483 } 4484 if (options.cacheBust) { 4485 location = updateQueryString(location, "t", Date.now()) 4486 } 4487 request.open(requestMethod, location, true); 4488 request.timeout = timeout; 4489 request.setRequestHeader("X-Requested-With", "XMLHttpRequest"); 4490 request.setRequestHeader("X-PJAX", "true"); 4491 request.setRequestHeader("X-PJAX-Selectors", JSON.stringify(options.selectors)); 4492 if (requestPayload && requestMethod === "POST" && !formData) { 4493 request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") 4494 } 4495 request.send(requestPayload); 4496 return request 4497 } 4498 }, { 4499 "./util/update-query-string": 24 4500 }], 4501 17: [function (require, module, exports) { 4502 var forEachEls = require("./foreach-els"); 4503 var defaultSwitches = require("./switches"); 4504 module.exports = function (switches, switchesOptions, selectors, fromEl, toEl, options) { 4505 var switchesQueue = []; 4506 selectors.forEach(function (selector) { 4507 var newEls = fromEl.querySelectorAll(selector); 4508 var oldEls = toEl.querySelectorAll(selector); 4509 if (this.log) { 4510 this.log("Pjax switch", selector, newEls, oldEls) 4511 } 4512 if (newEls.length !== oldEls.length) { 4513 throw "DOM doesnât look the same on new loaded page: â" + selector + "â - new " + newEls.length + ", old " + oldEls.length 4514 } 4515 forEachEls(newEls, function (newEl, i) { 4516 var oldEl = oldEls[i]; 4517 if (this.log) { 4518 this.log("newEl", newEl, "oldEl", oldEl) 4519 } 4520 var callback = switches[selector] ? switches[selector].bind(this, oldEl, newEl, options, switchesOptions[selector]) : defaultSwitches.outerHTML.bind(this, oldEl, newEl, options); 4521 switchesQueue.push(callback) 4522 }, this) 4523 }, this); 4524 this.state.numPendingSwitches = switchesQueue.length; 4525 switchesQueue.forEach(function (queuedSwitch) { 4526 queuedSwitch() 4527 }) 4528 } 4529 }, { 4530 "./foreach-els": 7, 4531 "./switches": 18 4532 }], 4533 18: [function (require, module, exports) { 4534 var on = require("./events/on"); 4535 module.exports = { 4536 outerHTML: function (oldEl, newEl) { 4537 oldEl.outerHTML = newEl.outerHTML; 4538 this.onSwitch() 4539 }, 4540 innerHTML: function (oldEl, newEl) { 4541 oldEl.innerHTML = newEl.innerHTML; 4542 if (newEl.className === "") { 4543 oldEl.removeAttribute("class") 4544 } else { 4545 oldEl.className = newEl.className 4546 } 4547 this.onSwitch() 4548 }, 4549 switchElementsAlt: function (oldEl, newEl) { 4550 oldEl.innerHTML = newEl.innerHTML; 4551 if (newEl.hasAttributes()) { 4552 var attrs = newEl.attributes; 4553 for (var i = 0; i < attrs.length; i++) { 4554 oldEl.attributes.setNamedItem(attrs[i].cloneNode()) 4555 } 4556 } 4557 this.onSwitch() 4558 }, 4559 replaceNode: function (oldEl, newEl) { 4560 oldEl.parentNode.replaceChild(newEl, oldEl); 4561 this.onSwitch() 4562 }, 4563 sideBySide: function (oldEl, newEl, options, switchOptions) { 4564 var forEach = Array.prototype.forEach; 4565 var elsToRemove = []; 4566 var elsToAdd = []; 4567 var fragToAppend = document.createDocumentFragment(); 4568 var animationEventNames = "animationend webkitAnimationEnd MSAnimationEnd oanimationend"; 4569 var animatedElsNumber = 0; 4570 var sexyAnimationEnd = function (e) { 4571 if (e.target !== e.currentTarget) { 4572 return 4573 } 4574 animatedElsNumber--; 4575 if (animatedElsNumber <= 0 && elsToRemove) { 4576 elsToRemove.forEach(function (el) { 4577 if (el.parentNode) { 4578 el.parentNode.removeChild(el) 4579 } 4580 }); 4581 elsToAdd.forEach(function (el) { 4582 el.className = el.className.replace(el.getAttribute("data-pjax-classes"), ""); 4583 el.removeAttribute("data-pjax-classes") 4584 }); 4585 elsToAdd = null; 4586 elsToRemove = null; 4587 this.onSwitch() 4588 } 4589 }.bind(this); 4590 switchOptions = switchOptions || {}; 4591 forEach.call(oldEl.childNodes, function (el) { 4592 elsToRemove.push(el); 4593 if (el.classList && !el.classList.contains("js-Pjax-remove")) { 4594 if (el.hasAttribute("data-pjax-classes")) { 4595 el.className = el.className.replace(el.getAttribute("data-pjax-classes"), ""); 4596 el.removeAttribute("data-pjax-classes") 4597 } 4598 el.classList.add("js-Pjax-remove"); 4599 if (switchOptions.callbacks && switchOptions.callbacks.removeElement) { 4600 switchOptions.callbacks.removeElement(el) 4601 } 4602 if (switchOptions.classNames) { 4603 el.className += " " + switchOptions.classNames.remove + " " + (options.backward ? switchOptions.classNames.backward : switchOptions.classNames.forward) 4604 } 4605 animatedElsNumber++; 4606 on(el, animationEventNames, sexyAnimationEnd, true) 4607 } 4608 }); 4609 forEach.call(newEl.childNodes, function (el) { 4610 if (el.classList) { 4611 var addClasses = ""; 4612 if (switchOptions.classNames) { 4613 addClasses = " js-Pjax-add " + switchOptions.classNames.add + " " + (options.backward ? switchOptions.classNames.forward : switchOptions.classNames.backward) 4614 } 4615 if (switchOptions.callbacks && switchOptions.callbacks.addElement) { 4616 switchOptions.callbacks.addElement(el) 4617 } 4618 el.className += addClasses;
4619 el.setAttribute("data-pjax-classes", addClasses); 4620 elsToAdd.push(el); 4621 fragToAppend.appendChild(el); 4622 animatedElsNumber++; 4623 on(el, animationEventNames, sexyAnimationEnd, true) 4624 } 4625 }); 4626 oldEl.className = newEl.className; 4627 oldEl.appendChild(fragToAppend) 4628 } 4629 } 4630 }, { 4631 "./events/on": 4 4632 }], 4633 19: [function (require, module, exports) { 4634 module.exports = function () { 4635 var counter = 0; 4636 return function () { 4637 var id = "pjax" + (new Date).getTime() + "_" + counter; 4638 counter++; 4639 return id 4640 } 4641 }() 4642 }, {}], 4643 20: [function (require, module, exports) { 4644 module.exports = function (obj) { 4645 if (null === obj || "object" !== typeof obj) { 4646 return obj 4647 } 4648 var copy = obj.constructor(); 4649 for (var attr in obj) { 4650 if (obj.hasOwnProperty(attr)) { 4651 copy[attr] = obj[attr] 4652 } 4653 } 4654 return copy 4655 } 4656 }, {}], 4657 21: [function (require, module, exports) { 4658 module.exports = function contains(doc, selectors, el) { 4659 for (var i = 0; i < selectors.length; i++) { 4660 var selectedEls = doc.querySelectorAll(selectors[i]); 4661 for (var j = 0; j < selectedEls.length; j++) { 4662 if (selectedEls[j].contains(el)) { 4663 return true 4664 } 4665 } 4666 } 4667 return false 4668 } 4669 }, {}], 4670 22: [function (require, module, exports) { 4671 module.exports = function (target) { 4672 if (target == null) { 4673 return null 4674 } 4675 var to = Object(target); 4676 for (var i = 1; i < arguments.length; i++) { 4677 var source = arguments[i]; 4678 if (source != null) { 4679 for (var key in source) { 4680 if (Object.prototype.hasOwnProperty.call(source, key)) { 4681 to[key] = source[key] 4682 } 4683 } 4684 } 4685 } 4686 return to 4687 } 4688 }, {}], 4689 23: [function (require, module, exports) { 4690 module.exports = function () {} 4691 }, {}], 4692 24: [function (require, module, exports) { 4693 module.exports = function (uri, key, value) { 4694 var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); 4695 var separator = uri.indexOf("?") !== -1 ? "&" : "?"; 4696 if (uri.match(re)) { 4697 return uri.replace(re, "$1" + key + "=" + value + "$2") 4698 } else { 4699 return uri + separator + key + "=" + value 4700 } 4701 } 4702 }, {}] 4703 }, {}, [1])(1) 4704}); 4705jQuery(function ($) { 4706 FaqModuleInitialize(); 4707}); 4708 4709function FaqModuleInitialize() { 4710 $(document).on("s123.page.load", function (event) { 4711 var $sections = $('.s123-module-faq'); 4712 $sections.each(function (index) { 4713 var $s = $(this); 4714 var categories = new ModuleLayoutCategories({ 4715 $items: $s.find('.faq-category'), 4716 $categoriesContainer: $s.find('.categories-panel'), 4717 $filterButton: $s.find('.items-responsive-filter'), 4718 $categories: $s.find('.items-categories-container li') 4719 }); 4720 }); 4721 }); 4722}; 4723(function (root, factory) { 4724 if (typeof define === 'function' && define.amd) { 4725 define(factory); 4726 } else if (typeof exports === 'object') { 4727 module.exports = factory(); 4728 } else { 4729 root.NProgress = factory(); 4730 } 4731})(this, function () { 4732 var NProgress = {}; 4733 NProgress.version = '0.2.0'; 4734 var Settings = NProgress.settings = { 4735 minimum: 0.08, 4736 easing: 'linear', 4737 positionUsing: '', 4738 speed: 200, 4739 trickle: true, 4740 trickleSpeed: 200, 4741 showSpinner: true, 4742 barSelector: '[role="bar"]', 4743 spinnerSelector: '[role="spinner"]', 4744 parent: 'body', 4745 template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>' 4746 }; 4747 NProgress.configure = function (options) { 4748 var key, value; 4749 for (key in options) { 4750 value = options[key]; 4751 if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value; 4752 } 4753 return this; 4754 }; 4755 NProgress.status = null; 4756 NProgress.set = function (n) { 4757 var started = NProgress.isStarted(); 4758 n = clamp(n, Settings.minimum, 1); 4759 NProgress.status = (n === 1 ? null : n); 4760 var progress = NProgress.render(!started), 4761 bar = progress.querySelector(Settings.barSelector), 4762 speed = Settings.speed, 4763 ease = Settings.easing; 4764 progress.offsetWidth; 4765 queue(function (next) { 4766 if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS(); 4767 css(bar, barPositionCSS(n, speed, ease)); 4768 if (n === 1) { 4769 css(progress, { 4770 transition: 'none', 4771 opacity: 1 4772 }); 4773 progress.offsetWidth; 4774 setTimeout(function () { 4775 css(progress, { 4776 transition: 'all ' + speed + 'ms linear', 4777 opacity: 0 4778 }); 4779 setTimeout(function () { 4780 NProgress.remove(); 4781 next(); 4782 }, speed); 4783 }, speed); 4784 } else { 4785 setTimeout(next, speed); 4786 } 4787 }); 4788 return this; 4789 }; 4790 NProgress.isStarted = function () { 4791 return typeof NProgress.status === 'number'; 4792 }; 4793 NProgress.start = function () { 4794 if (!NProgress.status) NProgress.set(0); 4795 var work = function () { 4796 setTimeout(function () { 4797 if (!NProgress.status) return; 4798 NProgress.trickle(); 4799 work(); 4800 }, Settings.trickleSpeed); 4801 }; 4802 if (Settings.trickle) work(); 4803 return this; 4804 }; 4805 NProgress.done = function (force) { 4806 if (!force && !NProgress.status) return this; 4807 return NProgress.inc(0.3 + 0.5 * Math.random()).set(1); 4808 }; 4809 NProgress.inc = function (amount) { 4810 var n = NProgress.status; 4811 if (!n) { 4812 return NProgress.start(); 4813 } else if (n > 1) { 4814 return; 4815 } else { 4816 if (typeof amount !== 'number') { 4817 if (n >= 0 && n < 0.2) { 4818 amount = 0.1; 4819 } else if (n >= 0.2 && n < 0.5) { 4820 amount = 0.04; 4821 } else if (n >= 0.5 && n < 0.8) { 4822 amount = 0.02; 4823 } else if (n >= 0.8 && n < 0.99) { 4824 amount = 0.005; 4825 } else { 4826 amount = 0; 4827 } 4828 } 4829 n = clamp(n + amount, 0, 0.994); 4830 return NProgress.set(n); 4831 } 4832 }; 4833 NProgress.trickle = function () { 4834 return NProgress.inc(); 4835 }; 4836 (function () { 4837 var initial = 0, 4838 current = 0; 4839 NProgress.promise = function ($promise) { 4840 if (!$promise || $promise.state() === "resolved") { 4841 return this; 4842 } 4843 if (current === 0) { 4844 NProgress.start(); 4845 } 4846 initial++; 4847 current++; 4848 $promise.always(function () { 4849 current--; 4850 if (current === 0) { 4851 initial = 0; 4852 NProgress.done(); 4853 } else { 4854 NProgress.set((initial - current) / initial); 4855 } 4856 }); 4857 return this; 4858 }; 4859 })(); 4860 NProgress.render = function (fromStart) { 4861 if (NProgress.isRendered()) return document.getElementById('nprogress'); 4862 addClass(document.documentElement, 'nprogress-busy'); 4863 var progress = document.createElement('div'); 4864 progress.id = 'nprogress'; 4865 progress.innerHTML = Settings.template; 4866 var bar = progress.querySelector(Settings.barSelector), 4867 perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0), 4868 parent = document.querySelector(Settings.parent), 4869 spinner; 4870 css(bar, { 4871 transition: 'all 0 linear', 4872 transform: 'translate3d(' + perc + '%,0,0)' 4873 }); 4874 if (!Settings.showSpinner) { 4875 spinner = progress.querySelector(Settings.spinnerSelector); 4876 spinner && removeElement(spinner); 4877 } 4878 if (parent != document.body) { 4879 addClass(parent, 'nprogress-custom-parent'); 4880 } 4881 parent.appendChild(progress); 4882 return progress; 4883 }; 4884 NProgress.remove = function () { 4885 removeClass(document.documentElement, 'nprogress-busy'); 4886 removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent'); 4887 var progress = document.getElementById('nprogress'); 4888 progress && removeElement(progress); 4889 }; 4890 NProgress.isRendered = function () { 4891 return !!document.getElementById('nprogress'); 4892 }; 4893 NProgress.getPositioningCSS = function () { 4894 var bodyStyle = document.body.style; 4895 var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' : ('MozTransform' in bodyStyle) ? 'Moz' : ('msTransform' in bodyStyle) ? 'ms' : ('OTransform' in bodyStyle) ? 'O' : ''; 4896 if (vendorPrefix + 'Perspective' in bodyStyle) { 4897 return 'translate3d'; 4898 } else if (vendorPrefix + 'Transform' in bodyStyle) { 4899 return 'translate'; 4900 } else { 4901 return 'margin'; 4902 } 4903 }; 4904 4905 function clamp(n, min, max) { 4906 if (n < min) return min; 4907 if (n > max) return max; 4908 return n; 4909 } 4910 4911 function toBarPerc(n) { 4912 return (-1 + n) * 100; 4913 } 4914 4915 function barPositionCSS(n, speed, ease) { 4916 var barCSS; 4917 if (Settings.positionUsing === 'translate3d') { 4918 barCSS = { 4919 transform: 'translate3d(' + toBarPerc(n) + '%,0,0)' 4920 }; 4921 } else if (Settings.positionUsing === 'translate') { 4922 barCSS = { 4923 transform: 'translate(' + toBarPerc(n) + '%,0)' 4924 }; 4925 } else { 4926 barCSS = { 4927 'margin-left': toBarPerc(n) + '%' 4928 }; 4929 } 4930 barCSS.transition = 'all ' + speed + 'ms ' + ease; 4931 return barCSS; 4932 } 4933 var queue = (function () { 4934 var pending = []; 4935 4936 function next() { 4937 var fn = pending.shift(); 4938 if (fn) { 4939 fn(next); 4940 } 4941 } 4942 return function (fn) { 4943 pending.push(fn); 4944 if (pending.length == 1) next(); 4945 }; 4946 })(); 4947 var css = (function () { 4948 var cssPrefixes = ['Webkit', 'O', 'Moz', 'ms'], 4949 cssProps = {}; 4950 4951 function camelCase(string) { 4952 return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function (match, letter) { 4953 return letter.toUpperCase(); 4954 }); 4955 } 4956 4957 function getVendorProp(name) { 4958 var style = document.body.style; 4959 if (name in style) return name; 4960 var i = cssPrefixes.length, 4961 capName = name.charAt(0).toUpperCase() + name.slice(1), 4962 vendorName; 4963 while (i--) { 4964 vendorName = cssPrefixes[i] + capName; 4965 if (vendorName in style) return vendorName; 4966 } 4967 return name; 4968 } 4969 4970 function getStyleProp(name) { 4971 name = camelCase(name); 4972 return cssProps[name] || (cssProps[name] = getVendorProp(name)); 4973 } 4974 4975 function applyCss(element, prop, value) { 4976 prop = getStyleProp(prop); 4977 element.style[prop] = value; 4978 } 4979 return function (element, properties) { 4980 var args = arguments, 4981 prop, value; 4982 if (args.length == 2) { 4983 for (prop in properties) { 4984 value = properties[prop]; 4985 if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value); 4986 } 4987 } else {
4988 applyCss(element, args[1], args[2]); 4989 } 4990 } 4991 })(); 4992 4993 function hasClass(element, name) { 4994 var list = typeof element == 'string' ? element : classList(element); 4995 return list.indexOf(' ' + name + ' ') >= 0; 4996 } 4997 4998 function addClass(element, name) { 4999 var oldList = classList(element), 5000 newList = oldList + name; 5001 if (hasClass(oldList, name)) return; 5002 element.className = newList.substring(1); 5003 } 5004 5005 function removeClass(element, name) { 5006 var oldList = classList(element), 5007 newList; 5008 if (!hasClass(element, name)) return; 5009 newList = oldList.replace(' ' + name + ' ', ' '); 5010 element.className = newList.substring(1, newList.length - 1); 5011 } 5012 5013 function classList(element) { 5014 return (' ' + (element && element.className || '') + ' ').replace(/\s+/gi, ' '); 5015 } 5016 5017 function removeElement(element) { 5018 element && element.parentNode && element.parentNode.removeChild(element); 5019 } 5020 return NProgress; 5021}); 5022(function (factory) { 5023 if (typeof define === 'function' && define.amd) { 5024 define(['jquery'], factory); 5025 } else if (typeof exports === 'object') { 5026 module.exports = factory(require('jquery')); 5027 } else { 5028 factory(jQuery); 5029 } 5030}(function ($) { 5031 $.detectSwipe = { 5032 version: '2.1.2', 5033 enabled: 'ontouchstart' in document.documentElement, 5034 preventDefault: true, 5035 threshold: 20 5036 }; 5037 var startX, startY, isMoving = false; 5038 5039 function onTouchEnd() { 5040 this.removeEventListener('touchmove', onTouchMove); 5041 this.removeEventListener('touchend', onTouchEnd); 5042 isMoving = false; 5043 } 5044 5045 function onTouchMove(e) { 5046 if ($.detectSwipe.preventDefault) { 5047 e.preventDefault(); 5048 } 5049 if (isMoving) { 5050 var x = e.touches[0].pageX; 5051 var y = e.touches[0].pageY; 5052 var dx = startX - x; 5053 var dy = startY - y; 5054 var dir; 5055 var ratio = window.devicePixelRatio || 1; 5056 if (Math.abs(dx) * ratio >= $.detectSwipe.threshold) { 5057 dir = dx > 0 ? 'left' : 'right' 5058 } else if (Math.abs(dy) * ratio >= $.detectSwipe.threshold) { 5059 dir = dy > 0 ? 'up' : 'down' 5060 } 5061 if (dir) { 5062 onTouchEnd.call(this); 5063 $(this).trigger('swipe', dir).trigger('swipe' + dir); 5064 } 5065 } 5066 } 5067 5068 function onTouchStart(e) { 5069 if (e.touches.length == 1) { 5070 startX = e.touches[0].pageX; 5071 startY = e.touches[0].pageY; 5072 isMoving = true; 5073 this.addEventListener('touchmove', onTouchMove, false); 5074 this.addEventListener('touchend', onTouchEnd, false); 5075 } 5076 } 5077 5078 function setup() { 5079 this.addEventListener && this.addEventListener('touchstart', onTouchStart, false); 5080 } 5081 5082 function teardown() { 5083 this.removeEventListener('touchstart', onTouchStart); 5084 } 5085 $.event.special.swipe = { 5086 setup: setup 5087 }; 5088 $.each(['left', 'up', 'down', 'right'], function () { 5089 $.event.special['swipe' + this] = { 5090 setup: function () { 5091 $(this).on('swipe', $.noop); 5092 } 5093 }; 5094 }); 5095})); 5096(function (root, factory) { 5097 if (typeof define === 'function' && define.amd) { 5098 define(["jquery"], function (a0) { 5099 return (factory(a0)); 5100 }); 5101 } else if (typeof exports === 'object') { 5102 module.exports = factory(require("jquery")); 5103 } else { 5104 factory(jQuery); 5105 } 5106}(this, function ($) { 5107 var CanvasRenderer = function (el, options) { 5108 var cachedBackground; 5109 var canvas = document.createElement('canvas'); 5110 el.appendChild(canvas); 5111 if (typeof (G_vmlCanvasManager) === 'object') { 5112 G_vmlCanvasManager.initElement(canvas); 5113 } 5114 var ctx = canvas.getContext('2d'); 5115 canvas.width = canvas.height = options.size; 5116 var scaleBy = 1; 5117 if (window.devicePixelRatio > 1) { 5118 scaleBy = window.devicePixelRatio; 5119 canvas.style.width = canvas.style.height = [options.size, 'px'].join(''); 5120 canvas.width = canvas.height = options.size * scaleBy; 5121 ctx.scale(scaleBy, scaleBy); 5122 } 5123 ctx.translate(options.size / 2, options.size / 2); 5124 ctx.rotate((-1 / 2 + options.rotate / 180) * Math.PI); 5125 var radius = (options.size - options.lineWidth) / 2; 5126 if (options.scaleColor && options.scaleLength) { 5127 radius -= options.scaleLength + 2; // 2 is the distance between scale and bar 5128 } 5129 Date.now = Date.now || function () { 5130 return +(new Date()); 5131 }; 5132 var drawCircle = function (color, lineWidth, percent) { 5133 percent = Math.min(Math.max(-1, percent || 0), 1); 5134 var isNegative = percent <= 0 ? true : false;
5135 ctx.beginPath(); 5136 ctx.arc(0, 0, radius, 0, Math.PI * 2 * percent, isNegative); 5137 ctx.strokeStyle = color; 5138 ctx.lineWidth = lineWidth; 5139 ctx.stroke(); 5140 }; 5141 var drawScale = function () { 5142 var offset; 5143 var length; 5144 ctx.lineWidth = 1; 5145 ctx.fillStyle = options.scaleColor; 5146 ctx.save(); 5147 for (var i = 24; i > 0; --i) { 5148 if (i % 6 === 0) { 5149 length = options.scaleLength; 5150 offset = 0; 5151 } else { 5152 length = options.scaleLength * 0.6; 5153 offset = options.scaleLength - length; 5154 } 5155 ctx.fillRect(-options.size / 2 + offset, 0, length, 1); 5156 ctx.rotate(Math.PI / 12); 5157 } 5158 ctx.restore(); 5159 }; 5160 var reqAnimationFrame = (function () { 5161 return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function (callback) { 5162 window.setTimeout(callback, 1000 / 60); 5163 }; 5164 }()); 5165 var drawBackground = function () { 5166 if (options.scaleColor) drawScale(); 5167 if (options.trackColor) drawCircle(options.trackColor, options.trackWidth || options.lineWidth, 1); 5168 }; 5169 this.getCanvas = function () { 5170 return canvas; 5171 }; 5172 this.getCtx = function () { 5173 return ctx; 5174 }; 5175 this.clear = function () { 5176 ctx.clearRect(options.size / -2, options.size / -2, options.size, options.size); 5177 }; 5178 this.draw = function (percent) { 5179 if (!!options.scaleColor || !!options.trackColor) { 5180 if (ctx.getImageData && ctx.putImageData) { 5181 if (!cachedBackground) { 5182 drawBackground(); 5183 cachedBackground = ctx.getImageData(0, 0, options.size * scaleBy, options.size * scaleBy); 5184 } else { 5185 ctx.putImageData(cachedBackground, 0, 0); 5186 } 5187 } else { 5188 this.clear(); 5189 drawBackground(); 5190 } 5191 } else { 5192 this.clear(); 5193 } 5194 ctx.lineCap = options.lineCap; 5195 var color; 5196 if (typeof (options.barColor) === 'function') { 5197 color = options.barColor(percent); 5198 } else { 5199 color = options.barColor; 5200 } 5201 drawCircle(color, options.lineWidth, percent / 100); 5202 }.bind(this); 5203 this.animate = function (from, to) { 5204 var startTime = Date.now(); 5205 options.onStart(from, to); 5206 var animation = function () { 5207 var process = Math.min(Date.now() - startTime, options.animate.duration); 5208 var currentValue = options.easing(this, process, from, to - from, options.animate.duration); 5209 this.draw(currentValue); 5210 options.onStep(from, to, currentValue); 5211 if (process >= options.animate.duration) { 5212 options.onStop(from, to); 5213 } else { 5214 reqAnimationFrame(animation); 5215 } 5216 }.bind(this); 5217 reqAnimationFrame(animation); 5218 }.bind(this); 5219 }; 5220 var EasyPieChart = function (el, opts) { 5221 var defaultOptions = { 5222 barColor: '#ef1e25', 5223 trackColor: '#f9f9f9', 5224 scaleColor: '#dfe0e0', 5225 scaleLength: 5, 5226 lineCap: 'round', 5227 lineWidth: 3, 5228 trackWidth: undefined, 5229 size: 110, 5230 rotate: 0, 5231 animate: { 5232 duration: 1000, 5233 enabled: true 5234 }, 5235 easing: function (x, t, b, c, d) { // more can be found here: http://gsgd.co.uk/sandbox/jquery/easing/ 5236 t = t / (d / 2); 5237 if (t < 1) { 5238 return c / 2 * t * t + b; 5239 } 5240 return -c / 2 * ((--t) * (t - 2) - 1) + b; 5241 }, 5242 onStart: function (from, to) { 5243 return; 5244 }, 5245 onStep: function (from, to, currentValue) { 5246 return; 5247 }, 5248 onStop: function (from, to) { 5249 return; 5250 } 5251 }; 5252 if (typeof (CanvasRenderer) !== 'undefined') { 5253 defaultOptions.renderer = CanvasRenderer; 5254 } else if (typeof (SVGRenderer) !== 'undefined') { 5255 defaultOptions.renderer = SVGRenderer; 5256 } else { 5257 throw new Error('Please load either the SVG- or the CanvasRenderer'); 5258 } 5259 var options = {}; 5260 var currentValue = 0; 5261 var init = function () { 5262 this.el = el; 5263 this.options = options; 5264 for (var i in defaultOptions) { 5265 if (defaultOptions.hasOwnProperty(i)) { 5266 options[i] = opts && typeof (opts[i]) !== 'undefined' ? opts[i] : defaultOptions[i]; 5267 if (typeof (options[i]) === 'function') { 5268 options[i] = options[i].bind(this); 5269 } 5270 } 5271 } 5272 if (typeof (options.easing) === 'string' && typeof (jQuery) !== 'undefined' && jQuery.isFunction(jQuery.easing[options.easing])) { 5273 options.easing = jQuery.easing[options.easing]; 5274 } else { 5275 options.easing = defaultOptions.easing; 5276 } 5277 if (typeof (options.animate) === 'number') { 5278 options.animate = { 5279 duration: options.animate, 5280 enabled: true 5281 }; 5282 } 5283 if (typeof (options.animate) === 'boolean' && !options.animate) { 5284 options.animate = { 5285 duration: 1000, 5286 enabled: options.animate 5287 }; 5288 } 5289 this.renderer = new options.renderer(el, options); 5290 this.renderer.draw(currentValue); 5291 if (el.dataset && el.dataset.percent) { 5292 this.update(parseFloat(el.dataset.percent)); 5293 } else if (el.getAttribute && el.getAttribute('data-percent')) { 5294 this.update(parseFloat(el.getAttribute('data-percent'))); 5295 } 5296 }.bind(this); 5297 this.update = function (newValue) { 5298 newValue = parseFloat(newValue); 5299 if (options.animate.enabled) { 5300 this.renderer.animate(currentValue, newValue); 5301 } else { 5302 this.renderer.draw(newValue); 5303 } 5304 currentValue = newValue; 5305 return this; 5306 }.bind(this); 5307 this.disableAnimation = function () { 5308 options.animate.enabled = false;
5309 return this; 5310 }; 5311 this.enableAnimation = function () { 5312 options.animate.enabled = true; 5313 return this; 5314 }; 5315 init(); 5316 }; 5317 $.fn.easyPieChart = function (options) { 5318 return this.each(function () { 5319 var instanceOptions; 5320 if (!$.data(this, 'easyPieChart')) { 5321 instanceOptions = $.extend({}, options, $(this).data()); 5322 $.data(this, 'easyPieChart', new EasyPieChart(this, instanceOptions)); 5323 } 5324 }); 5325 }; 5326})); 5327var S123_ActionButtons = function () { 5328 var that = { 5329 settings: {}, 5330 custom_form_html: {}, 5331 moduleIDs: {}, 5332 custom_thank_you_msg: {}, 5333 customFromInputs: {}, 5334 }; 5335 that.init = function () { 5336 $('[data-toggle="actionButton_customForm"]').each(function () { 5337 $(this).off('click').on('click', function () { 5338 var $this = $(this); 5339 var uniqueID = $this.data('settings-id'); 5340 that.moduleIDs[uniqueID] = $this.data('module-id'); 5341 if ($('#' + uniqueID).length == 0) return; 5342 that.settings[uniqueID] = tryParseJSON($('#' + uniqueID).val()); 5343 that.custom_form_html[uniqueID] = that.settings[uniqueID].custom_form_html ? that.settings[uniqueID].custom_form_html : ''; 5344 that.custom_thank_you_msg[uniqueID] = that.settings[uniqueID].thankYouMsg ? that.settings[uniqueID].thankYouMsg : ''; 5345 buildPopup('popupFloatDivActionButtonCustomForm', '', that.buildEmailToolForm(uniqueID), '', true, true, true, 'right', ''); 5346 S123_ActionButtons.submitHandler(uniqueID); 5347 }); 5348 }); 5349 }; 5350 that.buildEmailToolForm = function (uniqueID) { 5351 var html = ''; 5352 html += '<div class="global-contact-email-container">'; 5353 that.customFromInputs[uniqueID] = $(that.custom_form_html[uniqueID]).find('.c-f-field-type').length; 5354 if (that.settings[uniqueID].showCustomForm == 'on' && that.custom_form_html[uniqueID].length !== 0 && that.customFromInputs[uniqueID] > 0) { 5355 html += '<form class="a-b-email-form s123-custom-form-multi-steps custom-form">'; 5356 html += that.custom_form_html[uniqueID]; 5357 html += '<input type="hidden" name="websiteID" value="' + $('#websiteID').val() + '">'; 5358 html += '<input type="hidden" name="w" value="' + $('#w').val() + '">'; 5359 html += '<input type="hidden" name="recaptchaToken" value="">'; 5360 html += '<input type="hidden" name="moduleID" value="' + that.moduleIDs[uniqueID] + '">'; 5361 html += '<input type="hidden" name="actionButtonForm" value="1">'; 5362 html += '<input type="hidden" name="buttonNum" value="' + that.settings[uniqueID].buttonNum + '">'; 5363 html += '<div class="conv-code-container"></div>'; 5364 html += '</form>'; 5365 } else { 5366 html += '<form class="a-b-email-form">'; 5367 html += '<div class="row">'; 5368 html += '<div class="col-sm-6 col-xs-12">'; 5369 html += '<div class="form-group">'; 5370 html += '<label for="contact_name" class="white">' + translations.globalContactEmail.fullName + '</label>'; 5371 html += '<input type="text" name="contact_name" placeholder="' + translations.globalContactEmail.fullName + '" class="form-control" required data-msg-required="' + translations.jqueryValidMsgRequire + '">'; 5372 html += '</div>'; 5373 html += '</div>'; 5374 html += '<div class="col-sm-6 col-xs-12">'; 5375 html += '<div class="form-group">'; 5376 html += '<label for="contact_email" class="white">' + translations.emailAddress + '</label>'; 5377 html += '<input type="text" name="contact_email" placeholder="' + translations.emailAddress + '" class="form-control" required data-msg-required="' + translations.jqueryValidMsgRequire + '" data-rule-email="true" data-msg-email="' + translations.jqueryValidMsgEmail + '">'; 5378 html += '</div>'; 5379 html += '</div>'; 5380 html += '</div>'; 5381 html += '<div class="row">'; 5382 html += '<div class="col-xs-12">'; 5383 html += '<div class="form-group">'; 5384 html += '<label for="contact_message" class="white">' + translations.globalContactEmail.description + '</label>'; 5385 html += '<textarea class="form-control" name="contact_message" rows="4" placeholder="' + translations.globalContactEmail.description + '"></textarea>'; 5386 html += '</div>'; 5387 html += '</div>'; 5388 html += '</div>'; 5389 html += '<div class="row">'; 5390 html += '<div class="col-xs-12">'; 5391 html += '<button type="submit" class="btn btn-primary btn-block">' + translations.send + '</button>'; 5392 html += '</div>'; 5393 html += '</div>'; 5394 html += '<input type="hidden" name="websiteID" value="' + $('#websiteID').val() + '">'; 5395 html += '<input type="hidden" name="w" value="' + $('#w').val() + '">'; 5396 html += '<input type="hidden" name="recaptchaToken" value="">'; 5397 html += '<input type="hidden" name="moduleID" value="' + that.moduleIDs[uniqueID] + '">'; 5398 html += '<input type="hidden" name="actionButtonForm" value="1">'; 5399 html += '<input type="hidden" name="buttonNum" value="' + that.settings[uniqueID].buttonNum + '">'; 5400 html += '<div class="conv-code-container"></div>'; 5401 html += '</form>'; 5402 } 5403 html += '<div class="g-c-email-message-sent-box">'; 5404 html += '<div class="row">'; 5405 html += '<div class="col-sm-6 col-xs-12 col-md-offset-3">'; 5406 html += '<h3 class="g-c-email-message-content">' + (that.custom_thank_you_msg[uniqueID].length > 0 ? that.custom_thank_you_msg[uniqueID] : translations.globalContactEmail.thankYouMessage) + '</h3>'; 5407 html += '</div>'; 5408 html += '</div>'; 5409 html += '<div class="row">'; 5410 html += '<div class="col-sm-6 col-xs-12 col-md-offset-3">'; 5411 html += '<button type="button" class="btn btn-primary close-order-thank-you">' + translations.globalContactEmail.thankYouCloseBtn + '</button>'; 5412 html += '</div>'; 5413 html += '</div>'; 5414 html += '</div>'; 5415 html += '</div>'; 5416 return html; 5417 }; 5418 that.submitHandler = function (uniqueID) { 5419 var $form = $('.a-b-email-form'); 5420 var customFormMultiSteps = new CustomFormMultiSteps(); 5421 customFormMultiSteps.init({ 5422 $form: $form, 5423 $nextButton: $form.find('.next-form-btn'), 5424 $submitButton: $form.find('.submit-form-btn'), 5425 $previousButton: $form.find('.previous-form-btn'), 5426 totalSteps: $form.find('.custom-form-steps').data('total-steps') 5427 }); 5428 $form.find('.f-b-date-timePicker').each(function () { 5429 var $option = $(this); 5430 var $datePicker = $option.find('.fake-input.date-time-picker'); 5431 var $hiddenInput = $option.find('[data-id="' + $datePicker.data('related-id') + '"]'); 5432 var $datePickerIcon = $option.find('.f-b-date-timePicker-icon'); 5433 var formBuilderCalendar = new calendar_handler(); 5434 $datePicker.data('date-format', $form.data('date-format')); 5435 formBuilderCalendar.init({ 5436 $fakeInput: $datePicker, 5437 $hiddenInput: $hiddenInput, 5438 $fakeInputIcon: $datePickerIcon, 5439 type: 'datePicker', 5440 title: translations.chooseDate, 5441 customClass: 'action-button-custom-form', 5442 calendarSettings: { 5443 format: $datePicker.data('date-format'), 5444 weekStart: 0, 5445 todayBtn: "linked", 5446 clearBtn: false, 5447 language: languageCode, 5448 todayHighlight: true 5449 }, 5450 onSubmit: function (selectedDate) { 5451 $datePicker.html(selectedDate); 5452 $hiddenInput.val(selectedDate); 5453 } 5454 }); 5455 }); 5456 CustomForm_DisableTwoColumns($form); 5457 var forms_GoogleRecaptcha = new Forms_GoogleRecaptcha(); 5458 forms_GoogleRecaptcha.init($form); 5459 $form.validate({ 5460 errorElement: 'div', 5461 errorClass: 'help-block', 5462 focusInvalid: true, 5463 ignore: ':hidden:not(.custom-form-step:visible input[name^="datePicker-"])', 5464 highlight: function (e) { 5465 $(e).closest('.form-group').removeClass('has-info').addClass('has-error'); 5466 }, 5467 success: function (e) { 5468 $(e).closest('.form-group').removeClass('has-error'); 5469 $(e).remove(); 5470 }, 5471 submitHandler: function (form) { 5472 var $form = $(form); 5473 $form.find('button:submit').prop('disabled', true); 5474 if (forms_GoogleRecaptcha.isActive && !forms_GoogleRecaptcha.isGotToken) { 5475 forms_GoogleRecaptcha.getToken(); 5476 return false;
5477 } 5478 var url = '/versions/' + $('#versionNUM').val() + '/include/contactO.php'; 5479 if (that.settings[uniqueID].showCustomForm == 'on' && that.custom_form_html[uniqueID].length !== 0 && that.customFromInputs[uniqueID] > 0) { 5480 url = '/versions/' + $('#versionNUM').val() + '/include/customFormO.php'; 5481 } 5482 $.ajax({ 5483 type: "POST", 5484 url: url, 5485 data: $form.serialize(), 5486 success: function (data) { 5487 data = tryParseJSON(data); 5488 $form.trigger("reset"); 5489 if (data.conv_code && data.conv_code.length > 0) { 5490 var $convCode = $('<div>' + data.conv_code + '</div>'); 5491 $form.find('.conv-code-container').html($convCode.text()); 5492 } 5493 if (data.action.buttonClickAction && data.action.buttonClickAction == 'redirect') { 5494 if (data.action.url.length > 0) { 5495 if (IsWizard()) { 5496 buildPopup_CloseAction('popupFloatDivActionButtonCustomForm'); 5497 bootbox.alert({ 5498 title: translations.previewExternalLinkTitle, 5499 message: translations.previewExternalLinkMsg.replace('{{externalLink}}', '<b>' + data.action.url + '</b>'), 5500 className: 'externalAlert' 5501 }); 5502 } else { 5503 buildPopup_CloseAction('popupFloatDivActionButtonCustomForm'); 5504 window.open(data.action.url, '_self'); 5505 } 5506 } 5507 } else { 5508 $form.addClass("hidden"); 5509 $(".g-c-email-message-sent-box").show(); 5510 $(".g-c-email-info-box").hide(); 5511 $form.next().find(".close-order-thank-you").on("click", function () { 5512 buildPopup_CloseAction('popupFloatDivActionButtonCustomForm'); 5513 }); 5514 } 5515 forms_GoogleRecaptcha.reset(); 5516 $form.find('button:submit').prop('disabled', false); 5517 WizardNotificationUpdate(); 5518 } 5519 }); 5520 return false; 5521 }, 5522 errorPlacement: function (error, element) { 5523 if (element.is('input[type=checkbox]') || element.is('input[type=radio]')) { 5524 var controls = element.closest('div[class*="col-"]'); 5525 if (controls.find(':checkbox,:radio').length > 0) element.closest('.form-group').append(error); 5526 else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0)); 5527 } else if (element.is('.select2')) { 5528 error.insertAfter(element.siblings('[class*="select2-container"]:eq(0)')); 5529 } else if (element.is('.chosen-select')) { 5530 error.insertAfter(element.siblings('[class*="chosen-container"]:eq(0)')); 5531 } else { 5532 error.appendTo(element.closest('.form-group')); 5533 } 5534 }, 5535 }); 5536 }; 5537 return that; 5538}();
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.