vendor: 3,619 bytes, lines 1-88
1/******/ (function(modules) { // webpackBootstrap 2/******/ // The module cache 3/******/ var installedModules = {}; 4/******/ 5/******/ // The require function 6/******/ function __webpack_require__(moduleId) { 7/******/ 8/******/ // Check if module is in cache 9/******/ if(installedModules[moduleId]) { 10/******/ return installedModules[moduleId].exports; 11/******/ } 12/******/ // Create a new module (and put it into the cache) 13/******/ var module = installedModules[moduleId] = { 14/******/ i: moduleId, 15/******/ l: false, 16/******/ exports: {} 17/******/ }; 18/******/ 19/******/ // Execute the module function 20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21/******/ 22/******/ // Flag the module as loaded 23/******/ module.l = true; 24/******/ 25/******/ // Return the exports of the module 26/******/ return module.exports; 27/******/ } 28/******/ 29/******/ 30/******/ // expose the modules object (__webpack_modules__) 31/******/ __webpack_require__.m = modules; 32/******/ 33/******/ // expose the module cache 34/******/ __webpack_require__.c = installedModules; 35/******/ 36/******/ // define getter function for harmony exports 37/******/ __webpack_require__.d = function(exports, name, getter) { 38/******/ if(!__webpack_require__.o(exports, name)) { 39/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 40/******/ } 41/******/ }; 42/******/ 43/******/ // define __esModule on exports 44/******/ __webpack_require__.r = function(exports) { 45/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 46/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 47/******/ } 48/******/ Object.defineProperty(exports, '__esModule', { value: true }); 49/******/ }; 50/******/ 51/******/ // create a fake namespace object 52/******/ // mode & 1: value is a module id, require it 53/******/ // mode & 2: merge all properties of value into the ns 54/******/ // mode & 4: return value when already ns object 55/******/ // mode & 8|1: behave like require 56/******/ __webpack_require__.t = function(value, mode) { 57/******/ if(mode & 1) value = __webpack_require__(value); 58/******/ if(mode & 8) return value; 59/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 60/******/ var ns = Object.create(null); 61/******/ __webpack_require__.r(ns); 62/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 63/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 64/******/ return ns; 65/******/ }; 66/******/ 67/******/ // getDefaultExport function for compatibility with non-harmony modules 68/******/ __webpack_require__.n = function(module) { 69/******/ var getter = module && module.__esModule ? 70/******/ function getDefault() { return module['default']; } : 71/******/ function getModuleExports() { return module; }; 72/******/ __webpack_require__.d(getter, 'a', getter); 73/******/ return getter; 74/******/ }; 75/******/ 76/******/ // Object.prototype.hasOwnProperty.call 77/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 78/******/ 79/******/ // __webpack_public_path__ 80/******/ __webpack_require__.p = ""; 81/******/ 82/******/ 83/******/ // Load entry module and return exports 84/******/ return __webpack_require__(__webpack_require__.s = "../src/static/js/main.js"); 85/******/ }) 86/************************************************************************/ 87/******/ ({ 88
vendor: 814 bytes, lines 89-109
89/***/ "../node_modules/core-js/internals/a-callable.js": 90/*!*******************************************************!*\ 91 !*** ../node_modules/core-js/internals/a-callable.js ***! 92 \*******************************************************/ 93/*! no static exports found */ 94/***/ (function(module, exports, __webpack_require__) { 95 96var isCallable = __webpack_require__(/*! ../internals/is-callable */ "../node_modules/core-js/internals/is-callable.js"); 97var tryToString = __webpack_require__(/*! ../internals/try-to-string */ "../node_modules/core-js/internals/try-to-string.js"); 98 99var $TypeError = TypeError; 100 101// `Assert: IsCallable(argument) is true` 102module.exports = function (argument) { 103 if (isCallable(argument)) return argument; 104 throw $TypeError(tryToString(argument) + ' is not a function'); 105}; 106 107 108/***/ }), 109
vendor: 1,877 bytes, lines 110-154
110/***/ "../node_modules/core-js/internals/array-iteration-from-last.js": 111/*!**********************************************************************!*\ 112 !*** ../node_modules/core-js/internals/array-iteration-from-last.js ***! 113 \**********************************************************************/ 114/*! no static exports found */ 115/***/ (function(module, exports, __webpack_require__) { 116 117var bind = __webpack_require__(/*! ../internals/function-bind-context */ "../node_modules/core-js/internals/function-bind-context.js"); 118var IndexedObject = __webpack_require__(/*! ../internals/indexed-object */ "../node_modules/core-js/internals/indexed-object.js"); 119var toObject = __webpack_require__(/*! ../internals/to-object */ "../node_modules/core-js/internals/to-object.js"); 120var lengthOfArrayLike = __webpack_require__(/*! ../internals/length-of-array-like */ "../node_modules/core-js/internals/length-of-array-like.js"); 121 122// `Array.prototype.{ findLast, findLastIndex }` methods implementation 123var createMethod = function (TYPE) { 124 var IS_FIND_LAST_INDEX = TYPE == 1; 125 return function ($this, callbackfn, that) { 126 var O = toObject($this); 127 var self = IndexedObject(O); 128 var boundFunction = bind(callbackfn, that); 129 var index = lengthOfArrayLike(self); 130 var value, result; 131 while (index-- > 0) { 132 value = self[index]; 133 result = boundFunction(value, index, O); 134 if (result) switch (TYPE) { 135 case 0: return value; // findLast 136 case 1: return index; // findLastIndex 137 } 138 } 139 return IS_FIND_LAST_INDEX ? -1 : undefined; 140 }; 141}; 142 143module.exports = { 144 // `Array.prototype.findLast` method 145 // https://github.com/tc39/proposal-array-find-from-last 146 findLast: createMethod(0), 147 // `Array.prototype.findLastIndex` method 148 // https://github.com/tc39/proposal-array-find-from-last 149 findLastIndex: createMethod(1) 150}; 151 152 153/***/ }), 154
vendor: 650 bytes, lines 155-173
155/***/ "../node_modules/core-js/internals/classof-raw.js": 156/*!********************************************************!*\ 157 !*** ../node_modules/core-js/internals/classof-raw.js ***! 158 \********************************************************/ 159/*! no static exports found */ 160/***/ (function(module, exports, __webpack_require__) { 161 162var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ "../node_modules/core-js/internals/function-uncurry-this.js"); 163 164var toString = uncurryThis({}.toString); 165var stringSlice = uncurryThis(''.slice); 166 167module.exports = function (it) { 168 return stringSlice(toString(it), 8, -1); 169}; 170 171 172/***/ }), 173
vendor: 596 bytes, lines 174-193
174/***/ "../node_modules/core-js/internals/document-all.js": 175/*!*********************************************************!*\ 176 !*** ../node_modules/core-js/internals/document-all.js ***! 177 \*********************************************************/ 178/*! no static exports found */ 179/***/ (function(module, exports) { 180 181var documentAll = typeof document == 'object' && document.all; 182 183// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot 184var IS_HTMLDDA = typeof documentAll == 'undefined' && documentAll !== undefined; 185 186module.exports = { 187 all: documentAll, 188 IS_HTMLDDA: IS_HTMLDDA 189}; 190 191 192/***/ }), 193
vendor: 407 bytes, lines 194-211
194/***/ "../node_modules/core-js/internals/fails.js": 195/*!**************************************************!*\ 196 !*** ../node_modules/core-js/internals/fails.js ***! 197 \**************************************************/ 198/*! no static exports found */ 199/***/ (function(module, exports) { 200 201module.exports = function (exec) { 202 try { 203 return !!exec(); 204 } catch (error) { 205 return true; 206 } 207}; 208 209 210/***/ }), 211
vendor: 1,063 bytes, lines 212-235
212/***/ "../node_modules/core-js/internals/function-bind-context.js": 213/*!******************************************************************!*\ 214 !*** ../node_modules/core-js/internals/function-bind-context.js ***! 215 \******************************************************************/ 216/*! no static exports found */ 217/***/ (function(module, exports, __webpack_require__) { 218 219var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ "../node_modules/core-js/internals/function-uncurry-this.js"); 220var aCallable = __webpack_require__(/*! ../internals/a-callable */ "../node_modules/core-js/internals/a-callable.js"); 221var NATIVE_BIND = __webpack_require__(/*! ../internals/function-bind-native */ "../node_modules/core-js/internals/function-bind-native.js"); 222 223var bind = uncurryThis(uncurryThis.bind); 224 225// optional / simple context binding 226module.exports = function (fn, that) { 227 aCallable(fn); 228 return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) { 229 return fn.apply(that, arguments); 230 }; 231}; 232 233 234/***/ }), 235
vendor: 779 bytes, lines 236-254
236/***/ "../node_modules/core-js/internals/function-bind-native.js": 237/*!*****************************************************************!*\ 238 !*** ../node_modules/core-js/internals/function-bind-native.js ***! 239 \*****************************************************************/ 240/*! no static exports found */ 241/***/ (function(module, exports, __webpack_require__) { 242 243var fails = __webpack_require__(/*! ../internals/fails */ "../node_modules/core-js/internals/fails.js"); 244 245module.exports = !fails(function () { 246 // eslint-disable-next-line es/no-function-prototype-bind -- safe 247 var test = (function () { /* empty */ }).bind(); 248 // eslint-disable-next-line no-prototype-builtins -- safe 249 return typeof test != 'function' || test.hasOwnProperty('prototype'); 250}); 251 252 253/***/ }), 254
vendor: 871 bytes, lines 255-279
255/***/ "../node_modules/core-js/internals/function-uncurry-this.js": 256/*!******************************************************************!*\ 257 !*** ../node_modules/core-js/internals/function-uncurry-this.js ***! 258 \******************************************************************/ 259/*! no static exports found */ 260/***/ (function(module, exports, __webpack_require__) { 261 262var NATIVE_BIND = __webpack_require__(/*! ../internals/function-bind-native */ "../node_modules/core-js/internals/function-bind-native.js"); 263 264var FunctionPrototype = Function.prototype; 265var bind = FunctionPrototype.bind; 266var call = FunctionPrototype.call; 267var uncurryThis = NATIVE_BIND && bind.bind(call, call); 268 269module.exports = NATIVE_BIND ? function (fn) { 270 return fn && uncurryThis(fn); 271} : function (fn) { 272 return fn && function () { 273 return call.apply(fn, arguments); 274 }; 275}; 276 277 278/***/ }), 279
vendor: 1,173 bytes, lines 280-305
280/***/ "../node_modules/core-js/internals/indexed-object.js": 281/*!***********************************************************!*\ 282 !*** ../node_modules/core-js/internals/indexed-object.js ***! 283 \***********************************************************/ 284/*! no static exports found */ 285/***/ (function(module, exports, __webpack_require__) { 286 287var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ "../node_modules/core-js/internals/function-uncurry-this.js"); 288var fails = __webpack_require__(/*! ../internals/fails */ "../node_modules/core-js/internals/fails.js"); 289var classof = __webpack_require__(/*! ../internals/classof-raw */ "../node_modules/core-js/internals/classof-raw.js"); 290 291var $Object = Object; 292var split = uncurryThis(''.split); 293 294// fallback for non-array-like ES3 and non-enumerable old V8 strings 295module.exports = fails(function () { 296 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 297 // eslint-disable-next-line no-prototype-builtins -- safe 298 return !$Object('z').propertyIsEnumerable(0); 299}) ? function (it) { 300 return classof(it) == 'String' ? split(it, '') : $Object(it); 301} : $Object; 302 303 304/***/ }), 305
vendor: 788 bytes, lines 306-327
306/***/ "../node_modules/core-js/internals/is-callable.js": 307/*!********************************************************!*\ 308 !*** ../node_modules/core-js/internals/is-callable.js ***! 309 \********************************************************/ 310/*! no static exports found */ 311/***/ (function(module, exports, __webpack_require__) { 312 313var $documentAll = __webpack_require__(/*! ../internals/document-all */ "../node_modules/core-js/internals/document-all.js"); 314 315var documentAll = $documentAll.all; 316 317// `IsCallable` abstract operation 318// https://tc39.es/ecma262/#sec-iscallable 319module.exports = $documentAll.IS_HTMLDDA ? function (argument) { 320 return typeof argument == 'function' || argument === documentAll; 321} : function (argument) { 322 return typeof argument == 'function'; 323}; 324 325 326/***/ }), 327
vendor: 568 bytes, lines 328-343
328/***/ "../node_modules/core-js/internals/is-null-or-undefined.js": 329/*!*****************************************************************!*\ 330 !*** ../node_modules/core-js/internals/is-null-or-undefined.js ***! 331 \*****************************************************************/ 332/*! no static exports found */ 333/***/ (function(module, exports) { 334 335// we can't use just `it == null` since of `document.all` special case 336// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec 337module.exports = function (it) { 338 return it === null || it === undefined; 339}; 340 341 342/***/ }), 343
vendor: 657 bytes, lines 344-361
344/***/ "../node_modules/core-js/internals/length-of-array-like.js": 345/*!*****************************************************************!*\ 346 !*** ../node_modules/core-js/internals/length-of-array-like.js ***! 347 \*****************************************************************/ 348/*! no static exports found */ 349/***/ (function(module, exports, __webpack_require__) { 350 351var toLength = __webpack_require__(/*! ../internals/to-length */ "../node_modules/core-js/internals/to-length.js"); 352 353// `LengthOfArrayLike` abstract operation 354// https://tc39.es/ecma262/#sec-lengthofarraylike 355module.exports = function (obj) { 356 return toLength(obj.length); 357}; 358 359 360/***/ }), 361
vendor: 589 bytes, lines 362-382
362/***/ "../node_modules/core-js/internals/math-trunc.js": 363/*!*******************************************************!*\ 364 !*** ../node_modules/core-js/internals/math-trunc.js ***! 365 \*******************************************************/ 366/*! no static exports found */ 367/***/ (function(module, exports) { 368 369var ceil = Math.ceil; 370var floor = Math.floor; 371 372// `Math.trunc` method 373// https://tc39.es/ecma262/#sec-math.trunc 374// eslint-disable-next-line es/no-math-trunc -- safe 375module.exports = Math.trunc || function trunc(x) { 376 var n = +x; 377 return (n > 0 ? floor : ceil)(n); 378}; 379 380 381/***/ }), 382
vendor: 801 bytes, lines 383-403
383/***/ "../node_modules/core-js/internals/require-object-coercible.js": 384/*!*********************************************************************!*\ 385 !*** ../node_modules/core-js/internals/require-object-coercible.js ***! 386 \*********************************************************************/ 387/*! no static exports found */ 388/***/ (function(module, exports, __webpack_require__) { 389 390var isNullOrUndefined = __webpack_require__(/*! ../internals/is-null-or-undefined */ "../node_modules/core-js/internals/is-null-or-undefined.js"); 391 392var $TypeError = TypeError; 393 394// `RequireObjectCoercible` abstract operation 395// https://tc39.es/ecma262/#sec-requireobjectcoercible 396module.exports = function (it) { 397 if (isNullOrUndefined(it)) throw $TypeError("Can't call method on " + it); 398 return it; 399}; 400 401 402/***/ }), 403
vendor: 791 bytes, lines 404-423
404/***/ "../node_modules/core-js/internals/to-integer-or-infinity.js": 405/*!*******************************************************************!*\ 406 !*** ../node_modules/core-js/internals/to-integer-or-infinity.js ***! 407 \*******************************************************************/ 408/*! no static exports found */ 409/***/ (function(module, exports, __webpack_require__) { 410 411var trunc = __webpack_require__(/*! ../internals/math-trunc */ "../node_modules/core-js/internals/math-trunc.js"); 412 413// `ToIntegerOrInfinity` abstract operation 414// https://tc39.es/ecma262/#sec-tointegerorinfinity 415module.exports = function (argument) { 416 var number = +argument; 417 // eslint-disable-next-line no-self-compare -- NaN check 418 return number !== number || number === 0 ? 0 : trunc(number); 419}; 420 421 422/***/ }), 423
vendor: 744 bytes, lines 424-443
424/***/ "../node_modules/core-js/internals/to-length.js": 425/*!******************************************************!*\ 426 !*** ../node_modules/core-js/internals/to-length.js ***! 427 \******************************************************/ 428/*! no static exports found */ 429/***/ (function(module, exports, __webpack_require__) { 430 431var toIntegerOrInfinity = __webpack_require__(/*! ../internals/to-integer-or-infinity */ "../node_modules/core-js/internals/to-integer-or-infinity.js"); 432 433var min = Math.min; 434 435// `ToLength` abstract operation 436// https://tc39.es/ecma262/#sec-tolength 437module.exports = function (argument) { 438 return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 439}; 440 441 442/***/ }), 443
vendor: 688 bytes, lines 444-463
444/***/ "../node_modules/core-js/internals/to-object.js": 445/*!******************************************************!*\ 446 !*** ../node_modules/core-js/internals/to-object.js ***! 447 \******************************************************/ 448/*! no static exports found */ 449/***/ (function(module, exports, __webpack_require__) { 450 451var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "../node_modules/core-js/internals/require-object-coercible.js"); 452 453var $Object = Object; 454 455// `ToObject` abstract operation 456// https://tc39.es/ecma262/#sec-toobject 457module.exports = function (argument) { 458 return $Object(requireObjectCoercible(argument)); 459}; 460 461 462/***/ }), 463
vendor: 479 bytes, lines 464-483
464/***/ "../node_modules/core-js/internals/try-to-string.js": 465/*!**********************************************************!*\ 466 !*** ../node_modules/core-js/internals/try-to-string.js ***! 467 \**********************************************************/ 468/*! no static exports found */ 469/***/ (function(module, exports) { 470 471var $String = String; 472 473module.exports = function (argument) { 474 try { 475 return $String(argument); 476 } catch (error) { 477 return 'Object'; 478 } 479}; 480 481 482/***/ }), 483
vendor: 529,900 bytes, lines 484-19554
484/***/ "../node_modules/jquery-ui-dist/jquery-ui.js": 485/*!***************************************************!*\ 486 !*** ../node_modules/jquery-ui-dist/jquery-ui.js ***! 487 \***************************************************/ 488/*! no static exports found */ 489/***/ (function(module, exports, __webpack_require__) { 490 491var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! jQuery UI - v1.13.2 - 2022-07-14 492* http://jqueryui.com 493* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js 494* Copyright jQuery Foundation and other contributors; Licensed MIT */ 495 496( function( factory ) { 497 "use strict"; 498 499 if ( true ) { 500 501 // AMD. Register as an anonymous module. 502 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(/*! jquery */ "jquery") ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 503 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 504 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 505 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 506 } else {} 507} )( function( $ ) { 508"use strict"; 509 510$.ui = $.ui || {}; 511 512var version = $.ui.version = "1.13.2"; 513 514 515/*! 516 * jQuery UI Widget 1.13.2 517 * http://jqueryui.com 518 * 519 * Copyright jQuery Foundation and other contributors 520 * Released under the MIT license. 521 * http://jquery.org/license 522 */ 523 524//>>label: Widget 525//>>group: Core 526//>>description: Provides a factory for creating stateful widgets with a common API. 527//>>docs: http://api.jqueryui.com/jQuery.widget/ 528//>>demos: http://jqueryui.com/widget/ 529 530 531var widgetUuid = 0; 532var widgetHasOwnProperty = Array.prototype.hasOwnProperty; 533var widgetSlice = Array.prototype.slice; 534 535$.cleanData = ( function( orig ) { 536 return function( elems ) { 537 var events, elem, i; 538 for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { 539 540 // Only trigger remove when necessary to save time 541 events = $._data( elem, "events" ); 542 if ( events && events.remove ) { 543 $( elem ).triggerHandler( "remove" ); 544 } 545 } 546 orig( elems ); 547 }; 548} )( $.cleanData ); 549 550$.widget = function( name, base, prototype ) { 551 var existingConstructor, constructor, basePrototype; 552 553 // ProxiedPrototype allows the provided prototype to remain unmodified 554 // so that it can be used as a mixin for multiple widgets (#8876) 555 var proxiedPrototype = {}; 556 557 var namespace = name.split( "." )[ 0 ]; 558 name = name.split( "." )[ 1 ]; 559 var fullName = namespace + "-" + name; 560 561 if ( !prototype ) { 562 prototype = base; 563 base = $.Widget; 564 } 565 566 if ( Array.isArray( prototype ) ) { 567 prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); 568 } 569 570 // Create selector for plugin 571 $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) { 572 return !!$.data( elem, fullName ); 573 }; 574 575 $[ namespace ] = $[ namespace ] || {}; 576 existingConstructor = $[ namespace ][ name ]; 577 constructor = $[ namespace ][ name ] = function( options, element ) { 578 579 // Allow instantiation without "new" keyword 580 if ( !this || !this._createWidget ) { 581 return new constructor( options, element ); 582 } 583 584 // Allow instantiation without initializing for simple inheritance 585 // must use "new" keyword (the code above always passes args) 586 if ( arguments.length ) { 587 this._createWidget( options, element ); 588 } 589 }; 590 591 // Extend with the existing constructor to carry over any static properties 592 $.extend( constructor, existingConstructor, { 593 version: prototype.version, 594 595 // Copy the object used to create the prototype in case we need to 596 // redefine the widget later 597 _proto: $.extend( {}, prototype ), 598 599 // Track widgets that inherit from this widget in case this widget is 600 // redefined after a widget inherits from it 601 _childConstructors: [] 602 } ); 603 604 basePrototype = new base(); 605 606 // We need to make the options hash a property directly on the new instance 607 // otherwise we'll modify the options hash on the prototype that we're 608 // inheriting from 609 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 610 $.each( prototype, function( prop, value ) { 611 if ( typeof value !== "function" ) { 612 proxiedPrototype[ prop ] = value; 613 return; 614 } 615 proxiedPrototype[ prop ] = ( function() { 616 function _super() { 617 return base.prototype[ prop ].apply( this, arguments ); 618 } 619 620 function _superApply( args ) { 621 return base.prototype[ prop ].apply( this, args ); 622 } 623 624 return function() { 625 var __super = this._super; 626 var __superApply = this._superApply; 627 var returnValue; 628 629 this._super = _super; 630 this._superApply = _superApply; 631 632 returnValue = value.apply( this, arguments ); 633 634 this._super = __super; 635 this._superApply = __superApply; 636 637 return returnValue; 638 }; 639 } )(); 640 } ); 641 constructor.prototype = $.widget.extend( basePrototype, { 642 643 // TODO: remove support for widgetEventPrefix 644 // always use the name + a colon as the prefix, e.g., draggable:start 645 // don't prefix for widgets that aren't DOM-based 646 widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name 647 }, proxiedPrototype, { 648 constructor: constructor, 649 namespace: namespace, 650 widgetName: name, 651 widgetFullName: fullName 652 } ); 653 654 // If this widget is being redefined then we need to find all widgets that 655 // are inheriting from it and redefine all of them so that they inherit from 656 // the new version of this widget. We're essentially trying to replace one 657 // level in the prototype chain. 658 if ( existingConstructor ) { 659 $.each( existingConstructor._childConstructors, function( i, child ) { 660 var childPrototype = child.prototype; 661 662 // Redefine the child widget using the same prototype that was 663 // originally used, but inherit from the new version of the base 664 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, 665 child._proto ); 666 } ); 667 668 // Remove the list of existing child constructors from the old constructor 669 // so the old child constructors can be garbage collected 670 delete existingConstructor._childConstructors; 671 } else { 672 base._childConstructors.push( constructor ); 673 } 674 675 $.widget.bridge( name, constructor ); 676 677 return constructor; 678}; 679 680$.widget.extend = function( target ) { 681 var input = widgetSlice.call( arguments, 1 ); 682 var inputIndex = 0; 683 var inputLength = input.length; 684 var key; 685 var value; 686 687 for ( ; inputIndex < inputLength; inputIndex++ ) { 688 for ( key in input[ inputIndex ] ) { 689 value = input[ inputIndex ][ key ]; 690 if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) { 691 692 // Clone objects 693 if ( $.isPlainObject( value ) ) { 694 target[ key ] = $.isPlainObject( target[ key ] ) ? 695 $.widget.extend( {}, target[ key ], value ) : 696 697 // Don't extend strings, arrays, etc. with objects 698 $.widget.extend( {}, value ); 699 700 // Copy everything else by reference 701 } else { 702 target[ key ] = value; 703 } 704 } 705 } 706 } 707 return target; 708}; 709 710$.widget.bridge = function( name, object ) { 711 var fullName = object.prototype.widgetFullName || name; 712 $.fn[ name ] = function( options ) { 713 var isMethodCall = typeof options === "string"; 714 var args = widgetSlice.call( arguments, 1 ); 715 var returnValue = this; 716 717 if ( isMethodCall ) { 718 719 // If this is an empty collection, we need to have the instance method 720 // return undefined instead of the jQuery instance 721 if ( !this.length && options === "instance" ) { 722 returnValue = undefined; 723 } else { 724 this.each( function() { 725 var methodValue; 726 var instance = $.data( this, fullName ); 727 728 if ( options === "instance" ) { 729 returnValue = instance; 730 return false; 731 } 732 733 if ( !instance ) { 734 return $.error( "cannot call methods on " + name + 735 " prior to initialization; " + 736 "attempted to call method '" + options + "'" ); 737 } 738 739 if ( typeof instance[ options ] !== "function" || 740 options.charAt( 0 ) === "_" ) { 741 return $.error( "no such method '" + options + "' for " + name + 742 " widget instance" ); 743 } 744 745 methodValue = instance[ options ].apply( instance, args ); 746 747 if ( methodValue !== instance && methodValue !== undefined ) { 748 returnValue = methodValue && methodValue.jquery ? 749 returnValue.pushStack( methodValue.get() ) : 750 methodValue; 751 return false; 752 } 753 } ); 754 } 755 } else { 756 757 // Allow multiple hashes to be passed on init 758 if ( args.length ) { 759 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 760 } 761 762 this.each( function() { 763 var instance = $.data( this, fullName ); 764 if ( instance ) { 765 instance.option( options || {} ); 766 if ( instance._init ) { 767 instance._init(); 768 } 769 } else { 770 $.data( this, fullName, new object( options, this ) ); 771 } 772 } ); 773 } 774 775 return returnValue; 776 }; 777}; 778 779$.Widget = function( /* options, element */ ) {}; 780$.Widget._childConstructors = []; 781 782$.Widget.prototype = { 783 widgetName: "widget", 784 widgetEventPrefix: "", 785 defaultElement: "<div>", 786 787 options: { 788 classes: {}, 789 disabled: false, 790 791 // Callbacks 792 create: null 793 }, 794 795 _createWidget: function( options, element ) { 796 element = $( element || this.defaultElement || this )[ 0 ]; 797 this.element = $( element ); 798 this.uuid = widgetUuid++; 799 this.eventNamespace = "." + this.widgetName + this.uuid; 800 801 this.bindings = $(); 802 this.hoverable = $(); 803 this.focusable = $(); 804 this.classesElementLookup = {}; 805 806 if ( element !== this ) { 807 $.data( element, this.widgetFullName, this ); 808 this._on( true, this.element, { 809 remove: function( event ) { 810 if ( event.target === element ) { 811 this.destroy(); 812 } 813 } 814 } ); 815 this.document = $( element.style ? 816 817 // Element within the document 818 element.ownerDocument : 819 820 // Element is window or document 821 element.document || element ); 822 this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow ); 823 } 824 825 this.options = $.widget.extend( {}, 826 this.options, 827 this._getCreateOptions(), 828 options ); 829 830 this._create(); 831 832 if ( this.options.disabled ) { 833 this._setOptionDisabled( this.options.disabled ); 834 } 835 836 this._trigger( "create", null, this._getCreateEventData() ); 837 this._init(); 838 }, 839 840 _getCreateOptions: function() { 841 return {}; 842 }, 843 844 _getCreateEventData: $.noop, 845 846 _create: $.noop, 847 848 _init: $.noop, 849 850 destroy: function() { 851 var that = this; 852 853 this._destroy(); 854 $.each( this.classesElementLookup, function( key, value ) { 855 that._removeClass( value, key ); 856 } ); 857 858 // We can probably remove the unbind calls in 2.0 859 // all event bindings should go through this._on() 860 this.element 861 .off( this.eventNamespace ) 862 .removeData( this.widgetFullName ); 863 this.widget() 864 .off( this.eventNamespace ) 865 .removeAttr( "aria-disabled" ); 866 867 // Clean up events and states 868 this.bindings.off( this.eventNamespace ); 869 }, 870 871 _destroy: $.noop, 872 873 widget: function() { 874 return this.element; 875 }, 876 877 option: function( key, value ) { 878 var options = key; 879 var parts; 880 var curOption; 881 var i; 882 883 if ( arguments.length === 0 ) { 884 885 // Don't return a reference to the internal hash 886 return $.widget.extend( {}, this.options ); 887 } 888 889 if ( typeof key === "string" ) { 890 891 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 892 options = {}; 893 parts = key.split( "." ); 894 key = parts.shift(); 895 if ( parts.length ) { 896 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 897 for ( i = 0; i < parts.length - 1; i++ ) { 898 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 899 curOption = curOption[ parts[ i ] ]; 900 } 901 key = parts.pop(); 902 if ( arguments.length === 1 ) { 903 return curOption[ key ] === undefined ? null : curOption[ key ]; 904 } 905 curOption[ key ] = value; 906 } else { 907 if ( arguments.length === 1 ) { 908 return this.options[ key ] === undefined ? null : this.options[ key ]; 909 } 910 options[ key ] = value; 911 } 912 } 913 914 this._setOptions( options ); 915 916 return this; 917 }, 918 919 _setOptions: function( options ) { 920 var key; 921 922 for ( key in options ) { 923 this._setOption( key, options[ key ] ); 924 } 925 926 return this; 927 }, 928 929 _setOption: function( key, value ) { 930 if ( key === "classes" ) { 931 this._setOptionClasses( value ); 932 } 933 934 this.options[ key ] = value; 935 936 if ( key === "disabled" ) { 937 this._setOptionDisabled( value ); 938 } 939 940 return this; 941 }, 942 943 _setOptionClasses: function( value ) { 944 var classKey, elements, currentElements; 945 946 for ( classKey in value ) { 947 currentElements = this.classesElementLookup[ classKey ]; 948 if ( value[ classKey ] === this.options.classes[ classKey ] || 949 !currentElements || 950 !currentElements.length ) { 951 continue; 952 } 953 954 // We are doing this to create a new jQuery object because the _removeClass() call 955 // on the next line is going to destroy the reference to the current elements being 956 // tracked. We need to save a copy of this collection so that we can add the new classes 957 // below. 958 elements = $( currentElements.get() ); 959 this._removeClass( currentElements, classKey ); 960 961 // We don't use _addClass() here, because that uses this.options.classes 962 // for generating the string of classes. We want to use the value passed in from 963 // _setOption(), this is the new value of the classes option which was passed to 964 // _setOption(). We pass this value directly to _classes(). 965 elements.addClass( this._classes( { 966 element: elements, 967 keys: classKey, 968 classes: value, 969 add: true 970 } ) ); 971 } 972 }, 973 974 _setOptionDisabled: function( value ) { 975 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value ); 976 977 // If the widget is becoming disabled, then nothing is interactive 978 if ( value ) { 979 this._removeClass( this.hoverable, null, "ui-state-hover" ); 980 this._removeClass( this.focusable, null, "ui-state-focus" ); 981 } 982 }, 983 984 enable: function() { 985 return this._setOptions( { disabled: false } ); 986 }, 987 988 disable: function() { 989 return this._setOptions( { disabled: true } ); 990 }, 991 992 _classes: function( options ) { 993 var full = []; 994 var that = this; 995 996 options = $.extend( { 997 element: this.element, 998 classes: this.options.classes || {} 999 }, options ); 1000 1001 function bindRemoveEvent() { 1002 var nodesToBind = []; 1003 1004 options.element.each( function( _, element ) { 1005 var isTracked = $.map( that.classesElementLookup, function( elements ) { 1006 return elements; 1007 } ) 1008 .some( function( elements ) { 1009 return elements.is( element ); 1010 } ); 1011 1012 if ( !isTracked ) { 1013 nodesToBind.push( element ); 1014 } 1015 } ); 1016 1017 that._on( $( nodesToBind ), { 1018 remove: "_untrackClassesElement" 1019 } ); 1020 } 1021 1022 function processClassString( classes, checkOption ) { 1023 var current, i; 1024 for ( i = 0; i < classes.length; i++ ) { 1025 current = that.classesElementLookup[ classes[ i ] ] || $(); 1026 if ( options.add ) { 1027 bindRemoveEvent(); 1028 current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) ); 1029 } else { 1030 current = $( current.not( options.element ).get() ); 1031 } 1032 that.classesElementLookup[ classes[ i ] ] = current; 1033 full.push( classes[ i ] ); 1034 if ( checkOption && options.classes[ classes[ i ] ] ) { 1035 full.push( options.classes[ classes[ i ] ] ); 1036 } 1037 } 1038 } 1039 1040 if ( options.keys ) { 1041 processClassString( options.keys.match( /\S+/g ) || [], true ); 1042 } 1043 if ( options.extra ) { 1044 processClassString( options.extra.match( /\S+/g ) || [] ); 1045 } 1046 1047 return full.join( " " ); 1048 }, 1049 1050 _untrackClassesElement: function( event ) { 1051 var that = this; 1052 $.each( that.classesElementLookup, function( key, value ) { 1053 if ( $.inArray( event.target, value ) !== -1 ) { 1054 that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); 1055 } 1056 } ); 1057 1058 this._off( $( event.target ) ); 1059 }, 1060 1061 _removeClass: function( element, keys, extra ) { 1062 return this._toggleClass( element, keys, extra, false ); 1063 }, 1064 1065 _addClass: function( element, keys, extra ) { 1066 return this._toggleClass( element, keys, extra, true ); 1067 }, 1068 1069 _toggleClass: function( element, keys, extra, add ) { 1070 add = ( typeof add === "boolean" ) ? add : extra; 1071 var shift = ( typeof element === "string" || element === null ), 1072 options = { 1073 extra: shift ? keys : extra, 1074 keys: shift ? element : keys, 1075 element: shift ? this.element : element, 1076 add: add 1077 }; 1078 options.element.toggleClass( this._classes( options ), add ); 1079 return this; 1080 }, 1081 1082 _on: function( suppressDisabledCheck, element, handlers ) { 1083 var delegateElement; 1084 var instance = this; 1085 1086 // No suppressDisabledCheck flag, shuffle arguments 1087 if ( typeof suppressDisabledCheck !== "boolean" ) { 1088 handlers = element; 1089 element = suppressDisabledCheck; 1090 suppressDisabledCheck = false; 1091 } 1092 1093 // No element argument, shuffle and use this.element 1094 if ( !handlers ) { 1095 handlers = element; 1096 element = this.element; 1097 delegateElement = this.widget(); 1098 } else { 1099 element = delegateElement = $( element ); 1100 this.bindings = this.bindings.add( element ); 1101 } 1102 1103 $.each( handlers, function( event, handler ) { 1104 function handlerProxy() { 1105 1106 // Allow widgets to customize the disabled handling 1107 // - disabled as an array instead of boolean 1108 // - disabled class as method for disabling individual parts 1109 if ( !suppressDisabledCheck && 1110 ( instance.options.disabled === true || 1111 $( this ).hasClass( "ui-state-disabled" ) ) ) { 1112 return; 1113 } 1114 return ( typeof handler === "string" ? instance[ handler ] : handler ) 1115 .apply( instance, arguments ); 1116 } 1117 1118 // Copy the guid so direct unbinding works 1119 if ( typeof handler !== "string" ) { 1120 handlerProxy.guid = handler.guid = 1121 handler.guid || handlerProxy.guid || $.guid++; 1122 } 1123 1124 var match = event.match( /^([\w:-]*)\s*(.*)$/ ); 1125 var eventName = match[ 1 ] + instance.eventNamespace; 1126 var selector = match[ 2 ]; 1127 1128 if ( selector ) { 1129 delegateElement.on( eventName, selector, handlerProxy ); 1130 } else { 1131 element.on( eventName, handlerProxy ); 1132 } 1133 } ); 1134 }, 1135 1136 _off: function( element, eventName ) { 1137 eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + 1138 this.eventNamespace; 1139 element.off( eventName ); 1140 1141 // Clear the stack to avoid memory leaks (#10056) 1142 this.bindings = $( this.bindings.not( element ).get() ); 1143 this.focusable = $( this.focusable.not( element ).get() ); 1144 this.hoverable = $( this.hoverable.not( element ).get() ); 1145 }, 1146 1147 _delay: function( handler, delay ) { 1148 function handlerProxy() { 1149 return ( typeof handler === "string" ? instance[ handler ] : handler ) 1150 .apply( instance, arguments ); 1151 } 1152 var instance = this; 1153 return setTimeout( handlerProxy, delay || 0 ); 1154 }, 1155 1156 _hoverable: function( element ) { 1157 this.hoverable = this.hoverable.add( element ); 1158 this._on( element, { 1159 mouseenter: function( event ) { 1160 this._addClass( $( event.currentTarget ), null, "ui-state-hover" ); 1161 }, 1162 mouseleave: function( event ) { 1163 this._removeClass( $( event.currentTarget ), null, "ui-state-hover" ); 1164 } 1165 } ); 1166 }, 1167 1168 _focusable: function( element ) { 1169 this.focusable = this.focusable.add( element ); 1170 this._on( element, { 1171 focusin: function( event ) { 1172 this._addClass( $( event.currentTarget ), null, "ui-state-focus" ); 1173 }, 1174 focusout: function( event ) { 1175 this._removeClass( $( event.currentTarget ), null, "ui-state-focus" ); 1176 } 1177 } ); 1178 }, 1179 1180 _trigger: function( type, event, data ) { 1181 var prop, orig; 1182 var callback = this.options[ type ]; 1183 1184 data = data || {}; 1185 event = $.Event( event ); 1186 event.type = ( type === this.widgetEventPrefix ? 1187 type : 1188 this.widgetEventPrefix + type ).toLowerCase(); 1189 1190 // The original event may come from any element 1191 // so we need to reset the target on the new event 1192 event.target = this.element[ 0 ]; 1193 1194 // Copy original event properties over to the new event 1195 orig = event.originalEvent; 1196 if ( orig ) { 1197 for ( prop in orig ) { 1198 if ( !( prop in event ) ) { 1199 event[ prop ] = orig[ prop ]; 1200 } 1201 } 1202 } 1203 1204 this.element.trigger( event, data ); 1205 return !( typeof callback === "function" && 1206 callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || 1207 event.isDefaultPrevented() ); 1208 } 1209}; 1210 1211$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 1212 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 1213 if ( typeof options === "string" ) { 1214 options = { effect: options }; 1215 } 1216 1217 var hasOptions; 1218 var effectName = !options ? 1219 method : 1220 options === true || typeof options === "number" ? 1221 defaultEffect : 1222 options.effect || defaultEffect; 1223 1224 options = options || {}; 1225 if ( typeof options === "number" ) { 1226 options = { duration: options }; 1227 } else if ( options === true ) { 1228 options = {}; 1229 } 1230 1231 hasOptions = !$.isEmptyObject( options ); 1232 options.complete = callback; 1233 1234 if ( options.delay ) { 1235 element.delay( options.delay ); 1236 } 1237 1238 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 1239 element[ method ]( options ); 1240 } else if ( effectName !== method && element[ effectName ] ) { 1241 element[ effectName ]( options.duration, options.easing, callback ); 1242 } else { 1243 element.queue( function( next ) { 1244 $( this )[ method ](); 1245 if ( callback ) { 1246 callback.call( element[ 0 ] ); 1247 } 1248 next(); 1249 } ); 1250 } 1251 }; 1252} ); 1253 1254var widget = $.widget; 1255 1256 1257/*! 1258 * jQuery UI Position 1.13.2 1259 * http://jqueryui.com 1260 * 1261 * Copyright jQuery Foundation and other contributors 1262 * Released under the MIT license. 1263 * http://jquery.org/license 1264 * 1265 * http://api.jqueryui.com/position/ 1266 */ 1267 1268//>>label: Position 1269//>>group: Core 1270//>>description: Positions elements relative to other elements. 1271//>>docs: http://api.jqueryui.com/position/ 1272//>>demos: http://jqueryui.com/position/ 1273 1274 1275( function() { 1276var cachedScrollbarWidth, 1277 max = Math.max, 1278 abs = Math.abs, 1279 rhorizontal = /left|center|right/, 1280 rvertical = /top|center|bottom/, 1281 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 1282 rposition = /^\w+/, 1283 rpercent = /%$/, 1284 _position = $.fn.position; 1285 1286function getOffsets( offsets, width, height ) { 1287 return [ 1288 parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), 1289 parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) 1290 ]; 1291} 1292 1293function parseCss( element, property ) { 1294 return parseInt( $.css( element, property ), 10 ) || 0; 1295} 1296 1297function isWindow( obj ) { 1298 return obj != null && obj === obj.window; 1299} 1300 1301function getDimensions( elem ) { 1302 var raw = elem[ 0 ]; 1303 if ( raw.nodeType === 9 ) { 1304 return { 1305 width: elem.width(), 1306 height: elem.height(), 1307 offset: { top: 0, left: 0 } 1308 }; 1309 } 1310 if ( isWindow( raw ) ) { 1311 return { 1312 width: elem.width(), 1313 height: elem.height(), 1314 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 1315 }; 1316 } 1317 if ( raw.preventDefault ) { 1318 return { 1319 width: 0, 1320 height: 0, 1321 offset: { top: raw.pageY, left: raw.pageX } 1322 }; 1323 } 1324 return { 1325 width: elem.outerWidth(), 1326 height: elem.outerHeight(), 1327 offset: elem.offset() 1328 }; 1329} 1330 1331$.position = { 1332 scrollbarWidth: function() { 1333 if ( cachedScrollbarWidth !== undefined ) { 1334 return cachedScrollbarWidth; 1335 } 1336 var w1, w2, 1337 div = $( "<div style=" + 1338 "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" + 1339 "<div style='height:300px;width:auto;'></div></div>" ), 1340 innerDiv = div.children()[ 0 ]; 1341 1342 $( "body" ).append( div ); 1343 w1 = innerDiv.offsetWidth; 1344 div.css( "overflow", "scroll" ); 1345 1346 w2 = innerDiv.offsetWidth; 1347 1348 if ( w1 === w2 ) { 1349 w2 = div[ 0 ].clientWidth; 1350 } 1351 1352 div.remove(); 1353 1354 return ( cachedScrollbarWidth = w1 - w2 ); 1355 }, 1356 getScrollInfo: function( within ) { 1357 var overflowX = within.isWindow || within.isDocument ? "" : 1358 within.element.css( "overflow-x" ), 1359 overflowY = within.isWindow || within.isDocument ? "" : 1360 within.element.css( "overflow-y" ), 1361 hasOverflowX = overflowX === "scroll" || 1362 ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ), 1363 hasOverflowY = overflowY === "scroll" || 1364 ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight ); 1365 return { 1366 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 1367 height: hasOverflowX ? $.position.scrollbarWidth() : 0 1368 }; 1369 }, 1370 getWithinInfo: function( element ) { 1371 var withinElement = $( element || window ), 1372 isElemWindow = isWindow( withinElement[ 0 ] ), 1373 isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9, 1374 hasOffset = !isElemWindow && !isDocument; 1375 return { 1376 element: withinElement, 1377 isWindow: isElemWindow, 1378 isDocument: isDocument, 1379 offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 }, 1380 scrollLeft: withinElement.scrollLeft(), 1381 scrollTop: withinElement.scrollTop(), 1382 width: withinElement.outerWidth(), 1383 height: withinElement.outerHeight() 1384 }; 1385 } 1386}; 1387 1388$.fn.position = function( options ) { 1389 if ( !options || !options.of ) { 1390 return _position.apply( this, arguments ); 1391 } 1392 1393 // Make a copy, we don't want to modify arguments 1394 options = $.extend( {}, options ); 1395 1396 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 1397 1398 // Make sure string options are treated as CSS selectors 1399 target = typeof options.of === "string" ? 1400 $( document ).find( options.of ) : 1401 $( options.of ), 1402 1403 within = $.position.getWithinInfo( options.within ), 1404 scrollInfo = $.position.getScrollInfo( within ), 1405 collision = ( options.collision || "flip" ).split( " " ), 1406 offsets = {}; 1407 1408 dimensions = getDimensions( target ); 1409 if ( target[ 0 ].preventDefault ) { 1410 1411 // Force left top to allow flipping 1412 options.at = "left top"; 1413 } 1414 targetWidth = dimensions.width; 1415 targetHeight = dimensions.height; 1416 targetOffset = dimensions.offset; 1417 1418 // Clone to reuse original targetOffset later 1419 basePosition = $.extend( {}, targetOffset ); 1420 1421 // Force my and at to have valid horizontal and vertical positions 1422 // if a value is missing or invalid, it will be converted to center 1423 $.each( [ "my", "at" ], function() { 1424 var pos = ( options[ this ] || "" ).split( " " ), 1425 horizontalOffset, 1426 verticalOffset; 1427 1428 if ( pos.length === 1 ) { 1429 pos = rhorizontal.test( pos[ 0 ] ) ? 1430 pos.concat( [ "center" ] ) : 1431 rvertical.test( pos[ 0 ] ) ? 1432 [ "center" ].concat( pos ) : 1433 [ "center", "center" ]; 1434 } 1435 pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; 1436 pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; 1437 1438 // Calculate offsets 1439 horizontalOffset = roffset.exec( pos[ 0 ] ); 1440 verticalOffset = roffset.exec( pos[ 1 ] ); 1441 offsets[ this ] = [ 1442 horizontalOffset ? horizontalOffset[ 0 ] : 0, 1443 verticalOffset ? verticalOffset[ 0 ] : 0 1444 ]; 1445 1446 // Reduce to just the positions without the offsets 1447 options[ this ] = [ 1448 rposition.exec( pos[ 0 ] )[ 0 ], 1449 rposition.exec( pos[ 1 ] )[ 0 ] 1450 ]; 1451 } ); 1452 1453 // Normalize collision option 1454 if ( collision.length === 1 ) { 1455 collision[ 1 ] = collision[ 0 ]; 1456 } 1457 1458 if ( options.at[ 0 ] === "right" ) { 1459 basePosition.left += targetWidth; 1460 } else if ( options.at[ 0 ] === "center" ) { 1461 basePosition.left += targetWidth / 2; 1462 } 1463 1464 if ( options.at[ 1 ] === "bottom" ) { 1465 basePosition.top += targetHeight; 1466 } else if ( options.at[ 1 ] === "center" ) { 1467 basePosition.top += targetHeight / 2; 1468 } 1469 1470 atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); 1471 basePosition.left += atOffset[ 0 ]; 1472 basePosition.top += atOffset[ 1 ]; 1473 1474 return this.each( function() { 1475 var collisionPosition, using, 1476 elem = $( this ), 1477 elemWidth = elem.outerWidth(), 1478 elemHeight = elem.outerHeight(), 1479 marginLeft = parseCss( this, "marginLeft" ), 1480 marginTop = parseCss( this, "marginTop" ), 1481 collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + 1482 scrollInfo.width, 1483 collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + 1484 scrollInfo.height, 1485 position = $.extend( {}, basePosition ), 1486 myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); 1487 1488 if ( options.my[ 0 ] === "right" ) { 1489 position.left -= elemWidth; 1490 } else if ( options.my[ 0 ] === "center" ) { 1491 position.left -= elemWidth / 2; 1492 } 1493 1494 if ( options.my[ 1 ] === "bottom" ) { 1495 position.top -= elemHeight; 1496 } else if ( options.my[ 1 ] === "center" ) { 1497 position.top -= elemHeight / 2; 1498 } 1499 1500 position.left += myOffset[ 0 ]; 1501 position.top += myOffset[ 1 ]; 1502 1503 collisionPosition = { 1504 marginLeft: marginLeft, 1505 marginTop: marginTop 1506 }; 1507 1508 $.each( [ "left", "top" ], function( i, dir ) { 1509 if ( $.ui.position[ collision[ i ] ] ) { 1510 $.ui.position[ collision[ i ] ][ dir ]( position, { 1511 targetWidth: targetWidth, 1512 targetHeight: targetHeight, 1513 elemWidth: elemWidth, 1514 elemHeight: elemHeight, 1515 collisionPosition: collisionPosition, 1516 collisionWidth: collisionWidth, 1517 collisionHeight: collisionHeight, 1518 offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], 1519 my: options.my, 1520 at: options.at, 1521 within: within, 1522 elem: elem 1523 } ); 1524 } 1525 } ); 1526 1527 if ( options.using ) { 1528 1529 // Adds feedback as second argument to using callback, if present 1530 using = function( props ) { 1531 var left = targetOffset.left - position.left, 1532 right = left + targetWidth - elemWidth, 1533 top = targetOffset.top - position.top, 1534 bottom = top + targetHeight - elemHeight, 1535 feedback = { 1536 target: { 1537 element: target, 1538 left: targetOffset.left, 1539 top: targetOffset.top, 1540 width: targetWidth, 1541 height: targetHeight 1542 }, 1543 element: { 1544 element: elem, 1545 left: position.left, 1546 top: position.top, 1547 width: elemWidth, 1548 height: elemHeight 1549 }, 1550 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 1551 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 1552 }; 1553 if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { 1554 feedback.horizontal = "center"; 1555 } 1556 if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { 1557 feedback.vertical = "middle"; 1558 } 1559 if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { 1560 feedback.important = "horizontal"; 1561 } else { 1562 feedback.important = "vertical"; 1563 } 1564 options.using.call( this, props, feedback ); 1565 }; 1566 } 1567 1568 elem.offset( $.extend( position, { using: using } ) ); 1569 } ); 1570}; 1571 1572$.ui.position = { 1573 fit: { 1574 left: function( position, data ) { 1575 var within = data.within, 1576 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 1577 outerWidth = within.width, 1578 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1579 overLeft = withinOffset - collisionPosLeft, 1580 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 1581 newOverRight; 1582 1583 // Element is wider than within 1584 if ( data.collisionWidth > outerWidth ) { 1585 1586 // Element is initially over the left side of within 1587 if ( overLeft > 0 && overRight <= 0 ) { 1588 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - 1589 withinOffset; 1590 position.left += overLeft - newOverRight; 1591 1592 // Element is initially over right side of within 1593 } else if ( overRight > 0 && overLeft <= 0 ) { 1594 position.left = withinOffset; 1595 1596 // Element is initially over both left and right sides of within 1597 } else { 1598 if ( overLeft > overRight ) { 1599 position.left = withinOffset + outerWidth - data.collisionWidth; 1600 } else { 1601 position.left = withinOffset; 1602 } 1603 } 1604 1605 // Too far left -> align with left edge 1606 } else if ( overLeft > 0 ) { 1607 position.left += overLeft; 1608 1609 // Too far right -> align with right edge 1610 } else if ( overRight > 0 ) { 1611 position.left -= overRight; 1612 1613 // Adjust based on position and margin 1614 } else { 1615 position.left = max( position.left - collisionPosLeft, position.left ); 1616 } 1617 }, 1618 top: function( position, data ) { 1619 var within = data.within, 1620 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 1621 outerHeight = data.within.height, 1622 collisionPosTop = position.top - data.collisionPosition.marginTop, 1623 overTop = withinOffset - collisionPosTop, 1624 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 1625 newOverBottom; 1626 1627 // Element is taller than within 1628 if ( data.collisionHeight > outerHeight ) { 1629 1630 // Element is initially over the top of within 1631 if ( overTop > 0 && overBottom <= 0 ) { 1632 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - 1633 withinOffset; 1634 position.top += overTop - newOverBottom; 1635 1636 // Element is initially over bottom of within 1637 } else if ( overBottom > 0 && overTop <= 0 ) { 1638 position.top = withinOffset; 1639 1640 // Element is initially over both top and bottom of within 1641 } else { 1642 if ( overTop > overBottom ) { 1643 position.top = withinOffset + outerHeight - data.collisionHeight; 1644 } else { 1645 position.top = withinOffset; 1646 } 1647 } 1648 1649 // Too far up -> align with top 1650 } else if ( overTop > 0 ) { 1651 position.top += overTop; 1652 1653 // Too far down -> align with bottom edge 1654 } else if ( overBottom > 0 ) { 1655 position.top -= overBottom; 1656 1657 // Adjust based on position and margin 1658 } else { 1659 position.top = max( position.top - collisionPosTop, position.top ); 1660 } 1661 } 1662 }, 1663 flip: { 1664 left: function( position, data ) { 1665 var within = data.within, 1666 withinOffset = within.offset.left + within.scrollLeft, 1667 outerWidth = within.width, 1668 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 1669 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1670 overLeft = collisionPosLeft - offsetLeft, 1671 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 1672 myOffset = data.my[ 0 ] === "left" ? 1673 -data.elemWidth : 1674 data.my[ 0 ] === "right" ? 1675 data.elemWidth : 1676 0, 1677 atOffset = data.at[ 0 ] === "left" ? 1678 data.targetWidth : 1679 data.at[ 0 ] === "right" ? 1680 -data.targetWidth : 1681 0, 1682 offset = -2 * data.offset[ 0 ], 1683 newOverRight, 1684 newOverLeft; 1685 1686 if ( overLeft < 0 ) { 1687 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - 1688 outerWidth - withinOffset; 1689 if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { 1690 position.left += myOffset + atOffset + offset; 1691 } 1692 } else if ( overRight > 0 ) { 1693 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + 1694 atOffset + offset - offsetLeft; 1695 if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { 1696 position.left += myOffset + atOffset + offset; 1697 } 1698 } 1699 }, 1700 top: function( position, data ) { 1701 var within = data.within, 1702 withinOffset = within.offset.top + within.scrollTop, 1703 outerHeight = within.height, 1704 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 1705 collisionPosTop = position.top - data.collisionPosition.marginTop, 1706 overTop = collisionPosTop - offsetTop, 1707 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 1708 top = data.my[ 1 ] === "top", 1709 myOffset = top ? 1710 -data.elemHeight : 1711 data.my[ 1 ] === "bottom" ? 1712 data.elemHeight : 1713 0, 1714 atOffset = data.at[ 1 ] === "top" ? 1715 data.targetHeight : 1716 data.at[ 1 ] === "bottom" ? 1717 -data.targetHeight : 1718 0, 1719 offset = -2 * data.offset[ 1 ], 1720 newOverTop, 1721 newOverBottom; 1722 if ( overTop < 0 ) { 1723 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - 1724 outerHeight - withinOffset; 1725 if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) { 1726 position.top += myOffset + atOffset + offset; 1727 } 1728 } else if ( overBottom > 0 ) { 1729 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + 1730 offset - offsetTop; 1731 if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) { 1732 position.top += myOffset + atOffset + offset; 1733 } 1734 } 1735 } 1736 }, 1737 flipfit: { 1738 left: function() { 1739 $.ui.position.flip.left.apply( this, arguments ); 1740 $.ui.position.fit.left.apply( this, arguments ); 1741 }, 1742 top: function() { 1743 $.ui.position.flip.top.apply( this, arguments ); 1744 $.ui.position.fit.top.apply( this, arguments ); 1745 } 1746 } 1747}; 1748 1749} )(); 1750 1751var position = $.ui.position; 1752 1753 1754/*! 1755 * jQuery UI :data 1.13.2 1756 * http://jqueryui.com 1757 * 1758 * Copyright jQuery Foundation and other contributors 1759 * Released under the MIT license. 1760 * http://jquery.org/license 1761 */ 1762 1763//>>label: :data Selector 1764//>>group: Core 1765//>>description: Selects elements which have data stored under the specified key. 1766//>>docs: http://api.jqueryui.com/data-selector/ 1767 1768 1769var data = $.extend( $.expr.pseudos, { 1770 data: $.expr.createPseudo ? 1771 $.expr.createPseudo( function( dataName ) { 1772 return function( elem ) { 1773 return !!$.data( elem, dataName ); 1774 }; 1775 } ) : 1776 1777 // Support: jQuery <1.8 1778 function( elem, i, match ) { 1779 return !!$.data( elem, match[ 3 ] ); 1780 } 1781} ); 1782 1783/*! 1784 * jQuery UI Disable Selection 1.13.2 1785 * http://jqueryui.com 1786 * 1787 * Copyright jQuery Foundation and other contributors 1788 * Released under the MIT license. 1789 * http://jquery.org/license 1790 */ 1791 1792//>>label: disableSelection 1793//>>group: Core 1794//>>description: Disable selection of text content within the set of matched elements. 1795//>>docs: http://api.jqueryui.com/disableSelection/ 1796 1797// This file is deprecated 1798 1799var disableSelection = $.fn.extend( { 1800 disableSelection: ( function() { 1801 var eventType = "onselectstart" in document.createElement( "div" ) ? 1802 "selectstart" : 1803 "mousedown"; 1804 1805 return function() { 1806 return this.on( eventType + ".ui-disableSelection", function( event ) { 1807 event.preventDefault(); 1808 } ); 1809 }; 1810 } )(), 1811 1812 enableSelection: function() { 1813 return this.off( ".ui-disableSelection" ); 1814 } 1815} ); 1816 1817 1818 1819// Create a local jQuery because jQuery Color relies on it and the 1820// global may not exist with AMD and a custom build (#10199). 1821// This module is a noop if used as a regular AMD module. 1822// eslint-disable-next-line no-unused-vars 1823var jQuery = $; 1824 1825 1826/*! 1827 * jQuery Color Animations v2.2.0 1828 * https://github.com/jquery/jquery-color 1829 * 1830 * Copyright OpenJS Foundation and other contributors 1831 * Released under the MIT license. 1832 * http://jquery.org/license 1833 * 1834 * Date: Sun May 10 09:02:36 2020 +0200 1835 */ 1836 1837 1838 1839 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + 1840 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 1841 1842 class2type = {}, 1843 toString = class2type.toString, 1844 1845 // plusequals test for += 100 -= 100 1846 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 1847 1848 // a set of RE's that can match strings and generate color tuples. 1849 stringParsers = [ { 1850 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1851 parse: function( execResult ) { 1852 return [ 1853 execResult[ 1 ], 1854 execResult[ 2 ], 1855 execResult[ 3 ], 1856 execResult[ 4 ] 1857 ]; 1858 } 1859 }, { 1860 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1861 parse: function( execResult ) { 1862 return [ 1863 execResult[ 1 ] * 2.55, 1864 execResult[ 2 ] * 2.55, 1865 execResult[ 3 ] * 2.55, 1866 execResult[ 4 ] 1867 ]; 1868 } 1869 }, { 1870 1871 // this regex ignores A-F because it's compared against an already lowercased string 1872 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/, 1873 parse: function( execResult ) { 1874 return [ 1875 parseInt( execResult[ 1 ], 16 ), 1876 parseInt( execResult[ 2 ], 16 ), 1877 parseInt( execResult[ 3 ], 16 ), 1878 execResult[ 4 ] ? 1879 ( parseInt( execResult[ 4 ], 16 ) / 255 ).toFixed( 2 ) : 1880 1 1881 ]; 1882 } 1883 }, { 1884 1885 // this regex ignores A-F because it's compared against an already lowercased string 1886 re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/, 1887 parse: function( execResult ) { 1888 return [ 1889 parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), 1890 parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), 1891 parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ), 1892 execResult[ 4 ] ? 1893 ( parseInt( execResult[ 4 ] + execResult[ 4 ], 16 ) / 255 ) 1894 .toFixed( 2 ) : 1895 1 1896 ]; 1897 } 1898 }, { 1899 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1900 space: "hsla", 1901 parse: function( execResult ) { 1902 return [ 1903 execResult[ 1 ], 1904 execResult[ 2 ] / 100, 1905 execResult[ 3 ] / 100, 1906 execResult[ 4 ] 1907 ]; 1908 } 1909 } ], 1910 1911 // jQuery.Color( ) 1912 color = jQuery.Color = function( color, green, blue, alpha ) { 1913 return new jQuery.Color.fn.parse( color, green, blue, alpha ); 1914 }, 1915 spaces = { 1916 rgba: { 1917 props: { 1918 red: { 1919 idx: 0, 1920 type: "byte" 1921 }, 1922 green: { 1923 idx: 1, 1924 type: "byte" 1925 }, 1926 blue: { 1927 idx: 2, 1928 type: "byte" 1929 } 1930 } 1931 }, 1932 1933 hsla: { 1934 props: { 1935 hue: { 1936 idx: 0, 1937 type: "degrees" 1938 }, 1939 saturation: { 1940 idx: 1, 1941 type: "percent" 1942 }, 1943 lightness: { 1944 idx: 2, 1945 type: "percent" 1946 } 1947 } 1948 } 1949 }, 1950 propTypes = { 1951 "byte": { 1952 floor: true, 1953 max: 255 1954 }, 1955 "percent": { 1956 max: 1 1957 }, 1958 "degrees": { 1959 mod: 360, 1960 floor: true 1961 } 1962 }, 1963 support = color.support = {}, 1964 1965 // element for support tests 1966 supportElem = jQuery( "<p>" )[ 0 ], 1967 1968 // colors = jQuery.Color.names 1969 colors, 1970 1971 // local aliases of functions called often 1972 each = jQuery.each; 1973 1974// determine rgba support immediately 1975supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; 1976support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; 1977 1978// define cache name and alpha properties 1979// for rgba and hsla spaces 1980each( spaces, function( spaceName, space ) { 1981 space.cache = "_" + spaceName; 1982 space.props.alpha = { 1983 idx: 3, 1984 type: "percent", 1985 def: 1 1986 }; 1987} ); 1988 1989// Populate the class2type map 1990jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 1991 function( _i, name ) { 1992 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 1993 } ); 1994 1995function getType( obj ) { 1996 if ( obj == null ) { 1997 return obj + ""; 1998 } 1999 2000 return typeof obj === "object" ? 2001 class2type[ toString.call( obj ) ] || "object" : 2002 typeof obj; 2003} 2004 2005function clamp( value, prop, allowEmpty ) { 2006 var type = propTypes[ prop.type ] || {}; 2007 2008 if ( value == null ) { 2009 return ( allowEmpty || !prop.def ) ? null : prop.def; 2010 } 2011 2012 // ~~ is an short way of doing floor for positive numbers 2013 value = type.floor ? ~~value : parseFloat( value ); 2014 2015 // IE will pass in empty strings as value for alpha, 2016 // which will hit this case 2017 if ( isNaN( value ) ) { 2018 return prop.def; 2019 } 2020 2021 if ( type.mod ) { 2022 2023 // we add mod before modding to make sure that negatives values 2024 // get converted properly: -10 -> 350 2025 return ( value + type.mod ) % type.mod; 2026 } 2027 2028 // for now all property types without mod have min and max 2029 return Math.min( type.max, Math.max( 0, value ) ); 2030} 2031 2032function stringParse( string ) { 2033 var inst = color(), 2034 rgba = inst._rgba = []; 2035 2036 string = string.toLowerCase(); 2037 2038 each( stringParsers, function( _i, parser ) { 2039 var parsed, 2040 match = parser.re.exec( string ), 2041 values = match && parser.parse( match ), 2042 spaceName = parser.space || "rgba"; 2043 2044 if ( values ) { 2045 parsed = inst[ spaceName ]( values ); 2046 2047 // if this was an rgba parse the assignment might happen twice 2048 // oh well.... 2049 inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; 2050 rgba = inst._rgba = parsed._rgba; 2051 2052 // exit each( stringParsers ) here because we matched 2053 return false; 2054 } 2055 } ); 2056 2057 // Found a stringParser that handled it 2058 if ( rgba.length ) { 2059 2060 // if this came from a parsed string, force "transparent" when alpha is 0 2061 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 2062 if ( rgba.join() === "0,0,0,0" ) { 2063 jQuery.extend( rgba, colors.transparent ); 2064 } 2065 return inst; 2066 } 2067 2068 // named colors 2069 return colors[ string ]; 2070} 2071 2072color.fn = jQuery.extend( color.prototype, { 2073 parse: function( red, green, blue, alpha ) { 2074 if ( red === undefined ) { 2075 this._rgba = [ null, null, null, null ]; 2076 return this; 2077 } 2078 if ( red.jquery || red.nodeType ) { 2079 red = jQuery( red ).css( green ); 2080 green = undefined; 2081 } 2082 2083 var inst = this, 2084 type = getType( red ), 2085 rgba = this._rgba = []; 2086 2087 // more than 1 argument specified - assume ( red, green, blue, alpha ) 2088 if ( green !== undefined ) { 2089 red = [ red, green, blue, alpha ]; 2090 type = "array"; 2091 } 2092 2093 if ( type === "string" ) { 2094 return this.parse( stringParse( red ) || colors._default ); 2095 } 2096 2097 if ( type === "array" ) { 2098 each( spaces.rgba.props, function( _key, prop ) { 2099 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); 2100 } ); 2101 return this; 2102 } 2103 2104 if ( type === "object" ) { 2105 if ( red instanceof color ) { 2106 each( spaces, function( _spaceName, space ) { 2107 if ( red[ space.cache ] ) { 2108 inst[ space.cache ] = red[ space.cache ].slice(); 2109 } 2110 } ); 2111 } else { 2112 each( spaces, function( _spaceName, space ) { 2113 var cache = space.cache; 2114 each( space.props, function( key, prop ) { 2115 2116 // if the cache doesn't exist, and we know how to convert 2117 if ( !inst[ cache ] && space.to ) { 2118 2119 // if the value was null, we don't need to copy it 2120 // if the key was alpha, we don't need to copy it either 2121 if ( key === "alpha" || red[ key ] == null ) { 2122 return; 2123 } 2124 inst[ cache ] = space.to( inst._rgba ); 2125 } 2126 2127 // this is the only case where we allow nulls for ALL properties. 2128 // call clamp with alwaysAllowEmpty 2129 inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); 2130 } ); 2131 2132 // everything defined but alpha? 2133 if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { 2134 2135 // use the default of 1 2136 if ( inst[ cache ][ 3 ] == null ) { 2137 inst[ cache ][ 3 ] = 1; 2138 } 2139 2140 if ( space.from ) { 2141 inst._rgba = space.from( inst[ cache ] ); 2142 } 2143 } 2144 } ); 2145 } 2146 return this; 2147 } 2148 }, 2149 is: function( compare ) { 2150 var is = color( compare ), 2151 same = true, 2152 inst = this; 2153 2154 each( spaces, function( _, space ) { 2155 var localCache, 2156 isCache = is[ space.cache ]; 2157 if ( isCache ) { 2158 localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; 2159 each( space.props, function( _, prop ) { 2160 if ( isCache[ prop.idx ] != null ) { 2161 same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); 2162 return same; 2163 } 2164 } ); 2165 } 2166 return same; 2167 } ); 2168 return same; 2169 }, 2170 _space: function() { 2171 var used = [], 2172 inst = this; 2173 each( spaces, function( spaceName, space ) { 2174 if ( inst[ space.cache ] ) { 2175 used.push( spaceName ); 2176 } 2177 } ); 2178 return used.pop(); 2179 }, 2180 transition: function( other, distance ) { 2181 var end = color( other ), 2182 spaceName = end._space(), 2183 space = spaces[ spaceName ], 2184 startColor = this.alpha() === 0 ? color( "transparent" ) : this, 2185 start = startColor[ space.cache ] || space.to( startColor._rgba ), 2186 result = start.slice(); 2187 2188 end = end[ space.cache ]; 2189 each( space.props, function( _key, prop ) { 2190 var index = prop.idx, 2191 startValue = start[ index ], 2192 endValue = end[ index ], 2193 type = propTypes[ prop.type ] || {}; 2194 2195 // if null, don't override start value 2196 if ( endValue === null ) { 2197 return; 2198 } 2199 2200 // if null - use end 2201 if ( startValue === null ) { 2202 result[ index ] = endValue; 2203 } else { 2204 if ( type.mod ) { 2205 if ( endValue - startValue > type.mod / 2 ) { 2206 startValue += type.mod; 2207 } else if ( startValue - endValue > type.mod / 2 ) { 2208 startValue -= type.mod; 2209 } 2210 } 2211 result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); 2212 } 2213 } ); 2214 return this[ spaceName ]( result ); 2215 }, 2216 blend: function( opaque ) { 2217 2218 // if we are already opaque - return ourself 2219 if ( this._rgba[ 3 ] === 1 ) { 2220 return this; 2221 } 2222 2223 var rgb = this._rgba.slice(), 2224 a = rgb.pop(), 2225 blend = color( opaque )._rgba; 2226 2227 return color( jQuery.map( rgb, function( v, i ) { 2228 return ( 1 - a ) * blend[ i ] + a * v; 2229 } ) ); 2230 }, 2231 toRgbaString: function() { 2232 var prefix = "rgba(", 2233 rgba = jQuery.map( this._rgba, function( v, i ) { 2234 if ( v != null ) { 2235 return v; 2236 } 2237 return i > 2 ? 1 : 0; 2238 } ); 2239 2240 if ( rgba[ 3 ] === 1 ) { 2241 rgba.pop(); 2242 prefix = "rgb("; 2243 } 2244 2245 return prefix + rgba.join() + ")"; 2246 }, 2247 toHslaString: function() { 2248 var prefix = "hsla(", 2249 hsla = jQuery.map( this.hsla(), function( v, i ) { 2250 if ( v == null ) { 2251 v = i > 2 ? 1 : 0; 2252 } 2253 2254 // catch 1 and 2 2255 if ( i && i < 3 ) { 2256 v = Math.round( v * 100 ) + "%"; 2257 } 2258 return v; 2259 } ); 2260 2261 if ( hsla[ 3 ] === 1 ) { 2262 hsla.pop(); 2263 prefix = "hsl("; 2264 } 2265 return prefix + hsla.join() + ")"; 2266 }, 2267 toHexString: function( includeAlpha ) { 2268 var rgba = this._rgba.slice(), 2269 alpha = rgba.pop(); 2270 2271 if ( includeAlpha ) { 2272 rgba.push( ~~( alpha * 255 ) ); 2273 } 2274 2275 return "#" + jQuery.map( rgba, function( v ) { 2276 2277 // default to 0 when nulls exist 2278 v = ( v || 0 ).toString( 16 ); 2279 return v.length === 1 ? "0" + v : v; 2280 } ).join( "" ); 2281 }, 2282 toString: function() { 2283 return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); 2284 } 2285} ); 2286color.fn.parse.prototype = color.fn; 2287 2288// hsla conversions adapted from: 2289// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 2290 2291function hue2rgb( p, q, h ) { 2292 h = ( h + 1 ) % 1; 2293 if ( h * 6 < 1 ) { 2294 return p + ( q - p ) * h * 6; 2295 } 2296 if ( h * 2 < 1 ) { 2297 return q; 2298 } 2299 if ( h * 3 < 2 ) { 2300 return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6; 2301 } 2302 return p; 2303} 2304 2305spaces.hsla.to = function( rgba ) { 2306 if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { 2307 return [ null, null, null, rgba[ 3 ] ]; 2308 } 2309 var r = rgba[ 0 ] / 255, 2310 g = rgba[ 1 ] / 255, 2311 b = rgba[ 2 ] / 255, 2312 a = rgba[ 3 ], 2313 max = Math.max( r, g, b ), 2314 min = Math.min( r, g, b ), 2315 diff = max - min, 2316 add = max + min, 2317 l = add * 0.5, 2318 h, s; 2319 2320 if ( min === max ) { 2321 h = 0; 2322 } else if ( r === max ) { 2323 h = ( 60 * ( g - b ) / diff ) + 360; 2324 } else if ( g === max ) { 2325 h = ( 60 * ( b - r ) / diff ) + 120; 2326 } else { 2327 h = ( 60 * ( r - g ) / diff ) + 240; 2328 } 2329 2330 // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 2331 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 2332 if ( diff === 0 ) { 2333 s = 0; 2334 } else if ( l <= 0.5 ) { 2335 s = diff / add; 2336 } else { 2337 s = diff / ( 2 - add ); 2338 } 2339 return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ]; 2340}; 2341 2342spaces.hsla.from = function( hsla ) { 2343 if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { 2344 return [ null, null, null, hsla[ 3 ] ]; 2345 } 2346 var h = hsla[ 0 ] / 360, 2347 s = hsla[ 1 ], 2348 l = hsla[ 2 ], 2349 a = hsla[ 3 ], 2350 q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, 2351 p = 2 * l - q; 2352 2353 return [ 2354 Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), 2355 Math.round( hue2rgb( p, q, h ) * 255 ), 2356 Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), 2357 a 2358 ]; 2359}; 2360 2361 2362each( spaces, function( spaceName, space ) { 2363 var props = space.props, 2364 cache = space.cache, 2365 to = space.to, 2366 from = space.from; 2367 2368 // makes rgba() and hsla() 2369 color.fn[ spaceName ] = function( value ) { 2370 2371 // generate a cache for this space if it doesn't exist 2372 if ( to && !this[ cache ] ) { 2373 this[ cache ] = to( this._rgba ); 2374 } 2375 if ( value === undefined ) { 2376 return this[ cache ].slice(); 2377 } 2378 2379 var ret, 2380 type = getType( value ), 2381 arr = ( type === "array" || type === "object" ) ? value : arguments, 2382 local = this[ cache ].slice(); 2383 2384 each( props, function( key, prop ) { 2385 var val = arr[ type === "object" ? key : prop.idx ]; 2386 if ( val == null ) { 2387 val = local[ prop.idx ]; 2388 } 2389 local[ prop.idx ] = clamp( val, prop ); 2390 } ); 2391 2392 if ( from ) { 2393 ret = color( from( local ) ); 2394 ret[ cache ] = local; 2395 return ret; 2396 } else { 2397 return color( local ); 2398 } 2399 }; 2400 2401 // makes red() green() blue() alpha() hue() saturation() lightness() 2402 each( props, function( key, prop ) { 2403 2404 // alpha is included in more than one space 2405 if ( color.fn[ key ] ) { 2406 return; 2407 } 2408 color.fn[ key ] = function( value ) { 2409 var local, cur, match, fn, 2410 vtype = getType( value ); 2411 2412 if ( key === "alpha" ) { 2413 fn = this._hsla ? "hsla" : "rgba"; 2414 } else { 2415 fn = spaceName; 2416 } 2417 local = this[ fn ](); 2418 cur = local[ prop.idx ]; 2419 2420 if ( vtype === "undefined" ) { 2421 return cur; 2422 } 2423 2424 if ( vtype === "function" ) { 2425 value = value.call( this, cur ); 2426 vtype = getType( value ); 2427 } 2428 if ( value == null && prop.empty ) { 2429 return this; 2430 } 2431 if ( vtype === "string" ) { 2432 match = rplusequals.exec( value ); 2433 if ( match ) { 2434 value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); 2435 } 2436 } 2437 local[ prop.idx ] = value; 2438 return this[ fn ]( local ); 2439 }; 2440 } ); 2441} ); 2442 2443// add cssHook and .fx.step function for each named hook. 2444// accept a space separated string of properties 2445color.hook = function( hook ) { 2446 var hooks = hook.split( " " ); 2447 each( hooks, function( _i, hook ) { 2448 jQuery.cssHooks[ hook ] = { 2449 set: function( elem, value ) { 2450 var parsed, curElem, 2451 backgroundColor = ""; 2452 2453 if ( value !== "transparent" && ( getType( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) { 2454 value = color( parsed || value ); 2455 if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { 2456 curElem = hook === "backgroundColor" ? elem.parentNode : elem; 2457 while ( 2458 ( backgroundColor === "" || backgroundColor === "transparent" ) && 2459 curElem && curElem.style 2460 ) { 2461 try { 2462 backgroundColor = jQuery.css( curElem, "backgroundColor" ); 2463 curElem = curElem.parentNode; 2464 } catch ( e ) { 2465 } 2466 } 2467 2468 value = value.blend( backgroundColor && backgroundColor !== "transparent" ? 2469 backgroundColor : 2470 "_default" ); 2471 } 2472 2473 value = value.toRgbaString(); 2474 } 2475 try { 2476 elem.style[ hook ] = value; 2477 } catch ( e ) { 2478 2479 // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' 2480 } 2481 } 2482 }; 2483 jQuery.fx.step[ hook ] = function( fx ) { 2484 if ( !fx.colorInit ) { 2485 fx.start = color( fx.elem, hook ); 2486 fx.end = color( fx.end ); 2487 fx.colorInit = true; 2488 } 2489 jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); 2490 }; 2491 } ); 2492 2493}; 2494 2495color.hook( stepHooks ); 2496 2497jQuery.cssHooks.borderColor = { 2498 expand: function( value ) { 2499 var expanded = {}; 2500 2501 each( [ "Top", "Right", "Bottom", "Left" ], function( _i, part ) { 2502 expanded[ "border" + part + "Color" ] = value; 2503 } ); 2504 return expanded; 2505 } 2506}; 2507 2508// Basic color names only. 2509// Usage of any of the other color names requires adding yourself or including 2510// jquery.color.svg-names.js. 2511colors = jQuery.Color.names = { 2512 2513 // 4.1. Basic color keywords 2514 aqua: "#00ffff", 2515 black: "#000000", 2516 blue: "#0000ff", 2517 fuchsia: "#ff00ff", 2518 gray: "#808080", 2519 green: "#008000", 2520 lime: "#00ff00", 2521 maroon: "#800000", 2522 navy: "#000080", 2523 olive: "#808000", 2524 purple: "#800080", 2525 red: "#ff0000", 2526 silver: "#c0c0c0", 2527 teal: "#008080", 2528 white: "#ffffff", 2529 yellow: "#ffff00", 2530 2531 // 4.2.3. "transparent" color keyword 2532 transparent: [ null, null, null, 0 ], 2533 2534 _default: "#ffffff" 2535}; 2536 2537 2538/*! 2539 * jQuery UI Effects 1.13.2 2540 * http://jqueryui.com 2541 * 2542 * Copyright jQuery Foundation and other contributors 2543 * Released under the MIT license. 2544 * http://jquery.org/license 2545 */ 2546 2547//>>label: Effects Core 2548//>>group: Effects 2549/* eslint-disable max-len */ 2550//>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. 2551/* eslint-enable max-len */ 2552//>>docs: http://api.jqueryui.com/category/effects-core/ 2553//>>demos: http://jqueryui.com/effect/ 2554 2555 2556var dataSpace = "ui-effects-", 2557 dataSpaceStyle = "ui-effects-style", 2558 dataSpaceAnimated = "ui-effects-animated"; 2559 2560$.effects = { 2561 effect: {} 2562}; 2563 2564/******************************************************************************/ 2565/****************************** CLASS ANIMATIONS ******************************/ 2566/******************************************************************************/ 2567( function() { 2568 2569var classAnimationActions = [ "add", "remove", "toggle" ], 2570 shorthandStyles = { 2571 border: 1, 2572 borderBottom: 1, 2573 borderColor: 1, 2574 borderLeft: 1, 2575 borderRight: 1, 2576 borderTop: 1, 2577 borderWidth: 1, 2578 margin: 1, 2579 padding: 1 2580 }; 2581 2582$.each( 2583 [ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], 2584 function( _, prop ) { 2585 $.fx.step[ prop ] = function( fx ) { 2586 if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { 2587 jQuery.style( fx.elem, prop, fx.end ); 2588 fx.setAttr = true; 2589 } 2590 }; 2591 } 2592); 2593 2594function camelCase( string ) { 2595 return string.replace( /-([\da-z])/gi, function( all, letter ) { 2596 return letter.toUpperCase(); 2597 } ); 2598} 2599 2600function getElementStyles( elem ) { 2601 var key, len, 2602 style = elem.ownerDocument.defaultView ? 2603 elem.ownerDocument.defaultView.getComputedStyle( elem, null ) : 2604 elem.currentStyle, 2605 styles = {}; 2606 2607 if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { 2608 len = style.length; 2609 while ( len-- ) { 2610 key = style[ len ]; 2611 if ( typeof style[ key ] === "string" ) { 2612 styles[ camelCase( key ) ] = style[ key ]; 2613 } 2614 } 2615 2616 // Support: Opera, IE <9 2617 } else { 2618 for ( key in style ) { 2619 if ( typeof style[ key ] === "string" ) { 2620 styles[ key ] = style[ key ]; 2621 } 2622 } 2623 } 2624 2625 return styles; 2626} 2627 2628function styleDifference( oldStyle, newStyle ) { 2629 var diff = {}, 2630 name, value; 2631 2632 for ( name in newStyle ) { 2633 value = newStyle[ name ]; 2634 if ( oldStyle[ name ] !== value ) { 2635 if ( !shorthandStyles[ name ] ) { 2636 if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { 2637 diff[ name ] = value; 2638 } 2639 } 2640 } 2641 } 2642 2643 return diff; 2644} 2645 2646// Support: jQuery <1.8 2647if ( !$.fn.addBack ) { 2648 $.fn.addBack = function( selector ) { 2649 return this.add( selector == null ? 2650 this.prevObject : this.prevObject.filter( selector ) 2651 ); 2652 }; 2653} 2654 2655$.effects.animateClass = function( value, duration, easing, callback ) { 2656 var o = $.speed( duration, easing, callback ); 2657 2658 return this.queue( function() { 2659 var animated = $( this ), 2660 baseClass = animated.attr( "class" ) || "", 2661 applyClassChange, 2662 allAnimations = o.children ? animated.find( "*" ).addBack() : animated; 2663 2664 // Map the animated objects to store the original styles. 2665 allAnimations = allAnimations.map( function() { 2666 var el = $( this ); 2667 return { 2668 el: el, 2669 start: getElementStyles( this ) 2670 }; 2671 } ); 2672 2673 // Apply class change 2674 applyClassChange = function() { 2675 $.each( classAnimationActions, function( i, action ) { 2676 if ( value[ action ] ) { 2677 animated[ action + "Class" ]( value[ action ] ); 2678 } 2679 } ); 2680 }; 2681 applyClassChange(); 2682 2683 // Map all animated objects again - calculate new styles and diff 2684 allAnimations = allAnimations.map( function() { 2685 this.end = getElementStyles( this.el[ 0 ] ); 2686 this.diff = styleDifference( this.start, this.end ); 2687 return this; 2688 } ); 2689 2690 // Apply original class 2691 animated.attr( "class", baseClass ); 2692 2693 // Map all animated objects again - this time collecting a promise 2694 allAnimations = allAnimations.map( function() { 2695 var styleInfo = this, 2696 dfd = $.Deferred(), 2697 opts = $.extend( {}, o, { 2698 queue: false, 2699 complete: function() { 2700 dfd.resolve( styleInfo ); 2701 } 2702 } ); 2703 2704 this.el.animate( this.diff, opts ); 2705 return dfd.promise(); 2706 } ); 2707 2708 // Once all animations have completed: 2709 $.when.apply( $, allAnimations.get() ).done( function() { 2710 2711 // Set the final class 2712 applyClassChange(); 2713 2714 // For each animated element, 2715 // clear all css properties that were animated 2716 $.each( arguments, function() { 2717 var el = this.el; 2718 $.each( this.diff, function( key ) { 2719 el.css( key, "" ); 2720 } ); 2721 } ); 2722 2723 // This is guarnteed to be there if you use jQuery.speed() 2724 // it also handles dequeuing the next anim... 2725 o.complete.call( animated[ 0 ] ); 2726 } ); 2727 } ); 2728}; 2729 2730$.fn.extend( { 2731 addClass: ( function( orig ) { 2732 return function( classNames, speed, easing, callback ) { 2733 return speed ? 2734 $.effects.animateClass.call( this, 2735 { add: classNames }, speed, easing, callback ) : 2736 orig.apply( this, arguments ); 2737 }; 2738 } )( $.fn.addClass ), 2739 2740 removeClass: ( function( orig ) { 2741 return function( classNames, speed, easing, callback ) { 2742 return arguments.length > 1 ? 2743 $.effects.animateClass.call( this, 2744 { remove: classNames }, speed, easing, callback ) : 2745 orig.apply( this, arguments ); 2746 }; 2747 } )( $.fn.removeClass ), 2748 2749 toggleClass: ( function( orig ) { 2750 return function( classNames, force, speed, easing, callback ) { 2751 if ( typeof force === "boolean" || force === undefined ) { 2752 if ( !speed ) { 2753 2754 // Without speed parameter 2755 return orig.apply( this, arguments ); 2756 } else { 2757 return $.effects.animateClass.call( this, 2758 ( force ? { add: classNames } : { remove: classNames } ), 2759 speed, easing, callback ); 2760 } 2761 } else { 2762 2763 // Without force parameter 2764 return $.effects.animateClass.call( this, 2765 { toggle: classNames }, force, speed, easing ); 2766 } 2767 }; 2768 } )( $.fn.toggleClass ), 2769 2770 switchClass: function( remove, add, speed, easing, callback ) { 2771 return $.effects.animateClass.call( this, { 2772 add: add, 2773 remove: remove 2774 }, speed, easing, callback ); 2775 } 2776} ); 2777 2778} )(); 2779 2780/******************************************************************************/ 2781/*********************************** EFFECTS **********************************/ 2782/******************************************************************************/ 2783 2784( function() { 2785 2786if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) { 2787 $.expr.pseudos.animated = ( function( orig ) { 2788 return function( elem ) { 2789 return !!$( elem ).data( dataSpaceAnimated ) || orig( elem ); 2790 }; 2791 } )( $.expr.pseudos.animated ); 2792} 2793 2794if ( $.uiBackCompat !== false ) { 2795 $.extend( $.effects, { 2796 2797 // Saves a set of properties in a data storage 2798 save: function( element, set ) { 2799 var i = 0, length = set.length; 2800 for ( ; i < length; i++ ) { 2801 if ( set[ i ] !== null ) { 2802 element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); 2803 } 2804 } 2805 }, 2806 2807 // Restores a set of previously saved properties from a data storage 2808 restore: function( element, set ) { 2809 var val, i = 0, length = set.length; 2810 for ( ; i < length; i++ ) { 2811 if ( set[ i ] !== null ) { 2812 val = element.data( dataSpace + set[ i ] ); 2813 element.css( set[ i ], val ); 2814 } 2815 } 2816 }, 2817 2818 setMode: function( el, mode ) { 2819 if ( mode === "toggle" ) { 2820 mode = el.is( ":hidden" ) ? "show" : "hide"; 2821 } 2822 return mode; 2823 }, 2824 2825 // Wraps the element around a wrapper that copies position properties 2826 createWrapper: function( element ) { 2827 2828 // If the element is already wrapped, return it 2829 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 2830 return element.parent(); 2831 } 2832 2833 // Wrap the element 2834 var props = { 2835 width: element.outerWidth( true ), 2836 height: element.outerHeight( true ), 2837 "float": element.css( "float" ) 2838 }, 2839 wrapper = $( "<div></div>" ) 2840 .addClass( "ui-effects-wrapper" ) 2841 .css( { 2842 fontSize: "100%", 2843 background: "transparent", 2844 border: "none", 2845 margin: 0, 2846 padding: 0 2847 } ), 2848 2849 // Store the size in case width/height are defined in % - Fixes #5245 2850 size = { 2851 width: element.width(), 2852 height: element.height() 2853 }, 2854 active = document.activeElement; 2855 2856 // Support: Firefox 2857 // Firefox incorrectly exposes anonymous content 2858 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 2859 try { 2860 // eslint-disable-next-line no-unused-expressions 2861 active.id; 2862 } catch ( e ) { 2863 active = document.body; 2864 } 2865 2866 element.wrap( wrapper ); 2867 2868 // Fixes #7595 - Elements lose focus when wrapped. 2869 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 2870 $( active ).trigger( "focus" ); 2871 } 2872 2873 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 2874 // lose the reference to the wrapped element 2875 wrapper = element.parent(); 2876 2877 // Transfer positioning properties to the wrapper 2878 if ( element.css( "position" ) === "static" ) { 2879 wrapper.css( { position: "relative" } ); 2880 element.css( { position: "relative" } ); 2881 } else { 2882 $.extend( props, { 2883 position: element.css( "position" ), 2884 zIndex: element.css( "z-index" ) 2885 } ); 2886 $.each( [ "top", "left", "bottom", "right" ], function( i, pos ) { 2887 props[ pos ] = element.css( pos ); 2888 if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { 2889 props[ pos ] = "auto"; 2890 } 2891 } ); 2892 element.css( { 2893 position: "relative", 2894 top: 0, 2895 left: 0, 2896 right: "auto", 2897 bottom: "auto" 2898 } ); 2899 } 2900 element.css( size ); 2901 2902 return wrapper.css( props ).show(); 2903 }, 2904 2905 removeWrapper: function( element ) { 2906 var active = document.activeElement; 2907 2908 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 2909 element.parent().replaceWith( element ); 2910 2911 // Fixes #7595 - Elements lose focus when wrapped. 2912 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 2913 $( active ).trigger( "focus" ); 2914 } 2915 } 2916 2917 return element; 2918 } 2919 } ); 2920} 2921 2922$.extend( $.effects, { 2923 version: "1.13.2", 2924 2925 define: function( name, mode, effect ) { 2926 if ( !effect ) { 2927 effect = mode; 2928 mode = "effect"; 2929 } 2930 2931 $.effects.effect[ name ] = effect; 2932 $.effects.effect[ name ].mode = mode; 2933 2934 return effect; 2935 }, 2936 2937 scaledDimensions: function( element, percent, direction ) { 2938 if ( percent === 0 ) { 2939 return { 2940 height: 0, 2941 width: 0, 2942 outerHeight: 0, 2943 outerWidth: 0 2944 }; 2945 } 2946 2947 var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1, 2948 y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1; 2949 2950 return { 2951 height: element.height() * y, 2952 width: element.width() * x, 2953 outerHeight: element.outerHeight() * y, 2954 outerWidth: element.outerWidth() * x 2955 }; 2956 2957 }, 2958 2959 clipToBox: function( animation ) { 2960 return { 2961 width: animation.clip.right - animation.clip.left, 2962 height: animation.clip.bottom - animation.clip.top, 2963 left: animation.clip.left, 2964 top: animation.clip.top 2965 }; 2966 }, 2967 2968 // Injects recently queued functions to be first in line (after "inprogress") 2969 unshift: function( element, queueLength, count ) { 2970 var queue = element.queue(); 2971 2972 if ( queueLength > 1 ) { 2973 queue.splice.apply( queue, 2974 [ 1, 0 ].concat( queue.splice( queueLength, count ) ) ); 2975 } 2976 element.dequeue(); 2977 }, 2978 2979 saveStyle: function( element ) { 2980 element.data( dataSpaceStyle, element[ 0 ].style.cssText ); 2981 }, 2982 2983 restoreStyle: function( element ) { 2984 element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || ""; 2985 element.removeData( dataSpaceStyle ); 2986 }, 2987 2988 mode: function( element, mode ) { 2989 var hidden = element.is( ":hidden" ); 2990 2991 if ( mode === "toggle" ) { 2992 mode = hidden ? "show" : "hide"; 2993 } 2994 if ( hidden ? mode === "hide" : mode === "show" ) { 2995 mode = "none"; 2996 } 2997 return mode; 2998 }, 2999 3000 // Translates a [top,left] array into a baseline value 3001 getBaseline: function( origin, original ) { 3002 var y, x; 3003 3004 switch ( origin[ 0 ] ) { 3005 case "top": 3006 y = 0; 3007 break; 3008 case "middle": 3009 y = 0.5; 3010 break; 3011 case "bottom": 3012 y = 1; 3013 break; 3014 default: 3015 y = origin[ 0 ] / original.height; 3016 } 3017 3018 switch ( origin[ 1 ] ) { 3019 case "left": 3020 x = 0; 3021 break; 3022 case "center": 3023 x = 0.5; 3024 break; 3025 case "right": 3026 x = 1; 3027 break; 3028 default: 3029 x = origin[ 1 ] / original.width; 3030 } 3031 3032 return { 3033 x: x, 3034 y: y 3035 }; 3036 }, 3037 3038 // Creates a placeholder element so that the original element can be made absolute 3039 createPlaceholder: function( element ) { 3040 var placeholder, 3041 cssPosition = element.css( "position" ), 3042 position = element.position(); 3043 3044 // Lock in margins first to account for form elements, which 3045 // will change margin if you explicitly set height 3046 // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 3047 // Support: Safari 3048 element.css( { 3049 marginTop: element.css( "marginTop" ), 3050 marginBottom: element.css( "marginBottom" ), 3051 marginLeft: element.css( "marginLeft" ), 3052 marginRight: element.css( "marginRight" ) 3053 } ) 3054 .outerWidth( element.outerWidth() ) 3055 .outerHeight( element.outerHeight() ); 3056 3057 if ( /^(static|relative)/.test( cssPosition ) ) { 3058 cssPosition = "absolute"; 3059 3060 placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( { 3061 3062 // Convert inline to inline block to account for inline elements 3063 // that turn to inline block based on content (like img) 3064 display: /^(inline|ruby)/.test( element.css( "display" ) ) ? 3065 "inline-block" : 3066 "block", 3067 visibility: "hidden", 3068 3069 // Margins need to be set to account for margin collapse 3070 marginTop: element.css( "marginTop" ), 3071 marginBottom: element.css( "marginBottom" ), 3072 marginLeft: element.css( "marginLeft" ), 3073 marginRight: element.css( "marginRight" ), 3074 "float": element.css( "float" ) 3075 } ) 3076 .outerWidth( element.outerWidth() ) 3077 .outerHeight( element.outerHeight() ) 3078 .addClass( "ui-effects-placeholder" ); 3079 3080 element.data( dataSpace + "placeholder", placeholder ); 3081 } 3082 3083 element.css( { 3084 position: cssPosition, 3085 left: position.left, 3086 top: position.top 3087 } ); 3088 3089 return placeholder; 3090 }, 3091 3092 removePlaceholder: function( element ) { 3093 var dataKey = dataSpace + "placeholder", 3094 placeholder = element.data( dataKey ); 3095 3096 if ( placeholder ) { 3097 placeholder.remove(); 3098 element.removeData( dataKey ); 3099 } 3100 }, 3101 3102 // Removes a placeholder if it exists and restores 3103 // properties that were modified during placeholder creation 3104 cleanUp: function( element ) { 3105 $.effects.restoreStyle( element ); 3106 $.effects.removePlaceholder( element ); 3107 }, 3108 3109 setTransition: function( element, list, factor, value ) { 3110 value = value || {}; 3111 $.each( list, function( i, x ) { 3112 var unit = element.cssUnit( x ); 3113 if ( unit[ 0 ] > 0 ) { 3114 value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; 3115 } 3116 } ); 3117 return value; 3118 } 3119} ); 3120 3121// Return an effect options object for the given parameters: 3122function _normalizeArguments( effect, options, speed, callback ) { 3123 3124 // Allow passing all options as the first parameter 3125 if ( $.isPlainObject( effect ) ) { 3126 options = effect; 3127 effect = effect.effect; 3128 } 3129 3130 // Convert to an object 3131 effect = { effect: effect }; 3132 3133 // Catch (effect, null, ...) 3134 if ( options == null ) { 3135 options = {}; 3136 } 3137 3138 // Catch (effect, callback) 3139 if ( typeof options === "function" ) { 3140 callback = options; 3141 speed = null; 3142 options = {}; 3143 } 3144 3145 // Catch (effect, speed, ?) 3146 if ( typeof options === "number" || $.fx.speeds[ options ] ) { 3147 callback = speed; 3148 speed = options; 3149 options = {}; 3150 } 3151 3152 // Catch (effect, options, callback) 3153 if ( typeof speed === "function" ) { 3154 callback = speed; 3155 speed = null; 3156 } 3157 3158 // Add options to effect 3159 if ( options ) { 3160 $.extend( effect, options ); 3161 } 3162 3163 speed = speed || options.duration; 3164 effect.duration = $.fx.off ? 0 : 3165 typeof speed === "number" ? speed : 3166 speed in $.fx.speeds ? $.fx.speeds[ speed ] : 3167 $.fx.speeds._default; 3168 3169 effect.complete = callback || options.complete; 3170 3171 return effect; 3172} 3173 3174function standardAnimationOption( option ) { 3175 3176 // Valid standard speeds (nothing, number, named speed) 3177 if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) { 3178 return true; 3179 } 3180 3181 // Invalid strings - treat as "normal" speed 3182 if ( typeof option === "string" && !$.effects.effect[ option ] ) { 3183 return true; 3184 } 3185 3186 // Complete callback 3187 if ( typeof option === "function" ) { 3188 return true; 3189 } 3190 3191 // Options hash (but not naming an effect) 3192 if ( typeof option === "object" && !option.effect ) { 3193 return true; 3194 } 3195 3196 // Didn't match any standard API 3197 return false; 3198} 3199 3200$.fn.extend( { 3201 effect: function( /* effect, options, speed, callback */ ) { 3202 var args = _normalizeArguments.apply( this, arguments ), 3203 effectMethod = $.effects.effect[ args.effect ], 3204 defaultMode = effectMethod.mode, 3205 queue = args.queue, 3206 queueName = queue || "fx", 3207 complete = args.complete, 3208 mode = args.mode, 3209 modes = [], 3210 prefilter = function( next ) { 3211 var el = $( this ), 3212 normalizedMode = $.effects.mode( el, mode ) || defaultMode; 3213 3214 // Sentinel for duck-punching the :animated pseudo-selector 3215 el.data( dataSpaceAnimated, true ); 3216 3217 // Save effect mode for later use, 3218 // we can't just call $.effects.mode again later, 3219 // as the .show() below destroys the initial state 3220 modes.push( normalizedMode ); 3221 3222 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14 3223 if ( defaultMode && ( normalizedMode === "show" || 3224 ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) { 3225 el.show(); 3226 } 3227 3228 if ( !defaultMode || normalizedMode !== "none" ) { 3229 $.effects.saveStyle( el ); 3230 } 3231 3232 if ( typeof next === "function" ) { 3233 next(); 3234 } 3235 }; 3236 3237 if ( $.fx.off || !effectMethod ) { 3238 3239 // Delegate to the original method (e.g., .show()) if possible 3240 if ( mode ) { 3241 return this[ mode ]( args.duration, complete ); 3242 } else { 3243 return this.each( function() { 3244 if ( complete ) { 3245 complete.call( this ); 3246 } 3247 } ); 3248 } 3249 } 3250 3251 function run( next ) { 3252 var elem = $( this ); 3253 3254 function cleanup() { 3255 elem.removeData( dataSpaceAnimated ); 3256 3257 $.effects.cleanUp( elem ); 3258 3259 if ( args.mode === "hide" ) { 3260 elem.hide(); 3261 } 3262 3263 done(); 3264 } 3265 3266 function done() { 3267 if ( typeof complete === "function" ) { 3268 complete.call( elem[ 0 ] ); 3269 } 3270 3271 if ( typeof next === "function" ) { 3272 next(); 3273 } 3274 } 3275 3276 // Override mode option on a per element basis, 3277 // as toggle can be either show or hide depending on element state 3278 args.mode = modes.shift(); 3279 3280 if ( $.uiBackCompat !== false && !defaultMode ) { 3281 if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { 3282 3283 // Call the core method to track "olddisplay" properly 3284 elem[ mode ](); 3285 done(); 3286 } else { 3287 effectMethod.call( elem[ 0 ], args, done ); 3288 } 3289 } else { 3290 if ( args.mode === "none" ) { 3291 3292 // Call the core method to track "olddisplay" properly 3293 elem[ mode ](); 3294 done(); 3295 } else { 3296 effectMethod.call( elem[ 0 ], args, cleanup ); 3297 } 3298 } 3299 } 3300 3301 // Run prefilter on all elements first to ensure that 3302 // any showing or hiding happens before placeholder creation, 3303 // which ensures that any layout changes are correctly captured. 3304 return queue === false ? 3305 this.each( prefilter ).each( run ) : 3306 this.queue( queueName, prefilter ).queue( queueName, run ); 3307 }, 3308 3309 show: ( function( orig ) { 3310 return function( option ) { 3311 if ( standardAnimationOption( option ) ) { 3312 return orig.apply( this, arguments ); 3313 } else { 3314 var args = _normalizeArguments.apply( this, arguments ); 3315 args.mode = "show"; 3316 return this.effect.call( this, args ); 3317 } 3318 }; 3319 } )( $.fn.show ), 3320 3321 hide: ( function( orig ) { 3322 return function( option ) { 3323 if ( standardAnimationOption( option ) ) { 3324 return orig.apply( this, arguments ); 3325 } else { 3326 var args = _normalizeArguments.apply( this, arguments ); 3327 args.mode = "hide"; 3328 return this.effect.call( this, args ); 3329 } 3330 }; 3331 } )( $.fn.hide ), 3332 3333 toggle: ( function( orig ) { 3334 return function( option ) { 3335 if ( standardAnimationOption( option ) || typeof option === "boolean" ) { 3336 return orig.apply( this, arguments ); 3337 } else { 3338 var args = _normalizeArguments.apply( this, arguments ); 3339 args.mode = "toggle"; 3340 return this.effect.call( this, args ); 3341 } 3342 }; 3343 } )( $.fn.toggle ), 3344 3345 cssUnit: function( key ) { 3346 var style = this.css( key ), 3347 val = []; 3348 3349 $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { 3350 if ( style.indexOf( unit ) > 0 ) { 3351 val = [ parseFloat( style ), unit ]; 3352 } 3353 } ); 3354 return val; 3355 }, 3356 3357 cssClip: function( clipObj ) { 3358 if ( clipObj ) { 3359 return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + 3360 clipObj.bottom + "px " + clipObj.left + "px)" ); 3361 } 3362 return parseClip( this.css( "clip" ), this ); 3363 }, 3364 3365 transfer: function( options, done ) { 3366 var element = $( this ), 3367 target = $( options.to ), 3368 targetFixed = target.css( "position" ) === "fixed", 3369 body = $( "body" ), 3370 fixTop = targetFixed ? body.scrollTop() : 0, 3371 fixLeft = targetFixed ? body.scrollLeft() : 0, 3372 endPosition = target.offset(), 3373 animation = { 3374 top: endPosition.top - fixTop, 3375 left: endPosition.left - fixLeft, 3376 height: target.innerHeight(), 3377 width: target.innerWidth() 3378 }, 3379 startPosition = element.offset(), 3380 transfer = $( "<div class='ui-effects-transfer'></div>" ); 3381 3382 transfer 3383 .appendTo( "body" ) 3384 .addClass( options.className ) 3385 .css( { 3386 top: startPosition.top - fixTop, 3387 left: startPosition.left - fixLeft, 3388 height: element.innerHeight(), 3389 width: element.innerWidth(), 3390 position: targetFixed ? "fixed" : "absolute" 3391 } ) 3392 .animate( animation, options.duration, options.easing, function() { 3393 transfer.remove(); 3394 if ( typeof done === "function" ) { 3395 done(); 3396 } 3397 } ); 3398 } 3399} ); 3400 3401function parseClip( str, element ) { 3402 var outerWidth = element.outerWidth(), 3403 outerHeight = element.outerHeight(), 3404 clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/, 3405 values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ]; 3406 3407 return { 3408 top: parseFloat( values[ 1 ] ) || 0, 3409 right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ), 3410 bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ), 3411 left: parseFloat( values[ 4 ] ) || 0 3412 }; 3413} 3414 3415$.fx.step.clip = function( fx ) { 3416 if ( !fx.clipInit ) { 3417 fx.start = $( fx.elem ).cssClip(); 3418 if ( typeof fx.end === "string" ) { 3419 fx.end = parseClip( fx.end, fx.elem ); 3420 } 3421 fx.clipInit = true; 3422 } 3423 3424 $( fx.elem ).cssClip( { 3425 top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top, 3426 right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right, 3427 bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom, 3428 left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left 3429 } ); 3430}; 3431 3432} )(); 3433 3434/******************************************************************************/ 3435/*********************************** EASING ***********************************/ 3436/******************************************************************************/ 3437 3438( function() { 3439 3440// Based on easing equations from Robert Penner (http://www.robertpenner.com/easing) 3441 3442var baseEasings = {}; 3443 3444$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { 3445 baseEasings[ name ] = function( p ) { 3446 return Math.pow( p, i + 2 ); 3447 }; 3448} ); 3449 3450$.extend( baseEasings, { 3451 Sine: function( p ) { 3452 return 1 - Math.cos( p * Math.PI / 2 ); 3453 }, 3454 Circ: function( p ) { 3455 return 1 - Math.sqrt( 1 - p * p ); 3456 }, 3457 Elastic: function( p ) { 3458 return p === 0 || p === 1 ? p : 3459 -Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 ); 3460 }, 3461 Back: function( p ) { 3462 return p * p * ( 3 * p - 2 ); 3463 }, 3464 Bounce: function( p ) { 3465 var pow2, 3466 bounce = 4; 3467 3468 while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} 3469 return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); 3470 } 3471} ); 3472 3473$.each( baseEasings, function( name, easeIn ) { 3474 $.easing[ "easeIn" + name ] = easeIn; 3475 $.easing[ "easeOut" + name ] = function( p ) { 3476 return 1 - easeIn( 1 - p ); 3477 }; 3478 $.easing[ "easeInOut" + name ] = function( p ) { 3479 return p < 0.5 ? 3480 easeIn( p * 2 ) / 2 : 3481 1 - easeIn( p * -2 + 2 ) / 2; 3482 }; 3483} ); 3484 3485} )(); 3486 3487var effect = $.effects; 3488 3489 3490/*! 3491 * jQuery UI Effects Blind 1.13.2 3492 * http://jqueryui.com 3493 * 3494 * Copyright jQuery Foundation and other contributors 3495 * Released under the MIT license. 3496 * http://jquery.org/license 3497 */ 3498 3499//>>label: Blind Effect 3500//>>group: Effects 3501//>>description: Blinds the element. 3502//>>docs: http://api.jqueryui.com/blind-effect/ 3503//>>demos: http://jqueryui.com/effect/ 3504 3505 3506var effectsEffectBlind = $.effects.define( "blind", "hide", function( options, done ) { 3507 var map = { 3508 up: [ "bottom", "top" ], 3509 vertical: [ "bottom", "top" ], 3510 down: [ "top", "bottom" ], 3511 left: [ "right", "left" ], 3512 horizontal: [ "right", "left" ], 3513 right: [ "left", "right" ] 3514 }, 3515 element = $( this ), 3516 direction = options.direction || "up", 3517 start = element.cssClip(), 3518 animate = { clip: $.extend( {}, start ) }, 3519 placeholder = $.effects.createPlaceholder( element ); 3520 3521 animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ]; 3522 3523 if ( options.mode === "show" ) { 3524 element.cssClip( animate.clip ); 3525 if ( placeholder ) { 3526 placeholder.css( $.effects.clipToBox( animate ) ); 3527 } 3528 3529 animate.clip = start; 3530 } 3531 3532 if ( placeholder ) { 3533 placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing ); 3534 } 3535 3536 element.animate( animate, { 3537 queue: false, 3538 duration: options.duration, 3539 easing: options.easing, 3540 complete: done 3541 } ); 3542} ); 3543 3544 3545/*! 3546 * jQuery UI Effects Bounce 1.13.2 3547 * http://jqueryui.com 3548 * 3549 * Copyright jQuery Foundation and other contributors 3550 * Released under the MIT license. 3551 * http://jquery.org/license 3552 */ 3553 3554//>>label: Bounce Effect 3555//>>group: Effects 3556//>>description: Bounces an element horizontally or vertically n times. 3557//>>docs: http://api.jqueryui.com/bounce-effect/ 3558//>>demos: http://jqueryui.com/effect/ 3559 3560 3561var effectsEffectBounce = $.effects.define( "bounce", function( options, done ) { 3562 var upAnim, downAnim, refValue, 3563 element = $( this ), 3564 3565 // Defaults: 3566 mode = options.mode, 3567 hide = mode === "hide", 3568 show = mode === "show", 3569 direction = options.direction || "up", 3570 distance = options.distance, 3571 times = options.times || 5, 3572 3573 // Number of internal animations 3574 anims = times * 2 + ( show || hide ? 1 : 0 ), 3575 speed = options.duration / anims, 3576 easing = options.easing, 3577 3578 // Utility: 3579 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 3580 motion = ( direction === "up" || direction === "left" ), 3581 i = 0, 3582 3583 queuelen = element.queue().length; 3584 3585 $.effects.createPlaceholder( element ); 3586 3587 refValue = element.css( ref ); 3588 3589 // Default distance for the BIGGEST bounce is the outer Distance / 3 3590 if ( !distance ) { 3591 distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3; 3592 } 3593 3594 if ( show ) { 3595 downAnim = { opacity: 1 }; 3596 downAnim[ ref ] = refValue; 3597 3598 // If we are showing, force opacity 0 and set the initial position 3599 // then do the "first" animation 3600 element 3601 .css( "opacity", 0 ) 3602 .css( ref, motion ? -distance * 2 : distance * 2 ) 3603 .animate( downAnim, speed, easing ); 3604 } 3605 3606 // Start at the smallest distance if we are hiding 3607 if ( hide ) { 3608 distance = distance / Math.pow( 2, times - 1 ); 3609 } 3610 3611 downAnim = {}; 3612 downAnim[ ref ] = refValue; 3613 3614 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here 3615 for ( ; i < times; i++ ) { 3616 upAnim = {}; 3617 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; 3618 3619 element 3620 .animate( upAnim, speed, easing ) 3621 .animate( downAnim, speed, easing ); 3622 3623 distance = hide ? distance * 2 : distance / 2; 3624 } 3625 3626 // Last Bounce when Hiding 3627 if ( hide ) { 3628 upAnim = { opacity: 0 }; 3629 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; 3630 3631 element.animate( upAnim, speed, easing ); 3632 } 3633 3634 element.queue( done ); 3635 3636 $.effects.unshift( element, queuelen, anims + 1 ); 3637} ); 3638 3639 3640/*! 3641 * jQuery UI Effects Clip 1.13.2 3642 * http://jqueryui.com 3643 * 3644 * Copyright jQuery Foundation and other contributors 3645 * Released under the MIT license. 3646 * http://jquery.org/license 3647 */ 3648 3649//>>label: Clip Effect 3650//>>group: Effects 3651//>>description: Clips the element on and off like an old TV. 3652//>>docs: http://api.jqueryui.com/clip-effect/ 3653//>>demos: http://jqueryui.com/effect/ 3654 3655 3656var effectsEffectClip = $.effects.define( "clip", "hide", function( options, done ) { 3657 var start, 3658 animate = {}, 3659 element = $( this ), 3660 direction = options.direction || "vertical", 3661 both = direction === "both", 3662 horizontal = both || direction === "horizontal", 3663 vertical = both || direction === "vertical"; 3664 3665 start = element.cssClip(); 3666 animate.clip = { 3667 top: vertical ? ( start.bottom - start.top ) / 2 : start.top, 3668 right: horizontal ? ( start.right - start.left ) / 2 : start.right, 3669 bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom, 3670 left: horizontal ? ( start.right - start.left ) / 2 : start.left 3671 }; 3672 3673 $.effects.createPlaceholder( element ); 3674 3675 if ( options.mode === "show" ) { 3676 element.cssClip( animate.clip ); 3677 animate.clip = start; 3678 } 3679 3680 element.animate( animate, { 3681 queue: false, 3682 duration: options.duration, 3683 easing: options.easing, 3684 complete: done 3685 } ); 3686 3687} ); 3688 3689 3690/*! 3691 * jQuery UI Effects Drop 1.13.2 3692 * http://jqueryui.com 3693 * 3694 * Copyright jQuery Foundation and other contributors 3695 * Released under the MIT license. 3696 * http://jquery.org/license 3697 */ 3698 3699//>>label: Drop Effect 3700//>>group: Effects 3701//>>description: Moves an element in one direction and hides it at the same time. 3702//>>docs: http://api.jqueryui.com/drop-effect/ 3703//>>demos: http://jqueryui.com/effect/ 3704 3705 3706var effectsEffectDrop = $.effects.define( "drop", "hide", function( options, done ) { 3707 3708 var distance, 3709 element = $( this ), 3710 mode = options.mode, 3711 show = mode === "show", 3712 direction = options.direction || "left", 3713 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 3714 motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=", 3715 oppositeMotion = ( motion === "+=" ) ? "-=" : "+=", 3716 animation = { 3717 opacity: 0 3718 }; 3719 3720 $.effects.createPlaceholder( element ); 3721 3722 distance = options.distance || 3723 element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2; 3724 3725 animation[ ref ] = motion + distance; 3726 3727 if ( show ) { 3728 element.css( animation ); 3729 3730 animation[ ref ] = oppositeMotion + distance; 3731 animation.opacity = 1; 3732 } 3733 3734 // Animate 3735 element.animate( animation, { 3736 queue: false, 3737 duration: options.duration, 3738 easing: options.easing, 3739 complete: done 3740 } ); 3741} ); 3742 3743 3744/*! 3745 * jQuery UI Effects Explode 1.13.2 3746 * http://jqueryui.com 3747 * 3748 * Copyright jQuery Foundation and other contributors 3749 * Released under the MIT license. 3750 * http://jquery.org/license 3751 */ 3752 3753//>>label: Explode Effect 3754//>>group: Effects 3755/* eslint-disable max-len */ 3756//>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness. 3757/* eslint-enable max-len */ 3758//>>docs: http://api.jqueryui.com/explode-effect/ 3759//>>demos: http://jqueryui.com/effect/ 3760 3761 3762var effectsEffectExplode = $.effects.define( "explode", "hide", function( options, done ) { 3763 3764 var i, j, left, top, mx, my, 3765 rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3, 3766 cells = rows, 3767 element = $( this ), 3768 mode = options.mode, 3769 show = mode === "show", 3770 3771 // Show and then visibility:hidden the element before calculating offset 3772 offset = element.show().css( "visibility", "hidden" ).offset(), 3773 3774 // Width and height of a piece 3775 width = Math.ceil( element.outerWidth() / cells ), 3776 height = Math.ceil( element.outerHeight() / rows ), 3777 pieces = []; 3778 3779 // Children animate complete: 3780 function childComplete() { 3781 pieces.push( this ); 3782 if ( pieces.length === rows * cells ) { 3783 animComplete(); 3784 } 3785 } 3786 3787 // Clone the element for each row and cell. 3788 for ( i = 0; i < rows; i++ ) { // ===> 3789 top = offset.top + i * height; 3790 my = i - ( rows - 1 ) / 2; 3791 3792 for ( j = 0; j < cells; j++ ) { // ||| 3793 left = offset.left + j * width; 3794 mx = j - ( cells - 1 ) / 2; 3795 3796 // Create a clone of the now hidden main element that will be absolute positioned 3797 // within a wrapper div off the -left and -top equal to size of our pieces 3798 element 3799 .clone() 3800 .appendTo( "body" ) 3801 .wrap( "<div></div>" ) 3802 .css( { 3803 position: "absolute", 3804 visibility: "visible", 3805 left: -j * width, 3806 top: -i * height 3807 } ) 3808 3809 // Select the wrapper - make it overflow: hidden and absolute positioned based on 3810 // where the original was located +left and +top equal to the size of pieces 3811 .parent() 3812 .addClass( "ui-effects-explode" ) 3813 .css( { 3814 position: "absolute", 3815 overflow: "hidden", 3816 width: width, 3817 height: height, 3818 left: left + ( show ? mx * width : 0 ), 3819 top: top + ( show ? my * height : 0 ), 3820 opacity: show ? 0 : 1 3821 } ) 3822 .animate( { 3823 left: left + ( show ? 0 : mx * width ), 3824 top: top + ( show ? 0 : my * height ), 3825 opacity: show ? 1 : 0 3826 }, options.duration || 500, options.easing, childComplete ); 3827 } 3828 } 3829 3830 function animComplete() { 3831 element.css( { 3832 visibility: "visible" 3833 } ); 3834 $( pieces ).remove(); 3835 done(); 3836 } 3837} ); 3838 3839 3840/*! 3841 * jQuery UI Effects Fade 1.13.2 3842 * http://jqueryui.com 3843 * 3844 * Copyright jQuery Foundation and other contributors 3845 * Released under the MIT license. 3846 * http://jquery.org/license 3847 */ 3848 3849//>>label: Fade Effect 3850//>>group: Effects 3851//>>description: Fades the element. 3852//>>docs: http://api.jqueryui.com/fade-effect/ 3853//>>demos: http://jqueryui.com/effect/ 3854 3855 3856var effectsEffectFade = $.effects.define( "fade", "toggle", function( options, done ) { 3857 var show = options.mode === "show"; 3858 3859 $( this ) 3860 .css( "opacity", show ? 0 : 1 ) 3861 .animate( { 3862 opacity: show ? 1 : 0 3863 }, { 3864 queue: false, 3865 duration: options.duration, 3866 easing: options.easing, 3867 complete: done 3868 } ); 3869} ); 3870 3871 3872/*! 3873 * jQuery UI Effects Fold 1.13.2 3874 * http://jqueryui.com 3875 * 3876 * Copyright jQuery Foundation and other contributors 3877 * Released under the MIT license. 3878 * http://jquery.org/license 3879 */ 3880 3881//>>label: Fold Effect 3882//>>group: Effects 3883//>>description: Folds an element first horizontally and then vertically. 3884//>>docs: http://api.jqueryui.com/fold-effect/ 3885//>>demos: http://jqueryui.com/effect/ 3886 3887 3888var effectsEffectFold = $.effects.define( "fold", "hide", function( options, done ) { 3889 3890 // Create element 3891 var element = $( this ), 3892 mode = options.mode, 3893 show = mode === "show", 3894 hide = mode === "hide", 3895 size = options.size || 15, 3896 percent = /([0-9]+)%/.exec( size ), 3897 horizFirst = !!options.horizFirst, 3898 ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ], 3899 duration = options.duration / 2, 3900 3901 placeholder = $.effects.createPlaceholder( element ), 3902 3903 start = element.cssClip(), 3904 animation1 = { clip: $.extend( {}, start ) }, 3905 animation2 = { clip: $.extend( {}, start ) }, 3906 3907 distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ], 3908 3909 queuelen = element.queue().length; 3910 3911 if ( percent ) { 3912 size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ]; 3913 } 3914 animation1.clip[ ref[ 0 ] ] = size; 3915 animation2.clip[ ref[ 0 ] ] = size; 3916 animation2.clip[ ref[ 1 ] ] = 0; 3917 3918 if ( show ) { 3919 element.cssClip( animation2.clip ); 3920 if ( placeholder ) { 3921 placeholder.css( $.effects.clipToBox( animation2 ) ); 3922 } 3923 3924 animation2.clip = start; 3925 } 3926 3927 // Animate 3928 element 3929 .queue( function( next ) { 3930 if ( placeholder ) { 3931 placeholder 3932 .animate( $.effects.clipToBox( animation1 ), duration, options.easing ) 3933 .animate( $.effects.clipToBox( animation2 ), duration, options.easing ); 3934 } 3935 3936 next(); 3937 } ) 3938 .animate( animation1, duration, options.easing ) 3939 .animate( animation2, duration, options.easing ) 3940 .queue( done ); 3941 3942 $.effects.unshift( element, queuelen, 4 ); 3943} ); 3944 3945 3946/*! 3947 * jQuery UI Effects Highlight 1.13.2 3948 * http://jqueryui.com 3949 * 3950 * Copyright jQuery Foundation and other contributors 3951 * Released under the MIT license. 3952 * http://jquery.org/license 3953 */ 3954 3955//>>label: Highlight Effect 3956//>>group: Effects 3957//>>description: Highlights the background of an element in a defined color for a custom duration. 3958//>>docs: http://api.jqueryui.com/highlight-effect/ 3959//>>demos: http://jqueryui.com/effect/ 3960 3961 3962var effectsEffectHighlight = $.effects.define( "highlight", "show", function( options, done ) { 3963 var element = $( this ), 3964 animation = { 3965 backgroundColor: element.css( "backgroundColor" ) 3966 }; 3967 3968 if ( options.mode === "hide" ) { 3969 animation.opacity = 0; 3970 } 3971 3972 $.effects.saveStyle( element ); 3973 3974 element 3975 .css( { 3976 backgroundImage: "none", 3977 backgroundColor: options.color || "#ffff99" 3978 } ) 3979 .animate( animation, { 3980 queue: false, 3981 duration: options.duration, 3982 easing: options.easing, 3983 complete: done 3984 } ); 3985} ); 3986 3987 3988/*! 3989 * jQuery UI Effects Size 1.13.2 3990 * http://jqueryui.com 3991 * 3992 * Copyright jQuery Foundation and other contributors 3993 * Released under the MIT license. 3994 * http://jquery.org/license 3995 */ 3996 3997//>>label: Size Effect 3998//>>group: Effects 3999//>>description: Resize an element to a specified width and height. 4000//>>docs: http://api.jqueryui.com/size-effect/ 4001//>>demos: http://jqueryui.com/effect/ 4002 4003 4004var effectsEffectSize = $.effects.define( "size", function( options, done ) { 4005 4006 // Create element 4007 var baseline, factor, temp, 4008 element = $( this ), 4009 4010 // Copy for children 4011 cProps = [ "fontSize" ], 4012 vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ], 4013 hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ], 4014 4015 // Set options 4016 mode = options.mode, 4017 restore = mode !== "effect", 4018 scale = options.scale || "both", 4019 origin = options.origin || [ "middle", "center" ], 4020 position = element.css( "position" ), 4021 pos = element.position(), 4022 original = $.effects.scaledDimensions( element ), 4023 from = options.from || original, 4024 to = options.to || $.effects.scaledDimensions( element, 0 ); 4025 4026 $.effects.createPlaceholder( element ); 4027 4028 if ( mode === "show" ) { 4029 temp = from; 4030 from = to; 4031 to = temp; 4032 } 4033 4034 // Set scaling factor 4035 factor = { 4036 from: { 4037 y: from.height / original.height, 4038 x: from.width / original.width 4039 }, 4040 to: { 4041 y: to.height / original.height, 4042 x: to.width / original.width 4043 } 4044 }; 4045 4046 // Scale the css box 4047 if ( scale === "box" || scale === "both" ) { 4048 4049 // Vertical props scaling 4050 if ( factor.from.y !== factor.to.y ) { 4051 from = $.effects.setTransition( element, vProps, factor.from.y, from ); 4052 to = $.effects.setTransition( element, vProps, factor.to.y, to ); 4053 } 4054 4055 // Horizontal props scaling 4056 if ( factor.from.x !== factor.to.x ) { 4057 from = $.effects.setTransition( element, hProps, factor.from.x, from ); 4058 to = $.effects.setTransition( element, hProps, factor.to.x, to ); 4059 } 4060 } 4061 4062 // Scale the content 4063 if ( scale === "content" || scale === "both" ) { 4064 4065 // Vertical props scaling 4066 if ( factor.from.y !== factor.to.y ) { 4067 from = $.effects.setTransition( element, cProps, factor.from.y, from ); 4068 to = $.effects.setTransition( element, cProps, factor.to.y, to ); 4069 } 4070 } 4071 4072 // Adjust the position properties based on the provided origin points 4073 if ( origin ) { 4074 baseline = $.effects.getBaseline( origin, original ); 4075 from.top = ( original.outerHeight - from.outerHeight ) * baseline.y + pos.top; 4076 from.left = ( original.outerWidth - from.outerWidth ) * baseline.x + pos.left; 4077 to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top; 4078 to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left; 4079 } 4080 delete from.outerHeight; 4081 delete from.outerWidth; 4082 element.css( from ); 4083 4084 // Animate the children if desired 4085 if ( scale === "content" || scale === "both" ) { 4086 4087 vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps ); 4088 hProps = hProps.concat( [ "marginLeft", "marginRight" ] ); 4089 4090 // Only animate children with width attributes specified 4091 // TODO: is this right? should we include anything with css width specified as well 4092 element.find( "*[width]" ).each( function() { 4093 var child = $( this ), 4094 childOriginal = $.effects.scaledDimensions( child ), 4095 childFrom = { 4096 height: childOriginal.height * factor.from.y, 4097 width: childOriginal.width * factor.from.x, 4098 outerHeight: childOriginal.outerHeight * factor.from.y, 4099 outerWidth: childOriginal.outerWidth * factor.from.x 4100 }, 4101 childTo = { 4102 height: childOriginal.height * factor.to.y, 4103 width: childOriginal.width * factor.to.x, 4104 outerHeight: childOriginal.height * factor.to.y, 4105 outerWidth: childOriginal.width * factor.to.x 4106 }; 4107 4108 // Vertical props scaling 4109 if ( factor.from.y !== factor.to.y ) { 4110 childFrom = $.effects.setTransition( child, vProps, factor.from.y, childFrom ); 4111 childTo = $.effects.setTransition( child, vProps, factor.to.y, childTo ); 4112 } 4113 4114 // Horizontal props scaling 4115 if ( factor.from.x !== factor.to.x ) { 4116 childFrom = $.effects.setTransition( child, hProps, factor.from.x, childFrom ); 4117 childTo = $.effects.setTransition( child, hProps, factor.to.x, childTo ); 4118 } 4119 4120 if ( restore ) { 4121 $.effects.saveStyle( child ); 4122 } 4123 4124 // Animate children 4125 child.css( childFrom ); 4126 child.animate( childTo, options.duration, options.easing, function() { 4127 4128 // Restore children 4129 if ( restore ) { 4130 $.effects.restoreStyle( child ); 4131 } 4132 } ); 4133 } ); 4134 } 4135 4136 // Animate 4137 element.animate( to, { 4138 queue: false, 4139 duration: options.duration, 4140 easing: options.easing, 4141 complete: function() { 4142 4143 var offset = element.offset(); 4144 4145 if ( to.opacity === 0 ) { 4146 element.css( "opacity", from.opacity ); 4147 } 4148 4149 if ( !restore ) { 4150 element 4151 .css( "position", position === "static" ? "relative" : position ) 4152 .offset( offset ); 4153 4154 // Need to save style here so that automatic style restoration 4155 // doesn't restore to the original styles from before the animation. 4156 $.effects.saveStyle( element ); 4157 } 4158 4159 done(); 4160 } 4161 } ); 4162 4163} ); 4164 4165 4166/*! 4167 * jQuery UI Effects Scale 1.13.2 4168 * http://jqueryui.com 4169 * 4170 * Copyright jQuery Foundation and other contributors 4171 * Released under the MIT license. 4172 * http://jquery.org/license 4173 */ 4174 4175//>>label: Scale Effect 4176//>>group: Effects 4177//>>description: Grows or shrinks an element and its content. 4178//>>docs: http://api.jqueryui.com/scale-effect/ 4179//>>demos: http://jqueryui.com/effect/ 4180 4181 4182var effectsEffectScale = $.effects.define( "scale", function( options, done ) { 4183 4184 // Create element 4185 var el = $( this ), 4186 mode = options.mode, 4187 percent = parseInt( options.percent, 10 ) || 4188 ( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ), 4189 4190 newOptions = $.extend( true, { 4191 from: $.effects.scaledDimensions( el ), 4192 to: $.effects.scaledDimensions( el, percent, options.direction || "both" ), 4193 origin: options.origin || [ "middle", "center" ] 4194 }, options ); 4195 4196 // Fade option to support puff 4197 if ( options.fade ) { 4198 newOptions.from.opacity = 1; 4199 newOptions.to.opacity = 0; 4200 } 4201 4202 $.effects.effect.size.call( this, newOptions, done ); 4203} ); 4204 4205 4206/*! 4207 * jQuery UI Effects Puff 1.13.2 4208 * http://jqueryui.com 4209 * 4210 * Copyright jQuery Foundation and other contributors 4211 * Released under the MIT license. 4212 * http://jquery.org/license 4213 */ 4214 4215//>>label: Puff Effect 4216//>>group: Effects 4217//>>description: Creates a puff effect by scaling the element up and hiding it at the same time. 4218//>>docs: http://api.jqueryui.com/puff-effect/ 4219//>>demos: http://jqueryui.com/effect/ 4220 4221 4222var effectsEffectPuff = $.effects.define( "puff", "hide", function( options, done ) { 4223 var newOptions = $.extend( true, {}, options, { 4224 fade: true, 4225 percent: parseInt( options.percent, 10 ) || 150 4226 } ); 4227 4228 $.effects.effect.scale.call( this, newOptions, done ); 4229} ); 4230 4231 4232/*! 4233 * jQuery UI Effects Pulsate 1.13.2 4234 * http://jqueryui.com 4235 * 4236 * Copyright jQuery Foundation and other contributors 4237 * Released under the MIT license. 4238 * http://jquery.org/license 4239 */ 4240 4241//>>label: Pulsate Effect 4242//>>group: Effects 4243//>>description: Pulsates an element n times by changing the opacity to zero and back. 4244//>>docs: http://api.jqueryui.com/pulsate-effect/ 4245//>>demos: http://jqueryui.com/effect/ 4246 4247 4248var effectsEffectPulsate = $.effects.define( "pulsate", "show", function( options, done ) { 4249 var element = $( this ), 4250 mode = options.mode, 4251 show = mode === "show", 4252 hide = mode === "hide", 4253 showhide = show || hide, 4254 4255 // Showing or hiding leaves off the "last" animation 4256 anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ), 4257 duration = options.duration / anims, 4258 animateTo = 0, 4259 i = 1, 4260 queuelen = element.queue().length; 4261 4262 if ( show || !element.is( ":visible" ) ) { 4263 element.css( "opacity", 0 ).show(); 4264 animateTo = 1; 4265 } 4266 4267 // Anims - 1 opacity "toggles" 4268 for ( ; i < anims; i++ ) { 4269 element.animate( { opacity: animateTo }, duration, options.easing ); 4270 animateTo = 1 - animateTo; 4271 } 4272 4273 element.animate( { opacity: animateTo }, duration, options.easing ); 4274 4275 element.queue( done ); 4276 4277 $.effects.unshift( element, queuelen, anims + 1 ); 4278} ); 4279 4280 4281/*! 4282 * jQuery UI Effects Shake 1.13.2 4283 * http://jqueryui.com 4284 * 4285 * Copyright jQuery Foundation and other contributors 4286 * Released under the MIT license. 4287 * http://jquery.org/license 4288 */ 4289 4290//>>label: Shake Effect 4291//>>group: Effects 4292//>>description: Shakes an element horizontally or vertically n times. 4293//>>docs: http://api.jqueryui.com/shake-effect/ 4294//>>demos: http://jqueryui.com/effect/ 4295 4296 4297var effectsEffectShake = $.effects.define( "shake", function( options, done ) { 4298 4299 var i = 1, 4300 element = $( this ), 4301 direction = options.direction || "left", 4302 distance = options.distance || 20, 4303 times = options.times || 3, 4304 anims = times * 2 + 1, 4305 speed = Math.round( options.duration / anims ), 4306 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 4307 positiveMotion = ( direction === "up" || direction === "left" ), 4308 animation = {}, 4309 animation1 = {}, 4310 animation2 = {}, 4311 4312 queuelen = element.queue().length; 4313 4314 $.effects.createPlaceholder( element ); 4315 4316 // Animation 4317 animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance; 4318 animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2; 4319 animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2; 4320 4321 // Animate 4322 element.animate( animation, speed, options.easing ); 4323 4324 // Shakes 4325 for ( ; i < times; i++ ) { 4326 element 4327 .animate( animation1, speed, options.easing ) 4328 .animate( animation2, speed, options.easing ); 4329 } 4330 4331 element 4332 .animate( animation1, speed, options.easing ) 4333 .animate( animation, speed / 2, options.easing ) 4334 .queue( done ); 4335 4336 $.effects.unshift( element, queuelen, anims + 1 ); 4337} ); 4338 4339 4340/*! 4341 * jQuery UI Effects Slide 1.13.2 4342 * http://jqueryui.com 4343 * 4344 * Copyright jQuery Foundation and other contributors 4345 * Released under the MIT license. 4346 * http://jquery.org/license 4347 */ 4348 4349//>>label: Slide Effect 4350//>>group: Effects 4351//>>description: Slides an element in and out of the viewport. 4352//>>docs: http://api.jqueryui.com/slide-effect/ 4353//>>demos: http://jqueryui.com/effect/ 4354 4355 4356var effectsEffectSlide = $.effects.define( "slide", "show", function( options, done ) { 4357 var startClip, startRef, 4358 element = $( this ), 4359 map = { 4360 up: [ "bottom", "top" ], 4361 down: [ "top", "bottom" ], 4362 left: [ "right", "left" ], 4363 right: [ "left", "right" ] 4364 }, 4365 mode = options.mode, 4366 direction = options.direction || "left", 4367 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 4368 positiveMotion = ( direction === "up" || direction === "left" ), 4369 distance = options.distance || 4370 element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ), 4371 animation = {}; 4372 4373 $.effects.createPlaceholder( element ); 4374 4375 startClip = element.cssClip(); 4376 startRef = element.position()[ ref ]; 4377 4378 // Define hide animation 4379 animation[ ref ] = ( positiveMotion ? -1 : 1 ) * distance + startRef; 4380 animation.clip = element.cssClip(); 4381 animation.clip[ map[ direction ][ 1 ] ] = animation.clip[ map[ direction ][ 0 ] ]; 4382 4383 // Reverse the animation if we're showing 4384 if ( mode === "show" ) { 4385 element.cssClip( animation.clip ); 4386 element.css( ref, animation[ ref ] ); 4387 animation.clip = startClip; 4388 animation[ ref ] = startRef; 4389 } 4390 4391 // Actually animate 4392 element.animate( animation, { 4393 queue: false, 4394 duration: options.duration, 4395 easing: options.easing, 4396 complete: done 4397 } ); 4398} ); 4399 4400 4401/*! 4402 * jQuery UI Effects Transfer 1.13.2 4403 * http://jqueryui.com 4404 * 4405 * Copyright jQuery Foundation and other contributors 4406 * Released under the MIT license. 4407 * http://jquery.org/license 4408 */ 4409 4410//>>label: Transfer Effect 4411//>>group: Effects 4412//>>description: Displays a transfer effect from one element to another. 4413//>>docs: http://api.jqueryui.com/transfer-effect/ 4414//>>demos: http://jqueryui.com/effect/ 4415 4416 4417var effect; 4418if ( $.uiBackCompat !== false ) { 4419 effect = $.effects.define( "transfer", function( options, done ) { 4420 $( this ).transfer( options, done ); 4421 } ); 4422} 4423var effectsEffectTransfer = effect; 4424 4425 4426/*! 4427 * jQuery UI Focusable 1.13.2 4428 * http://jqueryui.com 4429 * 4430 * Copyright jQuery Foundation and other contributors 4431 * Released under the MIT license. 4432 * http://jquery.org/license 4433 */ 4434 4435//>>label: :focusable Selector 4436//>>group: Core 4437//>>description: Selects elements which can be focused. 4438//>>docs: http://api.jqueryui.com/focusable-selector/ 4439 4440 4441// Selectors 4442$.ui.focusable = function( element, hasTabindex ) { 4443 var map, mapName, img, focusableIfVisible, fieldset, 4444 nodeName = element.nodeName.toLowerCase(); 4445 4446 if ( "area" === nodeName ) { 4447 map = element.parentNode; 4448 mapName = map.name; 4449 if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { 4450 return false; 4451 } 4452 img = $( "img[usemap='#" + mapName + "']" ); 4453 return img.length > 0 && img.is( ":visible" ); 4454 } 4455 4456 if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) { 4457 focusableIfVisible = !element.disabled; 4458 4459 if ( focusableIfVisible ) { 4460 4461 // Form controls within a disabled fieldset are disabled. 4462 // However, controls within the fieldset's legend do not get disabled. 4463 // Since controls generally aren't placed inside legends, we skip 4464 // this portion of the check. 4465 fieldset = $( element ).closest( "fieldset" )[ 0 ]; 4466 if ( fieldset ) { 4467 focusableIfVisible = !fieldset.disabled; 4468 } 4469 } 4470 } else if ( "a" === nodeName ) { 4471 focusableIfVisible = element.href || hasTabindex; 4472 } else { 4473 focusableIfVisible = hasTabindex; 4474 } 4475 4476 return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) ); 4477}; 4478 4479// Support: IE 8 only 4480// IE 8 doesn't resolve inherit to visible/hidden for computed values 4481function visible( element ) { 4482 var visibility = element.css( "visibility" ); 4483 while ( visibility === "inherit" ) { 4484 element = element.parent(); 4485 visibility = element.css( "visibility" ); 4486 } 4487 return visibility === "visible"; 4488} 4489 4490$.extend( $.expr.pseudos, { 4491 focusable: function( element ) { 4492 return $.ui.focusable( element, $.attr( element, "tabindex" ) != null ); 4493 } 4494} ); 4495 4496var focusable = $.ui.focusable; 4497 4498 4499 4500// Support: IE8 Only 4501// IE8 does not support the form attribute and when it is supplied. It overwrites the form prop 4502// with a string, so we need to find the proper form. 4503var form = $.fn._form = function() { 4504 return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form ); 4505}; 4506 4507 4508/*! 4509 * jQuery UI Form Reset Mixin 1.13.2 4510 * http://jqueryui.com 4511 * 4512 * Copyright jQuery Foundation and other contributors 4513 * Released under the MIT license. 4514 * http://jquery.org/license 4515 */ 4516 4517//>>label: Form Reset Mixin 4518//>>group: Core 4519//>>description: Refresh input widgets when their form is reset 4520//>>docs: http://api.jqueryui.com/form-reset-mixin/ 4521 4522 4523var formResetMixin = $.ui.formResetMixin = { 4524 _formResetHandler: function() { 4525 var form = $( this ); 4526 4527 // Wait for the form reset to actually happen before refreshing 4528 setTimeout( function() { 4529 var instances = form.data( "ui-form-reset-instances" ); 4530 $.each( instances, function() { 4531 this.refresh(); 4532 } ); 4533 } ); 4534 }, 4535 4536 _bindFormResetHandler: function() { 4537 this.form = this.element._form(); 4538 if ( !this.form.length ) { 4539 return; 4540 } 4541 4542 var instances = this.form.data( "ui-form-reset-instances" ) || []; 4543 if ( !instances.length ) { 4544 4545 // We don't use _on() here because we use a single event handler per form 4546 this.form.on( "reset.ui-form-reset", this._formResetHandler ); 4547 } 4548 instances.push( this ); 4549 this.form.data( "ui-form-reset-instances", instances ); 4550 }, 4551 4552 _unbindFormResetHandler: function() { 4553 if ( !this.form.length ) { 4554 return; 4555 } 4556 4557 var instances = this.form.data( "ui-form-reset-instances" ); 4558 instances.splice( $.inArray( this, instances ), 1 ); 4559 if ( instances.length ) { 4560 this.form.data( "ui-form-reset-instances", instances ); 4561 } else { 4562 this.form 4563 .removeData( "ui-form-reset-instances" ) 4564 .off( "reset.ui-form-reset" ); 4565 } 4566 } 4567}; 4568 4569 4570/*! 4571 * jQuery UI Support for jQuery core 1.8.x and newer 1.13.2 4572 * http://jqueryui.com 4573 * 4574 * Copyright jQuery Foundation and other contributors 4575 * Released under the MIT license. 4576 * http://jquery.org/license 4577 * 4578 */ 4579 4580//>>label: jQuery 1.8+ Support 4581//>>group: Core 4582//>>description: Support version 1.8.x and newer of jQuery core 4583 4584 4585// Support: jQuery 1.9.x or older 4586// $.expr[ ":" ] is deprecated. 4587if ( !$.expr.pseudos ) { 4588 $.expr.pseudos = $.expr[ ":" ]; 4589} 4590 4591// Support: jQuery 1.11.x or older 4592// $.unique has been renamed to $.uniqueSort 4593if ( !$.uniqueSort ) { 4594 $.uniqueSort = $.unique; 4595} 4596 4597// Support: jQuery 2.2.x or older. 4598// This method has been defined in jQuery 3.0.0. 4599// Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js 4600if ( !$.escapeSelector ) { 4601 4602 // CSS string/identifier serialization 4603 // https://drafts.csswg.org/cssom/#common-serializing-idioms 4604 var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 4605 4606 var fcssescape = function( ch, asCodePoint ) { 4607 if ( asCodePoint ) { 4608 4609 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 4610 if ( ch === "\0" ) { 4611 return "\uFFFD"; 4612 } 4613 4614 // Control characters and (dependent upon position) numbers get escaped as code points 4615 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 4616 } 4617 4618 // Other potentially-special ASCII characters get backslash-escaped 4619 return "\\" + ch; 4620 }; 4621 4622 $.escapeSelector = function( sel ) { 4623 return ( sel + "" ).replace( rcssescape, fcssescape ); 4624 }; 4625} 4626 4627// Support: jQuery 3.4.x or older 4628// These methods have been defined in jQuery 3.5.0. 4629if ( !$.fn.even || !$.fn.odd ) { 4630 $.fn.extend( { 4631 even: function() { 4632 return this.filter( function( i ) { 4633 return i % 2 === 0; 4634 } ); 4635 }, 4636 odd: function() { 4637 return this.filter( function( i ) { 4638 return i % 2 === 1; 4639 } ); 4640 } 4641 } ); 4642} 4643 4644; 4645/*! 4646 * jQuery UI Keycode 1.13.2 4647 * http://jqueryui.com 4648 * 4649 * Copyright jQuery Foundation and other contributors 4650 * Released under the MIT license. 4651 * http://jquery.org/license 4652 */ 4653 4654//>>label: Keycode 4655//>>group: Core 4656//>>description: Provide keycodes as keynames 4657//>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/ 4658 4659 4660var keycode = $.ui.keyCode = { 4661 BACKSPACE: 8, 4662 COMMA: 188, 4663 DELETE: 46, 4664 DOWN: 40, 4665 END: 35, 4666 ENTER: 13, 4667 ESCAPE: 27, 4668 HOME: 36, 4669 LEFT: 37, 4670 PAGE_DOWN: 34, 4671 PAGE_UP: 33, 4672 PERIOD: 190, 4673 RIGHT: 39, 4674 SPACE: 32, 4675 TAB: 9, 4676 UP: 38 4677}; 4678 4679 4680/*! 4681 * jQuery UI Labels 1.13.2 4682 * http://jqueryui.com 4683 * 4684 * Copyright jQuery Foundation and other contributors 4685 * Released under the MIT license. 4686 * http://jquery.org/license 4687 */ 4688 4689//>>label: labels 4690//>>group: Core 4691//>>description: Find all the labels associated with a given input 4692//>>docs: http://api.jqueryui.com/labels/ 4693 4694 4695var labels = $.fn.labels = function() { 4696 var ancestor, selector, id, labels, ancestors; 4697 4698 if ( !this.length ) { 4699 return this.pushStack( [] ); 4700 } 4701 4702 // Check control.labels first 4703 if ( this[ 0 ].labels && this[ 0 ].labels.length ) { 4704 return this.pushStack( this[ 0 ].labels ); 4705 } 4706 4707 // Support: IE <= 11, FF <= 37, Android <= 2.3 only 4708 // Above browsers do not support control.labels. Everything below is to support them 4709 // as well as document fragments. control.labels does not work on document fragments 4710 labels = this.eq( 0 ).parents( "label" ); 4711 4712 // Look for the label based on the id 4713 id = this.attr( "id" ); 4714 if ( id ) { 4715 4716 // We don't search against the document in case the element 4717 // is disconnected from the DOM 4718 ancestor = this.eq( 0 ).parents().last(); 4719 4720 // Get a full set of top level ancestors 4721 ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() ); 4722 4723 // Create a selector for the label based on the id 4724 selector = "label[for='" + $.escapeSelector( id ) + "']"; 4725 4726 labels = labels.add( ancestors.find( selector ).addBack( selector ) ); 4727 4728 } 4729 4730 // Return whatever we have found for labels 4731 return this.pushStack( labels ); 4732}; 4733 4734 4735/*! 4736 * jQuery UI Scroll Parent 1.13.2 4737 * http://jqueryui.com 4738 * 4739 * Copyright jQuery Foundation and other contributors 4740 * Released under the MIT license. 4741 * http://jquery.org/license 4742 */ 4743 4744//>>label: scrollParent 4745//>>group: Core 4746//>>description: Get the closest ancestor element that is scrollable. 4747//>>docs: http://api.jqueryui.com/scrollParent/ 4748 4749 4750var scrollParent = $.fn.scrollParent = function( includeHidden ) { 4751 var position = this.css( "position" ), 4752 excludeStaticParent = position === "absolute", 4753 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 4754 scrollParent = this.parents().filter( function() { 4755 var parent = $( this ); 4756 if ( excludeStaticParent && parent.css( "position" ) === "static" ) { 4757 return false; 4758 } 4759 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + 4760 parent.css( "overflow-x" ) ); 4761 } ).eq( 0 ); 4762 4763 return position === "fixed" || !scrollParent.length ? 4764 $( this[ 0 ].ownerDocument || document ) : 4765 scrollParent; 4766}; 4767 4768 4769/*! 4770 * jQuery UI Tabbable 1.13.2 4771 * http://jqueryui.com 4772 * 4773 * Copyright jQuery Foundation and other contributors 4774 * Released under the MIT license. 4775 * http://jquery.org/license 4776 */ 4777 4778//>>label: :tabbable Selector 4779//>>group: Core 4780//>>description: Selects elements which can be tabbed to. 4781//>>docs: http://api.jqueryui.com/tabbable-selector/ 4782 4783 4784var tabbable = $.extend( $.expr.pseudos, { 4785 tabbable: function( element ) { 4786 var tabIndex = $.attr( element, "tabindex" ), 4787 hasTabindex = tabIndex != null; 4788 return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex ); 4789 } 4790} ); 4791 4792 4793/*! 4794 * jQuery UI Unique ID 1.13.2 4795 * http://jqueryui.com 4796 * 4797 * Copyright jQuery Foundation and other contributors 4798 * Released under the MIT license. 4799 * http://jquery.org/license 4800 */ 4801 4802//>>label: uniqueId 4803//>>group: Core 4804//>>description: Functions to generate and remove uniqueId's 4805//>>docs: http://api.jqueryui.com/uniqueId/ 4806 4807 4808var uniqueId = $.fn.extend( { 4809 uniqueId: ( function() { 4810 var uuid = 0; 4811 4812 return function() { 4813 return this.each( function() { 4814 if ( !this.id ) { 4815 this.id = "ui-id-" + ( ++uuid ); 4816 } 4817 } ); 4818 }; 4819 } )(), 4820 4821 removeUniqueId: function() { 4822 return this.each( function() { 4823 if ( /^ui-id-\d+$/.test( this.id ) ) { 4824 $( this ).removeAttr( "id" ); 4825 } 4826 } ); 4827 } 4828} ); 4829 4830 4831/*! 4832 * jQuery UI Accordion 1.13.2 4833 * http://jqueryui.com 4834 * 4835 * Copyright jQuery Foundation and other contributors 4836 * Released under the MIT license. 4837 * http://jquery.org/license 4838 */ 4839 4840//>>label: Accordion 4841//>>group: Widgets 4842/* eslint-disable max-len */ 4843//>>description: Displays collapsible content panels for presenting information in a limited amount of space. 4844/* eslint-enable max-len */ 4845//>>docs: http://api.jqueryui.com/accordion/ 4846//>>demos: http://jqueryui.com/accordion/ 4847//>>css.structure: ../../themes/base/core.css 4848//>>css.structure: ../../themes/base/accordion.css 4849//>>css.theme: ../../themes/base/theme.css 4850 4851 4852var widgetsAccordion = $.widget( "ui.accordion", { 4853 version: "1.13.2", 4854 options: { 4855 active: 0, 4856 animate: {}, 4857 classes: { 4858 "ui-accordion-header": "ui-corner-top", 4859 "ui-accordion-header-collapsed": "ui-corner-all", 4860 "ui-accordion-content": "ui-corner-bottom" 4861 }, 4862 collapsible: false, 4863 event: "click", 4864 header: function( elem ) { 4865 return elem.find( "> li > :first-child" ).add( elem.find( "> :not(li)" ).even() ); 4866 }, 4867 heightStyle: "auto", 4868 icons: { 4869 activeHeader: "ui-icon-triangle-1-s", 4870 header: "ui-icon-triangle-1-e" 4871 }, 4872 4873 // Callbacks 4874 activate: null, 4875 beforeActivate: null 4876 }, 4877 4878 hideProps: { 4879 borderTopWidth: "hide", 4880 borderBottomWidth: "hide", 4881 paddingTop: "hide", 4882 paddingBottom: "hide", 4883 height: "hide" 4884 }, 4885 4886 showProps: { 4887 borderTopWidth: "show", 4888 borderBottomWidth: "show", 4889 paddingTop: "show", 4890 paddingBottom: "show", 4891 height: "show" 4892 }, 4893 4894 _create: function() { 4895 var options = this.options; 4896 4897 this.prevShow = this.prevHide = $(); 4898 this._addClass( "ui-accordion", "ui-widget ui-helper-reset" ); 4899 this.element.attr( "role", "tablist" ); 4900 4901 // Don't allow collapsible: false and active: false / null 4902 if ( !options.collapsible && ( options.active === false || options.active == null ) ) { 4903 options.active = 0; 4904 } 4905 4906 this._processPanels(); 4907 4908 // handle negative values 4909 if ( options.active < 0 ) { 4910 options.active += this.headers.length; 4911 } 4912 this._refresh(); 4913 }, 4914 4915 _getCreateEventData: function() { 4916 return { 4917 header: this.active, 4918 panel: !this.active.length ? $() : this.active.next() 4919 }; 4920 }, 4921 4922 _createIcons: function() { 4923 var icon, children, 4924 icons = this.options.icons; 4925 4926 if ( icons ) { 4927 icon = $( "<span>" ); 4928 this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header ); 4929 icon.prependTo( this.headers ); 4930 children = this.active.children( ".ui-accordion-header-icon" ); 4931 this._removeClass( children, icons.header ) 4932 ._addClass( children, null, icons.activeHeader ) 4933 ._addClass( this.headers, "ui-accordion-icons" ); 4934 } 4935 }, 4936 4937 _destroyIcons: function() { 4938 this._removeClass( this.headers, "ui-accordion-icons" ); 4939 this.headers.children( ".ui-accordion-header-icon" ).remove(); 4940 }, 4941 4942 _destroy: function() { 4943 var contents; 4944 4945 // Clean up main element 4946 this.element.removeAttr( "role" ); 4947 4948 // Clean up headers 4949 this.headers 4950 .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" ) 4951 .removeUniqueId(); 4952 4953 this._destroyIcons(); 4954 4955 // Clean up content panels 4956 contents = this.headers.next() 4957 .css( "display", "" ) 4958 .removeAttr( "role aria-hidden aria-labelledby" ) 4959 .removeUniqueId(); 4960 4961 if ( this.options.heightStyle !== "content" ) { 4962 contents.css( "height", "" ); 4963 } 4964 }, 4965 4966 _setOption: function( key, value ) { 4967 if ( key === "active" ) { 4968 4969 // _activate() will handle invalid values and update this.options 4970 this._activate( value ); 4971 return; 4972 } 4973 4974 if ( key === "event" ) { 4975 if ( this.options.event ) { 4976 this._off( this.headers, this.options.event ); 4977 } 4978 this._setupEvents( value ); 4979 } 4980 4981 this._super( key, value ); 4982 4983 // Setting collapsible: false while collapsed; open first panel 4984 if ( key === "collapsible" && !value && this.options.active === false ) { 4985 this._activate( 0 ); 4986 } 4987 4988 if ( key === "icons" ) { 4989 this._destroyIcons(); 4990 if ( value ) { 4991 this._createIcons(); 4992 } 4993 } 4994 }, 4995 4996 _setOptionDisabled: function( value ) { 4997 this._super( value ); 4998 4999 this.element.attr( "aria-disabled", value ); 5000 5001 // Support: IE8 Only 5002 // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE 5003 // so we need to add the disabled class to the headers and panels 5004 this._toggleClass( null, "ui-state-disabled", !!value ); 5005 this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled", 5006 !!value ); 5007 }, 5008 5009 _keydown: function( event ) { 5010 if ( event.altKey || event.ctrlKey ) { 5011 return; 5012 } 5013 5014 var keyCode = $.ui.keyCode, 5015 length = this.headers.length, 5016 currentIndex = this.headers.index( event.target ), 5017 toFocus = false; 5018 5019 switch ( event.keyCode ) { 5020 case keyCode.RIGHT: 5021 case keyCode.DOWN: 5022 toFocus = this.headers[ ( currentIndex + 1 ) % length ]; 5023 break; 5024 case keyCode.LEFT: 5025 case keyCode.UP: 5026 toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; 5027 break; 5028 case keyCode.SPACE: 5029 case keyCode.ENTER: 5030 this._eventHandler( event ); 5031 break; 5032 case keyCode.HOME: 5033 toFocus = this.headers[ 0 ]; 5034 break; 5035 case keyCode.END: 5036 toFocus = this.headers[ length - 1 ]; 5037 break; 5038 } 5039 5040 if ( toFocus ) { 5041 $( event.target ).attr( "tabIndex", -1 ); 5042 $( toFocus ).attr( "tabIndex", 0 ); 5043 $( toFocus ).trigger( "focus" ); 5044 event.preventDefault(); 5045 } 5046 }, 5047 5048 _panelKeyDown: function( event ) { 5049 if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { 5050 $( event.currentTarget ).prev().trigger( "focus" ); 5051 } 5052 }, 5053 5054 refresh: function() { 5055 var options = this.options; 5056 this._processPanels(); 5057 5058 // Was collapsed or no panel 5059 if ( ( options.active === false && options.collapsible === true ) || 5060 !this.headers.length ) { 5061 options.active = false; 5062 this.active = $(); 5063 5064 // active false only when collapsible is true 5065 } else if ( options.active === false ) { 5066 this._activate( 0 ); 5067 5068 // was active, but active panel is gone 5069 } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { 5070 5071 // all remaining panel are disabled 5072 if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) { 5073 options.active = false; 5074 this.active = $(); 5075 5076 // activate previous panel 5077 } else { 5078 this._activate( Math.max( 0, options.active - 1 ) ); 5079 } 5080 5081 // was active, active panel still exists 5082 } else { 5083 5084 // make sure active index is correct 5085 options.active = this.headers.index( this.active ); 5086 } 5087 5088 this._destroyIcons(); 5089 5090 this._refresh(); 5091 }, 5092 5093 _processPanels: function() { 5094 var prevHeaders = this.headers, 5095 prevPanels = this.panels; 5096 5097 if ( typeof this.options.header === "function" ) { 5098 this.headers = this.options.header( this.element ); 5099 } else { 5100 this.headers = this.element.find( this.options.header ); 5101 } 5102 this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed", 5103 "ui-state-default" ); 5104 5105 this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide(); 5106 this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" ); 5107 5108 // Avoid memory leaks (#10056) 5109 if ( prevPanels ) { 5110 this._off( prevHeaders.not( this.headers ) ); 5111 this._off( prevPanels.not( this.panels ) ); 5112 } 5113 }, 5114 5115 _refresh: function() { 5116 var maxHeight, 5117 options = this.options, 5118 heightStyle = options.heightStyle, 5119 parent = this.element.parent(); 5120 5121 this.active = this._findActive( options.active ); 5122 this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" ) 5123 ._removeClass( this.active, "ui-accordion-header-collapsed" ); 5124 this._addClass( this.active.next(), "ui-accordion-content-active" ); 5125 this.active.next().show(); 5126 5127 this.headers 5128 .attr( "role", "tab" ) 5129 .each( function() { 5130 var header = $( this ), 5131 headerId = header.uniqueId().attr( "id" ), 5132 panel = header.next(), 5133 panelId = panel.uniqueId().attr( "id" ); 5134 header.attr( "aria-controls", panelId ); 5135 panel.attr( "aria-labelledby", headerId ); 5136 } ) 5137 .next() 5138 .attr( "role", "tabpanel" ); 5139 5140 this.headers 5141 .not( this.active ) 5142 .attr( { 5143 "aria-selected": "false", 5144 "aria-expanded": "false", 5145 tabIndex: -1 5146 } ) 5147 .next() 5148 .attr( { 5149 "aria-hidden": "true" 5150 } ) 5151 .hide(); 5152 5153 // Make sure at least one header is in the tab order 5154 if ( !this.active.length ) { 5155 this.headers.eq( 0 ).attr( "tabIndex", 0 ); 5156 } else { 5157 this.active.attr( { 5158 "aria-selected": "true", 5159 "aria-expanded": "true", 5160 tabIndex: 0 5161 } ) 5162 .next() 5163 .attr( { 5164 "aria-hidden": "false" 5165 } ); 5166 } 5167 5168 this._createIcons(); 5169 5170 this._setupEvents( options.event ); 5171 5172 if ( heightStyle === "fill" ) { 5173 maxHeight = parent.height(); 5174 this.element.siblings( ":visible" ).each( function() { 5175 var elem = $( this ), 5176 position = elem.css( "position" ); 5177 5178 if ( position === "absolute" || position === "fixed" ) { 5179 return; 5180 } 5181 maxHeight -= elem.outerHeight( true ); 5182 } ); 5183 5184 this.headers.each( function() { 5185 maxHeight -= $( this ).outerHeight( true ); 5186 } ); 5187 5188 this.headers.next() 5189 .each( function() { 5190 $( this ).height( Math.max( 0, maxHeight - 5191 $( this ).innerHeight() + $( this ).height() ) ); 5192 } ) 5193 .css( "overflow", "auto" ); 5194 } else if ( heightStyle === "auto" ) { 5195 maxHeight = 0; 5196 this.headers.next() 5197 .each( function() { 5198 var isVisible = $( this ).is( ":visible" ); 5199 if ( !isVisible ) { 5200 $( this ).show(); 5201 } 5202 maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); 5203 if ( !isVisible ) { 5204 $( this ).hide(); 5205 } 5206 } ) 5207 .height( maxHeight ); 5208 } 5209 }, 5210 5211 _activate: function( index ) { 5212 var active = this._findActive( index )[ 0 ]; 5213 5214 // Trying to activate the already active panel 5215 if ( active === this.active[ 0 ] ) { 5216 return; 5217 } 5218 5219 // Trying to collapse, simulate a click on the currently active header 5220 active = active || this.active[ 0 ]; 5221 5222 this._eventHandler( { 5223 target: active, 5224 currentTarget: active, 5225 preventDefault: $.noop 5226 } ); 5227 }, 5228 5229 _findActive: function( selector ) { 5230 return typeof selector === "number" ? this.headers.eq( selector ) : $(); 5231 }, 5232 5233 _setupEvents: function( event ) { 5234 var events = { 5235 keydown: "_keydown" 5236 }; 5237 if ( event ) { 5238 $.each( event.split( " " ), function( index, eventName ) { 5239 events[ eventName ] = "_eventHandler"; 5240 } ); 5241 } 5242 5243 this._off( this.headers.add( this.headers.next() ) ); 5244 this._on( this.headers, events ); 5245 this._on( this.headers.next(), { keydown: "_panelKeyDown" } ); 5246 this._hoverable( this.headers ); 5247 this._focusable( this.headers ); 5248 }, 5249 5250 _eventHandler: function( event ) { 5251 var activeChildren, clickedChildren, 5252 options = this.options, 5253 active = this.active, 5254 clicked = $( event.currentTarget ), 5255 clickedIsActive = clicked[ 0 ] === active[ 0 ], 5256 collapsing = clickedIsActive && options.collapsible, 5257 toShow = collapsing ? $() : clicked.next(), 5258 toHide = active.next(), 5259 eventData = { 5260 oldHeader: active, 5261 oldPanel: toHide, 5262 newHeader: collapsing ? $() : clicked, 5263 newPanel: toShow 5264 }; 5265 5266 event.preventDefault(); 5267 5268 if ( 5269 5270 // click on active header, but not collapsible 5271 ( clickedIsActive && !options.collapsible ) || 5272 5273 // allow canceling activation 5274 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 5275 return; 5276 } 5277 5278 options.active = collapsing ? false : this.headers.index( clicked ); 5279 5280 // When the call to ._toggle() comes after the class changes 5281 // it causes a very odd bug in IE 8 (see #6720) 5282 this.active = clickedIsActive ? $() : clicked; 5283 this._toggle( eventData ); 5284 5285 // Switch classes 5286 // corner classes on the previously active header stay after the animation 5287 this._removeClass( active, "ui-accordion-header-active", "ui-state-active" ); 5288 if ( options.icons ) { 5289 activeChildren = active.children( ".ui-accordion-header-icon" ); 5290 this._removeClass( activeChildren, null, options.icons.activeHeader ) 5291 ._addClass( activeChildren, null, options.icons.header ); 5292 } 5293 5294 if ( !clickedIsActive ) { 5295 this._removeClass( clicked, "ui-accordion-header-collapsed" ) 5296 ._addClass( clicked, "ui-accordion-header-active", "ui-state-active" ); 5297 if ( options.icons ) { 5298 clickedChildren = clicked.children( ".ui-accordion-header-icon" ); 5299 this._removeClass( clickedChildren, null, options.icons.header ) 5300 ._addClass( clickedChildren, null, options.icons.activeHeader ); 5301 } 5302 5303 this._addClass( clicked.next(), "ui-accordion-content-active" ); 5304 } 5305 }, 5306 5307 _toggle: function( data ) { 5308 var toShow = data.newPanel, 5309 toHide = this.prevShow.length ? this.prevShow : data.oldPanel; 5310 5311 // Handle activating a panel during the animation for another activation 5312 this.prevShow.add( this.prevHide ).stop( true, true ); 5313 this.prevShow = toShow; 5314 this.prevHide = toHide; 5315 5316 if ( this.options.animate ) { 5317 this._animate( toShow, toHide, data ); 5318 } else { 5319 toHide.hide(); 5320 toShow.show(); 5321 this._toggleComplete( data ); 5322 } 5323 5324 toHide.attr( { 5325 "aria-hidden": "true" 5326 } ); 5327 toHide.prev().attr( { 5328 "aria-selected": "false", 5329 "aria-expanded": "false" 5330 } ); 5331 5332 // if we're switching panels, remove the old header from the tab order 5333 // if we're opening from collapsed state, remove the previous header from the tab order 5334 // if we're collapsing, then keep the collapsing header in the tab order 5335 if ( toShow.length && toHide.length ) { 5336 toHide.prev().attr( { 5337 "tabIndex": -1, 5338 "aria-expanded": "false" 5339 } ); 5340 } else if ( toShow.length ) { 5341 this.headers.filter( function() { 5342 return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0; 5343 } ) 5344 .attr( "tabIndex", -1 ); 5345 } 5346 5347 toShow 5348 .attr( "aria-hidden", "false" ) 5349 .prev() 5350 .attr( { 5351 "aria-selected": "true", 5352 "aria-expanded": "true", 5353 tabIndex: 0 5354 } ); 5355 }, 5356 5357 _animate: function( toShow, toHide, data ) { 5358 var total, easing, duration, 5359 that = this, 5360 adjust = 0, 5361 boxSizing = toShow.css( "box-sizing" ), 5362 down = toShow.length && 5363 ( !toHide.length || ( toShow.index() < toHide.index() ) ), 5364 animate = this.options.animate || {}, 5365 options = down && animate.down || animate, 5366 complete = function() { 5367 that._toggleComplete( data ); 5368 }; 5369 5370 if ( typeof options === "number" ) { 5371 duration = options; 5372 } 5373 if ( typeof options === "string" ) { 5374 easing = options; 5375 } 5376 5377 // fall back from options to animation in case of partial down settings 5378 easing = easing || options.easing || animate.easing; 5379 duration = duration || options.duration || animate.duration; 5380 5381 if ( !toHide.length ) { 5382 return toShow.animate( this.showProps, duration, easing, complete ); 5383 } 5384 if ( !toShow.length ) { 5385 return toHide.animate( this.hideProps, duration, easing, complete ); 5386 } 5387 5388 total = toShow.show().outerHeight(); 5389 toHide.animate( this.hideProps, { 5390 duration: duration, 5391 easing: easing, 5392 step: function( now, fx ) { 5393 fx.now = Math.round( now ); 5394 } 5395 } ); 5396 toShow 5397 .hide() 5398 .animate( this.showProps, { 5399 duration: duration, 5400 easing: easing, 5401 complete: complete, 5402 step: function( now, fx ) { 5403 fx.now = Math.round( now ); 5404 if ( fx.prop !== "height" ) { 5405 if ( boxSizing === "content-box" ) { 5406 adjust += fx.now; 5407 } 5408 } else if ( that.options.heightStyle !== "content" ) { 5409 fx.now = Math.round( total - toHide.outerHeight() - adjust ); 5410 adjust = 0; 5411 } 5412 } 5413 } ); 5414 }, 5415 5416 _toggleComplete: function( data ) { 5417 var toHide = data.oldPanel, 5418 prev = toHide.prev(); 5419 5420 this._removeClass( toHide, "ui-accordion-content-active" ); 5421 this._removeClass( prev, "ui-accordion-header-active" ) 5422 ._addClass( prev, "ui-accordion-header-collapsed" ); 5423 5424 // Work around for rendering bug in IE (#5421) 5425 if ( toHide.length ) { 5426 toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className; 5427 } 5428 this._trigger( "activate", null, data ); 5429 } 5430} ); 5431 5432 5433 5434var safeActiveElement = $.ui.safeActiveElement = function( document ) { 5435 var activeElement; 5436 5437 // Support: IE 9 only 5438 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> 5439 try { 5440 activeElement = document.activeElement; 5441 } catch ( error ) { 5442 activeElement = document.body; 5443 } 5444 5445 // Support: IE 9 - 11 only 5446 // IE may return null instead of an element 5447 // Interestingly, this only seems to occur when NOT in an iframe 5448 if ( !activeElement ) { 5449 activeElement = document.body; 5450 } 5451 5452 // Support: IE 11 only 5453 // IE11 returns a seemingly empty object in some cases when accessing 5454 // document.activeElement from an <iframe> 5455 if ( !activeElement.nodeName ) { 5456 activeElement = document.body; 5457 } 5458 5459 return activeElement; 5460}; 5461 5462 5463/*! 5464 * jQuery UI Menu 1.13.2 5465 * http://jqueryui.com 5466 * 5467 * Copyright jQuery Foundation and other contributors 5468 * Released under the MIT license. 5469 * http://jquery.org/license 5470 */ 5471 5472//>>label: Menu 5473//>>group: Widgets 5474//>>description: Creates nestable menus. 5475//>>docs: http://api.jqueryui.com/menu/ 5476//>>demos: http://jqueryui.com/menu/ 5477//>>css.structure: ../../themes/base/core.css 5478//>>css.structure: ../../themes/base/menu.css 5479//>>css.theme: ../../themes/base/theme.css 5480 5481 5482var widgetsMenu = $.widget( "ui.menu", { 5483 version: "1.13.2", 5484 defaultElement: "<ul>", 5485 delay: 300, 5486 options: { 5487 icons: { 5488 submenu: "ui-icon-caret-1-e" 5489 }, 5490 items: "> *", 5491 menus: "ul", 5492 position: { 5493 my: "left top", 5494 at: "right top" 5495 }, 5496 role: "menu", 5497 5498 // Callbacks 5499 blur: null, 5500 focus: null, 5501 select: null 5502 }, 5503 5504 _create: function() { 5505 this.activeMenu = this.element; 5506 5507 // Flag used to prevent firing of the click handler 5508 // as the event bubbles up through nested menus 5509 this.mouseHandled = false; 5510 this.lastMousePosition = { x: null, y: null }; 5511 this.element 5512 .uniqueId() 5513 .attr( { 5514 role: this.options.role, 5515 tabIndex: 0 5516 } ); 5517 5518 this._addClass( "ui-menu", "ui-widget ui-widget-content" ); 5519 this._on( { 5520 5521 // Prevent focus from sticking to links inside menu after clicking 5522 // them (focus should always stay on UL during navigation). 5523 "mousedown .ui-menu-item": function( event ) { 5524 event.preventDefault(); 5525 5526 this._activateItem( event ); 5527 }, 5528 "click .ui-menu-item": function( event ) { 5529 var target = $( event.target ); 5530 var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) ); 5531 if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) { 5532 this.select( event ); 5533 5534 // Only set the mouseHandled flag if the event will bubble, see #9469. 5535 if ( !event.isPropagationStopped() ) { 5536 this.mouseHandled = true; 5537 } 5538 5539 // Open submenu on click 5540 if ( target.has( ".ui-menu" ).length ) { 5541 this.expand( event ); 5542 } else if ( !this.element.is( ":focus" ) && 5543 active.closest( ".ui-menu" ).length ) { 5544 5545 // Redirect focus to the menu 5546 this.element.trigger( "focus", [ true ] ); 5547 5548 // If the active item is on the top level, let it stay active. 5549 // Otherwise, blur the active item since it is no longer visible. 5550 if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) { 5551 clearTimeout( this.timer ); 5552 } 5553 } 5554 } 5555 }, 5556 "mouseenter .ui-menu-item": "_activateItem", 5557 "mousemove .ui-menu-item": "_activateItem", 5558 mouseleave: "collapseAll", 5559 "mouseleave .ui-menu": "collapseAll", 5560 focus: function( event, keepActiveItem ) { 5561 5562 // If there's already an active item, keep it active 5563 // If not, activate the first item 5564 var item = this.active || this._menuItems().first(); 5565 5566 if ( !keepActiveItem ) { 5567 this.focus( event, item ); 5568 } 5569 }, 5570 blur: function( event ) { 5571 this._delay( function() { 5572 var notContained = !$.contains( 5573 this.element[ 0 ], 5574 $.ui.safeActiveElement( this.document[ 0 ] ) 5575 ); 5576 if ( notContained ) { 5577 this.collapseAll( event ); 5578 } 5579 } ); 5580 }, 5581 keydown: "_keydown" 5582 } ); 5583 5584 this.refresh(); 5585 5586 // Clicks outside of a menu collapse any open menus 5587 this._on( this.document, { 5588 click: function( event ) { 5589 if ( this._closeOnDocumentClick( event ) ) { 5590 this.collapseAll( event, true ); 5591 } 5592 5593 // Reset the mouseHandled flag 5594 this.mouseHandled = false; 5595 } 5596 } ); 5597 }, 5598 5599 _activateItem: function( event ) { 5600 5601 // Ignore mouse events while typeahead is active, see #10458. 5602 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse 5603 // is over an item in the menu 5604 if ( this.previousFilter ) { 5605 return; 5606 } 5607 5608 // If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356) 5609 if ( event.clientX === this.lastMousePosition.x && 5610 event.clientY === this.lastMousePosition.y ) { 5611 return; 5612 } 5613 5614 this.lastMousePosition = { 5615 x: event.clientX, 5616 y: event.clientY 5617 }; 5618 5619 var actualTarget = $( event.target ).closest( ".ui-menu-item" ), 5620 target = $( event.currentTarget ); 5621 5622 // Ignore bubbled events on parent items, see #11641 5623 if ( actualTarget[ 0 ] !== target[ 0 ] ) { 5624 return; 5625 } 5626 5627 // If the item is already active, there's nothing to do 5628 if ( target.is( ".ui-state-active" ) ) { 5629 return; 5630 } 5631 5632 // Remove ui-state-active class from siblings of the newly focused menu item 5633 // to avoid a jump caused by adjacent elements both having a class with a border 5634 this._removeClass( target.siblings().children( ".ui-state-active" ), 5635 null, "ui-state-active" ); 5636 this.focus( event, target ); 5637 }, 5638 5639 _destroy: function() { 5640 var items = this.element.find( ".ui-menu-item" ) 5641 .removeAttr( "role aria-disabled" ), 5642 submenus = items.children( ".ui-menu-item-wrapper" ) 5643 .removeUniqueId() 5644 .removeAttr( "tabIndex role aria-haspopup" ); 5645 5646 // Destroy (sub)menus 5647 this.element 5648 .removeAttr( "aria-activedescendant" ) 5649 .find( ".ui-menu" ).addBack() 5650 .removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " + 5651 "tabIndex" ) 5652 .removeUniqueId() 5653 .show(); 5654 5655 submenus.children().each( function() { 5656 var elem = $( this ); 5657 if ( elem.data( "ui-menu-submenu-caret" ) ) { 5658 elem.remove(); 5659 } 5660 } ); 5661 }, 5662 5663 _keydown: function( event ) { 5664 var match, prev, character, skip, 5665 preventDefault = true; 5666 5667 switch ( event.keyCode ) { 5668 case $.ui.keyCode.PAGE_UP: 5669 this.previousPage( event ); 5670 break; 5671 case $.ui.keyCode.PAGE_DOWN: 5672 this.nextPage( event ); 5673 break; 5674 case $.ui.keyCode.HOME: 5675 this._move( "first", "first", event ); 5676 break; 5677 case $.ui.keyCode.END: 5678 this._move( "last", "last", event ); 5679 break; 5680 case $.ui.keyCode.UP: 5681 this.previous( event ); 5682 break; 5683 case $.ui.keyCode.DOWN: 5684 this.next( event ); 5685 break; 5686 case $.ui.keyCode.LEFT: 5687 this.collapse( event ); 5688 break; 5689 case $.ui.keyCode.RIGHT: 5690 if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { 5691 this.expand( event ); 5692 } 5693 break; 5694 case $.ui.keyCode.ENTER: 5695 case $.ui.keyCode.SPACE: 5696 this._activate( event ); 5697 break; 5698 case $.ui.keyCode.ESCAPE: 5699 this.collapse( event ); 5700 break; 5701 default: 5702 preventDefault = false; 5703 prev = this.previousFilter || ""; 5704 skip = false; 5705 5706 // Support number pad values 5707 character = event.keyCode >= 96 && event.keyCode <= 105 ? 5708 ( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode ); 5709 5710 clearTimeout( this.filterTimer ); 5711 5712 if ( character === prev ) { 5713 skip = true; 5714 } else { 5715 character = prev + character; 5716 } 5717 5718 match = this._filterMenuItems( character ); 5719 match = skip && match.index( this.active.next() ) !== -1 ? 5720 this.active.nextAll( ".ui-menu-item" ) : 5721 match; 5722 5723 // If no matches on the current filter, reset to the last character pressed 5724 // to move down the menu to the first item that starts with that character 5725 if ( !match.length ) { 5726 character = String.fromCharCode( event.keyCode ); 5727 match = this._filterMenuItems( character ); 5728 } 5729 5730 if ( match.length ) { 5731 this.focus( event, match ); 5732 this.previousFilter = character; 5733 this.filterTimer = this._delay( function() { 5734 delete this.previousFilter; 5735 }, 1000 ); 5736 } else { 5737 delete this.previousFilter; 5738 } 5739 } 5740 5741 if ( preventDefault ) { 5742 event.preventDefault(); 5743 } 5744 }, 5745 5746 _activate: function( event ) { 5747 if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { 5748 if ( this.active.children( "[aria-haspopup='true']" ).length ) { 5749 this.expand( event ); 5750 } else { 5751 this.select( event ); 5752 } 5753 } 5754 }, 5755 5756 refresh: function() { 5757 var menus, items, newSubmenus, newItems, newWrappers, 5758 that = this, 5759 icon = this.options.icons.submenu, 5760 submenus = this.element.find( this.options.menus ); 5761 5762 this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length ); 5763 5764 // Initialize nested menus 5765 newSubmenus = submenus.filter( ":not(.ui-menu)" ) 5766 .hide() 5767 .attr( { 5768 role: this.options.role, 5769 "aria-hidden": "true", 5770 "aria-expanded": "false" 5771 } ) 5772 .each( function() { 5773 var menu = $( this ), 5774 item = menu.prev(), 5775 submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true ); 5776 5777 that._addClass( submenuCaret, "ui-menu-icon", "ui-icon " + icon ); 5778 item 5779 .attr( "aria-haspopup", "true" ) 5780 .prepend( submenuCaret ); 5781 menu.attr( "aria-labelledby", item.attr( "id" ) ); 5782 } ); 5783 5784 this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" ); 5785 5786 menus = submenus.add( this.element ); 5787 items = menus.find( this.options.items ); 5788 5789 // Initialize menu-items containing spaces and/or dashes only as dividers 5790 items.not( ".ui-menu-item" ).each( function() { 5791 var item = $( this ); 5792 if ( that._isDivider( item ) ) { 5793 that._addClass( item, "ui-menu-divider", "ui-widget-content" ); 5794 } 5795 } ); 5796 5797 // Don't refresh list items that are already adapted 5798 newItems = items.not( ".ui-menu-item, .ui-menu-divider" ); 5799 newWrappers = newItems.children() 5800 .not( ".ui-menu" ) 5801 .uniqueId() 5802 .attr( { 5803 tabIndex: -1, 5804 role: this._itemRole() 5805 } ); 5806 this._addClass( newItems, "ui-menu-item" ) 5807 ._addClass( newWrappers, "ui-menu-item-wrapper" ); 5808 5809 // Add aria-disabled attribute to any disabled menu item 5810 items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); 5811 5812 // If the active item has been removed, blur the menu 5813 if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { 5814 this.blur(); 5815 } 5816 }, 5817 5818 _itemRole: function() { 5819 return { 5820 menu: "menuitem", 5821 listbox: "option" 5822 }[ this.options.role ]; 5823 }, 5824 5825 _setOption: function( key, value ) { 5826 if ( key === "icons" ) { 5827 var icons = this.element.find( ".ui-menu-icon" ); 5828 this._removeClass( icons, null, this.options.icons.submenu ) 5829 ._addClass( icons, null, value.submenu ); 5830 } 5831 this._super( key, value ); 5832 }, 5833 5834 _setOptionDisabled: function( value ) { 5835 this._super( value ); 5836 5837 this.element.attr( "aria-disabled", String( value ) ); 5838 this._toggleClass( null, "ui-state-disabled", !!value ); 5839 }, 5840 5841 focus: function( event, item ) { 5842 var nested, focused, activeParent; 5843 this.blur( event, event && event.type === "focus" ); 5844 5845 this._scrollIntoView( item ); 5846 5847 this.active = item.first(); 5848 5849 focused = this.active.children( ".ui-menu-item-wrapper" ); 5850 this._addClass( focused, null, "ui-state-active" ); 5851 5852 // Only update aria-activedescendant if there's a role 5853 // otherwise we assume focus is managed elsewhere 5854 if ( this.options.role ) { 5855 this.element.attr( "aria-activedescendant", focused.attr( "id" ) ); 5856 } 5857 5858 // Highlight active parent menu item, if any 5859 activeParent = this.active 5860 .parent() 5861 .closest( ".ui-menu-item" ) 5862 .children( ".ui-menu-item-wrapper" ); 5863 this._addClass( activeParent, null, "ui-state-active" ); 5864 5865 if ( event && event.type === "keydown" ) { 5866 this._close(); 5867 } else { 5868 this.timer = this._delay( function() { 5869 this._close(); 5870 }, this.delay ); 5871 } 5872 5873 nested = item.children( ".ui-menu" ); 5874 if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) { 5875 this._startOpening( nested ); 5876 } 5877 this.activeMenu = item.parent(); 5878 5879 this._trigger( "focus", event, { item: item } ); 5880 }, 5881 5882 _scrollIntoView: function( item ) { 5883 var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; 5884 if ( this._hasScroll() ) { 5885 borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0; 5886 paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0; 5887 offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; 5888 scroll = this.activeMenu.scrollTop(); 5889 elementHeight = this.activeMenu.height(); 5890 itemHeight = item.outerHeight(); 5891 5892 if ( offset < 0 ) { 5893 this.activeMenu.scrollTop( scroll + offset ); 5894 } else if ( offset + itemHeight > elementHeight ) { 5895 this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight ); 5896 } 5897 } 5898 }, 5899 5900 blur: function( event, fromFocus ) { 5901 if ( !fromFocus ) { 5902 clearTimeout( this.timer ); 5903 } 5904 5905 if ( !this.active ) { 5906 return; 5907 } 5908 5909 this._removeClass( this.active.children( ".ui-menu-item-wrapper" ), 5910 null, "ui-state-active" ); 5911 5912 this._trigger( "blur", event, { item: this.active } ); 5913 this.active = null; 5914 }, 5915 5916 _startOpening: function( submenu ) { 5917 clearTimeout( this.timer ); 5918 5919 // Don't open if already open fixes a Firefox bug that caused a .5 pixel 5920 // shift in the submenu position when mousing over the caret icon 5921 if ( submenu.attr( "aria-hidden" ) !== "true" ) { 5922 return; 5923 } 5924 5925 this.timer = this._delay( function() { 5926 this._close(); 5927 this._open( submenu ); 5928 }, this.delay ); 5929 }, 5930 5931 _open: function( submenu ) { 5932 var position = $.extend( { 5933 of: this.active 5934 }, this.options.position ); 5935 5936 clearTimeout( this.timer ); 5937 this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) ) 5938 .hide() 5939 .attr( "aria-hidden", "true" ); 5940 5941 submenu 5942 .show() 5943 .removeAttr( "aria-hidden" ) 5944 .attr( "aria-expanded", "true" ) 5945 .position( position ); 5946 }, 5947 5948 collapseAll: function( event, all ) { 5949 clearTimeout( this.timer ); 5950 this.timer = this._delay( function() { 5951 5952 // If we were passed an event, look for the submenu that contains the event 5953 var currentMenu = all ? this.element : 5954 $( event && event.target ).closest( this.element.find( ".ui-menu" ) ); 5955 5956 // If we found no valid submenu ancestor, use the main menu to close all 5957 // sub menus anyway 5958 if ( !currentMenu.length ) { 5959 currentMenu = this.element; 5960 } 5961 5962 this._close( currentMenu ); 5963 5964 this.blur( event ); 5965 5966 // Work around active item staying active after menu is blurred 5967 this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" ); 5968 5969 this.activeMenu = currentMenu; 5970 }, all ? 0 : this.delay ); 5971 }, 5972 5973 // With no arguments, closes the currently active menu - if nothing is active 5974 // it closes all menus. If passed an argument, it will search for menus BELOW 5975 _close: function( startMenu ) { 5976 if ( !startMenu ) { 5977 startMenu = this.active ? this.active.parent() : this.element; 5978 } 5979 5980 startMenu.find( ".ui-menu" ) 5981 .hide() 5982 .attr( "aria-hidden", "true" ) 5983 .attr( "aria-expanded", "false" ); 5984 }, 5985 5986 _closeOnDocumentClick: function( event ) { 5987 return !$( event.target ).closest( ".ui-menu" ).length; 5988 }, 5989 5990 _isDivider: function( item ) { 5991 5992 // Match hyphen, em dash, en dash 5993 return !/[^\-\u2014\u2013\s]/.test( item.text() ); 5994 }, 5995 5996 collapse: function( event ) { 5997 var newItem = this.active && 5998 this.active.parent().closest( ".ui-menu-item", this.element ); 5999 if ( newItem && newItem.length ) { 6000 this._close(); 6001 this.focus( event, newItem ); 6002 } 6003 }, 6004 6005 expand: function( event ) { 6006 var newItem = this.active && this._menuItems( this.active.children( ".ui-menu" ) ).first(); 6007 6008 if ( newItem && newItem.length ) { 6009 this._open( newItem.parent() ); 6010 6011 // Delay so Firefox will not hide activedescendant change in expanding submenu from AT 6012 this._delay( function() { 6013 this.focus( event, newItem ); 6014 } ); 6015 } 6016 }, 6017 6018 next: function( event ) { 6019 this._move( "next", "first", event ); 6020 }, 6021 6022 previous: function( event ) { 6023 this._move( "prev", "last", event ); 6024 }, 6025 6026 isFirstItem: function() { 6027 return this.active && !this.active.prevAll( ".ui-menu-item" ).length; 6028 }, 6029 6030 isLastItem: function() { 6031 return this.active && !this.active.nextAll( ".ui-menu-item" ).length; 6032 }, 6033 6034 _menuItems: function( menu ) { 6035 return ( menu || this.element ) 6036 .find( this.options.items ) 6037 .filter( ".ui-menu-item" ); 6038 }, 6039 6040 _move: function( direction, filter, event ) { 6041 var next; 6042 if ( this.active ) { 6043 if ( direction === "first" || direction === "last" ) { 6044 next = this.active 6045 [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ) 6046 .last(); 6047 } else { 6048 next = this.active 6049 [ direction + "All" ]( ".ui-menu-item" ) 6050 .first(); 6051 } 6052 } 6053 if ( !next || !next.length || !this.active ) { 6054 next = this._menuItems( this.activeMenu )[ filter ](); 6055 } 6056 6057 this.focus( event, next ); 6058 }, 6059 6060 nextPage: function( event ) { 6061 var item, base, height; 6062 6063 if ( !this.active ) { 6064 this.next( event ); 6065 return; 6066 } 6067 if ( this.isLastItem() ) { 6068 return; 6069 } 6070 if ( this._hasScroll() ) { 6071 base = this.active.offset().top; 6072 height = this.element.innerHeight(); 6073 6074 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 6075 if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) { 6076 height += this.element[ 0 ].offsetHeight - this.element.outerHeight(); 6077 } 6078 6079 this.active.nextAll( ".ui-menu-item" ).each( function() { 6080 item = $( this ); 6081 return item.offset().top - base - height < 0; 6082 } ); 6083 6084 this.focus( event, item ); 6085 } else { 6086 this.focus( event, this._menuItems( this.activeMenu ) 6087 [ !this.active ? "first" : "last" ]() ); 6088 } 6089 }, 6090 6091 previousPage: function( event ) { 6092 var item, base, height; 6093 if ( !this.active ) { 6094 this.next( event ); 6095 return; 6096 } 6097 if ( this.isFirstItem() ) { 6098 return; 6099 } 6100 if ( this._hasScroll() ) { 6101 base = this.active.offset().top; 6102 height = this.element.innerHeight(); 6103 6104 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 6105 if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) { 6106 height += this.element[ 0 ].offsetHeight - this.element.outerHeight(); 6107 } 6108 6109 this.active.prevAll( ".ui-menu-item" ).each( function() { 6110 item = $( this ); 6111 return item.offset().top - base + height > 0; 6112 } ); 6113 6114 this.focus( event, item ); 6115 } else { 6116 this.focus( event, this._menuItems( this.activeMenu ).first() ); 6117 } 6118 }, 6119 6120 _hasScroll: function() { 6121 return this.element.outerHeight() < this.element.prop( "scrollHeight" ); 6122 }, 6123 6124 select: function( event ) { 6125 6126 // TODO: It should never be possible to not have an active item at this 6127 // point, but the tests don't trigger mouseenter before click. 6128 this.active = this.active || $( event.target ).closest( ".ui-menu-item" ); 6129 var ui = { item: this.active }; 6130 if ( !this.active.has( ".ui-menu" ).length ) { 6131 this.collapseAll( event, true ); 6132 } 6133 this._trigger( "select", event, ui ); 6134 }, 6135 6136 _filterMenuItems: function( character ) { 6137 var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ), 6138 regex = new RegExp( "^" + escapedCharacter, "i" ); 6139 6140 return this.activeMenu 6141 .find( this.options.items ) 6142 6143 // Only match on items, not dividers or other content (#10571) 6144 .filter( ".ui-menu-item" ) 6145 .filter( function() { 6146 return regex.test( 6147 String.prototype.trim.call( 6148 $( this ).children( ".ui-menu-item-wrapper" ).text() ) ); 6149 } ); 6150 } 6151} ); 6152 6153 6154/*! 6155 * jQuery UI Autocomplete 1.13.2 6156 * http://jqueryui.com 6157 * 6158 * Copyright jQuery Foundation and other contributors 6159 * Released under the MIT license. 6160 * http://jquery.org/license 6161 */ 6162 6163//>>label: Autocomplete 6164//>>group: Widgets 6165//>>description: Lists suggested words as the user is typing. 6166//>>docs: http://api.jqueryui.com/autocomplete/ 6167//>>demos: http://jqueryui.com/autocomplete/ 6168//>>css.structure: ../../themes/base/core.css 6169//>>css.structure: ../../themes/base/autocomplete.css 6170//>>css.theme: ../../themes/base/theme.css 6171 6172 6173$.widget( "ui.autocomplete", { 6174 version: "1.13.2", 6175 defaultElement: "<input>", 6176 options: { 6177 appendTo: null, 6178 autoFocus: false, 6179 delay: 300, 6180 minLength: 1, 6181 position: { 6182 my: "left top", 6183 at: "left bottom", 6184 collision: "none" 6185 }, 6186 source: null, 6187 6188 // Callbacks 6189 change: null, 6190 close: null, 6191 focus: null, 6192 open: null, 6193 response: null, 6194 search: null, 6195 select: null 6196 }, 6197 6198 requestIndex: 0, 6199 pending: 0, 6200 liveRegionTimer: null, 6201 6202 _create: function() { 6203 6204 // Some browsers only repeat keydown events, not keypress events, 6205 // so we use the suppressKeyPress flag to determine if we've already 6206 // handled the keydown event. #7269 6207 // Unfortunately the code for & in keypress is the same as the up arrow, 6208 // so we use the suppressKeyPressRepeat flag to avoid handling keypress 6209 // events when we know the keydown event was used to modify the 6210 // search term. #7799 6211 var suppressKeyPress, suppressKeyPressRepeat, suppressInput, 6212 nodeName = this.element[ 0 ].nodeName.toLowerCase(), 6213 isTextarea = nodeName === "textarea", 6214 isInput = nodeName === "input"; 6215 6216 // Textareas are always multi-line 6217 // Inputs are always single-line, even if inside a contentEditable element 6218 // IE also treats inputs as contentEditable 6219 // All other element types are determined by whether or not they're contentEditable 6220 this.isMultiLine = isTextarea || !isInput && this._isContentEditable( this.element ); 6221 6222 this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ]; 6223 this.isNewMenu = true; 6224 6225 this._addClass( "ui-autocomplete-input" ); 6226 this.element.attr( "autocomplete", "off" ); 6227 6228 this._on( this.element, { 6229 keydown: function( event ) { 6230 if ( this.element.prop( "readOnly" ) ) { 6231 suppressKeyPress = true; 6232 suppressInput = true; 6233 suppressKeyPressRepeat = true; 6234 return; 6235 } 6236 6237 suppressKeyPress = false; 6238 suppressInput = false; 6239 suppressKeyPressRepeat = false; 6240 var keyCode = $.ui.keyCode; 6241 switch ( event.keyCode ) { 6242 case keyCode.PAGE_UP: 6243 suppressKeyPress = true; 6244 this._move( "previousPage", event ); 6245 break; 6246 case keyCode.PAGE_DOWN: 6247 suppressKeyPress = true; 6248 this._move( "nextPage", event ); 6249 break; 6250 case keyCode.UP: 6251 suppressKeyPress = true; 6252 this._keyEvent( "previous", event ); 6253 break; 6254 case keyCode.DOWN: 6255 suppressKeyPress = true; 6256 this._keyEvent( "next", event ); 6257 break; 6258 case keyCode.ENTER: 6259 6260 // when menu is open and has focus 6261 if ( this.menu.active ) { 6262 6263 // #6055 - Opera still allows the keypress to occur 6264 // which causes forms to submit 6265 suppressKeyPress = true; 6266 event.preventDefault(); 6267 this.menu.select( event ); 6268 } 6269 break; 6270 case keyCode.TAB: 6271 if ( this.menu.active ) { 6272 this.menu.select( event ); 6273 } 6274 break; 6275 case keyCode.ESCAPE: 6276 if ( this.menu.element.is( ":visible" ) ) { 6277 if ( !this.isMultiLine ) { 6278 this._value( this.term ); 6279 } 6280 this.close( event ); 6281 6282 // Different browsers have different default behavior for escape 6283 // Single press can mean undo or clear 6284 // Double press in IE means clear the whole form 6285 event.preventDefault(); 6286 } 6287 break; 6288 default: 6289 suppressKeyPressRepeat = true; 6290 6291 // search timeout should be triggered before the input value is changed 6292 this._searchTimeout( event ); 6293 break; 6294 } 6295 }, 6296 keypress: function( event ) { 6297 if ( suppressKeyPress ) { 6298 suppressKeyPress = false; 6299 if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { 6300 event.preventDefault(); 6301 } 6302 return; 6303 } 6304 if ( suppressKeyPressRepeat ) { 6305 return; 6306 } 6307 6308 // Replicate some key handlers to allow them to repeat in Firefox and Opera 6309 var keyCode = $.ui.keyCode; 6310 switch ( event.keyCode ) { 6311 case keyCode.PAGE_UP: 6312 this._move( "previousPage", event ); 6313 break; 6314 case keyCode.PAGE_DOWN: 6315 this._move( "nextPage", event ); 6316 break; 6317 case keyCode.UP: 6318 this._keyEvent( "previous", event ); 6319 break; 6320 case keyCode.DOWN: 6321 this._keyEvent( "next", event ); 6322 break; 6323 } 6324 }, 6325 input: function( event ) { 6326 if ( suppressInput ) { 6327 suppressInput = false; 6328 event.preventDefault(); 6329 return; 6330 } 6331 this._searchTimeout( event ); 6332 }, 6333 focus: function() { 6334 this.selectedItem = null; 6335 this.previous = this._value(); 6336 }, 6337 blur: function( event ) { 6338 clearTimeout( this.searching ); 6339 this.close( event ); 6340 this._change( event ); 6341 } 6342 } ); 6343 6344 this._initSource(); 6345 this.menu = $( "<ul>" ) 6346 .appendTo( this._appendTo() ) 6347 .menu( { 6348 6349 // disable ARIA support, the live region takes care of that 6350 role: null 6351 } ) 6352 .hide() 6353 6354 // Support: IE 11 only, Edge <= 14 6355 // For other browsers, we preventDefault() on the mousedown event 6356 // to keep the dropdown from taking focus from the input. This doesn't 6357 // work for IE/Edge, causing problems with selection and scrolling (#9638) 6358 // Happily, IE and Edge support an "unselectable" attribute that 6359 // prevents an element from receiving focus, exactly what we want here. 6360 .attr( { 6361 "unselectable": "on" 6362 } ) 6363 .menu( "instance" ); 6364 6365 this._addClass( this.menu.element, "ui-autocomplete", "ui-front" ); 6366 this._on( this.menu.element, { 6367 mousedown: function( event ) { 6368 6369 // Prevent moving focus out of the text field 6370 event.preventDefault(); 6371 }, 6372 menufocus: function( event, ui ) { 6373 var label, item; 6374 6375 // support: Firefox 6376 // Prevent accidental activation of menu items in Firefox (#7024 #9118) 6377 if ( this.isNewMenu ) { 6378 this.isNewMenu = false; 6379 if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) { 6380 this.menu.blur(); 6381 6382 this.document.one( "mousemove", function() { 6383 $( event.target ).trigger( event.originalEvent ); 6384 } ); 6385 6386 return; 6387 } 6388 } 6389 6390 item = ui.item.data( "ui-autocomplete-item" ); 6391 if ( false !== this._trigger( "focus", event, { item: item } ) ) { 6392 6393 // use value to match what will end up in the input, if it was a key event 6394 if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { 6395 this._value( item.value ); 6396 } 6397 } 6398 6399 // Announce the value in the liveRegion 6400 label = ui.item.attr( "aria-label" ) || item.value; 6401 if ( label && String.prototype.trim.call( label ).length ) { 6402 clearTimeout( this.liveRegionTimer ); 6403 this.liveRegionTimer = this._delay( function() { 6404 this.liveRegion.html( $( "<div>" ).text( label ) ); 6405 }, 100 ); 6406 } 6407 }, 6408 menuselect: function( event, ui ) { 6409 var item = ui.item.data( "ui-autocomplete-item" ), 6410 previous = this.previous; 6411 6412 // Only trigger when focus was lost (click on menu) 6413 if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) { 6414 this.element.trigger( "focus" ); 6415 this.previous = previous; 6416 6417 // #6109 - IE triggers two focus events and the second 6418 // is asynchronous, so we need to reset the previous 6419 // term synchronously and asynchronously :-( 6420 this._delay( function() { 6421 this.previous = previous; 6422 this.selectedItem = item; 6423 } ); 6424 } 6425 6426 if ( false !== this._trigger( "select", event, { item: item } ) ) { 6427 this._value( item.value ); 6428 } 6429 6430 // reset the term after the select event 6431 // this allows custom select handling to work properly 6432 this.term = this._value(); 6433 6434 this.close( event ); 6435 this.selectedItem = item; 6436 } 6437 } ); 6438 6439 this.liveRegion = $( "<div>", { 6440 role: "status", 6441 "aria-live": "assertive", 6442 "aria-relevant": "additions" 6443 } ) 6444 .appendTo( this.document[ 0 ].body ); 6445 6446 this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" ); 6447 6448 // Turning off autocomplete prevents the browser from remembering the 6449 // value when navigating through history, so we re-enable autocomplete 6450 // if the page is unloaded before the widget is destroyed. #7790 6451 this._on( this.window, { 6452 beforeunload: function() { 6453 this.element.removeAttr( "autocomplete" ); 6454 } 6455 } ); 6456 }, 6457 6458 _destroy: function() { 6459 clearTimeout( this.searching ); 6460 this.element.removeAttr( "autocomplete" ); 6461 this.menu.element.remove(); 6462 this.liveRegion.remove(); 6463 }, 6464 6465 _setOption: function( key, value ) { 6466 this._super( key, value ); 6467 if ( key === "source" ) { 6468 this._initSource(); 6469 } 6470 if ( key === "appendTo" ) { 6471 this.menu.element.appendTo( this._appendTo() ); 6472 } 6473 if ( key === "disabled" && value && this.xhr ) { 6474 this.xhr.abort(); 6475 } 6476 }, 6477 6478 _isEventTargetInWidget: function( event ) { 6479 var menuElement = this.menu.element[ 0 ]; 6480 6481 return event.target === this.element[ 0 ] || 6482 event.target === menuElement || 6483 $.contains( menuElement, event.target ); 6484 }, 6485 6486 _closeOnClickOutside: function( event ) { 6487 if ( !this._isEventTargetInWidget( event ) ) { 6488 this.close(); 6489 } 6490 }, 6491 6492 _appendTo: function() { 6493 var element = this.options.appendTo; 6494 6495 if ( element ) { 6496 element = element.jquery || element.nodeType ? 6497 $( element ) : 6498 this.document.find( element ).eq( 0 ); 6499 } 6500 6501 if ( !element || !element[ 0 ] ) { 6502 element = this.element.closest( ".ui-front, dialog" ); 6503 } 6504 6505 if ( !element.length ) { 6506 element = this.document[ 0 ].body; 6507 } 6508 6509 return element; 6510 }, 6511 6512 _initSource: function() { 6513 var array, url, 6514 that = this; 6515 if ( Array.isArray( this.options.source ) ) { 6516 array = this.options.source; 6517 this.source = function( request, response ) { 6518 response( $.ui.autocomplete.filter( array, request.term ) ); 6519 }; 6520 } else if ( typeof this.options.source === "string" ) { 6521 url = this.options.source; 6522 this.source = function( request, response ) { 6523 if ( that.xhr ) { 6524 that.xhr.abort(); 6525 } 6526 that.xhr = $.ajax( { 6527 url: url, 6528 data: request, 6529 dataType: "json", 6530 success: function( data ) { 6531 response( data ); 6532 }, 6533 error: function() { 6534 response( [] ); 6535 } 6536 } ); 6537 }; 6538 } else { 6539 this.source = this.options.source; 6540 } 6541 }, 6542 6543 _searchTimeout: function( event ) { 6544 clearTimeout( this.searching ); 6545 this.searching = this._delay( function() { 6546 6547 // Search if the value has changed, or if the user retypes the same value (see #7434) 6548 var equalValues = this.term === this._value(), 6549 menuVisible = this.menu.element.is( ":visible" ), 6550 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 6551 6552 if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) { 6553 this.selectedItem = null; 6554 this.search( null, event ); 6555 } 6556 }, this.options.delay ); 6557 }, 6558 6559 search: function( value, event ) { 6560 value = value != null ? value : this._value(); 6561 6562 // Always save the actual value, not the one passed as an argument 6563 this.term = this._value(); 6564 6565 if ( value.length < this.options.minLength ) { 6566 return this.close( event ); 6567 } 6568 6569 if ( this._trigger( "search", event ) === false ) { 6570 return; 6571 } 6572 6573 return this._search( value ); 6574 }, 6575 6576 _search: function( value ) { 6577 this.pending++; 6578 this._addClass( "ui-autocomplete-loading" ); 6579 this.cancelSearch = false; 6580 6581 this.source( { term: value }, this._response() ); 6582 }, 6583 6584 _response: function() { 6585 var index = ++this.requestIndex; 6586 6587 return function( content ) { 6588 if ( index === this.requestIndex ) { 6589 this.__response( content ); 6590 } 6591 6592 this.pending--; 6593 if ( !this.pending ) { 6594 this._removeClass( "ui-autocomplete-loading" ); 6595 } 6596 }.bind( this ); 6597 }, 6598 6599 __response: function( content ) { 6600 if ( content ) { 6601 content = this._normalize( content ); 6602 } 6603 this._trigger( "response", null, { content: content } ); 6604 if ( !this.options.disabled && content && content.length && !this.cancelSearch ) { 6605 this._suggest( content ); 6606 this._trigger( "open" ); 6607 } else { 6608 6609 // use ._close() instead of .close() so we don't cancel future searches 6610 this._close(); 6611 } 6612 }, 6613 6614 close: function( event ) { 6615 this.cancelSearch = true; 6616 this._close( event ); 6617 }, 6618 6619 _close: function( event ) { 6620 6621 // Remove the handler that closes the menu on outside clicks 6622 this._off( this.document, "mousedown" ); 6623 6624 if ( this.menu.element.is( ":visible" ) ) { 6625 this.menu.element.hide(); 6626 this.menu.blur(); 6627 this.isNewMenu = true; 6628 this._trigger( "close", event ); 6629 } 6630 }, 6631 6632 _change: function( event ) { 6633 if ( this.previous !== this._value() ) { 6634 this._trigger( "change", event, { item: this.selectedItem } ); 6635 } 6636 }, 6637 6638 _normalize: function( items ) { 6639 6640 // assume all items have the right format when the first item is complete 6641 if ( items.length && items[ 0 ].label && items[ 0 ].value ) { 6642 return items; 6643 } 6644 return $.map( items, function( item ) { 6645 if ( typeof item === "string" ) { 6646 return { 6647 label: item, 6648 value: item 6649 }; 6650 } 6651 return $.extend( {}, item, { 6652 label: item.label || item.value, 6653 value: item.value || item.label 6654 } ); 6655 } ); 6656 }, 6657 6658 _suggest: function( items ) { 6659 var ul = this.menu.element.empty(); 6660 this._renderMenu( ul, items ); 6661 this.isNewMenu = true; 6662 this.menu.refresh(); 6663 6664 // Size and position menu 6665 ul.show(); 6666 this._resizeMenu(); 6667 ul.position( $.extend( { 6668 of: this.element 6669 }, this.options.position ) ); 6670 6671 if ( this.options.autoFocus ) { 6672 this.menu.next(); 6673 } 6674 6675 // Listen for interactions outside of the widget (#6642) 6676 this._on( this.document, { 6677 mousedown: "_closeOnClickOutside" 6678 } ); 6679 }, 6680 6681 _resizeMenu: function() { 6682 var ul = this.menu.element; 6683 ul.outerWidth( Math.max( 6684 6685 // Firefox wraps long text (possibly a rounding bug) 6686 // so we add 1px to avoid the wrapping (#7513) 6687 ul.width( "" ).outerWidth() + 1, 6688 this.element.outerWidth() 6689 ) ); 6690 }, 6691 6692 _renderMenu: function( ul, items ) { 6693 var that = this; 6694 $.each( items, function( index, item ) { 6695 that._renderItemData( ul, item ); 6696 } ); 6697 }, 6698 6699 _renderItemData: function( ul, item ) { 6700 return this._renderItem( ul, item ).data( "ui-autocomplete-item", item ); 6701 }, 6702 6703 _renderItem: function( ul, item ) { 6704 return $( "<li>" ) 6705 .append( $( "<div>" ).text( item.label ) ) 6706 .appendTo( ul ); 6707 }, 6708 6709 _move: function( direction, event ) { 6710 if ( !this.menu.element.is( ":visible" ) ) { 6711 this.search( null, event ); 6712 return; 6713 } 6714 if ( this.menu.isFirstItem() && /^previous/.test( direction ) || 6715 this.menu.isLastItem() && /^next/.test( direction ) ) { 6716 6717 if ( !this.isMultiLine ) { 6718 this._value( this.term ); 6719 } 6720 6721 this.menu.blur(); 6722 return; 6723 } 6724 this.menu[ direction ]( event ); 6725 }, 6726 6727 widget: function() { 6728 return this.menu.element; 6729 }, 6730 6731 _value: function() { 6732 return this.valueMethod.apply( this.element, arguments ); 6733 }, 6734 6735 _keyEvent: function( keyEvent, event ) { 6736 if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { 6737 this._move( keyEvent, event ); 6738 6739 // Prevents moving cursor to beginning/end of the text field in some browsers 6740 event.preventDefault(); 6741 } 6742 }, 6743 6744 // Support: Chrome <=50 6745 // We should be able to just use this.element.prop( "isContentEditable" ) 6746 // but hidden elements always report false in Chrome. 6747 // https://code.google.com/p/chromium/issues/detail?id=313082 6748 _isContentEditable: function( element ) { 6749 if ( !element.length ) { 6750 return false; 6751 } 6752 6753 var editable = element.prop( "contentEditable" ); 6754 6755 if ( editable === "inherit" ) { 6756 return this._isContentEditable( element.parent() ); 6757 } 6758 6759 return editable === "true"; 6760 } 6761} ); 6762 6763$.extend( $.ui.autocomplete, { 6764 escapeRegex: function( value ) { 6765 return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ); 6766 }, 6767 filter: function( array, term ) { 6768 var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" ); 6769 return $.grep( array, function( value ) { 6770 return matcher.test( value.label || value.value || value ); 6771 } ); 6772 } 6773} ); 6774 6775// Live region extension, adding a `messages` option 6776// NOTE: This is an experimental API. We are still investigating 6777// a full solution for string manipulation and internationalization. 6778$.widget( "ui.autocomplete", $.ui.autocomplete, { 6779 options: { 6780 messages: { 6781 noResults: "No search results.", 6782 results: function( amount ) { 6783 return amount + ( amount > 1 ? " results are" : " result is" ) + 6784 " available, use up and down arrow keys to navigate."; 6785 } 6786 } 6787 }, 6788 6789 __response: function( content ) { 6790 var message; 6791 this._superApply( arguments ); 6792 if ( this.options.disabled || this.cancelSearch ) { 6793 return; 6794 } 6795 if ( content && content.length ) { 6796 message = this.options.messages.results( content.length ); 6797 } else { 6798 message = this.options.messages.noResults; 6799 } 6800 clearTimeout( this.liveRegionTimer ); 6801 this.liveRegionTimer = this._delay( function() { 6802 this.liveRegion.html( $( "<div>" ).text( message ) ); 6803 }, 100 ); 6804 } 6805} ); 6806 6807var widgetsAutocomplete = $.ui.autocomplete; 6808 6809 6810/*! 6811 * jQuery UI Controlgroup 1.13.2 6812 * http://jqueryui.com 6813 * 6814 * Copyright jQuery Foundation and other contributors 6815 * Released under the MIT license. 6816 * http://jquery.org/license 6817 */ 6818 6819//>>label: Controlgroup 6820//>>group: Widgets 6821//>>description: Visually groups form control widgets 6822//>>docs: http://api.jqueryui.com/controlgroup/ 6823//>>demos: http://jqueryui.com/controlgroup/ 6824//>>css.structure: ../../themes/base/core.css 6825//>>css.structure: ../../themes/base/controlgroup.css 6826//>>css.theme: ../../themes/base/theme.css 6827 6828 6829var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 6830 6831var widgetsControlgroup = $.widget( "ui.controlgroup", { 6832 version: "1.13.2", 6833 defaultElement: "<div>", 6834 options: { 6835 direction: "horizontal", 6836 disabled: null, 6837 onlyVisible: true, 6838 items: { 6839 "button": "input[type=button], input[type=submit], input[type=reset], button, a", 6840 "controlgroupLabel": ".ui-controlgroup-label", 6841 "checkboxradio": "input[type='checkbox'], input[type='radio']", 6842 "selectmenu": "select", 6843 "spinner": ".ui-spinner-input" 6844 } 6845 }, 6846 6847 _create: function() { 6848 this._enhance(); 6849 }, 6850 6851 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 6852 _enhance: function() { 6853 this.element.attr( "role", "toolbar" ); 6854 this.refresh(); 6855 }, 6856 6857 _destroy: function() { 6858 this._callChildMethod( "destroy" ); 6859 this.childWidgets.removeData( "ui-controlgroup-data" ); 6860 this.element.removeAttr( "role" ); 6861 if ( this.options.items.controlgroupLabel ) { 6862 this.element 6863 .find( this.options.items.controlgroupLabel ) 6864 .find( ".ui-controlgroup-label-contents" ) 6865 .contents().unwrap(); 6866 } 6867 }, 6868 6869 _initWidgets: function() { 6870 var that = this, 6871 childWidgets = []; 6872 6873 // First we iterate over each of the items options 6874 $.each( this.options.items, function( widget, selector ) { 6875 var labels; 6876 var options = {}; 6877 6878 // Make sure the widget has a selector set 6879 if ( !selector ) { 6880 return; 6881 } 6882 6883 if ( widget === "controlgroupLabel" ) { 6884 labels = that.element.find( selector ); 6885 labels.each( function() { 6886 var element = $( this ); 6887 6888 if ( element.children( ".ui-controlgroup-label-contents" ).length ) { 6889 return; 6890 } 6891 element.contents() 6892 .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" ); 6893 } ); 6894 that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" ); 6895 childWidgets = childWidgets.concat( labels.get() ); 6896 return; 6897 } 6898 6899 // Make sure the widget actually exists 6900 if ( !$.fn[ widget ] ) { 6901 return; 6902 } 6903 6904 // We assume everything is in the middle to start because we can't determine 6905 // first / last elements until all enhancments are done. 6906 if ( that[ "_" + widget + "Options" ] ) { 6907 options = that[ "_" + widget + "Options" ]( "middle" ); 6908 } else { 6909 options = { classes: {} }; 6910 } 6911 6912 // Find instances of this widget inside controlgroup and init them 6913 that.element 6914 .find( selector ) 6915 .each( function() { 6916 var element = $( this ); 6917 var instance = element[ widget ]( "instance" ); 6918 6919 // We need to clone the default options for this type of widget to avoid 6920 // polluting the variable options which has a wider scope than a single widget. 6921 var instanceOptions = $.widget.extend( {}, options ); 6922 6923 // If the button is the child of a spinner ignore it 6924 // TODO: Find a more generic solution 6925 if ( widget === "button" && element.parent( ".ui-spinner" ).length ) { 6926 return; 6927 } 6928 6929 // Create the widget if it doesn't exist 6930 if ( !instance ) { 6931 instance = element[ widget ]()[ widget ]( "instance" ); 6932 } 6933 if ( instance ) { 6934 instanceOptions.classes = 6935 that._resolveClassesValues( instanceOptions.classes, instance ); 6936 } 6937 element[ widget ]( instanceOptions ); 6938 6939 // Store an instance of the controlgroup to be able to reference 6940 // from the outermost element for changing options and refresh 6941 var widgetElement = element[ widget ]( "widget" ); 6942 $.data( widgetElement[ 0 ], "ui-controlgroup-data", 6943 instance ? instance : element[ widget ]( "instance" ) ); 6944 6945 childWidgets.push( widgetElement[ 0 ] ); 6946 } ); 6947 } ); 6948 6949 this.childWidgets = $( $.uniqueSort( childWidgets ) ); 6950 this._addClass( this.childWidgets, "ui-controlgroup-item" ); 6951 }, 6952 6953 _callChildMethod: function( method ) { 6954 this.childWidgets.each( function() { 6955 var element = $( this ), 6956 data = element.data( "ui-controlgroup-data" ); 6957 if ( data && data[ method ] ) { 6958 data[ method ](); 6959 } 6960 } ); 6961 }, 6962 6963 _updateCornerClass: function( element, position ) { 6964 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 6965 var add = this._buildSimpleOptions( position, "label" ).classes.label; 6966 6967 this._removeClass( element, null, remove ); 6968 this._addClass( element, null, add ); 6969 }, 6970 6971 _buildSimpleOptions: function( position, key ) { 6972 var direction = this.options.direction === "vertical"; 6973 var result = { 6974 classes: {} 6975 }; 6976 result.classes[ key ] = { 6977 "middle": "", 6978 "first": "ui-corner-" + ( direction ? "top" : "left" ), 6979 "last": "ui-corner-" + ( direction ? "bottom" : "right" ), 6980 "only": "ui-corner-all" 6981 }[ position ]; 6982 6983 return result; 6984 }, 6985 6986 _spinnerOptions: function( position ) { 6987 var options = this._buildSimpleOptions( position, "ui-spinner" ); 6988 6989 options.classes[ "ui-spinner-up" ] = ""; 6990 options.classes[ "ui-spinner-down" ] = ""; 6991 6992 return options; 6993 }, 6994 6995 _buttonOptions: function( position ) { 6996 return this._buildSimpleOptions( position, "ui-button" ); 6997 }, 6998 6999 _checkboxradioOptions: function( position ) { 7000 return this._buildSimpleOptions( position, "ui-checkboxradio-label" ); 7001 }, 7002 7003 _selectmenuOptions: function( position ) { 7004 var direction = this.options.direction === "vertical"; 7005 return { 7006 width: direction ? "auto" : false, 7007 classes: { 7008 middle: { 7009 "ui-selectmenu-button-open": "", 7010 "ui-selectmenu-button-closed": "" 7011 }, 7012 first: { 7013 "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ), 7014 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" ) 7015 }, 7016 last: { 7017 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 7018 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" ) 7019 }, 7020 only: { 7021 "ui-selectmenu-button-open": "ui-corner-top", 7022 "ui-selectmenu-button-closed": "ui-corner-all" 7023 } 7024 7025 }[ position ] 7026 }; 7027 }, 7028 7029 _resolveClassesValues: function( classes, instance ) { 7030 var result = {}; 7031 $.each( classes, function( key ) { 7032 var current = instance.options.classes[ key ] || ""; 7033 current = String.prototype.trim.call( current.replace( controlgroupCornerRegex, "" ) ); 7034 result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " ); 7035 } ); 7036 return result; 7037 }, 7038 7039 _setOption: function( key, value ) { 7040 if ( key === "direction" ) { 7041 this._removeClass( "ui-controlgroup-" + this.options.direction ); 7042 } 7043 7044 this._super( key, value ); 7045 if ( key === "disabled" ) { 7046 this._callChildMethod( value ? "disable" : "enable" ); 7047 return; 7048 } 7049 7050 this.refresh(); 7051 }, 7052 7053 refresh: function() { 7054 var children, 7055 that = this; 7056 7057 this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction ); 7058 7059 if ( this.options.direction === "horizontal" ) { 7060 this._addClass( null, "ui-helper-clearfix" ); 7061 } 7062 this._initWidgets(); 7063 7064 children = this.childWidgets; 7065 7066 // We filter here because we need to track all childWidgets not just the visible ones 7067 if ( this.options.onlyVisible ) { 7068 children = children.filter( ":visible" ); 7069 } 7070 7071 if ( children.length ) { 7072 7073 // We do this last because we need to make sure all enhancment is done 7074 // before determining first and last 7075 $.each( [ "first", "last" ], function( index, value ) { 7076 var instance = children[ value ]().data( "ui-controlgroup-data" ); 7077 7078 if ( instance && that[ "_" + instance.widgetName + "Options" ] ) { 7079 var options = that[ "_" + instance.widgetName + "Options" ]( 7080 children.length === 1 ? "only" : value 7081 ); 7082 options.classes = that._resolveClassesValues( options.classes, instance ); 7083 instance.element[ instance.widgetName ]( options ); 7084 } else { 7085 that._updateCornerClass( children[ value ](), value ); 7086 } 7087 } ); 7088 7089 // Finally call the refresh method on each of the child widgets. 7090 this._callChildMethod( "refresh" ); 7091 } 7092 } 7093} ); 7094 7095/*! 7096 * jQuery UI Checkboxradio 1.13.2 7097 * http://jqueryui.com 7098 * 7099 * Copyright jQuery Foundation and other contributors 7100 * Released under the MIT license. 7101 * http://jquery.org/license 7102 */ 7103 7104//>>label: Checkboxradio 7105//>>group: Widgets 7106//>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 7107//>>docs: http://api.jqueryui.com/checkboxradio/ 7108//>>demos: http://jqueryui.com/checkboxradio/ 7109//>>css.structure: ../../themes/base/core.css 7110//>>css.structure: ../../themes/base/button.css 7111//>>css.structure: ../../themes/base/checkboxradio.css 7112//>>css.theme: ../../themes/base/theme.css 7113 7114 7115$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { 7116 version: "1.13.2", 7117 options: { 7118 disabled: null, 7119 label: null, 7120 icon: true, 7121 classes: { 7122 "ui-checkboxradio-label": "ui-corner-all", 7123 "ui-checkboxradio-icon": "ui-corner-all" 7124 } 7125 }, 7126 7127 _getCreateOptions: function() { 7128 var disabled, labels, labelContents; 7129 var options = this._super() || {}; 7130 7131 // We read the type here, because it makes more sense to throw a element type error first, 7132 // rather then the error for lack of a label. Often if its the wrong type, it 7133 // won't have a label (e.g. calling on a div, btn, etc) 7134 this._readType(); 7135 7136 labels = this.element.labels(); 7137 7138 // If there are multiple labels, use the last one 7139 this.label = $( labels[ labels.length - 1 ] ); 7140 if ( !this.label.length ) { 7141 $.error( "No label found for checkboxradio widget" ); 7142 } 7143 7144 this.originalLabel = ""; 7145 7146 // We need to get the label text but this may also need to make sure it does not contain the 7147 // input itself. 7148 // The label contents could be text, html, or a mix. We wrap all elements 7149 // and read the wrapper's `innerHTML` to get a string representation of 7150 // the label, without the input as part of it. 7151 labelContents = this.label.contents().not( this.element[ 0 ] ); 7152 7153 if ( labelContents.length ) { 7154 this.originalLabel += labelContents 7155 .clone() 7156 .wrapAll( "<div></div>" ) 7157 .parent() 7158 .html(); 7159 } 7160 7161 // Set the label option if we found label text 7162 if ( this.originalLabel ) { 7163 options.label = this.originalLabel; 7164 } 7165 7166 disabled = this.element[ 0 ].disabled; 7167 if ( disabled != null ) { 7168 options.disabled = disabled; 7169 } 7170 return options; 7171 }, 7172 7173 _create: function() { 7174 var checked = this.element[ 0 ].checked; 7175 7176 this._bindFormResetHandler(); 7177 7178 if ( this.options.disabled == null ) { 7179 this.options.disabled = this.element[ 0 ].disabled; 7180 } 7181 7182 this._setOption( "disabled", this.options.disabled ); 7183 this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" ); 7184 this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" ); 7185 7186 if ( this.type === "radio" ) { 7187 this._addClass( this.label, "ui-checkboxradio-radio-label" ); 7188 } 7189 7190 if ( this.options.label && this.options.label !== this.originalLabel ) { 7191 this._updateLabel(); 7192 } else if ( this.originalLabel ) { 7193 this.options.label = this.originalLabel; 7194 } 7195 7196 this._enhance(); 7197 7198 if ( checked ) { 7199 this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" ); 7200 } 7201 7202 this._on( { 7203 change: "_toggleClasses", 7204 focus: function() { 7205 this._addClass( this.label, null, "ui-state-focus ui-visual-focus" ); 7206 }, 7207 blur: function() { 7208 this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" ); 7209 } 7210 } ); 7211 }, 7212 7213 _readType: function() { 7214 var nodeName = this.element[ 0 ].nodeName.toLowerCase(); 7215 this.type = this.element[ 0 ].type; 7216 if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) { 7217 $.error( "Can't create checkboxradio on element.nodeName=" + nodeName + 7218 " and element.type=" + this.type ); 7219 } 7220 }, 7221 7222 // Support jQuery Mobile enhanced option 7223 _enhance: function() { 7224 this._updateIcon( this.element[ 0 ].checked ); 7225 }, 7226 7227 widget: function() { 7228 return this.label; 7229 }, 7230 7231 _getRadioGroup: function() { 7232 var group; 7233 var name = this.element[ 0 ].name; 7234 var nameSelector = "input[name='" + $.escapeSelector( name ) + "']"; 7235 7236 if ( !name ) { 7237 return $( [] ); 7238 } 7239 7240 if ( this.form.length ) { 7241 group = $( this.form[ 0 ].elements ).filter( nameSelector ); 7242 } else { 7243 7244 // Not inside a form, check all inputs that also are not inside a form 7245 group = $( nameSelector ).filter( function() { 7246 return $( this )._form().length === 0; 7247 } ); 7248 } 7249 7250 return group.not( this.element ); 7251 }, 7252 7253 _toggleClasses: function() { 7254 var checked = this.element[ 0 ].checked; 7255 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 7256 7257 if ( this.options.icon && this.type === "checkbox" ) { 7258 this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked ) 7259 ._toggleClass( this.icon, null, "ui-icon-blank", !checked ); 7260 } 7261 7262 if ( this.type === "radio" ) { 7263 this._getRadioGroup() 7264 .each( function() { 7265 var instance = $( this ).checkboxradio( "instance" ); 7266 7267 if ( instance ) { 7268 instance._removeClass( instance.label, 7269 "ui-checkboxradio-checked", "ui-state-active" ); 7270 } 7271 } ); 7272 } 7273 }, 7274 7275 _destroy: function() { 7276 this._unbindFormResetHandler(); 7277 7278 if ( this.icon ) { 7279 this.icon.remove(); 7280 this.iconSpace.remove(); 7281 } 7282 }, 7283 7284 _setOption: function( key, value ) { 7285 7286 // We don't allow the value to be set to nothing 7287 if ( key === "label" && !value ) { 7288 return; 7289 } 7290 7291 this._super( key, value ); 7292 7293 if ( key === "disabled" ) { 7294 this._toggleClass( this.label, null, "ui-state-disabled", value ); 7295 this.element[ 0 ].disabled = value; 7296 7297 // Don't refresh when setting disabled 7298 return; 7299 } 7300 this.refresh(); 7301 }, 7302 7303 _updateIcon: function( checked ) { 7304 var toAdd = "ui-icon ui-icon-background "; 7305 7306 if ( this.options.icon ) { 7307 if ( !this.icon ) { 7308 this.icon = $( "<span>" ); 7309 this.iconSpace = $( "<span> </span>" ); 7310 this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" ); 7311 } 7312 7313 if ( this.type === "checkbox" ) { 7314 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank"; 7315 this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" ); 7316 } else { 7317 toAdd += "ui-icon-blank"; 7318 } 7319 this._addClass( this.icon, "ui-checkboxradio-icon", toAdd ); 7320 if ( !checked ) { 7321 this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" ); 7322 } 7323 this.icon.prependTo( this.label ).after( this.iconSpace ); 7324 } else if ( this.icon !== undefined ) { 7325 this.icon.remove(); 7326 this.iconSpace.remove(); 7327 delete this.icon; 7328 } 7329 }, 7330 7331 _updateLabel: function() { 7332 7333 // Remove the contents of the label ( minus the icon, icon space, and input ) 7334 var contents = this.label.contents().not( this.element[ 0 ] ); 7335 if ( this.icon ) { 7336 contents = contents.not( this.icon[ 0 ] ); 7337 } 7338 if ( this.iconSpace ) { 7339 contents = contents.not( this.iconSpace[ 0 ] ); 7340 } 7341 contents.remove(); 7342 7343 this.label.append( this.options.label ); 7344 }, 7345 7346 refresh: function() { 7347 var checked = this.element[ 0 ].checked, 7348 isDisabled = this.element[ 0 ].disabled; 7349 7350 this._updateIcon( checked ); 7351 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 7352 if ( this.options.label !== null ) { 7353 this._updateLabel(); 7354 } 7355 7356 if ( isDisabled !== this.options.disabled ) { 7357 this._setOptions( { "disabled": isDisabled } ); 7358 } 7359 } 7360 7361} ] ); 7362 7363var widgetsCheckboxradio = $.ui.checkboxradio; 7364 7365 7366/*! 7367 * jQuery UI Button 1.13.2 7368 * http://jqueryui.com 7369 * 7370 * Copyright jQuery Foundation and other contributors 7371 * Released under the MIT license. 7372 * http://jquery.org/license 7373 */ 7374 7375//>>label: Button 7376//>>group: Widgets 7377//>>description: Enhances a form with themeable buttons. 7378//>>docs: http://api.jqueryui.com/button/ 7379//>>demos: http://jqueryui.com/button/ 7380//>>css.structure: ../../themes/base/core.css 7381//>>css.structure: ../../themes/base/button.css 7382//>>css.theme: ../../themes/base/theme.css 7383 7384 7385$.widget( "ui.button", { 7386 version: "1.13.2", 7387 defaultElement: "<button>", 7388 options: { 7389 classes: { 7390 "ui-button": "ui-corner-all" 7391 }, 7392 disabled: null, 7393 icon: null, 7394 iconPosition: "beginning", 7395 label: null, 7396 showLabel: true 7397 }, 7398 7399 _getCreateOptions: function() { 7400 var disabled, 7401 7402 // This is to support cases like in jQuery Mobile where the base widget does have 7403 // an implementation of _getCreateOptions 7404 options = this._super() || {}; 7405 7406 this.isInput = this.element.is( "input" ); 7407 7408 disabled = this.element[ 0 ].disabled; 7409 if ( disabled != null ) { 7410 options.disabled = disabled; 7411 } 7412 7413 this.originalLabel = this.isInput ? this.element.val() : this.element.html(); 7414 if ( this.originalLabel ) { 7415 options.label = this.originalLabel; 7416 } 7417 7418 return options; 7419 }, 7420 7421 _create: function() { 7422 if ( !this.option.showLabel & !this.options.icon ) { 7423 this.options.showLabel = true; 7424 } 7425 7426 // We have to check the option again here even though we did in _getCreateOptions, 7427 // because null may have been passed on init which would override what was set in 7428 // _getCreateOptions 7429 if ( this.options.disabled == null ) { 7430 this.options.disabled = this.element[ 0 ].disabled || false; 7431 } 7432 7433 this.hasTitle = !!this.element.attr( "title" ); 7434 7435 // Check to see if the label needs to be set or if its already correct 7436 if ( this.options.label && this.options.label !== this.originalLabel ) { 7437 if ( this.isInput ) { 7438 this.element.val( this.options.label ); 7439 } else { 7440 this.element.html( this.options.label ); 7441 } 7442 } 7443 this._addClass( "ui-button", "ui-widget" ); 7444 this._setOption( "disabled", this.options.disabled ); 7445 this._enhance(); 7446 7447 if ( this.element.is( "a" ) ) { 7448 this._on( { 7449 "keyup": function( event ) { 7450 if ( event.keyCode === $.ui.keyCode.SPACE ) { 7451 event.preventDefault(); 7452 7453 // Support: PhantomJS <= 1.9, IE 8 Only 7454 // If a native click is available use it so we actually cause navigation 7455 // otherwise just trigger a click event 7456 if ( this.element[ 0 ].click ) { 7457 this.element[ 0 ].click(); 7458 } else { 7459 this.element.trigger( "click" ); 7460 } 7461 } 7462 } 7463 } ); 7464 } 7465 }, 7466 7467 _enhance: function() { 7468 if ( !this.element.is( "button" ) ) { 7469 this.element.attr( "role", "button" ); 7470 } 7471 7472 if ( this.options.icon ) { 7473 this._updateIcon( "icon", this.options.icon ); 7474 this._updateTooltip(); 7475 } 7476 }, 7477 7478 _updateTooltip: function() { 7479 this.title = this.element.attr( "title" ); 7480 7481 if ( !this.options.showLabel && !this.title ) { 7482 this.element.attr( "title", this.options.label ); 7483 } 7484 }, 7485 7486 _updateIcon: function( option, value ) { 7487 var icon = option !== "iconPosition", 7488 position = icon ? this.options.iconPosition : value, 7489 displayBlock = position === "top" || position === "bottom"; 7490 7491 // Create icon 7492 if ( !this.icon ) { 7493 this.icon = $( "<span>" ); 7494 7495 this._addClass( this.icon, "ui-button-icon", "ui-icon" ); 7496 7497 if ( !this.options.showLabel ) { 7498 this._addClass( "ui-button-icon-only" ); 7499 } 7500 } else if ( icon ) { 7501 7502 // If we are updating the icon remove the old icon class 7503 this._removeClass( this.icon, null, this.options.icon ); 7504 } 7505 7506 // If we are updating the icon add the new icon class 7507 if ( icon ) { 7508 this._addClass( this.icon, null, value ); 7509 } 7510 7511 this._attachIcon( position ); 7512 7513 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 7514 // the iconSpace if there is one. 7515 if ( displayBlock ) { 7516 this._addClass( this.icon, null, "ui-widget-icon-block" ); 7517 if ( this.iconSpace ) { 7518 this.iconSpace.remove(); 7519 } 7520 } else { 7521 7522 // Position is beginning or end so remove the ui-widget-icon-block class and add the 7523 // space if it does not exist 7524 if ( !this.iconSpace ) { 7525 this.iconSpace = $( "<span> </span>" ); 7526 this._addClass( this.iconSpace, "ui-button-icon-space" ); 7527 } 7528 this._removeClass( this.icon, null, "ui-wiget-icon-block" ); 7529 this._attachIconSpace( position ); 7530 } 7531 }, 7532 7533 _destroy: function() { 7534 this.element.removeAttr( "role" ); 7535 7536 if ( this.icon ) { 7537 this.icon.remove(); 7538 } 7539 if ( this.iconSpace ) { 7540 this.iconSpace.remove(); 7541 } 7542 if ( !this.hasTitle ) { 7543 this.element.removeAttr( "title" ); 7544 } 7545 }, 7546 7547 _attachIconSpace: function( iconPosition ) { 7548 this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace ); 7549 }, 7550 7551 _attachIcon: function( iconPosition ) { 7552 this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon ); 7553 }, 7554 7555 _setOptions: function( options ) { 7556 var newShowLabel = options.showLabel === undefined ? 7557 this.options.showLabel : 7558 options.showLabel, 7559 newIcon = options.icon === undefined ? this.options.icon : options.icon; 7560 7561 if ( !newShowLabel && !newIcon ) { 7562 options.showLabel = true; 7563 } 7564 this._super( options ); 7565 }, 7566 7567 _setOption: function( key, value ) { 7568 if ( key === "icon" ) { 7569 if ( value ) { 7570 this._updateIcon( key, value ); 7571 } else if ( this.icon ) { 7572 this.icon.remove(); 7573 if ( this.iconSpace ) { 7574 this.iconSpace.remove(); 7575 } 7576 } 7577 } 7578 7579 if ( key === "iconPosition" ) { 7580 this._updateIcon( key, value ); 7581 } 7582 7583 // Make sure we can't end up with a button that has neither text nor icon 7584 if ( key === "showLabel" ) { 7585 this._toggleClass( "ui-button-icon-only", null, !value ); 7586 this._updateTooltip(); 7587 } 7588 7589 if ( key === "label" ) { 7590 if ( this.isInput ) { 7591 this.element.val( value ); 7592 } else { 7593 7594 // If there is an icon, append it, else nothing then append the value 7595 // this avoids removal of the icon when setting label text 7596 this.element.html( value ); 7597 if ( this.icon ) { 7598 this._attachIcon( this.options.iconPosition ); 7599 this._attachIconSpace( this.options.iconPosition ); 7600 } 7601 } 7602 } 7603 7604 this._super( key, value ); 7605 7606 if ( key === "disabled" ) { 7607 this._toggleClass( null, "ui-state-disabled", value ); 7608 this.element[ 0 ].disabled = value; 7609 if ( value ) { 7610 this.element.trigger( "blur" ); 7611 } 7612 } 7613 }, 7614 7615 refresh: function() { 7616 7617 // Make sure to only check disabled if its an element that supports this otherwise 7618 // check for the disabled class to determine state 7619 var isDisabled = this.element.is( "input, button" ) ? 7620 this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" ); 7621 7622 if ( isDisabled !== this.options.disabled ) { 7623 this._setOptions( { disabled: isDisabled } ); 7624 } 7625 7626 this._updateTooltip(); 7627 } 7628} ); 7629 7630// DEPRECATED 7631if ( $.uiBackCompat !== false ) { 7632 7633 // Text and Icons options 7634 $.widget( "ui.button", $.ui.button, { 7635 options: { 7636 text: true, 7637 icons: { 7638 primary: null, 7639 secondary: null 7640 } 7641 }, 7642 7643 _create: function() { 7644 if ( this.options.showLabel && !this.options.text ) { 7645 this.options.showLabel = this.options.text; 7646 } 7647 if ( !this.options.showLabel && this.options.text ) { 7648 this.options.text = this.options.showLabel; 7649 } 7650 if ( !this.options.icon && ( this.options.icons.primary || 7651 this.options.icons.secondary ) ) { 7652 if ( this.options.icons.primary ) { 7653 this.options.icon = this.options.icons.primary; 7654 } else { 7655 this.options.icon = this.options.icons.secondary; 7656 this.options.iconPosition = "end"; 7657 } 7658 } else if ( this.options.icon ) { 7659 this.options.icons.primary = this.options.icon; 7660 } 7661 this._super(); 7662 }, 7663 7664 _setOption: function( key, value ) { 7665 if ( key === "text" ) { 7666 this._super( "showLabel", value ); 7667 return; 7668 } 7669 if ( key === "showLabel" ) { 7670 this.options.text = value; 7671 } 7672 if ( key === "icon" ) { 7673 this.options.icons.primary = value; 7674 } 7675 if ( key === "icons" ) { 7676 if ( value.primary ) { 7677 this._super( "icon", value.primary ); 7678 this._super( "iconPosition", "beginning" ); 7679 } else if ( value.secondary ) { 7680 this._super( "icon", value.secondary ); 7681 this._super( "iconPosition", "end" ); 7682 } 7683 } 7684 this._superApply( arguments ); 7685 } 7686 } ); 7687 7688 $.fn.button = ( function( orig ) { 7689 return function( options ) { 7690 var isMethodCall = typeof options === "string"; 7691 var args = Array.prototype.slice.call( arguments, 1 ); 7692 var returnValue = this; 7693 7694 if ( isMethodCall ) { 7695 7696 // If this is an empty collection, we need to have the instance method 7697 // return undefined instead of the jQuery instance 7698 if ( !this.length && options === "instance" ) { 7699 returnValue = undefined; 7700 } else { 7701 this.each( function() { 7702 var methodValue; 7703 var type = $( this ).attr( "type" ); 7704 var name = type !== "checkbox" && type !== "radio" ? 7705 "button" : 7706 "checkboxradio"; 7707 var instance = $.data( this, "ui-" + name ); 7708 7709 if ( options === "instance" ) { 7710 returnValue = instance; 7711 return false; 7712 } 7713 7714 if ( !instance ) { 7715 return $.error( "cannot call methods on button" + 7716 " prior to initialization; " + 7717 "attempted to call method '" + options + "'" ); 7718 } 7719 7720 if ( typeof instance[ options ] !== "function" || 7721 options.charAt( 0 ) === "_" ) { 7722 return $.error( "no such method '" + options + "' for button" + 7723 " widget instance" ); 7724 } 7725 7726 methodValue = instance[ options ].apply( instance, args ); 7727 7728 if ( methodValue !== instance && methodValue !== undefined ) { 7729 returnValue = methodValue && methodValue.jquery ? 7730 returnValue.pushStack( methodValue.get() ) : 7731 methodValue; 7732 return false; 7733 } 7734 } ); 7735 } 7736 } else { 7737 7738 // Allow multiple hashes to be passed on init 7739 if ( args.length ) { 7740 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 7741 } 7742 7743 this.each( function() { 7744 var type = $( this ).attr( "type" ); 7745 var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio"; 7746 var instance = $.data( this, "ui-" + name ); 7747 7748 if ( instance ) { 7749 instance.option( options || {} ); 7750 if ( instance._init ) { 7751 instance._init(); 7752 } 7753 } else { 7754 if ( name === "button" ) { 7755 orig.call( $( this ), options ); 7756 return; 7757 } 7758 7759 $( this ).checkboxradio( $.extend( { icon: false }, options ) ); 7760 } 7761 } ); 7762 } 7763 7764 return returnValue; 7765 }; 7766 } )( $.fn.button ); 7767 7768 $.fn.buttonset = function() { 7769 if ( !$.ui.controlgroup ) { 7770 $.error( "Controlgroup widget missing" ); 7771 } 7772 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) { 7773 return this.controlgroup.apply( this, 7774 [ arguments[ 0 ], "items.button", arguments[ 2 ] ] ); 7775 } 7776 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) { 7777 return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] ); 7778 } 7779 if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) { 7780 arguments[ 0 ].items = { 7781 button: arguments[ 0 ].items 7782 }; 7783 } 7784 return this.controlgroup.apply( this, arguments ); 7785 }; 7786} 7787 7788var widgetsButton = $.ui.button; 7789 7790 7791/* eslint-disable max-len, camelcase */ 7792/*! 7793 * jQuery UI Datepicker 1.13.2 7794 * http://jqueryui.com 7795 * 7796 * Copyright jQuery Foundation and other contributors 7797 * Released under the MIT license. 7798 * http://jquery.org/license 7799 */ 7800 7801//>>label: Datepicker 7802//>>group: Widgets 7803//>>description: Displays a calendar from an input or inline for selecting dates. 7804//>>docs: http://api.jqueryui.com/datepicker/ 7805//>>demos: http://jqueryui.com/datepicker/ 7806//>>css.structure: ../../themes/base/core.css 7807//>>css.structure: ../../themes/base/datepicker.css 7808//>>css.theme: ../../themes/base/theme.css 7809 7810 7811$.extend( $.ui, { datepicker: { version: "1.13.2" } } ); 7812 7813var datepicker_instActive; 7814 7815function datepicker_getZindex( elem ) { 7816 var position, value; 7817 while ( elem.length && elem[ 0 ] !== document ) { 7818 7819 // Ignore z-index if position is set to a value where z-index is ignored by the browser 7820 // This makes behavior of this function consistent across browsers 7821 // WebKit always returns auto if the element is positioned 7822 position = elem.css( "position" ); 7823 if ( position === "absolute" || position === "relative" || position === "fixed" ) { 7824 7825 // IE returns 0 when zIndex is not specified 7826 // other browsers return a string 7827 // we ignore the case of nested elements with an explicit value of 0 7828 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 7829 value = parseInt( elem.css( "zIndex" ), 10 ); 7830 if ( !isNaN( value ) && value !== 0 ) { 7831 return value; 7832 } 7833 } 7834 elem = elem.parent(); 7835 } 7836 7837 return 0; 7838} 7839 7840/* Date picker manager. 7841 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 7842 Settings for (groups of) date pickers are maintained in an instance object, 7843 allowing multiple different settings on the same page. */ 7844 7845function Datepicker() { 7846 this._curInst = null; // The current instance in use 7847 this._keyEvent = false; // If the last event was a key event 7848 this._disabledInputs = []; // List of date picker inputs that have been disabled 7849 this._datepickerShowing = false; // True if the popup picker is showing , false if not 7850 this._inDialog = false; // True if showing within a "dialog", false if not 7851 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 7852 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 7853 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 7854 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 7855 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 7856 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 7857 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 7858 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 7859 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 7860 this.regional = []; // Available regional settings, indexed by language code 7861 this.regional[ "" ] = { // Default regional settings 7862 closeText: "Done", // Display text for close link 7863 prevText: "Prev", // Display text for previous month link 7864 nextText: "Next", // Display text for next month link 7865 currentText: "Today", // Display text for current month link 7866 monthNames: [ "January", "February", "March", "April", "May", "June", 7867 "July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting 7868 monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting 7869 dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting 7870 dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting 7871 dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday 7872 weekHeader: "Wk", // Column header for week of the year 7873 dateFormat: "mm/dd/yy", // See format options on parseDate 7874 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 7875 isRTL: false, // True if right-to-left language, false if left-to-right 7876 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 7877 yearSuffix: "", // Additional text to append to the year in the month headers, 7878 selectMonthLabel: "Select month", // Invisible label for month selector 7879 selectYearLabel: "Select year" // Invisible label for year selector 7880 }; 7881 this._defaults = { // Global defaults for all the date picker instances 7882 showOn: "focus", // "focus" for popup on focus, 7883 // "button" for trigger button, or "both" for either 7884 showAnim: "fadeIn", // Name of jQuery animation for popup 7885 showOptions: {}, // Options for enhanced animations 7886 defaultDate: null, // Used when field is blank: actual date, 7887 // +/-number for offset from today, null for today 7888 appendText: "", // Display text following the input box, e.g. showing the format 7889 buttonText: "...", // Text for trigger button 7890 buttonImage: "", // URL for trigger button image 7891 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 7892 hideIfNoPrevNext: false, // True to hide next/previous month links 7893 // if not applicable, false to just disable them 7894 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 7895 gotoCurrent: false, // True if today link goes back to current selection instead 7896 changeMonth: false, // True if month can be selected directly, false if only prev/next 7897 changeYear: false, // True if year can be selected directly, false if only prev/next 7898 yearRange: "c-10:c+10", // Range of years to display in drop-down, 7899 // either relative to today's year (-nn:+nn), relative to currently displayed year 7900 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 7901 showOtherMonths: false, // True to show dates in other months, false to leave blank 7902 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 7903 showWeek: false, // True to show week of the year, false to not show it 7904 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 7905 // takes a Date and returns the number of the week for it 7906 shortYearCutoff: "+10", // Short year values < this are in the current century, 7907 // > this are in the previous century, 7908 // string value starting with "+" for current year + value 7909 minDate: null, // The earliest selectable date, or null for no limit 7910 maxDate: null, // The latest selectable date, or null for no limit 7911 duration: "fast", // Duration of display/closure 7912 beforeShowDay: null, // Function that takes a date and returns an array with 7913 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 7914 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 7915 beforeShow: null, // Function that takes an input field and 7916 // returns a set of custom settings for the date picker 7917 onSelect: null, // Define a callback function when a date is selected 7918 onChangeMonthYear: null, // Define a callback function when the month or year is changed 7919 onClose: null, // Define a callback function when the datepicker is closed 7920 onUpdateDatepicker: null, // Define a callback function when the datepicker is updated 7921 numberOfMonths: 1, // Number of months to show at a time 7922 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 7923 stepMonths: 1, // Number of months to step back/forward 7924 stepBigMonths: 12, // Number of months to step back/forward for the big links 7925 altField: "", // Selector for an alternate field to store selected dates into 7926 altFormat: "", // The date format to use for the alternate field 7927 constrainInput: true, // The input is constrained by the current date format 7928 showButtonPanel: false, // True to show button panel, false to not show it 7929 autoSize: false, // True to size the input for the date format, false to leave as is 7930 disabled: false // The initial disabled state 7931 }; 7932 $.extend( this._defaults, this.regional[ "" ] ); 7933 this.regional.en = $.extend( true, {}, this.regional[ "" ] ); 7934 this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en ); 7935 this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ); 7936} 7937 7938$.extend( Datepicker.prototype, { 7939 7940 /* Class name added to elements to indicate already configured with a date picker. */ 7941 markerClassName: "hasDatepicker", 7942 7943 //Keep track of the maximum number of rows displayed (see #7043) 7944 maxRows: 4, 7945 7946 // TODO rename to "widget" when switching to widget factory 7947 _widgetDatepicker: function() { 7948 return this.dpDiv; 7949 }, 7950 7951 /* Override the default settings for all instances of the date picker. 7952 * @param settings object - the new settings to use as defaults (anonymous object) 7953 * @return the manager object 7954 */ 7955 setDefaults: function( settings ) { 7956 datepicker_extendRemove( this._defaults, settings || {} ); 7957 return this; 7958 }, 7959 7960 /* Attach the date picker to a jQuery selection. 7961 * @param target element - the target input field or division or span 7962 * @param settings object - the new settings to use for this date picker instance (anonymous) 7963 */ 7964 _attachDatepicker: function( target, settings ) { 7965 var nodeName, inline, inst; 7966 nodeName = target.nodeName.toLowerCase(); 7967 inline = ( nodeName === "div" || nodeName === "span" ); 7968 if ( !target.id ) { 7969 this.uuid += 1; 7970 target.id = "dp" + this.uuid; 7971 } 7972 inst = this._newInst( $( target ), inline ); 7973 inst.settings = $.extend( {}, settings || {} ); 7974 if ( nodeName === "input" ) { 7975 this._connectDatepicker( target, inst ); 7976 } else if ( inline ) { 7977 this._inlineDatepicker( target, inst ); 7978 } 7979 }, 7980 7981 /* Create a new instance object. */ 7982 _newInst: function( target, inline ) { 7983 var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars 7984 return { id: id, input: target, // associated target 7985 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 7986 drawMonth: 0, drawYear: 0, // month being drawn 7987 inline: inline, // is datepicker inline or not 7988 dpDiv: ( !inline ? this.dpDiv : // presentation div 7989 datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) }; 7990 }, 7991 7992 /* Attach the date picker to an input field. */ 7993 _connectDatepicker: function( target, inst ) { 7994 var input = $( target ); 7995 inst.append = $( [] ); 7996 inst.trigger = $( [] ); 7997 if ( input.hasClass( this.markerClassName ) ) { 7998 return; 7999 } 8000 this._attachments( input, inst ); 8001 input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ). 8002 on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp ); 8003 this._autoSize( inst ); 8004 $.data( target, "datepicker", inst ); 8005 8006 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 8007 if ( inst.settings.disabled ) { 8008 this._disableDatepicker( target ); 8009 } 8010 }, 8011 8012 /* Make attachments based on settings. */ 8013 _attachments: function( input, inst ) { 8014 var showOn, buttonText, buttonImage, 8015 appendText = this._get( inst, "appendText" ), 8016 isRTL = this._get( inst, "isRTL" ); 8017 8018 if ( inst.append ) { 8019 inst.append.remove(); 8020 } 8021 if ( appendText ) { 8022 inst.append = $( "<span>" ) 8023 .addClass( this._appendClass ) 8024 .text( appendText ); 8025 input[ isRTL ? "before" : "after" ]( inst.append ); 8026 } 8027 8028 input.off( "focus", this._showDatepicker ); 8029 8030 if ( inst.trigger ) { 8031 inst.trigger.remove(); 8032 } 8033 8034 showOn = this._get( inst, "showOn" ); 8035 if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field 8036 input.on( "focus", this._showDatepicker ); 8037 } 8038 if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked 8039 buttonText = this._get( inst, "buttonText" ); 8040 buttonImage = this._get( inst, "buttonImage" ); 8041 8042 if ( this._get( inst, "buttonImageOnly" ) ) { 8043 inst.trigger = $( "<img>" ) 8044 .addClass( this._triggerClass ) 8045 .attr( { 8046 src: buttonImage, 8047 alt: buttonText, 8048 title: buttonText 8049 } ); 8050 } else { 8051 inst.trigger = $( "<button type='button'>" ) 8052 .addClass( this._triggerClass ); 8053 if ( buttonImage ) { 8054 inst.trigger.html( 8055 $( "<img>" ) 8056 .attr( { 8057 src: buttonImage, 8058 alt: buttonText, 8059 title: buttonText 8060 } ) 8061 ); 8062 } else { 8063 inst.trigger.text( buttonText ); 8064 } 8065 } 8066 8067 input[ isRTL ? "before" : "after" ]( inst.trigger ); 8068 inst.trigger.on( "click", function() { 8069 if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) { 8070 $.datepicker._hideDatepicker(); 8071 } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) { 8072 $.datepicker._hideDatepicker(); 8073 $.datepicker._showDatepicker( input[ 0 ] ); 8074 } else { 8075 $.datepicker._showDatepicker( input[ 0 ] ); 8076 } 8077 return false; 8078 } ); 8079 } 8080 }, 8081 8082 /* Apply the maximum length for the date format. */ 8083 _autoSize: function( inst ) { 8084 if ( this._get( inst, "autoSize" ) && !inst.inline ) { 8085 var findMax, max, maxI, i, 8086 date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits 8087 dateFormat = this._get( inst, "dateFormat" ); 8088 8089 if ( dateFormat.match( /[DM]/ ) ) { 8090 findMax = function( names ) { 8091 max = 0; 8092 maxI = 0; 8093 for ( i = 0; i < names.length; i++ ) { 8094 if ( names[ i ].length > max ) { 8095 max = names[ i ].length; 8096 maxI = i; 8097 } 8098 } 8099 return maxI; 8100 }; 8101 date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ? 8102 "monthNames" : "monthNamesShort" ) ) ) ); 8103 date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ? 8104 "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() ); 8105 } 8106 inst.input.attr( "size", this._formatDate( inst, date ).length ); 8107 } 8108 }, 8109 8110 /* Attach an inline date picker to a div. */ 8111 _inlineDatepicker: function( target, inst ) { 8112 var divSpan = $( target ); 8113 if ( divSpan.hasClass( this.markerClassName ) ) { 8114 return; 8115 } 8116 divSpan.addClass( this.markerClassName ).append( inst.dpDiv ); 8117 $.data( target, "datepicker", inst ); 8118 this._setDate( inst, this._getDefaultDate( inst ), true ); 8119 this._updateDatepicker( inst ); 8120 this._updateAlternate( inst ); 8121 8122 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 8123 if ( inst.settings.disabled ) { 8124 this._disableDatepicker( target ); 8125 } 8126 8127 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 8128 // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 8129 inst.dpDiv.css( "display", "block" ); 8130 }, 8131 8132 /* Pop-up the date picker in a "dialog" box. 8133 * @param input element - ignored 8134 * @param date string or Date - the initial date to display 8135 * @param onSelect function - the function to call when a date is selected 8136 * @param settings object - update the dialog date picker instance's settings (anonymous object) 8137 * @param pos int[2] - coordinates for the dialog's position within the screen or 8138 * event - with x/y coordinates or 8139 * leave empty for default (screen centre) 8140 * @return the manager object 8141 */ 8142 _dialogDatepicker: function( input, date, onSelect, settings, pos ) { 8143 var id, browserWidth, browserHeight, scrollX, scrollY, 8144 inst = this._dialogInst; // internal instance 8145 8146 if ( !inst ) { 8147 this.uuid += 1; 8148 id = "dp" + this.uuid; 8149 this._dialogInput = $( "<input type='text' id='" + id + 8150 "' style='position: absolute; top: -100px; width: 0px;'/>" ); 8151 this._dialogInput.on( "keydown", this._doKeyDown ); 8152 $( "body" ).append( this._dialogInput ); 8153 inst = this._dialogInst = this._newInst( this._dialogInput, false ); 8154 inst.settings = {}; 8155 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 8156 } 8157 datepicker_extendRemove( inst.settings, settings || {} ); 8158 date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date ); 8159 this._dialogInput.val( date ); 8160 8161 this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null ); 8162 if ( !this._pos ) { 8163 browserWidth = document.documentElement.clientWidth; 8164 browserHeight = document.documentElement.clientHeight; 8165 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 8166 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 8167 this._pos = // should use actual width/height below 8168 [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ]; 8169 } 8170 8171 // Move input on screen for focus, but hidden behind dialog 8172 this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" ); 8173 inst.settings.onSelect = onSelect; 8174 this._inDialog = true; 8175 this.dpDiv.addClass( this._dialogClass ); 8176 this._showDatepicker( this._dialogInput[ 0 ] ); 8177 if ( $.blockUI ) { 8178 $.blockUI( this.dpDiv ); 8179 } 8180 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 8181 return this; 8182 }, 8183 8184 /* Detach a datepicker from its control. 8185 * @param target element - the target input field or division or span 8186 */ 8187 _destroyDatepicker: function( target ) { 8188 var nodeName, 8189 $target = $( target ), 8190 inst = $.data( target, "datepicker" ); 8191 8192 if ( !$target.hasClass( this.markerClassName ) ) { 8193 return; 8194 } 8195 8196 nodeName = target.nodeName.toLowerCase(); 8197 $.removeData( target, "datepicker" ); 8198 if ( nodeName === "input" ) { 8199 inst.append.remove(); 8200 inst.trigger.remove(); 8201 $target.removeClass( this.markerClassName ). 8202 off( "focus", this._showDatepicker ). 8203 off( "keydown", this._doKeyDown ). 8204 off( "keypress", this._doKeyPress ). 8205 off( "keyup", this._doKeyUp ); 8206 } else if ( nodeName === "div" || nodeName === "span" ) { 8207 $target.removeClass( this.markerClassName ).empty(); 8208 } 8209 8210 if ( datepicker_instActive === inst ) { 8211 datepicker_instActive = null; 8212 this._curInst = null; 8213 } 8214 }, 8215 8216 /* Enable the date picker to a jQuery selection. 8217 * @param target element - the target input field or division or span 8218 */ 8219 _enableDatepicker: function( target ) { 8220 var nodeName, inline, 8221 $target = $( target ), 8222 inst = $.data( target, "datepicker" ); 8223 8224 if ( !$target.hasClass( this.markerClassName ) ) { 8225 return; 8226 } 8227 8228 nodeName = target.nodeName.toLowerCase(); 8229 if ( nodeName === "input" ) { 8230 target.disabled = false; 8231 inst.trigger.filter( "button" ). 8232 each( function() { 8233 this.disabled = false; 8234 } ).end(). 8235 filter( "img" ).css( { opacity: "1.0", cursor: "" } ); 8236 } else if ( nodeName === "div" || nodeName === "span" ) { 8237 inline = $target.children( "." + this._inlineClass ); 8238 inline.children().removeClass( "ui-state-disabled" ); 8239 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 8240 prop( "disabled", false ); 8241 } 8242 this._disabledInputs = $.map( this._disabledInputs, 8243 8244 // Delete entry 8245 function( value ) { 8246 return ( value === target ? null : value ); 8247 } ); 8248 }, 8249 8250 /* Disable the date picker to a jQuery selection. 8251 * @param target element - the target input field or division or span 8252 */ 8253 _disableDatepicker: function( target ) { 8254 var nodeName, inline, 8255 $target = $( target ), 8256 inst = $.data( target, "datepicker" ); 8257 8258 if ( !$target.hasClass( this.markerClassName ) ) { 8259 return; 8260 } 8261 8262 nodeName = target.nodeName.toLowerCase(); 8263 if ( nodeName === "input" ) { 8264 target.disabled = true; 8265 inst.trigger.filter( "button" ). 8266 each( function() { 8267 this.disabled = true; 8268 } ).end(). 8269 filter( "img" ).css( { opacity: "0.5", cursor: "default" } ); 8270 } else if ( nodeName === "div" || nodeName === "span" ) { 8271 inline = $target.children( "." + this._inlineClass ); 8272 inline.children().addClass( "ui-state-disabled" ); 8273 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 8274 prop( "disabled", true ); 8275 } 8276 this._disabledInputs = $.map( this._disabledInputs, 8277 8278 // Delete entry 8279 function( value ) { 8280 return ( value === target ? null : value ); 8281 } ); 8282 this._disabledInputs[ this._disabledInputs.length ] = target; 8283 }, 8284 8285 /* Is the first field in a jQuery collection disabled as a datepicker? 8286 * @param target element - the target input field or division or span 8287 * @return boolean - true if disabled, false if enabled 8288 */ 8289 _isDisabledDatepicker: function( target ) { 8290 if ( !target ) { 8291 return false; 8292 } 8293 for ( var i = 0; i < this._disabledInputs.length; i++ ) { 8294 if ( this._disabledInputs[ i ] === target ) { 8295 return true; 8296 } 8297 } 8298 return false; 8299 }, 8300 8301 /* Retrieve the instance data for the target control. 8302 * @param target element - the target input field or division or span 8303 * @return object - the associated instance data 8304 * @throws error if a jQuery problem getting data 8305 */ 8306 _getInst: function( target ) { 8307 try { 8308 return $.data( target, "datepicker" ); 8309 } catch ( err ) { 8310 throw "Missing instance data for this datepicker"; 8311 } 8312 }, 8313 8314 /* Update or retrieve the settings for a date picker attached to an input field or division. 8315 * @param target element - the target input field or division or span 8316 * @param name object - the new settings to update or 8317 * string - the name of the setting to change or retrieve, 8318 * when retrieving also "all" for all instance settings or 8319 * "defaults" for all global defaults 8320 * @param value any - the new value for the setting 8321 * (omit if above is an object or to retrieve a value) 8322 */ 8323 _optionDatepicker: function( target, name, value ) { 8324 var settings, date, minDate, maxDate, 8325 inst = this._getInst( target ); 8326 8327 if ( arguments.length === 2 && typeof name === "string" ) { 8328 return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) : 8329 ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) : 8330 this._get( inst, name ) ) : null ) ); 8331 } 8332 8333 settings = name || {}; 8334 if ( typeof name === "string" ) { 8335 settings = {}; 8336 settings[ name ] = value; 8337 } 8338 8339 if ( inst ) { 8340 if ( this._curInst === inst ) { 8341 this._hideDatepicker(); 8342 } 8343 8344 date = this._getDateDatepicker( target, true ); 8345 minDate = this._getMinMaxDate( inst, "min" ); 8346 maxDate = this._getMinMaxDate( inst, "max" ); 8347 datepicker_extendRemove( inst.settings, settings ); 8348 8349 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 8350 if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) { 8351 inst.settings.minDate = this._formatDate( inst, minDate ); 8352 } 8353 if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) { 8354 inst.settings.maxDate = this._formatDate( inst, maxDate ); 8355 } 8356 if ( "disabled" in settings ) { 8357 if ( settings.disabled ) { 8358 this._disableDatepicker( target ); 8359 } else { 8360 this._enableDatepicker( target ); 8361 } 8362 } 8363 this._attachments( $( target ), inst ); 8364 this._autoSize( inst ); 8365 this._setDate( inst, date ); 8366 this._updateAlternate( inst ); 8367 this._updateDatepicker( inst ); 8368 } 8369 }, 8370 8371 // Change method deprecated 8372 _changeDatepicker: function( target, name, value ) { 8373 this._optionDatepicker( target, name, value ); 8374 }, 8375 8376 /* Redraw the date picker attached to an input field or division. 8377 * @param target element - the target input field or division or span 8378 */ 8379 _refreshDatepicker: function( target ) { 8380 var inst = this._getInst( target ); 8381 if ( inst ) { 8382 this._updateDatepicker( inst ); 8383 } 8384 }, 8385 8386 /* Set the dates for a jQuery selection. 8387 * @param target element - the target input field or division or span 8388 * @param date Date - the new date 8389 */ 8390 _setDateDatepicker: function( target, date ) { 8391 var inst = this._getInst( target ); 8392 if ( inst ) { 8393 this._setDate( inst, date ); 8394 this._updateDatepicker( inst ); 8395 this._updateAlternate( inst ); 8396 } 8397 }, 8398 8399 /* Get the date(s) for the first entry in a jQuery selection. 8400 * @param target element - the target input field or division or span 8401 * @param noDefault boolean - true if no default date is to be used 8402 * @return Date - the current date 8403 */ 8404 _getDateDatepicker: function( target, noDefault ) { 8405 var inst = this._getInst( target ); 8406 if ( inst && !inst.inline ) { 8407 this._setDateFromField( inst, noDefault ); 8408 } 8409 return ( inst ? this._getDate( inst ) : null ); 8410 }, 8411 8412 /* Handle keystrokes. */ 8413 _doKeyDown: function( event ) { 8414 var onSelect, dateStr, sel, 8415 inst = $.datepicker._getInst( event.target ), 8416 handled = true, 8417 isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" ); 8418 8419 inst._keyEvent = true; 8420 if ( $.datepicker._datepickerShowing ) { 8421 switch ( event.keyCode ) { 8422 case 9: $.datepicker._hideDatepicker(); 8423 handled = false; 8424 break; // hide on tab out 8425 case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." + 8426 $.datepicker._currentClass + ")", inst.dpDiv ); 8427 if ( sel[ 0 ] ) { 8428 $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] ); 8429 } 8430 8431 onSelect = $.datepicker._get( inst, "onSelect" ); 8432 if ( onSelect ) { 8433 dateStr = $.datepicker._formatDate( inst ); 8434 8435 // Trigger custom callback 8436 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); 8437 } else { 8438 $.datepicker._hideDatepicker(); 8439 } 8440 8441 return false; // don't submit the form 8442 case 27: $.datepicker._hideDatepicker(); 8443 break; // hide on escape 8444 case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 8445 -$.datepicker._get( inst, "stepBigMonths" ) : 8446 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 8447 break; // previous month/year on page up/+ ctrl 8448 case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 8449 +$.datepicker._get( inst, "stepBigMonths" ) : 8450 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 8451 break; // next month/year on page down/+ ctrl 8452 case 35: if ( event.ctrlKey || event.metaKey ) { 8453 $.datepicker._clearDate( event.target ); 8454 } 8455 handled = event.ctrlKey || event.metaKey; 8456 break; // clear on ctrl or command +end 8457 case 36: if ( event.ctrlKey || event.metaKey ) { 8458 $.datepicker._gotoToday( event.target ); 8459 } 8460 handled = event.ctrlKey || event.metaKey; 8461 break; // current on ctrl or command +home 8462 case 37: if ( event.ctrlKey || event.metaKey ) { 8463 $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" ); 8464 } 8465 handled = event.ctrlKey || event.metaKey; 8466 8467 // -1 day on ctrl or command +left 8468 if ( event.originalEvent.altKey ) { 8469 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 8470 -$.datepicker._get( inst, "stepBigMonths" ) : 8471 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 8472 } 8473 8474 // next month/year on alt +left on Mac 8475 break; 8476 case 38: if ( event.ctrlKey || event.metaKey ) { 8477 $.datepicker._adjustDate( event.target, -7, "D" ); 8478 } 8479 handled = event.ctrlKey || event.metaKey; 8480 break; // -1 week on ctrl or command +up 8481 case 39: if ( event.ctrlKey || event.metaKey ) { 8482 $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" ); 8483 } 8484 handled = event.ctrlKey || event.metaKey; 8485 8486 // +1 day on ctrl or command +right 8487 if ( event.originalEvent.altKey ) { 8488 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 8489 +$.datepicker._get( inst, "stepBigMonths" ) : 8490 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 8491 } 8492 8493 // next month/year on alt +right 8494 break; 8495 case 40: if ( event.ctrlKey || event.metaKey ) { 8496 $.datepicker._adjustDate( event.target, +7, "D" ); 8497 } 8498 handled = event.ctrlKey || event.metaKey; 8499 break; // +1 week on ctrl or command +down 8500 default: handled = false; 8501 } 8502 } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home 8503 $.datepicker._showDatepicker( this ); 8504 } else { 8505 handled = false; 8506 } 8507 8508 if ( handled ) { 8509 event.preventDefault(); 8510 event.stopPropagation(); 8511 } 8512 }, 8513 8514 /* Filter entered characters - based on date format. */ 8515 _doKeyPress: function( event ) { 8516 var chars, chr, 8517 inst = $.datepicker._getInst( event.target ); 8518 8519 if ( $.datepicker._get( inst, "constrainInput" ) ) { 8520 chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) ); 8521 chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode ); 8522 return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 ); 8523 } 8524 }, 8525 8526 /* Synchronise manual entry and field/alternate field. */ 8527 _doKeyUp: function( event ) { 8528 var date, 8529 inst = $.datepicker._getInst( event.target ); 8530 8531 if ( inst.input.val() !== inst.lastVal ) { 8532 try { 8533 date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 8534 ( inst.input ? inst.input.val() : null ), 8535 $.datepicker._getFormatConfig( inst ) ); 8536 8537 if ( date ) { // only if valid 8538 $.datepicker._setDateFromField( inst ); 8539 $.datepicker._updateAlternate( inst ); 8540 $.datepicker._updateDatepicker( inst ); 8541 } 8542 } catch ( err ) { 8543 } 8544 } 8545 return true; 8546 }, 8547 8548 /* Pop-up the date picker for a given input field. 8549 * If false returned from beforeShow event handler do not show. 8550 * @param input element - the input field attached to the date picker or 8551 * event - if triggered by focus 8552 */ 8553 _showDatepicker: function( input ) { 8554 input = input.target || input; 8555 if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger 8556 input = $( "input", input.parentNode )[ 0 ]; 8557 } 8558 8559 if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here 8560 return; 8561 } 8562 8563 var inst, beforeShow, beforeShowSettings, isFixed, 8564 offset, showAnim, duration; 8565 8566 inst = $.datepicker._getInst( input ); 8567 if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) { 8568 $.datepicker._curInst.dpDiv.stop( true, true ); 8569 if ( inst && $.datepicker._datepickerShowing ) { 8570 $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] ); 8571 } 8572 } 8573 8574 beforeShow = $.datepicker._get( inst, "beforeShow" ); 8575 beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {}; 8576 if ( beforeShowSettings === false ) { 8577 return; 8578 } 8579 datepicker_extendRemove( inst.settings, beforeShowSettings ); 8580 8581 inst.lastVal = null; 8582 $.datepicker._lastInput = input; 8583 $.datepicker._setDateFromField( inst ); 8584 8585 if ( $.datepicker._inDialog ) { // hide cursor 8586 input.value = ""; 8587 } 8588 if ( !$.datepicker._pos ) { // position below input 8589 $.datepicker._pos = $.datepicker._findPos( input ); 8590 $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height 8591 } 8592 8593 isFixed = false; 8594 $( input ).parents().each( function() { 8595 isFixed |= $( this ).css( "position" ) === "fixed"; 8596 return !isFixed; 8597 } ); 8598 8599 offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] }; 8600 $.datepicker._pos = null; 8601 8602 //to avoid flashes on Firefox 8603 inst.dpDiv.empty(); 8604 8605 // determine sizing offscreen 8606 inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } ); 8607 $.datepicker._updateDatepicker( inst ); 8608 8609 // fix width for dynamic number of date pickers 8610 // and adjust position before showing 8611 offset = $.datepicker._checkOffset( inst, offset, isFixed ); 8612 inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ? 8613 "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none", 8614 left: offset.left + "px", top: offset.top + "px" } ); 8615 8616 if ( !inst.inline ) { 8617 showAnim = $.datepicker._get( inst, "showAnim" ); 8618 duration = $.datepicker._get( inst, "duration" ); 8619 inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 ); 8620 $.datepicker._datepickerShowing = true; 8621 8622 if ( $.effects && $.effects.effect[ showAnim ] ) { 8623 inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration ); 8624 } else { 8625 inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null ); 8626 } 8627 8628 if ( $.datepicker._shouldFocusInput( inst ) ) { 8629 inst.input.trigger( "focus" ); 8630 } 8631 8632 $.datepicker._curInst = inst; 8633 } 8634 }, 8635 8636 /* Generate the date picker content. */ 8637 _updateDatepicker: function( inst ) { 8638 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 8639 datepicker_instActive = inst; // for delegate hover events 8640 inst.dpDiv.empty().append( this._generateHTML( inst ) ); 8641 this._attachHandlers( inst ); 8642 8643 var origyearshtml, 8644 numMonths = this._getNumberOfMonths( inst ), 8645 cols = numMonths[ 1 ], 8646 width = 17, 8647 activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ), 8648 onUpdateDatepicker = $.datepicker._get( inst, "onUpdateDatepicker" ); 8649 8650 if ( activeCell.length > 0 ) { 8651 datepicker_handleMouseover.apply( activeCell.get( 0 ) ); 8652 } 8653 8654 inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" ); 8655 if ( cols > 1 ) { 8656 inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" ); 8657 } 8658 inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) + 8659 "Class" ]( "ui-datepicker-multi" ); 8660 inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) + 8661 "Class" ]( "ui-datepicker-rtl" ); 8662 8663 if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { 8664 inst.input.trigger( "focus" ); 8665 } 8666 8667 // Deffered render of the years select (to avoid flashes on Firefox) 8668 if ( inst.yearshtml ) { 8669 origyearshtml = inst.yearshtml; 8670 setTimeout( function() { 8671 8672 //assure that inst.yearshtml didn't change. 8673 if ( origyearshtml === inst.yearshtml && inst.yearshtml ) { 8674 inst.dpDiv.find( "select.ui-datepicker-year" ).first().replaceWith( inst.yearshtml ); 8675 } 8676 origyearshtml = inst.yearshtml = null; 8677 }, 0 ); 8678 } 8679 8680 if ( onUpdateDatepicker ) { 8681 onUpdateDatepicker.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst ] ); 8682 } 8683 }, 8684 8685 // #6694 - don't focus the input if it's already focused 8686 // this breaks the change event in IE 8687 // Support: IE and jQuery <1.9 8688 _shouldFocusInput: function( inst ) { 8689 return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" ); 8690 }, 8691 8692 /* Check positioning to remain on screen. */ 8693 _checkOffset: function( inst, offset, isFixed ) { 8694 var dpWidth = inst.dpDiv.outerWidth(), 8695 dpHeight = inst.dpDiv.outerHeight(), 8696 inputWidth = inst.input ? inst.input.outerWidth() : 0, 8697 inputHeight = inst.input ? inst.input.outerHeight() : 0, 8698 viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ), 8699 viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() ); 8700 8701 offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 ); 8702 offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0; 8703 offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0; 8704 8705 // Now check if datepicker is showing outside window viewport - move to a better place if so. 8706 offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ? 8707 Math.abs( offset.left + dpWidth - viewWidth ) : 0 ); 8708 offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ? 8709 Math.abs( dpHeight + inputHeight ) : 0 ); 8710 8711 return offset; 8712 }, 8713 8714 /* Find an object's position on the screen. */ 8715 _findPos: function( obj ) { 8716 var position, 8717 inst = this._getInst( obj ), 8718 isRTL = this._get( inst, "isRTL" ); 8719 8720 while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden( obj ) ) ) { 8721 obj = obj[ isRTL ? "previousSibling" : "nextSibling" ]; 8722 } 8723 8724 position = $( obj ).offset(); 8725 return [ position.left, position.top ]; 8726 }, 8727 8728 /* Hide the date picker from view. 8729 * @param input element - the input field attached to the date picker 8730 */ 8731 _hideDatepicker: function( input ) { 8732 var showAnim, duration, postProcess, onClose, 8733 inst = this._curInst; 8734 8735 if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) { 8736 return; 8737 } 8738 8739 if ( this._datepickerShowing ) { 8740 showAnim = this._get( inst, "showAnim" ); 8741 duration = this._get( inst, "duration" ); 8742 postProcess = function() { 8743 $.datepicker._tidyDialog( inst ); 8744 }; 8745 8746 // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed 8747 if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) { 8748 inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess ); 8749 } else { 8750 inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" : 8751 ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess ); 8752 } 8753 8754 if ( !showAnim ) { 8755 postProcess(); 8756 } 8757 this._datepickerShowing = false; 8758 8759 onClose = this._get( inst, "onClose" ); 8760 if ( onClose ) { 8761 onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] ); 8762 } 8763 8764 this._lastInput = null; 8765 if ( this._inDialog ) { 8766 this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } ); 8767 if ( $.blockUI ) { 8768 $.unblockUI(); 8769 $( "body" ).append( this.dpDiv ); 8770 } 8771 } 8772 this._inDialog = false; 8773 } 8774 }, 8775 8776 /* Tidy up after a dialog display. */ 8777 _tidyDialog: function( inst ) { 8778 inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" ); 8779 }, 8780 8781 /* Close date picker if clicked elsewhere. */ 8782 _checkExternalClick: function( event ) { 8783 if ( !$.datepicker._curInst ) { 8784 return; 8785 } 8786 8787 var $target = $( event.target ), 8788 inst = $.datepicker._getInst( $target[ 0 ] ); 8789 8790 if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId && 8791 $target.parents( "#" + $.datepicker._mainDivId ).length === 0 && 8792 !$target.hasClass( $.datepicker.markerClassName ) && 8793 !$target.closest( "." + $.datepicker._triggerClass ).length && 8794 $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) || 8795 ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) { 8796 $.datepicker._hideDatepicker(); 8797 } 8798 }, 8799 8800 /* Adjust one of the date sub-fields. */ 8801 _adjustDate: function( id, offset, period ) { 8802 var target = $( id ), 8803 inst = this._getInst( target[ 0 ] ); 8804 8805 if ( this._isDisabledDatepicker( target[ 0 ] ) ) { 8806 return; 8807 } 8808 this._adjustInstDate( inst, offset, period ); 8809 this._updateDatepicker( inst ); 8810 }, 8811 8812 /* Action for current link. */ 8813 _gotoToday: function( id ) { 8814 var date, 8815 target = $( id ), 8816 inst = this._getInst( target[ 0 ] ); 8817 8818 if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) { 8819 inst.selectedDay = inst.currentDay; 8820 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 8821 inst.drawYear = inst.selectedYear = inst.currentYear; 8822 } else { 8823 date = new Date(); 8824 inst.selectedDay = date.getDate(); 8825 inst.drawMonth = inst.selectedMonth = date.getMonth(); 8826 inst.drawYear = inst.selectedYear = date.getFullYear(); 8827 } 8828 this._notifyChange( inst ); 8829 this._adjustDate( target ); 8830 }, 8831 8832 /* Action for selecting a new month/year. */ 8833 _selectMonthYear: function( id, select, period ) { 8834 var target = $( id ), 8835 inst = this._getInst( target[ 0 ] ); 8836 8837 inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] = 8838 inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] = 8839 parseInt( select.options[ select.selectedIndex ].value, 10 ); 8840 8841 this._notifyChange( inst ); 8842 this._adjustDate( target ); 8843 }, 8844 8845 /* Action for selecting a day. */ 8846 _selectDay: function( id, month, year, td ) { 8847 var inst, 8848 target = $( id ); 8849 8850 if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) { 8851 return; 8852 } 8853 8854 inst = this._getInst( target[ 0 ] ); 8855 inst.selectedDay = inst.currentDay = parseInt( $( "a", td ).attr( "data-date" ) ); 8856 inst.selectedMonth = inst.currentMonth = month; 8857 inst.selectedYear = inst.currentYear = year; 8858 this._selectDate( id, this._formatDate( inst, 8859 inst.currentDay, inst.currentMonth, inst.currentYear ) ); 8860 }, 8861 8862 /* Erase the input field and hide the date picker. */ 8863 _clearDate: function( id ) { 8864 var target = $( id ); 8865 this._selectDate( target, "" ); 8866 }, 8867 8868 /* Update the input field with the selected date. */ 8869 _selectDate: function( id, dateStr ) { 8870 var onSelect, 8871 target = $( id ), 8872 inst = this._getInst( target[ 0 ] ); 8873 8874 dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) ); 8875 if ( inst.input ) { 8876 inst.input.val( dateStr ); 8877 } 8878 this._updateAlternate( inst ); 8879 8880 onSelect = this._get( inst, "onSelect" ); 8881 if ( onSelect ) { 8882 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback 8883 } else if ( inst.input ) { 8884 inst.input.trigger( "change" ); // fire the change event 8885 } 8886 8887 if ( inst.inline ) { 8888 this._updateDatepicker( inst ); 8889 } else { 8890 this._hideDatepicker(); 8891 this._lastInput = inst.input[ 0 ]; 8892 if ( typeof( inst.input[ 0 ] ) !== "object" ) { 8893 inst.input.trigger( "focus" ); // restore focus 8894 } 8895 this._lastInput = null; 8896 } 8897 }, 8898 8899 /* Update any alternate field to synchronise with the main field. */ 8900 _updateAlternate: function( inst ) { 8901 var altFormat, date, dateStr, 8902 altField = this._get( inst, "altField" ); 8903 8904 if ( altField ) { // update alternate field too 8905 altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" ); 8906 date = this._getDate( inst ); 8907 dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) ); 8908 $( document ).find( altField ).val( dateStr ); 8909 } 8910 }, 8911 8912 /* Set as beforeShowDay function to prevent selection of weekends. 8913 * @param date Date - the date to customise 8914 * @return [boolean, string] - is this date selectable?, what is its CSS class? 8915 */ 8916 noWeekends: function( date ) { 8917 var day = date.getDay(); 8918 return [ ( day > 0 && day < 6 ), "" ]; 8919 }, 8920 8921 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 8922 * @param date Date - the date to get the week for 8923 * @return number - the number of the week within the year that contains this date 8924 */ 8925 iso8601Week: function( date ) { 8926 var time, 8927 checkDate = new Date( date.getTime() ); 8928 8929 // Find Thursday of this week starting on Monday 8930 checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) ); 8931 8932 time = checkDate.getTime(); 8933 checkDate.setMonth( 0 ); // Compare with Jan 1 8934 checkDate.setDate( 1 ); 8935 return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1; 8936 }, 8937 8938 /* Parse a string value into a date object. 8939 * See formatDate below for the possible formats. 8940 * 8941 * @param format string - the expected format of the date 8942 * @param value string - the date in the above format 8943 * @param settings Object - attributes include: 8944 * shortYearCutoff number - the cutoff year for determining the century (optional) 8945 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 8946 * dayNames string[7] - names of the days from Sunday (optional) 8947 * monthNamesShort string[12] - abbreviated names of the months (optional) 8948 * monthNames string[12] - names of the months (optional) 8949 * @return Date - the extracted date value or null if value is blank 8950 */ 8951 parseDate: function( format, value, settings ) { 8952 if ( format == null || value == null ) { 8953 throw "Invalid arguments"; 8954 } 8955 8956 value = ( typeof value === "object" ? value.toString() : value + "" ); 8957 if ( value === "" ) { 8958 return null; 8959 } 8960 8961 var iFormat, dim, extra, 8962 iValue = 0, 8963 shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff, 8964 shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp : 8965 new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ), 8966 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 8967 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 8968 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 8969 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 8970 year = -1, 8971 month = -1, 8972 day = -1, 8973 doy = -1, 8974 literal = false, 8975 date, 8976 8977 // Check whether a format character is doubled 8978 lookAhead = function( match ) { 8979 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 8980 if ( matches ) { 8981 iFormat++; 8982 } 8983 return matches; 8984 }, 8985 8986 // Extract a number from the string value 8987 getNumber = function( match ) { 8988 var isDoubled = lookAhead( match ), 8989 size = ( match === "@" ? 14 : ( match === "!" ? 20 : 8990 ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ), 8991 minSize = ( match === "y" ? size : 1 ), 8992 digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ), 8993 num = value.substring( iValue ).match( digits ); 8994 if ( !num ) { 8995 throw "Missing number at position " + iValue; 8996 } 8997 iValue += num[ 0 ].length; 8998 return parseInt( num[ 0 ], 10 ); 8999 }, 9000 9001 // Extract a name from the string value and convert to an index 9002 getName = function( match, shortNames, longNames ) { 9003 var index = -1, 9004 names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) { 9005 return [ [ k, v ] ]; 9006 } ).sort( function( a, b ) { 9007 return -( a[ 1 ].length - b[ 1 ].length ); 9008 } ); 9009 9010 $.each( names, function( i, pair ) { 9011 var name = pair[ 1 ]; 9012 if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) { 9013 index = pair[ 0 ]; 9014 iValue += name.length; 9015 return false; 9016 } 9017 } ); 9018 if ( index !== -1 ) { 9019 return index + 1; 9020 } else { 9021 throw "Unknown name at position " + iValue; 9022 } 9023 }, 9024 9025 // Confirm that a literal character matches the string value 9026 checkLiteral = function() { 9027 if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) { 9028 throw "Unexpected literal at position " + iValue; 9029 } 9030 iValue++; 9031 }; 9032 9033 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 9034 if ( literal ) { 9035 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 9036 literal = false; 9037 } else { 9038 checkLiteral(); 9039 } 9040 } else { 9041 switch ( format.charAt( iFormat ) ) { 9042 case "d": 9043 day = getNumber( "d" ); 9044 break; 9045 case "D": 9046 getName( "D", dayNamesShort, dayNames ); 9047 break; 9048 case "o": 9049 doy = getNumber( "o" ); 9050 break; 9051 case "m": 9052 month = getNumber( "m" ); 9053 break; 9054 case "M": 9055 month = getName( "M", monthNamesShort, monthNames ); 9056 break; 9057 case "y": 9058 year = getNumber( "y" ); 9059 break; 9060 case "@": 9061 date = new Date( getNumber( "@" ) ); 9062 year = date.getFullYear(); 9063 month = date.getMonth() + 1; 9064 day = date.getDate(); 9065 break; 9066 case "!": 9067 date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 ); 9068 year = date.getFullYear(); 9069 month = date.getMonth() + 1; 9070 day = date.getDate(); 9071 break; 9072 case "'": 9073 if ( lookAhead( "'" ) ) { 9074 checkLiteral(); 9075 } else { 9076 literal = true; 9077 } 9078 break; 9079 default: 9080 checkLiteral(); 9081 } 9082 } 9083 } 9084 9085 if ( iValue < value.length ) { 9086 extra = value.substr( iValue ); 9087 if ( !/^\s+/.test( extra ) ) { 9088 throw "Extra/unparsed characters found in date: " + extra; 9089 } 9090 } 9091 9092 if ( year === -1 ) { 9093 year = new Date().getFullYear(); 9094 } else if ( year < 100 ) { 9095 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 9096 ( year <= shortYearCutoff ? 0 : -100 ); 9097 } 9098 9099 if ( doy > -1 ) { 9100 month = 1; 9101 day = doy; 9102 do { 9103 dim = this._getDaysInMonth( year, month - 1 ); 9104 if ( day <= dim ) { 9105 break; 9106 } 9107 month++; 9108 day -= dim; 9109 } while ( true ); 9110 } 9111 9112 date = this._daylightSavingAdjust( new Date( year, month - 1, day ) ); 9113 if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) { 9114 throw "Invalid date"; // E.g. 31/02/00 9115 } 9116 return date; 9117 }, 9118 9119 /* Standard date formats. */ 9120 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 9121 COOKIE: "D, dd M yy", 9122 ISO_8601: "yy-mm-dd", 9123 RFC_822: "D, d M y", 9124 RFC_850: "DD, dd-M-y", 9125 RFC_1036: "D, d M y", 9126 RFC_1123: "D, d M yy", 9127 RFC_2822: "D, d M yy", 9128 RSS: "D, d M y", // RFC 822 9129 TICKS: "!", 9130 TIMESTAMP: "@", 9131 W3C: "yy-mm-dd", // ISO 8601 9132 9133 _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) + 9134 Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ), 9135 9136 /* Format a date object into a string value. 9137 * The format can be combinations of the following: 9138 * d - day of month (no leading zero) 9139 * dd - day of month (two digit) 9140 * o - day of year (no leading zeros) 9141 * oo - day of year (three digit) 9142 * D - day name short 9143 * DD - day name long 9144 * m - month of year (no leading zero) 9145 * mm - month of year (two digit) 9146 * M - month name short 9147 * MM - month name long 9148 * y - year (two digit) 9149 * yy - year (four digit) 9150 * @ - Unix timestamp (ms since 01/01/1970) 9151 * ! - Windows ticks (100ns since 01/01/0001) 9152 * "..." - literal text 9153 * '' - single quote 9154 * 9155 * @param format string - the desired format of the date 9156 * @param date Date - the date value to format 9157 * @param settings Object - attributes include: 9158 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 9159 * dayNames string[7] - names of the days from Sunday (optional) 9160 * monthNamesShort string[12] - abbreviated names of the months (optional) 9161 * monthNames string[12] - names of the months (optional) 9162 * @return string - the date in the above format 9163 */ 9164 formatDate: function( format, date, settings ) { 9165 if ( !date ) { 9166 return ""; 9167 } 9168 9169 var iFormat, 9170 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 9171 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 9172 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 9173 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 9174 9175 // Check whether a format character is doubled 9176 lookAhead = function( match ) { 9177 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 9178 if ( matches ) { 9179 iFormat++; 9180 } 9181 return matches; 9182 }, 9183 9184 // Format a number, with leading zero if necessary 9185 formatNumber = function( match, value, len ) { 9186 var num = "" + value; 9187 if ( lookAhead( match ) ) { 9188 while ( num.length < len ) { 9189 num = "0" + num; 9190 } 9191 } 9192 return num; 9193 }, 9194 9195 // Format a name, short or long as requested 9196 formatName = function( match, value, shortNames, longNames ) { 9197 return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] ); 9198 }, 9199 output = "", 9200 literal = false; 9201 9202 if ( date ) { 9203 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 9204 if ( literal ) { 9205 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 9206 literal = false; 9207 } else { 9208 output += format.charAt( iFormat ); 9209 } 9210 } else { 9211 switch ( format.charAt( iFormat ) ) { 9212 case "d": 9213 output += formatNumber( "d", date.getDate(), 2 ); 9214 break; 9215 case "D": 9216 output += formatName( "D", date.getDay(), dayNamesShort, dayNames ); 9217 break; 9218 case "o": 9219 output += formatNumber( "o", 9220 Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 ); 9221 break; 9222 case "m": 9223 output += formatNumber( "m", date.getMonth() + 1, 2 ); 9224 break; 9225 case "M": 9226 output += formatName( "M", date.getMonth(), monthNamesShort, monthNames ); 9227 break; 9228 case "y": 9229 output += ( lookAhead( "y" ) ? date.getFullYear() : 9230 ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 ); 9231 break; 9232 case "@": 9233 output += date.getTime(); 9234 break; 9235 case "!": 9236 output += date.getTime() * 10000 + this._ticksTo1970; 9237 break; 9238 case "'": 9239 if ( lookAhead( "'" ) ) { 9240 output += "'"; 9241 } else { 9242 literal = true; 9243 } 9244 break; 9245 default: 9246 output += format.charAt( iFormat ); 9247 } 9248 } 9249 } 9250 } 9251 return output; 9252 }, 9253 9254 /* Extract all possible characters from the date format. */ 9255 _possibleChars: function( format ) { 9256 var iFormat, 9257 chars = "", 9258 literal = false, 9259 9260 // Check whether a format character is doubled 9261 lookAhead = function( match ) { 9262 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 9263 if ( matches ) { 9264 iFormat++; 9265 } 9266 return matches; 9267 }; 9268 9269 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 9270 if ( literal ) { 9271 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 9272 literal = false; 9273 } else { 9274 chars += format.charAt( iFormat ); 9275 } 9276 } else { 9277 switch ( format.charAt( iFormat ) ) { 9278 case "d": case "m": case "y": case "@": 9279 chars += "0123456789"; 9280 break; 9281 case "D": case "M": 9282 return null; // Accept anything 9283 case "'": 9284 if ( lookAhead( "'" ) ) { 9285 chars += "'"; 9286 } else { 9287 literal = true; 9288 } 9289 break; 9290 default: 9291 chars += format.charAt( iFormat ); 9292 } 9293 } 9294 } 9295 return chars; 9296 }, 9297 9298 /* Get a setting value, defaulting if necessary. */ 9299 _get: function( inst, name ) { 9300 return inst.settings[ name ] !== undefined ? 9301 inst.settings[ name ] : this._defaults[ name ]; 9302 }, 9303 9304 /* Parse existing date and initialise date picker. */ 9305 _setDateFromField: function( inst, noDefault ) { 9306 if ( inst.input.val() === inst.lastVal ) { 9307 return; 9308 } 9309 9310 var dateFormat = this._get( inst, "dateFormat" ), 9311 dates = inst.lastVal = inst.input ? inst.input.val() : null, 9312 defaultDate = this._getDefaultDate( inst ), 9313 date = defaultDate, 9314 settings = this._getFormatConfig( inst ); 9315 9316 try { 9317 date = this.parseDate( dateFormat, dates, settings ) || defaultDate; 9318 } catch ( event ) { 9319 dates = ( noDefault ? "" : dates ); 9320 } 9321 inst.selectedDay = date.getDate(); 9322 inst.drawMonth = inst.selectedMonth = date.getMonth(); 9323 inst.drawYear = inst.selectedYear = date.getFullYear(); 9324 inst.currentDay = ( dates ? date.getDate() : 0 ); 9325 inst.currentMonth = ( dates ? date.getMonth() : 0 ); 9326 inst.currentYear = ( dates ? date.getFullYear() : 0 ); 9327 this._adjustInstDate( inst ); 9328 }, 9329 9330 /* Retrieve the default date shown on opening. */ 9331 _getDefaultDate: function( inst ) { 9332 return this._restrictMinMax( inst, 9333 this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) ); 9334 }, 9335 9336 /* A date may be specified as an exact value or a relative one. */ 9337 _determineDate: function( inst, date, defaultDate ) { 9338 var offsetNumeric = function( offset ) { 9339 var date = new Date(); 9340 date.setDate( date.getDate() + offset ); 9341 return date; 9342 }, 9343 offsetString = function( offset ) { 9344 try { 9345 return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 9346 offset, $.datepicker._getFormatConfig( inst ) ); 9347 } catch ( e ) { 9348 9349 // Ignore 9350 } 9351 9352 var date = ( offset.toLowerCase().match( /^c/ ) ? 9353 $.datepicker._getDate( inst ) : null ) || new Date(), 9354 year = date.getFullYear(), 9355 month = date.getMonth(), 9356 day = date.getDate(), 9357 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 9358 matches = pattern.exec( offset ); 9359 9360 while ( matches ) { 9361 switch ( matches[ 2 ] || "d" ) { 9362 case "d" : case "D" : 9363 day += parseInt( matches[ 1 ], 10 ); break; 9364 case "w" : case "W" : 9365 day += parseInt( matches[ 1 ], 10 ) * 7; break; 9366 case "m" : case "M" : 9367 month += parseInt( matches[ 1 ], 10 ); 9368 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 9369 break; 9370 case "y": case "Y" : 9371 year += parseInt( matches[ 1 ], 10 ); 9372 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 9373 break; 9374 } 9375 matches = pattern.exec( offset ); 9376 } 9377 return new Date( year, month, day ); 9378 }, 9379 newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) : 9380 ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) ); 9381 9382 newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate ); 9383 if ( newDate ) { 9384 newDate.setHours( 0 ); 9385 newDate.setMinutes( 0 ); 9386 newDate.setSeconds( 0 ); 9387 newDate.setMilliseconds( 0 ); 9388 } 9389 return this._daylightSavingAdjust( newDate ); 9390 }, 9391 9392 /* Handle switch to/from daylight saving. 9393 * Hours may be non-zero on daylight saving cut-over: 9394 * > 12 when midnight changeover, but then cannot generate 9395 * midnight datetime, so jump to 1AM, otherwise reset. 9396 * @param date (Date) the date to check 9397 * @return (Date) the corrected date 9398 */ 9399 _daylightSavingAdjust: function( date ) { 9400 if ( !date ) { 9401 return null; 9402 } 9403 date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 ); 9404 return date; 9405 }, 9406 9407 /* Set the date(s) directly. */ 9408 _setDate: function( inst, date, noChange ) { 9409 var clear = !date, 9410 origMonth = inst.selectedMonth, 9411 origYear = inst.selectedYear, 9412 newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) ); 9413 9414 inst.selectedDay = inst.currentDay = newDate.getDate(); 9415 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 9416 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 9417 if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) { 9418 this._notifyChange( inst ); 9419 } 9420 this._adjustInstDate( inst ); 9421 if ( inst.input ) { 9422 inst.input.val( clear ? "" : this._formatDate( inst ) ); 9423 } 9424 }, 9425 9426 /* Retrieve the date(s) directly. */ 9427 _getDate: function( inst ) { 9428 var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null : 9429 this._daylightSavingAdjust( new Date( 9430 inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 9431 return startDate; 9432 }, 9433 9434 /* Attach the onxxx handlers. These are declared statically so 9435 * they work with static code transformers like Caja. 9436 */ 9437 _attachHandlers: function( inst ) { 9438 var stepMonths = this._get( inst, "stepMonths" ), 9439 id = "#" + inst.id.replace( /\\\\/g, "\\" ); 9440 inst.dpDiv.find( "[data-handler]" ).map( function() { 9441 var handler = { 9442 prev: function() { 9443 $.datepicker._adjustDate( id, -stepMonths, "M" ); 9444 }, 9445 next: function() { 9446 $.datepicker._adjustDate( id, +stepMonths, "M" ); 9447 }, 9448 hide: function() { 9449 $.datepicker._hideDatepicker(); 9450 }, 9451 today: function() { 9452 $.datepicker._gotoToday( id ); 9453 }, 9454 selectDay: function() { 9455 $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this ); 9456 return false; 9457 }, 9458 selectMonth: function() { 9459 $.datepicker._selectMonthYear( id, this, "M" ); 9460 return false; 9461 }, 9462 selectYear: function() { 9463 $.datepicker._selectMonthYear( id, this, "Y" ); 9464 return false; 9465 } 9466 }; 9467 $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] ); 9468 } ); 9469 }, 9470 9471 /* Generate the HTML for the current state of the date picker. */ 9472 _generateHTML: function( inst ) { 9473 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 9474 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 9475 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 9476 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 9477 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 9478 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 9479 tempDate = new Date(), 9480 today = this._daylightSavingAdjust( 9481 new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time 9482 isRTL = this._get( inst, "isRTL" ), 9483 showButtonPanel = this._get( inst, "showButtonPanel" ), 9484 hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ), 9485 navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ), 9486 numMonths = this._getNumberOfMonths( inst ), 9487 showCurrentAtPos = this._get( inst, "showCurrentAtPos" ), 9488 stepMonths = this._get( inst, "stepMonths" ), 9489 isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ), 9490 currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) : 9491 new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ), 9492 minDate = this._getMinMaxDate( inst, "min" ), 9493 maxDate = this._getMinMaxDate( inst, "max" ), 9494 drawMonth = inst.drawMonth - showCurrentAtPos, 9495 drawYear = inst.drawYear; 9496 9497 if ( drawMonth < 0 ) { 9498 drawMonth += 12; 9499 drawYear--; 9500 } 9501 if ( maxDate ) { 9502 maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(), 9503 maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) ); 9504 maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw ); 9505 while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) { 9506 drawMonth--; 9507 if ( drawMonth < 0 ) { 9508 drawMonth = 11; 9509 drawYear--; 9510 } 9511 } 9512 } 9513 inst.drawMonth = drawMonth; 9514 inst.drawYear = drawYear; 9515 9516 prevText = this._get( inst, "prevText" ); 9517 prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText, 9518 this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ), 9519 this._getFormatConfig( inst ) ) ); 9520 9521 if ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ) { 9522 prev = $( "<a>" ) 9523 .attr( { 9524 "class": "ui-datepicker-prev ui-corner-all", 9525 "data-handler": "prev", 9526 "data-event": "click", 9527 title: prevText 9528 } ) 9529 .append( 9530 $( "<span>" ) 9531 .addClass( "ui-icon ui-icon-circle-triangle-" + 9532 ( isRTL ? "e" : "w" ) ) 9533 .text( prevText ) 9534 )[ 0 ].outerHTML; 9535 } else if ( hideIfNoPrevNext ) { 9536 prev = ""; 9537 } else { 9538 prev = $( "<a>" ) 9539 .attr( { 9540 "class": "ui-datepicker-prev ui-corner-all ui-state-disabled", 9541 title: prevText 9542 } ) 9543 .append( 9544 $( "<span>" ) 9545 .addClass( "ui-icon ui-icon-circle-triangle-" + 9546 ( isRTL ? "e" : "w" ) ) 9547 .text( prevText ) 9548 )[ 0 ].outerHTML; 9549 } 9550 9551 nextText = this._get( inst, "nextText" ); 9552 nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText, 9553 this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ), 9554 this._getFormatConfig( inst ) ) ); 9555 9556 if ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ) { 9557 next = $( "<a>" ) 9558 .attr( { 9559 "class": "ui-datepicker-next ui-corner-all", 9560 "data-handler": "next", 9561 "data-event": "click", 9562 title: nextText 9563 } ) 9564 .append( 9565 $( "<span>" ) 9566 .addClass( "ui-icon ui-icon-circle-triangle-" + 9567 ( isRTL ? "w" : "e" ) ) 9568 .text( nextText ) 9569 )[ 0 ].outerHTML; 9570 } else if ( hideIfNoPrevNext ) { 9571 next = ""; 9572 } else { 9573 next = $( "<a>" ) 9574 .attr( { 9575 "class": "ui-datepicker-next ui-corner-all ui-state-disabled", 9576 title: nextText 9577 } ) 9578 .append( 9579 $( "<span>" ) 9580 .attr( "class", "ui-icon ui-icon-circle-triangle-" + 9581 ( isRTL ? "w" : "e" ) ) 9582 .text( nextText ) 9583 )[ 0 ].outerHTML; 9584 } 9585 9586 currentText = this._get( inst, "currentText" ); 9587 gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today ); 9588 currentText = ( !navigationAsDateFormat ? currentText : 9589 this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) ); 9590 9591 controls = ""; 9592 if ( !inst.inline ) { 9593 controls = $( "<button>" ) 9594 .attr( { 9595 type: "button", 9596 "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all", 9597 "data-handler": "hide", 9598 "data-event": "click" 9599 } ) 9600 .text( this._get( inst, "closeText" ) )[ 0 ].outerHTML; 9601 } 9602 9603 buttonPanel = ""; 9604 if ( showButtonPanel ) { 9605 buttonPanel = $( "<div class='ui-datepicker-buttonpane ui-widget-content'>" ) 9606 .append( isRTL ? controls : "" ) 9607 .append( this._isInRange( inst, gotoDate ) ? 9608 $( "<button>" ) 9609 .attr( { 9610 type: "button", 9611 "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all", 9612 "data-handler": "today", 9613 "data-event": "click" 9614 } ) 9615 .text( currentText ) : 9616 "" ) 9617 .append( isRTL ? "" : controls )[ 0 ].outerHTML; 9618 } 9619 9620 firstDay = parseInt( this._get( inst, "firstDay" ), 10 ); 9621 firstDay = ( isNaN( firstDay ) ? 0 : firstDay ); 9622 9623 showWeek = this._get( inst, "showWeek" ); 9624 dayNames = this._get( inst, "dayNames" ); 9625 dayNamesMin = this._get( inst, "dayNamesMin" ); 9626 monthNames = this._get( inst, "monthNames" ); 9627 monthNamesShort = this._get( inst, "monthNamesShort" ); 9628 beforeShowDay = this._get( inst, "beforeShowDay" ); 9629 showOtherMonths = this._get( inst, "showOtherMonths" ); 9630 selectOtherMonths = this._get( inst, "selectOtherMonths" ); 9631 defaultDate = this._getDefaultDate( inst ); 9632 html = ""; 9633 9634 for ( row = 0; row < numMonths[ 0 ]; row++ ) { 9635 group = ""; 9636 this.maxRows = 4; 9637 for ( col = 0; col < numMonths[ 1 ]; col++ ) { 9638 selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) ); 9639 cornerClass = " ui-corner-all"; 9640 calender = ""; 9641 if ( isMultiMonth ) { 9642 calender += "<div class='ui-datepicker-group"; 9643 if ( numMonths[ 1 ] > 1 ) { 9644 switch ( col ) { 9645 case 0: calender += " ui-datepicker-group-first"; 9646 cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break; 9647 case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last"; 9648 cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break; 9649 default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; 9650 } 9651 } 9652 calender += "'>"; 9653 } 9654 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 9655 ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) + 9656 ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) + 9657 this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate, 9658 row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers 9659 "</div><table class='ui-datepicker-calendar'><thead>" + 9660 "<tr>"; 9661 thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" ); 9662 for ( dow = 0; dow < 7; dow++ ) { // days of the week 9663 day = ( dow + firstDay ) % 7; 9664 thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" + 9665 "<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>"; 9666 } 9667 calender += thead + "</tr></thead><tbody>"; 9668 daysInMonth = this._getDaysInMonth( drawYear, drawMonth ); 9669 if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) { 9670 inst.selectedDay = Math.min( inst.selectedDay, daysInMonth ); 9671 } 9672 leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7; 9673 curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate 9674 numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043) 9675 this.maxRows = numRows; 9676 printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) ); 9677 for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows 9678 calender += "<tr>"; 9679 tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 9680 this._get( inst, "calculateWeek" )( printDate ) + "</td>" ); 9681 for ( dow = 0; dow < 7; dow++ ) { // create date picker days 9682 daySettings = ( beforeShowDay ? 9683 beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] ); 9684 otherMonth = ( printDate.getMonth() !== drawMonth ); 9685 unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] || 9686 ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate ); 9687 tbody += "<td class='" + 9688 ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends 9689 ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months 9690 ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key 9691 ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ? 9692 9693 // or defaultDate is current printedDate and defaultDate is selectedDate 9694 " " + this._dayOverClass : "" ) + // highlight selected day 9695 ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days 9696 ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates 9697 ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day 9698 ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different) 9699 ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "'" ) + "'" : "" ) + // cell title 9700 ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions 9701 ( otherMonth && !showOtherMonths ? " " : // display for other months 9702 ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 9703 ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) + 9704 ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day 9705 ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months 9706 "' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader 9707 "' data-date='" + printDate.getDate() + // store date as data 9708 "'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date 9709 printDate.setDate( printDate.getDate() + 1 ); 9710 printDate = this._daylightSavingAdjust( printDate ); 9711 } 9712 calender += tbody + "</tr>"; 9713 } 9714 drawMonth++; 9715 if ( drawMonth > 11 ) { 9716 drawMonth = 0; 9717 drawYear++; 9718 } 9719 calender += "</tbody></table>" + ( isMultiMonth ? "</div>" + 9720 ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" ); 9721 group += calender; 9722 } 9723 html += group; 9724 } 9725 html += buttonPanel; 9726 inst._keyEvent = false; 9727 return html; 9728 }, 9729 9730 /* Generate the month and year header. */ 9731 _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate, 9732 secondary, monthNames, monthNamesShort ) { 9733 9734 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 9735 changeMonth = this._get( inst, "changeMonth" ), 9736 changeYear = this._get( inst, "changeYear" ), 9737 showMonthAfterYear = this._get( inst, "showMonthAfterYear" ), 9738 selectMonthLabel = this._get( inst, "selectMonthLabel" ), 9739 selectYearLabel = this._get( inst, "selectYearLabel" ), 9740 html = "<div class='ui-datepicker-title'>", 9741 monthHtml = ""; 9742 9743 // Month selection 9744 if ( secondary || !changeMonth ) { 9745 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>"; 9746 } else { 9747 inMinYear = ( minDate && minDate.getFullYear() === drawYear ); 9748 inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear ); 9749 monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>"; 9750 for ( month = 0; month < 12; month++ ) { 9751 if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) { 9752 monthHtml += "<option value='" + month + "'" + 9753 ( month === drawMonth ? " selected='selected'" : "" ) + 9754 ">" + monthNamesShort[ month ] + "</option>"; 9755 } 9756 } 9757 monthHtml += "</select>"; 9758 } 9759 9760 if ( !showMonthAfterYear ) { 9761 html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? " " : "" ); 9762 } 9763 9764 // Year selection 9765 if ( !inst.yearshtml ) { 9766 inst.yearshtml = ""; 9767 if ( secondary || !changeYear ) { 9768 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 9769 } else { 9770 9771 // determine range of years to display 9772 years = this._get( inst, "yearRange" ).split( ":" ); 9773 thisYear = new Date().getFullYear(); 9774 determineYear = function( value ) { 9775 var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) : 9776 ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) : 9777 parseInt( value, 10 ) ) ); 9778 return ( isNaN( year ) ? thisYear : year ); 9779 }; 9780 year = determineYear( years[ 0 ] ); 9781 endYear = Math.max( year, determineYear( years[ 1 ] || "" ) ); 9782 year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year ); 9783 endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear ); 9784 inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>"; 9785 for ( ; year <= endYear; year++ ) { 9786 inst.yearshtml += "<option value='" + year + "'" + 9787 ( year === drawYear ? " selected='selected'" : "" ) + 9788 ">" + year + "</option>"; 9789 } 9790 inst.yearshtml += "</select>"; 9791 9792 html += inst.yearshtml; 9793 inst.yearshtml = null; 9794 } 9795 } 9796 9797 html += this._get( inst, "yearSuffix" ); 9798 if ( showMonthAfterYear ) { 9799 html += ( secondary || !( changeMonth && changeYear ) ? " " : "" ) + monthHtml; 9800 } 9801 html += "</div>"; // Close datepicker_header 9802 return html; 9803 }, 9804 9805 /* Adjust one of the date sub-fields. */ 9806 _adjustInstDate: function( inst, offset, period ) { 9807 var year = inst.selectedYear + ( period === "Y" ? offset : 0 ), 9808 month = inst.selectedMonth + ( period === "M" ? offset : 0 ), 9809 day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ), 9810 date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) ); 9811 9812 inst.selectedDay = date.getDate(); 9813 inst.drawMonth = inst.selectedMonth = date.getMonth(); 9814 inst.drawYear = inst.selectedYear = date.getFullYear(); 9815 if ( period === "M" || period === "Y" ) { 9816 this._notifyChange( inst ); 9817 } 9818 }, 9819 9820 /* Ensure a date is within any min/max bounds. */ 9821 _restrictMinMax: function( inst, date ) { 9822 var minDate = this._getMinMaxDate( inst, "min" ), 9823 maxDate = this._getMinMaxDate( inst, "max" ), 9824 newDate = ( minDate && date < minDate ? minDate : date ); 9825 return ( maxDate && newDate > maxDate ? maxDate : newDate ); 9826 }, 9827 9828 /* Notify change of month/year. */ 9829 _notifyChange: function( inst ) { 9830 var onChange = this._get( inst, "onChangeMonthYear" ); 9831 if ( onChange ) { 9832 onChange.apply( ( inst.input ? inst.input[ 0 ] : null ), 9833 [ inst.selectedYear, inst.selectedMonth + 1, inst ] ); 9834 } 9835 }, 9836 9837 /* Determine the number of months to show. */ 9838 _getNumberOfMonths: function( inst ) { 9839 var numMonths = this._get( inst, "numberOfMonths" ); 9840 return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) ); 9841 }, 9842 9843 /* Determine the current maximum date - ensure no time components are set. */ 9844 _getMinMaxDate: function( inst, minMax ) { 9845 return this._determineDate( inst, this._get( inst, minMax + "Date" ), null ); 9846 }, 9847 9848 /* Find the number of days in a given month. */ 9849 _getDaysInMonth: function( year, month ) { 9850 return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate(); 9851 }, 9852 9853 /* Find the day of the week of the first of a month. */ 9854 _getFirstDayOfMonth: function( year, month ) { 9855 return new Date( year, month, 1 ).getDay(); 9856 }, 9857 9858 /* Determines if we should allow a "next/prev" month display change. */ 9859 _canAdjustMonth: function( inst, offset, curYear, curMonth ) { 9860 var numMonths = this._getNumberOfMonths( inst ), 9861 date = this._daylightSavingAdjust( new Date( curYear, 9862 curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) ); 9863 9864 if ( offset < 0 ) { 9865 date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) ); 9866 } 9867 return this._isInRange( inst, date ); 9868 }, 9869 9870 /* Is the given date in the accepted range? */ 9871 _isInRange: function( inst, date ) { 9872 var yearSplit, currentYear, 9873 minDate = this._getMinMaxDate( inst, "min" ), 9874 maxDate = this._getMinMaxDate( inst, "max" ), 9875 minYear = null, 9876 maxYear = null, 9877 years = this._get( inst, "yearRange" ); 9878 if ( years ) { 9879 yearSplit = years.split( ":" ); 9880 currentYear = new Date().getFullYear(); 9881 minYear = parseInt( yearSplit[ 0 ], 10 ); 9882 maxYear = parseInt( yearSplit[ 1 ], 10 ); 9883 if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) { 9884 minYear += currentYear; 9885 } 9886 if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) { 9887 maxYear += currentYear; 9888 } 9889 } 9890 9891 return ( ( !minDate || date.getTime() >= minDate.getTime() ) && 9892 ( !maxDate || date.getTime() <= maxDate.getTime() ) && 9893 ( !minYear || date.getFullYear() >= minYear ) && 9894 ( !maxYear || date.getFullYear() <= maxYear ) ); 9895 }, 9896 9897 /* Provide the configuration settings for formatting/parsing. */ 9898 _getFormatConfig: function( inst ) { 9899 var shortYearCutoff = this._get( inst, "shortYearCutoff" ); 9900 shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff : 9901 new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) ); 9902 return { shortYearCutoff: shortYearCutoff, 9903 dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ), 9904 monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) }; 9905 }, 9906 9907 /* Format the given date for display. */ 9908 _formatDate: function( inst, day, month, year ) { 9909 if ( !day ) { 9910 inst.currentDay = inst.selectedDay; 9911 inst.currentMonth = inst.selectedMonth; 9912 inst.currentYear = inst.selectedYear; 9913 } 9914 var date = ( day ? ( typeof day === "object" ? day : 9915 this._daylightSavingAdjust( new Date( year, month, day ) ) ) : 9916 this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 9917 return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) ); 9918 } 9919} ); 9920 9921/* 9922 * Bind hover events for datepicker elements. 9923 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 9924 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 9925 */ 9926function datepicker_bindHover( dpDiv ) { 9927 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 9928 return dpDiv.on( "mouseout", selector, function() { 9929 $( this ).removeClass( "ui-state-hover" ); 9930 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 9931 $( this ).removeClass( "ui-datepicker-prev-hover" ); 9932 } 9933 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 9934 $( this ).removeClass( "ui-datepicker-next-hover" ); 9935 } 9936 } ) 9937 .on( "mouseover", selector, datepicker_handleMouseover ); 9938} 9939 9940function datepicker_handleMouseover() { 9941 if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) { 9942 $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" ); 9943 $( this ).addClass( "ui-state-hover" ); 9944 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 9945 $( this ).addClass( "ui-datepicker-prev-hover" ); 9946 } 9947 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 9948 $( this ).addClass( "ui-datepicker-next-hover" ); 9949 } 9950 } 9951} 9952 9953/* jQuery extend now ignores nulls! */ 9954function datepicker_extendRemove( target, props ) { 9955 $.extend( target, props ); 9956 for ( var name in props ) { 9957 if ( props[ name ] == null ) { 9958 target[ name ] = props[ name ]; 9959 } 9960 } 9961 return target; 9962} 9963 9964/* Invoke the datepicker functionality. 9965 @param options string - a command, optionally followed by additional parameters or 9966 Object - settings for attaching new datepicker functionality 9967 @return jQuery object */ 9968$.fn.datepicker = function( options ) { 9969 9970 /* Verify an empty collection wasn't passed - Fixes #6976 */ 9971 if ( !this.length ) { 9972 return this; 9973 } 9974 9975 /* Initialise the date picker. */ 9976 if ( !$.datepicker.initialized ) { 9977 $( document ).on( "mousedown", $.datepicker._checkExternalClick ); 9978 $.datepicker.initialized = true; 9979 } 9980 9981 /* Append datepicker main container to body if not exist. */ 9982 if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) { 9983 $( "body" ).append( $.datepicker.dpDiv ); 9984 } 9985 9986 var otherArgs = Array.prototype.slice.call( arguments, 1 ); 9987 if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) { 9988 return $.datepicker[ "_" + options + "Datepicker" ]. 9989 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 9990 } 9991 if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) { 9992 return $.datepicker[ "_" + options + "Datepicker" ]. 9993 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 9994 } 9995 return this.each( function() { 9996 if ( typeof options === "string" ) { 9997 $.datepicker[ "_" + options + "Datepicker" ] 9998 .apply( $.datepicker, [ this ].concat( otherArgs ) ); 9999 } else { 10000 $.datepicker._attachDatepicker( this, options ); 10001 } 10002 } ); 10003}; 10004 10005$.datepicker = new Datepicker(); // singleton instance 10006$.datepicker.initialized = false; 10007$.datepicker.uuid = new Date().getTime(); 10008$.datepicker.version = "1.13.2"; 10009 10010var widgetsDatepicker = $.datepicker; 10011 10012 10013 10014// This file is deprecated 10015var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); 10016 10017/*! 10018 * jQuery UI Mouse 1.13.2 10019 * http://jqueryui.com 10020 * 10021 * Copyright jQuery Foundation and other contributors 10022 * Released under the MIT license. 10023 * http://jquery.org/license 10024 */ 10025 10026//>>label: Mouse 10027//>>group: Widgets 10028//>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 10029//>>docs: http://api.jqueryui.com/mouse/ 10030 10031 10032var mouseHandled = false; 10033$( document ).on( "mouseup", function() { 10034 mouseHandled = false; 10035} ); 10036 10037var widgetsMouse = $.widget( "ui.mouse", { 10038 version: "1.13.2", 10039 options: { 10040 cancel: "input, textarea, button, select, option", 10041 distance: 1, 10042 delay: 0 10043 }, 10044 _mouseInit: function() { 10045 var that = this; 10046 10047 this.element 10048 .on( "mousedown." + this.widgetName, function( event ) { 10049 return that._mouseDown( event ); 10050 } ) 10051 .on( "click." + this.widgetName, function( event ) { 10052 if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) { 10053 $.removeData( event.target, that.widgetName + ".preventClickEvent" ); 10054 event.stopImmediatePropagation(); 10055 return false; 10056 } 10057 } ); 10058 10059 this.started = false; 10060 }, 10061 10062 // TODO: make sure destroying one instance of mouse doesn't mess with 10063 // other instances of mouse 10064 _mouseDestroy: function() { 10065 this.element.off( "." + this.widgetName ); 10066 if ( this._mouseMoveDelegate ) { 10067 this.document 10068 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 10069 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 10070 } 10071 }, 10072 10073 _mouseDown: function( event ) { 10074 10075 // don't let more than one widget handle mouseStart 10076 if ( mouseHandled ) { 10077 return; 10078 } 10079 10080 this._mouseMoved = false; 10081 10082 // We may have missed mouseup (out of window) 10083 if ( this._mouseStarted ) { 10084 this._mouseUp( event ); 10085 } 10086 10087 this._mouseDownEvent = event; 10088 10089 var that = this, 10090 btnIsLeft = ( event.which === 1 ), 10091 10092 // event.target.nodeName works around a bug in IE 8 with 10093 // disabled inputs (#7620) 10094 elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ? 10095 $( event.target ).closest( this.options.cancel ).length : false ); 10096 if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) { 10097 return true; 10098 } 10099 10100 this.mouseDelayMet = !this.options.delay; 10101 if ( !this.mouseDelayMet ) { 10102 this._mouseDelayTimer = setTimeout( function() { 10103 that.mouseDelayMet = true; 10104 }, this.options.delay ); 10105 } 10106 10107 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 10108 this._mouseStarted = ( this._mouseStart( event ) !== false ); 10109 if ( !this._mouseStarted ) { 10110 event.preventDefault(); 10111 return true; 10112 } 10113 } 10114 10115 // Click event may never have fired (Gecko & Opera) 10116 if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) { 10117 $.removeData( event.target, this.widgetName + ".preventClickEvent" ); 10118 } 10119 10120 // These delegates are required to keep context 10121 this._mouseMoveDelegate = function( event ) { 10122 return that._mouseMove( event ); 10123 }; 10124 this._mouseUpDelegate = function( event ) { 10125 return that._mouseUp( event ); 10126 }; 10127 10128 this.document 10129 .on( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 10130 .on( "mouseup." + this.widgetName, this._mouseUpDelegate ); 10131 10132 event.preventDefault(); 10133 10134 mouseHandled = true; 10135 return true; 10136 }, 10137 10138 _mouseMove: function( event ) { 10139 10140 // Only check for mouseups outside the document if you've moved inside the document 10141 // at least once. This prevents the firing of mouseup in the case of IE<9, which will 10142 // fire a mousemove event if content is placed under the cursor. See #7778 10143 // Support: IE <9 10144 if ( this._mouseMoved ) { 10145 10146 // IE mouseup check - mouseup happened when mouse was out of window 10147 if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && 10148 !event.button ) { 10149 return this._mouseUp( event ); 10150 10151 // Iframe mouseup check - mouseup occurred in another document 10152 } else if ( !event.which ) { 10153 10154 // Support: Safari <=8 - 9 10155 // Safari sets which to 0 if you press any of the following keys 10156 // during a drag (#14461) 10157 if ( event.originalEvent.altKey || event.originalEvent.ctrlKey || 10158 event.originalEvent.metaKey || event.originalEvent.shiftKey ) { 10159 this.ignoreMissingWhich = true; 10160 } else if ( !this.ignoreMissingWhich ) { 10161 return this._mouseUp( event ); 10162 } 10163 } 10164 } 10165 10166 if ( event.which || event.button ) { 10167 this._mouseMoved = true; 10168 } 10169 10170 if ( this._mouseStarted ) { 10171 this._mouseDrag( event ); 10172 return event.preventDefault(); 10173 } 10174 10175 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 10176 this._mouseStarted = 10177 ( this._mouseStart( this._mouseDownEvent, event ) !== false ); 10178 if ( this._mouseStarted ) { 10179 this._mouseDrag( event ); 10180 } else { 10181 this._mouseUp( event ); 10182 } 10183 } 10184 10185 return !this._mouseStarted; 10186 }, 10187 10188 _mouseUp: function( event ) { 10189 this.document 10190 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 10191 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 10192 10193 if ( this._mouseStarted ) { 10194 this._mouseStarted = false; 10195 10196 if ( event.target === this._mouseDownEvent.target ) { 10197 $.data( event.target, this.widgetName + ".preventClickEvent", true ); 10198 } 10199 10200 this._mouseStop( event ); 10201 } 10202 10203 if ( this._mouseDelayTimer ) { 10204 clearTimeout( this._mouseDelayTimer ); 10205 delete this._mouseDelayTimer; 10206 } 10207 10208 this.ignoreMissingWhich = false; 10209 mouseHandled = false; 10210 event.preventDefault(); 10211 }, 10212 10213 _mouseDistanceMet: function( event ) { 10214 return ( Math.max( 10215 Math.abs( this._mouseDownEvent.pageX - event.pageX ), 10216 Math.abs( this._mouseDownEvent.pageY - event.pageY ) 10217 ) >= this.options.distance 10218 ); 10219 }, 10220 10221 _mouseDelayMet: function( /* event */ ) { 10222 return this.mouseDelayMet; 10223 }, 10224 10225 // These are placeholder methods, to be overriden by extending plugin 10226 _mouseStart: function( /* event */ ) {}, 10227 _mouseDrag: function( /* event */ ) {}, 10228 _mouseStop: function( /* event */ ) {}, 10229 _mouseCapture: function( /* event */ ) { 10230 return true; 10231 } 10232} ); 10233 10234 10235 10236// $.ui.plugin is deprecated. Use $.widget() extensions instead. 10237var plugin = $.ui.plugin = { 10238 add: function( module, option, set ) { 10239 var i, 10240 proto = $.ui[ module ].prototype; 10241 for ( i in set ) { 10242 proto.plugins[ i ] = proto.plugins[ i ] || []; 10243 proto.plugins[ i ].push( [ option, set[ i ] ] ); 10244 } 10245 }, 10246 call: function( instance, name, args, allowDisconnected ) { 10247 var i, 10248 set = instance.plugins[ name ]; 10249 10250 if ( !set ) { 10251 return; 10252 } 10253 10254 if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || 10255 instance.element[ 0 ].parentNode.nodeType === 11 ) ) { 10256 return; 10257 } 10258 10259 for ( i = 0; i < set.length; i++ ) { 10260 if ( instance.options[ set[ i ][ 0 ] ] ) { 10261 set[ i ][ 1 ].apply( instance.element, args ); 10262 } 10263 } 10264 } 10265}; 10266 10267 10268 10269var safeBlur = $.ui.safeBlur = function( element ) { 10270 10271 // Support: IE9 - 10 only 10272 // If the <body> is blurred, IE will switch windows, see #9420 10273 if ( element && element.nodeName.toLowerCase() !== "body" ) { 10274 $( element ).trigger( "blur" ); 10275 } 10276}; 10277 10278 10279/*! 10280 * jQuery UI Draggable 1.13.2 10281 * http://jqueryui.com 10282 * 10283 * Copyright jQuery Foundation and other contributors 10284 * Released under the MIT license. 10285 * http://jquery.org/license 10286 */ 10287 10288//>>label: Draggable 10289//>>group: Interactions 10290//>>description: Enables dragging functionality for any element. 10291//>>docs: http://api.jqueryui.com/draggable/ 10292//>>demos: http://jqueryui.com/draggable/ 10293//>>css.structure: ../../themes/base/draggable.css 10294 10295 10296$.widget( "ui.draggable", $.ui.mouse, { 10297 version: "1.13.2", 10298 widgetEventPrefix: "drag", 10299 options: { 10300 addClasses: true, 10301 appendTo: "parent", 10302 axis: false, 10303 connectToSortable: false, 10304 containment: false, 10305 cursor: "auto", 10306 cursorAt: false, 10307 grid: false, 10308 handle: false, 10309 helper: "original", 10310 iframeFix: false, 10311 opacity: false, 10312 refreshPositions: false, 10313 revert: false, 10314 revertDuration: 500, 10315 scope: "default", 10316 scroll: true, 10317 scrollSensitivity: 20, 10318 scrollSpeed: 20, 10319 snap: false, 10320 snapMode: "both", 10321 snapTolerance: 20, 10322 stack: false, 10323 zIndex: false, 10324 10325 // Callbacks 10326 drag: null, 10327 start: null, 10328 stop: null 10329 }, 10330 _create: function() { 10331 10332 if ( this.options.helper === "original" ) { 10333 this._setPositionRelative(); 10334 } 10335 if ( this.options.addClasses ) { 10336 this._addClass( "ui-draggable" ); 10337 } 10338 this._setHandleClassName(); 10339 10340 this._mouseInit(); 10341 }, 10342 10343 _setOption: function( key, value ) { 10344 this._super( key, value ); 10345 if ( key === "handle" ) { 10346 this._removeHandleClassName(); 10347 this._setHandleClassName(); 10348 } 10349 }, 10350 10351 _destroy: function() { 10352 if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { 10353 this.destroyOnClear = true; 10354 return; 10355 } 10356 this._removeHandleClassName(); 10357 this._mouseDestroy(); 10358 }, 10359 10360 _mouseCapture: function( event ) { 10361 var o = this.options; 10362 10363 // Among others, prevent a drag on a resizable-handle 10364 if ( this.helper || o.disabled || 10365 $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) { 10366 return false; 10367 } 10368 10369 //Quit if we're not on a valid handle 10370 this.handle = this._getHandle( event ); 10371 if ( !this.handle ) { 10372 return false; 10373 } 10374 10375 this._blurActiveElement( event ); 10376 10377 this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix ); 10378 10379 return true; 10380 10381 }, 10382 10383 _blockFrames: function( selector ) { 10384 this.iframeBlocks = this.document.find( selector ).map( function() { 10385 var iframe = $( this ); 10386 10387 return $( "<div>" ) 10388 .css( "position", "absolute" ) 10389 .appendTo( iframe.parent() ) 10390 .outerWidth( iframe.outerWidth() ) 10391 .outerHeight( iframe.outerHeight() ) 10392 .offset( iframe.offset() )[ 0 ]; 10393 } ); 10394 }, 10395 10396 _unblockFrames: function() { 10397 if ( this.iframeBlocks ) { 10398 this.iframeBlocks.remove(); 10399 delete this.iframeBlocks; 10400 } 10401 }, 10402 10403 _blurActiveElement: function( event ) { 10404 var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ), 10405 target = $( event.target ); 10406 10407 // Don't blur if the event occurred on an element that is within 10408 // the currently focused element 10409 // See #10527, #12472 10410 if ( target.closest( activeElement ).length ) { 10411 return; 10412 } 10413 10414 // Blur any element that currently has focus, see #4261 10415 $.ui.safeBlur( activeElement ); 10416 }, 10417 10418 _mouseStart: function( event ) { 10419 10420 var o = this.options; 10421 10422 //Create and append the visible helper 10423 this.helper = this._createHelper( event ); 10424 10425 this._addClass( this.helper, "ui-draggable-dragging" ); 10426 10427 //Cache the helper size 10428 this._cacheHelperProportions(); 10429 10430 //If ddmanager is used for droppables, set the global draggable 10431 if ( $.ui.ddmanager ) { 10432 $.ui.ddmanager.current = this; 10433 } 10434 10435 /* 10436 * - Position generation - 10437 * This block generates everything position related - it's the core of draggables. 10438 */ 10439 10440 //Cache the margins of the original element 10441 this._cacheMargins(); 10442 10443 //Store the helper's css position 10444 this.cssPosition = this.helper.css( "position" ); 10445 this.scrollParent = this.helper.scrollParent( true ); 10446 this.offsetParent = this.helper.offsetParent(); 10447 this.hasFixedAncestor = this.helper.parents().filter( function() { 10448 return $( this ).css( "position" ) === "fixed"; 10449 } ).length > 0; 10450 10451 //The element's absolute position on the page minus margins 10452 this.positionAbs = this.element.offset(); 10453 this._refreshOffsets( event ); 10454 10455 //Generate the original position 10456 this.originalPosition = this.position = this._generatePosition( event, false ); 10457 this.originalPageX = event.pageX; 10458 this.originalPageY = event.pageY; 10459 10460 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 10461 if ( o.cursorAt ) { 10462 this._adjustOffsetFromHelper( o.cursorAt ); 10463 } 10464 10465 //Set a containment if given in the options 10466 this._setContainment(); 10467 10468 //Trigger event + callbacks 10469 if ( this._trigger( "start", event ) === false ) { 10470 this._clear(); 10471 return false; 10472 } 10473 10474 //Recache the helper size 10475 this._cacheHelperProportions(); 10476 10477 //Prepare the droppable offsets 10478 if ( $.ui.ddmanager && !o.dropBehaviour ) { 10479 $.ui.ddmanager.prepareOffsets( this, event ); 10480 } 10481 10482 // Execute the drag once - this causes the helper not to be visible before getting its 10483 // correct position 10484 this._mouseDrag( event, true ); 10485 10486 // If the ddmanager is used for droppables, inform the manager that dragging has started 10487 // (see #5003) 10488 if ( $.ui.ddmanager ) { 10489 $.ui.ddmanager.dragStart( this, event ); 10490 } 10491 10492 return true; 10493 }, 10494 10495 _refreshOffsets: function( event ) { 10496 this.offset = { 10497 top: this.positionAbs.top - this.margins.top, 10498 left: this.positionAbs.left - this.margins.left, 10499 scroll: false, 10500 parent: this._getParentOffset(), 10501 relative: this._getRelativeOffset() 10502 }; 10503 10504 this.offset.click = { 10505 left: event.pageX - this.offset.left, 10506 top: event.pageY - this.offset.top 10507 }; 10508 }, 10509 10510 _mouseDrag: function( event, noPropagation ) { 10511 10512 // reset any necessary cached properties (see #5009) 10513 if ( this.hasFixedAncestor ) { 10514 this.offset.parent = this._getParentOffset(); 10515 } 10516 10517 //Compute the helpers position 10518 this.position = this._generatePosition( event, true ); 10519 this.positionAbs = this._convertPositionTo( "absolute" ); 10520 10521 //Call plugins and callbacks and use the resulting position if something is returned 10522 if ( !noPropagation ) { 10523 var ui = this._uiHash(); 10524 if ( this._trigger( "drag", event, ui ) === false ) { 10525 this._mouseUp( new $.Event( "mouseup", event ) ); 10526 return false; 10527 } 10528 this.position = ui.position; 10529 } 10530 10531 this.helper[ 0 ].style.left = this.position.left + "px"; 10532 this.helper[ 0 ].style.top = this.position.top + "px"; 10533 10534 if ( $.ui.ddmanager ) { 10535 $.ui.ddmanager.drag( this, event ); 10536 } 10537 10538 return false; 10539 }, 10540 10541 _mouseStop: function( event ) { 10542 10543 //If we are using droppables, inform the manager about the drop 10544 var that = this, 10545 dropped = false; 10546 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 10547 dropped = $.ui.ddmanager.drop( this, event ); 10548 } 10549 10550 //if a drop comes from outside (a sortable) 10551 if ( this.dropped ) { 10552 dropped = this.dropped; 10553 this.dropped = false; 10554 } 10555 10556 if ( ( this.options.revert === "invalid" && !dropped ) || 10557 ( this.options.revert === "valid" && dropped ) || 10558 this.options.revert === true || ( typeof this.options.revert === "function" && 10559 this.options.revert.call( this.element, dropped ) ) 10560 ) { 10561 $( this.helper ).animate( 10562 this.originalPosition, 10563 parseInt( this.options.revertDuration, 10 ), 10564 function() { 10565 if ( that._trigger( "stop", event ) !== false ) { 10566 that._clear(); 10567 } 10568 } 10569 ); 10570 } else { 10571 if ( this._trigger( "stop", event ) !== false ) { 10572 this._clear(); 10573 } 10574 } 10575 10576 return false; 10577 }, 10578 10579 _mouseUp: function( event ) { 10580 this._unblockFrames(); 10581 10582 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 10583 // (see #5003) 10584 if ( $.ui.ddmanager ) { 10585 $.ui.ddmanager.dragStop( this, event ); 10586 } 10587 10588 // Only need to focus if the event occurred on the draggable itself, see #10527 10589 if ( this.handleElement.is( event.target ) ) { 10590 10591 // The interaction is over; whether or not the click resulted in a drag, 10592 // focus the element 10593 this.element.trigger( "focus" ); 10594 } 10595 10596 return $.ui.mouse.prototype._mouseUp.call( this, event ); 10597 }, 10598 10599 cancel: function() { 10600 10601 if ( this.helper.is( ".ui-draggable-dragging" ) ) { 10602 this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) ); 10603 } else { 10604 this._clear(); 10605 } 10606 10607 return this; 10608 10609 }, 10610 10611 _getHandle: function( event ) { 10612 return this.options.handle ? 10613 !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : 10614 true; 10615 }, 10616 10617 _setHandleClassName: function() { 10618 this.handleElement = this.options.handle ? 10619 this.element.find( this.options.handle ) : this.element; 10620 this._addClass( this.handleElement, "ui-draggable-handle" ); 10621 }, 10622 10623 _removeHandleClassName: function() { 10624 this._removeClass( this.handleElement, "ui-draggable-handle" ); 10625 }, 10626 10627 _createHelper: function( event ) { 10628 10629 var o = this.options, 10630 helperIsFunction = typeof o.helper === "function", 10631 helper = helperIsFunction ? 10632 $( o.helper.apply( this.element[ 0 ], [ event ] ) ) : 10633 ( o.helper === "clone" ? 10634 this.element.clone().removeAttr( "id" ) : 10635 this.element ); 10636 10637 if ( !helper.parents( "body" ).length ) { 10638 helper.appendTo( ( o.appendTo === "parent" ? 10639 this.element[ 0 ].parentNode : 10640 o.appendTo ) ); 10641 } 10642 10643 // Http://bugs.jqueryui.com/ticket/9446 10644 // a helper function can return the original element 10645 // which wouldn't have been set to relative in _create 10646 if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) { 10647 this._setPositionRelative(); 10648 } 10649 10650 if ( helper[ 0 ] !== this.element[ 0 ] && 10651 !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) { 10652 helper.css( "position", "absolute" ); 10653 } 10654 10655 return helper; 10656 10657 }, 10658 10659 _setPositionRelative: function() { 10660 if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) { 10661 this.element[ 0 ].style.position = "relative"; 10662 } 10663 }, 10664 10665 _adjustOffsetFromHelper: function( obj ) { 10666 if ( typeof obj === "string" ) { 10667 obj = obj.split( " " ); 10668 } 10669 if ( Array.isArray( obj ) ) { 10670 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 10671 } 10672 if ( "left" in obj ) { 10673 this.offset.click.left = obj.left + this.margins.left; 10674 } 10675 if ( "right" in obj ) { 10676 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 10677 } 10678 if ( "top" in obj ) { 10679 this.offset.click.top = obj.top + this.margins.top; 10680 } 10681 if ( "bottom" in obj ) { 10682 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 10683 } 10684 }, 10685 10686 _isRootNode: function( element ) { 10687 return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ]; 10688 }, 10689 10690 _getParentOffset: function() { 10691 10692 //Get the offsetParent and cache its position 10693 var po = this.offsetParent.offset(), 10694 document = this.document[ 0 ]; 10695 10696 // This is a special case where we need to modify a offset calculated on start, since the 10697 // following happened: 10698 // 1. The position of the helper is absolute, so it's position is calculated based on the 10699 // next positioned parent 10700 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 10701 // the document, which means that the scroll is included in the initial calculation of the 10702 // offset of the parent, and never recalculated upon drag 10703 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document && 10704 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 10705 po.left += this.scrollParent.scrollLeft(); 10706 po.top += this.scrollParent.scrollTop(); 10707 } 10708 10709 if ( this._isRootNode( this.offsetParent[ 0 ] ) ) { 10710 po = { top: 0, left: 0 }; 10711 } 10712 10713 return { 10714 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 10715 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 10716 }; 10717 10718 }, 10719 10720 _getRelativeOffset: function() { 10721 if ( this.cssPosition !== "relative" ) { 10722 return { top: 0, left: 0 }; 10723 } 10724 10725 var p = this.element.position(), 10726 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 10727 10728 return { 10729 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 10730 ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ), 10731 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 10732 ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 ) 10733 }; 10734 10735 }, 10736 10737 _cacheMargins: function() { 10738 this.margins = { 10739 left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ), 10740 top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ), 10741 right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ), 10742 bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 ) 10743 }; 10744 }, 10745 10746 _cacheHelperProportions: function() { 10747 this.helperProportions = { 10748 width: this.helper.outerWidth(), 10749 height: this.helper.outerHeight() 10750 }; 10751 }, 10752 10753 _setContainment: function() { 10754 10755 var isUserScrollable, c, ce, 10756 o = this.options, 10757 document = this.document[ 0 ]; 10758 10759 this.relativeContainer = null; 10760 10761 if ( !o.containment ) { 10762 this.containment = null; 10763 return; 10764 } 10765 10766 if ( o.containment === "window" ) { 10767 this.containment = [ 10768 $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 10769 $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, 10770 $( window ).scrollLeft() + $( window ).width() - 10771 this.helperProportions.width - this.margins.left, 10772 $( window ).scrollTop() + 10773 ( $( window ).height() || document.body.parentNode.scrollHeight ) - 10774 this.helperProportions.height - this.margins.top 10775 ]; 10776 return; 10777 } 10778 10779 if ( o.containment === "document" ) { 10780 this.containment = [ 10781 0, 10782 0, 10783 $( document ).width() - this.helperProportions.width - this.margins.left, 10784 ( $( document ).height() || document.body.parentNode.scrollHeight ) - 10785 this.helperProportions.height - this.margins.top 10786 ]; 10787 return; 10788 } 10789 10790 if ( o.containment.constructor === Array ) { 10791 this.containment = o.containment; 10792 return; 10793 } 10794 10795 if ( o.containment === "parent" ) { 10796 o.containment = this.helper[ 0 ].parentNode; 10797 } 10798 10799 c = $( o.containment ); 10800 ce = c[ 0 ]; 10801 10802 if ( !ce ) { 10803 return; 10804 } 10805 10806 isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) ); 10807 10808 this.containment = [ 10809 ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + 10810 ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), 10811 ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + 10812 ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), 10813 ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - 10814 ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - 10815 ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - 10816 this.helperProportions.width - 10817 this.margins.left - 10818 this.margins.right, 10819 ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 10820 ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - 10821 ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - 10822 this.helperProportions.height - 10823 this.margins.top - 10824 this.margins.bottom 10825 ]; 10826 this.relativeContainer = c; 10827 }, 10828 10829 _convertPositionTo: function( d, pos ) { 10830 10831 if ( !pos ) { 10832 pos = this.position; 10833 } 10834 10835 var mod = d === "absolute" ? 1 : -1, 10836 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 10837 10838 return { 10839 top: ( 10840 10841 // The absolute mouse position 10842 pos.top + 10843 10844 // Only for relative positioned nodes: Relative offset from element to offset parent 10845 this.offset.relative.top * mod + 10846 10847 // The offsetParent's offset without borders (offset + border) 10848 this.offset.parent.top * mod - 10849 ( ( this.cssPosition === "fixed" ? 10850 -this.offset.scroll.top : 10851 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod ) 10852 ), 10853 left: ( 10854 10855 // The absolute mouse position 10856 pos.left + 10857 10858 // Only for relative positioned nodes: Relative offset from element to offset parent 10859 this.offset.relative.left * mod + 10860 10861 // The offsetParent's offset without borders (offset + border) 10862 this.offset.parent.left * mod - 10863 ( ( this.cssPosition === "fixed" ? 10864 -this.offset.scroll.left : 10865 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod ) 10866 ) 10867 }; 10868 10869 }, 10870 10871 _generatePosition: function( event, constrainPosition ) { 10872 10873 var containment, co, top, left, 10874 o = this.options, 10875 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ), 10876 pageX = event.pageX, 10877 pageY = event.pageY; 10878 10879 // Cache the scroll 10880 if ( !scrollIsRootNode || !this.offset.scroll ) { 10881 this.offset.scroll = { 10882 top: this.scrollParent.scrollTop(), 10883 left: this.scrollParent.scrollLeft() 10884 }; 10885 } 10886 10887 /* 10888 * - Position constraining - 10889 * Constrain the position to a mix of grid, containment. 10890 */ 10891 10892 // If we are not dragging yet, we won't check for options 10893 if ( constrainPosition ) { 10894 if ( this.containment ) { 10895 if ( this.relativeContainer ) { 10896 co = this.relativeContainer.offset(); 10897 containment = [ 10898 this.containment[ 0 ] + co.left, 10899 this.containment[ 1 ] + co.top, 10900 this.containment[ 2 ] + co.left, 10901 this.containment[ 3 ] + co.top 10902 ]; 10903 } else { 10904 containment = this.containment; 10905 } 10906 10907 if ( event.pageX - this.offset.click.left < containment[ 0 ] ) { 10908 pageX = containment[ 0 ] + this.offset.click.left; 10909 } 10910 if ( event.pageY - this.offset.click.top < containment[ 1 ] ) { 10911 pageY = containment[ 1 ] + this.offset.click.top; 10912 } 10913 if ( event.pageX - this.offset.click.left > containment[ 2 ] ) { 10914 pageX = containment[ 2 ] + this.offset.click.left; 10915 } 10916 if ( event.pageY - this.offset.click.top > containment[ 3 ] ) { 10917 pageY = containment[ 3 ] + this.offset.click.top; 10918 } 10919 } 10920 10921 if ( o.grid ) { 10922 10923 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 10924 // argument errors in IE (see ticket #6950) 10925 top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY - 10926 this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY; 10927 pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] || 10928 top - this.offset.click.top > containment[ 3 ] ) ? 10929 top : 10930 ( ( top - this.offset.click.top >= containment[ 1 ] ) ? 10931 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top; 10932 10933 left = o.grid[ 0 ] ? this.originalPageX + 10934 Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] : 10935 this.originalPageX; 10936 pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] || 10937 left - this.offset.click.left > containment[ 2 ] ) ? 10938 left : 10939 ( ( left - this.offset.click.left >= containment[ 0 ] ) ? 10940 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left; 10941 } 10942 10943 if ( o.axis === "y" ) { 10944 pageX = this.originalPageX; 10945 } 10946 10947 if ( o.axis === "x" ) { 10948 pageY = this.originalPageY; 10949 } 10950 } 10951 10952 return { 10953 top: ( 10954 10955 // The absolute mouse position 10956 pageY - 10957 10958 // Click offset (relative to the element) 10959 this.offset.click.top - 10960 10961 // Only for relative positioned nodes: Relative offset from element to offset parent 10962 this.offset.relative.top - 10963 10964 // The offsetParent's offset without borders (offset + border) 10965 this.offset.parent.top + 10966 ( this.cssPosition === "fixed" ? 10967 -this.offset.scroll.top : 10968 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) 10969 ), 10970 left: ( 10971 10972 // The absolute mouse position 10973 pageX - 10974 10975 // Click offset (relative to the element) 10976 this.offset.click.left - 10977 10978 // Only for relative positioned nodes: Relative offset from element to offset parent 10979 this.offset.relative.left - 10980 10981 // The offsetParent's offset without borders (offset + border) 10982 this.offset.parent.left + 10983 ( this.cssPosition === "fixed" ? 10984 -this.offset.scroll.left : 10985 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) 10986 ) 10987 }; 10988 10989 }, 10990 10991 _clear: function() { 10992 this._removeClass( this.helper, "ui-draggable-dragging" ); 10993 if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) { 10994 this.helper.remove(); 10995 } 10996 this.helper = null; 10997 this.cancelHelperRemoval = false; 10998 if ( this.destroyOnClear ) { 10999 this.destroy(); 11000 } 11001 }, 11002 11003 // From now on bulk stuff - mainly helpers 11004 11005 _trigger: function( type, event, ui ) { 11006 ui = ui || this._uiHash(); 11007 $.ui.plugin.call( this, type, [ event, ui, this ], true ); 11008 11009 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 11010 if ( /^(drag|start|stop)/.test( type ) ) { 11011 this.positionAbs = this._convertPositionTo( "absolute" ); 11012 ui.offset = this.positionAbs; 11013 } 11014 return $.Widget.prototype._trigger.call( this, type, event, ui ); 11015 }, 11016 11017 plugins: {}, 11018 11019 _uiHash: function() { 11020 return { 11021 helper: this.helper, 11022 position: this.position, 11023 originalPosition: this.originalPosition, 11024 offset: this.positionAbs 11025 }; 11026 } 11027 11028} ); 11029 11030$.ui.plugin.add( "draggable", "connectToSortable", { 11031 start: function( event, ui, draggable ) { 11032 var uiSortable = $.extend( {}, ui, { 11033 item: draggable.element 11034 } ); 11035 11036 draggable.sortables = []; 11037 $( draggable.options.connectToSortable ).each( function() { 11038 var sortable = $( this ).sortable( "instance" ); 11039 11040 if ( sortable && !sortable.options.disabled ) { 11041 draggable.sortables.push( sortable ); 11042 11043 // RefreshPositions is called at drag start to refresh the containerCache 11044 // which is used in drag. This ensures it's initialized and synchronized 11045 // with any changes that might have happened on the page since initialization. 11046 sortable.refreshPositions(); 11047 sortable._trigger( "activate", event, uiSortable ); 11048 } 11049 } ); 11050 }, 11051 stop: function( event, ui, draggable ) { 11052 var uiSortable = $.extend( {}, ui, { 11053 item: draggable.element 11054 } ); 11055 11056 draggable.cancelHelperRemoval = false; 11057 11058 $.each( draggable.sortables, function() { 11059 var sortable = this; 11060 11061 if ( sortable.isOver ) { 11062 sortable.isOver = 0; 11063 11064 // Allow this sortable to handle removing the helper 11065 draggable.cancelHelperRemoval = true; 11066 sortable.cancelHelperRemoval = false; 11067 11068 // Use _storedCSS To restore properties in the sortable, 11069 // as this also handles revert (#9675) since the draggable 11070 // may have modified them in unexpected ways (#8809) 11071 sortable._storedCSS = { 11072 position: sortable.placeholder.css( "position" ), 11073 top: sortable.placeholder.css( "top" ), 11074 left: sortable.placeholder.css( "left" ) 11075 }; 11076 11077 sortable._mouseStop( event ); 11078 11079 // Once drag has ended, the sortable should return to using 11080 // its original helper, not the shared helper from draggable 11081 sortable.options.helper = sortable.options._helper; 11082 } else { 11083 11084 // Prevent this Sortable from removing the helper. 11085 // However, don't set the draggable to remove the helper 11086 // either as another connected Sortable may yet handle the removal. 11087 sortable.cancelHelperRemoval = true; 11088 11089 sortable._trigger( "deactivate", event, uiSortable ); 11090 } 11091 } ); 11092 }, 11093 drag: function( event, ui, draggable ) { 11094 $.each( draggable.sortables, function() { 11095 var innermostIntersecting = false, 11096 sortable = this; 11097 11098 // Copy over variables that sortable's _intersectsWith uses 11099 sortable.positionAbs = draggable.positionAbs; 11100 sortable.helperProportions = draggable.helperProportions; 11101 sortable.offset.click = draggable.offset.click; 11102 11103 if ( sortable._intersectsWith( sortable.containerCache ) ) { 11104 innermostIntersecting = true; 11105 11106 $.each( draggable.sortables, function() { 11107 11108 // Copy over variables that sortable's _intersectsWith uses 11109 this.positionAbs = draggable.positionAbs; 11110 this.helperProportions = draggable.helperProportions; 11111 this.offset.click = draggable.offset.click; 11112 11113 if ( this !== sortable && 11114 this._intersectsWith( this.containerCache ) && 11115 $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) { 11116 innermostIntersecting = false; 11117 } 11118 11119 return innermostIntersecting; 11120 } ); 11121 } 11122 11123 if ( innermostIntersecting ) { 11124 11125 // If it intersects, we use a little isOver variable and set it once, 11126 // so that the move-in stuff gets fired only once. 11127 if ( !sortable.isOver ) { 11128 sortable.isOver = 1; 11129 11130 // Store draggable's parent in case we need to reappend to it later. 11131 draggable._parent = ui.helper.parent(); 11132 11133 sortable.currentItem = ui.helper 11134 .appendTo( sortable.element ) 11135 .data( "ui-sortable-item", true ); 11136 11137 // Store helper option to later restore it 11138 sortable.options._helper = sortable.options.helper; 11139 11140 sortable.options.helper = function() { 11141 return ui.helper[ 0 ]; 11142 }; 11143 11144 // Fire the start events of the sortable with our passed browser event, 11145 // and our own helper (so it doesn't create a new one) 11146 event.target = sortable.currentItem[ 0 ]; 11147 sortable._mouseCapture( event, true ); 11148 sortable._mouseStart( event, true, true ); 11149 11150 // Because the browser event is way off the new appended portlet, 11151 // modify necessary variables to reflect the changes 11152 sortable.offset.click.top = draggable.offset.click.top; 11153 sortable.offset.click.left = draggable.offset.click.left; 11154 sortable.offset.parent.left -= draggable.offset.parent.left - 11155 sortable.offset.parent.left; 11156 sortable.offset.parent.top -= draggable.offset.parent.top - 11157 sortable.offset.parent.top; 11158 11159 draggable._trigger( "toSortable", event ); 11160 11161 // Inform draggable that the helper is in a valid drop zone, 11162 // used solely in the revert option to handle "valid/invalid". 11163 draggable.dropped = sortable.element; 11164 11165 // Need to refreshPositions of all sortables in the case that 11166 // adding to one sortable changes the location of the other sortables (#9675) 11167 $.each( draggable.sortables, function() { 11168 this.refreshPositions(); 11169 } ); 11170 11171 // Hack so receive/update callbacks work (mostly) 11172 draggable.currentItem = draggable.element; 11173 sortable.fromOutside = draggable; 11174 } 11175 11176 if ( sortable.currentItem ) { 11177 sortable._mouseDrag( event ); 11178 11179 // Copy the sortable's position because the draggable's can potentially reflect 11180 // a relative position, while sortable is always absolute, which the dragged 11181 // element has now become. (#8809) 11182 ui.position = sortable.position; 11183 } 11184 } else { 11185 11186 // If it doesn't intersect with the sortable, and it intersected before, 11187 // we fake the drag stop of the sortable, but make sure it doesn't remove 11188 // the helper by using cancelHelperRemoval. 11189 if ( sortable.isOver ) { 11190 11191 sortable.isOver = 0; 11192 sortable.cancelHelperRemoval = true; 11193 11194 // Calling sortable's mouseStop would trigger a revert, 11195 // so revert must be temporarily false until after mouseStop is called. 11196 sortable.options._revert = sortable.options.revert; 11197 sortable.options.revert = false; 11198 11199 sortable._trigger( "out", event, sortable._uiHash( sortable ) ); 11200 sortable._mouseStop( event, true ); 11201 11202 // Restore sortable behaviors that were modfied 11203 // when the draggable entered the sortable area (#9481) 11204 sortable.options.revert = sortable.options._revert; 11205 sortable.options.helper = sortable.options._helper; 11206 11207 if ( sortable.placeholder ) { 11208 sortable.placeholder.remove(); 11209 } 11210 11211 // Restore and recalculate the draggable's offset considering the sortable 11212 // may have modified them in unexpected ways. (#8809, #10669) 11213 ui.helper.appendTo( draggable._parent ); 11214 draggable._refreshOffsets( event ); 11215 ui.position = draggable._generatePosition( event, true ); 11216 11217 draggable._trigger( "fromSortable", event ); 11218 11219 // Inform draggable that the helper is no longer in a valid drop zone 11220 draggable.dropped = false; 11221 11222 // Need to refreshPositions of all sortables just in case removing 11223 // from one sortable changes the location of other sortables (#9675) 11224 $.each( draggable.sortables, function() { 11225 this.refreshPositions(); 11226 } ); 11227 } 11228 } 11229 } ); 11230 } 11231} ); 11232 11233$.ui.plugin.add( "draggable", "cursor", { 11234 start: function( event, ui, instance ) { 11235 var t = $( "body" ), 11236 o = instance.options; 11237 11238 if ( t.css( "cursor" ) ) { 11239 o._cursor = t.css( "cursor" ); 11240 } 11241 t.css( "cursor", o.cursor ); 11242 }, 11243 stop: function( event, ui, instance ) { 11244 var o = instance.options; 11245 if ( o._cursor ) { 11246 $( "body" ).css( "cursor", o._cursor ); 11247 } 11248 } 11249} ); 11250 11251$.ui.plugin.add( "draggable", "opacity", { 11252 start: function( event, ui, instance ) { 11253 var t = $( ui.helper ), 11254 o = instance.options; 11255 if ( t.css( "opacity" ) ) { 11256 o._opacity = t.css( "opacity" ); 11257 } 11258 t.css( "opacity", o.opacity ); 11259 }, 11260 stop: function( event, ui, instance ) { 11261 var o = instance.options; 11262 if ( o._opacity ) { 11263 $( ui.helper ).css( "opacity", o._opacity ); 11264 } 11265 } 11266} ); 11267 11268$.ui.plugin.add( "draggable", "scroll", { 11269 start: function( event, ui, i ) { 11270 if ( !i.scrollParentNotHidden ) { 11271 i.scrollParentNotHidden = i.helper.scrollParent( false ); 11272 } 11273 11274 if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && 11275 i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { 11276 i.overflowOffset = i.scrollParentNotHidden.offset(); 11277 } 11278 }, 11279 drag: function( event, ui, i ) { 11280 11281 var o = i.options, 11282 scrolled = false, 11283 scrollParent = i.scrollParentNotHidden[ 0 ], 11284 document = i.document[ 0 ]; 11285 11286 if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { 11287 if ( !o.axis || o.axis !== "x" ) { 11288 if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < 11289 o.scrollSensitivity ) { 11290 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 11291 } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { 11292 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 11293 } 11294 } 11295 11296 if ( !o.axis || o.axis !== "y" ) { 11297 if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < 11298 o.scrollSensitivity ) { 11299 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 11300 } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { 11301 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 11302 } 11303 } 11304 11305 } else { 11306 11307 if ( !o.axis || o.axis !== "x" ) { 11308 if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) { 11309 scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed ); 11310 } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) < 11311 o.scrollSensitivity ) { 11312 scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed ); 11313 } 11314 } 11315 11316 if ( !o.axis || o.axis !== "y" ) { 11317 if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) { 11318 scrolled = $( document ).scrollLeft( 11319 $( document ).scrollLeft() - o.scrollSpeed 11320 ); 11321 } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) < 11322 o.scrollSensitivity ) { 11323 scrolled = $( document ).scrollLeft( 11324 $( document ).scrollLeft() + o.scrollSpeed 11325 ); 11326 } 11327 } 11328 11329 } 11330 11331 if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) { 11332 $.ui.ddmanager.prepareOffsets( i, event ); 11333 } 11334 11335 } 11336} ); 11337 11338$.ui.plugin.add( "draggable", "snap", { 11339 start: function( event, ui, i ) { 11340 11341 var o = i.options; 11342 11343 i.snapElements = []; 11344 11345 $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap ) 11346 .each( function() { 11347 var $t = $( this ), 11348 $o = $t.offset(); 11349 if ( this !== i.element[ 0 ] ) { 11350 i.snapElements.push( { 11351 item: this, 11352 width: $t.outerWidth(), height: $t.outerHeight(), 11353 top: $o.top, left: $o.left 11354 } ); 11355 } 11356 } ); 11357 11358 }, 11359 drag: function( event, ui, inst ) { 11360 11361 var ts, bs, ls, rs, l, r, t, b, i, first, 11362 o = inst.options, 11363 d = o.snapTolerance, 11364 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 11365 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 11366 11367 for ( i = inst.snapElements.length - 1; i >= 0; i-- ) { 11368 11369 l = inst.snapElements[ i ].left - inst.margins.left; 11370 r = l + inst.snapElements[ i ].width; 11371 t = inst.snapElements[ i ].top - inst.margins.top; 11372 b = t + inst.snapElements[ i ].height; 11373 11374 if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 11375 !$.contains( inst.snapElements[ i ].item.ownerDocument, 11376 inst.snapElements[ i ].item ) ) { 11377 if ( inst.snapElements[ i ].snapping ) { 11378 if ( inst.options.snap.release ) { 11379 inst.options.snap.release.call( 11380 inst.element, 11381 event, 11382 $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } ) 11383 ); 11384 } 11385 } 11386 inst.snapElements[ i ].snapping = false; 11387 continue; 11388 } 11389 11390 if ( o.snapMode !== "inner" ) { 11391 ts = Math.abs( t - y2 ) <= d; 11392 bs = Math.abs( b - y1 ) <= d; 11393 ls = Math.abs( l - x2 ) <= d; 11394 rs = Math.abs( r - x1 ) <= d; 11395 if ( ts ) { 11396 ui.position.top = inst._convertPositionTo( "relative", { 11397 top: t - inst.helperProportions.height, 11398 left: 0 11399 } ).top; 11400 } 11401 if ( bs ) { 11402 ui.position.top = inst._convertPositionTo( "relative", { 11403 top: b, 11404 left: 0 11405 } ).top; 11406 } 11407 if ( ls ) { 11408 ui.position.left = inst._convertPositionTo( "relative", { 11409 top: 0, 11410 left: l - inst.helperProportions.width 11411 } ).left; 11412 } 11413 if ( rs ) { 11414 ui.position.left = inst._convertPositionTo( "relative", { 11415 top: 0, 11416 left: r 11417 } ).left; 11418 } 11419 } 11420 11421 first = ( ts || bs || ls || rs ); 11422 11423 if ( o.snapMode !== "outer" ) { 11424 ts = Math.abs( t - y1 ) <= d; 11425 bs = Math.abs( b - y2 ) <= d; 11426 ls = Math.abs( l - x1 ) <= d; 11427 rs = Math.abs( r - x2 ) <= d; 11428 if ( ts ) { 11429 ui.position.top = inst._convertPositionTo( "relative", { 11430 top: t, 11431 left: 0 11432 } ).top; 11433 } 11434 if ( bs ) { 11435 ui.position.top = inst._convertPositionTo( "relative", { 11436 top: b - inst.helperProportions.height, 11437 left: 0 11438 } ).top; 11439 } 11440 if ( ls ) { 11441 ui.position.left = inst._convertPositionTo( "relative", { 11442 top: 0, 11443 left: l 11444 } ).left; 11445 } 11446 if ( rs ) { 11447 ui.position.left = inst._convertPositionTo( "relative", { 11448 top: 0, 11449 left: r - inst.helperProportions.width 11450 } ).left; 11451 } 11452 } 11453 11454 if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) { 11455 if ( inst.options.snap.snap ) { 11456 inst.options.snap.snap.call( 11457 inst.element, 11458 event, 11459 $.extend( inst._uiHash(), { 11460 snapItem: inst.snapElements[ i ].item 11461 } ) ); 11462 } 11463 } 11464 inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first ); 11465 11466 } 11467 11468 } 11469} ); 11470 11471$.ui.plugin.add( "draggable", "stack", { 11472 start: function( event, ui, instance ) { 11473 var min, 11474 o = instance.options, 11475 group = $.makeArray( $( o.stack ) ).sort( function( a, b ) { 11476 return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) - 11477 ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 ); 11478 } ); 11479 11480 if ( !group.length ) { 11481 return; 11482 } 11483 11484 min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0; 11485 $( group ).each( function( i ) { 11486 $( this ).css( "zIndex", min + i ); 11487 } ); 11488 this.css( "zIndex", ( min + group.length ) ); 11489 } 11490} ); 11491 11492$.ui.plugin.add( "draggable", "zIndex", { 11493 start: function( event, ui, instance ) { 11494 var t = $( ui.helper ), 11495 o = instance.options; 11496 11497 if ( t.css( "zIndex" ) ) { 11498 o._zIndex = t.css( "zIndex" ); 11499 } 11500 t.css( "zIndex", o.zIndex ); 11501 }, 11502 stop: function( event, ui, instance ) { 11503 var o = instance.options; 11504 11505 if ( o._zIndex ) { 11506 $( ui.helper ).css( "zIndex", o._zIndex ); 11507 } 11508 } 11509} ); 11510 11511var widgetsDraggable = $.ui.draggable; 11512 11513 11514/*! 11515 * jQuery UI Resizable 1.13.2 11516 * http://jqueryui.com 11517 * 11518 * Copyright jQuery Foundation and other contributors 11519 * Released under the MIT license. 11520 * http://jquery.org/license 11521 */ 11522 11523//>>label: Resizable 11524//>>group: Interactions 11525//>>description: Enables resize functionality for any element. 11526//>>docs: http://api.jqueryui.com/resizable/ 11527//>>demos: http://jqueryui.com/resizable/ 11528//>>css.structure: ../../themes/base/core.css 11529//>>css.structure: ../../themes/base/resizable.css 11530//>>css.theme: ../../themes/base/theme.css 11531 11532 11533$.widget( "ui.resizable", $.ui.mouse, { 11534 version: "1.13.2", 11535 widgetEventPrefix: "resize", 11536 options: { 11537 alsoResize: false, 11538 animate: false, 11539 animateDuration: "slow", 11540 animateEasing: "swing", 11541 aspectRatio: false, 11542 autoHide: false, 11543 classes: { 11544 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" 11545 }, 11546 containment: false, 11547 ghost: false, 11548 grid: false, 11549 handles: "e,s,se", 11550 helper: false, 11551 maxHeight: null, 11552 maxWidth: null, 11553 minHeight: 10, 11554 minWidth: 10, 11555 11556 // See #7960 11557 zIndex: 90, 11558 11559 // Callbacks 11560 resize: null, 11561 start: null, 11562 stop: null 11563 }, 11564 11565 _num: function( value ) { 11566 return parseFloat( value ) || 0; 11567 }, 11568 11569 _isNumber: function( value ) { 11570 return !isNaN( parseFloat( value ) ); 11571 }, 11572 11573 _hasScroll: function( el, a ) { 11574 11575 if ( $( el ).css( "overflow" ) === "hidden" ) { 11576 return false; 11577 } 11578 11579 var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", 11580 has = false; 11581 11582 if ( el[ scroll ] > 0 ) { 11583 return true; 11584 } 11585 11586 // TODO: determine which cases actually cause this to happen 11587 // if the element doesn't have the scroll set, see if it's possible to 11588 // set the scroll 11589 try { 11590 el[ scroll ] = 1; 11591 has = ( el[ scroll ] > 0 ); 11592 el[ scroll ] = 0; 11593 } catch ( e ) { 11594 11595 // `el` might be a string, then setting `scroll` will throw 11596 // an error in strict mode; ignore it. 11597 } 11598 return has; 11599 }, 11600 11601 _create: function() { 11602 11603 var margins, 11604 o = this.options, 11605 that = this; 11606 this._addClass( "ui-resizable" ); 11607 11608 $.extend( this, { 11609 _aspectRatio: !!( o.aspectRatio ), 11610 aspectRatio: o.aspectRatio, 11611 originalElement: this.element, 11612 _proportionallyResizeElements: [], 11613 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 11614 } ); 11615 11616 // Wrap the element if it cannot hold child nodes 11617 if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) { 11618 11619 this.element.wrap( 11620 $( "<div class='ui-wrapper'></div>" ).css( { 11621 overflow: "hidden", 11622 position: this.element.css( "position" ), 11623 width: this.element.outerWidth(), 11624 height: this.element.outerHeight(), 11625 top: this.element.css( "top" ), 11626 left: this.element.css( "left" ) 11627 } ) 11628 ); 11629 11630 this.element = this.element.parent().data( 11631 "ui-resizable", this.element.resizable( "instance" ) 11632 ); 11633 11634 this.elementIsWrapper = true; 11635 11636 margins = { 11637 marginTop: this.originalElement.css( "marginTop" ), 11638 marginRight: this.originalElement.css( "marginRight" ), 11639 marginBottom: this.originalElement.css( "marginBottom" ), 11640 marginLeft: this.originalElement.css( "marginLeft" ) 11641 }; 11642 11643 this.element.css( margins ); 11644 this.originalElement.css( "margin", 0 ); 11645 11646 // support: Safari 11647 // Prevent Safari textarea resize 11648 this.originalResizeStyle = this.originalElement.css( "resize" ); 11649 this.originalElement.css( "resize", "none" ); 11650 11651 this._proportionallyResizeElements.push( this.originalElement.css( { 11652 position: "static", 11653 zoom: 1, 11654 display: "block" 11655 } ) ); 11656 11657 // Support: IE9 11658 // avoid IE jump (hard set the margin) 11659 this.originalElement.css( margins ); 11660 11661 this._proportionallyResize(); 11662 } 11663 11664 this._setupHandles(); 11665 11666 if ( o.autoHide ) { 11667 $( this.element ) 11668 .on( "mouseenter", function() { 11669 if ( o.disabled ) { 11670 return; 11671 } 11672 that._removeClass( "ui-resizable-autohide" ); 11673 that._handles.show(); 11674 } ) 11675 .on( "mouseleave", function() { 11676 if ( o.disabled ) { 11677 return; 11678 } 11679 if ( !that.resizing ) { 11680 that._addClass( "ui-resizable-autohide" ); 11681 that._handles.hide(); 11682 } 11683 } ); 11684 } 11685 11686 this._mouseInit(); 11687 }, 11688 11689 _destroy: function() { 11690 11691 this._mouseDestroy(); 11692 this._addedHandles.remove(); 11693 11694 var wrapper, 11695 _destroy = function( exp ) { 11696 $( exp ) 11697 .removeData( "resizable" ) 11698 .removeData( "ui-resizable" ) 11699 .off( ".resizable" ); 11700 }; 11701 11702 // TODO: Unwrap at same DOM position 11703 if ( this.elementIsWrapper ) { 11704 _destroy( this.element ); 11705 wrapper = this.element; 11706 this.originalElement.css( { 11707 position: wrapper.css( "position" ), 11708 width: wrapper.outerWidth(), 11709 height: wrapper.outerHeight(), 11710 top: wrapper.css( "top" ), 11711 left: wrapper.css( "left" ) 11712 } ).insertAfter( wrapper ); 11713 wrapper.remove(); 11714 } 11715 11716 this.originalElement.css( "resize", this.originalResizeStyle ); 11717 _destroy( this.originalElement ); 11718 11719 return this; 11720 }, 11721 11722 _setOption: function( key, value ) { 11723 this._super( key, value ); 11724 11725 switch ( key ) { 11726 case "handles": 11727 this._removeHandles(); 11728 this._setupHandles(); 11729 break; 11730 case "aspectRatio": 11731 this._aspectRatio = !!value; 11732 break; 11733 default: 11734 break; 11735 } 11736 }, 11737 11738 _setupHandles: function() { 11739 var o = this.options, handle, i, n, hname, axis, that = this; 11740 this.handles = o.handles || 11741 ( !$( ".ui-resizable-handle", this.element ).length ? 11742 "e,s,se" : { 11743 n: ".ui-resizable-n", 11744 e: ".ui-resizable-e", 11745 s: ".ui-resizable-s", 11746 w: ".ui-resizable-w", 11747 se: ".ui-resizable-se", 11748 sw: ".ui-resizable-sw", 11749 ne: ".ui-resizable-ne", 11750 nw: ".ui-resizable-nw" 11751 } ); 11752 11753 this._handles = $(); 11754 this._addedHandles = $(); 11755 if ( this.handles.constructor === String ) { 11756 11757 if ( this.handles === "all" ) { 11758 this.handles = "n,e,s,w,se,sw,ne,nw"; 11759 } 11760 11761 n = this.handles.split( "," ); 11762 this.handles = {}; 11763 11764 for ( i = 0; i < n.length; i++ ) { 11765 11766 handle = String.prototype.trim.call( n[ i ] ); 11767 hname = "ui-resizable-" + handle; 11768 axis = $( "<div>" ); 11769 this._addClass( axis, "ui-resizable-handle " + hname ); 11770 11771 axis.css( { zIndex: o.zIndex } ); 11772 11773 this.handles[ handle ] = ".ui-resizable-" + handle; 11774 if ( !this.element.children( this.handles[ handle ] ).length ) { 11775 this.element.append( axis ); 11776 this._addedHandles = this._addedHandles.add( axis ); 11777 } 11778 } 11779 11780 } 11781 11782 this._renderAxis = function( target ) { 11783 11784 var i, axis, padPos, padWrapper; 11785 11786 target = target || this.element; 11787 11788 for ( i in this.handles ) { 11789 11790 if ( this.handles[ i ].constructor === String ) { 11791 this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show(); 11792 } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) { 11793 this.handles[ i ] = $( this.handles[ i ] ); 11794 this._on( this.handles[ i ], { "mousedown": that._mouseDown } ); 11795 } 11796 11797 if ( this.elementIsWrapper && 11798 this.originalElement[ 0 ] 11799 .nodeName 11800 .match( /^(textarea|input|select|button)$/i ) ) { 11801 axis = $( this.handles[ i ], this.element ); 11802 11803 padWrapper = /sw|ne|nw|se|n|s/.test( i ) ? 11804 axis.outerHeight() : 11805 axis.outerWidth(); 11806 11807 padPos = [ "padding", 11808 /ne|nw|n/.test( i ) ? "Top" : 11809 /se|sw|s/.test( i ) ? "Bottom" : 11810 /^e$/.test( i ) ? "Right" : "Left" ].join( "" ); 11811 11812 target.css( padPos, padWrapper ); 11813 11814 this._proportionallyResize(); 11815 } 11816 11817 this._handles = this._handles.add( this.handles[ i ] ); 11818 } 11819 }; 11820 11821 // TODO: make renderAxis a prototype function 11822 this._renderAxis( this.element ); 11823 11824 this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) ); 11825 this._handles.disableSelection(); 11826 11827 this._handles.on( "mouseover", function() { 11828 if ( !that.resizing ) { 11829 if ( this.className ) { 11830 axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i ); 11831 } 11832 that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se"; 11833 } 11834 } ); 11835 11836 if ( o.autoHide ) { 11837 this._handles.hide(); 11838 this._addClass( "ui-resizable-autohide" ); 11839 } 11840 }, 11841 11842 _removeHandles: function() { 11843 this._addedHandles.remove(); 11844 }, 11845 11846 _mouseCapture: function( event ) { 11847 var i, handle, 11848 capture = false; 11849 11850 for ( i in this.handles ) { 11851 handle = $( this.handles[ i ] )[ 0 ]; 11852 if ( handle === event.target || $.contains( handle, event.target ) ) { 11853 capture = true; 11854 } 11855 } 11856 11857 return !this.options.disabled && capture; 11858 }, 11859 11860 _mouseStart: function( event ) { 11861 11862 var curleft, curtop, cursor, 11863 o = this.options, 11864 el = this.element; 11865 11866 this.resizing = true; 11867 11868 this._renderProxy(); 11869 11870 curleft = this._num( this.helper.css( "left" ) ); 11871 curtop = this._num( this.helper.css( "top" ) ); 11872 11873 if ( o.containment ) { 11874 curleft += $( o.containment ).scrollLeft() || 0; 11875 curtop += $( o.containment ).scrollTop() || 0; 11876 } 11877 11878 this.offset = this.helper.offset(); 11879 this.position = { left: curleft, top: curtop }; 11880 11881 this.size = this._helper ? { 11882 width: this.helper.width(), 11883 height: this.helper.height() 11884 } : { 11885 width: el.width(), 11886 height: el.height() 11887 }; 11888 11889 this.originalSize = this._helper ? { 11890 width: el.outerWidth(), 11891 height: el.outerHeight() 11892 } : { 11893 width: el.width(), 11894 height: el.height() 11895 }; 11896 11897 this.sizeDiff = { 11898 width: el.outerWidth() - el.width(), 11899 height: el.outerHeight() - el.height() 11900 }; 11901 11902 this.originalPosition = { left: curleft, top: curtop }; 11903 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 11904 11905 this.aspectRatio = ( typeof o.aspectRatio === "number" ) ? 11906 o.aspectRatio : 11907 ( ( this.originalSize.width / this.originalSize.height ) || 1 ); 11908 11909 cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" ); 11910 $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor ); 11911 11912 this._addClass( "ui-resizable-resizing" ); 11913 this._propagate( "start", event ); 11914 return true; 11915 }, 11916 11917 _mouseDrag: function( event ) { 11918 11919 var data, props, 11920 smp = this.originalMousePosition, 11921 a = this.axis, 11922 dx = ( event.pageX - smp.left ) || 0, 11923 dy = ( event.pageY - smp.top ) || 0, 11924 trigger = this._change[ a ]; 11925 11926 this._updatePrevProperties(); 11927 11928 if ( !trigger ) { 11929 return false; 11930 } 11931 11932 data = trigger.apply( this, [ event, dx, dy ] ); 11933 11934 this._updateVirtualBoundaries( event.shiftKey ); 11935 if ( this._aspectRatio || event.shiftKey ) { 11936 data = this._updateRatio( data, event ); 11937 } 11938 11939 data = this._respectSize( data, event ); 11940 11941 this._updateCache( data ); 11942 11943 this._propagate( "resize", event ); 11944 11945 props = this._applyChanges(); 11946 11947 if ( !this._helper && this._proportionallyResizeElements.length ) { 11948 this._proportionallyResize(); 11949 } 11950 11951 if ( !$.isEmptyObject( props ) ) { 11952 this._updatePrevProperties(); 11953 this._trigger( "resize", event, this.ui() ); 11954 this._applyChanges(); 11955 } 11956 11957 return false; 11958 }, 11959 11960 _mouseStop: function( event ) { 11961 11962 this.resizing = false; 11963 var pr, ista, soffseth, soffsetw, s, left, top, 11964 o = this.options, that = this; 11965 11966 if ( this._helper ) { 11967 11968 pr = this._proportionallyResizeElements; 11969 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ); 11970 soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height; 11971 soffsetw = ista ? 0 : that.sizeDiff.width; 11972 11973 s = { 11974 width: ( that.helper.width() - soffsetw ), 11975 height: ( that.helper.height() - soffseth ) 11976 }; 11977 left = ( parseFloat( that.element.css( "left" ) ) + 11978 ( that.position.left - that.originalPosition.left ) ) || null; 11979 top = ( parseFloat( that.element.css( "top" ) ) + 11980 ( that.position.top - that.originalPosition.top ) ) || null; 11981 11982 if ( !o.animate ) { 11983 this.element.css( $.extend( s, { top: top, left: left } ) ); 11984 } 11985 11986 that.helper.height( that.size.height ); 11987 that.helper.width( that.size.width ); 11988 11989 if ( this._helper && !o.animate ) { 11990 this._proportionallyResize(); 11991 } 11992 } 11993 11994 $( "body" ).css( "cursor", "auto" ); 11995 11996 this._removeClass( "ui-resizable-resizing" ); 11997 11998 this._propagate( "stop", event ); 11999 12000 if ( this._helper ) { 12001 this.helper.remove(); 12002 } 12003 12004 return false; 12005 12006 }, 12007 12008 _updatePrevProperties: function() { 12009 this.prevPosition = { 12010 top: this.position.top, 12011 left: this.position.left 12012 }; 12013 this.prevSize = { 12014 width: this.size.width, 12015 height: this.size.height 12016 }; 12017 }, 12018 12019 _applyChanges: function() { 12020 var props = {}; 12021 12022 if ( this.position.top !== this.prevPosition.top ) { 12023 props.top = this.position.top + "px"; 12024 } 12025 if ( this.position.left !== this.prevPosition.left ) { 12026 props.left = this.position.left + "px"; 12027 } 12028 if ( this.size.width !== this.prevSize.width ) { 12029 props.width = this.size.width + "px"; 12030 } 12031 if ( this.size.height !== this.prevSize.height ) { 12032 props.height = this.size.height + "px"; 12033 } 12034 12035 this.helper.css( props ); 12036 12037 return props; 12038 }, 12039 12040 _updateVirtualBoundaries: function( forceAspectRatio ) { 12041 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 12042 o = this.options; 12043 12044 b = { 12045 minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0, 12046 maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity, 12047 minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0, 12048 maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity 12049 }; 12050 12051 if ( this._aspectRatio || forceAspectRatio ) { 12052 pMinWidth = b.minHeight * this.aspectRatio; 12053 pMinHeight = b.minWidth / this.aspectRatio; 12054 pMaxWidth = b.maxHeight * this.aspectRatio; 12055 pMaxHeight = b.maxWidth / this.aspectRatio; 12056 12057 if ( pMinWidth > b.minWidth ) { 12058 b.minWidth = pMinWidth; 12059 } 12060 if ( pMinHeight > b.minHeight ) { 12061 b.minHeight = pMinHeight; 12062 } 12063 if ( pMaxWidth < b.maxWidth ) { 12064 b.maxWidth = pMaxWidth; 12065 } 12066 if ( pMaxHeight < b.maxHeight ) { 12067 b.maxHeight = pMaxHeight; 12068 } 12069 } 12070 this._vBoundaries = b; 12071 }, 12072 12073 _updateCache: function( data ) { 12074 this.offset = this.helper.offset(); 12075 if ( this._isNumber( data.left ) ) { 12076 this.position.left = data.left; 12077 } 12078 if ( this._isNumber( data.top ) ) { 12079 this.position.top = data.top; 12080 } 12081 if ( this._isNumber( data.height ) ) { 12082 this.size.height = data.height; 12083 } 12084 if ( this._isNumber( data.width ) ) { 12085 this.size.width = data.width; 12086 } 12087 }, 12088 12089 _updateRatio: function( data ) { 12090 12091 var cpos = this.position, 12092 csize = this.size, 12093 a = this.axis; 12094 12095 if ( this._isNumber( data.height ) ) { 12096 data.width = ( data.height * this.aspectRatio ); 12097 } else if ( this._isNumber( data.width ) ) { 12098 data.height = ( data.width / this.aspectRatio ); 12099 } 12100 12101 if ( a === "sw" ) { 12102 data.left = cpos.left + ( csize.width - data.width ); 12103 data.top = null; 12104 } 12105 if ( a === "nw" ) { 12106 data.top = cpos.top + ( csize.height - data.height ); 12107 data.left = cpos.left + ( csize.width - data.width ); 12108 } 12109 12110 return data; 12111 }, 12112 12113 _respectSize: function( data ) { 12114 12115 var o = this._vBoundaries, 12116 a = this.axis, 12117 ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ), 12118 ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ), 12119 isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ), 12120 isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ), 12121 dw = this.originalPosition.left + this.originalSize.width, 12122 dh = this.originalPosition.top + this.originalSize.height, 12123 cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a ); 12124 if ( isminw ) { 12125 data.width = o.minWidth; 12126 } 12127 if ( isminh ) { 12128 data.height = o.minHeight; 12129 } 12130 if ( ismaxw ) { 12131 data.width = o.maxWidth; 12132 } 12133 if ( ismaxh ) { 12134 data.height = o.maxHeight; 12135 } 12136 12137 if ( isminw && cw ) { 12138 data.left = dw - o.minWidth; 12139 } 12140 if ( ismaxw && cw ) { 12141 data.left = dw - o.maxWidth; 12142 } 12143 if ( isminh && ch ) { 12144 data.top = dh - o.minHeight; 12145 } 12146 if ( ismaxh && ch ) { 12147 data.top = dh - o.maxHeight; 12148 } 12149 12150 // Fixing jump error on top/left - bug #2330 12151 if ( !data.width && !data.height && !data.left && data.top ) { 12152 data.top = null; 12153 } else if ( !data.width && !data.height && !data.top && data.left ) { 12154 data.left = null; 12155 } 12156 12157 return data; 12158 }, 12159 12160 _getPaddingPlusBorderDimensions: function( element ) { 12161 var i = 0, 12162 widths = [], 12163 borders = [ 12164 element.css( "borderTopWidth" ), 12165 element.css( "borderRightWidth" ), 12166 element.css( "borderBottomWidth" ), 12167 element.css( "borderLeftWidth" ) 12168 ], 12169 paddings = [ 12170 element.css( "paddingTop" ), 12171 element.css( "paddingRight" ), 12172 element.css( "paddingBottom" ), 12173 element.css( "paddingLeft" ) 12174 ]; 12175 12176 for ( ; i < 4; i++ ) { 12177 widths[ i ] = ( parseFloat( borders[ i ] ) || 0 ); 12178 widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 ); 12179 } 12180 12181 return { 12182 height: widths[ 0 ] + widths[ 2 ], 12183 width: widths[ 1 ] + widths[ 3 ] 12184 }; 12185 }, 12186 12187 _proportionallyResize: function() { 12188 12189 if ( !this._proportionallyResizeElements.length ) { 12190 return; 12191 } 12192 12193 var prel, 12194 i = 0, 12195 element = this.helper || this.element; 12196 12197 for ( ; i < this._proportionallyResizeElements.length; i++ ) { 12198 12199 prel = this._proportionallyResizeElements[ i ]; 12200 12201 // TODO: Seems like a bug to cache this.outerDimensions 12202 // considering that we are in a loop. 12203 if ( !this.outerDimensions ) { 12204 this.outerDimensions = this._getPaddingPlusBorderDimensions( prel ); 12205 } 12206 12207 prel.css( { 12208 height: ( element.height() - this.outerDimensions.height ) || 0, 12209 width: ( element.width() - this.outerDimensions.width ) || 0 12210 } ); 12211 12212 } 12213 12214 }, 12215 12216 _renderProxy: function() { 12217 12218 var el = this.element, o = this.options; 12219 this.elementOffset = el.offset(); 12220 12221 if ( this._helper ) { 12222 12223 this.helper = this.helper || $( "<div></div>" ).css( { overflow: "hidden" } ); 12224 12225 this._addClass( this.helper, this._helper ); 12226 this.helper.css( { 12227 width: this.element.outerWidth(), 12228 height: this.element.outerHeight(), 12229 position: "absolute", 12230 left: this.elementOffset.left + "px", 12231 top: this.elementOffset.top + "px", 12232 zIndex: ++o.zIndex //TODO: Don't modify option 12233 } ); 12234 12235 this.helper 12236 .appendTo( "body" ) 12237 .disableSelection(); 12238 12239 } else { 12240 this.helper = this.element; 12241 } 12242 12243 }, 12244 12245 _change: { 12246 e: function( event, dx ) { 12247 return { width: this.originalSize.width + dx }; 12248 }, 12249 w: function( event, dx ) { 12250 var cs = this.originalSize, sp = this.originalPosition; 12251 return { left: sp.left + dx, width: cs.width - dx }; 12252 }, 12253 n: function( event, dx, dy ) { 12254 var cs = this.originalSize, sp = this.originalPosition; 12255 return { top: sp.top + dy, height: cs.height - dy }; 12256 }, 12257 s: function( event, dx, dy ) { 12258 return { height: this.originalSize.height + dy }; 12259 }, 12260 se: function( event, dx, dy ) { 12261 return $.extend( this._change.s.apply( this, arguments ), 12262 this._change.e.apply( this, [ event, dx, dy ] ) ); 12263 }, 12264 sw: function( event, dx, dy ) { 12265 return $.extend( this._change.s.apply( this, arguments ), 12266 this._change.w.apply( this, [ event, dx, dy ] ) ); 12267 }, 12268 ne: function( event, dx, dy ) { 12269 return $.extend( this._change.n.apply( this, arguments ), 12270 this._change.e.apply( this, [ event, dx, dy ] ) ); 12271 }, 12272 nw: function( event, dx, dy ) { 12273 return $.extend( this._change.n.apply( this, arguments ), 12274 this._change.w.apply( this, [ event, dx, dy ] ) ); 12275 } 12276 }, 12277 12278 _propagate: function( n, event ) { 12279 $.ui.plugin.call( this, n, [ event, this.ui() ] ); 12280 if ( n !== "resize" ) { 12281 this._trigger( n, event, this.ui() ); 12282 } 12283 }, 12284 12285 plugins: {}, 12286 12287 ui: function() { 12288 return { 12289 originalElement: this.originalElement, 12290 element: this.element, 12291 helper: this.helper, 12292 position: this.position, 12293 size: this.size, 12294 originalSize: this.originalSize, 12295 originalPosition: this.originalPosition 12296 }; 12297 } 12298 12299} ); 12300 12301/* 12302 * Resizable Extensions 12303 */ 12304 12305$.ui.plugin.add( "resizable", "animate", { 12306 12307 stop: function( event ) { 12308 var that = $( this ).resizable( "instance" ), 12309 o = that.options, 12310 pr = that._proportionallyResizeElements, 12311 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ), 12312 soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height, 12313 soffsetw = ista ? 0 : that.sizeDiff.width, 12314 style = { 12315 width: ( that.size.width - soffsetw ), 12316 height: ( that.size.height - soffseth ) 12317 }, 12318 left = ( parseFloat( that.element.css( "left" ) ) + 12319 ( that.position.left - that.originalPosition.left ) ) || null, 12320 top = ( parseFloat( that.element.css( "top" ) ) + 12321 ( that.position.top - that.originalPosition.top ) ) || null; 12322 12323 that.element.animate( 12324 $.extend( style, top && left ? { top: top, left: left } : {} ), { 12325 duration: o.animateDuration, 12326 easing: o.animateEasing, 12327 step: function() { 12328 12329 var data = { 12330 width: parseFloat( that.element.css( "width" ) ), 12331 height: parseFloat( that.element.css( "height" ) ), 12332 top: parseFloat( that.element.css( "top" ) ), 12333 left: parseFloat( that.element.css( "left" ) ) 12334 }; 12335 12336 if ( pr && pr.length ) { 12337 $( pr[ 0 ] ).css( { width: data.width, height: data.height } ); 12338 } 12339 12340 // Propagating resize, and updating values for each animation step 12341 that._updateCache( data ); 12342 that._propagate( "resize", event ); 12343 12344 } 12345 } 12346 ); 12347 } 12348 12349} ); 12350 12351$.ui.plugin.add( "resizable", "containment", { 12352 12353 start: function() { 12354 var element, p, co, ch, cw, width, height, 12355 that = $( this ).resizable( "instance" ), 12356 o = that.options, 12357 el = that.element, 12358 oc = o.containment, 12359 ce = ( oc instanceof $ ) ? 12360 oc.get( 0 ) : 12361 ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc; 12362 12363 if ( !ce ) { 12364 return; 12365 } 12366 12367 that.containerElement = $( ce ); 12368 12369 if ( /document/.test( oc ) || oc === document ) { 12370 that.containerOffset = { 12371 left: 0, 12372 top: 0 12373 }; 12374 that.containerPosition = { 12375 left: 0, 12376 top: 0 12377 }; 12378 12379 that.parentData = { 12380 element: $( document ), 12381 left: 0, 12382 top: 0, 12383 width: $( document ).width(), 12384 height: $( document ).height() || document.body.parentNode.scrollHeight 12385 }; 12386 } else { 12387 element = $( ce ); 12388 p = []; 12389 $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) { 12390 p[ i ] = that._num( element.css( "padding" + name ) ); 12391 } ); 12392 12393 that.containerOffset = element.offset(); 12394 that.containerPosition = element.position(); 12395 that.containerSize = { 12396 height: ( element.innerHeight() - p[ 3 ] ), 12397 width: ( element.innerWidth() - p[ 1 ] ) 12398 }; 12399 12400 co = that.containerOffset; 12401 ch = that.containerSize.height; 12402 cw = that.containerSize.width; 12403 width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw ); 12404 height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch ); 12405 12406 that.parentData = { 12407 element: ce, 12408 left: co.left, 12409 top: co.top, 12410 width: width, 12411 height: height 12412 }; 12413 } 12414 }, 12415 12416 resize: function( event ) { 12417 var woset, hoset, isParent, isOffsetRelative, 12418 that = $( this ).resizable( "instance" ), 12419 o = that.options, 12420 co = that.containerOffset, 12421 cp = that.position, 12422 pRatio = that._aspectRatio || event.shiftKey, 12423 cop = { 12424 top: 0, 12425 left: 0 12426 }, 12427 ce = that.containerElement, 12428 continueResize = true; 12429 12430 if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) { 12431 cop = co; 12432 } 12433 12434 if ( cp.left < ( that._helper ? co.left : 0 ) ) { 12435 that.size.width = that.size.width + 12436 ( that._helper ? 12437 ( that.position.left - co.left ) : 12438 ( that.position.left - cop.left ) ); 12439 12440 if ( pRatio ) { 12441 that.size.height = that.size.width / that.aspectRatio; 12442 continueResize = false; 12443 } 12444 that.position.left = o.helper ? co.left : 0; 12445 } 12446 12447 if ( cp.top < ( that._helper ? co.top : 0 ) ) { 12448 that.size.height = that.size.height + 12449 ( that._helper ? 12450 ( that.position.top - co.top ) : 12451 that.position.top ); 12452 12453 if ( pRatio ) { 12454 that.size.width = that.size.height * that.aspectRatio; 12455 continueResize = false; 12456 } 12457 that.position.top = that._helper ? co.top : 0; 12458 } 12459 12460 isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 ); 12461 isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) ); 12462 12463 if ( isParent && isOffsetRelative ) { 12464 that.offset.left = that.parentData.left + that.position.left; 12465 that.offset.top = that.parentData.top + that.position.top; 12466 } else { 12467 that.offset.left = that.element.offset().left; 12468 that.offset.top = that.element.offset().top; 12469 } 12470 12471 woset = Math.abs( that.sizeDiff.width + 12472 ( that._helper ? 12473 that.offset.left - cop.left : 12474 ( that.offset.left - co.left ) ) ); 12475 12476 hoset = Math.abs( that.sizeDiff.height + 12477 ( that._helper ? 12478 that.offset.top - cop.top : 12479 ( that.offset.top - co.top ) ) ); 12480 12481 if ( woset + that.size.width >= that.parentData.width ) { 12482 that.size.width = that.parentData.width - woset; 12483 if ( pRatio ) { 12484 that.size.height = that.size.width / that.aspectRatio; 12485 continueResize = false; 12486 } 12487 } 12488 12489 if ( hoset + that.size.height >= that.parentData.height ) { 12490 that.size.height = that.parentData.height - hoset; 12491 if ( pRatio ) { 12492 that.size.width = that.size.height * that.aspectRatio; 12493 continueResize = false; 12494 } 12495 } 12496 12497 if ( !continueResize ) { 12498 that.position.left = that.prevPosition.left; 12499 that.position.top = that.prevPosition.top; 12500 that.size.width = that.prevSize.width; 12501 that.size.height = that.prevSize.height; 12502 } 12503 }, 12504 12505 stop: function() { 12506 var that = $( this ).resizable( "instance" ), 12507 o = that.options, 12508 co = that.containerOffset, 12509 cop = that.containerPosition, 12510 ce = that.containerElement, 12511 helper = $( that.helper ), 12512 ho = helper.offset(), 12513 w = helper.outerWidth() - that.sizeDiff.width, 12514 h = helper.outerHeight() - that.sizeDiff.height; 12515 12516 if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) { 12517 $( this ).css( { 12518 left: ho.left - cop.left - co.left, 12519 width: w, 12520 height: h 12521 } ); 12522 } 12523 12524 if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) { 12525 $( this ).css( { 12526 left: ho.left - cop.left - co.left, 12527 width: w, 12528 height: h 12529 } ); 12530 } 12531 } 12532} ); 12533 12534$.ui.plugin.add( "resizable", "alsoResize", { 12535 12536 start: function() { 12537 var that = $( this ).resizable( "instance" ), 12538 o = that.options; 12539 12540 $( o.alsoResize ).each( function() { 12541 var el = $( this ); 12542 el.data( "ui-resizable-alsoresize", { 12543 width: parseFloat( el.width() ), height: parseFloat( el.height() ), 12544 left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) ) 12545 } ); 12546 } ); 12547 }, 12548 12549 resize: function( event, ui ) { 12550 var that = $( this ).resizable( "instance" ), 12551 o = that.options, 12552 os = that.originalSize, 12553 op = that.originalPosition, 12554 delta = { 12555 height: ( that.size.height - os.height ) || 0, 12556 width: ( that.size.width - os.width ) || 0, 12557 top: ( that.position.top - op.top ) || 0, 12558 left: ( that.position.left - op.left ) || 0 12559 }; 12560 12561 $( o.alsoResize ).each( function() { 12562 var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {}, 12563 css = el.parents( ui.originalElement[ 0 ] ).length ? 12564 [ "width", "height" ] : 12565 [ "width", "height", "top", "left" ]; 12566 12567 $.each( css, function( i, prop ) { 12568 var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 ); 12569 if ( sum && sum >= 0 ) { 12570 style[ prop ] = sum || null; 12571 } 12572 } ); 12573 12574 el.css( style ); 12575 } ); 12576 }, 12577 12578 stop: function() { 12579 $( this ).removeData( "ui-resizable-alsoresize" ); 12580 } 12581} ); 12582 12583$.ui.plugin.add( "resizable", "ghost", { 12584 12585 start: function() { 12586 12587 var that = $( this ).resizable( "instance" ), cs = that.size; 12588 12589 that.ghost = that.originalElement.clone(); 12590 that.ghost.css( { 12591 opacity: 0.25, 12592 display: "block", 12593 position: "relative", 12594 height: cs.height, 12595 width: cs.width, 12596 margin: 0, 12597 left: 0, 12598 top: 0 12599 } ); 12600 12601 that._addClass( that.ghost, "ui-resizable-ghost" ); 12602 12603 // DEPRECATED 12604 // TODO: remove after 1.12 12605 if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) { 12606 12607 // Ghost option 12608 that.ghost.addClass( this.options.ghost ); 12609 } 12610 12611 that.ghost.appendTo( that.helper ); 12612 12613 }, 12614 12615 resize: function() { 12616 var that = $( this ).resizable( "instance" ); 12617 if ( that.ghost ) { 12618 that.ghost.css( { 12619 position: "relative", 12620 height: that.size.height, 12621 width: that.size.width 12622 } ); 12623 } 12624 }, 12625 12626 stop: function() { 12627 var that = $( this ).resizable( "instance" ); 12628 if ( that.ghost && that.helper ) { 12629 that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) ); 12630 } 12631 } 12632 12633} ); 12634 12635$.ui.plugin.add( "resizable", "grid", { 12636 12637 resize: function() { 12638 var outerDimensions, 12639 that = $( this ).resizable( "instance" ), 12640 o = that.options, 12641 cs = that.size, 12642 os = that.originalSize, 12643 op = that.originalPosition, 12644 a = that.axis, 12645 grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid, 12646 gridX = ( grid[ 0 ] || 1 ), 12647 gridY = ( grid[ 1 ] || 1 ), 12648 ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX, 12649 oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY, 12650 newWidth = os.width + ox, 12651 newHeight = os.height + oy, 12652 isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ), 12653 isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ), 12654 isMinWidth = o.minWidth && ( o.minWidth > newWidth ), 12655 isMinHeight = o.minHeight && ( o.minHeight > newHeight ); 12656 12657 o.grid = grid; 12658 12659 if ( isMinWidth ) { 12660 newWidth += gridX; 12661 } 12662 if ( isMinHeight ) { 12663 newHeight += gridY; 12664 } 12665 if ( isMaxWidth ) { 12666 newWidth -= gridX; 12667 } 12668 if ( isMaxHeight ) { 12669 newHeight -= gridY; 12670 } 12671 12672 if ( /^(se|s|e)$/.test( a ) ) { 12673 that.size.width = newWidth; 12674 that.size.height = newHeight; 12675 } else if ( /^(ne)$/.test( a ) ) { 12676 that.size.width = newWidth; 12677 that.size.height = newHeight; 12678 that.position.top = op.top - oy; 12679 } else if ( /^(sw)$/.test( a ) ) { 12680 that.size.width = newWidth; 12681 that.size.height = newHeight; 12682 that.position.left = op.left - ox; 12683 } else { 12684 if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) { 12685 outerDimensions = that._getPaddingPlusBorderDimensions( this ); 12686 } 12687 12688 if ( newHeight - gridY > 0 ) { 12689 that.size.height = newHeight; 12690 that.position.top = op.top - oy; 12691 } else { 12692 newHeight = gridY - outerDimensions.height; 12693 that.size.height = newHeight; 12694 that.position.top = op.top + os.height - newHeight; 12695 } 12696 if ( newWidth - gridX > 0 ) { 12697 that.size.width = newWidth; 12698 that.position.left = op.left - ox; 12699 } else { 12700 newWidth = gridX - outerDimensions.width; 12701 that.size.width = newWidth; 12702 that.position.left = op.left + os.width - newWidth; 12703 } 12704 } 12705 } 12706 12707} ); 12708 12709var widgetsResizable = $.ui.resizable; 12710 12711 12712/*! 12713 * jQuery UI Dialog 1.13.2 12714 * http://jqueryui.com 12715 * 12716 * Copyright jQuery Foundation and other contributors 12717 * Released under the MIT license. 12718 * http://jquery.org/license 12719 */ 12720 12721//>>label: Dialog 12722//>>group: Widgets 12723//>>description: Displays customizable dialog windows. 12724//>>docs: http://api.jqueryui.com/dialog/ 12725//>>demos: http://jqueryui.com/dialog/ 12726//>>css.structure: ../../themes/base/core.css 12727//>>css.structure: ../../themes/base/dialog.css 12728//>>css.theme: ../../themes/base/theme.css 12729 12730 12731$.widget( "ui.dialog", { 12732 version: "1.13.2", 12733 options: { 12734 appendTo: "body", 12735 autoOpen: true, 12736 buttons: [], 12737 classes: { 12738 "ui-dialog": "ui-corner-all", 12739 "ui-dialog-titlebar": "ui-corner-all" 12740 }, 12741 closeOnEscape: true, 12742 closeText: "Close", 12743 draggable: true, 12744 hide: null, 12745 height: "auto", 12746 maxHeight: null, 12747 maxWidth: null, 12748 minHeight: 150, 12749 minWidth: 150, 12750 modal: false, 12751 position: { 12752 my: "center", 12753 at: "center", 12754 of: window, 12755 collision: "fit", 12756 12757 // Ensure the titlebar is always visible 12758 using: function( pos ) { 12759 var topOffset = $( this ).css( pos ).offset().top; 12760 if ( topOffset < 0 ) { 12761 $( this ).css( "top", pos.top - topOffset ); 12762 } 12763 } 12764 }, 12765 resizable: true, 12766 show: null, 12767 title: null, 12768 width: 300, 12769 12770 // Callbacks 12771 beforeClose: null, 12772 close: null, 12773 drag: null, 12774 dragStart: null, 12775 dragStop: null, 12776 focus: null, 12777 open: null, 12778 resize: null, 12779 resizeStart: null, 12780 resizeStop: null 12781 }, 12782 12783 sizeRelatedOptions: { 12784 buttons: true, 12785 height: true, 12786 maxHeight: true, 12787 maxWidth: true, 12788 minHeight: true, 12789 minWidth: true, 12790 width: true 12791 }, 12792 12793 resizableRelatedOptions: { 12794 maxHeight: true, 12795 maxWidth: true, 12796 minHeight: true, 12797 minWidth: true 12798 }, 12799 12800 _create: function() { 12801 this.originalCss = { 12802 display: this.element[ 0 ].style.display, 12803 width: this.element[ 0 ].style.width, 12804 minHeight: this.element[ 0 ].style.minHeight, 12805 maxHeight: this.element[ 0 ].style.maxHeight, 12806 height: this.element[ 0 ].style.height 12807 }; 12808 this.originalPosition = { 12809 parent: this.element.parent(), 12810 index: this.element.parent().children().index( this.element ) 12811 }; 12812 this.originalTitle = this.element.attr( "title" ); 12813 if ( this.options.title == null && this.originalTitle != null ) { 12814 this.options.title = this.originalTitle; 12815 } 12816 12817 // Dialogs can't be disabled 12818 if ( this.options.disabled ) { 12819 this.options.disabled = false; 12820 } 12821 12822 this._createWrapper(); 12823 12824 this.element 12825 .show() 12826 .removeAttr( "title" ) 12827 .appendTo( this.uiDialog ); 12828 12829 this._addClass( "ui-dialog-content", "ui-widget-content" ); 12830 12831 this._createTitlebar(); 12832 this._createButtonPane(); 12833 12834 if ( this.options.draggable && $.fn.draggable ) { 12835 this._makeDraggable(); 12836 } 12837 if ( this.options.resizable && $.fn.resizable ) { 12838 this._makeResizable(); 12839 } 12840 12841 this._isOpen = false; 12842 12843 this._trackFocus(); 12844 }, 12845 12846 _init: function() { 12847 if ( this.options.autoOpen ) { 12848 this.open(); 12849 } 12850 }, 12851 12852 _appendTo: function() { 12853 var element = this.options.appendTo; 12854 if ( element && ( element.jquery || element.nodeType ) ) { 12855 return $( element ); 12856 } 12857 return this.document.find( element || "body" ).eq( 0 ); 12858 }, 12859 12860 _destroy: function() { 12861 var next, 12862 originalPosition = this.originalPosition; 12863 12864 this._untrackInstance(); 12865 this._destroyOverlay(); 12866 12867 this.element 12868 .removeUniqueId() 12869 .css( this.originalCss ) 12870 12871 // Without detaching first, the following becomes really slow 12872 .detach(); 12873 12874 this.uiDialog.remove(); 12875 12876 if ( this.originalTitle ) { 12877 this.element.attr( "title", this.originalTitle ); 12878 } 12879 12880 next = originalPosition.parent.children().eq( originalPosition.index ); 12881 12882 // Don't try to place the dialog next to itself (#8613) 12883 if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { 12884 next.before( this.element ); 12885 } else { 12886 originalPosition.parent.append( this.element ); 12887 } 12888 }, 12889 12890 widget: function() { 12891 return this.uiDialog; 12892 }, 12893 12894 disable: $.noop, 12895 enable: $.noop, 12896 12897 close: function( event ) { 12898 var that = this; 12899 12900 if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { 12901 return; 12902 } 12903 12904 this._isOpen = false; 12905 this._focusedElement = null; 12906 this._destroyOverlay(); 12907 this._untrackInstance(); 12908 12909 if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) { 12910 12911 // Hiding a focused element doesn't trigger blur in WebKit 12912 // so in case we have nothing to focus on, explicitly blur the active element 12913 // https://bugs.webkit.org/show_bug.cgi?id=47182 12914 $.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) ); 12915 } 12916 12917 this._hide( this.uiDialog, this.options.hide, function() { 12918 that._trigger( "close", event ); 12919 } ); 12920 }, 12921 12922 isOpen: function() { 12923 return this._isOpen; 12924 }, 12925 12926 moveToTop: function() { 12927 this._moveToTop(); 12928 }, 12929 12930 _moveToTop: function( event, silent ) { 12931 var moved = false, 12932 zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() { 12933 return +$( this ).css( "z-index" ); 12934 } ).get(), 12935 zIndexMax = Math.max.apply( null, zIndices ); 12936 12937 if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) { 12938 this.uiDialog.css( "z-index", zIndexMax + 1 ); 12939 moved = true; 12940 } 12941 12942 if ( moved && !silent ) { 12943 this._trigger( "focus", event ); 12944 } 12945 return moved; 12946 }, 12947 12948 open: function() { 12949 var that = this; 12950 if ( this._isOpen ) { 12951 if ( this._moveToTop() ) { 12952 this._focusTabbable(); 12953 } 12954 return; 12955 } 12956 12957 this._isOpen = true; 12958 this.opener = $( $.ui.safeActiveElement( this.document[ 0 ] ) ); 12959 12960 this._size(); 12961 this._position(); 12962 this._createOverlay(); 12963 this._moveToTop( null, true ); 12964 12965 // Ensure the overlay is moved to the top with the dialog, but only when 12966 // opening. The overlay shouldn't move after the dialog is open so that 12967 // modeless dialogs opened after the modal dialog stack properly. 12968 if ( this.overlay ) { 12969 this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 ); 12970 } 12971 12972 this._show( this.uiDialog, this.options.show, function() { 12973 that._focusTabbable(); 12974 that._trigger( "focus" ); 12975 } ); 12976 12977 // Track the dialog immediately upon opening in case a focus event 12978 // somehow occurs outside of the dialog before an element inside the 12979 // dialog is focused (#10152) 12980 this._makeFocusTarget(); 12981 12982 this._trigger( "open" ); 12983 }, 12984 12985 _focusTabbable: function() { 12986 12987 // Set focus to the first match: 12988 // 1. An element that was focused previously 12989 // 2. First element inside the dialog matching [autofocus] 12990 // 3. Tabbable element inside the content element 12991 // 4. Tabbable element inside the buttonpane 12992 // 5. The close button 12993 // 6. The dialog itself 12994 var hasFocus = this._focusedElement; 12995 if ( !hasFocus ) { 12996 hasFocus = this.element.find( "[autofocus]" ); 12997 } 12998 if ( !hasFocus.length ) { 12999 hasFocus = this.element.find( ":tabbable" ); 13000 } 13001 if ( !hasFocus.length ) { 13002 hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); 13003 } 13004 if ( !hasFocus.length ) { 13005 hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" ); 13006 } 13007 if ( !hasFocus.length ) { 13008 hasFocus = this.uiDialog; 13009 } 13010 hasFocus.eq( 0 ).trigger( "focus" ); 13011 }, 13012 13013 _restoreTabbableFocus: function() { 13014 var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ), 13015 isActive = this.uiDialog[ 0 ] === activeElement || 13016 $.contains( this.uiDialog[ 0 ], activeElement ); 13017 if ( !isActive ) { 13018 this._focusTabbable(); 13019 } 13020 }, 13021 13022 _keepFocus: function( event ) { 13023 event.preventDefault(); 13024 this._restoreTabbableFocus(); 13025 13026 // support: IE 13027 // IE <= 8 doesn't prevent moving focus even with event.preventDefault() 13028 // so we check again later 13029 this._delay( this._restoreTabbableFocus ); 13030 }, 13031 13032 _createWrapper: function() { 13033 this.uiDialog = $( "<div>" ) 13034 .hide() 13035 .attr( { 13036 13037 // Setting tabIndex makes the div focusable 13038 tabIndex: -1, 13039 role: "dialog" 13040 } ) 13041 .appendTo( this._appendTo() ); 13042 13043 this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" ); 13044 this._on( this.uiDialog, { 13045 keydown: function( event ) { 13046 if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 13047 event.keyCode === $.ui.keyCode.ESCAPE ) { 13048 event.preventDefault(); 13049 this.close( event ); 13050 return; 13051 } 13052 13053 // Prevent tabbing out of dialogs 13054 if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) { 13055 return; 13056 } 13057 var tabbables = this.uiDialog.find( ":tabbable" ), 13058 first = tabbables.first(), 13059 last = tabbables.last(); 13060 13061 if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) && 13062 !event.shiftKey ) { 13063 this._delay( function() { 13064 first.trigger( "focus" ); 13065 } ); 13066 event.preventDefault(); 13067 } else if ( ( event.target === first[ 0 ] || 13068 event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) { 13069 this._delay( function() { 13070 last.trigger( "focus" ); 13071 } ); 13072 event.preventDefault(); 13073 } 13074 }, 13075 mousedown: function( event ) { 13076 if ( this._moveToTop( event ) ) { 13077 this._focusTabbable(); 13078 } 13079 } 13080 } ); 13081 13082 // We assume that any existing aria-describedby attribute means 13083 // that the dialog content is marked up properly 13084 // otherwise we brute force the content as the description 13085 if ( !this.element.find( "[aria-describedby]" ).length ) { 13086 this.uiDialog.attr( { 13087 "aria-describedby": this.element.uniqueId().attr( "id" ) 13088 } ); 13089 } 13090 }, 13091 13092 _createTitlebar: function() { 13093 var uiDialogTitle; 13094 13095 this.uiDialogTitlebar = $( "<div>" ); 13096 this._addClass( this.uiDialogTitlebar, 13097 "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" ); 13098 this._on( this.uiDialogTitlebar, { 13099 mousedown: function( event ) { 13100 13101 // Don't prevent click on close button (#8838) 13102 // Focusing a dialog that is partially scrolled out of view 13103 // causes the browser to scroll it into view, preventing the click event 13104 if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) { 13105 13106 // Dialog isn't getting focus when dragging (#8063) 13107 this.uiDialog.trigger( "focus" ); 13108 } 13109 } 13110 } ); 13111 13112 // Support: IE 13113 // Use type="button" to prevent enter keypresses in textboxes from closing the 13114 // dialog in IE (#9312) 13115 this.uiDialogTitlebarClose = $( "<button type='button'></button>" ) 13116 .button( { 13117 label: $( "<a>" ).text( this.options.closeText ).html(), 13118 icon: "ui-icon-closethick", 13119 showLabel: false 13120 } ) 13121 .appendTo( this.uiDialogTitlebar ); 13122 13123 this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" ); 13124 this._on( this.uiDialogTitlebarClose, { 13125 click: function( event ) { 13126 event.preventDefault(); 13127 this.close( event ); 13128 } 13129 } ); 13130 13131 uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar ); 13132 this._addClass( uiDialogTitle, "ui-dialog-title" ); 13133 this._title( uiDialogTitle ); 13134 13135 this.uiDialogTitlebar.prependTo( this.uiDialog ); 13136 13137 this.uiDialog.attr( { 13138 "aria-labelledby": uiDialogTitle.attr( "id" ) 13139 } ); 13140 }, 13141 13142 _title: function( title ) { 13143 if ( this.options.title ) { 13144 title.text( this.options.title ); 13145 } else { 13146 title.html( " " ); 13147 } 13148 }, 13149 13150 _createButtonPane: function() { 13151 this.uiDialogButtonPane = $( "<div>" ); 13152 this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane", 13153 "ui-widget-content ui-helper-clearfix" ); 13154 13155 this.uiButtonSet = $( "<div>" ) 13156 .appendTo( this.uiDialogButtonPane ); 13157 this._addClass( this.uiButtonSet, "ui-dialog-buttonset" ); 13158 13159 this._createButtons(); 13160 }, 13161 13162 _createButtons: function() { 13163 var that = this, 13164 buttons = this.options.buttons; 13165 13166 // If we already have a button pane, remove it 13167 this.uiDialogButtonPane.remove(); 13168 this.uiButtonSet.empty(); 13169 13170 if ( $.isEmptyObject( buttons ) || ( Array.isArray( buttons ) && !buttons.length ) ) { 13171 this._removeClass( this.uiDialog, "ui-dialog-buttons" ); 13172 return; 13173 } 13174 13175 $.each( buttons, function( name, props ) { 13176 var click, buttonOptions; 13177 props = typeof props === "function" ? 13178 { click: props, text: name } : 13179 props; 13180 13181 // Default to a non-submitting button 13182 props = $.extend( { type: "button" }, props ); 13183 13184 // Change the context for the click callback to be the main element 13185 click = props.click; 13186 buttonOptions = { 13187 icon: props.icon, 13188 iconPosition: props.iconPosition, 13189 showLabel: props.showLabel, 13190 13191 // Deprecated options 13192 icons: props.icons, 13193 text: props.text 13194 }; 13195 13196 delete props.click; 13197 delete props.icon; 13198 delete props.iconPosition; 13199 delete props.showLabel; 13200 13201 // Deprecated options 13202 delete props.icons; 13203 if ( typeof props.text === "boolean" ) { 13204 delete props.text; 13205 } 13206 13207 $( "<button></button>", props ) 13208 .button( buttonOptions ) 13209 .appendTo( that.uiButtonSet ) 13210 .on( "click", function() { 13211 click.apply( that.element[ 0 ], arguments ); 13212 } ); 13213 } ); 13214 this._addClass( this.uiDialog, "ui-dialog-buttons" ); 13215 this.uiDialogButtonPane.appendTo( this.uiDialog ); 13216 }, 13217 13218 _makeDraggable: function() { 13219 var that = this, 13220 options = this.options; 13221 13222 function filteredUi( ui ) { 13223 return { 13224 position: ui.position, 13225 offset: ui.offset 13226 }; 13227 } 13228 13229 this.uiDialog.draggable( { 13230 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 13231 handle: ".ui-dialog-titlebar", 13232 containment: "document", 13233 start: function( event, ui ) { 13234 that._addClass( $( this ), "ui-dialog-dragging" ); 13235 that._blockFrames(); 13236 that._trigger( "dragStart", event, filteredUi( ui ) ); 13237 }, 13238 drag: function( event, ui ) { 13239 that._trigger( "drag", event, filteredUi( ui ) ); 13240 }, 13241 stop: function( event, ui ) { 13242 var left = ui.offset.left - that.document.scrollLeft(), 13243 top = ui.offset.top - that.document.scrollTop(); 13244 13245 options.position = { 13246 my: "left top", 13247 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 13248 "top" + ( top >= 0 ? "+" : "" ) + top, 13249 of: that.window 13250 }; 13251 that._removeClass( $( this ), "ui-dialog-dragging" ); 13252 that._unblockFrames(); 13253 that._trigger( "dragStop", event, filteredUi( ui ) ); 13254 } 13255 } ); 13256 }, 13257 13258 _makeResizable: function() { 13259 var that = this, 13260 options = this.options, 13261 handles = options.resizable, 13262 13263 // .ui-resizable has position: relative defined in the stylesheet 13264 // but dialogs have to use absolute or fixed positioning 13265 position = this.uiDialog.css( "position" ), 13266 resizeHandles = typeof handles === "string" ? 13267 handles : 13268 "n,e,s,w,se,sw,ne,nw"; 13269 13270 function filteredUi( ui ) { 13271 return { 13272 originalPosition: ui.originalPosition, 13273 originalSize: ui.originalSize, 13274 position: ui.position, 13275 size: ui.size 13276 }; 13277 } 13278 13279 this.uiDialog.resizable( { 13280 cancel: ".ui-dialog-content", 13281 containment: "document", 13282 alsoResize: this.element, 13283 maxWidth: options.maxWidth, 13284 maxHeight: options.maxHeight, 13285 minWidth: options.minWidth, 13286 minHeight: this._minHeight(), 13287 handles: resizeHandles, 13288 start: function( event, ui ) { 13289 that._addClass( $( this ), "ui-dialog-resizing" ); 13290 that._blockFrames(); 13291 that._trigger( "resizeStart", event, filteredUi( ui ) ); 13292 }, 13293 resize: function( event, ui ) { 13294 that._trigger( "resize", event, filteredUi( ui ) ); 13295 }, 13296 stop: function( event, ui ) { 13297 var offset = that.uiDialog.offset(), 13298 left = offset.left - that.document.scrollLeft(), 13299 top = offset.top - that.document.scrollTop(); 13300 13301 options.height = that.uiDialog.height(); 13302 options.width = that.uiDialog.width(); 13303 options.position = { 13304 my: "left top", 13305 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 13306 "top" + ( top >= 0 ? "+" : "" ) + top, 13307 of: that.window 13308 }; 13309 that._removeClass( $( this ), "ui-dialog-resizing" ); 13310 that._unblockFrames(); 13311 that._trigger( "resizeStop", event, filteredUi( ui ) ); 13312 } 13313 } ) 13314 .css( "position", position ); 13315 }, 13316 13317 _trackFocus: function() { 13318 this._on( this.widget(), { 13319 focusin: function( event ) { 13320 this._makeFocusTarget(); 13321 this._focusedElement = $( event.target ); 13322 } 13323 } ); 13324 }, 13325 13326 _makeFocusTarget: function() { 13327 this._untrackInstance(); 13328 this._trackingInstances().unshift( this ); 13329 }, 13330 13331 _untrackInstance: function() { 13332 var instances = this._trackingInstances(), 13333 exists = $.inArray( this, instances ); 13334 if ( exists !== -1 ) { 13335 instances.splice( exists, 1 ); 13336 } 13337 }, 13338 13339 _trackingInstances: function() { 13340 var instances = this.document.data( "ui-dialog-instances" ); 13341 if ( !instances ) { 13342 instances = []; 13343 this.document.data( "ui-dialog-instances", instances ); 13344 } 13345 return instances; 13346 }, 13347 13348 _minHeight: function() { 13349 var options = this.options; 13350 13351 return options.height === "auto" ? 13352 options.minHeight : 13353 Math.min( options.minHeight, options.height ); 13354 }, 13355 13356 _position: function() { 13357 13358 // Need to show the dialog to get the actual offset in the position plugin 13359 var isVisible = this.uiDialog.is( ":visible" ); 13360 if ( !isVisible ) { 13361 this.uiDialog.show(); 13362 } 13363 this.uiDialog.position( this.options.position ); 13364 if ( !isVisible ) { 13365 this.uiDialog.hide(); 13366 } 13367 }, 13368 13369 _setOptions: function( options ) { 13370 var that = this, 13371 resize = false, 13372 resizableOptions = {}; 13373 13374 $.each( options, function( key, value ) { 13375 that._setOption( key, value ); 13376 13377 if ( key in that.sizeRelatedOptions ) { 13378 resize = true; 13379 } 13380 if ( key in that.resizableRelatedOptions ) { 13381 resizableOptions[ key ] = value; 13382 } 13383 } ); 13384 13385 if ( resize ) { 13386 this._size(); 13387 this._position(); 13388 } 13389 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 13390 this.uiDialog.resizable( "option", resizableOptions ); 13391 } 13392 }, 13393 13394 _setOption: function( key, value ) { 13395 var isDraggable, isResizable, 13396 uiDialog = this.uiDialog; 13397 13398 if ( key === "disabled" ) { 13399 return; 13400 } 13401 13402 this._super( key, value ); 13403 13404 if ( key === "appendTo" ) { 13405 this.uiDialog.appendTo( this._appendTo() ); 13406 } 13407 13408 if ( key === "buttons" ) { 13409 this._createButtons(); 13410 } 13411 13412 if ( key === "closeText" ) { 13413 this.uiDialogTitlebarClose.button( { 13414 13415 // Ensure that we always pass a string 13416 label: $( "<a>" ).text( "" + this.options.closeText ).html() 13417 } ); 13418 } 13419 13420 if ( key === "draggable" ) { 13421 isDraggable = uiDialog.is( ":data(ui-draggable)" ); 13422 if ( isDraggable && !value ) { 13423 uiDialog.draggable( "destroy" ); 13424 } 13425 13426 if ( !isDraggable && value ) { 13427 this._makeDraggable(); 13428 } 13429 } 13430 13431 if ( key === "position" ) { 13432 this._position(); 13433 } 13434 13435 if ( key === "resizable" ) { 13436 13437 // currently resizable, becoming non-resizable 13438 isResizable = uiDialog.is( ":data(ui-resizable)" ); 13439 if ( isResizable && !value ) { 13440 uiDialog.resizable( "destroy" ); 13441 } 13442 13443 // Currently resizable, changing handles 13444 if ( isResizable && typeof value === "string" ) { 13445 uiDialog.resizable( "option", "handles", value ); 13446 } 13447 13448 // Currently non-resizable, becoming resizable 13449 if ( !isResizable && value !== false ) { 13450 this._makeResizable(); 13451 } 13452 } 13453 13454 if ( key === "title" ) { 13455 this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) ); 13456 } 13457 }, 13458 13459 _size: function() { 13460 13461 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 13462 // divs will both have width and height set, so we need to reset them 13463 var nonContentHeight, minContentHeight, maxContentHeight, 13464 options = this.options; 13465 13466 // Reset content sizing 13467 this.element.show().css( { 13468 width: "auto", 13469 minHeight: 0, 13470 maxHeight: "none", 13471 height: 0 13472 } ); 13473 13474 if ( options.minWidth > options.width ) { 13475 options.width = options.minWidth; 13476 } 13477 13478 // Reset wrapper sizing 13479 // determine the height of all the non-content elements 13480 nonContentHeight = this.uiDialog.css( { 13481 height: "auto", 13482 width: options.width 13483 } ) 13484 .outerHeight(); 13485 minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); 13486 maxContentHeight = typeof options.maxHeight === "number" ? 13487 Math.max( 0, options.maxHeight - nonContentHeight ) : 13488 "none"; 13489 13490 if ( options.height === "auto" ) { 13491 this.element.css( { 13492 minHeight: minContentHeight, 13493 maxHeight: maxContentHeight, 13494 height: "auto" 13495 } ); 13496 } else { 13497 this.element.height( Math.max( 0, options.height - nonContentHeight ) ); 13498 } 13499 13500 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 13501 this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); 13502 } 13503 }, 13504 13505 _blockFrames: function() { 13506 this.iframeBlocks = this.document.find( "iframe" ).map( function() { 13507 var iframe = $( this ); 13508 13509 return $( "<div>" ) 13510 .css( { 13511 position: "absolute", 13512 width: iframe.outerWidth(), 13513 height: iframe.outerHeight() 13514 } ) 13515 .appendTo( iframe.parent() ) 13516 .offset( iframe.offset() )[ 0 ]; 13517 } ); 13518 }, 13519 13520 _unblockFrames: function() { 13521 if ( this.iframeBlocks ) { 13522 this.iframeBlocks.remove(); 13523 delete this.iframeBlocks; 13524 } 13525 }, 13526 13527 _allowInteraction: function( event ) { 13528 if ( $( event.target ).closest( ".ui-dialog" ).length ) { 13529 return true; 13530 } 13531 13532 // TODO: Remove hack when datepicker implements 13533 // the .ui-front logic (#8989) 13534 return !!$( event.target ).closest( ".ui-datepicker" ).length; 13535 }, 13536 13537 _createOverlay: function() { 13538 if ( !this.options.modal ) { 13539 return; 13540 } 13541 13542 var jqMinor = $.fn.jquery.substring( 0, 4 ); 13543 13544 // We use a delay in case the overlay is created from an 13545 // event that we're going to be cancelling (#2804) 13546 var isOpening = true; 13547 this._delay( function() { 13548 isOpening = false; 13549 } ); 13550 13551 if ( !this.document.data( "ui-dialog-overlays" ) ) { 13552 13553 // Prevent use of anchors and inputs 13554 // This doesn't use `_on()` because it is a shared event handler 13555 // across all open modal dialogs. 13556 this.document.on( "focusin.ui-dialog", function( event ) { 13557 if ( isOpening ) { 13558 return; 13559 } 13560 13561 var instance = this._trackingInstances()[ 0 ]; 13562 if ( !instance._allowInteraction( event ) ) { 13563 event.preventDefault(); 13564 instance._focusTabbable(); 13565 13566 // Support: jQuery >=3.4 <3.6 only 13567 // Focus re-triggering in jQuery 3.4/3.5 makes the original element 13568 // have its focus event propagated last, breaking the re-targeting. 13569 // Trigger focus in a delay in addition if needed to avoid the issue 13570 // See https://github.com/jquery/jquery/issues/4382 13571 if ( jqMinor === "3.4." || jqMinor === "3.5." ) { 13572 instance._delay( instance._restoreTabbableFocus ); 13573 } 13574 } 13575 }.bind( this ) ); 13576 } 13577 13578 this.overlay = $( "<div>" ) 13579 .appendTo( this._appendTo() ); 13580 13581 this._addClass( this.overlay, null, "ui-widget-overlay ui-front" ); 13582 this._on( this.overlay, { 13583 mousedown: "_keepFocus" 13584 } ); 13585 this.document.data( "ui-dialog-overlays", 13586 ( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 ); 13587 }, 13588 13589 _destroyOverlay: function() { 13590 if ( !this.options.modal ) { 13591 return; 13592 } 13593 13594 if ( this.overlay ) { 13595 var overlays = this.document.data( "ui-dialog-overlays" ) - 1; 13596 13597 if ( !overlays ) { 13598 this.document.off( "focusin.ui-dialog" ); 13599 this.document.removeData( "ui-dialog-overlays" ); 13600 } else { 13601 this.document.data( "ui-dialog-overlays", overlays ); 13602 } 13603 13604 this.overlay.remove(); 13605 this.overlay = null; 13606 } 13607 } 13608} ); 13609 13610// DEPRECATED 13611// TODO: switch return back to widget declaration at top of file when this is removed 13612if ( $.uiBackCompat !== false ) { 13613 13614 // Backcompat for dialogClass option 13615 $.widget( "ui.dialog", $.ui.dialog, { 13616 options: { 13617 dialogClass: "" 13618 }, 13619 _createWrapper: function() { 13620 this._super(); 13621 this.uiDialog.addClass( this.options.dialogClass ); 13622 }, 13623 _setOption: function( key, value ) { 13624 if ( key === "dialogClass" ) { 13625 this.uiDialog 13626 .removeClass( this.options.dialogClass ) 13627 .addClass( value ); 13628 } 13629 this._superApply( arguments ); 13630 } 13631 } ); 13632} 13633 13634var widgetsDialog = $.ui.dialog; 13635 13636 13637/*! 13638 * jQuery UI Droppable 1.13.2 13639 * http://jqueryui.com 13640 * 13641 * Copyright jQuery Foundation and other contributors 13642 * Released under the MIT license. 13643 * http://jquery.org/license 13644 */ 13645 13646//>>label: Droppable 13647//>>group: Interactions 13648//>>description: Enables drop targets for draggable elements. 13649//>>docs: http://api.jqueryui.com/droppable/ 13650//>>demos: http://jqueryui.com/droppable/ 13651 13652 13653$.widget( "ui.droppable", { 13654 version: "1.13.2", 13655 widgetEventPrefix: "drop", 13656 options: { 13657 accept: "*", 13658 addClasses: true, 13659 greedy: false, 13660 scope: "default", 13661 tolerance: "intersect", 13662 13663 // Callbacks 13664 activate: null, 13665 deactivate: null, 13666 drop: null, 13667 out: null, 13668 over: null 13669 }, 13670 _create: function() { 13671 13672 var proportions, 13673 o = this.options, 13674 accept = o.accept; 13675 13676 this.isover = false; 13677 this.isout = true; 13678 13679 this.accept = typeof accept === "function" ? accept : function( d ) { 13680 return d.is( accept ); 13681 }; 13682 13683 this.proportions = function( /* valueToWrite */ ) { 13684 if ( arguments.length ) { 13685 13686 // Store the droppable's proportions 13687 proportions = arguments[ 0 ]; 13688 } else { 13689 13690 // Retrieve or derive the droppable's proportions 13691 return proportions ? 13692 proportions : 13693 proportions = { 13694 width: this.element[ 0 ].offsetWidth, 13695 height: this.element[ 0 ].offsetHeight 13696 }; 13697 } 13698 }; 13699 13700 this._addToManager( o.scope ); 13701 13702 if ( o.addClasses ) { 13703 this._addClass( "ui-droppable" ); 13704 } 13705 13706 }, 13707 13708 _addToManager: function( scope ) { 13709 13710 // Add the reference and positions to the manager 13711 $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || []; 13712 $.ui.ddmanager.droppables[ scope ].push( this ); 13713 }, 13714 13715 _splice: function( drop ) { 13716 var i = 0; 13717 for ( ; i < drop.length; i++ ) { 13718 if ( drop[ i ] === this ) { 13719 drop.splice( i, 1 ); 13720 } 13721 } 13722 }, 13723 13724 _destroy: function() { 13725 var drop = $.ui.ddmanager.droppables[ this.options.scope ]; 13726 13727 this._splice( drop ); 13728 }, 13729 13730 _setOption: function( key, value ) { 13731 13732 if ( key === "accept" ) { 13733 this.accept = typeof value === "function" ? value : function( d ) { 13734 return d.is( value ); 13735 }; 13736 } else if ( key === "scope" ) { 13737 var drop = $.ui.ddmanager.droppables[ this.options.scope ]; 13738 13739 this._splice( drop ); 13740 this._addToManager( value ); 13741 } 13742 13743 this._super( key, value ); 13744 }, 13745 13746 _activate: function( event ) { 13747 var draggable = $.ui.ddmanager.current; 13748 13749 this._addActiveClass(); 13750 if ( draggable ) { 13751 this._trigger( "activate", event, this.ui( draggable ) ); 13752 } 13753 }, 13754 13755 _deactivate: function( event ) { 13756 var draggable = $.ui.ddmanager.current; 13757 13758 this._removeActiveClass(); 13759 if ( draggable ) { 13760 this._trigger( "deactivate", event, this.ui( draggable ) ); 13761 } 13762 }, 13763 13764 _over: function( event ) { 13765 13766 var draggable = $.ui.ddmanager.current; 13767 13768 // Bail if draggable and droppable are same element 13769 if ( !draggable || ( draggable.currentItem || 13770 draggable.element )[ 0 ] === this.element[ 0 ] ) { 13771 return; 13772 } 13773 13774 if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || 13775 draggable.element ) ) ) { 13776 this._addHoverClass(); 13777 this._trigger( "over", event, this.ui( draggable ) ); 13778 } 13779 13780 }, 13781 13782 _out: function( event ) { 13783 13784 var draggable = $.ui.ddmanager.current; 13785 13786 // Bail if draggable and droppable are same element 13787 if ( !draggable || ( draggable.currentItem || 13788 draggable.element )[ 0 ] === this.element[ 0 ] ) { 13789 return; 13790 } 13791 13792 if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || 13793 draggable.element ) ) ) { 13794 this._removeHoverClass(); 13795 this._trigger( "out", event, this.ui( draggable ) ); 13796 } 13797 13798 }, 13799 13800 _drop: function( event, custom ) { 13801 13802 var draggable = custom || $.ui.ddmanager.current, 13803 childrenIntersection = false; 13804 13805 // Bail if draggable and droppable are same element 13806 if ( !draggable || ( draggable.currentItem || 13807 draggable.element )[ 0 ] === this.element[ 0 ] ) { 13808 return false; 13809 } 13810 13811 this.element 13812 .find( ":data(ui-droppable)" ) 13813 .not( ".ui-draggable-dragging" ) 13814 .each( function() { 13815 var inst = $( this ).droppable( "instance" ); 13816 if ( 13817 inst.options.greedy && 13818 !inst.options.disabled && 13819 inst.options.scope === draggable.options.scope && 13820 inst.accept.call( 13821 inst.element[ 0 ], ( draggable.currentItem || draggable.element ) 13822 ) && 13823 $.ui.intersect( 13824 draggable, 13825 $.extend( inst, { offset: inst.element.offset() } ), 13826 inst.options.tolerance, event 13827 ) 13828 ) { 13829 childrenIntersection = true; 13830 return false; 13831 } 13832 } ); 13833 if ( childrenIntersection ) { 13834 return false; 13835 } 13836 13837 if ( this.accept.call( this.element[ 0 ], 13838 ( draggable.currentItem || draggable.element ) ) ) { 13839 this._removeActiveClass(); 13840 this._removeHoverClass(); 13841 13842 this._trigger( "drop", event, this.ui( draggable ) ); 13843 return this.element; 13844 } 13845 13846 return false; 13847 13848 }, 13849 13850 ui: function( c ) { 13851 return { 13852 draggable: ( c.currentItem || c.element ), 13853 helper: c.helper, 13854 position: c.position, 13855 offset: c.positionAbs 13856 }; 13857 }, 13858 13859 // Extension points just to make backcompat sane and avoid duplicating logic 13860 // TODO: Remove in 1.14 along with call to it below 13861 _addHoverClass: function() { 13862 this._addClass( "ui-droppable-hover" ); 13863 }, 13864 13865 _removeHoverClass: function() { 13866 this._removeClass( "ui-droppable-hover" ); 13867 }, 13868 13869 _addActiveClass: function() { 13870 this._addClass( "ui-droppable-active" ); 13871 }, 13872 13873 _removeActiveClass: function() { 13874 this._removeClass( "ui-droppable-active" ); 13875 } 13876} ); 13877 13878$.ui.intersect = ( function() { 13879 function isOverAxis( x, reference, size ) { 13880 return ( x >= reference ) && ( x < ( reference + size ) ); 13881 } 13882 13883 return function( draggable, droppable, toleranceMode, event ) { 13884 13885 if ( !droppable.offset ) { 13886 return false; 13887 } 13888 13889 var x1 = ( draggable.positionAbs || 13890 draggable.position.absolute ).left + draggable.margins.left, 13891 y1 = ( draggable.positionAbs || 13892 draggable.position.absolute ).top + draggable.margins.top, 13893 x2 = x1 + draggable.helperProportions.width, 13894 y2 = y1 + draggable.helperProportions.height, 13895 l = droppable.offset.left, 13896 t = droppable.offset.top, 13897 r = l + droppable.proportions().width, 13898 b = t + droppable.proportions().height; 13899 13900 switch ( toleranceMode ) { 13901 case "fit": 13902 return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b ); 13903 case "intersect": 13904 return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half 13905 x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half 13906 t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half 13907 y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half 13908 case "pointer": 13909 return isOverAxis( event.pageY, t, droppable.proportions().height ) && 13910 isOverAxis( event.pageX, l, droppable.proportions().width ); 13911 case "touch": 13912 return ( 13913 ( y1 >= t && y1 <= b ) || // Top edge touching 13914 ( y2 >= t && y2 <= b ) || // Bottom edge touching 13915 ( y1 < t && y2 > b ) // Surrounded vertically 13916 ) && ( 13917 ( x1 >= l && x1 <= r ) || // Left edge touching 13918 ( x2 >= l && x2 <= r ) || // Right edge touching 13919 ( x1 < l && x2 > r ) // Surrounded horizontally 13920 ); 13921 default: 13922 return false; 13923 } 13924 }; 13925} )(); 13926 13927/* 13928 This manager tracks offsets of draggables and droppables 13929*/ 13930$.ui.ddmanager = { 13931 current: null, 13932 droppables: { "default": [] }, 13933 prepareOffsets: function( t, event ) { 13934 13935 var i, j, 13936 m = $.ui.ddmanager.droppables[ t.options.scope ] || [], 13937 type = event ? event.type : null, // workaround for #2317 13938 list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack(); 13939 13940 droppablesLoop: for ( i = 0; i < m.length; i++ ) { 13941 13942 // No disabled and non-accepted 13943 if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], 13944 ( t.currentItem || t.element ) ) ) ) { 13945 continue; 13946 } 13947 13948 // Filter out elements in the current dragged item 13949 for ( j = 0; j < list.length; j++ ) { 13950 if ( list[ j ] === m[ i ].element[ 0 ] ) { 13951 m[ i ].proportions().height = 0; 13952 continue droppablesLoop; 13953 } 13954 } 13955 13956 m[ i ].visible = m[ i ].element.css( "display" ) !== "none"; 13957 if ( !m[ i ].visible ) { 13958 continue; 13959 } 13960 13961 // Activate the droppable if used directly from draggables 13962 if ( type === "mousedown" ) { 13963 m[ i ]._activate.call( m[ i ], event ); 13964 } 13965 13966 m[ i ].offset = m[ i ].element.offset(); 13967 m[ i ].proportions( { 13968 width: m[ i ].element[ 0 ].offsetWidth, 13969 height: m[ i ].element[ 0 ].offsetHeight 13970 } ); 13971 13972 } 13973 13974 }, 13975 drop: function( draggable, event ) { 13976 13977 var dropped = false; 13978 13979 // Create a copy of the droppables in case the list changes during the drop (#9116) 13980 $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() { 13981 13982 if ( !this.options ) { 13983 return; 13984 } 13985 if ( !this.options.disabled && this.visible && 13986 $.ui.intersect( draggable, this, this.options.tolerance, event ) ) { 13987 dropped = this._drop.call( this, event ) || dropped; 13988 } 13989 13990 if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], 13991 ( draggable.currentItem || draggable.element ) ) ) { 13992 this.isout = true; 13993 this.isover = false; 13994 this._deactivate.call( this, event ); 13995 } 13996 13997 } ); 13998 return dropped; 13999 14000 }, 14001 dragStart: function( draggable, event ) { 14002 14003 // Listen for scrolling so that if the dragging causes scrolling the position of the 14004 // droppables can be recalculated (see #5003) 14005 draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() { 14006 if ( !draggable.options.refreshPositions ) { 14007 $.ui.ddmanager.prepareOffsets( draggable, event ); 14008 } 14009 } ); 14010 }, 14011 drag: function( draggable, event ) { 14012 14013 // If you have a highly dynamic page, you might try this option. It renders positions 14014 // every time you move the mouse. 14015 if ( draggable.options.refreshPositions ) { 14016 $.ui.ddmanager.prepareOffsets( draggable, event ); 14017 } 14018 14019 // Run through all droppables and check their positions based on specific tolerance options 14020 $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() { 14021 14022 if ( this.options.disabled || this.greedyChild || !this.visible ) { 14023 return; 14024 } 14025 14026 var parentInstance, scope, parent, 14027 intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ), 14028 c = !intersects && this.isover ? 14029 "isout" : 14030 ( intersects && !this.isover ? "isover" : null ); 14031 if ( !c ) { 14032 return; 14033 } 14034 14035 if ( this.options.greedy ) { 14036 14037 // find droppable parents with same scope 14038 scope = this.options.scope; 14039 parent = this.element.parents( ":data(ui-droppable)" ).filter( function() { 14040 return $( this ).droppable( "instance" ).options.scope === scope; 14041 } ); 14042 14043 if ( parent.length ) { 14044 parentInstance = $( parent[ 0 ] ).droppable( "instance" ); 14045 parentInstance.greedyChild = ( c === "isover" ); 14046 } 14047 } 14048 14049 // We just moved into a greedy child 14050 if ( parentInstance && c === "isover" ) { 14051 parentInstance.isover = false; 14052 parentInstance.isout = true; 14053 parentInstance._out.call( parentInstance, event ); 14054 } 14055 14056 this[ c ] = true; 14057 this[ c === "isout" ? "isover" : "isout" ] = false; 14058 this[ c === "isover" ? "_over" : "_out" ].call( this, event ); 14059 14060 // We just moved out of a greedy child 14061 if ( parentInstance && c === "isout" ) { 14062 parentInstance.isout = false; 14063 parentInstance.isover = true; 14064 parentInstance._over.call( parentInstance, event ); 14065 } 14066 } ); 14067 14068 }, 14069 dragStop: function( draggable, event ) { 14070 draggable.element.parentsUntil( "body" ).off( "scroll.droppable" ); 14071 14072 // Call prepareOffsets one final time since IE does not fire return scroll events when 14073 // overflow was caused by drag (see #5003) 14074 if ( !draggable.options.refreshPositions ) { 14075 $.ui.ddmanager.prepareOffsets( draggable, event ); 14076 } 14077 } 14078}; 14079 14080// DEPRECATED 14081// TODO: switch return back to widget declaration at top of file when this is removed 14082if ( $.uiBackCompat !== false ) { 14083 14084 // Backcompat for activeClass and hoverClass options 14085 $.widget( "ui.droppable", $.ui.droppable, { 14086 options: { 14087 hoverClass: false, 14088 activeClass: false 14089 }, 14090 _addActiveClass: function() { 14091 this._super(); 14092 if ( this.options.activeClass ) { 14093 this.element.addClass( this.options.activeClass ); 14094 } 14095 }, 14096 _removeActiveClass: function() { 14097 this._super(); 14098 if ( this.options.activeClass ) { 14099 this.element.removeClass( this.options.activeClass ); 14100 } 14101 }, 14102 _addHoverClass: function() { 14103 this._super(); 14104 if ( this.options.hoverClass ) { 14105 this.element.addClass( this.options.hoverClass ); 14106 } 14107 }, 14108 _removeHoverClass: function() { 14109 this._super(); 14110 if ( this.options.hoverClass ) { 14111 this.element.removeClass( this.options.hoverClass ); 14112 } 14113 } 14114 } ); 14115} 14116 14117var widgetsDroppable = $.ui.droppable; 14118 14119 14120/*! 14121 * jQuery UI Progressbar 1.13.2 14122 * http://jqueryui.com 14123 * 14124 * Copyright jQuery Foundation and other contributors 14125 * Released under the MIT license. 14126 * http://jquery.org/license 14127 */ 14128 14129//>>label: Progressbar 14130//>>group: Widgets 14131/* eslint-disable max-len */ 14132//>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators. 14133/* eslint-enable max-len */ 14134//>>docs: http://api.jqueryui.com/progressbar/ 14135//>>demos: http://jqueryui.com/progressbar/ 14136//>>css.structure: ../../themes/base/core.css 14137//>>css.structure: ../../themes/base/progressbar.css 14138//>>css.theme: ../../themes/base/theme.css 14139 14140 14141var widgetsProgressbar = $.widget( "ui.progressbar", { 14142 version: "1.13.2", 14143 options: { 14144 classes: { 14145 "ui-progressbar": "ui-corner-all", 14146 "ui-progressbar-value": "ui-corner-left", 14147 "ui-progressbar-complete": "ui-corner-right" 14148 }, 14149 max: 100, 14150 value: 0, 14151 14152 change: null, 14153 complete: null 14154 }, 14155 14156 min: 0, 14157 14158 _create: function() { 14159 14160 // Constrain initial value 14161 this.oldValue = this.options.value = this._constrainedValue(); 14162 14163 this.element.attr( { 14164 14165 // Only set static values; aria-valuenow and aria-valuemax are 14166 // set inside _refreshValue() 14167 role: "progressbar", 14168 "aria-valuemin": this.min 14169 } ); 14170 this._addClass( "ui-progressbar", "ui-widget ui-widget-content" ); 14171 14172 this.valueDiv = $( "<div>" ).appendTo( this.element ); 14173 this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" ); 14174 this._refreshValue(); 14175 }, 14176 14177 _destroy: function() { 14178 this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" ); 14179 14180 this.valueDiv.remove(); 14181 }, 14182 14183 value: function( newValue ) { 14184 if ( newValue === undefined ) { 14185 return this.options.value; 14186 } 14187 14188 this.options.value = this._constrainedValue( newValue ); 14189 this._refreshValue(); 14190 }, 14191 14192 _constrainedValue: function( newValue ) { 14193 if ( newValue === undefined ) { 14194 newValue = this.options.value; 14195 } 14196 14197 this.indeterminate = newValue === false; 14198 14199 // Sanitize value 14200 if ( typeof newValue !== "number" ) { 14201 newValue = 0; 14202 } 14203 14204 return this.indeterminate ? false : 14205 Math.min( this.options.max, Math.max( this.min, newValue ) ); 14206 }, 14207 14208 _setOptions: function( options ) { 14209 14210 // Ensure "value" option is set after other values (like max) 14211 var value = options.value; 14212 delete options.value; 14213 14214 this._super( options ); 14215 14216 this.options.value = this._constrainedValue( value ); 14217 this._refreshValue(); 14218 }, 14219 14220 _setOption: function( key, value ) { 14221 if ( key === "max" ) { 14222 14223 // Don't allow a max less than min 14224 value = Math.max( this.min, value ); 14225 } 14226 this._super( key, value ); 14227 }, 14228 14229 _setOptionDisabled: function( value ) { 14230 this._super( value ); 14231 14232 this.element.attr( "aria-disabled", value ); 14233 this._toggleClass( null, "ui-state-disabled", !!value ); 14234 }, 14235 14236 _percentage: function() { 14237 return this.indeterminate ? 14238 100 : 14239 100 * ( this.options.value - this.min ) / ( this.options.max - this.min ); 14240 }, 14241 14242 _refreshValue: function() { 14243 var value = this.options.value, 14244 percentage = this._percentage(); 14245 14246 this.valueDiv 14247 .toggle( this.indeterminate || value > this.min ) 14248 .width( percentage.toFixed( 0 ) + "%" ); 14249 14250 this 14251 ._toggleClass( this.valueDiv, "ui-progressbar-complete", null, 14252 value === this.options.max ) 14253 ._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate ); 14254 14255 if ( this.indeterminate ) { 14256 this.element.removeAttr( "aria-valuenow" ); 14257 if ( !this.overlayDiv ) { 14258 this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv ); 14259 this._addClass( this.overlayDiv, "ui-progressbar-overlay" ); 14260 } 14261 } else { 14262 this.element.attr( { 14263 "aria-valuemax": this.options.max, 14264 "aria-valuenow": value 14265 } ); 14266 if ( this.overlayDiv ) { 14267 this.overlayDiv.remove(); 14268 this.overlayDiv = null; 14269 } 14270 } 14271 14272 if ( this.oldValue !== value ) { 14273 this.oldValue = value; 14274 this._trigger( "change" ); 14275 } 14276 if ( value === this.options.max ) { 14277 this._trigger( "complete" ); 14278 } 14279 } 14280} ); 14281 14282 14283/*! 14284 * jQuery UI Selectable 1.13.2 14285 * http://jqueryui.com 14286 * 14287 * Copyright jQuery Foundation and other contributors 14288 * Released under the MIT license. 14289 * http://jquery.org/license 14290 */ 14291 14292//>>label: Selectable 14293//>>group: Interactions 14294//>>description: Allows groups of elements to be selected with the mouse. 14295//>>docs: http://api.jqueryui.com/selectable/ 14296//>>demos: http://jqueryui.com/selectable/ 14297//>>css.structure: ../../themes/base/selectable.css 14298 14299 14300var widgetsSelectable = $.widget( "ui.selectable", $.ui.mouse, { 14301 version: "1.13.2", 14302 options: { 14303 appendTo: "body", 14304 autoRefresh: true, 14305 distance: 0, 14306 filter: "*", 14307 tolerance: "touch", 14308 14309 // Callbacks 14310 selected: null, 14311 selecting: null, 14312 start: null, 14313 stop: null, 14314 unselected: null, 14315 unselecting: null 14316 }, 14317 _create: function() { 14318 var that = this; 14319 14320 this._addClass( "ui-selectable" ); 14321 14322 this.dragged = false; 14323 14324 // Cache selectee children based on filter 14325 this.refresh = function() { 14326 that.elementPos = $( that.element[ 0 ] ).offset(); 14327 that.selectees = $( that.options.filter, that.element[ 0 ] ); 14328 that._addClass( that.selectees, "ui-selectee" ); 14329 that.selectees.each( function() { 14330 var $this = $( this ), 14331 selecteeOffset = $this.offset(), 14332 pos = { 14333 left: selecteeOffset.left - that.elementPos.left, 14334 top: selecteeOffset.top - that.elementPos.top 14335 }; 14336 $.data( this, "selectable-item", { 14337 element: this, 14338 $element: $this, 14339 left: pos.left, 14340 top: pos.top, 14341 right: pos.left + $this.outerWidth(), 14342 bottom: pos.top + $this.outerHeight(), 14343 startselected: false, 14344 selected: $this.hasClass( "ui-selected" ), 14345 selecting: $this.hasClass( "ui-selecting" ), 14346 unselecting: $this.hasClass( "ui-unselecting" ) 14347 } ); 14348 } ); 14349 }; 14350 this.refresh(); 14351 14352 this._mouseInit(); 14353 14354 this.helper = $( "<div>" ); 14355 this._addClass( this.helper, "ui-selectable-helper" ); 14356 }, 14357 14358 _destroy: function() { 14359 this.selectees.removeData( "selectable-item" ); 14360 this._mouseDestroy(); 14361 }, 14362 14363 _mouseStart: function( event ) { 14364 var that = this, 14365 options = this.options; 14366 14367 this.opos = [ event.pageX, event.pageY ]; 14368 this.elementPos = $( this.element[ 0 ] ).offset(); 14369 14370 if ( this.options.disabled ) { 14371 return; 14372 } 14373 14374 this.selectees = $( options.filter, this.element[ 0 ] ); 14375 14376 this._trigger( "start", event ); 14377 14378 $( options.appendTo ).append( this.helper ); 14379 14380 // position helper (lasso) 14381 this.helper.css( { 14382 "left": event.pageX, 14383 "top": event.pageY, 14384 "width": 0, 14385 "height": 0 14386 } ); 14387 14388 if ( options.autoRefresh ) { 14389 this.refresh(); 14390 } 14391 14392 this.selectees.filter( ".ui-selected" ).each( function() { 14393 var selectee = $.data( this, "selectable-item" ); 14394 selectee.startselected = true; 14395 if ( !event.metaKey && !event.ctrlKey ) { 14396 that._removeClass( selectee.$element, "ui-selected" ); 14397 selectee.selected = false; 14398 that._addClass( selectee.$element, "ui-unselecting" ); 14399 selectee.unselecting = true; 14400 14401 // selectable UNSELECTING callback 14402 that._trigger( "unselecting", event, { 14403 unselecting: selectee.element 14404 } ); 14405 } 14406 } ); 14407 14408 $( event.target ).parents().addBack().each( function() { 14409 var doSelect, 14410 selectee = $.data( this, "selectable-item" ); 14411 if ( selectee ) { 14412 doSelect = ( !event.metaKey && !event.ctrlKey ) || 14413 !selectee.$element.hasClass( "ui-selected" ); 14414 that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" ) 14415 ._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" ); 14416 selectee.unselecting = !doSelect; 14417 selectee.selecting = doSelect; 14418 selectee.selected = doSelect; 14419 14420 // selectable (UN)SELECTING callback 14421 if ( doSelect ) { 14422 that._trigger( "selecting", event, { 14423 selecting: selectee.element 14424 } ); 14425 } else { 14426 that._trigger( "unselecting", event, { 14427 unselecting: selectee.element 14428 } ); 14429 } 14430 return false; 14431 } 14432 } ); 14433 14434 }, 14435 14436 _mouseDrag: function( event ) { 14437 14438 this.dragged = true; 14439 14440 if ( this.options.disabled ) { 14441 return; 14442 } 14443 14444 var tmp, 14445 that = this, 14446 options = this.options, 14447 x1 = this.opos[ 0 ], 14448 y1 = this.opos[ 1 ], 14449 x2 = event.pageX, 14450 y2 = event.pageY; 14451 14452 if ( x1 > x2 ) { 14453 tmp = x2; x2 = x1; x1 = tmp; 14454 } 14455 if ( y1 > y2 ) { 14456 tmp = y2; y2 = y1; y1 = tmp; 14457 } 14458 this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } ); 14459 14460 this.selectees.each( function() { 14461 var selectee = $.data( this, "selectable-item" ), 14462 hit = false, 14463 offset = {}; 14464 14465 //prevent helper from being selected if appendTo: selectable 14466 if ( !selectee || selectee.element === that.element[ 0 ] ) { 14467 return; 14468 } 14469 14470 offset.left = selectee.left + that.elementPos.left; 14471 offset.right = selectee.right + that.elementPos.left; 14472 offset.top = selectee.top + that.elementPos.top; 14473 offset.bottom = selectee.bottom + that.elementPos.top; 14474 14475 if ( options.tolerance === "touch" ) { 14476 hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 || 14477 offset.bottom < y1 ) ); 14478 } else if ( options.tolerance === "fit" ) { 14479 hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 && 14480 offset.bottom < y2 ); 14481 } 14482 14483 if ( hit ) { 14484 14485 // SELECT 14486 if ( selectee.selected ) { 14487 that._removeClass( selectee.$element, "ui-selected" ); 14488 selectee.selected = false; 14489 } 14490 if ( selectee.unselecting ) { 14491 that._removeClass( selectee.$element, "ui-unselecting" ); 14492 selectee.unselecting = false; 14493 } 14494 if ( !selectee.selecting ) { 14495 that._addClass( selectee.$element, "ui-selecting" ); 14496 selectee.selecting = true; 14497 14498 // selectable SELECTING callback 14499 that._trigger( "selecting", event, { 14500 selecting: selectee.element 14501 } ); 14502 } 14503 } else { 14504 14505 // UNSELECT 14506 if ( selectee.selecting ) { 14507 if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) { 14508 that._removeClass( selectee.$element, "ui-selecting" ); 14509 selectee.selecting = false; 14510 that._addClass( selectee.$element, "ui-selected" ); 14511 selectee.selected = true; 14512 } else { 14513 that._removeClass( selectee.$element, "ui-selecting" ); 14514 selectee.selecting = false; 14515 if ( selectee.startselected ) { 14516 that._addClass( selectee.$element, "ui-unselecting" ); 14517 selectee.unselecting = true; 14518 } 14519 14520 // selectable UNSELECTING callback 14521 that._trigger( "unselecting", event, { 14522 unselecting: selectee.element 14523 } ); 14524 } 14525 } 14526 if ( selectee.selected ) { 14527 if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) { 14528 that._removeClass( selectee.$element, "ui-selected" ); 14529 selectee.selected = false; 14530 14531 that._addClass( selectee.$element, "ui-unselecting" ); 14532 selectee.unselecting = true; 14533 14534 // selectable UNSELECTING callback 14535 that._trigger( "unselecting", event, { 14536 unselecting: selectee.element 14537 } ); 14538 } 14539 } 14540 } 14541 } ); 14542 14543 return false; 14544 }, 14545 14546 _mouseStop: function( event ) { 14547 var that = this; 14548 14549 this.dragged = false; 14550 14551 $( ".ui-unselecting", this.element[ 0 ] ).each( function() { 14552 var selectee = $.data( this, "selectable-item" ); 14553 that._removeClass( selectee.$element, "ui-unselecting" ); 14554 selectee.unselecting = false; 14555 selectee.startselected = false; 14556 that._trigger( "unselected", event, { 14557 unselected: selectee.element 14558 } ); 14559 } ); 14560 $( ".ui-selecting", this.element[ 0 ] ).each( function() { 14561 var selectee = $.data( this, "selectable-item" ); 14562 that._removeClass( selectee.$element, "ui-selecting" ) 14563 ._addClass( selectee.$element, "ui-selected" ); 14564 selectee.selecting = false; 14565 selectee.selected = true; 14566 selectee.startselected = true; 14567 that._trigger( "selected", event, { 14568 selected: selectee.element 14569 } ); 14570 } ); 14571 this._trigger( "stop", event ); 14572 14573 this.helper.remove(); 14574 14575 return false; 14576 } 14577 14578} ); 14579 14580 14581/*! 14582 * jQuery UI Selectmenu 1.13.2 14583 * http://jqueryui.com 14584 * 14585 * Copyright jQuery Foundation and other contributors 14586 * Released under the MIT license. 14587 * http://jquery.org/license 14588 */ 14589 14590//>>label: Selectmenu 14591//>>group: Widgets 14592/* eslint-disable max-len */ 14593//>>description: Duplicates and extends the functionality of a native HTML select element, allowing it to be customizable in behavior and appearance far beyond the limitations of a native select. 14594/* eslint-enable max-len */ 14595//>>docs: http://api.jqueryui.com/selectmenu/ 14596//>>demos: http://jqueryui.com/selectmenu/ 14597//>>css.structure: ../../themes/base/core.css 14598//>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css 14599//>>css.theme: ../../themes/base/theme.css 14600 14601 14602var widgetsSelectmenu = $.widget( "ui.selectmenu", [ $.ui.formResetMixin, { 14603 version: "1.13.2", 14604 defaultElement: "<select>", 14605 options: { 14606 appendTo: null, 14607 classes: { 14608 "ui-selectmenu-button-open": "ui-corner-top", 14609 "ui-selectmenu-button-closed": "ui-corner-all" 14610 }, 14611 disabled: null, 14612 icons: { 14613 button: "ui-icon-triangle-1-s" 14614 }, 14615 position: { 14616 my: "left top", 14617 at: "left bottom", 14618 collision: "none" 14619 }, 14620 width: false, 14621 14622 // Callbacks 14623 change: null, 14624 close: null, 14625 focus: null, 14626 open: null, 14627 select: null 14628 }, 14629 14630 _create: function() { 14631 var selectmenuId = this.element.uniqueId().attr( "id" ); 14632 this.ids = { 14633 element: selectmenuId, 14634 button: selectmenuId + "-button", 14635 menu: selectmenuId + "-menu" 14636 }; 14637 14638 this._drawButton(); 14639 this._drawMenu(); 14640 this._bindFormResetHandler(); 14641 14642 this._rendered = false; 14643 this.menuItems = $(); 14644 }, 14645 14646 _drawButton: function() { 14647 var icon, 14648 that = this, 14649 item = this._parseOption( 14650 this.element.find( "option:selected" ), 14651 this.element[ 0 ].selectedIndex 14652 ); 14653 14654 // Associate existing label with the new button 14655 this.labels = this.element.labels().attr( "for", this.ids.button ); 14656 this._on( this.labels, { 14657 click: function( event ) { 14658 this.button.trigger( "focus" ); 14659 event.preventDefault(); 14660 } 14661 } ); 14662 14663 // Hide original select element 14664 this.element.hide(); 14665 14666 // Create button 14667 this.button = $( "<span>", { 14668 tabindex: this.options.disabled ? -1 : 0, 14669 id: this.ids.button, 14670 role: "combobox", 14671 "aria-expanded": "false", 14672 "aria-autocomplete": "list", 14673 "aria-owns": this.ids.menu, 14674 "aria-haspopup": "true", 14675 title: this.element.attr( "title" ) 14676 } ) 14677 .insertAfter( this.element ); 14678 14679 this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed", 14680 "ui-button ui-widget" ); 14681 14682 icon = $( "<span>" ).appendTo( this.button ); 14683 this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button ); 14684 this.buttonItem = this._renderButtonItem( item ) 14685 .appendTo( this.button ); 14686 14687 if ( this.options.width !== false ) { 14688 this._resizeButton(); 14689 } 14690 14691 this._on( this.button, this._buttonEvents ); 14692 this.button.one( "focusin", function() { 14693 14694 // Delay rendering the menu items until the button receives focus. 14695 // The menu may have already been rendered via a programmatic open. 14696 if ( !that._rendered ) { 14697 that._refreshMenu(); 14698 } 14699 } ); 14700 }, 14701 14702 _drawMenu: function() { 14703 var that = this; 14704 14705 // Create menu 14706 this.menu = $( "<ul>", { 14707 "aria-hidden": "true", 14708 "aria-labelledby": this.ids.button, 14709 id: this.ids.menu 14710 } ); 14711 14712 // Wrap menu 14713 this.menuWrap = $( "<div>" ).append( this.menu ); 14714 this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" ); 14715 this.menuWrap.appendTo( this._appendTo() ); 14716 14717 // Initialize menu widget 14718 this.menuInstance = this.menu 14719 .menu( { 14720 classes: { 14721 "ui-menu": "ui-corner-bottom" 14722 }, 14723 role: "listbox", 14724 select: function( event, ui ) { 14725 event.preventDefault(); 14726 14727 // Support: IE8 14728 // If the item was selected via a click, the text selection 14729 // will be destroyed in IE 14730 that._setSelection(); 14731 14732 that._select( ui.item.data( "ui-selectmenu-item" ), event ); 14733 }, 14734 focus: function( event, ui ) { 14735 var item = ui.item.data( "ui-selectmenu-item" ); 14736 14737 // Prevent inital focus from firing and check if its a newly focused item 14738 if ( that.focusIndex != null && item.index !== that.focusIndex ) { 14739 that._trigger( "focus", event, { item: item } ); 14740 if ( !that.isOpen ) { 14741 that._select( item, event ); 14742 } 14743 } 14744 that.focusIndex = item.index; 14745 14746 that.button.attr( "aria-activedescendant", 14747 that.menuItems.eq( item.index ).attr( "id" ) ); 14748 } 14749 } ) 14750 .menu( "instance" ); 14751 14752 // Don't close the menu on mouseleave 14753 this.menuInstance._off( this.menu, "mouseleave" ); 14754 14755 // Cancel the menu's collapseAll on document click 14756 this.menuInstance._closeOnDocumentClick = function() { 14757 return false; 14758 }; 14759 14760 // Selects often contain empty items, but never contain dividers 14761 this.menuInstance._isDivider = function() { 14762 return false; 14763 }; 14764 }, 14765 14766 refresh: function() { 14767 this._refreshMenu(); 14768 this.buttonItem.replaceWith( 14769 this.buttonItem = this._renderButtonItem( 14770 14771 // Fall back to an empty object in case there are no options 14772 this._getSelectedItem().data( "ui-selectmenu-item" ) || {} 14773 ) 14774 ); 14775 if ( this.options.width === null ) { 14776 this._resizeButton(); 14777 } 14778 }, 14779 14780 _refreshMenu: function() { 14781 var item, 14782 options = this.element.find( "option" ); 14783 14784 this.menu.empty(); 14785 14786 this._parseOptions( options ); 14787 this._renderMenu( this.menu, this.items ); 14788 14789 this.menuInstance.refresh(); 14790 this.menuItems = this.menu.find( "li" ) 14791 .not( ".ui-selectmenu-optgroup" ) 14792 .find( ".ui-menu-item-wrapper" ); 14793 14794 this._rendered = true; 14795 14796 if ( !options.length ) { 14797 return; 14798 } 14799 14800 item = this._getSelectedItem(); 14801 14802 // Update the menu to have the correct item focused 14803 this.menuInstance.focus( null, item ); 14804 this._setAria( item.data( "ui-selectmenu-item" ) ); 14805 14806 // Set disabled state 14807 this._setOption( "disabled", this.element.prop( "disabled" ) ); 14808 }, 14809 14810 open: function( event ) { 14811 if ( this.options.disabled ) { 14812 return; 14813 } 14814 14815 // If this is the first time the menu is being opened, render the items 14816 if ( !this._rendered ) { 14817 this._refreshMenu(); 14818 } else { 14819 14820 // Menu clears focus on close, reset focus to selected item 14821 this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" ); 14822 this.menuInstance.focus( null, this._getSelectedItem() ); 14823 } 14824 14825 // If there are no options, don't open the menu 14826 if ( !this.menuItems.length ) { 14827 return; 14828 } 14829 14830 this.isOpen = true; 14831 this._toggleAttr(); 14832 this._resizeMenu(); 14833 this._position(); 14834 14835 this._on( this.document, this._documentClick ); 14836 14837 this._trigger( "open", event ); 14838 }, 14839 14840 _position: function() { 14841 this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) ); 14842 }, 14843 14844 close: function( event ) { 14845 if ( !this.isOpen ) { 14846 return; 14847 } 14848 14849 this.isOpen = false; 14850 this._toggleAttr(); 14851 14852 this.range = null; 14853 this._off( this.document ); 14854 14855 this._trigger( "close", event ); 14856 }, 14857 14858 widget: function() { 14859 return this.button; 14860 }, 14861 14862 menuWidget: function() { 14863 return this.menu; 14864 }, 14865 14866 _renderButtonItem: function( item ) { 14867 var buttonItem = $( "<span>" ); 14868 14869 this._setText( buttonItem, item.label ); 14870 this._addClass( buttonItem, "ui-selectmenu-text" ); 14871 14872 return buttonItem; 14873 }, 14874 14875 _renderMenu: function( ul, items ) { 14876 var that = this, 14877 currentOptgroup = ""; 14878 14879 $.each( items, function( index, item ) { 14880 var li; 14881 14882 if ( item.optgroup !== currentOptgroup ) { 14883 li = $( "<li>", { 14884 text: item.optgroup 14885 } ); 14886 that._addClass( li, "ui-selectmenu-optgroup", "ui-menu-divider" + 14887 ( item.element.parent( "optgroup" ).prop( "disabled" ) ? 14888 " ui-state-disabled" : 14889 "" ) ); 14890 14891 li.appendTo( ul ); 14892 14893 currentOptgroup = item.optgroup; 14894 } 14895 14896 that._renderItemData( ul, item ); 14897 } ); 14898 }, 14899 14900 _renderItemData: function( ul, item ) { 14901 return this._renderItem( ul, item ).data( "ui-selectmenu-item", item ); 14902 }, 14903 14904 _renderItem: function( ul, item ) { 14905 var li = $( "<li>" ), 14906 wrapper = $( "<div>", { 14907 title: item.element.attr( "title" ) 14908 } ); 14909 14910 if ( item.disabled ) { 14911 this._addClass( li, null, "ui-state-disabled" ); 14912 } 14913 this._setText( wrapper, item.label ); 14914 14915 return li.append( wrapper ).appendTo( ul ); 14916 }, 14917 14918 _setText: function( element, value ) { 14919 if ( value ) { 14920 element.text( value ); 14921 } else { 14922 element.html( " " ); 14923 } 14924 }, 14925 14926 _move: function( direction, event ) { 14927 var item, next, 14928 filter = ".ui-menu-item"; 14929 14930 if ( this.isOpen ) { 14931 item = this.menuItems.eq( this.focusIndex ).parent( "li" ); 14932 } else { 14933 item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" ); 14934 filter += ":not(.ui-state-disabled)"; 14935 } 14936 14937 if ( direction === "first" || direction === "last" ) { 14938 next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 ); 14939 } else { 14940 next = item[ direction + "All" ]( filter ).eq( 0 ); 14941 } 14942 14943 if ( next.length ) { 14944 this.menuInstance.focus( event, next ); 14945 } 14946 }, 14947 14948 _getSelectedItem: function() { 14949 return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" ); 14950 }, 14951 14952 _toggle: function( event ) { 14953 this[ this.isOpen ? "close" : "open" ]( event ); 14954 }, 14955 14956 _setSelection: function() { 14957 var selection; 14958 14959 if ( !this.range ) { 14960 return; 14961 } 14962 14963 if ( window.getSelection ) { 14964 selection = window.getSelection(); 14965 selection.removeAllRanges(); 14966 selection.addRange( this.range ); 14967 14968 // Support: IE8 14969 } else { 14970 this.range.select(); 14971 } 14972 14973 // Support: IE 14974 // Setting the text selection kills the button focus in IE, but 14975 // restoring the focus doesn't kill the selection. 14976 this.button.trigger( "focus" ); 14977 }, 14978 14979 _documentClick: { 14980 mousedown: function( event ) { 14981 if ( !this.isOpen ) { 14982 return; 14983 } 14984 14985 if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + 14986 $.escapeSelector( this.ids.button ) ).length ) { 14987 this.close( event ); 14988 } 14989 } 14990 }, 14991 14992 _buttonEvents: { 14993 14994 // Prevent text selection from being reset when interacting with the selectmenu (#10144) 14995 mousedown: function() { 14996 var selection; 14997 14998 if ( window.getSelection ) { 14999 selection = window.getSelection(); 15000 if ( selection.rangeCount ) { 15001 this.range = selection.getRangeAt( 0 ); 15002 } 15003 15004 // Support: IE8 15005 } else { 15006 this.range = document.selection.createRange(); 15007 } 15008 }, 15009 15010 click: function( event ) { 15011 this._setSelection(); 15012 this._toggle( event ); 15013 }, 15014 15015 keydown: function( event ) { 15016 var preventDefault = true; 15017 switch ( event.keyCode ) { 15018 case $.ui.keyCode.TAB: 15019 case $.ui.keyCode.ESCAPE: 15020 this.close( event ); 15021 preventDefault = false; 15022 break; 15023 case $.ui.keyCode.ENTER: 15024 if ( this.isOpen ) { 15025 this._selectFocusedItem( event ); 15026 } 15027 break; 15028 case $.ui.keyCode.UP: 15029 if ( event.altKey ) { 15030 this._toggle( event ); 15031 } else { 15032 this._move( "prev", event ); 15033 } 15034 break; 15035 case $.ui.keyCode.DOWN: 15036 if ( event.altKey ) { 15037 this._toggle( event ); 15038 } else { 15039 this._move( "next", event ); 15040 } 15041 break; 15042 case $.ui.keyCode.SPACE: 15043 if ( this.isOpen ) { 15044 this._selectFocusedItem( event ); 15045 } else { 15046 this._toggle( event ); 15047 } 15048 break; 15049 case $.ui.keyCode.LEFT: 15050 this._move( "prev", event ); 15051 break; 15052 case $.ui.keyCode.RIGHT: 15053 this._move( "next", event ); 15054 break; 15055 case $.ui.keyCode.HOME: 15056 case $.ui.keyCode.PAGE_UP: 15057 this._move( "first", event ); 15058 break; 15059 case $.ui.keyCode.END: 15060 case $.ui.keyCode.PAGE_DOWN: 15061 this._move( "last", event ); 15062 break; 15063 default: 15064 this.menu.trigger( event ); 15065 preventDefault = false; 15066 } 15067 15068 if ( preventDefault ) { 15069 event.preventDefault(); 15070 } 15071 } 15072 }, 15073 15074 _selectFocusedItem: function( event ) { 15075 var item = this.menuItems.eq( this.focusIndex ).parent( "li" ); 15076 if ( !item.hasClass( "ui-state-disabled" ) ) { 15077 this._select( item.data( "ui-selectmenu-item" ), event ); 15078 } 15079 }, 15080 15081 _select: function( item, event ) { 15082 var oldIndex = this.element[ 0 ].selectedIndex; 15083 15084 // Change native select element 15085 this.element[ 0 ].selectedIndex = item.index; 15086 this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) ); 15087 this._setAria( item ); 15088 this._trigger( "select", event, { item: item } ); 15089 15090 if ( item.index !== oldIndex ) { 15091 this._trigger( "change", event, { item: item } ); 15092 } 15093 15094 this.close( event ); 15095 }, 15096 15097 _setAria: function( item ) { 15098 var id = this.menuItems.eq( item.index ).attr( "id" ); 15099 15100 this.button.attr( { 15101 "aria-labelledby": id, 15102 "aria-activedescendant": id 15103 } ); 15104 this.menu.attr( "aria-activedescendant", id ); 15105 }, 15106 15107 _setOption: function( key, value ) { 15108 if ( key === "icons" ) { 15109 var icon = this.button.find( "span.ui-icon" ); 15110 this._removeClass( icon, null, this.options.icons.button ) 15111 ._addClass( icon, null, value.button ); 15112 } 15113 15114 this._super( key, value ); 15115 15116 if ( key === "appendTo" ) { 15117 this.menuWrap.appendTo( this._appendTo() ); 15118 } 15119 15120 if ( key === "width" ) { 15121 this._resizeButton(); 15122 } 15123 }, 15124 15125 _setOptionDisabled: function( value ) { 15126 this._super( value ); 15127 15128 this.menuInstance.option( "disabled", value ); 15129 this.button.attr( "aria-disabled", value ); 15130 this._toggleClass( this.button, null, "ui-state-disabled", value ); 15131 15132 this.element.prop( "disabled", value ); 15133 if ( value ) { 15134 this.button.attr( "tabindex", -1 ); 15135 this.close(); 15136 } else { 15137 this.button.attr( "tabindex", 0 ); 15138 } 15139 }, 15140 15141 _appendTo: function() { 15142 var element = this.options.appendTo; 15143 15144 if ( element ) { 15145 element = element.jquery || element.nodeType ? 15146 $( element ) : 15147 this.document.find( element ).eq( 0 ); 15148 } 15149 15150 if ( !element || !element[ 0 ] ) { 15151 element = this.element.closest( ".ui-front, dialog" ); 15152 } 15153 15154 if ( !element.length ) { 15155 element = this.document[ 0 ].body; 15156 } 15157 15158 return element; 15159 }, 15160 15161 _toggleAttr: function() { 15162 this.button.attr( "aria-expanded", this.isOpen ); 15163 15164 // We can't use two _toggleClass() calls here, because we need to make sure 15165 // we always remove classes first and add them second, otherwise if both classes have the 15166 // same theme class, it will be removed after we add it. 15167 this._removeClass( this.button, "ui-selectmenu-button-" + 15168 ( this.isOpen ? "closed" : "open" ) ) 15169 ._addClass( this.button, "ui-selectmenu-button-" + 15170 ( this.isOpen ? "open" : "closed" ) ) 15171 ._toggleClass( this.menuWrap, "ui-selectmenu-open", null, this.isOpen ); 15172 15173 this.menu.attr( "aria-hidden", !this.isOpen ); 15174 }, 15175 15176 _resizeButton: function() { 15177 var width = this.options.width; 15178 15179 // For `width: false`, just remove inline style and stop 15180 if ( width === false ) { 15181 this.button.css( "width", "" ); 15182 return; 15183 } 15184 15185 // For `width: null`, match the width of the original element 15186 if ( width === null ) { 15187 width = this.element.show().outerWidth(); 15188 this.element.hide(); 15189 } 15190 15191 this.button.outerWidth( width ); 15192 }, 15193 15194 _resizeMenu: function() { 15195 this.menu.outerWidth( Math.max( 15196 this.button.outerWidth(), 15197 15198 // Support: IE10 15199 // IE10 wraps long text (possibly a rounding bug) 15200 // so we add 1px to avoid the wrapping 15201 this.menu.width( "" ).outerWidth() + 1 15202 ) ); 15203 }, 15204 15205 _getCreateOptions: function() { 15206 var options = this._super(); 15207 15208 options.disabled = this.element.prop( "disabled" ); 15209 15210 return options; 15211 }, 15212 15213 _parseOptions: function( options ) { 15214 var that = this, 15215 data = []; 15216 options.each( function( index, item ) { 15217 if ( item.hidden ) { 15218 return; 15219 } 15220 15221 data.push( that._parseOption( $( item ), index ) ); 15222 } ); 15223 this.items = data; 15224 }, 15225 15226 _parseOption: function( option, index ) { 15227 var optgroup = option.parent( "optgroup" ); 15228 15229 return { 15230 element: option, 15231 index: index, 15232 value: option.val(), 15233 label: option.text(), 15234 optgroup: optgroup.attr( "label" ) || "", 15235 disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" ) 15236 }; 15237 }, 15238 15239 _destroy: function() { 15240 this._unbindFormResetHandler(); 15241 this.menuWrap.remove(); 15242 this.button.remove(); 15243 this.element.show(); 15244 this.element.removeUniqueId(); 15245 this.labels.attr( "for", this.ids.element ); 15246 } 15247} ] ); 15248 15249 15250/*! 15251 * jQuery UI Slider 1.13.2 15252 * http://jqueryui.com 15253 * 15254 * Copyright jQuery Foundation and other contributors 15255 * Released under the MIT license. 15256 * http://jquery.org/license 15257 */ 15258 15259//>>label: Slider 15260//>>group: Widgets 15261//>>description: Displays a flexible slider with ranges and accessibility via keyboard. 15262//>>docs: http://api.jqueryui.com/slider/ 15263//>>demos: http://jqueryui.com/slider/ 15264//>>css.structure: ../../themes/base/core.css 15265//>>css.structure: ../../themes/base/slider.css 15266//>>css.theme: ../../themes/base/theme.css 15267 15268 15269var widgetsSlider = $.widget( "ui.slider", $.ui.mouse, { 15270 version: "1.13.2", 15271 widgetEventPrefix: "slide", 15272 15273 options: { 15274 animate: false, 15275 classes: { 15276 "ui-slider": "ui-corner-all", 15277 "ui-slider-handle": "ui-corner-all", 15278 15279 // Note: ui-widget-header isn't the most fittingly semantic framework class for this 15280 // element, but worked best visually with a variety of themes 15281 "ui-slider-range": "ui-corner-all ui-widget-header" 15282 }, 15283 distance: 0, 15284 max: 100, 15285 min: 0, 15286 orientation: "horizontal", 15287 range: false, 15288 step: 1, 15289 value: 0, 15290 values: null, 15291 15292 // Callbacks 15293 change: null, 15294 slide: null, 15295 start: null, 15296 stop: null 15297 }, 15298 15299 // Number of pages in a slider 15300 // (how many times can you page up/down to go through the whole range) 15301 numPages: 5, 15302 15303 _create: function() { 15304 this._keySliding = false; 15305 this._mouseSliding = false; 15306 this._animateOff = true; 15307 this._handleIndex = null; 15308 this._detectOrientation(); 15309 this._mouseInit(); 15310 this._calculateNewMax(); 15311 15312 this._addClass( "ui-slider ui-slider-" + this.orientation, 15313 "ui-widget ui-widget-content" ); 15314 15315 this._refresh(); 15316 15317 this._animateOff = false; 15318 }, 15319 15320 _refresh: function() { 15321 this._createRange(); 15322 this._createHandles(); 15323 this._setupEvents(); 15324 this._refreshValue(); 15325 }, 15326 15327 _createHandles: function() { 15328 var i, handleCount, 15329 options = this.options, 15330 existingHandles = this.element.find( ".ui-slider-handle" ), 15331 handle = "<span tabindex='0'></span>", 15332 handles = []; 15333 15334 handleCount = ( options.values && options.values.length ) || 1; 15335 15336 if ( existingHandles.length > handleCount ) { 15337 existingHandles.slice( handleCount ).remove(); 15338 existingHandles = existingHandles.slice( 0, handleCount ); 15339 } 15340 15341 for ( i = existingHandles.length; i < handleCount; i++ ) { 15342 handles.push( handle ); 15343 } 15344 15345 this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) ); 15346 15347 this._addClass( this.handles, "ui-slider-handle", "ui-state-default" ); 15348 15349 this.handle = this.handles.eq( 0 ); 15350 15351 this.handles.each( function( i ) { 15352 $( this ) 15353 .data( "ui-slider-handle-index", i ) 15354 .attr( "tabIndex", 0 ); 15355 } ); 15356 }, 15357 15358 _createRange: function() { 15359 var options = this.options; 15360 15361 if ( options.range ) { 15362 if ( options.range === true ) { 15363 if ( !options.values ) { 15364 options.values = [ this._valueMin(), this._valueMin() ]; 15365 } else if ( options.values.length && options.values.length !== 2 ) { 15366 options.values = [ options.values[ 0 ], options.values[ 0 ] ]; 15367 } else if ( Array.isArray( options.values ) ) { 15368 options.values = options.values.slice( 0 ); 15369 } 15370 } 15371 15372 if ( !this.range || !this.range.length ) { 15373 this.range = $( "<div>" ) 15374 .appendTo( this.element ); 15375 15376 this._addClass( this.range, "ui-slider-range" ); 15377 } else { 15378 this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" ); 15379 15380 // Handle range switching from true to min/max 15381 this.range.css( { 15382 "left": "", 15383 "bottom": "" 15384 } ); 15385 } 15386 if ( options.range === "min" || options.range === "max" ) { 15387 this._addClass( this.range, "ui-slider-range-" + options.range ); 15388 } 15389 } else { 15390 if ( this.range ) { 15391 this.range.remove(); 15392 } 15393 this.range = null; 15394 } 15395 }, 15396 15397 _setupEvents: function() { 15398 this._off( this.handles ); 15399 this._on( this.handles, this._handleEvents ); 15400 this._hoverable( this.handles ); 15401 this._focusable( this.handles ); 15402 }, 15403 15404 _destroy: function() { 15405 this.handles.remove(); 15406 if ( this.range ) { 15407 this.range.remove(); 15408 } 15409 15410 this._mouseDestroy(); 15411 }, 15412 15413 _mouseCapture: function( event ) { 15414 var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, 15415 that = this, 15416 o = this.options; 15417 15418 if ( o.disabled ) { 15419 return false; 15420 } 15421 15422 this.elementSize = { 15423 width: this.element.outerWidth(), 15424 height: this.element.outerHeight() 15425 }; 15426 this.elementOffset = this.element.offset(); 15427 15428 position = { x: event.pageX, y: event.pageY }; 15429 normValue = this._normValueFromMouse( position ); 15430 distance = this._valueMax() - this._valueMin() + 1; 15431 this.handles.each( function( i ) { 15432 var thisDistance = Math.abs( normValue - that.values( i ) ); 15433 if ( ( distance > thisDistance ) || 15434 ( distance === thisDistance && 15435 ( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) { 15436 distance = thisDistance; 15437 closestHandle = $( this ); 15438 index = i; 15439 } 15440 } ); 15441 15442 allowed = this._start( event, index ); 15443 if ( allowed === false ) { 15444 return false; 15445 } 15446 this._mouseSliding = true; 15447 15448 this._handleIndex = index; 15449 15450 this._addClass( closestHandle, null, "ui-state-active" ); 15451 closestHandle.trigger( "focus" ); 15452 15453 offset = closestHandle.offset(); 15454 mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" ); 15455 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { 15456 left: event.pageX - offset.left - ( closestHandle.width() / 2 ), 15457 top: event.pageY - offset.top - 15458 ( closestHandle.height() / 2 ) - 15459 ( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) - 15460 ( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) + 15461 ( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 ) 15462 }; 15463 15464 if ( !this.handles.hasClass( "ui-state-hover" ) ) { 15465 this._slide( event, index, normValue ); 15466 } 15467 this._animateOff = true; 15468 return true; 15469 }, 15470 15471 _mouseStart: function() { 15472 return true; 15473 }, 15474 15475 _mouseDrag: function( event ) { 15476 var position = { x: event.pageX, y: event.pageY }, 15477 normValue = this._normValueFromMouse( position ); 15478 15479 this._slide( event, this._handleIndex, normValue ); 15480 15481 return false; 15482 }, 15483 15484 _mouseStop: function( event ) { 15485 this._removeClass( this.handles, null, "ui-state-active" ); 15486 this._mouseSliding = false; 15487 15488 this._stop( event, this._handleIndex ); 15489 this._change( event, this._handleIndex ); 15490 15491 this._handleIndex = null; 15492 this._clickOffset = null; 15493 this._animateOff = false; 15494 15495 return false; 15496 }, 15497 15498 _detectOrientation: function() { 15499 this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; 15500 }, 15501 15502 _normValueFromMouse: function( position ) { 15503 var pixelTotal, 15504 pixelMouse, 15505 percentMouse, 15506 valueTotal, 15507 valueMouse; 15508 15509 if ( this.orientation === "horizontal" ) { 15510 pixelTotal = this.elementSize.width; 15511 pixelMouse = position.x - this.elementOffset.left - 15512 ( this._clickOffset ? this._clickOffset.left : 0 ); 15513 } else { 15514 pixelTotal = this.elementSize.height; 15515 pixelMouse = position.y - this.elementOffset.top - 15516 ( this._clickOffset ? this._clickOffset.top : 0 ); 15517 } 15518 15519 percentMouse = ( pixelMouse / pixelTotal ); 15520 if ( percentMouse > 1 ) { 15521 percentMouse = 1; 15522 } 15523 if ( percentMouse < 0 ) { 15524 percentMouse = 0; 15525 } 15526 if ( this.orientation === "vertical" ) { 15527 percentMouse = 1 - percentMouse; 15528 } 15529 15530 valueTotal = this._valueMax() - this._valueMin(); 15531 valueMouse = this._valueMin() + percentMouse * valueTotal; 15532 15533 return this._trimAlignValue( valueMouse ); 15534 }, 15535 15536 _uiHash: function( index, value, values ) { 15537 var uiHash = { 15538 handle: this.handles[ index ], 15539 handleIndex: index, 15540 value: value !== undefined ? value : this.value() 15541 }; 15542 15543 if ( this._hasMultipleValues() ) { 15544 uiHash.value = value !== undefined ? value : this.values( index ); 15545 uiHash.values = values || this.values(); 15546 } 15547 15548 return uiHash; 15549 }, 15550 15551 _hasMultipleValues: function() { 15552 return this.options.values && this.options.values.length; 15553 }, 15554 15555 _start: function( event, index ) { 15556 return this._trigger( "start", event, this._uiHash( index ) ); 15557 }, 15558 15559 _slide: function( event, index, newVal ) { 15560 var allowed, otherVal, 15561 currentValue = this.value(), 15562 newValues = this.values(); 15563 15564 if ( this._hasMultipleValues() ) { 15565 otherVal = this.values( index ? 0 : 1 ); 15566 currentValue = this.values( index ); 15567 15568 if ( this.options.values.length === 2 && this.options.range === true ) { 15569 newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal ); 15570 } 15571 15572 newValues[ index ] = newVal; 15573 } 15574 15575 if ( newVal === currentValue ) { 15576 return; 15577 } 15578 15579 allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) ); 15580 15581 // A slide can be canceled by returning false from the slide callback 15582 if ( allowed === false ) { 15583 return; 15584 } 15585 15586 if ( this._hasMultipleValues() ) { 15587 this.values( index, newVal ); 15588 } else { 15589 this.value( newVal ); 15590 } 15591 }, 15592 15593 _stop: function( event, index ) { 15594 this._trigger( "stop", event, this._uiHash( index ) ); 15595 }, 15596 15597 _change: function( event, index ) { 15598 if ( !this._keySliding && !this._mouseSliding ) { 15599 15600 //store the last changed value index for reference when handles overlap 15601 this._lastChangedValue = index; 15602 this._trigger( "change", event, this._uiHash( index ) ); 15603 } 15604 }, 15605 15606 value: function( newValue ) { 15607 if ( arguments.length ) { 15608 this.options.value = this._trimAlignValue( newValue ); 15609 this._refreshValue(); 15610 this._change( null, 0 ); 15611 return; 15612 } 15613 15614 return this._value(); 15615 }, 15616 15617 values: function( index, newValue ) { 15618 var vals, 15619 newValues, 15620 i; 15621 15622 if ( arguments.length > 1 ) { 15623 this.options.values[ index ] = this._trimAlignValue( newValue ); 15624 this._refreshValue(); 15625 this._change( null, index ); 15626 return; 15627 } 15628 15629 if ( arguments.length ) { 15630 if ( Array.isArray( arguments[ 0 ] ) ) { 15631 vals = this.options.values; 15632 newValues = arguments[ 0 ]; 15633 for ( i = 0; i < vals.length; i += 1 ) { 15634 vals[ i ] = this._trimAlignValue( newValues[ i ] ); 15635 this._change( null, i ); 15636 } 15637 this._refreshValue(); 15638 } else { 15639 if ( this._hasMultipleValues() ) { 15640 return this._values( index ); 15641 } else { 15642 return this.value(); 15643 } 15644 } 15645 } else { 15646 return this._values(); 15647 } 15648 }, 15649 15650 _setOption: function( key, value ) { 15651 var i, 15652 valsLength = 0; 15653 15654 if ( key === "range" && this.options.range === true ) { 15655 if ( value === "min" ) { 15656 this.options.value = this._values( 0 ); 15657 this.options.values = null; 15658 } else if ( value === "max" ) { 15659 this.options.value = this._values( this.options.values.length - 1 ); 15660 this.options.values = null; 15661 } 15662 } 15663 15664 if ( Array.isArray( this.options.values ) ) { 15665 valsLength = this.options.values.length; 15666 } 15667 15668 this._super( key, value ); 15669 15670 switch ( key ) { 15671 case "orientation": 15672 this._detectOrientation(); 15673 this._removeClass( "ui-slider-horizontal ui-slider-vertical" ) 15674 ._addClass( "ui-slider-" + this.orientation ); 15675 this._refreshValue(); 15676 if ( this.options.range ) { 15677 this._refreshRange( value ); 15678 } 15679 15680 // Reset positioning from previous orientation 15681 this.handles.css( value === "horizontal" ? "bottom" : "left", "" ); 15682 break; 15683 case "value": 15684 this._animateOff = true; 15685 this._refreshValue(); 15686 this._change( null, 0 ); 15687 this._animateOff = false; 15688 break; 15689 case "values": 15690 this._animateOff = true; 15691 this._refreshValue(); 15692 15693 // Start from the last handle to prevent unreachable handles (#9046) 15694 for ( i = valsLength - 1; i >= 0; i-- ) { 15695 this._change( null, i ); 15696 } 15697 this._animateOff = false; 15698 break; 15699 case "step": 15700 case "min": 15701 case "max": 15702 this._animateOff = true; 15703 this._calculateNewMax(); 15704 this._refreshValue(); 15705 this._animateOff = false; 15706 break; 15707 case "range": 15708 this._animateOff = true; 15709 this._refresh(); 15710 this._animateOff = false; 15711 break; 15712 } 15713 }, 15714 15715 _setOptionDisabled: function( value ) { 15716 this._super( value ); 15717 15718 this._toggleClass( null, "ui-state-disabled", !!value ); 15719 }, 15720 15721 //internal value getter 15722 // _value() returns value trimmed by min and max, aligned by step 15723 _value: function() { 15724 var val = this.options.value; 15725 val = this._trimAlignValue( val ); 15726 15727 return val; 15728 }, 15729 15730 //internal values getter 15731 // _values() returns array of values trimmed by min and max, aligned by step 15732 // _values( index ) returns single value trimmed by min and max, aligned by step 15733 _values: function( index ) { 15734 var val, 15735 vals, 15736 i; 15737 15738 if ( arguments.length ) { 15739 val = this.options.values[ index ]; 15740 val = this._trimAlignValue( val ); 15741 15742 return val; 15743 } else if ( this._hasMultipleValues() ) { 15744 15745 // .slice() creates a copy of the array 15746 // this copy gets trimmed by min and max and then returned 15747 vals = this.options.values.slice(); 15748 for ( i = 0; i < vals.length; i += 1 ) { 15749 vals[ i ] = this._trimAlignValue( vals[ i ] ); 15750 } 15751 15752 return vals; 15753 } else { 15754 return []; 15755 } 15756 }, 15757 15758 // Returns the step-aligned value that val is closest to, between (inclusive) min and max 15759 _trimAlignValue: function( val ) { 15760 if ( val <= this._valueMin() ) { 15761 return this._valueMin(); 15762 } 15763 if ( val >= this._valueMax() ) { 15764 return this._valueMax(); 15765 } 15766 var step = ( this.options.step > 0 ) ? this.options.step : 1, 15767 valModStep = ( val - this._valueMin() ) % step, 15768 alignValue = val - valModStep; 15769 15770 if ( Math.abs( valModStep ) * 2 >= step ) { 15771 alignValue += ( valModStep > 0 ) ? step : ( -step ); 15772 } 15773 15774 // Since JavaScript has problems with large floats, round 15775 // the final value to 5 digits after the decimal point (see #4124) 15776 return parseFloat( alignValue.toFixed( 5 ) ); 15777 }, 15778 15779 _calculateNewMax: function() { 15780 var max = this.options.max, 15781 min = this._valueMin(), 15782 step = this.options.step, 15783 aboveMin = Math.round( ( max - min ) / step ) * step; 15784 max = aboveMin + min; 15785 if ( max > this.options.max ) { 15786 15787 //If max is not divisible by step, rounding off may increase its value 15788 max -= step; 15789 } 15790 this.max = parseFloat( max.toFixed( this._precision() ) ); 15791 }, 15792 15793 _precision: function() { 15794 var precision = this._precisionOf( this.options.step ); 15795 if ( this.options.min !== null ) { 15796 precision = Math.max( precision, this._precisionOf( this.options.min ) ); 15797 } 15798 return precision; 15799 }, 15800 15801 _precisionOf: function( num ) { 15802 var str = num.toString(), 15803 decimal = str.indexOf( "." ); 15804 return decimal === -1 ? 0 : str.length - decimal - 1; 15805 }, 15806 15807 _valueMin: function() { 15808 return this.options.min; 15809 }, 15810 15811 _valueMax: function() { 15812 return this.max; 15813 }, 15814 15815 _refreshRange: function( orientation ) { 15816 if ( orientation === "vertical" ) { 15817 this.range.css( { "width": "", "left": "" } ); 15818 } 15819 if ( orientation === "horizontal" ) { 15820 this.range.css( { "height": "", "bottom": "" } ); 15821 } 15822 }, 15823 15824 _refreshValue: function() { 15825 var lastValPercent, valPercent, value, valueMin, valueMax, 15826 oRange = this.options.range, 15827 o = this.options, 15828 that = this, 15829 animate = ( !this._animateOff ) ? o.animate : false, 15830 _set = {}; 15831 15832 if ( this._hasMultipleValues() ) { 15833 this.handles.each( function( i ) { 15834 valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() - 15835 that._valueMin() ) * 100; 15836 _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 15837 $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 15838 if ( that.options.range === true ) { 15839 if ( that.orientation === "horizontal" ) { 15840 if ( i === 0 ) { 15841 that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15842 left: valPercent + "%" 15843 }, o.animate ); 15844 } 15845 if ( i === 1 ) { 15846 that.range[ animate ? "animate" : "css" ]( { 15847 width: ( valPercent - lastValPercent ) + "%" 15848 }, { 15849 queue: false, 15850 duration: o.animate 15851 } ); 15852 } 15853 } else { 15854 if ( i === 0 ) { 15855 that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15856 bottom: ( valPercent ) + "%" 15857 }, o.animate ); 15858 } 15859 if ( i === 1 ) { 15860 that.range[ animate ? "animate" : "css" ]( { 15861 height: ( valPercent - lastValPercent ) + "%" 15862 }, { 15863 queue: false, 15864 duration: o.animate 15865 } ); 15866 } 15867 } 15868 } 15869 lastValPercent = valPercent; 15870 } ); 15871 } else { 15872 value = this.value(); 15873 valueMin = this._valueMin(); 15874 valueMax = this._valueMax(); 15875 valPercent = ( valueMax !== valueMin ) ? 15876 ( value - valueMin ) / ( valueMax - valueMin ) * 100 : 15877 0; 15878 _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 15879 this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 15880 15881 if ( oRange === "min" && this.orientation === "horizontal" ) { 15882 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15883 width: valPercent + "%" 15884 }, o.animate ); 15885 } 15886 if ( oRange === "max" && this.orientation === "horizontal" ) { 15887 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15888 width: ( 100 - valPercent ) + "%" 15889 }, o.animate ); 15890 } 15891 if ( oRange === "min" && this.orientation === "vertical" ) { 15892 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15893 height: valPercent + "%" 15894 }, o.animate ); 15895 } 15896 if ( oRange === "max" && this.orientation === "vertical" ) { 15897 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15898 height: ( 100 - valPercent ) + "%" 15899 }, o.animate ); 15900 } 15901 } 15902 }, 15903 15904 _handleEvents: { 15905 keydown: function( event ) { 15906 var allowed, curVal, newVal, step, 15907 index = $( event.target ).data( "ui-slider-handle-index" ); 15908 15909 switch ( event.keyCode ) { 15910 case $.ui.keyCode.HOME: 15911 case $.ui.keyCode.END: 15912 case $.ui.keyCode.PAGE_UP: 15913 case $.ui.keyCode.PAGE_DOWN: 15914 case $.ui.keyCode.UP: 15915 case $.ui.keyCode.RIGHT: 15916 case $.ui.keyCode.DOWN: 15917 case $.ui.keyCode.LEFT: 15918 event.preventDefault(); 15919 if ( !this._keySliding ) { 15920 this._keySliding = true; 15921 this._addClass( $( event.target ), null, "ui-state-active" ); 15922 allowed = this._start( event, index ); 15923 if ( allowed === false ) { 15924 return; 15925 } 15926 } 15927 break; 15928 } 15929 15930 step = this.options.step; 15931 if ( this._hasMultipleValues() ) { 15932 curVal = newVal = this.values( index ); 15933 } else { 15934 curVal = newVal = this.value(); 15935 } 15936 15937 switch ( event.keyCode ) { 15938 case $.ui.keyCode.HOME: 15939 newVal = this._valueMin(); 15940 break; 15941 case $.ui.keyCode.END: 15942 newVal = this._valueMax(); 15943 break; 15944 case $.ui.keyCode.PAGE_UP: 15945 newVal = this._trimAlignValue( 15946 curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages ) 15947 ); 15948 break; 15949 case $.ui.keyCode.PAGE_DOWN: 15950 newVal = this._trimAlignValue( 15951 curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) ); 15952 break; 15953 case $.ui.keyCode.UP: 15954 case $.ui.keyCode.RIGHT: 15955 if ( curVal === this._valueMax() ) { 15956 return; 15957 } 15958 newVal = this._trimAlignValue( curVal + step ); 15959 break; 15960 case $.ui.keyCode.DOWN: 15961 case $.ui.keyCode.LEFT: 15962 if ( curVal === this._valueMin() ) { 15963 return; 15964 } 15965 newVal = this._trimAlignValue( curVal - step ); 15966 break; 15967 } 15968 15969 this._slide( event, index, newVal ); 15970 }, 15971 keyup: function( event ) { 15972 var index = $( event.target ).data( "ui-slider-handle-index" ); 15973 15974 if ( this._keySliding ) { 15975 this._keySliding = false; 15976 this._stop( event, index ); 15977 this._change( event, index ); 15978 this._removeClass( $( event.target ), null, "ui-state-active" ); 15979 } 15980 } 15981 } 15982} ); 15983 15984 15985/*! 15986 * jQuery UI Sortable 1.13.2 15987 * http://jqueryui.com 15988 * 15989 * Copyright jQuery Foundation and other contributors 15990 * Released under the MIT license. 15991 * http://jquery.org/license 15992 */ 15993 15994//>>label: Sortable 15995//>>group: Interactions 15996//>>description: Enables items in a list to be sorted using the mouse. 15997//>>docs: http://api.jqueryui.com/sortable/ 15998//>>demos: http://jqueryui.com/sortable/ 15999//>>css.structure: ../../themes/base/sortable.css 16000 16001 16002var widgetsSortable = $.widget( "ui.sortable", $.ui.mouse, { 16003 version: "1.13.2", 16004 widgetEventPrefix: "sort", 16005 ready: false, 16006 options: { 16007 appendTo: "parent", 16008 axis: false, 16009 connectWith: false, 16010 containment: false, 16011 cursor: "auto", 16012 cursorAt: false, 16013 dropOnEmpty: true, 16014 forcePlaceholderSize: false, 16015 forceHelperSize: false, 16016 grid: false, 16017 handle: false, 16018 helper: "original", 16019 items: "> *", 16020 opacity: false, 16021 placeholder: false, 16022 revert: false, 16023 scroll: true, 16024 scrollSensitivity: 20, 16025 scrollSpeed: 20, 16026 scope: "default", 16027 tolerance: "intersect", 16028 zIndex: 1000, 16029 16030 // Callbacks 16031 activate: null, 16032 beforeStop: null, 16033 change: null, 16034 deactivate: null, 16035 out: null, 16036 over: null, 16037 receive: null, 16038 remove: null, 16039 sort: null, 16040 start: null, 16041 stop: null, 16042 update: null 16043 }, 16044 16045 _isOverAxis: function( x, reference, size ) { 16046 return ( x >= reference ) && ( x < ( reference + size ) ); 16047 }, 16048 16049 _isFloating: function( item ) { 16050 return ( /left|right/ ).test( item.css( "float" ) ) || 16051 ( /inline|table-cell/ ).test( item.css( "display" ) ); 16052 }, 16053 16054 _create: function() { 16055 this.containerCache = {}; 16056 this._addClass( "ui-sortable" ); 16057 16058 //Get the items 16059 this.refresh(); 16060 16061 //Let's determine the parent's offset 16062 this.offset = this.element.offset(); 16063 16064 //Initialize mouse events for interaction 16065 this._mouseInit(); 16066 16067 this._setHandleClassName(); 16068 16069 //We're ready to go 16070 this.ready = true; 16071 16072 }, 16073 16074 _setOption: function( key, value ) { 16075 this._super( key, value ); 16076 16077 if ( key === "handle" ) { 16078 this._setHandleClassName(); 16079 } 16080 }, 16081 16082 _setHandleClassName: function() { 16083 var that = this; 16084 this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" ); 16085 $.each( this.items, function() { 16086 that._addClass( 16087 this.instance.options.handle ? 16088 this.item.find( this.instance.options.handle ) : 16089 this.item, 16090 "ui-sortable-handle" 16091 ); 16092 } ); 16093 }, 16094 16095 _destroy: function() { 16096 this._mouseDestroy(); 16097 16098 for ( var i = this.items.length - 1; i >= 0; i-- ) { 16099 this.items[ i ].item.removeData( this.widgetName + "-item" ); 16100 } 16101 16102 return this; 16103 }, 16104 16105 _mouseCapture: function( event, overrideHandle ) { 16106 var currentItem = null, 16107 validHandle = false, 16108 that = this; 16109 16110 if ( this.reverting ) { 16111 return false; 16112 } 16113 16114 if ( this.options.disabled || this.options.type === "static" ) { 16115 return false; 16116 } 16117 16118 //We have to refresh the items data once first 16119 this._refreshItems( event ); 16120 16121 //Find out if the clicked node (or one of its parents) is a actual item in this.items 16122 $( event.target ).parents().each( function() { 16123 if ( $.data( this, that.widgetName + "-item" ) === that ) { 16124 currentItem = $( this ); 16125 return false; 16126 } 16127 } ); 16128 if ( $.data( event.target, that.widgetName + "-item" ) === that ) { 16129 currentItem = $( event.target ); 16130 } 16131 16132 if ( !currentItem ) { 16133 return false; 16134 } 16135 if ( this.options.handle && !overrideHandle ) { 16136 $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() { 16137 if ( this === event.target ) { 16138 validHandle = true; 16139 } 16140 } ); 16141 if ( !validHandle ) { 16142 return false; 16143 } 16144 } 16145 16146 this.currentItem = currentItem; 16147 this._removeCurrentsFromItems(); 16148 return true; 16149 16150 }, 16151 16152 _mouseStart: function( event, overrideHandle, noActivation ) { 16153 16154 var i, body, 16155 o = this.options; 16156 16157 this.currentContainer = this; 16158 16159 //We only need to call refreshPositions, because the refreshItems call has been moved to 16160 // mouseCapture 16161 this.refreshPositions(); 16162 16163 //Prepare the dragged items parent 16164 this.appendTo = $( o.appendTo !== "parent" ? 16165 o.appendTo : 16166 this.currentItem.parent() ); 16167 16168 //Create and append the visible helper 16169 this.helper = this._createHelper( event ); 16170 16171 //Cache the helper size 16172 this._cacheHelperProportions(); 16173 16174 /* 16175 * - Position generation - 16176 * This block generates everything position related - it's the core of draggables. 16177 */ 16178 16179 //Cache the margins of the original element 16180 this._cacheMargins(); 16181 16182 //The element's absolute position on the page minus margins 16183 this.offset = this.currentItem.offset(); 16184 this.offset = { 16185 top: this.offset.top - this.margins.top, 16186 left: this.offset.left - this.margins.left 16187 }; 16188 16189 $.extend( this.offset, { 16190 click: { //Where the click happened, relative to the element 16191 left: event.pageX - this.offset.left, 16192 top: event.pageY - this.offset.top 16193 }, 16194 16195 // This is a relative to absolute position minus the actual position calculation - 16196 // only used for relative positioned helper 16197 relative: this._getRelativeOffset() 16198 } ); 16199 16200 // After we get the helper offset, but before we get the parent offset we can 16201 // change the helper's position to absolute 16202 // TODO: Still need to figure out a way to make relative sorting possible 16203 this.helper.css( "position", "absolute" ); 16204 this.cssPosition = this.helper.css( "position" ); 16205 16206 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 16207 if ( o.cursorAt ) { 16208 this._adjustOffsetFromHelper( o.cursorAt ); 16209 } 16210 16211 //Cache the former DOM position 16212 this.domPosition = { 16213 prev: this.currentItem.prev()[ 0 ], 16214 parent: this.currentItem.parent()[ 0 ] 16215 }; 16216 16217 // If the helper is not the original, hide the original so it's not playing any role during 16218 // the drag, won't cause anything bad this way 16219 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 16220 this.currentItem.hide(); 16221 } 16222 16223 //Create the placeholder 16224 this._createPlaceholder(); 16225 16226 //Get the next scrolling parent 16227 this.scrollParent = this.placeholder.scrollParent(); 16228 16229 $.extend( this.offset, { 16230 parent: this._getParentOffset() 16231 } ); 16232 16233 //Set a containment if given in the options 16234 if ( o.containment ) { 16235 this._setContainment(); 16236 } 16237 16238 if ( o.cursor && o.cursor !== "auto" ) { // cursor option 16239 body = this.document.find( "body" ); 16240 16241 // Support: IE 16242 this.storedCursor = body.css( "cursor" ); 16243 body.css( "cursor", o.cursor ); 16244 16245 this.storedStylesheet = 16246 $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body ); 16247 } 16248 16249 // We need to make sure to grab the zIndex before setting the 16250 // opacity, because setting the opacity to anything lower than 1 16251 // causes the zIndex to change from "auto" to 0. 16252 if ( o.zIndex ) { // zIndex option 16253 if ( this.helper.css( "zIndex" ) ) { 16254 this._storedZIndex = this.helper.css( "zIndex" ); 16255 } 16256 this.helper.css( "zIndex", o.zIndex ); 16257 } 16258 16259 if ( o.opacity ) { // opacity option 16260 if ( this.helper.css( "opacity" ) ) { 16261 this._storedOpacity = this.helper.css( "opacity" ); 16262 } 16263 this.helper.css( "opacity", o.opacity ); 16264 } 16265 16266 //Prepare scrolling 16267 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 16268 this.scrollParent[ 0 ].tagName !== "HTML" ) { 16269 this.overflowOffset = this.scrollParent.offset(); 16270 } 16271 16272 //Call callbacks 16273 this._trigger( "start", event, this._uiHash() ); 16274 16275 //Recache the helper size 16276 if ( !this._preserveHelperProportions ) { 16277 this._cacheHelperProportions(); 16278 } 16279 16280 //Post "activate" events to possible containers 16281 if ( !noActivation ) { 16282 for ( i = this.containers.length - 1; i >= 0; i-- ) { 16283 this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) ); 16284 } 16285 } 16286 16287 //Prepare possible droppables 16288 if ( $.ui.ddmanager ) { 16289 $.ui.ddmanager.current = this; 16290 } 16291 16292 if ( $.ui.ddmanager && !o.dropBehaviour ) { 16293 $.ui.ddmanager.prepareOffsets( this, event ); 16294 } 16295 16296 this.dragging = true; 16297 16298 this._addClass( this.helper, "ui-sortable-helper" ); 16299 16300 //Move the helper, if needed 16301 if ( !this.helper.parent().is( this.appendTo ) ) { 16302 this.helper.detach().appendTo( this.appendTo ); 16303 16304 //Update position 16305 this.offset.parent = this._getParentOffset(); 16306 } 16307 16308 //Generate the original position 16309 this.position = this.originalPosition = this._generatePosition( event ); 16310 this.originalPageX = event.pageX; 16311 this.originalPageY = event.pageY; 16312 this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" ); 16313 16314 this._mouseDrag( event ); 16315 16316 return true; 16317 16318 }, 16319 16320 _scroll: function( event ) { 16321 var o = this.options, 16322 scrolled = false; 16323 16324 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 16325 this.scrollParent[ 0 ].tagName !== "HTML" ) { 16326 16327 if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) - 16328 event.pageY < o.scrollSensitivity ) { 16329 this.scrollParent[ 0 ].scrollTop = 16330 scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed; 16331 } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) { 16332 this.scrollParent[ 0 ].scrollTop = 16333 scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed; 16334 } 16335 16336 if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) - 16337 event.pageX < o.scrollSensitivity ) { 16338 this.scrollParent[ 0 ].scrollLeft = scrolled = 16339 this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed; 16340 } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) { 16341 this.scrollParent[ 0 ].scrollLeft = scrolled = 16342 this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed; 16343 } 16344 16345 } else { 16346 16347 if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) { 16348 scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed ); 16349 } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) < 16350 o.scrollSensitivity ) { 16351 scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed ); 16352 } 16353 16354 if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) { 16355 scrolled = this.document.scrollLeft( 16356 this.document.scrollLeft() - o.scrollSpeed 16357 ); 16358 } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) < 16359 o.scrollSensitivity ) { 16360 scrolled = this.document.scrollLeft( 16361 this.document.scrollLeft() + o.scrollSpeed 16362 ); 16363 } 16364 16365 } 16366 16367 return scrolled; 16368 }, 16369 16370 _mouseDrag: function( event ) { 16371 var i, item, itemElement, intersection, 16372 o = this.options; 16373 16374 //Compute the helpers position 16375 this.position = this._generatePosition( event ); 16376 this.positionAbs = this._convertPositionTo( "absolute" ); 16377 16378 //Set the helper position 16379 if ( !this.options.axis || this.options.axis !== "y" ) { 16380 this.helper[ 0 ].style.left = this.position.left + "px"; 16381 } 16382 if ( !this.options.axis || this.options.axis !== "x" ) { 16383 this.helper[ 0 ].style.top = this.position.top + "px"; 16384 } 16385 16386 //Do scrolling 16387 if ( o.scroll ) { 16388 if ( this._scroll( event ) !== false ) { 16389 16390 //Update item positions used in position checks 16391 this._refreshItemPositions( true ); 16392 16393 if ( $.ui.ddmanager && !o.dropBehaviour ) { 16394 $.ui.ddmanager.prepareOffsets( this, event ); 16395 } 16396 } 16397 } 16398 16399 this.dragDirection = { 16400 vertical: this._getDragVerticalDirection(), 16401 horizontal: this._getDragHorizontalDirection() 16402 }; 16403 16404 //Rearrange 16405 for ( i = this.items.length - 1; i >= 0; i-- ) { 16406 16407 //Cache variables and intersection, continue if no intersection 16408 item = this.items[ i ]; 16409 itemElement = item.item[ 0 ]; 16410 intersection = this._intersectsWithPointer( item ); 16411 if ( !intersection ) { 16412 continue; 16413 } 16414 16415 // Only put the placeholder inside the current Container, skip all 16416 // items from other containers. This works because when moving 16417 // an item from one container to another the 16418 // currentContainer is switched before the placeholder is moved. 16419 // 16420 // Without this, moving items in "sub-sortables" can cause 16421 // the placeholder to jitter between the outer and inner container. 16422 if ( item.instance !== this.currentContainer ) { 16423 continue; 16424 } 16425 16426 // Cannot intersect with itself 16427 // no useless actions that have been done before 16428 // no action if the item moved is the parent of the item checked 16429 if ( itemElement !== this.currentItem[ 0 ] && 16430 this.placeholder[ intersection === 1 ? 16431 "next" : "prev" ]()[ 0 ] !== itemElement && 16432 !$.contains( this.placeholder[ 0 ], itemElement ) && 16433 ( this.options.type === "semi-dynamic" ? 16434 !$.contains( this.element[ 0 ], itemElement ) : 16435 true 16436 ) 16437 ) { 16438 16439 this.direction = intersection === 1 ? "down" : "up"; 16440 16441 if ( this.options.tolerance === "pointer" || 16442 this._intersectsWithSides( item ) ) { 16443 this._rearrange( event, item ); 16444 } else { 16445 break; 16446 } 16447 16448 this._trigger( "change", event, this._uiHash() ); 16449 break; 16450 } 16451 } 16452 16453 //Post events to containers 16454 this._contactContainers( event ); 16455 16456 //Interconnect with droppables 16457 if ( $.ui.ddmanager ) { 16458 $.ui.ddmanager.drag( this, event ); 16459 } 16460 16461 //Call callbacks 16462 this._trigger( "sort", event, this._uiHash() ); 16463 16464 this.lastPositionAbs = this.positionAbs; 16465 return false; 16466 16467 }, 16468 16469 _mouseStop: function( event, noPropagation ) { 16470 16471 if ( !event ) { 16472 return; 16473 } 16474 16475 //If we are using droppables, inform the manager about the drop 16476 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 16477 $.ui.ddmanager.drop( this, event ); 16478 } 16479 16480 if ( this.options.revert ) { 16481 var that = this, 16482 cur = this.placeholder.offset(), 16483 axis = this.options.axis, 16484 animation = {}; 16485 16486 if ( !axis || axis === "x" ) { 16487 animation.left = cur.left - this.offset.parent.left - this.margins.left + 16488 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 16489 0 : 16490 this.offsetParent[ 0 ].scrollLeft 16491 ); 16492 } 16493 if ( !axis || axis === "y" ) { 16494 animation.top = cur.top - this.offset.parent.top - this.margins.top + 16495 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 16496 0 : 16497 this.offsetParent[ 0 ].scrollTop 16498 ); 16499 } 16500 this.reverting = true; 16501 $( this.helper ).animate( 16502 animation, 16503 parseInt( this.options.revert, 10 ) || 500, 16504 function() { 16505 that._clear( event ); 16506 } 16507 ); 16508 } else { 16509 this._clear( event, noPropagation ); 16510 } 16511 16512 return false; 16513 16514 }, 16515 16516 cancel: function() { 16517 16518 if ( this.dragging ) { 16519 16520 this._mouseUp( new $.Event( "mouseup", { target: null } ) ); 16521 16522 if ( this.options.helper === "original" ) { 16523 this.currentItem.css( this._storedCSS ); 16524 this._removeClass( this.currentItem, "ui-sortable-helper" ); 16525 } else { 16526 this.currentItem.show(); 16527 } 16528 16529 //Post deactivating events to containers 16530 for ( var i = this.containers.length - 1; i >= 0; i-- ) { 16531 this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) ); 16532 if ( this.containers[ i ].containerCache.over ) { 16533 this.containers[ i ]._trigger( "out", null, this._uiHash( this ) ); 16534 this.containers[ i ].containerCache.over = 0; 16535 } 16536 } 16537 16538 } 16539 16540 if ( this.placeholder ) { 16541 16542 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 16543 // it unbinds ALL events from the original node! 16544 if ( this.placeholder[ 0 ].parentNode ) { 16545 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 16546 } 16547 if ( this.options.helper !== "original" && this.helper && 16548 this.helper[ 0 ].parentNode ) { 16549 this.helper.remove(); 16550 } 16551 16552 $.extend( this, { 16553 helper: null, 16554 dragging: false, 16555 reverting: false, 16556 _noFinalSort: null 16557 } ); 16558 16559 if ( this.domPosition.prev ) { 16560 $( this.domPosition.prev ).after( this.currentItem ); 16561 } else { 16562 $( this.domPosition.parent ).prepend( this.currentItem ); 16563 } 16564 } 16565 16566 return this; 16567 16568 }, 16569 16570 serialize: function( o ) { 16571 16572 var items = this._getItemsAsjQuery( o && o.connected ), 16573 str = []; 16574 o = o || {}; 16575 16576 $( items ).each( function() { 16577 var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" ) 16578 .match( o.expression || ( /(.+)[\-=_](.+)/ ) ); 16579 if ( res ) { 16580 str.push( 16581 ( o.key || res[ 1 ] + "[]" ) + 16582 "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) ); 16583 } 16584 } ); 16585 16586 if ( !str.length && o.key ) { 16587 str.push( o.key + "=" ); 16588 } 16589 16590 return str.join( "&" ); 16591 16592 }, 16593 16594 toArray: function( o ) { 16595 16596 var items = this._getItemsAsjQuery( o && o.connected ), 16597 ret = []; 16598 16599 o = o || {}; 16600 16601 items.each( function() { 16602 ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" ); 16603 } ); 16604 return ret; 16605 16606 }, 16607 16608 /* Be careful with the following core functions */ 16609 _intersectsWith: function( item ) { 16610 16611 var x1 = this.positionAbs.left, 16612 x2 = x1 + this.helperProportions.width, 16613 y1 = this.positionAbs.top, 16614 y2 = y1 + this.helperProportions.height, 16615 l = item.left, 16616 r = l + item.width, 16617 t = item.top, 16618 b = t + item.height, 16619 dyClick = this.offset.click.top, 16620 dxClick = this.offset.click.left, 16621 isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && 16622 ( y1 + dyClick ) < b ), 16623 isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && 16624 ( x1 + dxClick ) < r ), 16625 isOverElement = isOverElementHeight && isOverElementWidth; 16626 16627 if ( this.options.tolerance === "pointer" || 16628 this.options.forcePointerForContainers || 16629 ( this.options.tolerance !== "pointer" && 16630 this.helperProportions[ this.floating ? "width" : "height" ] > 16631 item[ this.floating ? "width" : "height" ] ) 16632 ) { 16633 return isOverElement; 16634 } else { 16635 16636 return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half 16637 x2 - ( this.helperProportions.width / 2 ) < r && // Left Half 16638 t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half 16639 y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half 16640 16641 } 16642 }, 16643 16644 _intersectsWithPointer: function( item ) { 16645 var verticalDirection, horizontalDirection, 16646 isOverElementHeight = ( this.options.axis === "x" ) || 16647 this._isOverAxis( 16648 this.positionAbs.top + this.offset.click.top, item.top, item.height ), 16649 isOverElementWidth = ( this.options.axis === "y" ) || 16650 this._isOverAxis( 16651 this.positionAbs.left + this.offset.click.left, item.left, item.width ), 16652 isOverElement = isOverElementHeight && isOverElementWidth; 16653 16654 if ( !isOverElement ) { 16655 return false; 16656 } 16657 16658 verticalDirection = this.dragDirection.vertical; 16659 horizontalDirection = this.dragDirection.horizontal; 16660 16661 return this.floating ? 16662 ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) : 16663 ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) ); 16664 16665 }, 16666 16667 _intersectsWithSides: function( item ) { 16668 16669 var isOverBottomHalf = this._isOverAxis( this.positionAbs.top + 16670 this.offset.click.top, item.top + ( item.height / 2 ), item.height ), 16671 isOverRightHalf = this._isOverAxis( this.positionAbs.left + 16672 this.offset.click.left, item.left + ( item.width / 2 ), item.width ), 16673 verticalDirection = this.dragDirection.vertical, 16674 horizontalDirection = this.dragDirection.horizontal; 16675 16676 if ( this.floating && horizontalDirection ) { 16677 return ( ( horizontalDirection === "right" && isOverRightHalf ) || 16678 ( horizontalDirection === "left" && !isOverRightHalf ) ); 16679 } else { 16680 return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) || 16681 ( verticalDirection === "up" && !isOverBottomHalf ) ); 16682 } 16683 16684 }, 16685 16686 _getDragVerticalDirection: function() { 16687 var delta = this.positionAbs.top - this.lastPositionAbs.top; 16688 return delta !== 0 && ( delta > 0 ? "down" : "up" ); 16689 }, 16690 16691 _getDragHorizontalDirection: function() { 16692 var delta = this.positionAbs.left - this.lastPositionAbs.left; 16693 return delta !== 0 && ( delta > 0 ? "right" : "left" ); 16694 }, 16695 16696 refresh: function( event ) { 16697 this._refreshItems( event ); 16698 this._setHandleClassName(); 16699 this.refreshPositions(); 16700 return this; 16701 }, 16702 16703 _connectWith: function() { 16704 var options = this.options; 16705 return options.connectWith.constructor === String ? 16706 [ options.connectWith ] : 16707 options.connectWith; 16708 }, 16709 16710 _getItemsAsjQuery: function( connected ) { 16711 16712 var i, j, cur, inst, 16713 items = [], 16714 queries = [], 16715 connectWith = this._connectWith(); 16716 16717 if ( connectWith && connected ) { 16718 for ( i = connectWith.length - 1; i >= 0; i-- ) { 16719 cur = $( connectWith[ i ], this.document[ 0 ] ); 16720 for ( j = cur.length - 1; j >= 0; j-- ) { 16721 inst = $.data( cur[ j ], this.widgetFullName ); 16722 if ( inst && inst !== this && !inst.options.disabled ) { 16723 queries.push( [ typeof inst.options.items === "function" ? 16724 inst.options.items.call( inst.element ) : 16725 $( inst.options.items, inst.element ) 16726 .not( ".ui-sortable-helper" ) 16727 .not( ".ui-sortable-placeholder" ), inst ] ); 16728 } 16729 } 16730 } 16731 } 16732 16733 queries.push( [ typeof this.options.items === "function" ? 16734 this.options.items 16735 .call( this.element, null, { options: this.options, item: this.currentItem } ) : 16736 $( this.options.items, this.element ) 16737 .not( ".ui-sortable-helper" ) 16738 .not( ".ui-sortable-placeholder" ), this ] ); 16739 16740 function addItems() { 16741 items.push( this ); 16742 } 16743 for ( i = queries.length - 1; i >= 0; i-- ) { 16744 queries[ i ][ 0 ].each( addItems ); 16745 } 16746 16747 return $( items ); 16748 16749 }, 16750 16751 _removeCurrentsFromItems: function() { 16752 16753 var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" ); 16754 16755 this.items = $.grep( this.items, function( item ) { 16756 for ( var j = 0; j < list.length; j++ ) { 16757 if ( list[ j ] === item.item[ 0 ] ) { 16758 return false; 16759 } 16760 } 16761 return true; 16762 } ); 16763 16764 }, 16765 16766 _refreshItems: function( event ) { 16767 16768 this.items = []; 16769 this.containers = [ this ]; 16770 16771 var i, j, cur, inst, targetData, _queries, item, queriesLength, 16772 items = this.items, 16773 queries = [ [ typeof this.options.items === "function" ? 16774 this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) : 16775 $( this.options.items, this.element ), this ] ], 16776 connectWith = this._connectWith(); 16777 16778 //Shouldn't be run the first time through due to massive slow-down 16779 if ( connectWith && this.ready ) { 16780 for ( i = connectWith.length - 1; i >= 0; i-- ) { 16781 cur = $( connectWith[ i ], this.document[ 0 ] ); 16782 for ( j = cur.length - 1; j >= 0; j-- ) { 16783 inst = $.data( cur[ j ], this.widgetFullName ); 16784 if ( inst && inst !== this && !inst.options.disabled ) { 16785 queries.push( [ typeof inst.options.items === "function" ? 16786 inst.options.items 16787 .call( inst.element[ 0 ], event, { item: this.currentItem } ) : 16788 $( inst.options.items, inst.element ), inst ] ); 16789 this.containers.push( inst ); 16790 } 16791 } 16792 } 16793 } 16794 16795 for ( i = queries.length - 1; i >= 0; i-- ) { 16796 targetData = queries[ i ][ 1 ]; 16797 _queries = queries[ i ][ 0 ]; 16798 16799 for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) { 16800 item = $( _queries[ j ] ); 16801 16802 // Data for target checking (mouse manager) 16803 item.data( this.widgetName + "-item", targetData ); 16804 16805 items.push( { 16806 item: item, 16807 instance: targetData, 16808 width: 0, height: 0, 16809 left: 0, top: 0 16810 } ); 16811 } 16812 } 16813 16814 }, 16815 16816 _refreshItemPositions: function( fast ) { 16817 var i, item, t, p; 16818 16819 for ( i = this.items.length - 1; i >= 0; i-- ) { 16820 item = this.items[ i ]; 16821 16822 //We ignore calculating positions of all connected containers when we're not over them 16823 if ( this.currentContainer && item.instance !== this.currentContainer && 16824 item.item[ 0 ] !== this.currentItem[ 0 ] ) { 16825 continue; 16826 } 16827 16828 t = this.options.toleranceElement ? 16829 $( this.options.toleranceElement, item.item ) : 16830 item.item; 16831 16832 if ( !fast ) { 16833 item.width = t.outerWidth(); 16834 item.height = t.outerHeight(); 16835 } 16836 16837 p = t.offset(); 16838 item.left = p.left; 16839 item.top = p.top; 16840 } 16841 }, 16842 16843 refreshPositions: function( fast ) { 16844 16845 // Determine whether items are being displayed horizontally 16846 this.floating = this.items.length ? 16847 this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) : 16848 false; 16849 16850 // This has to be redone because due to the item being moved out/into the offsetParent, 16851 // the offsetParent's position will change 16852 if ( this.offsetParent && this.helper ) { 16853 this.offset.parent = this._getParentOffset(); 16854 } 16855 16856 this._refreshItemPositions( fast ); 16857 16858 var i, p; 16859 16860 if ( this.options.custom && this.options.custom.refreshContainers ) { 16861 this.options.custom.refreshContainers.call( this ); 16862 } else { 16863 for ( i = this.containers.length - 1; i >= 0; i-- ) { 16864 p = this.containers[ i ].element.offset(); 16865 this.containers[ i ].containerCache.left = p.left; 16866 this.containers[ i ].containerCache.top = p.top; 16867 this.containers[ i ].containerCache.width = 16868 this.containers[ i ].element.outerWidth(); 16869 this.containers[ i ].containerCache.height = 16870 this.containers[ i ].element.outerHeight(); 16871 } 16872 } 16873 16874 return this; 16875 }, 16876 16877 _createPlaceholder: function( that ) { 16878 that = that || this; 16879 var className, nodeName, 16880 o = that.options; 16881 16882 if ( !o.placeholder || o.placeholder.constructor === String ) { 16883 className = o.placeholder; 16884 nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(); 16885 o.placeholder = { 16886 element: function() { 16887 16888 var element = $( "<" + nodeName + ">", that.document[ 0 ] ); 16889 16890 that._addClass( element, "ui-sortable-placeholder", 16891 className || that.currentItem[ 0 ].className ) 16892 ._removeClass( element, "ui-sortable-helper" ); 16893 16894 if ( nodeName === "tbody" ) { 16895 that._createTrPlaceholder( 16896 that.currentItem.find( "tr" ).eq( 0 ), 16897 $( "<tr>", that.document[ 0 ] ).appendTo( element ) 16898 ); 16899 } else if ( nodeName === "tr" ) { 16900 that._createTrPlaceholder( that.currentItem, element ); 16901 } else if ( nodeName === "img" ) { 16902 element.attr( "src", that.currentItem.attr( "src" ) ); 16903 } 16904 16905 if ( !className ) { 16906 element.css( "visibility", "hidden" ); 16907 } 16908 16909 return element; 16910 }, 16911 update: function( container, p ) { 16912 16913 // 1. If a className is set as 'placeholder option, we don't force sizes - 16914 // the class is responsible for that 16915 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a 16916 // class name is specified 16917 if ( className && !o.forcePlaceholderSize ) { 16918 return; 16919 } 16920 16921 // If the element doesn't have a actual height or width by itself (without 16922 // styles coming from a stylesheet), it receives the inline height and width 16923 // from the dragged item. Or, if it's a tbody or tr, it's going to have a height 16924 // anyway since we're populating them with <td>s above, but they're unlikely to 16925 // be the correct height on their own if the row heights are dynamic, so we'll 16926 // always assign the height of the dragged item given forcePlaceholderSize 16927 // is true. 16928 if ( !p.height() || ( o.forcePlaceholderSize && 16929 ( nodeName === "tbody" || nodeName === "tr" ) ) ) { 16930 p.height( 16931 that.currentItem.innerHeight() - 16932 parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) - 16933 parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) ); 16934 } 16935 if ( !p.width() ) { 16936 p.width( 16937 that.currentItem.innerWidth() - 16938 parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) - 16939 parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) ); 16940 } 16941 } 16942 }; 16943 } 16944 16945 //Create the placeholder 16946 that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) ); 16947 16948 //Append it after the actual current item 16949 that.currentItem.after( that.placeholder ); 16950 16951 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 16952 o.placeholder.update( that, that.placeholder ); 16953 16954 }, 16955 16956 _createTrPlaceholder: function( sourceTr, targetTr ) { 16957 var that = this; 16958 16959 sourceTr.children().each( function() { 16960 $( "<td> </td>", that.document[ 0 ] ) 16961 .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) 16962 .appendTo( targetTr ); 16963 } ); 16964 }, 16965 16966 _contactContainers: function( event ) { 16967 var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, 16968 floating, axis, 16969 innermostContainer = null, 16970 innermostIndex = null; 16971 16972 // Get innermost container that intersects with item 16973 for ( i = this.containers.length - 1; i >= 0; i-- ) { 16974 16975 // Never consider a container that's located within the item itself 16976 if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) { 16977 continue; 16978 } 16979 16980 if ( this._intersectsWith( this.containers[ i ].containerCache ) ) { 16981 16982 // If we've already found a container and it's more "inner" than this, then continue 16983 if ( innermostContainer && 16984 $.contains( 16985 this.containers[ i ].element[ 0 ], 16986 innermostContainer.element[ 0 ] ) ) { 16987 continue; 16988 } 16989 16990 innermostContainer = this.containers[ i ]; 16991 innermostIndex = i; 16992 16993 } else { 16994 16995 // container doesn't intersect. trigger "out" event if necessary 16996 if ( this.containers[ i ].containerCache.over ) { 16997 this.containers[ i ]._trigger( "out", event, this._uiHash( this ) ); 16998 this.containers[ i ].containerCache.over = 0; 16999 } 17000 } 17001 17002 } 17003 17004 // If no intersecting containers found, return 17005 if ( !innermostContainer ) { 17006 return; 17007 } 17008 17009 // Move the item into the container if it's not there already 17010 if ( this.containers.length === 1 ) { 17011 if ( !this.containers[ innermostIndex ].containerCache.over ) { 17012 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 17013 this.containers[ innermostIndex ].containerCache.over = 1; 17014 } 17015 } else { 17016 17017 // When entering a new container, we will find the item with the least distance and 17018 // append our item near it 17019 dist = 10000; 17020 itemWithLeastDistance = null; 17021 floating = innermostContainer.floating || this._isFloating( this.currentItem ); 17022 posProperty = floating ? "left" : "top"; 17023 sizeProperty = floating ? "width" : "height"; 17024 axis = floating ? "pageX" : "pageY"; 17025 17026 for ( j = this.items.length - 1; j >= 0; j-- ) { 17027 if ( !$.contains( 17028 this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] ) 17029 ) { 17030 continue; 17031 } 17032 if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) { 17033 continue; 17034 } 17035 17036 cur = this.items[ j ].item.offset()[ posProperty ]; 17037 nearBottom = false; 17038 if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) { 17039 nearBottom = true; 17040 } 17041 17042 if ( Math.abs( event[ axis ] - cur ) < dist ) { 17043 dist = Math.abs( event[ axis ] - cur ); 17044 itemWithLeastDistance = this.items[ j ]; 17045 this.direction = nearBottom ? "up" : "down"; 17046 } 17047 } 17048 17049 //Check if dropOnEmpty is enabled 17050 if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) { 17051 return; 17052 } 17053 17054 if ( this.currentContainer === this.containers[ innermostIndex ] ) { 17055 if ( !this.currentContainer.containerCache.over ) { 17056 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() ); 17057 this.currentContainer.containerCache.over = 1; 17058 } 17059 return; 17060 } 17061 17062 if ( itemWithLeastDistance ) { 17063 this._rearrange( event, itemWithLeastDistance, null, true ); 17064 } else { 17065 this._rearrange( event, null, this.containers[ innermostIndex ].element, true ); 17066 } 17067 this._trigger( "change", event, this._uiHash() ); 17068 this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) ); 17069 this.currentContainer = this.containers[ innermostIndex ]; 17070 17071 //Update the placeholder 17072 this.options.placeholder.update( this.currentContainer, this.placeholder ); 17073 17074 //Update scrollParent 17075 this.scrollParent = this.placeholder.scrollParent(); 17076 17077 //Update overflowOffset 17078 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 17079 this.scrollParent[ 0 ].tagName !== "HTML" ) { 17080 this.overflowOffset = this.scrollParent.offset(); 17081 } 17082 17083 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 17084 this.containers[ innermostIndex ].containerCache.over = 1; 17085 } 17086 17087 }, 17088 17089 _createHelper: function( event ) { 17090 17091 var o = this.options, 17092 helper = typeof o.helper === "function" ? 17093 $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) : 17094 ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem ); 17095 17096 //Add the helper to the DOM if that didn't happen already 17097 if ( !helper.parents( "body" ).length ) { 17098 this.appendTo[ 0 ].appendChild( helper[ 0 ] ); 17099 } 17100 17101 if ( helper[ 0 ] === this.currentItem[ 0 ] ) { 17102 this._storedCSS = { 17103 width: this.currentItem[ 0 ].style.width, 17104 height: this.currentItem[ 0 ].style.height, 17105 position: this.currentItem.css( "position" ), 17106 top: this.currentItem.css( "top" ), 17107 left: this.currentItem.css( "left" ) 17108 }; 17109 } 17110 17111 if ( !helper[ 0 ].style.width || o.forceHelperSize ) { 17112 helper.width( this.currentItem.width() ); 17113 } 17114 if ( !helper[ 0 ].style.height || o.forceHelperSize ) { 17115 helper.height( this.currentItem.height() ); 17116 } 17117 17118 return helper; 17119 17120 }, 17121 17122 _adjustOffsetFromHelper: function( obj ) { 17123 if ( typeof obj === "string" ) { 17124 obj = obj.split( " " ); 17125 } 17126 if ( Array.isArray( obj ) ) { 17127 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 17128 } 17129 if ( "left" in obj ) { 17130 this.offset.click.left = obj.left + this.margins.left; 17131 } 17132 if ( "right" in obj ) { 17133 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 17134 } 17135 if ( "top" in obj ) { 17136 this.offset.click.top = obj.top + this.margins.top; 17137 } 17138 if ( "bottom" in obj ) { 17139 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 17140 } 17141 }, 17142 17143 _getParentOffset: function() { 17144 17145 //Get the offsetParent and cache its position 17146 this.offsetParent = this.helper.offsetParent(); 17147 var po = this.offsetParent.offset(); 17148 17149 // This is a special case where we need to modify a offset calculated on start, since the 17150 // following happened: 17151 // 1. The position of the helper is absolute, so it's position is calculated based on the 17152 // next positioned parent 17153 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 17154 // the document, which means that the scroll is included in the initial calculation of the 17155 // offset of the parent, and never recalculated upon drag 17156 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] && 17157 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 17158 po.left += this.scrollParent.scrollLeft(); 17159 po.top += this.scrollParent.scrollTop(); 17160 } 17161 17162 // This needs to be actually done for all browsers, since pageX/pageY includes this 17163 // information with an ugly IE fix 17164 if ( this.offsetParent[ 0 ] === this.document[ 0 ].body || 17165 ( this.offsetParent[ 0 ].tagName && 17166 this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) { 17167 po = { top: 0, left: 0 }; 17168 } 17169 17170 return { 17171 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 17172 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 17173 }; 17174 17175 }, 17176 17177 _getRelativeOffset: function() { 17178 17179 if ( this.cssPosition === "relative" ) { 17180 var p = this.currentItem.position(); 17181 return { 17182 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 17183 this.scrollParent.scrollTop(), 17184 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 17185 this.scrollParent.scrollLeft() 17186 }; 17187 } else { 17188 return { top: 0, left: 0 }; 17189 } 17190 17191 }, 17192 17193 _cacheMargins: function() { 17194 this.margins = { 17195 left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ), 17196 top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 ) 17197 }; 17198 }, 17199 17200 _cacheHelperProportions: function() { 17201 this.helperProportions = { 17202 width: this.helper.outerWidth(), 17203 height: this.helper.outerHeight() 17204 }; 17205 }, 17206 17207 _setContainment: function() { 17208 17209 var ce, co, over, 17210 o = this.options; 17211 if ( o.containment === "parent" ) { 17212 o.containment = this.helper[ 0 ].parentNode; 17213 } 17214 if ( o.containment === "document" || o.containment === "window" ) { 17215 this.containment = [ 17216 0 - this.offset.relative.left - this.offset.parent.left, 17217 0 - this.offset.relative.top - this.offset.parent.top, 17218 o.containment === "document" ? 17219 this.document.width() : 17220 this.window.width() - this.helperProportions.width - this.margins.left, 17221 ( o.containment === "document" ? 17222 ( this.document.height() || document.body.parentNode.scrollHeight ) : 17223 this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight 17224 ) - this.helperProportions.height - this.margins.top 17225 ]; 17226 } 17227 17228 if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) { 17229 ce = $( o.containment )[ 0 ]; 17230 co = $( o.containment ).offset(); 17231 over = ( $( ce ).css( "overflow" ) !== "hidden" ); 17232 17233 this.containment = [ 17234 co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) + 17235 ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left, 17236 co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) + 17237 ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top, 17238 co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - 17239 ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) - 17240 ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) - 17241 this.helperProportions.width - this.margins.left, 17242 co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 17243 ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) - 17244 ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) - 17245 this.helperProportions.height - this.margins.top 17246 ]; 17247 } 17248 17249 }, 17250 17251 _convertPositionTo: function( d, pos ) { 17252 17253 if ( !pos ) { 17254 pos = this.position; 17255 } 17256 var mod = d === "absolute" ? 1 : -1, 17257 scroll = this.cssPosition === "absolute" && 17258 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 17259 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 17260 this.offsetParent : 17261 this.scrollParent, 17262 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 17263 17264 return { 17265 top: ( 17266 17267 // The absolute mouse position 17268 pos.top + 17269 17270 // Only for relative positioned nodes: Relative offset from element to offset parent 17271 this.offset.relative.top * mod + 17272 17273 // The offsetParent's offset without borders (offset + border) 17274 this.offset.parent.top * mod - 17275 ( ( this.cssPosition === "fixed" ? 17276 -this.scrollParent.scrollTop() : 17277 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod ) 17278 ), 17279 left: ( 17280 17281 // The absolute mouse position 17282 pos.left + 17283 17284 // Only for relative positioned nodes: Relative offset from element to offset parent 17285 this.offset.relative.left * mod + 17286 17287 // The offsetParent's offset without borders (offset + border) 17288 this.offset.parent.left * mod - 17289 ( ( this.cssPosition === "fixed" ? 17290 -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : 17291 scroll.scrollLeft() ) * mod ) 17292 ) 17293 }; 17294 17295 }, 17296 17297 _generatePosition: function( event ) { 17298 17299 var top, left, 17300 o = this.options, 17301 pageX = event.pageX, 17302 pageY = event.pageY, 17303 scroll = this.cssPosition === "absolute" && 17304 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 17305 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 17306 this.offsetParent : 17307 this.scrollParent, 17308 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 17309 17310 // This is another very weird special case that only happens for relative elements: 17311 // 1. If the css position is relative 17312 // 2. and the scroll parent is the document or similar to the offset parent 17313 // we have to refresh the relative offset during the scroll so there are no jumps 17314 if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 17315 this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) { 17316 this.offset.relative = this._getRelativeOffset(); 17317 } 17318 17319 /* 17320 * - Position constraining - 17321 * Constrain the position to a mix of grid, containment. 17322 */ 17323 17324 if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options 17325 17326 if ( this.containment ) { 17327 if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) { 17328 pageX = this.containment[ 0 ] + this.offset.click.left; 17329 } 17330 if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) { 17331 pageY = this.containment[ 1 ] + this.offset.click.top; 17332 } 17333 if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) { 17334 pageX = this.containment[ 2 ] + this.offset.click.left; 17335 } 17336 if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) { 17337 pageY = this.containment[ 3 ] + this.offset.click.top; 17338 } 17339 } 17340 17341 if ( o.grid ) { 17342 top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) / 17343 o.grid[ 1 ] ) * o.grid[ 1 ]; 17344 pageY = this.containment ? 17345 ( ( top - this.offset.click.top >= this.containment[ 1 ] && 17346 top - this.offset.click.top <= this.containment[ 3 ] ) ? 17347 top : 17348 ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ? 17349 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : 17350 top; 17351 17352 left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) / 17353 o.grid[ 0 ] ) * o.grid[ 0 ]; 17354 pageX = this.containment ? 17355 ( ( left - this.offset.click.left >= this.containment[ 0 ] && 17356 left - this.offset.click.left <= this.containment[ 2 ] ) ? 17357 left : 17358 ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ? 17359 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : 17360 left; 17361 } 17362 17363 } 17364 17365 return { 17366 top: ( 17367 17368 // The absolute mouse position 17369 pageY - 17370 17371 // Click offset (relative to the element) 17372 this.offset.click.top - 17373 17374 // Only for relative positioned nodes: Relative offset from element to offset parent 17375 this.offset.relative.top - 17376 17377 // The offsetParent's offset without borders (offset + border) 17378 this.offset.parent.top + 17379 ( ( this.cssPosition === "fixed" ? 17380 -this.scrollParent.scrollTop() : 17381 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) ) 17382 ), 17383 left: ( 17384 17385 // The absolute mouse position 17386 pageX - 17387 17388 // Click offset (relative to the element) 17389 this.offset.click.left - 17390 17391 // Only for relative positioned nodes: Relative offset from element to offset parent 17392 this.offset.relative.left - 17393 17394 // The offsetParent's offset without borders (offset + border) 17395 this.offset.parent.left + 17396 ( ( this.cssPosition === "fixed" ? 17397 -this.scrollParent.scrollLeft() : 17398 scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) 17399 ) 17400 }; 17401 17402 }, 17403 17404 _rearrange: function( event, i, a, hardRefresh ) { 17405 17406 if ( a ) { 17407 a[ 0 ].appendChild( this.placeholder[ 0 ] ); 17408 } else { 17409 i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ], 17410 ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) ); 17411 } 17412 17413 //Various things done here to improve the performance: 17414 // 1. we create a setTimeout, that calls refreshPositions 17415 // 2. on the instance, we have a counter variable, that get's higher after every append 17416 // 3. on the local scope, we copy the counter variable, and check in the timeout, 17417 // if it's still the same 17418 // 4. this lets only the last addition to the timeout stack through 17419 this.counter = this.counter ? ++this.counter : 1; 17420 var counter = this.counter; 17421 17422 this._delay( function() { 17423 if ( counter === this.counter ) { 17424 17425 //Precompute after each DOM insertion, NOT on mousemove 17426 this.refreshPositions( !hardRefresh ); 17427 } 17428 } ); 17429 17430 }, 17431 17432 _clear: function( event, noPropagation ) { 17433 17434 this.reverting = false; 17435 17436 // We delay all events that have to be triggered to after the point where the placeholder 17437 // has been removed and everything else normalized again 17438 var i, 17439 delayedTriggers = []; 17440 17441 // We first have to update the dom position of the actual currentItem 17442 // Note: don't do it if the current item is already removed (by a user), or it gets 17443 // reappended (see #4088) 17444 if ( !this._noFinalSort && this.currentItem.parent().length ) { 17445 this.placeholder.before( this.currentItem ); 17446 } 17447 this._noFinalSort = null; 17448 17449 if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) { 17450 for ( i in this._storedCSS ) { 17451 if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) { 17452 this._storedCSS[ i ] = ""; 17453 } 17454 } 17455 this.currentItem.css( this._storedCSS ); 17456 this._removeClass( this.currentItem, "ui-sortable-helper" ); 17457 } else { 17458 this.currentItem.show(); 17459 } 17460 17461 if ( this.fromOutside && !noPropagation ) { 17462 delayedTriggers.push( function( event ) { 17463 this._trigger( "receive", event, this._uiHash( this.fromOutside ) ); 17464 } ); 17465 } 17466 if ( ( this.fromOutside || 17467 this.domPosition.prev !== 17468 this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] || 17469 this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) { 17470 17471 // Trigger update callback if the DOM position has changed 17472 delayedTriggers.push( function( event ) { 17473 this._trigger( "update", event, this._uiHash() ); 17474 } ); 17475 } 17476 17477 // Check if the items Container has Changed and trigger appropriate 17478 // events. 17479 if ( this !== this.currentContainer ) { 17480 if ( !noPropagation ) { 17481 delayedTriggers.push( function( event ) { 17482 this._trigger( "remove", event, this._uiHash() ); 17483 } ); 17484 delayedTriggers.push( ( function( c ) { 17485 return function( event ) { 17486 c._trigger( "receive", event, this._uiHash( this ) ); 17487 }; 17488 } ).call( this, this.currentContainer ) ); 17489 delayedTriggers.push( ( function( c ) { 17490 return function( event ) { 17491 c._trigger( "update", event, this._uiHash( this ) ); 17492 }; 17493 } ).call( this, this.currentContainer ) ); 17494 } 17495 } 17496 17497 //Post events to containers 17498 function delayEvent( type, instance, container ) { 17499 return function( event ) { 17500 container._trigger( type, event, instance._uiHash( instance ) ); 17501 }; 17502 } 17503 for ( i = this.containers.length - 1; i >= 0; i-- ) { 17504 if ( !noPropagation ) { 17505 delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) ); 17506 } 17507 if ( this.containers[ i ].containerCache.over ) { 17508 delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) ); 17509 this.containers[ i ].containerCache.over = 0; 17510 } 17511 } 17512 17513 //Do what was originally in plugins 17514 if ( this.storedCursor ) { 17515 this.document.find( "body" ).css( "cursor", this.storedCursor ); 17516 this.storedStylesheet.remove(); 17517 } 17518 if ( this._storedOpacity ) { 17519 this.helper.css( "opacity", this._storedOpacity ); 17520 } 17521 if ( this._storedZIndex ) { 17522 this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex ); 17523 } 17524 17525 this.dragging = false; 17526 17527 if ( !noPropagation ) { 17528 this._trigger( "beforeStop", event, this._uiHash() ); 17529 } 17530 17531 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 17532 // it unbinds ALL events from the original node! 17533 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 17534 17535 if ( !this.cancelHelperRemoval ) { 17536 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 17537 this.helper.remove(); 17538 } 17539 this.helper = null; 17540 } 17541 17542 if ( !noPropagation ) { 17543 for ( i = 0; i < delayedTriggers.length; i++ ) { 17544 17545 // Trigger all delayed events 17546 delayedTriggers[ i ].call( this, event ); 17547 } 17548 this._trigger( "stop", event, this._uiHash() ); 17549 } 17550 17551 this.fromOutside = false; 17552 return !this.cancelHelperRemoval; 17553 17554 }, 17555 17556 _trigger: function() { 17557 if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) { 17558 this.cancel(); 17559 } 17560 }, 17561 17562 _uiHash: function( _inst ) { 17563 var inst = _inst || this; 17564 return { 17565 helper: inst.helper, 17566 placeholder: inst.placeholder || $( [] ), 17567 position: inst.position, 17568 originalPosition: inst.originalPosition, 17569 offset: inst.positionAbs, 17570 item: inst.currentItem, 17571 sender: _inst ? _inst.element : null 17572 }; 17573 } 17574 17575} ); 17576 17577 17578/*! 17579 * jQuery UI Spinner 1.13.2 17580 * http://jqueryui.com 17581 * 17582 * Copyright jQuery Foundation and other contributors 17583 * Released under the MIT license. 17584 * http://jquery.org/license 17585 */ 17586 17587//>>label: Spinner 17588//>>group: Widgets 17589//>>description: Displays buttons to easily input numbers via the keyboard or mouse. 17590//>>docs: http://api.jqueryui.com/spinner/ 17591//>>demos: http://jqueryui.com/spinner/ 17592//>>css.structure: ../../themes/base/core.css 17593//>>css.structure: ../../themes/base/spinner.css 17594//>>css.theme: ../../themes/base/theme.css 17595 17596 17597function spinnerModifier( fn ) { 17598 return function() { 17599 var previous = this.element.val(); 17600 fn.apply( this, arguments ); 17601 this._refresh(); 17602 if ( previous !== this.element.val() ) { 17603 this._trigger( "change" ); 17604 } 17605 }; 17606} 17607 17608$.widget( "ui.spinner", { 17609 version: "1.13.2", 17610 defaultElement: "<input>", 17611 widgetEventPrefix: "spin", 17612 options: { 17613 classes: { 17614 "ui-spinner": "ui-corner-all", 17615 "ui-spinner-down": "ui-corner-br", 17616 "ui-spinner-up": "ui-corner-tr" 17617 }, 17618 culture: null, 17619 icons: { 17620 down: "ui-icon-triangle-1-s", 17621 up: "ui-icon-triangle-1-n" 17622 }, 17623 incremental: true, 17624 max: null, 17625 min: null, 17626 numberFormat: null, 17627 page: 10, 17628 step: 1, 17629 17630 change: null, 17631 spin: null, 17632 start: null, 17633 stop: null 17634 }, 17635 17636 _create: function() { 17637 17638 // handle string values that need to be parsed 17639 this._setOption( "max", this.options.max ); 17640 this._setOption( "min", this.options.min ); 17641 this._setOption( "step", this.options.step ); 17642 17643 // Only format if there is a value, prevents the field from being marked 17644 // as invalid in Firefox, see #9573. 17645 if ( this.value() !== "" ) { 17646 17647 // Format the value, but don't constrain. 17648 this._value( this.element.val(), true ); 17649 } 17650 17651 this._draw(); 17652 this._on( this._events ); 17653 this._refresh(); 17654 17655 // Turning off autocomplete prevents the browser from remembering the 17656 // value when navigating through history, so we re-enable autocomplete 17657 // if the page is unloaded before the widget is destroyed. #7790 17658 this._on( this.window, { 17659 beforeunload: function() { 17660 this.element.removeAttr( "autocomplete" ); 17661 } 17662 } ); 17663 }, 17664 17665 _getCreateOptions: function() { 17666 var options = this._super(); 17667 var element = this.element; 17668 17669 $.each( [ "min", "max", "step" ], function( i, option ) { 17670 var value = element.attr( option ); 17671 if ( value != null && value.length ) { 17672 options[ option ] = value; 17673 } 17674 } ); 17675 17676 return options; 17677 }, 17678 17679 _events: { 17680 keydown: function( event ) { 17681 if ( this._start( event ) && this._keydown( event ) ) { 17682 event.preventDefault(); 17683 } 17684 }, 17685 keyup: "_stop", 17686 focus: function() { 17687 this.previous = this.element.val(); 17688 }, 17689 blur: function( event ) { 17690 if ( this.cancelBlur ) { 17691 delete this.cancelBlur; 17692 return; 17693 } 17694 17695 this._stop(); 17696 this._refresh(); 17697 if ( this.previous !== this.element.val() ) { 17698 this._trigger( "change", event ); 17699 } 17700 }, 17701 mousewheel: function( event, delta ) { 17702 var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ); 17703 var isActive = this.element[ 0 ] === activeElement; 17704 17705 if ( !isActive || !delta ) { 17706 return; 17707 } 17708 17709 if ( !this.spinning && !this._start( event ) ) { 17710 return false; 17711 } 17712 17713 this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event ); 17714 clearTimeout( this.mousewheelTimer ); 17715 this.mousewheelTimer = this._delay( function() { 17716 if ( this.spinning ) { 17717 this._stop( event ); 17718 } 17719 }, 100 ); 17720 event.preventDefault(); 17721 }, 17722 "mousedown .ui-spinner-button": function( event ) { 17723 var previous; 17724 17725 // We never want the buttons to have focus; whenever the user is 17726 // interacting with the spinner, the focus should be on the input. 17727 // If the input is focused then this.previous is properly set from 17728 // when the input first received focus. If the input is not focused 17729 // then we need to set this.previous based on the value before spinning. 17730 previous = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ) ? 17731 this.previous : this.element.val(); 17732 function checkFocus() { 17733 var isActive = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ); 17734 if ( !isActive ) { 17735 this.element.trigger( "focus" ); 17736 this.previous = previous; 17737 17738 // support: IE 17739 // IE sets focus asynchronously, so we need to check if focus 17740 // moved off of the input because the user clicked on the button. 17741 this._delay( function() { 17742 this.previous = previous; 17743 } ); 17744 } 17745 } 17746 17747 // Ensure focus is on (or stays on) the text field 17748 event.preventDefault(); 17749 checkFocus.call( this ); 17750 17751 // Support: IE 17752 // IE doesn't prevent moving focus even with event.preventDefault() 17753 // so we set a flag to know when we should ignore the blur event 17754 // and check (again) if focus moved off of the input. 17755 this.cancelBlur = true; 17756 this._delay( function() { 17757 delete this.cancelBlur; 17758 checkFocus.call( this ); 17759 } ); 17760 17761 if ( this._start( event ) === false ) { 17762 return; 17763 } 17764 17765 this._repeat( null, $( event.currentTarget ) 17766 .hasClass( "ui-spinner-up" ) ? 1 : -1, event ); 17767 }, 17768 "mouseup .ui-spinner-button": "_stop", 17769 "mouseenter .ui-spinner-button": function( event ) { 17770 17771 // button will add ui-state-active if mouse was down while mouseleave and kept down 17772 if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) { 17773 return; 17774 } 17775 17776 if ( this._start( event ) === false ) { 17777 return false; 17778 } 17779 this._repeat( null, $( event.currentTarget ) 17780 .hasClass( "ui-spinner-up" ) ? 1 : -1, event ); 17781 }, 17782 17783 // TODO: do we really want to consider this a stop? 17784 // shouldn't we just stop the repeater and wait until mouseup before 17785 // we trigger the stop event? 17786 "mouseleave .ui-spinner-button": "_stop" 17787 }, 17788 17789 // Support mobile enhanced option and make backcompat more sane 17790 _enhance: function() { 17791 this.uiSpinner = this.element 17792 .attr( "autocomplete", "off" ) 17793 .wrap( "<span>" ) 17794 .parent() 17795 17796 // Add buttons 17797 .append( 17798 "<a></a><a></a>" 17799 ); 17800 }, 17801 17802 _draw: function() { 17803 this._enhance(); 17804 17805 this._addClass( this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content" ); 17806 this._addClass( "ui-spinner-input" ); 17807 17808 this.element.attr( "role", "spinbutton" ); 17809 17810 // Button bindings 17811 this.buttons = this.uiSpinner.children( "a" ) 17812 .attr( "tabIndex", -1 ) 17813 .attr( "aria-hidden", true ) 17814 .button( { 17815 classes: { 17816 "ui-button": "" 17817 } 17818 } ); 17819 17820 // TODO: Right now button does not support classes this is already updated in button PR 17821 this._removeClass( this.buttons, "ui-corner-all" ); 17822 17823 this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" ); 17824 this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" ); 17825 this.buttons.first().button( { 17826 "icon": this.options.icons.up, 17827 "showLabel": false 17828 } ); 17829 this.buttons.last().button( { 17830 "icon": this.options.icons.down, 17831 "showLabel": false 17832 } ); 17833 17834 // IE 6 doesn't understand height: 50% for the buttons 17835 // unless the wrapper has an explicit height 17836 if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) && 17837 this.uiSpinner.height() > 0 ) { 17838 this.uiSpinner.height( this.uiSpinner.height() ); 17839 } 17840 }, 17841 17842 _keydown: function( event ) { 17843 var options = this.options, 17844 keyCode = $.ui.keyCode; 17845 17846 switch ( event.keyCode ) { 17847 case keyCode.UP: 17848 this._repeat( null, 1, event ); 17849 return true; 17850 case keyCode.DOWN: 17851 this._repeat( null, -1, event ); 17852 return true; 17853 case keyCode.PAGE_UP: 17854 this._repeat( null, options.page, event ); 17855 return true; 17856 case keyCode.PAGE_DOWN: 17857 this._repeat( null, -options.page, event ); 17858 return true; 17859 } 17860 17861 return false; 17862 }, 17863 17864 _start: function( event ) { 17865 if ( !this.spinning && this._trigger( "start", event ) === false ) { 17866 return false; 17867 } 17868 17869 if ( !this.counter ) { 17870 this.counter = 1; 17871 } 17872 this.spinning = true; 17873 return true; 17874 }, 17875 17876 _repeat: function( i, steps, event ) { 17877 i = i || 500; 17878 17879 clearTimeout( this.timer ); 17880 this.timer = this._delay( function() { 17881 this._repeat( 40, steps, event ); 17882 }, i ); 17883 17884 this._spin( steps * this.options.step, event ); 17885 }, 17886 17887 _spin: function( step, event ) { 17888 var value = this.value() || 0; 17889 17890 if ( !this.counter ) { 17891 this.counter = 1; 17892 } 17893 17894 value = this._adjustValue( value + step * this._increment( this.counter ) ); 17895 17896 if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) { 17897 this._value( value ); 17898 this.counter++; 17899 } 17900 }, 17901 17902 _increment: function( i ) { 17903 var incremental = this.options.incremental; 17904 17905 if ( incremental ) { 17906 return typeof incremental === "function" ? 17907 incremental( i ) : 17908 Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 ); 17909 } 17910 17911 return 1; 17912 }, 17913 17914 _precision: function() { 17915 var precision = this._precisionOf( this.options.step ); 17916 if ( this.options.min !== null ) { 17917 precision = Math.max( precision, this._precisionOf( this.options.min ) ); 17918 } 17919 return precision; 17920 }, 17921 17922 _precisionOf: function( num ) { 17923 var str = num.toString(), 17924 decimal = str.indexOf( "." ); 17925 return decimal === -1 ? 0 : str.length - decimal - 1; 17926 }, 17927 17928 _adjustValue: function( value ) { 17929 var base, aboveMin, 17930 options = this.options; 17931 17932 // Make sure we're at a valid step 17933 // - find out where we are relative to the base (min or 0) 17934 base = options.min !== null ? options.min : 0; 17935 aboveMin = value - base; 17936 17937 // - round to the nearest step 17938 aboveMin = Math.round( aboveMin / options.step ) * options.step; 17939 17940 // - rounding is based on 0, so adjust back to our base 17941 value = base + aboveMin; 17942 17943 // Fix precision from bad JS floating point math 17944 value = parseFloat( value.toFixed( this._precision() ) ); 17945 17946 // Clamp the value 17947 if ( options.max !== null && value > options.max ) { 17948 return options.max; 17949 } 17950 if ( options.min !== null && value < options.min ) { 17951 return options.min; 17952 } 17953 17954 return value; 17955 }, 17956 17957 _stop: function( event ) { 17958 if ( !this.spinning ) { 17959 return; 17960 } 17961 17962 clearTimeout( this.timer ); 17963 clearTimeout( this.mousewheelTimer ); 17964 this.counter = 0; 17965 this.spinning = false; 17966 this._trigger( "stop", event ); 17967 }, 17968 17969 _setOption: function( key, value ) { 17970 var prevValue, first, last; 17971 17972 if ( key === "culture" || key === "numberFormat" ) { 17973 prevValue = this._parse( this.element.val() ); 17974 this.options[ key ] = value; 17975 this.element.val( this._format( prevValue ) ); 17976 return; 17977 } 17978 17979 if ( key === "max" || key === "min" || key === "step" ) { 17980 if ( typeof value === "string" ) { 17981 value = this._parse( value ); 17982 } 17983 } 17984 if ( key === "icons" ) { 17985 first = this.buttons.first().find( ".ui-icon" ); 17986 this._removeClass( first, null, this.options.icons.up ); 17987 this._addClass( first, null, value.up ); 17988 last = this.buttons.last().find( ".ui-icon" ); 17989 this._removeClass( last, null, this.options.icons.down ); 17990 this._addClass( last, null, value.down ); 17991 } 17992 17993 this._super( key, value ); 17994 }, 17995 17996 _setOptionDisabled: function( value ) { 17997 this._super( value ); 17998 17999 this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value ); 18000 this.element.prop( "disabled", !!value ); 18001 this.buttons.button( value ? "disable" : "enable" ); 18002 }, 18003 18004 _setOptions: spinnerModifier( function( options ) { 18005 this._super( options ); 18006 } ), 18007 18008 _parse: function( val ) { 18009 if ( typeof val === "string" && val !== "" ) { 18010 val = window.Globalize && this.options.numberFormat ? 18011 Globalize.parseFloat( val, 10, this.options.culture ) : +val; 18012 } 18013 return val === "" || isNaN( val ) ? null : val; 18014 }, 18015 18016 _format: function( value ) { 18017 if ( value === "" ) { 18018 return ""; 18019 } 18020 return window.Globalize && this.options.numberFormat ? 18021 Globalize.format( value, this.options.numberFormat, this.options.culture ) : 18022 value; 18023 }, 18024 18025 _refresh: function() { 18026 this.element.attr( { 18027 "aria-valuemin": this.options.min, 18028 "aria-valuemax": this.options.max, 18029 18030 // TODO: what should we do with values that can't be parsed? 18031 "aria-valuenow": this._parse( this.element.val() ) 18032 } ); 18033 }, 18034 18035 isValid: function() { 18036 var value = this.value(); 18037 18038 // Null is invalid 18039 if ( value === null ) { 18040 return false; 18041 } 18042 18043 // If value gets adjusted, it's invalid 18044 return value === this._adjustValue( value ); 18045 }, 18046 18047 // Update the value without triggering change 18048 _value: function( value, allowAny ) { 18049 var parsed; 18050 if ( value !== "" ) { 18051 parsed = this._parse( value ); 18052 if ( parsed !== null ) { 18053 if ( !allowAny ) { 18054 parsed = this._adjustValue( parsed ); 18055 } 18056 value = this._format( parsed ); 18057 } 18058 } 18059 this.element.val( value ); 18060 this._refresh(); 18061 }, 18062 18063 _destroy: function() { 18064 this.element 18065 .prop( "disabled", false ) 18066 .removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" ); 18067 18068 this.uiSpinner.replaceWith( this.element ); 18069 }, 18070 18071 stepUp: spinnerModifier( function( steps ) { 18072 this._stepUp( steps ); 18073 } ), 18074 _stepUp: function( steps ) { 18075 if ( this._start() ) { 18076 this._spin( ( steps || 1 ) * this.options.step ); 18077 this._stop(); 18078 } 18079 }, 18080 18081 stepDown: spinnerModifier( function( steps ) { 18082 this._stepDown( steps ); 18083 } ), 18084 _stepDown: function( steps ) { 18085 if ( this._start() ) { 18086 this._spin( ( steps || 1 ) * -this.options.step ); 18087 this._stop(); 18088 } 18089 }, 18090 18091 pageUp: spinnerModifier( function( pages ) { 18092 this._stepUp( ( pages || 1 ) * this.options.page ); 18093 } ), 18094 18095 pageDown: spinnerModifier( function( pages ) { 18096 this._stepDown( ( pages || 1 ) * this.options.page ); 18097 } ), 18098 18099 value: function( newVal ) { 18100 if ( !arguments.length ) { 18101 return this._parse( this.element.val() ); 18102 } 18103 spinnerModifier( this._value ).call( this, newVal ); 18104 }, 18105 18106 widget: function() { 18107 return this.uiSpinner; 18108 } 18109} ); 18110 18111// DEPRECATED 18112// TODO: switch return back to widget declaration at top of file when this is removed 18113if ( $.uiBackCompat !== false ) { 18114 18115 // Backcompat for spinner html extension points 18116 $.widget( "ui.spinner", $.ui.spinner, { 18117 _enhance: function() { 18118 this.uiSpinner = this.element 18119 .attr( "autocomplete", "off" ) 18120 .wrap( this._uiSpinnerHtml() ) 18121 .parent() 18122 18123 // Add buttons 18124 .append( this._buttonHtml() ); 18125 }, 18126 _uiSpinnerHtml: function() { 18127 return "<span>"; 18128 }, 18129 18130 _buttonHtml: function() { 18131 return "<a></a><a></a>"; 18132 } 18133 } ); 18134} 18135 18136var widgetsSpinner = $.ui.spinner; 18137 18138 18139/*! 18140 * jQuery UI Tabs 1.13.2 18141 * http://jqueryui.com 18142 * 18143 * Copyright jQuery Foundation and other contributors 18144 * Released under the MIT license. 18145 * http://jquery.org/license 18146 */ 18147 18148//>>label: Tabs 18149//>>group: Widgets 18150//>>description: Transforms a set of container elements into a tab structure. 18151//>>docs: http://api.jqueryui.com/tabs/ 18152//>>demos: http://jqueryui.com/tabs/ 18153//>>css.structure: ../../themes/base/core.css 18154//>>css.structure: ../../themes/base/tabs.css 18155//>>css.theme: ../../themes/base/theme.css 18156 18157 18158$.widget( "ui.tabs", { 18159 version: "1.13.2", 18160 delay: 300, 18161 options: { 18162 active: null, 18163 classes: { 18164 "ui-tabs": "ui-corner-all", 18165 "ui-tabs-nav": "ui-corner-all", 18166 "ui-tabs-panel": "ui-corner-bottom", 18167 "ui-tabs-tab": "ui-corner-top" 18168 }, 18169 collapsible: false, 18170 event: "click", 18171 heightStyle: "content", 18172 hide: null, 18173 show: null, 18174 18175 // Callbacks 18176 activate: null, 18177 beforeActivate: null, 18178 beforeLoad: null, 18179 load: null 18180 }, 18181 18182 _isLocal: ( function() { 18183 var rhash = /#.*$/; 18184 18185 return function( anchor ) { 18186 var anchorUrl, locationUrl; 18187 18188 anchorUrl = anchor.href.replace( rhash, "" ); 18189 locationUrl = location.href.replace( rhash, "" ); 18190 18191 // Decoding may throw an error if the URL isn't UTF-8 (#9518) 18192 try { 18193 anchorUrl = decodeURIComponent( anchorUrl ); 18194 } catch ( error ) {} 18195 try { 18196 locationUrl = decodeURIComponent( locationUrl ); 18197 } catch ( error ) {} 18198 18199 return anchor.hash.length > 1 && anchorUrl === locationUrl; 18200 }; 18201 } )(), 18202 18203 _create: function() { 18204 var that = this, 18205 options = this.options; 18206 18207 this.running = false; 18208 18209 this._addClass( "ui-tabs", "ui-widget ui-widget-content" ); 18210 this._toggleClass( "ui-tabs-collapsible", null, options.collapsible ); 18211 18212 this._processTabs(); 18213 options.active = this._initialActive(); 18214 18215 // Take disabling tabs via class attribute from HTML 18216 // into account and update option properly. 18217 if ( Array.isArray( options.disabled ) ) { 18218 options.disabled = $.uniqueSort( options.disabled.concat( 18219 $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { 18220 return that.tabs.index( li ); 18221 } ) 18222 ) ).sort(); 18223 } 18224 18225 // Check for length avoids error when initializing empty list 18226 if ( this.options.active !== false && this.anchors.length ) { 18227 this.active = this._findActive( options.active ); 18228 } else { 18229 this.active = $(); 18230 } 18231 18232 this._refresh(); 18233 18234 if ( this.active.length ) { 18235 this.load( options.active ); 18236 } 18237 }, 18238 18239 _initialActive: function() { 18240 var active = this.options.active, 18241 collapsible = this.options.collapsible, 18242 locationHash = location.hash.substring( 1 ); 18243 18244 if ( active === null ) { 18245 18246 // check the fragment identifier in the URL 18247 if ( locationHash ) { 18248 this.tabs.each( function( i, tab ) { 18249 if ( $( tab ).attr( "aria-controls" ) === locationHash ) { 18250 active = i; 18251 return false; 18252 } 18253 } ); 18254 } 18255 18256 // Check for a tab marked active via a class 18257 if ( active === null ) { 18258 active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); 18259 } 18260 18261 // No active tab, set to false 18262 if ( active === null || active === -1 ) { 18263 active = this.tabs.length ? 0 : false; 18264 } 18265 } 18266 18267 // Handle numbers: negative, out of range 18268 if ( active !== false ) { 18269 active = this.tabs.index( this.tabs.eq( active ) ); 18270 if ( active === -1 ) { 18271 active = collapsible ? false : 0; 18272 } 18273 } 18274 18275 // Don't allow collapsible: false and active: false 18276 if ( !collapsible && active === false && this.anchors.length ) { 18277 active = 0; 18278 } 18279 18280 return active; 18281 }, 18282 18283 _getCreateEventData: function() { 18284 return { 18285 tab: this.active, 18286 panel: !this.active.length ? $() : this._getPanelForTab( this.active ) 18287 }; 18288 }, 18289 18290 _tabKeydown: function( event ) { 18291 var focusedTab = $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( "li" ), 18292 selectedIndex = this.tabs.index( focusedTab ), 18293 goingForward = true; 18294 18295 if ( this._handlePageNav( event ) ) { 18296 return; 18297 } 18298 18299 switch ( event.keyCode ) { 18300 case $.ui.keyCode.RIGHT: 18301 case $.ui.keyCode.DOWN: 18302 selectedIndex++; 18303 break; 18304 case $.ui.keyCode.UP: 18305 case $.ui.keyCode.LEFT: 18306 goingForward = false; 18307 selectedIndex--; 18308 break; 18309 case $.ui.keyCode.END: 18310 selectedIndex = this.anchors.length - 1; 18311 break; 18312 case $.ui.keyCode.HOME: 18313 selectedIndex = 0; 18314 break; 18315 case $.ui.keyCode.SPACE: 18316 18317 // Activate only, no collapsing 18318 event.preventDefault(); 18319 clearTimeout( this.activating ); 18320 this._activate( selectedIndex ); 18321 return; 18322 case $.ui.keyCode.ENTER: 18323 18324 // Toggle (cancel delayed activation, allow collapsing) 18325 event.preventDefault(); 18326 clearTimeout( this.activating ); 18327 18328 // Determine if we should collapse or activate 18329 this._activate( selectedIndex === this.options.active ? false : selectedIndex ); 18330 return; 18331 default: 18332 return; 18333 } 18334 18335 // Focus the appropriate tab, based on which key was pressed 18336 event.preventDefault(); 18337 clearTimeout( this.activating ); 18338 selectedIndex = this._focusNextTab( selectedIndex, goingForward ); 18339 18340 // Navigating with control/command key will prevent automatic activation 18341 if ( !event.ctrlKey && !event.metaKey ) { 18342 18343 // Update aria-selected immediately so that AT think the tab is already selected. 18344 // Otherwise AT may confuse the user by stating that they need to activate the tab, 18345 // but the tab will already be activated by the time the announcement finishes. 18346 focusedTab.attr( "aria-selected", "false" ); 18347 this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); 18348 18349 this.activating = this._delay( function() { 18350 this.option( "active", selectedIndex ); 18351 }, this.delay ); 18352 } 18353 }, 18354 18355 _panelKeydown: function( event ) { 18356 if ( this._handlePageNav( event ) ) { 18357 return; 18358 } 18359 18360 // Ctrl+up moves focus to the current tab 18361 if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { 18362 event.preventDefault(); 18363 this.active.trigger( "focus" ); 18364 } 18365 }, 18366 18367 // Alt+page up/down moves focus to the previous/next tab (and activates) 18368 _handlePageNav: function( event ) { 18369 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { 18370 this._activate( this._focusNextTab( this.options.active - 1, false ) ); 18371 return true; 18372 } 18373 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { 18374 this._activate( this._focusNextTab( this.options.active + 1, true ) ); 18375 return true; 18376 } 18377 }, 18378 18379 _findNextTab: function( index, goingForward ) { 18380 var lastTabIndex = this.tabs.length - 1; 18381 18382 function constrain() { 18383 if ( index > lastTabIndex ) { 18384 index = 0; 18385 } 18386 if ( index < 0 ) { 18387 index = lastTabIndex; 18388 } 18389 return index; 18390 } 18391 18392 while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { 18393 index = goingForward ? index + 1 : index - 1; 18394 } 18395 18396 return index; 18397 }, 18398 18399 _focusNextTab: function( index, goingForward ) { 18400 index = this._findNextTab( index, goingForward ); 18401 this.tabs.eq( index ).trigger( "focus" ); 18402 return index; 18403 }, 18404 18405 _setOption: function( key, value ) { 18406 if ( key === "active" ) { 18407 18408 // _activate() will handle invalid values and update this.options 18409 this._activate( value ); 18410 return; 18411 } 18412 18413 this._super( key, value ); 18414 18415 if ( key === "collapsible" ) { 18416 this._toggleClass( "ui-tabs-collapsible", null, value ); 18417 18418 // Setting collapsible: false while collapsed; open first panel 18419 if ( !value && this.options.active === false ) { 18420 this._activate( 0 ); 18421 } 18422 } 18423 18424 if ( key === "event" ) { 18425 this._setupEvents( value ); 18426 } 18427 18428 if ( key === "heightStyle" ) { 18429 this._setupHeightStyle( value ); 18430 } 18431 }, 18432 18433 _sanitizeSelector: function( hash ) { 18434 return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : ""; 18435 }, 18436 18437 refresh: function() { 18438 var options = this.options, 18439 lis = this.tablist.children( ":has(a[href])" ); 18440 18441 // Get disabled tabs from class attribute from HTML 18442 // this will get converted to a boolean if needed in _refresh() 18443 options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { 18444 return lis.index( tab ); 18445 } ); 18446 18447 this._processTabs(); 18448 18449 // Was collapsed or no tabs 18450 if ( options.active === false || !this.anchors.length ) { 18451 options.active = false; 18452 this.active = $(); 18453 18454 // was active, but active tab is gone 18455 } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { 18456 18457 // all remaining tabs are disabled 18458 if ( this.tabs.length === options.disabled.length ) { 18459 options.active = false; 18460 this.active = $(); 18461 18462 // activate previous tab 18463 } else { 18464 this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); 18465 } 18466 18467 // was active, active tab still exists 18468 } else { 18469 18470 // make sure active index is correct 18471 options.active = this.tabs.index( this.active ); 18472 } 18473 18474 this._refresh(); 18475 }, 18476 18477 _refresh: function() { 18478 this._setOptionDisabled( this.options.disabled ); 18479 this._setupEvents( this.options.event ); 18480 this._setupHeightStyle( this.options.heightStyle ); 18481 18482 this.tabs.not( this.active ).attr( { 18483 "aria-selected": "false", 18484 "aria-expanded": "false", 18485 tabIndex: -1 18486 } ); 18487 this.panels.not( this._getPanelForTab( this.active ) ) 18488 .hide() 18489 .attr( { 18490 "aria-hidden": "true" 18491 } ); 18492 18493 // Make sure one tab is in the tab order 18494 if ( !this.active.length ) { 18495 this.tabs.eq( 0 ).attr( "tabIndex", 0 ); 18496 } else { 18497 this.active 18498 .attr( { 18499 "aria-selected": "true", 18500 "aria-expanded": "true", 18501 tabIndex: 0 18502 } ); 18503 this._addClass( this.active, "ui-tabs-active", "ui-state-active" ); 18504 this._getPanelForTab( this.active ) 18505 .show() 18506 .attr( { 18507 "aria-hidden": "false" 18508 } ); 18509 } 18510 }, 18511 18512 _processTabs: function() { 18513 var that = this, 18514 prevTabs = this.tabs, 18515 prevAnchors = this.anchors, 18516 prevPanels = this.panels; 18517 18518 this.tablist = this._getList().attr( "role", "tablist" ); 18519 this._addClass( this.tablist, "ui-tabs-nav", 18520 "ui-helper-reset ui-helper-clearfix ui-widget-header" ); 18521 18522 // Prevent users from focusing disabled tabs via click 18523 this.tablist 18524 .on( "mousedown" + this.eventNamespace, "> li", function( event ) { 18525 if ( $( this ).is( ".ui-state-disabled" ) ) { 18526 event.preventDefault(); 18527 } 18528 } ) 18529 18530 // Support: IE <9 18531 // Preventing the default action in mousedown doesn't prevent IE 18532 // from focusing the element, so if the anchor gets focused, blur. 18533 // We don't have to worry about focusing the previously focused 18534 // element since clicking on a non-focusable element should focus 18535 // the body anyway. 18536 .on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() { 18537 if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) { 18538 this.blur(); 18539 } 18540 } ); 18541 18542 this.tabs = this.tablist.find( "> li:has(a[href])" ) 18543 .attr( { 18544 role: "tab", 18545 tabIndex: -1 18546 } ); 18547 this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" ); 18548 18549 this.anchors = this.tabs.map( function() { 18550 return $( "a", this )[ 0 ]; 18551 } ) 18552 .attr( { 18553 tabIndex: -1 18554 } ); 18555 this._addClass( this.anchors, "ui-tabs-anchor" ); 18556 18557 this.panels = $(); 18558 18559 this.anchors.each( function( i, anchor ) { 18560 var selector, panel, panelId, 18561 anchorId = $( anchor ).uniqueId().attr( "id" ), 18562 tab = $( anchor ).closest( "li" ), 18563 originalAriaControls = tab.attr( "aria-controls" ); 18564 18565 // Inline tab 18566 if ( that._isLocal( anchor ) ) { 18567 selector = anchor.hash; 18568 panelId = selector.substring( 1 ); 18569 panel = that.element.find( that._sanitizeSelector( selector ) ); 18570 18571 // remote tab 18572 } else { 18573 18574 // If the tab doesn't already have aria-controls, 18575 // generate an id by using a throw-away element 18576 panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id; 18577 selector = "#" + panelId; 18578 panel = that.element.find( selector ); 18579 if ( !panel.length ) { 18580 panel = that._createPanel( panelId ); 18581 panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); 18582 } 18583 panel.attr( "aria-live", "polite" ); 18584 } 18585 18586 if ( panel.length ) { 18587 that.panels = that.panels.add( panel ); 18588 } 18589 if ( originalAriaControls ) { 18590 tab.data( "ui-tabs-aria-controls", originalAriaControls ); 18591 } 18592 tab.attr( { 18593 "aria-controls": panelId, 18594 "aria-labelledby": anchorId 18595 } ); 18596 panel.attr( "aria-labelledby", anchorId ); 18597 } ); 18598 18599 this.panels.attr( "role", "tabpanel" ); 18600 this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" ); 18601 18602 // Avoid memory leaks (#10056) 18603 if ( prevTabs ) { 18604 this._off( prevTabs.not( this.tabs ) ); 18605 this._off( prevAnchors.not( this.anchors ) ); 18606 this._off( prevPanels.not( this.panels ) ); 18607 } 18608 }, 18609 18610 // Allow overriding how to find the list for rare usage scenarios (#7715) 18611 _getList: function() { 18612 return this.tablist || this.element.find( "ol, ul" ).eq( 0 ); 18613 }, 18614 18615 _createPanel: function( id ) { 18616 return $( "<div>" ) 18617 .attr( "id", id ) 18618 .data( "ui-tabs-destroy", true ); 18619 }, 18620 18621 _setOptionDisabled: function( disabled ) { 18622 var currentItem, li, i; 18623 18624 if ( Array.isArray( disabled ) ) { 18625 if ( !disabled.length ) { 18626 disabled = false; 18627 } else if ( disabled.length === this.anchors.length ) { 18628 disabled = true; 18629 } 18630 } 18631 18632 // Disable tabs 18633 for ( i = 0; ( li = this.tabs[ i ] ); i++ ) { 18634 currentItem = $( li ); 18635 if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { 18636 currentItem.attr( "aria-disabled", "true" ); 18637 this._addClass( currentItem, null, "ui-state-disabled" ); 18638 } else { 18639 currentItem.removeAttr( "aria-disabled" ); 18640 this._removeClass( currentItem, null, "ui-state-disabled" ); 18641 } 18642 } 18643 18644 this.options.disabled = disabled; 18645 18646 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, 18647 disabled === true ); 18648 }, 18649 18650 _setupEvents: function( event ) { 18651 var events = {}; 18652 if ( event ) { 18653 $.each( event.split( " " ), function( index, eventName ) { 18654 events[ eventName ] = "_eventHandler"; 18655 } ); 18656 } 18657 18658 this._off( this.anchors.add( this.tabs ).add( this.panels ) ); 18659 18660 // Always prevent the default action, even when disabled 18661 this._on( true, this.anchors, { 18662 click: function( event ) { 18663 event.preventDefault(); 18664 } 18665 } ); 18666 this._on( this.anchors, events ); 18667 this._on( this.tabs, { keydown: "_tabKeydown" } ); 18668 this._on( this.panels, { keydown: "_panelKeydown" } ); 18669 18670 this._focusable( this.tabs ); 18671 this._hoverable( this.tabs ); 18672 }, 18673 18674 _setupHeightStyle: function( heightStyle ) { 18675 var maxHeight, 18676 parent = this.element.parent(); 18677 18678 if ( heightStyle === "fill" ) { 18679 maxHeight = parent.height(); 18680 maxHeight -= this.element.outerHeight() - this.element.height(); 18681 18682 this.element.siblings( ":visible" ).each( function() { 18683 var elem = $( this ), 18684 position = elem.css( "position" ); 18685 18686 if ( position === "absolute" || position === "fixed" ) { 18687 return; 18688 } 18689 maxHeight -= elem.outerHeight( true ); 18690 } ); 18691 18692 this.element.children().not( this.panels ).each( function() { 18693 maxHeight -= $( this ).outerHeight( true ); 18694 } ); 18695 18696 this.panels.each( function() { 18697 $( this ).height( Math.max( 0, maxHeight - 18698 $( this ).innerHeight() + $( this ).height() ) ); 18699 } ) 18700 .css( "overflow", "auto" ); 18701 } else if ( heightStyle === "auto" ) { 18702 maxHeight = 0; 18703 this.panels.each( function() { 18704 maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); 18705 } ).height( maxHeight ); 18706 } 18707 }, 18708 18709 _eventHandler: function( event ) { 18710 var options = this.options, 18711 active = this.active, 18712 anchor = $( event.currentTarget ), 18713 tab = anchor.closest( "li" ), 18714 clickedIsActive = tab[ 0 ] === active[ 0 ], 18715 collapsing = clickedIsActive && options.collapsible, 18716 toShow = collapsing ? $() : this._getPanelForTab( tab ), 18717 toHide = !active.length ? $() : this._getPanelForTab( active ), 18718 eventData = { 18719 oldTab: active, 18720 oldPanel: toHide, 18721 newTab: collapsing ? $() : tab, 18722 newPanel: toShow 18723 }; 18724 18725 event.preventDefault(); 18726 18727 if ( tab.hasClass( "ui-state-disabled" ) || 18728 18729 // tab is already loading 18730 tab.hasClass( "ui-tabs-loading" ) || 18731 18732 // can't switch durning an animation 18733 this.running || 18734 18735 // click on active header, but not collapsible 18736 ( clickedIsActive && !options.collapsible ) || 18737 18738 // allow canceling activation 18739 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 18740 return; 18741 } 18742 18743 options.active = collapsing ? false : this.tabs.index( tab ); 18744 18745 this.active = clickedIsActive ? $() : tab; 18746 if ( this.xhr ) { 18747 this.xhr.abort(); 18748 } 18749 18750 if ( !toHide.length && !toShow.length ) { 18751 $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); 18752 } 18753 18754 if ( toShow.length ) { 18755 this.load( this.tabs.index( tab ), event ); 18756 } 18757 this._toggle( event, eventData ); 18758 }, 18759 18760 // Handles show/hide for selecting tabs 18761 _toggle: function( event, eventData ) { 18762 var that = this, 18763 toShow = eventData.newPanel, 18764 toHide = eventData.oldPanel; 18765 18766 this.running = true; 18767 18768 function complete() { 18769 that.running = false; 18770 that._trigger( "activate", event, eventData ); 18771 } 18772 18773 function show() { 18774 that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" ); 18775 18776 if ( toShow.length && that.options.show ) { 18777 that._show( toShow, that.options.show, complete ); 18778 } else { 18779 toShow.show(); 18780 complete(); 18781 } 18782 } 18783 18784 // Start out by hiding, then showing, then completing 18785 if ( toHide.length && this.options.hide ) { 18786 this._hide( toHide, this.options.hide, function() { 18787 that._removeClass( eventData.oldTab.closest( "li" ), 18788 "ui-tabs-active", "ui-state-active" ); 18789 show(); 18790 } ); 18791 } else { 18792 this._removeClass( eventData.oldTab.closest( "li" ), 18793 "ui-tabs-active", "ui-state-active" ); 18794 toHide.hide(); 18795 show(); 18796 } 18797 18798 toHide.attr( "aria-hidden", "true" ); 18799 eventData.oldTab.attr( { 18800 "aria-selected": "false", 18801 "aria-expanded": "false" 18802 } ); 18803 18804 // If we're switching tabs, remove the old tab from the tab order. 18805 // If we're opening from collapsed state, remove the previous tab from the tab order. 18806 // If we're collapsing, then keep the collapsing tab in the tab order. 18807 if ( toShow.length && toHide.length ) { 18808 eventData.oldTab.attr( "tabIndex", -1 ); 18809 } else if ( toShow.length ) { 18810 this.tabs.filter( function() { 18811 return $( this ).attr( "tabIndex" ) === 0; 18812 } ) 18813 .attr( "tabIndex", -1 ); 18814 } 18815 18816 toShow.attr( "aria-hidden", "false" ); 18817 eventData.newTab.attr( { 18818 "aria-selected": "true", 18819 "aria-expanded": "true", 18820 tabIndex: 0 18821 } ); 18822 }, 18823 18824 _activate: function( index ) { 18825 var anchor, 18826 active = this._findActive( index ); 18827 18828 // Trying to activate the already active panel 18829 if ( active[ 0 ] === this.active[ 0 ] ) { 18830 return; 18831 } 18832 18833 // Trying to collapse, simulate a click on the current active header 18834 if ( !active.length ) { 18835 active = this.active; 18836 } 18837 18838 anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; 18839 this._eventHandler( { 18840 target: anchor, 18841 currentTarget: anchor, 18842 preventDefault: $.noop 18843 } ); 18844 }, 18845 18846 _findActive: function( index ) { 18847 return index === false ? $() : this.tabs.eq( index ); 18848 }, 18849 18850 _getIndex: function( index ) { 18851 18852 // meta-function to give users option to provide a href string instead of a numerical index. 18853 if ( typeof index === "string" ) { 18854 index = this.anchors.index( this.anchors.filter( "[href$='" + 18855 $.escapeSelector( index ) + "']" ) ); 18856 } 18857 18858 return index; 18859 }, 18860 18861 _destroy: function() { 18862 if ( this.xhr ) { 18863 this.xhr.abort(); 18864 } 18865 18866 this.tablist 18867 .removeAttr( "role" ) 18868 .off( this.eventNamespace ); 18869 18870 this.anchors 18871 .removeAttr( "role tabIndex" ) 18872 .removeUniqueId(); 18873 18874 this.tabs.add( this.panels ).each( function() { 18875 if ( $.data( this, "ui-tabs-destroy" ) ) { 18876 $( this ).remove(); 18877 } else { 18878 $( this ).removeAttr( "role tabIndex " + 18879 "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" ); 18880 } 18881 } ); 18882 18883 this.tabs.each( function() { 18884 var li = $( this ), 18885 prev = li.data( "ui-tabs-aria-controls" ); 18886 if ( prev ) { 18887 li 18888 .attr( "aria-controls", prev ) 18889 .removeData( "ui-tabs-aria-controls" ); 18890 } else { 18891 li.removeAttr( "aria-controls" ); 18892 } 18893 } ); 18894 18895 this.panels.show(); 18896 18897 if ( this.options.heightStyle !== "content" ) { 18898 this.panels.css( "height", "" ); 18899 } 18900 }, 18901 18902 enable: function( index ) { 18903 var disabled = this.options.disabled; 18904 if ( disabled === false ) { 18905 return; 18906 } 18907 18908 if ( index === undefined ) { 18909 disabled = false; 18910 } else { 18911 index = this._getIndex( index ); 18912 if ( Array.isArray( disabled ) ) { 18913 disabled = $.map( disabled, function( num ) { 18914 return num !== index ? num : null; 18915 } ); 18916 } else { 18917 disabled = $.map( this.tabs, function( li, num ) { 18918 return num !== index ? num : null; 18919 } ); 18920 } 18921 } 18922 this._setOptionDisabled( disabled ); 18923 }, 18924 18925 disable: function( index ) { 18926 var disabled = this.options.disabled; 18927 if ( disabled === true ) { 18928 return; 18929 } 18930 18931 if ( index === undefined ) { 18932 disabled = true; 18933 } else { 18934 index = this._getIndex( index ); 18935 if ( $.inArray( index, disabled ) !== -1 ) { 18936 return; 18937 } 18938 if ( Array.isArray( disabled ) ) { 18939 disabled = $.merge( [ index ], disabled ).sort(); 18940 } else { 18941 disabled = [ index ]; 18942 } 18943 } 18944 this._setOptionDisabled( disabled ); 18945 }, 18946 18947 load: function( index, event ) { 18948 index = this._getIndex( index ); 18949 var that = this, 18950 tab = this.tabs.eq( index ), 18951 anchor = tab.find( ".ui-tabs-anchor" ), 18952 panel = this._getPanelForTab( tab ), 18953 eventData = { 18954 tab: tab, 18955 panel: panel 18956 }, 18957 complete = function( jqXHR, status ) { 18958 if ( status === "abort" ) { 18959 that.panels.stop( false, true ); 18960 } 18961 18962 that._removeClass( tab, "ui-tabs-loading" ); 18963 panel.removeAttr( "aria-busy" ); 18964 18965 if ( jqXHR === that.xhr ) { 18966 delete that.xhr; 18967 } 18968 }; 18969 18970 // Not remote 18971 if ( this._isLocal( anchor[ 0 ] ) ) { 18972 return; 18973 } 18974 18975 this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); 18976 18977 // Support: jQuery <1.8 18978 // jQuery <1.8 returns false if the request is canceled in beforeSend, 18979 // but as of 1.8, $.ajax() always returns a jqXHR object. 18980 if ( this.xhr && this.xhr.statusText !== "canceled" ) { 18981 this._addClass( tab, "ui-tabs-loading" ); 18982 panel.attr( "aria-busy", "true" ); 18983 18984 this.xhr 18985 .done( function( response, status, jqXHR ) { 18986 18987 // support: jQuery <1.8 18988 // http://bugs.jquery.com/ticket/11778 18989 setTimeout( function() { 18990 panel.html( response ); 18991 that._trigger( "load", event, eventData ); 18992 18993 complete( jqXHR, status ); 18994 }, 1 ); 18995 } ) 18996 .fail( function( jqXHR, status ) { 18997 18998 // support: jQuery <1.8 18999 // http://bugs.jquery.com/ticket/11778 19000 setTimeout( function() { 19001 complete( jqXHR, status ); 19002 }, 1 ); 19003 } ); 19004 } 19005 }, 19006 19007 _ajaxSettings: function( anchor, event, eventData ) { 19008 var that = this; 19009 return { 19010 19011 // Support: IE <11 only 19012 // Strip any hash that exists to prevent errors with the Ajax request 19013 url: anchor.attr( "href" ).replace( /#.*$/, "" ), 19014 beforeSend: function( jqXHR, settings ) { 19015 return that._trigger( "beforeLoad", event, 19016 $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) ); 19017 } 19018 }; 19019 }, 19020 19021 _getPanelForTab: function( tab ) { 19022 var id = $( tab ).attr( "aria-controls" ); 19023 return this.element.find( this._sanitizeSelector( "#" + id ) ); 19024 } 19025} ); 19026 19027// DEPRECATED 19028// TODO: Switch return back to widget declaration at top of file when this is removed 19029if ( $.uiBackCompat !== false ) { 19030 19031 // Backcompat for ui-tab class (now ui-tabs-tab) 19032 $.widget( "ui.tabs", $.ui.tabs, { 19033 _processTabs: function() { 19034 this._superApply( arguments ); 19035 this._addClass( this.tabs, "ui-tab" ); 19036 } 19037 } ); 19038} 19039 19040var widgetsTabs = $.ui.tabs; 19041 19042 19043/*! 19044 * jQuery UI Tooltip 1.13.2 19045 * http://jqueryui.com 19046 * 19047 * Copyright jQuery Foundation and other contributors 19048 * Released under the MIT license. 19049 * http://jquery.org/license 19050 */ 19051 19052//>>label: Tooltip 19053//>>group: Widgets 19054//>>description: Shows additional information for any element on hover or focus. 19055//>>docs: http://api.jqueryui.com/tooltip/ 19056//>>demos: http://jqueryui.com/tooltip/ 19057//>>css.structure: ../../themes/base/core.css 19058//>>css.structure: ../../themes/base/tooltip.css 19059//>>css.theme: ../../themes/base/theme.css 19060 19061 19062$.widget( "ui.tooltip", { 19063 version: "1.13.2", 19064 options: { 19065 classes: { 19066 "ui-tooltip": "ui-corner-all ui-widget-shadow" 19067 }, 19068 content: function() { 19069 var title = $( this ).attr( "title" ); 19070 19071 // Escape title, since we're going from an attribute to raw HTML 19072 return $( "<a>" ).text( title ).html(); 19073 }, 19074 hide: true, 19075 19076 // Disabled elements have inconsistent behavior across browsers (#8661) 19077 items: "[title]:not([disabled])", 19078 position: { 19079 my: "left top+15", 19080 at: "left bottom", 19081 collision: "flipfit flip" 19082 }, 19083 show: true, 19084 track: false, 19085 19086 // Callbacks 19087 close: null, 19088 open: null 19089 }, 19090 19091 _addDescribedBy: function( elem, id ) { 19092 var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ); 19093 describedby.push( id ); 19094 elem 19095 .data( "ui-tooltip-id", id ) 19096 .attr( "aria-describedby", String.prototype.trim.call( describedby.join( " " ) ) ); 19097 }, 19098 19099 _removeDescribedBy: function( elem ) { 19100 var id = elem.data( "ui-tooltip-id" ), 19101 describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ), 19102 index = $.inArray( id, describedby ); 19103 19104 if ( index !== -1 ) { 19105 describedby.splice( index, 1 ); 19106 } 19107 19108 elem.removeData( "ui-tooltip-id" ); 19109 describedby = String.prototype.trim.call( describedby.join( " " ) ); 19110 if ( describedby ) { 19111 elem.attr( "aria-describedby", describedby ); 19112 } else { 19113 elem.removeAttr( "aria-describedby" ); 19114 } 19115 }, 19116 19117 _create: function() { 19118 this._on( { 19119 mouseover: "open", 19120 focusin: "open" 19121 } ); 19122 19123 // IDs of generated tooltips, needed for destroy 19124 this.tooltips = {}; 19125 19126 // IDs of parent tooltips where we removed the title attribute 19127 this.parents = {}; 19128 19129 // Append the aria-live region so tooltips announce correctly 19130 this.liveRegion = $( "<div>" ) 19131 .attr( { 19132 role: "log", 19133 "aria-live": "assertive", 19134 "aria-relevant": "additions" 19135 } ) 19136 .appendTo( this.document[ 0 ].body ); 19137 this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" ); 19138 19139 this.disabledTitles = $( [] ); 19140 }, 19141 19142 _setOption: function( key, value ) { 19143 var that = this; 19144 19145 this._super( key, value ); 19146 19147 if ( key === "content" ) { 19148 $.each( this.tooltips, function( id, tooltipData ) { 19149 that._updateContent( tooltipData.element ); 19150 } ); 19151 } 19152 }, 19153 19154 _setOptionDisabled: function( value ) { 19155 this[ value ? "_disable" : "_enable" ](); 19156 }, 19157 19158 _disable: function() { 19159 var that = this; 19160 19161 // Close open tooltips 19162 $.each( this.tooltips, function( id, tooltipData ) { 19163 var event = $.Event( "blur" ); 19164 event.target = event.currentTarget = tooltipData.element[ 0 ]; 19165 that.close( event, true ); 19166 } ); 19167 19168 // Remove title attributes to prevent native tooltips 19169 this.disabledTitles = this.disabledTitles.add( 19170 this.element.find( this.options.items ).addBack() 19171 .filter( function() { 19172 var element = $( this ); 19173 if ( element.is( "[title]" ) ) { 19174 return element 19175 .data( "ui-tooltip-title", element.attr( "title" ) ) 19176 .removeAttr( "title" ); 19177 } 19178 } ) 19179 ); 19180 }, 19181 19182 _enable: function() { 19183 19184 // restore title attributes 19185 this.disabledTitles.each( function() { 19186 var element = $( this ); 19187 if ( element.data( "ui-tooltip-title" ) ) { 19188 element.attr( "title", element.data( "ui-tooltip-title" ) ); 19189 } 19190 } ); 19191 this.disabledTitles = $( [] ); 19192 }, 19193 19194 open: function( event ) { 19195 var that = this, 19196 target = $( event ? event.target : this.element ) 19197 19198 // we need closest here due to mouseover bubbling, 19199 // but always pointing at the same event target 19200 .closest( this.options.items ); 19201 19202 // No element to show a tooltip for or the tooltip is already open 19203 if ( !target.length || target.data( "ui-tooltip-id" ) ) { 19204 return; 19205 } 19206 19207 if ( target.attr( "title" ) ) { 19208 target.data( "ui-tooltip-title", target.attr( "title" ) ); 19209 } 19210 19211 target.data( "ui-tooltip-open", true ); 19212 19213 // Kill parent tooltips, custom or native, for hover 19214 if ( event && event.type === "mouseover" ) { 19215 target.parents().each( function() { 19216 var parent = $( this ), 19217 blurEvent; 19218 if ( parent.data( "ui-tooltip-open" ) ) { 19219 blurEvent = $.Event( "blur" ); 19220 blurEvent.target = blurEvent.currentTarget = this; 19221 that.close( blurEvent, true ); 19222 } 19223 if ( parent.attr( "title" ) ) { 19224 parent.uniqueId(); 19225 that.parents[ this.id ] = { 19226 element: this, 19227 title: parent.attr( "title" ) 19228 }; 19229 parent.attr( "title", "" ); 19230 } 19231 } ); 19232 } 19233 19234 this._registerCloseHandlers( event, target ); 19235 this._updateContent( target, event ); 19236 }, 19237 19238 _updateContent: function( target, event ) { 19239 var content, 19240 contentOption = this.options.content, 19241 that = this, 19242 eventType = event ? event.type : null; 19243 19244 if ( typeof contentOption === "string" || contentOption.nodeType || 19245 contentOption.jquery ) { 19246 return this._open( event, target, contentOption ); 19247 } 19248 19249 content = contentOption.call( target[ 0 ], function( response ) { 19250 19251 // IE may instantly serve a cached response for ajax requests 19252 // delay this call to _open so the other call to _open runs first 19253 that._delay( function() { 19254 19255 // Ignore async response if tooltip was closed already 19256 if ( !target.data( "ui-tooltip-open" ) ) { 19257 return; 19258 } 19259 19260 // JQuery creates a special event for focusin when it doesn't 19261 // exist natively. To improve performance, the native event 19262 // object is reused and the type is changed. Therefore, we can't 19263 // rely on the type being correct after the event finished 19264 // bubbling, so we set it back to the previous value. (#8740) 19265 if ( event ) { 19266 event.type = eventType; 19267 } 19268 this._open( event, target, response ); 19269 } ); 19270 } ); 19271 if ( content ) { 19272 this._open( event, target, content ); 19273 } 19274 }, 19275 19276 _open: function( event, target, content ) { 19277 var tooltipData, tooltip, delayedShow, a11yContent, 19278 positionOption = $.extend( {}, this.options.position ); 19279 19280 if ( !content ) { 19281 return; 19282 } 19283 19284 // Content can be updated multiple times. If the tooltip already 19285 // exists, then just update the content and bail. 19286 tooltipData = this._find( target ); 19287 if ( tooltipData ) { 19288 tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content ); 19289 return; 19290 } 19291 19292 // If we have a title, clear it to prevent the native tooltip 19293 // we have to check first to avoid defining a title if none exists 19294 // (we don't want to cause an element to start matching [title]) 19295 // 19296 // We use removeAttr only for key events, to allow IE to export the correct 19297 // accessible attributes. For mouse events, set to empty string to avoid 19298 // native tooltip showing up (happens only when removing inside mouseover). 19299 if ( target.is( "[title]" ) ) { 19300 if ( event && event.type === "mouseover" ) { 19301 target.attr( "title", "" ); 19302 } else { 19303 target.removeAttr( "title" ); 19304 } 19305 } 19306 19307 tooltipData = this._tooltip( target ); 19308 tooltip = tooltipData.tooltip; 19309 this._addDescribedBy( target, tooltip.attr( "id" ) ); 19310 tooltip.find( ".ui-tooltip-content" ).html( content ); 19311 19312 // Support: Voiceover on OS X, JAWS on IE <= 9 19313 // JAWS announces deletions even when aria-relevant="additions" 19314 // Voiceover will sometimes re-read the entire log region's contents from the beginning 19315 this.liveRegion.children().hide(); 19316 a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() ); 19317 a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" ); 19318 a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" ); 19319 a11yContent.appendTo( this.liveRegion ); 19320 19321 function position( event ) { 19322 positionOption.of = event; 19323 if ( tooltip.is( ":hidden" ) ) { 19324 return; 19325 } 19326 tooltip.position( positionOption ); 19327 } 19328 if ( this.options.track && event && /^mouse/.test( event.type ) ) { 19329 this._on( this.document, { 19330 mousemove: position 19331 } ); 19332 19333 // trigger once to override element-relative positioning 19334 position( event ); 19335 } else { 19336 tooltip.position( $.extend( { 19337 of: target 19338 }, this.options.position ) ); 19339 } 19340 19341 tooltip.hide(); 19342 19343 this._show( tooltip, this.options.show ); 19344 19345 // Handle tracking tooltips that are shown with a delay (#8644). As soon 19346 // as the tooltip is visible, position the tooltip using the most recent 19347 // event. 19348 // Adds the check to add the timers only when both delay and track options are set (#14682) 19349 if ( this.options.track && this.options.show && this.options.show.delay ) { 19350 delayedShow = this.delayedShow = setInterval( function() { 19351 if ( tooltip.is( ":visible" ) ) { 19352 position( positionOption.of ); 19353 clearInterval( delayedShow ); 19354 } 19355 }, 13 ); 19356 } 19357 19358 this._trigger( "open", event, { tooltip: tooltip } ); 19359 }, 19360 19361 _registerCloseHandlers: function( event, target ) { 19362 var events = { 19363 keyup: function( event ) { 19364 if ( event.keyCode === $.ui.keyCode.ESCAPE ) { 19365 var fakeEvent = $.Event( event ); 19366 fakeEvent.currentTarget = target[ 0 ]; 19367 this.close( fakeEvent, true ); 19368 } 19369 } 19370 }; 19371 19372 // Only bind remove handler for delegated targets. Non-delegated 19373 // tooltips will handle this in destroy. 19374 if ( target[ 0 ] !== this.element[ 0 ] ) { 19375 events.remove = function() { 19376 var targetElement = this._find( target ); 19377 if ( targetElement ) { 19378 this._removeTooltip( targetElement.tooltip ); 19379 } 19380 }; 19381 } 19382 19383 if ( !event || event.type === "mouseover" ) { 19384 events.mouseleave = "close"; 19385 } 19386 if ( !event || event.type === "focusin" ) { 19387 events.focusout = "close"; 19388 } 19389 this._on( true, target, events ); 19390 }, 19391 19392 close: function( event ) { 19393 var tooltip, 19394 that = this, 19395 target = $( event ? event.currentTarget : this.element ), 19396 tooltipData = this._find( target ); 19397 19398 // The tooltip may already be closed 19399 if ( !tooltipData ) { 19400 19401 // We set ui-tooltip-open immediately upon open (in open()), but only set the 19402 // additional data once there's actually content to show (in _open()). So even if the 19403 // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in 19404 // the period between open() and _open(). 19405 target.removeData( "ui-tooltip-open" ); 19406 return; 19407 } 19408 19409 tooltip = tooltipData.tooltip; 19410 19411 // Disabling closes the tooltip, so we need to track when we're closing 19412 // to avoid an infinite loop in case the tooltip becomes disabled on close 19413 if ( tooltipData.closing ) { 19414 return; 19415 } 19416 19417 // Clear the interval for delayed tracking tooltips 19418 clearInterval( this.delayedShow ); 19419 19420 // Only set title if we had one before (see comment in _open()) 19421 // If the title attribute has changed since open(), don't restore 19422 if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) { 19423 target.attr( "title", target.data( "ui-tooltip-title" ) ); 19424 } 19425 19426 this._removeDescribedBy( target ); 19427 19428 tooltipData.hiding = true; 19429 tooltip.stop( true ); 19430 this._hide( tooltip, this.options.hide, function() { 19431 that._removeTooltip( $( this ) ); 19432 } ); 19433 19434 target.removeData( "ui-tooltip-open" ); 19435 this._off( target, "mouseleave focusout keyup" ); 19436 19437 // Remove 'remove' binding only on delegated targets 19438 if ( target[ 0 ] !== this.element[ 0 ] ) { 19439 this._off( target, "remove" ); 19440 } 19441 this._off( this.document, "mousemove" ); 19442 19443 if ( event && event.type === "mouseleave" ) { 19444 $.each( this.parents, function( id, parent ) { 19445 $( parent.element ).attr( "title", parent.title ); 19446 delete that.parents[ id ]; 19447 } ); 19448 } 19449 19450 tooltipData.closing = true; 19451 this._trigger( "close", event, { tooltip: tooltip } ); 19452 if ( !tooltipData.hiding ) { 19453 tooltipData.closing = false; 19454 } 19455 }, 19456 19457 _tooltip: function( element ) { 19458 var tooltip = $( "<div>" ).attr( "role", "tooltip" ), 19459 content = $( "<div>" ).appendTo( tooltip ), 19460 id = tooltip.uniqueId().attr( "id" ); 19461 19462 this._addClass( content, "ui-tooltip-content" ); 19463 this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" ); 19464 19465 tooltip.appendTo( this._appendTo( element ) ); 19466 19467 return this.tooltips[ id ] = { 19468 element: element, 19469 tooltip: tooltip 19470 }; 19471 }, 19472 19473 _find: function( target ) { 19474 var id = target.data( "ui-tooltip-id" ); 19475 return id ? this.tooltips[ id ] : null; 19476 }, 19477 19478 _removeTooltip: function( tooltip ) { 19479 19480 // Clear the interval for delayed tracking tooltips 19481 clearInterval( this.delayedShow ); 19482 19483 tooltip.remove(); 19484 delete this.tooltips[ tooltip.attr( "id" ) ]; 19485 }, 19486 19487 _appendTo: function( target ) { 19488 var element = target.closest( ".ui-front, dialog" ); 19489 19490 if ( !element.length ) { 19491 element = this.document[ 0 ].body; 19492 } 19493 19494 return element; 19495 }, 19496 19497 _destroy: function() { 19498 var that = this; 19499 19500 // Close open tooltips 19501 $.each( this.tooltips, function( id, tooltipData ) { 19502 19503 // Delegate to close method to handle common cleanup 19504 var event = $.Event( "blur" ), 19505 element = tooltipData.element; 19506 event.target = event.currentTarget = element[ 0 ]; 19507 that.close( event, true ); 19508 19509 // Remove immediately; destroying an open tooltip doesn't use the 19510 // hide animation 19511 $( "#" + id ).remove(); 19512 19513 // Restore the title 19514 if ( element.data( "ui-tooltip-title" ) ) { 19515 19516 // If the title attribute has changed since open(), don't restore 19517 if ( !element.attr( "title" ) ) { 19518 element.attr( "title", element.data( "ui-tooltip-title" ) ); 19519 } 19520 element.removeData( "ui-tooltip-title" ); 19521 } 19522 } ); 19523 this.liveRegion.remove(); 19524 } 19525} ); 19526 19527// DEPRECATED 19528// TODO: Switch return back to widget declaration at top of file when this is removed 19529if ( $.uiBackCompat !== false ) { 19530 19531 // Backcompat for tooltipClass option 19532 $.widget( "ui.tooltip", $.ui.tooltip, { 19533 options: { 19534 tooltipClass: null 19535 }, 19536 _tooltip: function() { 19537 var tooltipData = this._superApply( arguments ); 19538 if ( this.options.tooltipClass ) { 19539 tooltipData.tooltip.addClass( this.options.tooltipClass ); 19540 } 19541 return tooltipData; 19542 } 19543 } ); 19544} 19545 19546var widgetsTooltip = $.ui.tooltip; 19547 19548 19549 19550 19551} ); 19552 19553/***/ }), 19554
vendor: 4,151 bytes, lines 19555-19707
19555/***/ "../node_modules/js-cookie/dist/js.cookie.js": 19556/*!***************************************************!*\ 19557 !*** ../node_modules/js-cookie/dist/js.cookie.js ***! 19558 \***************************************************/ 19559/*! no static exports found */ 19560/***/ (function(module, exports, __webpack_require__) { 19561 19562/*! js-cookie v3.0.1 | MIT */ 19563; 19564(function (global, factory) { 19565 true ? module.exports = factory() : 19566 undefined; 19567}(this, (function () { 'use strict'; 19568 19569 /* eslint-disable no-var */ 19570 function assign (target) { 19571 for (var i = 1; i < arguments.length; i++) { 19572 var source = arguments[i]; 19573 for (var key in source) { 19574 target[key] = source[key]; 19575 } 19576 } 19577 return target 19578 } 19579 /* eslint-enable no-var */ 19580 19581 /* eslint-disable no-var */ 19582 var defaultConverter = { 19583 read: function (value) { 19584 if (value[0] === '"') { 19585 value = value.slice(1, -1); 19586 } 19587 return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent) 19588 }, 19589 write: function (value) { 19590 return encodeURIComponent(value).replace( 19591 /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, 19592 decodeURIComponent 19593 ) 19594 } 19595 }; 19596 /* eslint-enable no-var */ 19597 19598 /* eslint-disable no-var */ 19599 19600 function init (converter, defaultAttributes) { 19601 function set (key, value, attributes) { 19602 if (typeof document === 'undefined') { 19603 return 19604 } 19605 19606 attributes = assign({}, defaultAttributes, attributes); 19607 19608 if (typeof attributes.expires === 'number') { 19609 attributes.expires = new Date(Date.now() + attributes.expires * 864e5); 19610 } 19611 if (attributes.expires) { 19612 attributes.expires = attributes.expires.toUTCString(); 19613 } 19614 19615 key = encodeURIComponent(key) 19616 .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent) 19617 .replace(/[()]/g, escape); 19618 19619 var stringifiedAttributes = ''; 19620 for (var attributeName in attributes) { 19621 if (!attributes[attributeName]) { 19622 continue 19623 } 19624 19625 stringifiedAttributes += '; ' + attributeName; 19626 19627 if (attributes[attributeName] === true) { 19628 continue 19629 } 19630 19631 // Considers RFC 6265 section 5.2: 19632 // ... 19633 // 3. If the remaining unparsed-attributes contains a %x3B (";") 19634 // character: 19635 // Consume the characters of the unparsed-attributes up to, 19636 // not including, the first %x3B (";") character. 19637 // ... 19638 stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; 19639 } 19640 19641 return (document.cookie = 19642 key + '=' + converter.write(value, key) + stringifiedAttributes) 19643 } 19644 19645 function get (key) { 19646 if (typeof document === 'undefined' || (arguments.length && !key)) { 19647 return 19648 } 19649 19650 // To prevent the for loop in the first place assign an empty array 19651 // in case there are no cookies at all. 19652 var cookies = document.cookie ? document.cookie.split('; ') : []; 19653 var jar = {}; 19654 for (var i = 0; i < cookies.length; i++) { 19655 var parts = cookies[i].split('='); 19656 var value = parts.slice(1).join('='); 19657 19658 try { 19659 var foundKey = decodeURIComponent(parts[0]); 19660 jar[foundKey] = converter.read(value, foundKey); 19661 19662 if (key === foundKey) { 19663 break 19664 } 19665 } catch (e) {} 19666 } 19667 19668 return key ? jar[key] : jar 19669 } 19670 19671 return Object.create( 19672 { 19673 set: set, 19674 get: get, 19675 remove: function (key, attributes) { 19676 set( 19677 key, 19678 '', 19679 assign({}, attributes, { 19680 expires: -1 19681 }) 19682 ); 19683 }, 19684 withAttributes: function (attributes) { 19685 return init(this.converter, assign({}, this.attributes, attributes)) 19686 }, 19687 withConverter: function (converter) { 19688 return init(assign({}, this.converter, converter), this.attributes) 19689 } 19690 }, 19691 { 19692 attributes: { value: Object.freeze(defaultAttributes) }, 19693 converter: { value: Object.freeze(converter) } 19694 } 19695 ) 19696 } 19697 19698 var api = init(defaultConverter, { path: '/' }); 19699 /* eslint-enable no-var */ 19700 19701 return api; 19702 19703}))); 19704 19705 19706/***/ }), 19707
vendor: 42,427 bytes, lines 19708-21574
19708/***/ "../node_modules/magnific-popup/dist/jquery.magnific-popup.js": 19709/*!********************************************************************!*\ 19710 !*** ../node_modules/magnific-popup/dist/jquery.magnific-popup.js ***! 19711 \********************************************************************/ 19712/*! no static exports found */ 19713/***/ (function(module, exports, __webpack_require__) { 19714 19715var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Magnific Popup - v1.1.0 - 2016-02-20 19716* http://dimsemenov.com/plugins/magnific-popup/ 19717* Copyright (c) 2016 Dmitry Semenov; */ 19718;(function (factory) { 19719if (true) { 19720 // AMD. Register as an anonymous module. 19721 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "jquery")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 19722 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 19723 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 19724 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 19725 } else {} 19726 }(function($) { 19727 19728/*>>core*/ 19729/** 19730 * 19731 * Magnific Popup Core JS file 19732 * 19733 */ 19734 19735 19736/** 19737 * Private static constants 19738 */ 19739var CLOSE_EVENT = 'Close', 19740 BEFORE_CLOSE_EVENT = 'BeforeClose', 19741 AFTER_CLOSE_EVENT = 'AfterClose', 19742 BEFORE_APPEND_EVENT = 'BeforeAppend', 19743 MARKUP_PARSE_EVENT = 'MarkupParse', 19744 OPEN_EVENT = 'Open', 19745 CHANGE_EVENT = 'Change', 19746 NS = 'mfp', 19747 EVENT_NS = '.' + NS, 19748 READY_CLASS = 'mfp-ready', 19749 REMOVING_CLASS = 'mfp-removing', 19750 PREVENT_CLOSE_CLASS = 'mfp-prevent-close'; 19751 19752 19753/** 19754 * Private vars 19755 */ 19756/*jshint -W079 */ 19757var mfp, // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this' 19758 MagnificPopup = function(){}, 19759 _isJQ = !!(window.jQuery), 19760 _prevStatus, 19761 _window = $(window), 19762 _document, 19763 _prevContentType, 19764 _wrapClasses, 19765 _currPopupType; 19766 19767 19768/** 19769 * Private functions 19770 */ 19771var _mfpOn = function(name, f) { 19772 mfp.ev.on(NS + name + EVENT_NS, f); 19773 }, 19774 _getEl = function(className, appendTo, html, raw) { 19775 var el = document.createElement('div'); 19776 el.className = 'mfp-'+className; 19777 if(html) { 19778 el.innerHTML = html; 19779 } 19780 if(!raw) { 19781 el = $(el); 19782 if(appendTo) { 19783 el.appendTo(appendTo); 19784 } 19785 } else if(appendTo) { 19786 appendTo.appendChild(el); 19787 } 19788 return el; 19789 }, 19790 _mfpTrigger = function(e, data) { 19791 mfp.ev.triggerHandler(NS + e, data); 19792 19793 if(mfp.st.callbacks) { 19794 // converts "mfpEventName" to "eventName" callback and triggers it if it's present 19795 e = e.charAt(0).toLowerCase() + e.slice(1); 19796 if(mfp.st.callbacks[e]) { 19797 mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]); 19798 } 19799 } 19800 }, 19801 _getCloseBtn = function(type) { 19802 if(type !== _currPopupType || !mfp.currTemplate.closeBtn) { 19803 mfp.currTemplate.closeBtn = $( mfp.st.closeMarkup.replace('%title%', mfp.st.tClose ) ); 19804 _currPopupType = type; 19805 } 19806 return mfp.currTemplate.closeBtn; 19807 }, 19808 // Initialize Magnific Popup only when called at least once 19809 _checkInstance = function() { 19810 if(!$.magnificPopup.instance) { 19811 /*jshint -W020 */ 19812 mfp = new MagnificPopup(); 19813 mfp.init(); 19814 $.magnificPopup.instance = mfp; 19815 } 19816 }, 19817 // CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr 19818 supportsTransitions = function() { 19819 var s = document.createElement('p').style, // 's' for style. better to create an element if body yet to exist 19820 v = ['ms','O','Moz','Webkit']; // 'v' for vendor 19821 19822 if( s['transition'] !== undefined ) { 19823 return true; 19824 } 19825 19826 while( v.length ) { 19827 if( v.pop() + 'Transition' in s ) { 19828 return true; 19829 } 19830 } 19831 19832 return false; 19833 }; 19834 19835 19836 19837/** 19838 * Public functions 19839 */ 19840MagnificPopup.prototype = { 19841 19842 constructor: MagnificPopup, 19843 19844 /** 19845 * Initializes Magnific Popup plugin. 19846 * This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed 19847 */ 19848 init: function() { 19849 var appVersion = navigator.appVersion; 19850 mfp.isLowIE = mfp.isIE8 = document.all && !document.addEventListener; 19851 mfp.isAndroid = (/android/gi).test(appVersion); 19852 mfp.isIOS = (/iphone|ipad|ipod/gi).test(appVersion); 19853 mfp.supportsTransition = supportsTransitions(); 19854 19855 // We disable fixed positioned lightbox on devices that don't handle it nicely. 19856 // If you know a better way of detecting this - let me know. 19857 mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent) ); 19858 _document = $(document); 19859 19860 mfp.popupsCache = {}; 19861 }, 19862 19863 /** 19864 * Opens popup 19865 * @param data [description] 19866 */ 19867 open: function(data) { 19868 19869 var i; 19870 19871 if(data.isObj === false) { 19872 // convert jQuery collection to array to avoid conflicts later 19873 mfp.items = data.items.toArray(); 19874 19875 mfp.index = 0; 19876 var items = data.items, 19877 item; 19878 for(i = 0; i < items.length; i++) { 19879 item = items[i]; 19880 if(item.parsed) { 19881 item = item.el[0]; 19882 } 19883 if(item === data.el[0]) { 19884 mfp.index = i; 19885 break; 19886 } 19887 } 19888 } else { 19889 mfp.items = $.isArray(data.items) ? data.items : [data.items]; 19890 mfp.index = data.index || 0; 19891 } 19892 19893 // if popup is already opened - we just update the content 19894 if(mfp.isOpen) { 19895 mfp.updateItemHTML(); 19896 return; 19897 } 19898 19899 mfp.types = []; 19900 _wrapClasses = ''; 19901 if(data.mainEl && data.mainEl.length) { 19902 mfp.ev = data.mainEl.eq(0); 19903 } else { 19904 mfp.ev = _document; 19905 } 19906 19907 if(data.key) { 19908 if(!mfp.popupsCache[data.key]) { 19909 mfp.popupsCache[data.key] = {}; 19910 } 19911 mfp.currTemplate = mfp.popupsCache[data.key]; 19912 } else { 19913 mfp.currTemplate = {}; 19914 } 19915 19916 19917 19918 mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data ); 19919 mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos; 19920 19921 if(mfp.st.modal) { 19922 mfp.st.closeOnContentClick = false; 19923 mfp.st.closeOnBgClick = false; 19924 mfp.st.showCloseBtn = false; 19925 mfp.st.enableEscapeKey = false; 19926 } 19927 19928 19929 // Building markup 19930 // main containers are created only once 19931 if(!mfp.bgOverlay) { 19932 19933 // Dark overlay 19934 mfp.bgOverlay = _getEl('bg').on('click'+EVENT_NS, function() { 19935 mfp.close(); 19936 }); 19937 19938 mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) { 19939 if(mfp._checkIfClose(e.target)) { 19940 mfp.close(); 19941 } 19942 }); 19943 19944 mfp.container = _getEl('container', mfp.wrap); 19945 } 19946 19947 mfp.contentContainer = _getEl('content'); 19948 if(mfp.st.preloader) { 19949 mfp.preloader = _getEl('preloader', mfp.container, mfp.st.tLoading); 19950 } 19951 19952 19953 // Initializing modules 19954 var modules = $.magnificPopup.modules; 19955 for(i = 0; i < modules.length; i++) { 19956 var n = modules[i]; 19957 n = n.charAt(0).toUpperCase() + n.slice(1); 19958 mfp['init'+n].call(mfp); 19959 } 19960 _mfpTrigger('BeforeOpen'); 19961 19962 19963 if(mfp.st.showCloseBtn) { 19964 // Close button 19965 if(!mfp.st.closeBtnInside) { 19966 mfp.wrap.append( _getCloseBtn() ); 19967 } else { 19968 _mfpOn(MARKUP_PARSE_EVENT, function(e, template, values, item) { 19969 values.close_replaceWith = _getCloseBtn(item.type); 19970 }); 19971 _wrapClasses += ' mfp-close-btn-in'; 19972 } 19973 } 19974 19975 if(mfp.st.alignTop) { 19976 _wrapClasses += ' mfp-align-top'; 19977 } 19978 19979 19980 19981 if(mfp.fixedContentPos) { 19982 mfp.wrap.css({ 19983 overflow: mfp.st.overflowY, 19984 overflowX: 'hidden', 19985 overflowY: mfp.st.overflowY 19986 }); 19987 } else { 19988 mfp.wrap.css({ 19989 top: _window.scrollTop(), 19990 position: 'absolute' 19991 }); 19992 } 19993 if( mfp.st.fixedBgPos === false || (mfp.st.fixedBgPos === 'auto' && !mfp.fixedContentPos) ) { 19994 mfp.bgOverlay.css({ 19995 height: _document.height(), 19996 position: 'absolute' 19997 }); 19998 } 19999 20000 20001 20002 if(mfp.st.enableEscapeKey) { 20003 // Close on ESC key 20004 _document.on('keyup' + EVENT_NS, function(e) { 20005 if(e.keyCode === 27) { 20006 mfp.close(); 20007 } 20008 }); 20009 } 20010 20011 _window.on('resize' + EVENT_NS, function() { 20012 mfp.updateSize(); 20013 }); 20014 20015 20016 if(!mfp.st.closeOnContentClick) { 20017 _wrapClasses += ' mfp-auto-cursor'; 20018 } 20019 20020 if(_wrapClasses) 20021 mfp.wrap.addClass(_wrapClasses); 20022 20023 20024 // this triggers recalculation of layout, so we get it once to not to trigger twice 20025 var windowHeight = mfp.wH = _window.height(); 20026 20027 20028 var windowStyles = {}; 20029 20030 if( mfp.fixedContentPos ) { 20031 if(mfp._hasScrollBar(windowHeight)){ 20032 var s = mfp._getScrollbarSize(); 20033 if(s) { 20034 windowStyles.marginRight = s; 20035 } 20036 } 20037 } 20038 20039 if(mfp.fixedContentPos) { 20040 if(!mfp.isIE7) { 20041 windowStyles.overflow = 'hidden'; 20042 } else { 20043 // ie7 double-scroll bug 20044 $('body, html').css('overflow', 'hidden'); 20045 } 20046 } 20047 20048 20049 20050 var classesToadd = mfp.st.mainClass; 20051 if(mfp.isIE7) { 20052 classesToadd += ' mfp-ie7'; 20053 } 20054 if(classesToadd) { 20055 mfp._addClassToMFP( classesToadd ); 20056 } 20057 20058 // add content 20059 mfp.updateItemHTML(); 20060 20061 _mfpTrigger('BuildControls'); 20062 20063 // remove scrollbar, add margin e.t.c 20064 $('html').css(windowStyles); 20065 20066 // add everything to DOM 20067 mfp.bgOverlay.add(mfp.wrap).prependTo( mfp.st.prependTo || $(document.body) ); 20068 20069 // Save last focused element 20070 mfp._lastFocusedEl = document.activeElement; 20071 20072 // Wait for next cycle to allow CSS transition 20073 setTimeout(function() { 20074 20075 if(mfp.content) { 20076 mfp._addClassToMFP(READY_CLASS); 20077 mfp._setFocus(); 20078 } else { 20079 // if content is not defined (not loaded e.t.c) we add class only for BG 20080 mfp.bgOverlay.addClass(READY_CLASS); 20081 } 20082 20083 // Trap the focus in popup 20084 _document.on('focusin' + EVENT_NS, mfp._onFocusIn); 20085 20086 }, 16); 20087 20088 mfp.isOpen = true; 20089 mfp.updateSize(windowHeight); 20090 _mfpTrigger(OPEN_EVENT); 20091 20092 return data; 20093 }, 20094 20095 /** 20096 * Closes the popup 20097 */ 20098 close: function() { 20099 if(!mfp.isOpen) return; 20100 _mfpTrigger(BEFORE_CLOSE_EVENT); 20101 20102 mfp.isOpen = false; 20103 // for CSS3 animation 20104 if(mfp.st.removalDelay && !mfp.isLowIE && mfp.supportsTransition ) { 20105 mfp._addClassToMFP(REMOVING_CLASS); 20106 setTimeout(function() { 20107 mfp._close(); 20108 }, mfp.st.removalDelay); 20109 } else { 20110 mfp._close(); 20111 } 20112 }, 20113 20114 /** 20115 * Helper for close() function 20116 */ 20117 _close: function() { 20118 _mfpTrigger(CLOSE_EVENT); 20119 20120 var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' '; 20121 20122 mfp.bgOverlay.detach(); 20123 mfp.wrap.detach(); 20124 mfp.container.empty(); 20125 20126 if(mfp.st.mainClass) { 20127 classesToRemove += mfp.st.mainClass + ' '; 20128 } 20129 20130 mfp._removeClassFromMFP(classesToRemove); 20131 20132 if(mfp.fixedContentPos) { 20133 var windowStyles = {marginRight: ''}; 20134 if(mfp.isIE7) { 20135 $('body, html').css('overflow', ''); 20136 } else { 20137 windowStyles.overflow = ''; 20138 } 20139 $('html').css(windowStyles); 20140 } 20141 20142 _document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS); 20143 mfp.ev.off(EVENT_NS); 20144 20145 // clean up DOM elements that aren't removed 20146 mfp.wrap.attr('class', 'mfp-wrap').removeAttr('style'); 20147 mfp.bgOverlay.attr('class', 'mfp-bg'); 20148 mfp.container.attr('class', 'mfp-container'); 20149 20150 // remove close button from target element 20151 if(mfp.st.showCloseBtn && 20152 (!mfp.st.closeBtnInside || mfp.currTemplate[mfp.currItem.type] === true)) { 20153 if(mfp.currTemplate.closeBtn) 20154 mfp.currTemplate.closeBtn.detach(); 20155 } 20156 20157 20158 if(mfp.st.autoFocusLast && mfp._lastFocusedEl) { 20159 $(mfp._lastFocusedEl).focus(); // put tab focus back 20160 } 20161 mfp.currItem = null; 20162 mfp.content = null; 20163 mfp.currTemplate = null; 20164 mfp.prevHeight = 0; 20165 20166 _mfpTrigger(AFTER_CLOSE_EVENT); 20167 }, 20168 20169 updateSize: function(winHeight) { 20170 20171 if(mfp.isIOS) { 20172 // fixes iOS nav bars https://github.com/dimsemenov/Magnific-Popup/issues/2 20173 var zoomLevel = document.documentElement.clientWidth / window.innerWidth; 20174 var height = window.innerHeight * zoomLevel; 20175 mfp.wrap.css('height', height); 20176 mfp.wH = height; 20177 } else { 20178 mfp.wH = winHeight || _window.height(); 20179 } 20180 // Fixes #84: popup incorrectly positioned with position:relative on body 20181 if(!mfp.fixedContentPos) { 20182 mfp.wrap.css('height', mfp.wH); 20183 } 20184 20185 _mfpTrigger('Resize'); 20186 20187 }, 20188 20189 /** 20190 * Set content of popup based on current index 20191 */ 20192 updateItemHTML: function() { 20193 var item = mfp.items[mfp.index]; 20194 20195 // Detach and perform modifications 20196 mfp.contentContainer.detach(); 20197 20198 if(mfp.content) 20199 mfp.content.detach(); 20200 20201 if(!item.parsed) { 20202 item = mfp.parseEl( mfp.index ); 20203 } 20204 20205 var type = item.type; 20206 20207 _mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]); 20208 // BeforeChange event works like so: 20209 // _mfpOn('BeforeChange', function(e, prevType, newType) { }); 20210 20211 mfp.currItem = item; 20212 20213 if(!mfp.currTemplate[type]) { 20214 var markup = mfp.st[type] ? mfp.st[type].markup : false; 20215 20216 // allows to modify markup 20217 _mfpTrigger('FirstMarkupParse', markup); 20218 20219 if(markup) { 20220 mfp.currTemplate[type] = $(markup); 20221 } else { 20222 // if there is no markup found we just define that template is parsed 20223 mfp.currTemplate[type] = true; 20224 } 20225 } 20226 20227 if(_prevContentType && _prevContentType !== item.type) { 20228 mfp.container.removeClass('mfp-'+_prevContentType+'-holder'); 20229 } 20230 20231 var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]); 20232 mfp.appendContent(newContent, type); 20233 20234 item.preloaded = true; 20235 20236 _mfpTrigger(CHANGE_EVENT, item); 20237 _prevContentType = item.type; 20238 20239 // Append container back after its content changed 20240 mfp.container.prepend(mfp.contentContainer); 20241 20242 _mfpTrigger('AfterChange'); 20243 }, 20244 20245 20246 /** 20247 * Set HTML content of popup 20248 */ 20249 appendContent: function(newContent, type) { 20250 mfp.content = newContent; 20251 20252 if(newContent) { 20253 if(mfp.st.showCloseBtn && mfp.st.closeBtnInside && 20254 mfp.currTemplate[type] === true) { 20255 // if there is no markup, we just append close button element inside 20256 if(!mfp.content.find('.mfp-close').length) { 20257 mfp.content.append(_getCloseBtn()); 20258 } 20259 } else { 20260 mfp.content = newContent; 20261 } 20262 } else { 20263 mfp.content = ''; 20264 } 20265 20266 _mfpTrigger(BEFORE_APPEND_EVENT); 20267 mfp.container.addClass('mfp-'+type+'-holder'); 20268 20269 mfp.contentContainer.append(mfp.content); 20270 }, 20271 20272 20273 /** 20274 * Creates Magnific Popup data object based on given data 20275 * @param {int} index Index of item to parse 20276 */ 20277 parseEl: function(index) { 20278 var item = mfp.items[index], 20279 type; 20280 20281 if(item.tagName) { 20282 item = { el: $(item) }; 20283 } else { 20284 type = item.type; 20285 item = { data: item, src: item.src }; 20286 } 20287 20288 if(item.el) { 20289 var types = mfp.types; 20290 20291 // check for 'mfp-TYPE' class 20292 for(var i = 0; i < types.length; i++) { 20293 if( item.el.hasClass('mfp-'+types[i]) ) { 20294 type = types[i]; 20295 break; 20296 } 20297 } 20298 20299 item.src = item.el.attr('data-mfp-src'); 20300 if(!item.src) { 20301 item.src = item.el.attr('href'); 20302 } 20303 } 20304 20305 item.type = type || mfp.st.type || 'inline'; 20306 item.index = index; 20307 item.parsed = true; 20308 mfp.items[index] = item; 20309 _mfpTrigger('ElementParse', item); 20310 20311 return mfp.items[index]; 20312 }, 20313 20314 20315 /** 20316 * Initializes single popup or a group of popups 20317 */ 20318 addGroup: function(el, options) { 20319 var eHandler = function(e) { 20320 e.mfpEl = this; 20321 mfp._openClick(e, el, options); 20322 }; 20323 20324 if(!options) { 20325 options = {}; 20326 } 20327 20328 var eName = 'click.magnificPopup'; 20329 options.mainEl = el; 20330 20331 if(options.items) { 20332 options.isObj = true; 20333 el.off(eName).on(eName, eHandler); 20334 } else { 20335 options.isObj = false; 20336 if(options.delegate) { 20337 el.off(eName).on(eName, options.delegate , eHandler); 20338 } else { 20339 options.items = el; 20340 el.off(eName).on(eName, eHandler); 20341 } 20342 } 20343 }, 20344 _openClick: function(e, el, options) { 20345 var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick; 20346 20347 20348 if(!midClick && ( e.which === 2 || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey ) ) { 20349 return; 20350 } 20351 20352 var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn; 20353 20354 if(disableOn) { 20355 if($.isFunction(disableOn)) { 20356 if( !disableOn.call(mfp) ) { 20357 return true; 20358 } 20359 } else { // else it's number 20360 if( _window.width() < disableOn ) { 20361 return true; 20362 } 20363 } 20364 } 20365 20366 if(e.type) { 20367 e.preventDefault(); 20368 20369 // This will prevent popup from closing if element is inside and popup is already opened 20370 if(mfp.isOpen) { 20371 e.stopPropagation(); 20372 } 20373 } 20374 20375 options.el = $(e.mfpEl); 20376 if(options.delegate) { 20377 options.items = el.find(options.delegate); 20378 } 20379 mfp.open(options); 20380 }, 20381 20382 20383 /** 20384 * Updates text on preloader 20385 */ 20386 updateStatus: function(status, text) { 20387 20388 if(mfp.preloader) { 20389 if(_prevStatus !== status) { 20390 mfp.container.removeClass('mfp-s-'+_prevStatus); 20391 } 20392 20393 if(!text && status === 'loading') { 20394 text = mfp.st.tLoading; 20395 } 20396 20397 var data = { 20398 status: status, 20399 text: text 20400 }; 20401 // allows to modify status 20402 _mfpTrigger('UpdateStatus', data); 20403 20404 status = data.status; 20405 text = data.text; 20406 20407 mfp.preloader.html(text); 20408 20409 mfp.preloader.find('a').on('click', function(e) { 20410 e.stopImmediatePropagation(); 20411 }); 20412 20413 mfp.container.addClass('mfp-s-'+status); 20414 _prevStatus = status; 20415 } 20416 }, 20417 20418 20419 /* 20420 "Private" helpers that aren't private at all 20421 */ 20422 // Check to close popup or not 20423 // "target" is an element that was clicked 20424 _checkIfClose: function(target) { 20425 20426 if($(target).hasClass(PREVENT_CLOSE_CLASS)) { 20427 return; 20428 } 20429 20430 var closeOnContent = mfp.st.closeOnContentClick; 20431 var closeOnBg = mfp.st.closeOnBgClick; 20432 20433 if(closeOnContent && closeOnBg) { 20434 return true; 20435 } else { 20436 20437 // We close the popup if click is on close button or on preloader. Or if there is no content. 20438 if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) { 20439 return true; 20440 } 20441 20442 // if click is outside the content 20443 if( (target !== mfp.content[0] && !$.contains(mfp.content[0], target)) ) { 20444 if(closeOnBg) { 20445 // last check, if the clicked element is in DOM, (in case it's removed onclick) 20446 if( $.contains(document, target) ) { 20447 return true; 20448 } 20449 } 20450 } else if(closeOnContent) { 20451 return true; 20452 } 20453 20454 } 20455 return false; 20456 }, 20457 _addClassToMFP: function(cName) { 20458 mfp.bgOverlay.addClass(cName); 20459 mfp.wrap.addClass(cName); 20460 }, 20461 _removeClassFromMFP: function(cName) { 20462 this.bgOverlay.removeClass(cName); 20463 mfp.wrap.removeClass(cName); 20464 }, 20465 _hasScrollBar: function(winHeight) { 20466 return ( (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()) ); 20467 }, 20468 _setFocus: function() { 20469 (mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus(); 20470 }, 20471 _onFocusIn: function(e) { 20472 if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) { 20473 mfp._setFocus(); 20474 return false; 20475 } 20476 }, 20477 _parseMarkup: function(template, values, item) { 20478 var arr; 20479 if(item.data) { 20480 values = $.extend(item.data, values); 20481 } 20482 _mfpTrigger(MARKUP_PARSE_EVENT, [template, values, item] ); 20483 20484 $.each(values, function(key, value) { 20485 if(value === undefined || value === false) { 20486 return true; 20487 } 20488 arr = key.split('_'); 20489 if(arr.length > 1) { 20490 var el = template.find(EVENT_NS + '-'+arr[0]); 20491 20492 if(el.length > 0) { 20493 var attr = arr[1]; 20494 if(attr === 'replaceWith') { 20495 if(el[0] !== value[0]) { 20496 el.replaceWith(value); 20497 } 20498 } else if(attr === 'img') { 20499 if(el.is('img')) { 20500 el.attr('src', value); 20501 } else { 20502 el.replaceWith( $('<img>').attr('src', value).attr('class', el.attr('class')) ); 20503 } 20504 } else { 20505 el.attr(arr[1], value); 20506 } 20507 } 20508 20509 } else { 20510 template.find(EVENT_NS + '-'+key).html(value); 20511 } 20512 }); 20513 }, 20514 20515 _getScrollbarSize: function() { 20516 // thx David 20517 if(mfp.scrollbarSize === undefined) { 20518 var scrollDiv = document.createElement("div"); 20519 scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;'; 20520 document.body.appendChild(scrollDiv); 20521 mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth; 20522 document.body.removeChild(scrollDiv); 20523 } 20524 return mfp.scrollbarSize; 20525 } 20526 20527}; /* MagnificPopup core prototype end */ 20528 20529 20530 20531 20532/** 20533 * Public static functions 20534 */ 20535$.magnificPopup = { 20536 instance: null, 20537 proto: MagnificPopup.prototype, 20538 modules: [], 20539 20540 open: function(options, index) { 20541 _checkInstance(); 20542 20543 if(!options) { 20544 options = {}; 20545 } else { 20546 options = $.extend(true, {}, options); 20547 } 20548 20549 options.isObj = true; 20550 options.index = index || 0; 20551 return this.instance.open(options); 20552 }, 20553 20554 close: function() { 20555 return $.magnificPopup.instance && $.magnificPopup.instance.close(); 20556 }, 20557 20558 registerModule: function(name, module) { 20559 if(module.options) { 20560 $.magnificPopup.defaults[name] = module.options; 20561 } 20562 $.extend(this.proto, module.proto); 20563 this.modules.push(name); 20564 }, 20565 20566 defaults: { 20567 20568 // Info about options is in docs: 20569 // http://dimsemenov.com/plugins/magnific-popup/documentation.html#options 20570 20571 disableOn: 0, 20572 20573 key: null, 20574 20575 midClick: false, 20576 20577 mainClass: '', 20578 20579 preloader: true, 20580 20581 focus: '', // CSS selector of input to focus after popup is opened 20582 20583 closeOnContentClick: false, 20584 20585 closeOnBgClick: true, 20586 20587 closeBtnInside: true, 20588 20589 showCloseBtn: true, 20590 20591 enableEscapeKey: true, 20592 20593 modal: false, 20594 20595 alignTop: false, 20596 20597 removalDelay: 0, 20598 20599 prependTo: null, 20600 20601 fixedContentPos: 'auto', 20602 20603 fixedBgPos: 'auto', 20604 20605 overflowY: 'auto', 20606 20607 closeMarkup: '<button title="%title%" type="button" class="mfp-close">×</button>', 20608 20609 tClose: 'Close (Esc)', 20610 20611 tLoading: 'Loading...', 20612 20613 autoFocusLast: true 20614 20615 } 20616}; 20617 20618 20619 20620$.fn.magnificPopup = function(options) { 20621 _checkInstance(); 20622 20623 var jqEl = $(this); 20624 20625 // We call some API method of first param is a string 20626 if (typeof options === "string" ) { 20627 20628 if(options === 'open') { 20629 var items, 20630 itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup, 20631 index = parseInt(arguments[1], 10) || 0; 20632 20633 if(itemOpts.items) { 20634 items = itemOpts.items[index]; 20635 } else { 20636 items = jqEl; 20637 if(itemOpts.delegate) { 20638 items = items.find(itemOpts.delegate); 20639 } 20640 items = items.eq( index ); 20641 } 20642 mfp._openClick({mfpEl:items}, jqEl, itemOpts); 20643 } else { 20644 if(mfp.isOpen) 20645 mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1)); 20646 } 20647 20648 } else { 20649 // clone options obj 20650 options = $.extend(true, {}, options); 20651 20652 /* 20653 * As Zepto doesn't support .data() method for objects 20654 * and it works only in normal browsers 20655 * we assign "options" object directly to the DOM element. FTW! 20656 */ 20657 if(_isJQ) { 20658 jqEl.data('magnificPopup', options); 20659 } else { 20660 jqEl[0].magnificPopup = options; 20661 } 20662 20663 mfp.addGroup(jqEl, options); 20664 20665 } 20666 return jqEl; 20667}; 20668 20669/*>>core*/ 20670 20671/*>>inline*/ 20672 20673var INLINE_NS = 'inline', 20674 _hiddenClass, 20675 _inlinePlaceholder, 20676 _lastInlineElement, 20677 _putInlineElementsBack = function() { 20678 if(_lastInlineElement) { 20679 _inlinePlaceholder.after( _lastInlineElement.addClass(_hiddenClass) ).detach(); 20680 _lastInlineElement = null; 20681 } 20682 }; 20683 20684$.magnificPopup.registerModule(INLINE_NS, { 20685 options: { 20686 hiddenClass: 'hide', // will be appended with `mfp-` prefix 20687 markup: '', 20688 tNotFound: 'Content not found' 20689 }, 20690 proto: { 20691 20692 initInline: function() { 20693 mfp.types.push(INLINE_NS); 20694 20695 _mfpOn(CLOSE_EVENT+'.'+INLINE_NS, function() { 20696 _putInlineElementsBack(); 20697 }); 20698 }, 20699 20700 getInline: function(item, template) { 20701 20702 _putInlineElementsBack(); 20703 20704 if(item.src) { 20705 var inlineSt = mfp.st.inline, 20706 el = $(item.src); 20707 20708 if(el.length) { 20709 20710 // If target element has parent - we replace it with placeholder and put it back after popup is closed 20711 var parent = el[0].parentNode; 20712 if(parent && parent.tagName) { 20713 if(!_inlinePlaceholder) { 20714 _hiddenClass = inlineSt.hiddenClass; 20715 _inlinePlaceholder = _getEl(_hiddenClass); 20716 _hiddenClass = 'mfp-'+_hiddenClass; 20717 } 20718 // replace target inline element with placeholder 20719 _lastInlineElement = el.after(_inlinePlaceholder).detach().removeClass(_hiddenClass); 20720 } 20721 20722 mfp.updateStatus('ready'); 20723 } else { 20724 mfp.updateStatus('error', inlineSt.tNotFound); 20725 el = $('<div>'); 20726 } 20727 20728 item.inlineElement = el; 20729 return el; 20730 } 20731 20732 mfp.updateStatus('ready'); 20733 mfp._parseMarkup(template, {}, item); 20734 return template; 20735 } 20736 } 20737}); 20738 20739/*>>inline*/ 20740 20741/*>>ajax*/ 20742var AJAX_NS = 'ajax', 20743 _ajaxCur, 20744 _removeAjaxCursor = function() { 20745 if(_ajaxCur) { 20746 $(document.body).removeClass(_ajaxCur); 20747 } 20748 }, 20749 _destroyAjaxRequest = function() { 20750 _removeAjaxCursor(); 20751 if(mfp.req) { 20752 mfp.req.abort(); 20753 } 20754 }; 20755 20756$.magnificPopup.registerModule(AJAX_NS, { 20757 20758 options: { 20759 settings: null, 20760 cursor: 'mfp-ajax-cur', 20761 tError: '<a href="%url%">The content</a> could not be loaded.' 20762 }, 20763 20764 proto: { 20765 initAjax: function() { 20766 mfp.types.push(AJAX_NS); 20767 _ajaxCur = mfp.st.ajax.cursor; 20768 20769 _mfpOn(CLOSE_EVENT+'.'+AJAX_NS, _destroyAjaxRequest); 20770 _mfpOn('BeforeChange.' + AJAX_NS, _destroyAjaxRequest); 20771 }, 20772 getAjax: function(item) { 20773 20774 if(_ajaxCur) { 20775 $(document.body).addClass(_ajaxCur); 20776 } 20777 20778 mfp.updateStatus('loading'); 20779 20780 var opts = $.extend({ 20781 url: item.src, 20782 success: function(data, textStatus, jqXHR) { 20783 var temp = { 20784 data:data, 20785 xhr:jqXHR 20786 }; 20787 20788 _mfpTrigger('ParseAjax', temp); 20789 20790 mfp.appendContent( $(temp.data), AJAX_NS ); 20791 20792 item.finished = true; 20793 20794 _removeAjaxCursor(); 20795 20796 mfp._setFocus(); 20797 20798 setTimeout(function() { 20799 mfp.wrap.addClass(READY_CLASS); 20800 }, 16); 20801 20802 mfp.updateStatus('ready'); 20803 20804 _mfpTrigger('AjaxContentAdded'); 20805 }, 20806 error: function() { 20807 _removeAjaxCursor(); 20808 item.finished = item.loadError = true; 20809 mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src)); 20810 } 20811 }, mfp.st.ajax.settings); 20812 20813 mfp.req = $.ajax(opts); 20814 20815 return ''; 20816 } 20817 } 20818}); 20819 20820/*>>ajax*/ 20821 20822/*>>image*/ 20823var _imgInterval, 20824 _getTitle = function(item) { 20825 if(item.data && item.data.title !== undefined) 20826 return item.data.title; 20827 20828 var src = mfp.st.image.titleSrc; 20829 20830 if(src) { 20831 if($.isFunction(src)) { 20832 return src.call(mfp, item); 20833 } else if(item.el) { 20834 return item.el.attr(src) || ''; 20835 } 20836 } 20837 return ''; 20838 }; 20839 20840$.magnificPopup.registerModule('image', { 20841 20842 options: { 20843 markup: '<div class="mfp-figure">'+ 20844 '<div class="mfp-close"></div>'+ 20845 '<figure>'+ 20846 '<div class="mfp-img"></div>'+ 20847 '<figcaption>'+ 20848 '<div class="mfp-bottom-bar">'+ 20849 '<div class="mfp-title"></div>'+ 20850 '<div class="mfp-counter"></div>'+ 20851 '</div>'+ 20852 '</figcaption>'+ 20853 '</figure>'+ 20854 '</div>', 20855 cursor: 'mfp-zoom-out-cur', 20856 titleSrc: 'title', 20857 verticalFit: true, 20858 tError: '<a href="%url%">The image</a> could not be loaded.' 20859 }, 20860 20861 proto: { 20862 initImage: function() { 20863 var imgSt = mfp.st.image, 20864 ns = '.image'; 20865 20866 mfp.types.push('image'); 20867 20868 _mfpOn(OPEN_EVENT+ns, function() { 20869 if(mfp.currItem.type === 'image' && imgSt.cursor) { 20870 $(document.body).addClass(imgSt.cursor); 20871 } 20872 }); 20873 20874 _mfpOn(CLOSE_EVENT+ns, function() { 20875 if(imgSt.cursor) { 20876 $(document.body).removeClass(imgSt.cursor); 20877 } 20878 _window.off('resize' + EVENT_NS); 20879 }); 20880 20881 _mfpOn('Resize'+ns, mfp.resizeImage); 20882 if(mfp.isLowIE) { 20883 _mfpOn('AfterChange', mfp.resizeImage); 20884 } 20885 }, 20886 resizeImage: function() { 20887 var item = mfp.currItem; 20888 if(!item || !item.img) return; 20889 20890 if(mfp.st.image.verticalFit) { 20891 var decr = 0; 20892 // fix box-sizing in ie7/8 20893 if(mfp.isLowIE) { 20894 decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'),10); 20895 } 20896 item.img.css('max-height', mfp.wH-decr); 20897 } 20898 }, 20899 _onImageHasSize: function(item) { 20900 if(item.img) { 20901 20902 item.hasSize = true; 20903 20904 if(_imgInterval) { 20905 clearInterval(_imgInterval); 20906 } 20907 20908 item.isCheckingImgSize = false; 20909 20910 _mfpTrigger('ImageHasSize', item); 20911 20912 if(item.imgHidden) { 20913 if(mfp.content) 20914 mfp.content.removeClass('mfp-loading'); 20915 20916 item.imgHidden = false; 20917 } 20918 20919 } 20920 }, 20921 20922 /** 20923 * Function that loops until the image has size to display elements that rely on it asap 20924 */ 20925 findImageSize: function(item) { 20926 20927 var counter = 0, 20928 img = item.img[0], 20929 mfpSetInterval = function(delay) { 20930 20931 if(_imgInterval) { 20932 clearInterval(_imgInterval); 20933 } 20934 // decelerating interval that checks for size of an image 20935 _imgInterval = setInterval(function() { 20936 if(img.naturalWidth > 0) { 20937 mfp._onImageHasSize(item); 20938 return; 20939 } 20940 20941 if(counter > 200) { 20942 clearInterval(_imgInterval); 20943 } 20944 20945 counter++; 20946 if(counter === 3) { 20947 mfpSetInterval(10); 20948 } else if(counter === 40) { 20949 mfpSetInterval(50); 20950 } else if(counter === 100) { 20951 mfpSetInterval(500); 20952 } 20953 }, delay); 20954 }; 20955 20956 mfpSetInterval(1); 20957 }, 20958 20959 getImage: function(item, template) { 20960 20961 var guard = 0, 20962 20963 // image load complete handler 20964 onLoadComplete = function() { 20965 if(item) { 20966 if (item.img[0].complete) { 20967 item.img.off('.mfploader'); 20968 20969 if(item === mfp.currItem){ 20970 mfp._onImageHasSize(item); 20971 20972 mfp.updateStatus('ready'); 20973 } 20974 20975 item.hasSize = true; 20976 item.loaded = true; 20977 20978 _mfpTrigger('ImageLoadComplete'); 20979 20980 } 20981 else { 20982 // if image complete check fails 200 times (20 sec), we assume that there was an error. 20983 guard++; 20984 if(guard < 200) { 20985 setTimeout(onLoadComplete,100); 20986 } else { 20987 onLoadError(); 20988 } 20989 } 20990 } 20991 }, 20992 20993 // image error handler 20994 onLoadError = function() { 20995 if(item) { 20996 item.img.off('.mfploader'); 20997 if(item === mfp.currItem){ 20998 mfp._onImageHasSize(item); 20999 mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) ); 21000 } 21001 21002 item.hasSize = true; 21003 item.loaded = true; 21004 item.loadError = true; 21005 } 21006 }, 21007 imgSt = mfp.st.image; 21008 21009 21010 var el = template.find('.mfp-img'); 21011 if(el.length) { 21012 var img = document.createElement('img'); 21013 img.className = 'mfp-img'; 21014 if(item.el && item.el.find('img').length) { 21015 img.alt = item.el.find('img').attr('alt'); 21016 } 21017 item.img = $(img).on('load.mfploader', onLoadComplete).on('error.mfploader', onLoadError); 21018 img.src = item.src; 21019 21020 // without clone() "error" event is not firing when IMG is replaced by new IMG 21021 // TODO: find a way to avoid such cloning 21022 if(el.is('img')) { 21023 item.img = item.img.clone(); 21024 } 21025 21026 img = item.img[0]; 21027 if(img.naturalWidth > 0) { 21028 item.hasSize = true; 21029 } else if(!img.width) { 21030 item.hasSize = false; 21031 } 21032 } 21033 21034 mfp._parseMarkup(template, { 21035 title: _getTitle(item), 21036 img_replaceWith: item.img 21037 }, item); 21038 21039 mfp.resizeImage(); 21040 21041 if(item.hasSize) { 21042 if(_imgInterval) clearInterval(_imgInterval); 21043 21044 if(item.loadError) { 21045 template.addClass('mfp-loading'); 21046 mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) ); 21047 } else { 21048 template.removeClass('mfp-loading'); 21049 mfp.updateStatus('ready'); 21050 } 21051 return template; 21052 } 21053 21054 mfp.updateStatus('loading'); 21055 item.loading = true; 21056 21057 if(!item.hasSize) { 21058 item.imgHidden = true; 21059 template.addClass('mfp-loading'); 21060 mfp.findImageSize(item); 21061 } 21062 21063 return template; 21064 } 21065 } 21066}); 21067 21068/*>>image*/ 21069 21070/*>>zoom*/ 21071var hasMozTransform, 21072 getHasMozTransform = function() { 21073 if(hasMozTransform === undefined) { 21074 hasMozTransform = document.createElement('p').style.MozTransform !== undefined; 21075 } 21076 return hasMozTransform; 21077 }; 21078 21079$.magnificPopup.registerModule('zoom', { 21080 21081 options: { 21082 enabled: false, 21083 easing: 'ease-in-out', 21084 duration: 300, 21085 opener: function(element) { 21086 return element.is('img') ? element : element.find('img'); 21087 } 21088 }, 21089 21090 proto: { 21091 21092 initZoom: function() { 21093 var zoomSt = mfp.st.zoom, 21094 ns = '.zoom', 21095 image; 21096 21097 if(!zoomSt.enabled || !mfp.supportsTransition) { 21098 return; 21099 } 21100 21101 var duration = zoomSt.duration, 21102 getElToAnimate = function(image) { 21103 var newImg = image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'), 21104 transition = 'all '+(zoomSt.duration/1000)+'s ' + zoomSt.easing, 21105 cssObj = { 21106 position: 'fixed', 21107 zIndex: 9999, 21108 left: 0, 21109 top: 0, 21110 '-webkit-backface-visibility': 'hidden' 21111 }, 21112 t = 'transition'; 21113 21114 cssObj['-webkit-'+t] = cssObj['-moz-'+t] = cssObj['-o-'+t] = cssObj[t] = transition; 21115 21116 newImg.css(cssObj); 21117 return newImg; 21118 }, 21119 showMainContent = function() { 21120 mfp.content.css('visibility', 'visible'); 21121 }, 21122 openTimeout, 21123 animatedImg; 21124 21125 _mfpOn('BuildControls'+ns, function() { 21126 if(mfp._allowZoom()) { 21127 21128 clearTimeout(openTimeout); 21129 mfp.content.css('visibility', 'hidden'); 21130 21131 // Basically, all code below does is clones existing image, puts in on top of the current one and animated it 21132 21133 image = mfp._getItemToZoom(); 21134 21135 if(!image) { 21136 showMainContent(); 21137 return; 21138 } 21139 21140 animatedImg = getElToAnimate(image); 21141 21142 animatedImg.css( mfp._getOffset() ); 21143 21144 mfp.wrap.append(animatedImg); 21145 21146 openTimeout = setTimeout(function() { 21147 animatedImg.css( mfp._getOffset( true ) ); 21148 openTimeout = setTimeout(function() { 21149 21150 showMainContent(); 21151 21152 setTimeout(function() { 21153 animatedImg.remove(); 21154 image = animatedImg = null; 21155 _mfpTrigger('ZoomAnimationEnded'); 21156 }, 16); // avoid blink when switching images 21157 21158 }, duration); // this timeout equals animation duration 21159 21160 }, 16); // by adding this timeout we avoid short glitch at the beginning of animation 21161 21162 21163 // Lots of timeouts... 21164 } 21165 }); 21166 _mfpOn(BEFORE_CLOSE_EVENT+ns, function() { 21167 if(mfp._allowZoom()) { 21168 21169 clearTimeout(openTimeout); 21170 21171 mfp.st.removalDelay = duration; 21172 21173 if(!image) { 21174 image = mfp._getItemToZoom(); 21175 if(!image) { 21176 return; 21177 } 21178 animatedImg = getElToAnimate(image); 21179 } 21180 21181 animatedImg.css( mfp._getOffset(true) ); 21182 mfp.wrap.append(animatedImg); 21183 mfp.content.css('visibility', 'hidden'); 21184 21185 setTimeout(function() { 21186 animatedImg.css( mfp._getOffset() ); 21187 }, 16); 21188 } 21189 21190 }); 21191 21192 _mfpOn(CLOSE_EVENT+ns, function() { 21193 if(mfp._allowZoom()) { 21194 showMainContent(); 21195 if(animatedImg) { 21196 animatedImg.remove(); 21197 } 21198 image = null; 21199 } 21200 }); 21201 }, 21202 21203 _allowZoom: function() { 21204 return mfp.currItem.type === 'image'; 21205 }, 21206 21207 _getItemToZoom: function() { 21208 if(mfp.currItem.hasSize) { 21209 return mfp.currItem.img; 21210 } else { 21211 return false; 21212 } 21213 }, 21214 21215 // Get element postion relative to viewport 21216 _getOffset: function(isLarge) { 21217 var el; 21218 if(isLarge) { 21219 el = mfp.currItem.img; 21220 } else { 21221 el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem); 21222 } 21223 21224 var offset = el.offset(); 21225 var paddingTop = parseInt(el.css('padding-top'),10); 21226 var paddingBottom = parseInt(el.css('padding-bottom'),10); 21227 offset.top -= ( $(window).scrollTop() - paddingTop ); 21228 21229 21230 /* 21231 21232 Animating left + top + width/height looks glitchy in Firefox, but perfect in Chrome. And vice-versa. 21233 21234 */ 21235 var obj = { 21236 width: el.width(), 21237 // fix Zepto height+padding issue 21238 height: (_isJQ ? el.innerHeight() : el[0].offsetHeight) - paddingBottom - paddingTop 21239 }; 21240 21241 // I hate to do this, but there is no another option 21242 if( getHasMozTransform() ) { 21243 obj['-moz-transform'] = obj['transform'] = 'translate(' + offset.left + 'px,' + offset.top + 'px)'; 21244 } else { 21245 obj.left = offset.left; 21246 obj.top = offset.top; 21247 } 21248 return obj; 21249 } 21250 21251 } 21252}); 21253 21254 21255 21256/*>>zoom*/ 21257 21258/*>>iframe*/ 21259 21260var IFRAME_NS = 'iframe', 21261 _emptyPage = '//about:blank', 21262 21263 _fixIframeBugs = function(isShowing) { 21264 if(mfp.currTemplate[IFRAME_NS]) { 21265 var el = mfp.currTemplate[IFRAME_NS].find('iframe'); 21266 if(el.length) { 21267 // reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug 21268 if(!isShowing) { 21269 el[0].src = _emptyPage; 21270 } 21271 21272 // IE8 black screen bug fix 21273 if(mfp.isIE8) { 21274 el.css('display', isShowing ? 'block' : 'none'); 21275 } 21276 } 21277 } 21278 }; 21279 21280$.magnificPopup.registerModule(IFRAME_NS, { 21281 21282 options: { 21283 markup: '<div class="mfp-iframe-scaler">'+ 21284 '<div class="mfp-close"></div>'+ 21285 '<iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe>'+ 21286 '</div>', 21287 21288 srcAction: 'iframe_src', 21289 21290 // we don't care and support only one default type of URL by default 21291 patterns: { 21292 youtube: { 21293 index: 'youtube.com', 21294 id: 'v=', 21295 src: '//www.youtube.com/embed/%id%?autoplay=1' 21296 }, 21297 vimeo: { 21298 index: 'vimeo.com/', 21299 id: '/', 21300 src: '//player.vimeo.com/video/%id%?autoplay=1' 21301 }, 21302 gmaps: { 21303 index: '//maps.google.', 21304 src: '%id%&output=embed' 21305 } 21306 } 21307 }, 21308 21309 proto: { 21310 initIframe: function() { 21311 mfp.types.push(IFRAME_NS); 21312 21313 _mfpOn('BeforeChange', function(e, prevType, newType) { 21314 if(prevType !== newType) { 21315 if(prevType === IFRAME_NS) { 21316 _fixIframeBugs(); // iframe if removed 21317 } else if(newType === IFRAME_NS) { 21318 _fixIframeBugs(true); // iframe is showing 21319 } 21320 }// else { 21321 // iframe source is switched, don't do anything 21322 //} 21323 }); 21324 21325 _mfpOn(CLOSE_EVENT + '.' + IFRAME_NS, function() { 21326 _fixIframeBugs(); 21327 }); 21328 }, 21329 21330 getIframe: function(item, template) { 21331 var embedSrc = item.src; 21332 var iframeSt = mfp.st.iframe; 21333 21334 $.each(iframeSt.patterns, function() { 21335 if(embedSrc.indexOf( this.index ) > -1) { 21336 if(this.id) { 21337 if(typeof this.id === 'string') { 21338 embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length, embedSrc.length); 21339 } else { 21340 embedSrc = this.id.call( this, embedSrc ); 21341 } 21342 } 21343 embedSrc = this.src.replace('%id%', embedSrc ); 21344 return false; // break; 21345 } 21346 }); 21347 21348 var dataObj = {}; 21349 if(iframeSt.srcAction) { 21350 dataObj[iframeSt.srcAction] = embedSrc; 21351 } 21352 mfp._parseMarkup(template, dataObj, item); 21353 21354 mfp.updateStatus('ready'); 21355 21356 return template; 21357 } 21358 } 21359}); 21360 21361 21362 21363/*>>iframe*/ 21364 21365/*>>gallery*/ 21366/** 21367 * Get looped index depending on number of slides 21368 */ 21369var _getLoopedId = function(index) { 21370 var numSlides = mfp.items.length; 21371 if(index > numSlides - 1) { 21372 return index - numSlides; 21373 } else if(index < 0) { 21374 return numSlides + index; 21375 } 21376 return index; 21377 }, 21378 _replaceCurrTotal = function(text, curr, total) { 21379 return text.replace(/%curr%/gi, curr + 1).replace(/%total%/gi, total); 21380 }; 21381 21382$.magnificPopup.registerModule('gallery', { 21383 21384 options: { 21385 enabled: false, 21386 arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', 21387 preload: [0,2], 21388 navigateByImgClick: true, 21389 arrows: true, 21390 21391 tPrev: 'Previous (Left arrow key)', 21392 tNext: 'Next (Right arrow key)', 21393 tCounter: '%curr% of %total%' 21394 }, 21395 21396 proto: { 21397 initGallery: function() { 21398 21399 var gSt = mfp.st.gallery, 21400 ns = '.mfp-gallery'; 21401 21402 mfp.direction = true; // true - next, false - prev 21403 21404 if(!gSt || !gSt.enabled ) return false; 21405 21406 _wrapClasses += ' mfp-gallery'; 21407 21408 _mfpOn(OPEN_EVENT+ns, function() { 21409 21410 if(gSt.navigateByImgClick) { 21411 mfp.wrap.on('click'+ns, '.mfp-img', function() { 21412 if(mfp.items.length > 1) { 21413 mfp.next(); 21414 return false; 21415 } 21416 }); 21417 } 21418 21419 _document.on('keydown'+ns, function(e) { 21420 if (e.keyCode === 37) { 21421 mfp.prev(); 21422 } else if (e.keyCode === 39) { 21423 mfp.next(); 21424 } 21425 }); 21426 }); 21427 21428 _mfpOn('UpdateStatus'+ns, function(e, data) { 21429 if(data.text) { 21430 data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length); 21431 } 21432 }); 21433 21434 _mfpOn(MARKUP_PARSE_EVENT+ns, function(e, element, values, item) { 21435 var l = mfp.items.length; 21436 values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : ''; 21437 }); 21438 21439 _mfpOn('BuildControls' + ns, function() { 21440 if(mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) { 21441 var markup = gSt.arrowMarkup, 21442 arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS), 21443 arrowRight = mfp.arrowRight = $( markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right') ).addClass(PREVENT_CLOSE_CLASS); 21444 21445 arrowLeft.click(function() { 21446 mfp.prev(); 21447 }); 21448 arrowRight.click(function() { 21449 mfp.next(); 21450 }); 21451 21452 mfp.container.append(arrowLeft.add(arrowRight)); 21453 } 21454 }); 21455 21456 _mfpOn(CHANGE_EVENT+ns, function() { 21457 if(mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout); 21458 21459 mfp._preloadTimeout = setTimeout(function() { 21460 mfp.preloadNearbyImages(); 21461 mfp._preloadTimeout = null; 21462 }, 16); 21463 }); 21464 21465 21466 _mfpOn(CLOSE_EVENT+ns, function() { 21467 _document.off(ns); 21468 mfp.wrap.off('click'+ns); 21469 mfp.arrowRight = mfp.arrowLeft = null; 21470 }); 21471 21472 }, 21473 next: function() { 21474 mfp.direction = true; 21475 mfp.index = _getLoopedId(mfp.index + 1); 21476 mfp.updateItemHTML(); 21477 }, 21478 prev: function() { 21479 mfp.direction = false; 21480 mfp.index = _getLoopedId(mfp.index - 1); 21481 mfp.updateItemHTML(); 21482 }, 21483 goTo: function(newIndex) { 21484 mfp.direction = (newIndex >= mfp.index); 21485 mfp.index = newIndex; 21486 mfp.updateItemHTML(); 21487 }, 21488 preloadNearbyImages: function() { 21489 var p = mfp.st.gallery.preload, 21490 preloadBefore = Math.min(p[0], mfp.items.length), 21491 preloadAfter = Math.min(p[1], mfp.items.length), 21492 i; 21493 21494 for(i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) { 21495 mfp._preloadItem(mfp.index+i); 21496 } 21497 for(i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) { 21498 mfp._preloadItem(mfp.index-i); 21499 } 21500 }, 21501 _preloadItem: function(index) { 21502 index = _getLoopedId(index); 21503 21504 if(mfp.items[index].preloaded) { 21505 return; 21506 } 21507 21508 var item = mfp.items[index]; 21509 if(!item.parsed) { 21510 item = mfp.parseEl( index ); 21511 } 21512 21513 _mfpTrigger('LazyLoad', item); 21514 21515 if(item.type === 'image') { 21516 item.img = $('<img class="mfp-img" />').on('load.mfploader', function() { 21517 item.hasSize = true; 21518 }).on('error.mfploader', function() { 21519 item.hasSize = true; 21520 item.loadError = true; 21521 _mfpTrigger('LazyLoadError', item); 21522 }).attr('src', item.src); 21523 } 21524 21525 21526 item.preloaded = true; 21527 } 21528 } 21529}); 21530 21531/*>>gallery*/ 21532 21533/*>>retina*/ 21534 21535var RETINA_NS = 'retina'; 21536 21537$.magnificPopup.registerModule(RETINA_NS, { 21538 options: { 21539 replaceSrc: function(item) { 21540 return item.src.replace(/\.\w+$/, function(m) { return '@2x' + m; }); 21541 }, 21542 ratio: 1 // Function or number. Set to 1 to disable. 21543 }, 21544 proto: { 21545 initRetina: function() { 21546 if(window.devicePixelRatio > 1) { 21547 21548 var st = mfp.st.retina, 21549 ratio = st.ratio; 21550 21551 ratio = !isNaN(ratio) ? ratio : ratio(); 21552 21553 if(ratio > 1) { 21554 _mfpOn('ImageHasSize' + '.' + RETINA_NS, function(e, item) { 21555 item.img.css({ 21556 'max-width': item.img[0].naturalWidth / ratio, 21557 'width': '100%' 21558 }); 21559 }); 21560 _mfpOn('ElementParse' + '.' + RETINA_NS, function(e, item) { 21561 item.src = st.replaceSrc(item, ratio); 21562 }); 21563 } 21564 } 21565 21566 } 21567 } 21568}); 21569 21570/*>>retina*/ 21571 _checkInstance(); })); 21572 21573/***/ }), 21574
vendor: 975 bytes, lines 21575-21597
21575/***/ "../node_modules/tiny-slider/src/helpers/addCSSRule.js": 21576/*!*************************************************************!*\ 21577 !*** ../node_modules/tiny-slider/src/helpers/addCSSRule.js ***! 21578 \*************************************************************/ 21579/*! exports provided: addCSSRule */ 21580/***/ (function(module, __webpack_exports__, __webpack_require__) { 21581 21582"use strict"; 21583__webpack_require__.r(__webpack_exports__); 21584/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addCSSRule", function() { return addCSSRule; }); 21585/* harmony import */ var _raf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./raf.js */ "../node_modules/tiny-slider/src/helpers/raf.js"); 21586// cross browsers addRule method 21587 21588function addCSSRule(sheet, selector, rules, index) { 21589 // return raf(function() { 21590 'insertRule' in sheet ? 21591 sheet.insertRule(selector + '{' + rules + '}', index) : 21592 sheet.addRule(selector, rules, index); 21593 // }); 21594} 21595 21596/***/ }), 21597
vendor: 1,087 bytes, lines 21598-21621
21598/***/ "../node_modules/tiny-slider/src/helpers/addClass.js": 21599/*!***********************************************************!*\ 21600 !*** ../node_modules/tiny-slider/src/helpers/addClass.js ***! 21601 \***********************************************************/ 21602/*! exports provided: addClass */ 21603/***/ (function(module, __webpack_exports__, __webpack_require__) { 21604 21605"use strict"; 21606__webpack_require__.r(__webpack_exports__); 21607/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addClass", function() { return addClass; }); 21608/* harmony import */ var _hasClass_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hasClass.js */ "../node_modules/tiny-slider/src/helpers/hasClass.js"); 21609 21610var addClass = _hasClass_js__WEBPACK_IMPORTED_MODULE_0__["classListSupport"] ? 21611 function (el, str) { 21612 if (!Object(_hasClass_js__WEBPACK_IMPORTED_MODULE_0__["hasClass"])(el, str)) { el.classList.add(str); } 21613 } : 21614 function (el, str) { 21615 if (!Object(_hasClass_js__WEBPACK_IMPORTED_MODULE_0__["hasClass"])(el, str)) { el.className += ' ' + str; } 21616 }; 21617 21618 21619 21620/***/ }), 21621
vendor: 1,028 bytes, lines 21622-21643
21622/***/ "../node_modules/tiny-slider/src/helpers/addEvents.js": 21623/*!************************************************************!*\ 21624 !*** ../node_modules/tiny-slider/src/helpers/addEvents.js ***! 21625 \************************************************************/ 21626/*! exports provided: addEvents */ 21627/***/ (function(module, __webpack_exports__, __webpack_require__) { 21628 21629"use strict"; 21630__webpack_require__.r(__webpack_exports__); 21631/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addEvents", function() { return addEvents; }); 21632/* harmony import */ var _passiveOption_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./passiveOption.js */ "../node_modules/tiny-slider/src/helpers/passiveOption.js"); 21633 21634 21635function addEvents(el, obj, preventScrolling) { 21636 for (var prop in obj) { 21637 var option = ['touchstart', 'touchmove'].indexOf(prop) >= 0 && !preventScrolling ? _passiveOption_js__WEBPACK_IMPORTED_MODULE_0__["passiveOption"] : false; 21638 el.addEventListener(prop, obj[prop], option); 21639 } 21640} 21641 21642/***/ }), 21643
vendor: 749 bytes, lines 21644-21663
21644/***/ "../node_modules/tiny-slider/src/helpers/arrayFromNodeList.js": 21645/*!********************************************************************!*\ 21646 !*** ../node_modules/tiny-slider/src/helpers/arrayFromNodeList.js ***! 21647 \********************************************************************/ 21648/*! exports provided: arrayFromNodeList */ 21649/***/ (function(module, __webpack_exports__, __webpack_require__) { 21650 21651"use strict"; 21652__webpack_require__.r(__webpack_exports__); 21653/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "arrayFromNodeList", function() { return arrayFromNodeList; }); 21654function arrayFromNodeList (nl) { 21655 var arr = []; 21656 for (var i = 0, l = nl.length; i < l; i++) { 21657 arr.push(nl[i]); 21658 } 21659 return arr; 21660} 21661 21662/***/ }), 21663
vendor: 641 bytes, lines 21664-21682
21664/***/ "../node_modules/tiny-slider/src/helpers/caf.js": 21665/*!******************************************************!*\ 21666 !*** ../node_modules/tiny-slider/src/helpers/caf.js ***! 21667 \******************************************************/ 21668/*! exports provided: caf */ 21669/***/ (function(module, __webpack_exports__, __webpack_require__) { 21670 21671"use strict"; 21672__webpack_require__.r(__webpack_exports__); 21673/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "caf", function() { return caf; }); 21674var win = window; 21675 21676var caf = win.cancelAnimationFrame 21677 || win.mozCancelAnimationFrame 21678 || function(id){ clearTimeout(id); }; 21679 21680 21681/***/ }), 21682
vendor: 1,921 bytes, lines 21683-21731
21683/***/ "../node_modules/tiny-slider/src/helpers/calc.js": 21684/*!*******************************************************!*\ 21685 !*** ../node_modules/tiny-slider/src/helpers/calc.js ***! 21686 \*******************************************************/ 21687/*! exports provided: calc */ 21688/***/ (function(module, __webpack_exports__, __webpack_require__) { 21689 21690"use strict"; 21691__webpack_require__.r(__webpack_exports__); 21692/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "calc", function() { return calc; }); 21693/* harmony import */ var _getBody_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getBody.js */ "../node_modules/tiny-slider/src/helpers/getBody.js"); 21694/* harmony import */ var _setFakeBody_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setFakeBody.js */ "../node_modules/tiny-slider/src/helpers/setFakeBody.js"); 21695/* harmony import */ var _resetFakeBody_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./resetFakeBody.js */ "../node_modules/tiny-slider/src/helpers/resetFakeBody.js"); 21696// get css-calc 21697// @return - false | calc | -webkit-calc | -moz-calc 21698// @usage - var calc = getCalc(); 21699 21700 21701 21702 21703function calc() { 21704 var doc = document, 21705 body = Object(_getBody_js__WEBPACK_IMPORTED_MODULE_0__["getBody"])(), 21706 docOverflow = Object(_setFakeBody_js__WEBPACK_IMPORTED_MODULE_1__["setFakeBody"])(body), 21707 div = doc.createElement('div'), 21708 result = false; 21709 21710 body.appendChild(div); 21711 try { 21712 var str = '(10px * 10)', 21713 vals = ['calc' + str, '-moz-calc' + str, '-webkit-calc' + str], 21714 val; 21715 for (var i = 0; i < 3; i++) { 21716 val = vals[i]; 21717 div.style.width = val; 21718 if (div.offsetWidth === 100) { 21719 result = val.replace(str, ''); 21720 break; 21721 } 21722 } 21723 } catch (e) {} 21724 21725 body.fake ? Object(_resetFakeBody_js__WEBPACK_IMPORTED_MODULE_2__["resetFakeBody"])(body, docOverflow) : div.remove(); 21726 21727 return result; 21728} 21729 21730/***/ }), 21731
vendor: 726 bytes, lines 21732-21747
21732/***/ "../node_modules/tiny-slider/src/helpers/checkStorageValue.js": 21733/*!********************************************************************!*\ 21734 !*** ../node_modules/tiny-slider/src/helpers/checkStorageValue.js ***! 21735 \********************************************************************/ 21736/*! exports provided: checkStorageValue */ 21737/***/ (function(module, __webpack_exports__, __webpack_require__) { 21738 21739"use strict"; 21740__webpack_require__.r(__webpack_exports__); 21741/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "checkStorageValue", function() { return checkStorageValue; }); 21742function checkStorageValue (value) { 21743 return ['true', 'false'].indexOf(value) >= 0 ? JSON.parse(value) : value; 21744} 21745 21746/***/ }), 21747
vendor: 671 bytes, lines 21748-21761
21748/***/ "../node_modules/tiny-slider/src/helpers/classListSupport.js": 21749/*!*******************************************************************!*\ 21750 !*** ../node_modules/tiny-slider/src/helpers/classListSupport.js ***! 21751 \*******************************************************************/ 21752/*! exports provided: classListSupport */ 21753/***/ (function(module, __webpack_exports__, __webpack_require__) { 21754 21755"use strict"; 21756__webpack_require__.r(__webpack_exports__); 21757/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "classListSupport", function() { return classListSupport; }); 21758var classListSupport = 'classList' in document.createElement('_'); 21759 21760/***/ }), 21761
vendor: 1,363 bytes, lines 21762-21796
21762/***/ "../node_modules/tiny-slider/src/helpers/createStyleSheet.js": 21763/*!*******************************************************************!*\ 21764 !*** ../node_modules/tiny-slider/src/helpers/createStyleSheet.js ***! 21765 \*******************************************************************/ 21766/*! exports provided: createStyleSheet */ 21767/***/ (function(module, __webpack_exports__, __webpack_require__) { 21768 21769"use strict"; 21770__webpack_require__.r(__webpack_exports__); 21771/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createStyleSheet", function() { return createStyleSheet; }); 21772// create and append style sheet 21773function createStyleSheet (media, nonce) { 21774 // Create the <style> tag 21775 var style = document.createElement("style"); 21776 // style.setAttribute("type", "text/css"); 21777 21778 // Add a media (and/or media query) here if you'd like! 21779 // style.setAttribute("media", "screen") 21780 // style.setAttribute("media", "only screen and (max-width : 1024px)") 21781 if (media) { style.setAttribute("media", media); } 21782 21783 // Add nonce attribute for Content Security Policy 21784 if (nonce) { style.setAttribute("nonce", nonce); } 21785 21786 // WebKit hack :( 21787 // style.appendChild(document.createTextNode("")); 21788 21789 // Add the <style> element to the page 21790 document.querySelector('head').appendChild(style); 21791 21792 return style.sheet ? style.sheet : style.styleSheet; 21793}; 21794 21795/***/ }), 21796
vendor: 605 bytes, lines 21797-21810
21797/***/ "../node_modules/tiny-slider/src/helpers/docElement.js": 21798/*!*************************************************************!*\ 21799 !*** ../node_modules/tiny-slider/src/helpers/docElement.js ***! 21800 \*************************************************************/ 21801/*! exports provided: docElement */ 21802/***/ (function(module, __webpack_exports__, __webpack_require__) { 21803 21804"use strict"; 21805__webpack_require__.r(__webpack_exports__); 21806/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "docElement", function() { return docElement; }); 21807var docElement = document.documentElement; 21808 21809/***/ }), 21810
vendor: 1,238 bytes, lines 21811-21850
21811/***/ "../node_modules/tiny-slider/src/helpers/events.js": 21812/*!*********************************************************!*\ 21813 !*** ../node_modules/tiny-slider/src/helpers/events.js ***! 21814 \*********************************************************/ 21815/*! exports provided: Events */ 21816/***/ (function(module, __webpack_exports__, __webpack_require__) { 21817 21818"use strict"; 21819__webpack_require__.r(__webpack_exports__); 21820/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Events", function() { return Events; }); 21821function Events() { 21822 return { 21823 topics: {}, 21824 on: function (eventName, fn) { 21825 this.topics[eventName] = this.topics[eventName] || []; 21826 this.topics[eventName].push(fn); 21827 }, 21828 off: function(eventName, fn) { 21829 if (this.topics[eventName]) { 21830 for (var i = 0; i < this.topics[eventName].length; i++) { 21831 if (this.topics[eventName][i] === fn) { 21832 this.topics[eventName].splice(i, 1); 21833 break; 21834 } 21835 } 21836 } 21837 }, 21838 emit: function (eventName, data) { 21839 data.type = eventName; 21840 if (this.topics[eventName]) { 21841 this.topics[eventName].forEach(function(fn) { 21842 fn(data, eventName); 21843 }); 21844 } 21845 } 21846 }; 21847}; 21848 21849/***/ }), 21850
vendor: 951 bytes, lines 21851-21884
21851/***/ "../node_modules/tiny-slider/src/helpers/extend.js": 21852/*!*********************************************************!*\ 21853 !*** ../node_modules/tiny-slider/src/helpers/extend.js ***! 21854 \*********************************************************/ 21855/*! exports provided: extend */ 21856/***/ (function(module, __webpack_exports__, __webpack_require__) { 21857 21858"use strict"; 21859__webpack_require__.r(__webpack_exports__); 21860/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return extend; }); 21861function extend() { 21862 var obj, name, copy, 21863 target = arguments[0] || {}, 21864 i = 1, 21865 length = arguments.length; 21866 21867 for (; i < length; i++) { 21868 if ((obj = arguments[i]) !== null) { 21869 for (name in obj) { 21870 copy = obj[name]; 21871 21872 if (target === copy) { 21873 continue; 21874 } else if (copy !== undefined) { 21875 target[name] = copy; 21876 } 21877 } 21878 } 21879 } 21880 return target; 21881} 21882 21883/***/ }), 21884
vendor: 743 bytes, lines 21885-21903
21885/***/ "../node_modules/tiny-slider/src/helpers/forEach.js": 21886/*!**********************************************************!*\ 21887 !*** ../node_modules/tiny-slider/src/helpers/forEach.js ***! 21888 \**********************************************************/ 21889/*! exports provided: forEach */ 21890/***/ (function(module, __webpack_exports__, __webpack_require__) { 21891 21892"use strict"; 21893__webpack_require__.r(__webpack_exports__); 21894/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return forEach; }); 21895// https://toddmotto.com/ditch-the-array-foreach-call-nodelist-hack/ 21896function forEach (arr, callback, scope) { 21897 for (var i = 0, l = arr.length; i < l; i++) { 21898 callback.call(scope, arr[i], i); 21899 } 21900} 21901 21902/***/ }), 21903
vendor: 604 bytes, lines 21904-21919
21904/***/ "../node_modules/tiny-slider/src/helpers/getAttr.js": 21905/*!**********************************************************!*\ 21906 !*** ../node_modules/tiny-slider/src/helpers/getAttr.js ***! 21907 \**********************************************************/ 21908/*! exports provided: getAttr */ 21909/***/ (function(module, __webpack_exports__, __webpack_require__) { 21910 21911"use strict"; 21912__webpack_require__.r(__webpack_exports__); 21913/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAttr", function() { return getAttr; }); 21914function getAttr(el, attr) { 21915 return el.getAttribute(attr); 21916} 21917 21918/***/ }), 21919
vendor: 706 bytes, lines 21920-21943
21920/***/ "../node_modules/tiny-slider/src/helpers/getBody.js": 21921/*!**********************************************************!*\ 21922 !*** ../node_modules/tiny-slider/src/helpers/getBody.js ***! 21923 \**********************************************************/ 21924/*! exports provided: getBody */ 21925/***/ (function(module, __webpack_exports__, __webpack_require__) { 21926 21927"use strict"; 21928__webpack_require__.r(__webpack_exports__); 21929/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getBody", function() { return getBody; }); 21930function getBody () { 21931 var doc = document, 21932 body = doc.body; 21933 21934 if (!body) { 21935 body = doc.createElement('body'); 21936 body.fake = true; 21937 } 21938 21939 return body; 21940} 21941 21942/***/ }), 21943
vendor: 740 bytes, lines 21944-21960
21944/***/ "../node_modules/tiny-slider/src/helpers/getCssRulesLength.js": 21945/*!********************************************************************!*\ 21946 !*** ../node_modules/tiny-slider/src/helpers/getCssRulesLength.js ***! 21947 \********************************************************************/ 21948/*! exports provided: getCssRulesLength */ 21949/***/ (function(module, __webpack_exports__, __webpack_require__) { 21950 21951"use strict"; 21952__webpack_require__.r(__webpack_exports__); 21953/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCssRulesLength", function() { return getCssRulesLength; }); 21954function getCssRulesLength(sheet) { 21955 var rule = ('insertRule' in sheet) ? sheet.cssRules : sheet.rules; 21956 return rule.length; 21957} 21958 21959/***/ }), 21960
vendor: 1,109 bytes, lines 21961-21988
21961/***/ "../node_modules/tiny-slider/src/helpers/getEndProperty.js": 21962/*!*****************************************************************!*\ 21963 !*** ../node_modules/tiny-slider/src/helpers/getEndProperty.js ***! 21964 \*****************************************************************/ 21965/*! exports provided: getEndProperty */ 21966/***/ (function(module, __webpack_exports__, __webpack_require__) { 21967 21968"use strict"; 21969__webpack_require__.r(__webpack_exports__); 21970/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getEndProperty", function() { return getEndProperty; }); 21971// get transitionend, animationend based on transitionDuration 21972// @propin: string 21973// @propOut: string, first-letter uppercase 21974// Usage: getEndProperty('WebkitTransitionDuration', 'Transition') => webkitTransitionEnd 21975function getEndProperty(propIn, propOut) { 21976 var endProp = false; 21977 if (/^Webkit/.test(propIn)) { 21978 endProp = 'webkit' + propOut + 'End'; 21979 } else if (/^O/.test(propIn)) { 21980 endProp = 'o' + propOut + 'End'; 21981 } else if (propIn) { 21982 endProp = propOut.toLowerCase() + 'end'; 21983 } 21984 return endProp; 21985} 21986 21987/***/ }), 21988
vendor: 682 bytes, lines 21989-22007
21989/***/ "../node_modules/tiny-slider/src/helpers/getSlideId.js": 21990/*!*************************************************************!*\ 21991 !*** ../node_modules/tiny-slider/src/helpers/getSlideId.js ***! 21992 \*************************************************************/ 21993/*! exports provided: getSlideId */ 21994/***/ (function(module, __webpack_exports__, __webpack_require__) { 21995 21996"use strict"; 21997__webpack_require__.r(__webpack_exports__); 21998/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSlideId", function() { return getSlideId; }); 21999function getSlideId() { 22000 var id = window.tnsId; 22001 window.tnsId = !id ? 1 : id + 1; 22002 22003 return 'tns' + window.tnsId; 22004} 22005 22006/***/ }), 22007
vendor: 871 bytes, lines 22008-22032
22008/***/ "../node_modules/tiny-slider/src/helpers/getTouchDirection.js": 22009/*!********************************************************************!*\ 22010 !*** ../node_modules/tiny-slider/src/helpers/getTouchDirection.js ***! 22011 \********************************************************************/ 22012/*! exports provided: getTouchDirection */ 22013/***/ (function(module, __webpack_exports__, __webpack_require__) { 22014 22015"use strict"; 22016__webpack_require__.r(__webpack_exports__); 22017/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTouchDirection", function() { return getTouchDirection; }); 22018function getTouchDirection(angle, range) { 22019 var direction = false, 22020 gap = Math.abs(90 - Math.abs(angle)); 22021 22022 if (gap >= 90 - range) { 22023 direction = 'horizontal'; 22024 } else if (gap <= range) { 22025 direction = 'vertical'; 22026 } 22027 22028 return direction; 22029} 22030 22031/***/ }), 22032
vendor: 1,964 bytes, lines 22033-22076
22033/***/ "../node_modules/tiny-slider/src/helpers/has3DTransforms.js": 22034/*!******************************************************************!*\ 22035 !*** ../node_modules/tiny-slider/src/helpers/has3DTransforms.js ***! 22036 \******************************************************************/ 22037/*! exports provided: has3DTransforms */ 22038/***/ (function(module, __webpack_exports__, __webpack_require__) { 22039 22040"use strict"; 22041__webpack_require__.r(__webpack_exports__); 22042/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "has3DTransforms", function() { return has3DTransforms; }); 22043/* harmony import */ var _getBody_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getBody.js */ "../node_modules/tiny-slider/src/helpers/getBody.js"); 22044/* harmony import */ var _setFakeBody_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setFakeBody.js */ "../node_modules/tiny-slider/src/helpers/setFakeBody.js"); 22045/* harmony import */ var _resetFakeBody_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./resetFakeBody.js */ "../node_modules/tiny-slider/src/helpers/resetFakeBody.js"); 22046 22047 22048 22049 22050function has3DTransforms(tf){ 22051 if (!tf) { return false; } 22052 if (!window.getComputedStyle) { return false; } 22053 22054 var doc = document, 22055 body = Object(_getBody_js__WEBPACK_IMPORTED_MODULE_0__["getBody"])(), 22056 docOverflow = Object(_setFakeBody_js__WEBPACK_IMPORTED_MODULE_1__["setFakeBody"])(body), 22057 el = doc.createElement('p'), 22058 has3d, 22059 cssTF = tf.length > 9 ? '-' + tf.slice(0, -9).toLowerCase() + '-' : ''; 22060 22061 cssTF += 'transform'; 22062 22063 // Add it to the body to get the computed style 22064 body.insertBefore(el, null); 22065 22066 el.style[tf] = 'translate3d(1px,1px,1px)'; 22067 has3d = window.getComputedStyle(el).getPropertyValue(cssTF); 22068 22069 body.fake ? Object(_resetFakeBody_js__WEBPACK_IMPORTED_MODULE_2__["resetFakeBody"])(body, docOverflow) : el.remove(); 22070 22071 return (has3d !== undefined && has3d.length > 0 && has3d !== "none"); 22072} 22073 22074 22075/***/ }), 22076
vendor: 604 bytes, lines 22077-22092
22077/***/ "../node_modules/tiny-slider/src/helpers/hasAttr.js": 22078/*!**********************************************************!*\ 22079 !*** ../node_modules/tiny-slider/src/helpers/hasAttr.js ***! 22080 \**********************************************************/ 22081/*! exports provided: hasAttr */ 22082/***/ (function(module, __webpack_exports__, __webpack_require__) { 22083 22084"use strict"; 22085__webpack_require__.r(__webpack_exports__); 22086/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasAttr", function() { return hasAttr; }); 22087function hasAttr(el, attr) { 22088 return el.hasAttribute(attr); 22089} 22090 22091/***/ }), 22092
vendor: 1,167 bytes, lines 22093-22115
22093/***/ "../node_modules/tiny-slider/src/helpers/hasClass.js": 22094/*!***********************************************************!*\ 22095 !*** ../node_modules/tiny-slider/src/helpers/hasClass.js ***! 22096 \***********************************************************/ 22097/*! exports provided: classListSupport, hasClass */ 22098/***/ (function(module, __webpack_exports__, __webpack_require__) { 22099 22100"use strict"; 22101__webpack_require__.r(__webpack_exports__); 22102/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasClass", function() { return hasClass; }); 22103/* harmony import */ var _classListSupport_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./classListSupport.js */ "../node_modules/tiny-slider/src/helpers/classListSupport.js"); 22104/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "classListSupport", function() { return _classListSupport_js__WEBPACK_IMPORTED_MODULE_0__["classListSupport"]; }); 22105 22106 22107 22108var hasClass = _classListSupport_js__WEBPACK_IMPORTED_MODULE_0__["classListSupport"] ? 22109 function (el, str) { return el.classList.contains(str); } : 22110 function (el, str) { return el.className.indexOf(str) >= 0; }; 22111 22112 22113 22114/***/ }), 22115
vendor: 675 bytes, lines 22116-22131
22116/***/ "../node_modules/tiny-slider/src/helpers/hideElement.js": 22117/*!**************************************************************!*\ 22118 !*** ../node_modules/tiny-slider/src/helpers/hideElement.js ***! 22119 \**************************************************************/ 22120/*! exports provided: hideElement */ 22121/***/ (function(module, __webpack_exports__, __webpack_require__) { 22122 22123"use strict"; 22124__webpack_require__.r(__webpack_exports__); 22125/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hideElement", function() { return hideElement; }); 22126function hideElement(el, forceHide) { 22127 if (el.style.display !== 'none') { el.style.display = 'none'; } 22128} 22129 22130/***/ }), 22131
vendor: 677 bytes, lines 22132-22148
22132/***/ "../node_modules/tiny-slider/src/helpers/isNodeList.js": 22133/*!*************************************************************!*\ 22134 !*** ../node_modules/tiny-slider/src/helpers/isNodeList.js ***! 22135 \*************************************************************/ 22136/*! exports provided: isNodeList */ 22137/***/ (function(module, __webpack_exports__, __webpack_require__) { 22138 22139"use strict"; 22140__webpack_require__.r(__webpack_exports__); 22141/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNodeList", function() { return isNodeList; }); 22142function isNodeList(el) { 22143 // Only NodeList has the "item()" function 22144 return typeof el.item !== "undefined"; 22145} 22146 22147/***/ }), 22148
vendor: 639 bytes, lines 22149-22164
22149/***/ "../node_modules/tiny-slider/src/helpers/isVisible.js": 22150/*!************************************************************!*\ 22151 !*** ../node_modules/tiny-slider/src/helpers/isVisible.js ***! 22152 \************************************************************/ 22153/*! exports provided: isVisible */ 22154/***/ (function(module, __webpack_exports__, __webpack_require__) { 22155 22156"use strict"; 22157__webpack_require__.r(__webpack_exports__); 22158/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isVisible", function() { return isVisible; }); 22159function isVisible(el) { 22160 return window.getComputedStyle(el).display !== 'none'; 22161} 22162 22163/***/ }), 22164
vendor: 1,209 bytes, lines 22165-22197
22165/***/ "../node_modules/tiny-slider/src/helpers/jsTransform.js": 22166/*!**************************************************************!*\ 22167 !*** ../node_modules/tiny-slider/src/helpers/jsTransform.js ***! 22168 \**************************************************************/ 22169/*! exports provided: jsTransform */ 22170/***/ (function(module, __webpack_exports__, __webpack_require__) { 22171 22172"use strict"; 22173__webpack_require__.r(__webpack_exports__); 22174/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsTransform", function() { return jsTransform; }); 22175function jsTransform(element, attr, prefix, postfix, to, duration, callback) { 22176 var tick = Math.min(duration, 10), 22177 unit = (to.indexOf('%') >= 0) ? '%' : 'px', 22178 to = to.replace(unit, ''), 22179 from = Number(element.style[attr].replace(prefix, '').replace(postfix, '').replace(unit, '')), 22180 positionTick = (to - from) / duration * tick, 22181 running; 22182 22183 setTimeout(moveElement, tick); 22184 function moveElement() { 22185 duration -= tick; 22186 from += positionTick; 22187 element.style[attr] = prefix + from + unit + postfix; 22188 if (duration > 0) { 22189 setTimeout(moveElement, tick); 22190 } else { 22191 callback(); 22192 } 22193 } 22194} 22195 22196/***/ }), 22197
vendor: 2,121 bytes, lines 22198-22249
22198/***/ "../node_modules/tiny-slider/src/helpers/mediaquerySupport.js": 22199/*!********************************************************************!*\ 22200 !*** ../node_modules/tiny-slider/src/helpers/mediaquerySupport.js ***! 22201 \********************************************************************/ 22202/*! exports provided: mediaquerySupport */ 22203/***/ (function(module, __webpack_exports__, __webpack_require__) { 22204 22205"use strict"; 22206__webpack_require__.r(__webpack_exports__); 22207/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mediaquerySupport", function() { return mediaquerySupport; }); 22208/* harmony import */ var _getBody_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getBody.js */ "../node_modules/tiny-slider/src/helpers/getBody.js"); 22209/* harmony import */ var _setFakeBody_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setFakeBody.js */ "../node_modules/tiny-slider/src/helpers/setFakeBody.js"); 22210/* harmony import */ var _resetFakeBody_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./resetFakeBody.js */ "../node_modules/tiny-slider/src/helpers/resetFakeBody.js"); 22211 22212 22213 22214 22215function mediaquerySupport () { 22216 if (window.matchMedia || window.msMatchMedia) { 22217 return true; 22218 } 22219 22220 var doc = document, 22221 body = Object(_getBody_js__WEBPACK_IMPORTED_MODULE_0__["getBody"])(), 22222 docOverflow = Object(_setFakeBody_js__WEBPACK_IMPORTED_MODULE_1__["setFakeBody"])(body), 22223 div = doc.createElement('div'), 22224 style = doc.createElement('style'), 22225 rule = '@media all and (min-width:1px){.tns-mq-test{position:absolute}}', 22226 position; 22227 22228 style.type = 'text/css'; 22229 div.className = 'tns-mq-test'; 22230 22231 body.appendChild(style); 22232 body.appendChild(div); 22233 22234 if (style.styleSheet) { 22235 style.styleSheet.cssText = rule; 22236 } else { 22237 style.appendChild(doc.createTextNode(rule)); 22238 } 22239 22240 position = window.getComputedStyle ? window.getComputedStyle(div).position : div.currentStyle['position']; 22241 22242 body.fake ? Object(_resetFakeBody_js__WEBPACK_IMPORTED_MODULE_2__["resetFakeBody"])(body, docOverflow) : div.remove(); 22243 22244 return position === "absolute"; 22245} 22246 22247 22248/***/ }), 22249
vendor: 947 bytes, lines 22250-22273
22250/***/ "../node_modules/tiny-slider/src/helpers/passiveOption.js": 22251/*!****************************************************************!*\ 22252 !*** ../node_modules/tiny-slider/src/helpers/passiveOption.js ***! 22253 \****************************************************************/ 22254/*! exports provided: passiveOption */ 22255/***/ (function(module, __webpack_exports__, __webpack_require__) { 22256 22257"use strict"; 22258__webpack_require__.r(__webpack_exports__); 22259/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "passiveOption", function() { return passiveOption; }); 22260// Test via a getter in the options object to see if the passive property is accessed 22261var supportsPassive = false; 22262try { 22263 var opts = Object.defineProperty({}, 'passive', { 22264 get: function() { 22265 supportsPassive = true; 22266 } 22267 }); 22268 window.addEventListener("test", null, opts); 22269} catch (e) {} 22270var passiveOption = supportsPassive ? { passive: true } : false; 22271 22272/***/ }), 22273
vendor: 2,100 bytes, lines 22274-22324
22274/***/ "../node_modules/tiny-slider/src/helpers/percentageLayout.js": 22275/*!*******************************************************************!*\ 22276 !*** ../node_modules/tiny-slider/src/helpers/percentageLayout.js ***! 22277 \*******************************************************************/ 22278/*! exports provided: percentageLayout */ 22279/***/ (function(module, __webpack_exports__, __webpack_require__) { 22280 22281"use strict"; 22282__webpack_require__.r(__webpack_exports__); 22283/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "percentageLayout", function() { return percentageLayout; }); 22284/* harmony import */ var _getBody_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getBody.js */ "../node_modules/tiny-slider/src/helpers/getBody.js"); 22285/* harmony import */ var _setFakeBody_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setFakeBody.js */ "../node_modules/tiny-slider/src/helpers/setFakeBody.js"); 22286/* harmony import */ var _resetFakeBody_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./resetFakeBody.js */ "../node_modules/tiny-slider/src/helpers/resetFakeBody.js"); 22287// get subpixel support value 22288// @return - boolean 22289 22290 22291 22292 22293function percentageLayout() { 22294 // check subpixel layout supporting 22295 var doc = document, 22296 body = Object(_getBody_js__WEBPACK_IMPORTED_MODULE_0__["getBody"])(), 22297 docOverflow = Object(_setFakeBody_js__WEBPACK_IMPORTED_MODULE_1__["setFakeBody"])(body), 22298 wrapper = doc.createElement('div'), 22299 outer = doc.createElement('div'), 22300 str = '', 22301 count = 70, 22302 perPage = 3, 22303 supported = false; 22304 22305 wrapper.className = "tns-t-subp2"; 22306 outer.className = "tns-t-ct"; 22307 22308 for (var i = 0; i < count; i++) { 22309 str += '<div></div>'; 22310 } 22311 22312 outer.innerHTML = str; 22313 wrapper.appendChild(outer); 22314 body.appendChild(wrapper); 22315 22316 supported = Math.abs(wrapper.getBoundingClientRect().left - outer.children[count - perPage].getBoundingClientRect().left) < 2; 22317 22318 body.fake ? Object(_resetFakeBody_js__WEBPACK_IMPORTED_MODULE_2__["resetFakeBody"])(body, docOverflow) : wrapper.remove(); 22319 22320 return supported; 22321} 22322 22323/***/ }), 22324
vendor: 723 bytes, lines 22325-22345
22325/***/ "../node_modules/tiny-slider/src/helpers/raf.js": 22326/*!******************************************************!*\ 22327 !*** ../node_modules/tiny-slider/src/helpers/raf.js ***! 22328 \******************************************************/ 22329/*! exports provided: raf */ 22330/***/ (function(module, __webpack_exports__, __webpack_require__) { 22331 22332"use strict"; 22333__webpack_require__.r(__webpack_exports__); 22334/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "raf", function() { return raf; }); 22335var win = window; 22336 22337var raf = win.requestAnimationFrame 22338 || win.webkitRequestAnimationFrame 22339 || win.mozRequestAnimationFrame 22340 || win.msRequestAnimationFrame 22341 || function(cb) { return setTimeout(cb, 16); }; 22342 22343 22344/***/ }), 22345
vendor: 1,110 bytes, lines 22346-22372
22346/***/ "../node_modules/tiny-slider/src/helpers/removeAttrs.js": 22347/*!**************************************************************!*\ 22348 !*** ../node_modules/tiny-slider/src/helpers/removeAttrs.js ***! 22349 \**************************************************************/ 22350/*! exports provided: removeAttrs */ 22351/***/ (function(module, __webpack_exports__, __webpack_require__) { 22352 22353"use strict"; 22354__webpack_require__.r(__webpack_exports__); 22355/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAttrs", function() { return removeAttrs; }); 22356/* harmony import */ var _isNodeList_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isNodeList.js */ "../node_modules/tiny-slider/src/helpers/isNodeList.js"); 22357 22358 22359function removeAttrs(els, attrs) { 22360 els = (Object(_isNodeList_js__WEBPACK_IMPORTED_MODULE_0__["isNodeList"])(els) || els instanceof Array) ? els : [els]; 22361 attrs = (attrs instanceof Array) ? attrs : [attrs]; 22362 22363 var attrLength = attrs.length; 22364 for (var i = els.length; i--;) { 22365 for (var j = attrLength; j--;) { 22366 els[i].removeAttribute(attrs[j]); 22367 } 22368 } 22369} 22370 22371/***/ }), 22372
vendor: 938 bytes, lines 22373-22395
22373/***/ "../node_modules/tiny-slider/src/helpers/removeCSSRule.js": 22374/*!****************************************************************!*\ 22375 !*** ../node_modules/tiny-slider/src/helpers/removeCSSRule.js ***! 22376 \****************************************************************/ 22377/*! exports provided: removeCSSRule */ 22378/***/ (function(module, __webpack_exports__, __webpack_require__) { 22379 22380"use strict"; 22381__webpack_require__.r(__webpack_exports__); 22382/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeCSSRule", function() { return removeCSSRule; }); 22383/* harmony import */ var _raf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./raf.js */ "../node_modules/tiny-slider/src/helpers/raf.js"); 22384// cross browsers addRule method 22385 22386function removeCSSRule(sheet, index) { 22387 // return raf(function() { 22388 'deleteRule' in sheet ? 22389 sheet.deleteRule(index) : 22390 sheet.removeRule(index); 22391 // }); 22392} 22393 22394/***/ }), 22395
vendor: 1,130 bytes, lines 22396-22419
22396/***/ "../node_modules/tiny-slider/src/helpers/removeClass.js": 22397/*!**************************************************************!*\ 22398 !*** ../node_modules/tiny-slider/src/helpers/removeClass.js ***! 22399 \**************************************************************/ 22400/*! exports provided: removeClass */ 22401/***/ (function(module, __webpack_exports__, __webpack_require__) { 22402 22403"use strict"; 22404__webpack_require__.r(__webpack_exports__); 22405/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeClass", function() { return removeClass; }); 22406/* harmony import */ var _hasClass_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hasClass.js */ "../node_modules/tiny-slider/src/helpers/hasClass.js"); 22407 22408var removeClass = _hasClass_js__WEBPACK_IMPORTED_MODULE_0__["classListSupport"] ? 22409 function (el, str) { 22410 if (Object(_hasClass_js__WEBPACK_IMPORTED_MODULE_0__["hasClass"])(el, str)) { el.classList.remove(str); } 22411 } : 22412 function (el, str) { 22413 if (Object(_hasClass_js__WEBPACK_IMPORTED_MODULE_0__["hasClass"])(el, str)) { el.className = el.className.replace(str, ''); } 22414 }; 22415 22416 22417 22418/***/ }), 22419
vendor: 1,016 bytes, lines 22420-22441
22420/***/ "../node_modules/tiny-slider/src/helpers/removeEvents.js": 22421/*!***************************************************************!*\ 22422 !*** ../node_modules/tiny-slider/src/helpers/removeEvents.js ***! 22423 \***************************************************************/ 22424/*! exports provided: removeEvents */ 22425/***/ (function(module, __webpack_exports__, __webpack_require__) { 22426 22427"use strict"; 22428__webpack_require__.r(__webpack_exports__); 22429/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeEvents", function() { return removeEvents; }); 22430/* harmony import */ var _passiveOption_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./passiveOption.js */ "../node_modules/tiny-slider/src/helpers/passiveOption.js"); 22431 22432 22433function removeEvents(el, obj) { 22434 for (var prop in obj) { 22435 var option = ['touchstart', 'touchmove'].indexOf(prop) >= 0 ? _passiveOption_js__WEBPACK_IMPORTED_MODULE_0__["passiveOption"] : false; 22436 el.removeEventListener(prop, obj[prop], option); 22437 } 22438} 22439 22440/***/ }), 22441
vendor: 1,113 bytes, lines 22442-22466
22442/***/ "../node_modules/tiny-slider/src/helpers/resetFakeBody.js": 22443/*!****************************************************************!*\ 22444 !*** ../node_modules/tiny-slider/src/helpers/resetFakeBody.js ***! 22445 \****************************************************************/ 22446/*! exports provided: resetFakeBody */ 22447/***/ (function(module, __webpack_exports__, __webpack_require__) { 22448 22449"use strict"; 22450__webpack_require__.r(__webpack_exports__); 22451/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resetFakeBody", function() { return resetFakeBody; }); 22452/* harmony import */ var _docElement_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./docElement.js */ "../node_modules/tiny-slider/src/helpers/docElement.js"); 22453 22454 22455function resetFakeBody (body, docOverflow) { 22456 if (body.fake) { 22457 body.remove(); 22458 _docElement_js__WEBPACK_IMPORTED_MODULE_0__["docElement"].style.overflow = docOverflow; 22459 // Trigger layout so kinetic scrolling isn't disabled in iOS6+ 22460 // eslint-disable-next-line 22461 _docElement_js__WEBPACK_IMPORTED_MODULE_0__["docElement"].offsetHeight; 22462 } 22463} 22464 22465/***/ }), 22466
vendor: 1,073 bytes, lines 22467-22492
22467/***/ "../node_modules/tiny-slider/src/helpers/setAttrs.js": 22468/*!***********************************************************!*\ 22469 !*** ../node_modules/tiny-slider/src/helpers/setAttrs.js ***! 22470 \***********************************************************/ 22471/*! exports provided: setAttrs */ 22472/***/ (function(module, __webpack_exports__, __webpack_require__) { 22473 22474"use strict"; 22475__webpack_require__.r(__webpack_exports__); 22476/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setAttrs", function() { return setAttrs; }); 22477/* harmony import */ var _isNodeList_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isNodeList.js */ "../node_modules/tiny-slider/src/helpers/isNodeList.js"); 22478 22479 22480function setAttrs(els, attrs) { 22481 els = (Object(_isNodeList_js__WEBPACK_IMPORTED_MODULE_0__["isNodeList"])(els) || els instanceof Array) ? els : [els]; 22482 if (Object.prototype.toString.call(attrs) !== '[object Object]') { return; } 22483 22484 for (var i = els.length; i--;) { 22485 for(var key in attrs) { 22486 els[i].setAttribute(key, attrs[key]); 22487 } 22488 } 22489} 22490 22491/***/ }), 22492
vendor: 1,315 bytes, lines 22493-22521
22493/***/ "../node_modules/tiny-slider/src/helpers/setFakeBody.js": 22494/*!**************************************************************!*\ 22495 !*** ../node_modules/tiny-slider/src/helpers/setFakeBody.js ***! 22496 \**************************************************************/ 22497/*! exports provided: setFakeBody */ 22498/***/ (function(module, __webpack_exports__, __webpack_require__) { 22499 22500"use strict"; 22501__webpack_require__.r(__webpack_exports__); 22502/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setFakeBody", function() { return setFakeBody; }); 22503/* harmony import */ var _docElement_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./docElement.js */ "../node_modules/tiny-slider/src/helpers/docElement.js"); 22504 22505 22506function setFakeBody (body) { 22507 var docOverflow = ''; 22508 if (body.fake) { 22509 docOverflow = _docElement_js__WEBPACK_IMPORTED_MODULE_0__["docElement"].style.overflow; 22510 //avoid crashing IE8, if background image is used 22511 body.style.background = ''; 22512 //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible 22513 body.style.overflow = _docElement_js__WEBPACK_IMPORTED_MODULE_0__["docElement"].style.overflow = 'hidden'; 22514 _docElement_js__WEBPACK_IMPORTED_MODULE_0__["docElement"].appendChild(body); 22515 } 22516 22517 return docOverflow; 22518} 22519 22520/***/ }), 22521
vendor: 745 bytes, lines 22522-22540
22522/***/ "../node_modules/tiny-slider/src/helpers/setLocalStorage.js": 22523/*!******************************************************************!*\ 22524 !*** ../node_modules/tiny-slider/src/helpers/setLocalStorage.js ***! 22525 \******************************************************************/ 22526/*! exports provided: setLocalStorage */ 22527/***/ (function(module, __webpack_exports__, __webpack_require__) { 22528 22529"use strict"; 22530__webpack_require__.r(__webpack_exports__); 22531/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLocalStorage", function() { return setLocalStorage; }); 22532function setLocalStorage(storage, key, value, access) { 22533 if (access) { 22534 try { storage.setItem(key, value); } catch (e) {} 22535 } 22536 return value; 22537} 22538 22539/***/ }), 22540
vendor: 671 bytes, lines 22541-22556
22541/***/ "../node_modules/tiny-slider/src/helpers/showElement.js": 22542/*!**************************************************************!*\ 22543 !*** ../node_modules/tiny-slider/src/helpers/showElement.js ***! 22544 \**************************************************************/ 22545/*! exports provided: showElement */ 22546/***/ (function(module, __webpack_exports__, __webpack_require__) { 22547 22548"use strict"; 22549__webpack_require__.r(__webpack_exports__); 22550/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "showElement", function() { return showElement; }); 22551function showElement(el, forceHide) { 22552 if (el.style.display === 'none') { el.style.display = ''; } 22553} 22554 22555/***/ }), 22556
vendor: 622 bytes, lines 22557-22572
22557/***/ "../node_modules/tiny-slider/src/helpers/toDegree.js": 22558/*!***********************************************************!*\ 22559 !*** ../node_modules/tiny-slider/src/helpers/toDegree.js ***! 22560 \***********************************************************/ 22561/*! exports provided: toDegree */ 22562/***/ (function(module, __webpack_exports__, __webpack_require__) { 22563 22564"use strict"; 22565__webpack_require__.r(__webpack_exports__); 22566/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toDegree", function() { return toDegree; }); 22567function toDegree (y, x) { 22568 return Math.atan2(y, x) * (180 / Math.PI); 22569} 22570 22571/***/ }), 22572
vendor: 1,204 bytes, lines 22573-22610
22573/***/ "../node_modules/tiny-slider/src/helpers/whichProperty.js": 22574/*!****************************************************************!*\ 22575 !*** ../node_modules/tiny-slider/src/helpers/whichProperty.js ***! 22576 \****************************************************************/ 22577/*! exports provided: whichProperty */ 22578/***/ (function(module, __webpack_exports__, __webpack_require__) { 22579 22580"use strict"; 22581__webpack_require__.r(__webpack_exports__); 22582/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "whichProperty", function() { return whichProperty; }); 22583function whichProperty(props){ 22584 if (typeof props === 'string') { 22585 var arr = [props], 22586 Props = props.charAt(0).toUpperCase() + props.substr(1), 22587 prefixes = ['Webkit', 'Moz', 'ms', 'O']; 22588 22589 prefixes.forEach(function(prefix) { 22590 if (prefix !== 'ms' || props === 'transform') { 22591 arr.push(prefix + Props); 22592 } 22593 }); 22594 22595 props = arr; 22596 } 22597 22598 var el = document.createElement('fakeelement'), 22599 len = props.length; 22600 for(var i = 0; i < props.length; i++){ 22601 var prop = props[i]; 22602 if( el.style[prop] !== undefined ){ return prop; } 22603 } 22604 22605 return false; // explicit for ie9- 22606} 22607 22608 22609/***/ }), 22610
vendor: 109,459 bytes, lines 22611-25424
22611/***/ "../node_modules/tiny-slider/src/tiny-slider.js": 22612/*!******************************************************!*\ 22613 !*** ../node_modules/tiny-slider/src/tiny-slider.js ***! 22614 \******************************************************/ 22615/*! exports provided: tns */ 22616/***/ (function(module, __webpack_exports__, __webpack_require__) { 22617 22618"use strict"; 22619__webpack_require__.r(__webpack_exports__); 22620/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tns", function() { return tns; }); 22621/* harmony import */ var _helpers_raf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers/raf.js */ "../node_modules/tiny-slider/src/helpers/raf.js"); 22622/* harmony import */ var _helpers_caf_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers/caf.js */ "../node_modules/tiny-slider/src/helpers/caf.js"); 22623/* harmony import */ var _helpers_extend_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helpers/extend.js */ "../node_modules/tiny-slider/src/helpers/extend.js"); 22624/* harmony import */ var _helpers_checkStorageValue_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers/checkStorageValue.js */ "../node_modules/tiny-slider/src/helpers/checkStorageValue.js"); 22625/* harmony import */ var _helpers_setLocalStorage_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers/setLocalStorage.js */ "../node_modules/tiny-slider/src/helpers/setLocalStorage.js"); 22626/* harmony import */ var _helpers_getSlideId_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./helpers/getSlideId.js */ "../node_modules/tiny-slider/src/helpers/getSlideId.js"); 22627/* harmony import */ var _helpers_calc_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers/calc.js */ "../node_modules/tiny-slider/src/helpers/calc.js"); 22628/* harmony import */ var _helpers_percentageLayout_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./helpers/percentageLayout.js */ "../node_modules/tiny-slider/src/helpers/percentageLayout.js"); 22629/* harmony import */ var _helpers_mediaquerySupport_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./helpers/mediaquerySupport.js */ "../node_modules/tiny-slider/src/helpers/mediaquerySupport.js"); 22630/* harmony import */ var _helpers_createStyleSheet_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./helpers/createStyleSheet.js */ "../node_modules/tiny-slider/src/helpers/createStyleSheet.js"); 22631/* harmony import */ var _helpers_addCSSRule_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./helpers/addCSSRule.js */ "../node_modules/tiny-slider/src/helpers/addCSSRule.js"); 22632/* harmony import */ var _helpers_removeCSSRule_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./helpers/removeCSSRule.js */ "../node_modules/tiny-slider/src/helpers/removeCSSRule.js"); 22633/* harmony import */ var _helpers_getCssRulesLength_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./helpers/getCssRulesLength.js */ "../node_modules/tiny-slider/src/helpers/getCssRulesLength.js"); 22634/* harmony import */ var _helpers_toDegree_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./helpers/toDegree.js */ "../node_modules/tiny-slider/src/helpers/toDegree.js"); 22635/* harmony import */ var _helpers_getTouchDirection_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./helpers/getTouchDirection.js */ "../node_modules/tiny-slider/src/helpers/getTouchDirection.js"); 22636/* harmony import */ var _helpers_forEach_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./helpers/forEach.js */ "../node_modules/tiny-slider/src/helpers/forEach.js"); 22637/* harmony import */ var _helpers_hasClass_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./helpers/hasClass.js */ "../node_modules/tiny-slider/src/helpers/hasClass.js"); 22638/* harmony import */ var _helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./helpers/addClass.js */ "../node_modules/tiny-slider/src/helpers/addClass.js"); 22639/* harmony import */ var _helpers_removeClass_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./helpers/removeClass.js */ "../node_modules/tiny-slider/src/helpers/removeClass.js"); 22640/* harmony import */ var _helpers_hasAttr_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./helpers/hasAttr.js */ "../node_modules/tiny-slider/src/helpers/hasAttr.js"); 22641/* harmony import */ var _helpers_getAttr_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./helpers/getAttr.js */ "../node_modules/tiny-slider/src/helpers/getAttr.js"); 22642/* harmony import */ var _helpers_setAttrs_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./helpers/setAttrs.js */ "../node_modules/tiny-slider/src/helpers/setAttrs.js"); 22643/* harmony import */ var _helpers_removeAttrs_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./helpers/removeAttrs.js */ "../node_modules/tiny-slider/src/helpers/removeAttrs.js"); 22644/* harmony import */ var _helpers_arrayFromNodeList_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./helpers/arrayFromNodeList.js */ "../node_modules/tiny-slider/src/helpers/arrayFromNodeList.js"); 22645/* harmony import */ var _helpers_hideElement_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./helpers/hideElement.js */ "../node_modules/tiny-slider/src/helpers/hideElement.js"); 22646/* harmony import */ var _helpers_showElement_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./helpers/showElement.js */ "../node_modules/tiny-slider/src/helpers/showElement.js"); 22647/* harmony import */ var _helpers_isVisible_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./helpers/isVisible.js */ "../node_modules/tiny-slider/src/helpers/isVisible.js"); 22648/* harmony import */ var _helpers_whichProperty_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./helpers/whichProperty.js */ "../node_modules/tiny-slider/src/helpers/whichProperty.js"); 22649/* harmony import */ var _helpers_has3DTransforms_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./helpers/has3DTransforms.js */ "../node_modules/tiny-slider/src/helpers/has3DTransforms.js"); 22650/* harmony import */ var _helpers_getEndProperty_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./helpers/getEndProperty.js */ "../node_modules/tiny-slider/src/helpers/getEndProperty.js"); 22651/* harmony import */ var _helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./helpers/addEvents.js */ "../node_modules/tiny-slider/src/helpers/addEvents.js"); 22652/* harmony import */ var _helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./helpers/removeEvents.js */ "../node_modules/tiny-slider/src/helpers/removeEvents.js"); 22653/* harmony import */ var _helpers_events_js__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./helpers/events.js */ "../node_modules/tiny-slider/src/helpers/events.js"); 22654/* harmony import */ var _helpers_jsTransform_js__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./helpers/jsTransform.js */ "../node_modules/tiny-slider/src/helpers/jsTransform.js"); 22655// Object.keys 22656if (!Object.keys) { 22657 Object.keys = function(object) { 22658 var keys = []; 22659 for (var name in object) { 22660 if (Object.prototype.hasOwnProperty.call(object, name)) { 22661 keys.push(name); 22662 } 22663 } 22664 return keys; 22665 }; 22666} 22667 22668// ChildNode.remove 22669if(!("remove" in Element.prototype)){ 22670 Element.prototype.remove = function(){ 22671 if(this.parentNode) { 22672 this.parentNode.removeChild(this); 22673 } 22674 }; 22675} 22676 22677 22678 22679 22680 22681 22682 22683 22684 22685 22686 22687 22688 22689 22690 22691 22692 22693 22694 22695 22696 22697 22698 22699 22700 22701 22702 22703 22704 22705 22706 22707 22708 22709 22710 22711 22712var tns = function(options) { 22713 options = Object(_helpers_extend_js__WEBPACK_IMPORTED_MODULE_2__["extend"])({ 22714 container: '.slider', 22715 mode: 'carousel', 22716 axis: 'horizontal', 22717 items: 1, 22718 gutter: 0, 22719 edgePadding: 0, 22720 fixedWidth: false, 22721 autoWidth: false, 22722 viewportMax: false, 22723 slideBy: 1, 22724 center: false, 22725 controls: true, 22726 controlsPosition: 'top', 22727 controlsText: ['prev', 'next'], 22728 controlsContainer: false, 22729 prevButton: false, 22730 nextButton: false, 22731 nav: true, 22732 navPosition: 'top', 22733 navContainer: false, 22734 navAsThumbnails: false, 22735 arrowKeys: false, 22736 speed: 300, 22737 autoplay: false, 22738 autoplayPosition: 'top', 22739 autoplayTimeout: 5000, 22740 autoplayDirection: 'forward', 22741 autoplayText: ['start', 'stop'], 22742 autoplayHoverPause: false, 22743 autoplayButton: false, 22744 autoplayButtonOutput: true, 22745 autoplayResetOnVisibility: true, 22746 animateIn: 'tns-fadeIn', 22747 animateOut: 'tns-fadeOut', 22748 animateNormal: 'tns-normal', 22749 animateDelay: false, 22750 loop: true, 22751 rewind: false, 22752 autoHeight: false, 22753 responsive: false, 22754 lazyload: false, 22755 lazyloadSelector: '.tns-lazy-img', 22756 touch: true, 22757 mouseDrag: false, 22758 swipeAngle: 15, 22759 nested: false, 22760 preventActionWhenRunning: false, 22761 preventScrollOnTouch: false, 22762 freezable: true, 22763 onInit: false, 22764 useLocalStorage: true, 22765 nonce: false 22766 }, options || {}); 22767 22768 var doc = document, 22769 win = window, 22770 KEYS = { 22771 ENTER: 13, 22772 SPACE: 32, 22773 LEFT: 37, 22774 RIGHT: 39 22775 }, 22776 tnsStorage = {}, 22777 localStorageAccess = options.useLocalStorage; 22778 22779 if (localStorageAccess) { 22780 // check browser version and local storage access 22781 var browserInfo = navigator.userAgent; 22782 var uid = new Date; 22783 22784 try { 22785 tnsStorage = win.localStorage; 22786 if (tnsStorage) { 22787 tnsStorage.setItem(uid, uid); 22788 localStorageAccess = tnsStorage.getItem(uid) == uid; 22789 tnsStorage.removeItem(uid); 22790 } else { 22791 localStorageAccess = false; 22792 } 22793 if (!localStorageAccess) { tnsStorage = {}; } 22794 } catch(e) { 22795 localStorageAccess = false; 22796 } 22797 22798 if (localStorageAccess) { 22799 // remove storage when browser version changes 22800 if (tnsStorage['tnsApp'] && tnsStorage['tnsApp'] !== browserInfo) { 22801 ['tC', 'tPL', 'tMQ', 'tTf', 't3D', 'tTDu', 'tTDe', 'tADu', 'tADe', 'tTE', 'tAE'].forEach(function(item) { tnsStorage.removeItem(item); }); 22802 } 22803 // update browserInfo 22804 localStorage['tnsApp'] = browserInfo; 22805 } 22806 } 22807 22808 var CALC = tnsStorage['tC'] ? Object(_helpers_checkStorageValue_js__WEBPACK_IMPORTED_MODULE_3__["checkStorageValue"])(tnsStorage['tC']) : Object(_helpers_setLocalStorage_js__WEBPACK_IMPORTED_MODULE_4__["setLocalStorage"])(tnsStorage, 'tC', Object(_helpers_calc_js__WEBPACK_IMPORTED_MODULE_6__["calc"])(), localStorageAccess), 22809 PERCENTAGELAYOUT = tnsStorage['tPL'] ? Object(_helpers_checkStorageValue_js__WEBPACK_IMPORTED_MODULE_3__["checkStorageValue"])(tnsStorage['tPL']) : Object(_helpers_setLocalStorage_js__WEBPACK_IMPORTED_MODULE_4__["setLocalStorage"])(tnsStorage, 'tPL', Object(_helpers_percentageLayout_js__WEBPACK_IMPORTED_MODULE_7__["percentageLayout"])(), localStorageAccess), 22810 CSSMQ = tnsStorage['tMQ'] ? Object(_helpers_checkStorageValue_js__WEBPACK_IMPORTED_MODULE_3__["checkStorageValue"])(tnsStorage['tMQ']) : Object(_helpers_setLocalStorage_js__WEBPACK_IMPORTED_MODULE_4__["setLocalStorage"])(tnsStorage, 'tMQ', Object(_helpers_mediaquerySupport_js__WEBPACK_IMPORTED_MODULE_8__["mediaquerySupport"])(), localStorageAccess), 22811 TRANSFORM = tnsStorage['tTf'] ? Object(_helpers_checkStorageValue_js__WEBPACK_IMPORTED_MODULE_3__["checkStorageValue"])(tnsStorage['tTf']) : Object(_helpers_setLocalStorage_js__WEBPACK_IMPORTED_MODULE_4__["setLocalStorage"])(tnsStorage, 'tTf', Object(_helpers_whichProperty_js__WEBPACK_IMPORTED_MODULE_27__["whichProperty"])('transform'), localStorageAccess), 22812 HAS3DTRANSFORMS = tnsStorage['t3D'] ? Object(_helpers_checkStorageValue_js__WEBPACK_IMPORTED_MODULE_3__["checkStorageValue"])(tnsStorage['t3D']) : Object(_helpers_setLocalStorage_js__WEBPACK_IMPORTED_MODULE_4__["setLocalStorage"])(tnsStorage, 't3D', Object(_helpers_has3DTransforms_js__WEBPACK_IMPORTED_MODULE_28__["has3DTransforms"])(TRANSFORM), localStorageAccess), 22813 TRANSITIONDURATION = tnsStorage['tTDu'] ? Object(_helpers_checkStorageValue_js__WEBPACK_IMPORTED_MODULE_3__["checkStorageValue"])(tnsStorage['tTDu']) : Object(_helpers_setLocalStorage_js__WEBPACK_IMPORTED_MODULE_4__["setLocalStorage"])(tnsStorage, 'tTDu', Object(_helpers_whichProperty_js__WEBPACK_IMPORTED_MODULE_27__["whichProperty"])('transitionDuration'), localStorageAccess), 22814 TRANSITIONDELAY = tnsStorage['tTDe'] ? Object(_helpers_checkStorageValue_js__WEBPACK_IMPORTED_MODULE_3__["checkStorageValue"])(tnsStorage['tTDe']) : Object(_helpers_setLocalStorage_js__WEBPACK_IMPORTED_MODULE_4__["setLocalStorage"])(tnsStorage, 'tTDe', Object(_helpers_whichProperty_js__WEBPACK_IMPORTED_MODULE_27__["whichProperty"])('transitionDelay'), localStorageAccess), 22815 ANIMATIONDURATION = tnsStorage['tADu'] ? Object(_helpers_checkStorageValue_js__WEBPACK_IMPORTED_MODULE_3__["checkStorageValue"])(tnsStorage['tADu']) : Object(_helpers_setLocalStorage_js__WEBPACK_IMPORTED_MODULE_4__["setLocalStorage"])(tnsStorage, 'tADu', Object(_helpers_whichProperty_js__WEBPACK_IMPORTED_MODULE_27__["whichProperty"])('animationDuration'), localStorageAccess), 22816 ANIMATIONDELAY = tnsStorage['tADe'] ? Object(_helpers_checkStorageValue_js__WEBPACK_IMPORTED_MODULE_3__["checkStorageValue"])(tnsStorage['tADe']) : Object(_helpers_setLocalStorage_js__WEBPACK_IMPORTED_MODULE_4__["setLocalStorage"])(tnsStorage, 'tADe', Object(_helpers_whichProperty_js__WEBPACK_IMPORTED_MODULE_27__["whichProperty"])('animationDelay'), localStorageAccess), 22817 TRANSITIONEND = tnsStorage['tTE'] ? Object(_helpers_checkStorageValue_js__WEBPACK_IMPORTED_MODULE_3__["checkStorageValue"])(tnsStorage['tTE']) : Object(_helpers_setLocalStorage_js__WEBPACK_IMPORTED_MODULE_4__["setLocalStorage"])(tnsStorage, 'tTE', Object(_helpers_getEndProperty_js__WEBPACK_IMPORTED_MODULE_29__["getEndProperty"])(TRANSITIONDURATION, 'Transition'), localStorageAccess), 22818 ANIMATIONEND = tnsStorage['tAE'] ? Object(_helpers_checkStorageValue_js__WEBPACK_IMPORTED_MODULE_3__["checkStorageValue"])(tnsStorage['tAE']) : Object(_helpers_setLocalStorage_js__WEBPACK_IMPORTED_MODULE_4__["setLocalStorage"])(tnsStorage, 'tAE', Object(_helpers_getEndProperty_js__WEBPACK_IMPORTED_MODULE_29__["getEndProperty"])(ANIMATIONDURATION, 'Animation'), localStorageAccess); 22819 22820 // get element nodes from selectors 22821 var supportConsoleWarn = win.console && typeof win.console.warn === "function", 22822 tnsList = ['container', 'controlsContainer', 'prevButton', 'nextButton', 'navContainer', 'autoplayButton'], 22823 optionsElements = {}; 22824 22825 tnsList.forEach(function(item) { 22826 if (typeof options[item] === 'string') { 22827 var str = options[item], 22828 el = doc.querySelector(str); 22829 optionsElements[item] = str; 22830 22831 if (el && el.nodeName) { 22832 options[item] = el; 22833 } else { 22834 if (supportConsoleWarn) { console.warn('Can\'t find', options[item]); } 22835 return; 22836 } 22837 } 22838 }); 22839 22840 // make sure at least 1 slide 22841 if (options.container.children.length < 1) { 22842 if (supportConsoleWarn) { console.warn('No slides found in', options.container); } 22843 return; 22844 } 22845 22846 // update options 22847 var responsive = options.responsive, 22848 nested = options.nested, 22849 carousel = options.mode === 'carousel' ? true : false; 22850 22851 if (responsive) { 22852 // apply responsive[0] to options and remove it 22853 if (0 in responsive) { 22854 options = Object(_helpers_extend_js__WEBPACK_IMPORTED_MODULE_2__["extend"])(options, responsive[0]); 22855 delete responsive[0]; 22856 } 22857 22858 var responsiveTem = {}; 22859 for (var key in responsive) { 22860 var val = responsive[key]; 22861 // update responsive 22862 // from: 300: 2 22863 // to: 22864 // 300: { 22865 // items: 2 22866 // } 22867 val = typeof val === 'number' ? {items: val} : val; 22868 responsiveTem[key] = val; 22869 } 22870 responsive = responsiveTem; 22871 responsiveTem = null; 22872 } 22873 22874 // update options 22875 function updateOptions (obj) { 22876 for (var key in obj) { 22877 if (!carousel) { 22878 if (key === 'slideBy') { obj[key] = 'page'; } 22879 if (key === 'edgePadding') { obj[key] = false; } 22880 if (key === 'autoHeight') { obj[key] = false; } 22881 } 22882 22883 // update responsive options 22884 if (key === 'responsive') { updateOptions(obj[key]); } 22885 } 22886 } 22887 if (!carousel) { updateOptions(options); } 22888 22889 22890 // === define and set variables === 22891 if (!carousel) { 22892 options.axis = 'horizontal'; 22893 options.slideBy = 'page'; 22894 options.edgePadding = false; 22895 22896 var animateIn = options.animateIn, 22897 animateOut = options.animateOut, 22898 animateDelay = options.animateDelay, 22899 animateNormal = options.animateNormal; 22900 } 22901 22902 var horizontal = options.axis === 'horizontal' ? true : false, 22903 outerWrapper = doc.createElement('div'), 22904 innerWrapper = doc.createElement('div'), 22905 middleWrapper, 22906 container = options.container, 22907 containerParent = container.parentNode, 22908 containerHTML = container.outerHTML, 22909 slideItems = container.children, 22910 slideCount = slideItems.length, 22911 breakpointZone, 22912 windowWidth = getWindowWidth(), 22913 isOn = false; 22914 if (responsive) { setBreakpointZone(); } 22915 if (carousel) { container.className += ' tns-vpfix'; } 22916 22917 // fixedWidth: viewport > rightBoundary > indexMax 22918 var autoWidth = options.autoWidth, 22919 fixedWidth = getOption('fixedWidth'), 22920 edgePadding = getOption('edgePadding'), 22921 gutter = getOption('gutter'), 22922 viewport = getViewportWidth(), 22923 center = getOption('center'), 22924 items = !autoWidth ? Math.floor(getOption('items')) : 1, 22925 slideBy = getOption('slideBy'), 22926 viewportMax = options.viewportMax || options.fixedWidthViewportWidth, 22927 arrowKeys = getOption('arrowKeys'), 22928 speed = getOption('speed'), 22929 rewind = options.rewind, 22930 loop = rewind ? false : options.loop, 22931 autoHeight = getOption('autoHeight'), 22932 controls = getOption('controls'), 22933 controlsText = getOption('controlsText'), 22934 nav = getOption('nav'), 22935 touch = getOption('touch'), 22936 mouseDrag = getOption('mouseDrag'), 22937 autoplay = getOption('autoplay'), 22938 autoplayTimeout = getOption('autoplayTimeout'), 22939 autoplayText = getOption('autoplayText'), 22940 autoplayHoverPause = getOption('autoplayHoverPause'), 22941 autoplayResetOnVisibility = getOption('autoplayResetOnVisibility'), 22942 sheet = Object(_helpers_createStyleSheet_js__WEBPACK_IMPORTED_MODULE_9__["createStyleSheet"])(null, getOption('nonce')), 22943 lazyload = options.lazyload, 22944 lazyloadSelector = options.lazyloadSelector, 22945 slidePositions, // collection of slide positions 22946 slideItemsOut = [], 22947 cloneCount = loop ? getCloneCountForLoop() : 0, 22948 slideCountNew = !carousel ? slideCount + cloneCount : slideCount + cloneCount * 2, 22949 hasRightDeadZone = (fixedWidth || autoWidth) && !loop ? true : false, 22950 rightBoundary = fixedWidth ? getRightBoundary() : null, 22951 updateIndexBeforeTransform = (!carousel || !loop) ? true : false, 22952 // transform 22953 transformAttr = horizontal ? 'left' : 'top', 22954 transformPrefix = '', 22955 transformPostfix = '', 22956 // index 22957 getIndexMax = (function () { 22958 if (fixedWidth) { 22959 return function() { return center && !loop ? slideCount - 1 : Math.ceil(- rightBoundary / (fixedWidth + gutter)); }; 22960 } else if (autoWidth) { 22961 return function() { 22962 for (var i = 0; i < slideCountNew; i++) { 22963 if (slidePositions[i] >= - rightBoundary) { return i; } 22964 } 22965 }; 22966 } else { 22967 return function() { 22968 if (center && carousel && !loop) { 22969 return slideCount - 1; 22970 } else { 22971 return loop || carousel ? Math.max(0, slideCountNew - Math.ceil(items)) : slideCountNew - 1; 22972 } 22973 }; 22974 } 22975 })(), 22976 index = getStartIndex(getOption('startIndex')), 22977 indexCached = index, 22978 displayIndex = getCurrentSlide(), 22979 indexMin = 0, 22980 indexMax = !autoWidth ? getIndexMax() : null, 22981 // resize 22982 resizeTimer, 22983 preventActionWhenRunning = options.preventActionWhenRunning, 22984 swipeAngle = options.swipeAngle, 22985 moveDirectionExpected = swipeAngle ? '?' : true, 22986 running = false, 22987 onInit = options.onInit, 22988 events = new _helpers_events_js__WEBPACK_IMPORTED_MODULE_32__["Events"](), 22989 // id, class 22990 newContainerClasses = ' tns-slider tns-' + options.mode, 22991 slideId = container.id || Object(_helpers_getSlideId_js__WEBPACK_IMPORTED_MODULE_5__["getSlideId"])(), 22992 disable = getOption('disable'), 22993 disabled = false, 22994 freezable = options.freezable, 22995 freeze = freezable && !autoWidth ? getFreeze() : false, 22996 frozen = false, 22997 controlsEvents = { 22998 'click': onControlsClick, 22999 'keydown': onControlsKeydown 23000 }, 23001 navEvents = { 23002 'click': onNavClick, 23003 'keydown': onNavKeydown 23004 }, 23005 hoverEvents = { 23006 'mouseover': mouseoverPause, 23007 'mouseout': mouseoutRestart 23008 }, 23009 visibilityEvent = {'visibilitychange': onVisibilityChange}, 23010 docmentKeydownEvent = {'keydown': onDocumentKeydown}, 23011 touchEvents = { 23012 'touchstart': onPanStart, 23013 'touchmove': onPanMove, 23014 'touchend': onPanEnd, 23015 'touchcancel': onPanEnd 23016 }, dragEvents = { 23017 'mousedown': onPanStart, 23018 'mousemove': onPanMove, 23019 'mouseup': onPanEnd, 23020 'mouseleave': onPanEnd 23021 }, 23022 hasControls = hasOption('controls'), 23023 hasNav = hasOption('nav'), 23024 navAsThumbnails = autoWidth ? true : options.navAsThumbnails, 23025 hasAutoplay = hasOption('autoplay'), 23026 hasTouch = hasOption('touch'), 23027 hasMouseDrag = hasOption('mouseDrag'), 23028 slideActiveClass = 'tns-slide-active', 23029 slideClonedClass = 'tns-slide-cloned', 23030 imgCompleteClass = 'tns-complete', 23031 imgEvents = { 23032 'load': onImgLoaded, 23033 'error': onImgFailed 23034 }, 23035 imgsComplete, 23036 liveregionCurrent, 23037 preventScroll = options.preventScrollOnTouch === 'force' ? true : false; 23038 23039 // controls 23040 if (hasControls) { 23041 var controlsContainer = options.controlsContainer, 23042 controlsContainerHTML = options.controlsContainer ? options.controlsContainer.outerHTML : '', 23043 prevButton = options.prevButton, 23044 nextButton = options.nextButton, 23045 prevButtonHTML = options.prevButton ? options.prevButton.outerHTML : '', 23046 nextButtonHTML = options.nextButton ? options.nextButton.outerHTML : '', 23047 prevIsButton, 23048 nextIsButton; 23049 } 23050 23051 // nav 23052 if (hasNav) { 23053 var navContainer = options.navContainer, 23054 navContainerHTML = options.navContainer ? options.navContainer.outerHTML : '', 23055 navItems, 23056 pages = autoWidth ? slideCount : getPages(), 23057 pagesCached = 0, 23058 navClicked = -1, 23059 navCurrentIndex = getCurrentNavIndex(), 23060 navCurrentIndexCached = navCurrentIndex, 23061 navActiveClass = 'tns-nav-active', 23062 navStr = 'Carousel Page ', 23063 navStrCurrent = ' (Current Slide)'; 23064 } 23065 23066 // autoplay 23067 if (hasAutoplay) { 23068 var autoplayDirection = options.autoplayDirection === 'forward' ? 1 : -1, 23069 autoplayButton = options.autoplayButton, 23070 autoplayButtonHTML = options.autoplayButton ? options.autoplayButton.outerHTML : '', 23071 autoplayHtmlStrings = ['<span class=\'tns-visually-hidden\'>', ' animation</span>'], 23072 autoplayTimer, 23073 animating, 23074 autoplayHoverPaused, 23075 autoplayUserPaused, 23076 autoplayVisibilityPaused; 23077 } 23078 23079 if (hasTouch || hasMouseDrag) { 23080 var initPosition = {}, 23081 lastPosition = {}, 23082 translateInit, 23083 disX, 23084 disY, 23085 panStart = false, 23086 rafIndex, 23087 getDist = horizontal ? 23088 function(a, b) { return a.x - b.x; } : 23089 function(a, b) { return a.y - b.y; }; 23090 } 23091 23092 // disable slider when slidecount <= items 23093 if (!autoWidth) { resetVariblesWhenDisable(disable || freeze); } 23094 23095 if (TRANSFORM) { 23096 transformAttr = TRANSFORM; 23097 transformPrefix = 'translate'; 23098 23099 if (HAS3DTRANSFORMS) { 23100 transformPrefix += horizontal ? '3d(' : '3d(0px, '; 23101 transformPostfix = horizontal ? ', 0px, 0px)' : ', 0px)'; 23102 } else { 23103 transformPrefix += horizontal ? 'X(' : 'Y('; 23104 transformPostfix = ')'; 23105 } 23106 23107 } 23108 23109 if (carousel) { container.className = container.className.replace('tns-vpfix', ''); } 23110 initStructure(); 23111 initSheet(); 23112 initSliderTransform(); 23113 23114 // === COMMON FUNCTIONS === // 23115 function resetVariblesWhenDisable (condition) { 23116 if (condition) { 23117 controls = nav = touch = mouseDrag = arrowKeys = autoplay = autoplayHoverPause = autoplayResetOnVisibility = false; 23118 } 23119 } 23120 23121 function getCurrentSlide () { 23122 var tem = carousel ? index - cloneCount : index; 23123 while (tem < 0) { tem += slideCount; } 23124 return tem%slideCount + 1; 23125 } 23126 23127 function getStartIndex (ind) { 23128 ind = ind ? Math.max(0, Math.min(loop ? slideCount - 1 : slideCount - items, ind)) : 0; 23129 return carousel ? ind + cloneCount : ind; 23130 } 23131 23132 function getAbsIndex (i) { 23133 if (i == null) { i = index; } 23134 23135 if (carousel) { i -= cloneCount; } 23136 while (i < 0) { i += slideCount; } 23137 23138 return Math.floor(i%slideCount); 23139 } 23140 23141 function getCurrentNavIndex () { 23142 var absIndex = getAbsIndex(), 23143 result; 23144 23145 result = navAsThumbnails ? absIndex : 23146 fixedWidth || autoWidth ? Math.ceil((absIndex + 1) * pages / slideCount - 1) : 23147 Math.floor(absIndex / items); 23148 23149 // set active nav to the last one when reaches the right edge 23150 if (!loop && carousel && index === indexMax) { result = pages - 1; } 23151 23152 return result; 23153 } 23154 23155 function getItemsMax () { 23156 // fixedWidth or autoWidth while viewportMax is not available 23157 if (autoWidth || (fixedWidth && !viewportMax)) { 23158 return slideCount - 1; 23159 // most cases 23160 } else { 23161 var str = fixedWidth ? 'fixedWidth' : 'items', 23162 arr = []; 23163 23164 if (fixedWidth || options[str] < slideCount) { arr.push(options[str]); } 23165 23166 if (responsive) { 23167 for (var bp in responsive) { 23168 var tem = responsive[bp][str]; 23169 if (tem && (fixedWidth || tem < slideCount)) { arr.push(tem); } 23170 } 23171 } 23172 23173 if (!arr.length) { arr.push(0); } 23174 23175 return Math.ceil(fixedWidth ? viewportMax / Math.min.apply(null, arr) : Math.max.apply(null, arr)); 23176 } 23177 } 23178 23179 function getCloneCountForLoop () { 23180 var itemsMax = getItemsMax(), 23181 result = carousel ? Math.ceil((itemsMax * 5 - slideCount)/2) : (itemsMax * 4 - slideCount); 23182 result = Math.max(itemsMax, result); 23183 23184 return hasOption('edgePadding') ? result + 1 : result; 23185 } 23186 23187 function getWindowWidth () { 23188 return win.innerWidth || doc.documentElement.clientWidth || doc.body.clientWidth; 23189 } 23190 23191 function getInsertPosition (pos) { 23192 return pos === 'top' ? 'afterbegin' : 'beforeend'; 23193 } 23194 23195 function getClientWidth (el) { 23196 if (el == null) { return; } 23197 var div = doc.createElement('div'), rect, width; 23198 el.appendChild(div); 23199 rect = div.getBoundingClientRect(); 23200 width = rect.right - rect.left; 23201 div.remove(); 23202 return width || getClientWidth(el.parentNode); 23203 } 23204 23205 function getViewportWidth () { 23206 var gap = edgePadding ? edgePadding * 2 - gutter : 0; 23207 return getClientWidth(containerParent) - gap; 23208 } 23209 23210 function hasOption (item) { 23211 if (options[item]) { 23212 return true; 23213 } else { 23214 if (responsive) { 23215 for (var bp in responsive) { 23216 if (responsive[bp][item]) { return true; } 23217 } 23218 } 23219 return false; 23220 } 23221 } 23222 23223 // get option: 23224 // fixed width: viewport, fixedWidth, gutter => items 23225 // others: window width => all variables 23226 // all: items => slideBy 23227 function getOption (item, ww) { 23228 if (ww == null) { ww = windowWidth; } 23229 23230 if (item === 'items' && fixedWidth) { 23231 return Math.floor((viewport + gutter) / (fixedWidth + gutter)) || 1; 23232 23233 } else { 23234 var result = options[item]; 23235 23236 if (responsive) { 23237 for (var bp in responsive) { 23238 // bp: convert string to number 23239 if (ww >= parseInt(bp)) { 23240 if (item in responsive[bp]) { result = responsive[bp][item]; } 23241 } 23242 } 23243 } 23244 23245 if (item === 'slideBy' && result === 'page') { result = getOption('items'); } 23246 if (!carousel && (item === 'slideBy' || item === 'items')) { result = Math.floor(result); } 23247 23248 return result; 23249 } 23250 } 23251 23252 function getSlideMarginLeft (i) { 23253 return CALC ? 23254 CALC + '(' + i * 100 + '% / ' + slideCountNew + ')' : 23255 i * 100 / slideCountNew + '%'; 23256 } 23257 23258 function getInnerWrapperStyles (edgePaddingTem, gutterTem, fixedWidthTem, speedTem, autoHeightBP) { 23259 var str = ''; 23260 23261 if (edgePaddingTem !== undefined) { 23262 var gap = edgePaddingTem; 23263 if (gutterTem) { gap -= gutterTem; } 23264 str = horizontal ? 23265 'margin: 0 ' + gap + 'px 0 ' + edgePaddingTem + 'px;' : 23266 'margin: ' + edgePaddingTem + 'px 0 ' + gap + 'px 0;'; 23267 } else if (gutterTem && !fixedWidthTem) { 23268 var gutterTemUnit = '-' + gutterTem + 'px', 23269 dir = horizontal ? gutterTemUnit + ' 0 0' : '0 ' + gutterTemUnit + ' 0'; 23270 str = 'margin: 0 ' + dir + ';' 23271 } 23272 23273 if (!carousel && autoHeightBP && TRANSITIONDURATION && speedTem) { str += getTransitionDurationStyle(speedTem); } 23274 return str; 23275 } 23276 23277 function getContainerWidth (fixedWidthTem, gutterTem, itemsTem) { 23278 if (fixedWidthTem) { 23279 return (fixedWidthTem + gutterTem) * slideCountNew + 'px'; 23280 } else { 23281 return CALC ? 23282 CALC + '(' + slideCountNew * 100 + '% / ' + itemsTem + ')' : 23283 slideCountNew * 100 / itemsTem + '%'; 23284 } 23285 } 23286 23287 function getSlideWidthStyle (fixedWidthTem, gutterTem, itemsTem) { 23288 var width; 23289 23290 if (fixedWidthTem) { 23291 width = (fixedWidthTem + gutterTem) + 'px'; 23292 } else { 23293 if (!carousel) { itemsTem = Math.floor(itemsTem); } 23294 var dividend = carousel ? slideCountNew : itemsTem; 23295 width = CALC ? 23296 CALC + '(100% / ' + dividend + ')' : 23297 100 / dividend + '%'; 23298 } 23299 23300 width = 'width:' + width; 23301 23302 // inner slider: overwrite outer slider styles 23303 return nested !== 'inner' ? width + ';' : width + ' !important;'; 23304 } 23305 23306 function getSlideGutterStyle (gutterTem) { 23307 var str = ''; 23308 23309 // gutter maybe interger || 0 23310 // so can't use 'if (gutter)' 23311 if (gutterTem !== false) { 23312 var prop = horizontal ? 'padding-' : 'margin-', 23313 dir = horizontal ? 'right' : 'bottom'; 23314 str = prop + dir + ': ' + gutterTem + 'px;'; 23315 } 23316 23317 return str; 23318 } 23319 23320 function getCSSPrefix (name, num) { 23321 var prefix = name.substring(0, name.length - num).toLowerCase(); 23322 if (prefix) { prefix = '-' + prefix + '-'; } 23323 23324 return prefix; 23325 } 23326 23327 function getTransitionDurationStyle (speed) { 23328 return getCSSPrefix(TRANSITIONDURATION, 18) + 'transition-duration:' + speed / 1000 + 's;'; 23329 } 23330 23331 function getAnimationDurationStyle (speed) { 23332 return getCSSPrefix(ANIMATIONDURATION, 17) + 'animation-duration:' + speed / 1000 + 's;'; 23333 } 23334 23335 function initStructure () { 23336 var classOuter = 'tns-outer', 23337 classInner = 'tns-inner', 23338 hasGutter = hasOption('gutter'); 23339 23340 outerWrapper.className = classOuter; 23341 innerWrapper.className = classInner; 23342 outerWrapper.id = slideId + '-ow'; 23343 innerWrapper.id = slideId + '-iw'; 23344 23345 // set container properties 23346 if (container.id === '') { container.id = slideId; } 23347 newContainerClasses += PERCENTAGELAYOUT || autoWidth ? ' tns-subpixel' : ' tns-no-subpixel'; 23348 newContainerClasses += CALC ? ' tns-calc' : ' tns-no-calc'; 23349 if (autoWidth) { newContainerClasses += ' tns-autowidth'; } 23350 newContainerClasses += ' tns-' + options.axis; 23351 container.className += newContainerClasses; 23352 23353 // add constrain layer for carousel 23354 if (carousel) { 23355 middleWrapper = doc.createElement('div'); 23356 middleWrapper.id = slideId + '-mw'; 23357 middleWrapper.className = 'tns-ovh'; 23358 23359 outerWrapper.appendChild(middleWrapper); 23360 middleWrapper.appendChild(innerWrapper); 23361 } else { 23362 outerWrapper.appendChild(innerWrapper); 23363 } 23364 23365 if (autoHeight) { 23366 var wp = middleWrapper ? middleWrapper : innerWrapper; 23367 wp.className += ' tns-ah'; 23368 } 23369 23370 containerParent.insertBefore(outerWrapper, container); 23371 innerWrapper.appendChild(container); 23372 23373 // add id, class, aria attributes 23374 // before clone slides 23375 Object(_helpers_forEach_js__WEBPACK_IMPORTED_MODULE_15__["forEach"])(slideItems, function(item, i) { 23376 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(item, 'tns-item'); 23377 if (!item.id) { item.id = slideId + '-item' + i; } 23378 if (!carousel && animateNormal) { Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(item, animateNormal); } 23379 Object(_helpers_setAttrs_js__WEBPACK_IMPORTED_MODULE_21__["setAttrs"])(item, { 23380 'aria-hidden': 'true', 23381 'tabindex': '-1' 23382 }); 23383 }); 23384 23385 // ## clone slides 23386 // carousel: n + slides + n 23387 // gallery: slides + n 23388 if (cloneCount) { 23389 var fragmentBefore = doc.createDocumentFragment(), 23390 fragmentAfter = doc.createDocumentFragment(); 23391 23392 for (var j = cloneCount; j--;) { 23393 var num = j%slideCount, 23394 cloneFirst = slideItems[num].cloneNode(true); 23395 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(cloneFirst, slideClonedClass); 23396 Object(_helpers_removeAttrs_js__WEBPACK_IMPORTED_MODULE_22__["removeAttrs"])(cloneFirst, 'id'); 23397 fragmentAfter.insertBefore(cloneFirst, fragmentAfter.firstChild); 23398 23399 if (carousel) { 23400 var cloneLast = slideItems[slideCount - 1 - num].cloneNode(true); 23401 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(cloneLast, slideClonedClass); 23402 Object(_helpers_removeAttrs_js__WEBPACK_IMPORTED_MODULE_22__["removeAttrs"])(cloneLast, 'id'); 23403 fragmentBefore.appendChild(cloneLast); 23404 } 23405 } 23406 23407 container.insertBefore(fragmentBefore, container.firstChild); 23408 container.appendChild(fragmentAfter); 23409 slideItems = container.children; 23410 } 23411 23412 } 23413 23414 function initSliderTransform () { 23415 // ## images loaded/failed 23416 if (hasOption('autoHeight') || autoWidth || !horizontal) { 23417 var imgs = container.querySelectorAll('img'); 23418 23419 // add img load event listener 23420 Object(_helpers_forEach_js__WEBPACK_IMPORTED_MODULE_15__["forEach"])(imgs, function(img) { 23421 var src = img.src; 23422 23423 if (!lazyload) { 23424 // not data img 23425 if (src && src.indexOf('data:image') < 0) { 23426 img.src = ''; 23427 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(img, imgEvents); 23428 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(img, 'loading'); 23429 23430 img.src = src; 23431 // data img 23432 } else { 23433 imgLoaded(img); 23434 } 23435 } 23436 }); 23437 23438 // set imgsComplete 23439 Object(_helpers_raf_js__WEBPACK_IMPORTED_MODULE_0__["raf"])(function(){ imgsLoadedCheck(Object(_helpers_arrayFromNodeList_js__WEBPACK_IMPORTED_MODULE_23__["arrayFromNodeList"])(imgs), function() { imgsComplete = true; }); }); 23440 23441 // reset imgs for auto height: check visible imgs only 23442 if (hasOption('autoHeight')) { imgs = getImageArray(index, Math.min(index + items - 1, slideCountNew - 1)); } 23443 23444 lazyload ? initSliderTransformStyleCheck() : Object(_helpers_raf_js__WEBPACK_IMPORTED_MODULE_0__["raf"])(function(){ imgsLoadedCheck(Object(_helpers_arrayFromNodeList_js__WEBPACK_IMPORTED_MODULE_23__["arrayFromNodeList"])(imgs), initSliderTransformStyleCheck); }); 23445 23446 } else { 23447 // set container transform property 23448 if (carousel) { doContainerTransformSilent(); } 23449 23450 // update slider tools and events 23451 initTools(); 23452 initEvents(); 23453 } 23454 } 23455 23456 function initSliderTransformStyleCheck () { 23457 if (autoWidth && slideCount > 1) { 23458 // check styles application 23459 var num = loop ? index : slideCount - 1; 23460 23461 (function stylesApplicationCheck() { 23462 var left = slideItems[num].getBoundingClientRect().left; 23463 var right = slideItems[num - 1].getBoundingClientRect().right; 23464 23465 (Math.abs(left - right) <= 1) ? 23466 initSliderTransformCore() : 23467 setTimeout(function(){ stylesApplicationCheck() }, 16); 23468 })(); 23469 23470 } else { 23471 initSliderTransformCore(); 23472 } 23473 } 23474 23475 23476 function initSliderTransformCore () { 23477 // run Fn()s which are rely on image loading 23478 if (!horizontal || autoWidth) { 23479 setSlidePositions(); 23480 23481 if (autoWidth) { 23482 rightBoundary = getRightBoundary(); 23483 if (freezable) { freeze = getFreeze(); } 23484 indexMax = getIndexMax(); // <= slidePositions, rightBoundary <= 23485 resetVariblesWhenDisable(disable || freeze); 23486 } else { 23487 updateContentWrapperHeight(); 23488 } 23489 } 23490 23491 // set container transform property 23492 if (carousel) { doContainerTransformSilent(); } 23493 23494 // update slider tools and events 23495 initTools(); 23496 initEvents(); 23497 } 23498 23499 function initSheet () { 23500 // gallery: 23501 // set animation classes and left value for gallery slider 23502 if (!carousel) { 23503 for (var i = index, l = index + Math.min(slideCount, items); i < l; i++) { 23504 var item = slideItems[i]; 23505 item.style.left = (i - index) * 100 / items + '%'; 23506 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(item, animateIn); 23507 Object(_helpers_removeClass_js__WEBPACK_IMPORTED_MODULE_18__["removeClass"])(item, animateNormal); 23508 } 23509 } 23510 23511 // #### LAYOUT 23512 23513 // ## INLINE-BLOCK VS FLOAT 23514 23515 // ## PercentageLayout: 23516 // slides: inline-block 23517 // remove blank space between slides by set font-size: 0 23518 23519 // ## Non PercentageLayout: 23520 // slides: float 23521 // margin-right: -100% 23522 // margin-left: ~ 23523 23524 // Resource: https://docs.google.com/spreadsheets/d/147up245wwTXeQYve3BRSAD4oVcvQmuGsFteJOeA5xNQ/edit?usp=sharing 23525 if (horizontal) { 23526 if (PERCENTAGELAYOUT || autoWidth) { 23527 Object(_helpers_addCSSRule_js__WEBPACK_IMPORTED_MODULE_10__["addCSSRule"])(sheet, '#' + slideId + ' > .tns-item', 'font-size:' + win.getComputedStyle(slideItems[0]).fontSize + ';', Object(_helpers_getCssRulesLength_js__WEBPACK_IMPORTED_MODULE_12__["getCssRulesLength"])(sheet)); 23528 Object(_helpers_addCSSRule_js__WEBPACK_IMPORTED_MODULE_10__["addCSSRule"])(sheet, '#' + slideId, 'font-size:0;', Object(_helpers_getCssRulesLength_js__WEBPACK_IMPORTED_MODULE_12__["getCssRulesLength"])(sheet)); 23529 } else if (carousel) { 23530 Object(_helpers_forEach_js__WEBPACK_IMPORTED_MODULE_15__["forEach"])(slideItems, function (slide, i) { 23531 slide.style.marginLeft = getSlideMarginLeft(i); 23532 }); 23533 } 23534 } 23535 23536 23537 // ## BASIC STYLES 23538 if (CSSMQ) { 23539 // middle wrapper style 23540 if (TRANSITIONDURATION) { 23541 var str = middleWrapper && options.autoHeight ? getTransitionDurationStyle(options.speed) : ''; 23542 Object(_helpers_addCSSRule_js__WEBPACK_IMPORTED_MODULE_10__["addCSSRule"])(sheet, '#' + slideId + '-mw', str, Object(_helpers_getCssRulesLength_js__WEBPACK_IMPORTED_MODULE_12__["getCssRulesLength"])(sheet)); 23543 } 23544 23545 // inner wrapper styles 23546 str = getInnerWrapperStyles(options.edgePadding, options.gutter, options.fixedWidth, options.speed, options.autoHeight); 23547 Object(_helpers_addCSSRule_js__WEBPACK_IMPORTED_MODULE_10__["addCSSRule"])(sheet, '#' + slideId + '-iw', str, Object(_helpers_getCssRulesLength_js__WEBPACK_IMPORTED_MODULE_12__["getCssRulesLength"])(sheet)); 23548 23549 // container styles 23550 if (carousel) { 23551 str = horizontal && !autoWidth ? 'width:' + getContainerWidth(options.fixedWidth, options.gutter, options.items) + ';' : ''; 23552 if (TRANSITIONDURATION) { str += getTransitionDurationStyle(speed); } 23553 Object(_helpers_addCSSRule_js__WEBPACK_IMPORTED_MODULE_10__["addCSSRule"])(sheet, '#' + slideId, str, Object(_helpers_getCssRulesLength_js__WEBPACK_IMPORTED_MODULE_12__["getCssRulesLength"])(sheet)); 23554 } 23555 23556 // slide styles 23557 str = horizontal && !autoWidth ? getSlideWidthStyle(options.fixedWidth, options.gutter, options.items) : ''; 23558 if (options.gutter) { str += getSlideGutterStyle(options.gutter); } 23559 // set gallery items transition-duration 23560 if (!carousel) { 23561 if (TRANSITIONDURATION) { str += getTransitionDurationStyle(speed); } 23562 if (ANIMATIONDURATION) { str += getAnimationDurationStyle(speed); } 23563 } 23564 if (str) { Object(_helpers_addCSSRule_js__WEBPACK_IMPORTED_MODULE_10__["addCSSRule"])(sheet, '#' + slideId + ' > .tns-item', str, Object(_helpers_getCssRulesLength_js__WEBPACK_IMPORTED_MODULE_12__["getCssRulesLength"])(sheet)); } 23565 23566 // non CSS mediaqueries: IE8 23567 // ## update inner wrapper, container, slides if needed 23568 // set inline styles for inner wrapper & container 23569 // insert stylesheet (one line) for slides only (since slides are many) 23570 } else { 23571 // middle wrapper styles 23572 update_carousel_transition_duration(); 23573 23574 // inner wrapper styles 23575 innerWrapper.style.cssText = getInnerWrapperStyles(edgePadding, gutter, fixedWidth, autoHeight); 23576 23577 // container styles 23578 if (carousel && horizontal && !autoWidth) { 23579 container.style.width = getContainerWidth(fixedWidth, gutter, items); 23580 } 23581 23582 // slide styles 23583 var str = horizontal && !autoWidth ? getSlideWidthStyle(fixedWidth, gutter, items) : ''; 23584 if (gutter) { str += getSlideGutterStyle(gutter); } 23585 23586 // append to the last line 23587 if (str) { Object(_helpers_addCSSRule_js__WEBPACK_IMPORTED_MODULE_10__["addCSSRule"])(sheet, '#' + slideId + ' > .tns-item', str, Object(_helpers_getCssRulesLength_js__WEBPACK_IMPORTED_MODULE_12__["getCssRulesLength"])(sheet)); } 23588 } 23589 23590 // ## MEDIAQUERIES 23591 if (responsive && CSSMQ) { 23592 for (var bp in responsive) { 23593 // bp: convert string to number 23594 bp = parseInt(bp); 23595 23596 var opts = responsive[bp], 23597 str = '', 23598 middleWrapperStr = '', 23599 innerWrapperStr = '', 23600 containerStr = '', 23601 slideStr = '', 23602 itemsBP = !autoWidth ? getOption('items', bp) : null, 23603 fixedWidthBP = getOption('fixedWidth', bp), 23604 speedBP = getOption('speed', bp), 23605 edgePaddingBP = getOption('edgePadding', bp), 23606 autoHeightBP = getOption('autoHeight', bp), 23607 gutterBP = getOption('gutter', bp); 23608 23609 // middle wrapper string 23610 if (TRANSITIONDURATION && middleWrapper && getOption('autoHeight', bp) && 'speed' in opts) { 23611 middleWrapperStr = '#' + slideId + '-mw{' + getTransitionDurationStyle(speedBP) + '}'; 23612 } 23613 23614 // inner wrapper string 23615 if ('edgePadding' in opts || 'gutter' in opts) { 23616 innerWrapperStr = '#' + slideId + '-iw{' + getInnerWrapperStyles(edgePaddingBP, gutterBP, fixedWidthBP, speedBP, autoHeightBP) + '}'; 23617 } 23618 23619 // container string 23620 if (carousel && horizontal && !autoWidth && ('fixedWidth' in opts || 'items' in opts || (fixedWidth && 'gutter' in opts))) { 23621 containerStr = 'width:' + getContainerWidth(fixedWidthBP, gutterBP, itemsBP) + ';'; 23622 } 23623 if (TRANSITIONDURATION && 'speed' in opts) { 23624 containerStr += getTransitionDurationStyle(speedBP); 23625 } 23626 if (containerStr) { 23627 containerStr = '#' + slideId + '{' + containerStr + '}'; 23628 } 23629 23630 // slide string 23631 if ('fixedWidth' in opts || (fixedWidth && 'gutter' in opts) || !carousel && 'items' in opts) { 23632 slideStr += getSlideWidthStyle(fixedWidthBP, gutterBP, itemsBP); 23633 } 23634 if ('gutter' in opts) { 23635 slideStr += getSlideGutterStyle(gutterBP); 23636 } 23637 // set gallery items transition-duration 23638 if (!carousel && 'speed' in opts) { 23639 if (TRANSITIONDURATION) { slideStr += getTransitionDurationStyle(speedBP); } 23640 if (ANIMATIONDURATION) { slideStr += getAnimationDurationStyle(speedBP); } 23641 } 23642 if (slideStr) { slideStr = '#' + slideId + ' > .tns-item{' + slideStr + '}'; } 23643 23644 // add up 23645 str = middleWrapperStr + innerWrapperStr + containerStr + slideStr; 23646 23647 if (str) { 23648 sheet.insertRule('@media (min-width: ' + bp / 16 + 'em) {' + str + '}', sheet.cssRules.length); 23649 } 23650 } 23651 } 23652 } 23653 23654 function initTools () { 23655 // == slides == 23656 updateSlideStatus(); 23657 23658 // == live region == 23659 outerWrapper.insertAdjacentHTML('afterbegin', '<div class="tns-liveregion tns-visually-hidden" aria-live="polite" aria-atomic="true">slide <span class="current">' + getLiveRegionStr() + '</span> of ' + slideCount + '</div>'); 23660 liveregionCurrent = outerWrapper.querySelector('.tns-liveregion .current'); 23661 23662 // == autoplayInit == 23663 if (hasAutoplay) { 23664 var txt = autoplay ? 'stop' : 'start'; 23665 if (autoplayButton) { 23666 Object(_helpers_setAttrs_js__WEBPACK_IMPORTED_MODULE_21__["setAttrs"])(autoplayButton, {'data-action': txt}); 23667 } else if (options.autoplayButtonOutput) { 23668 outerWrapper.insertAdjacentHTML(getInsertPosition(options.autoplayPosition), '<button type="button" data-action="' + txt + '">' + autoplayHtmlStrings[0] + txt + autoplayHtmlStrings[1] + autoplayText[0] + '</button>'); 23669 autoplayButton = outerWrapper.querySelector('[data-action]'); 23670 } 23671 23672 // add event 23673 if (autoplayButton) { 23674 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(autoplayButton, {'click': toggleAutoplay}); 23675 } 23676 23677 if (autoplay) { 23678 startAutoplay(); 23679 if (autoplayHoverPause) { Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(container, hoverEvents); } 23680 if (autoplayResetOnVisibility) { Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(container, visibilityEvent); } 23681 } 23682 } 23683 23684 // == navInit == 23685 if (hasNav) { 23686 var initIndex = !carousel ? 0 : cloneCount; 23687 // customized nav 23688 // will not hide the navs in case they're thumbnails 23689 if (navContainer) { 23690 Object(_helpers_setAttrs_js__WEBPACK_IMPORTED_MODULE_21__["setAttrs"])(navContainer, {'aria-label': 'Carousel Pagination'}); 23691 navItems = navContainer.children; 23692 Object(_helpers_forEach_js__WEBPACK_IMPORTED_MODULE_15__["forEach"])(navItems, function(item, i) { 23693 Object(_helpers_setAttrs_js__WEBPACK_IMPORTED_MODULE_21__["setAttrs"])(item, { 23694 'data-nav': i, 23695 'tabindex': '-1', 23696 'aria-label': navStr + (i + 1), 23697 'aria-controls': slideId, 23698 }); 23699 }); 23700 23701 // generated nav 23702 } else { 23703 var navHtml = '', 23704 hiddenStr = navAsThumbnails ? '' : 'style="display:none"'; 23705 for (var i = 0; i < slideCount; i++) { 23706 // hide nav items by default 23707 navHtml += '<button type="button" data-nav="' + i +'" tabindex="-1" aria-controls="' + slideId + '" ' + hiddenStr + ' aria-label="' + navStr + (i + 1) +'"></button>'; 23708 } 23709 navHtml = '<div class="tns-nav" aria-label="Carousel Pagination">' + navHtml + '</div>'; 23710 outerWrapper.insertAdjacentHTML(getInsertPosition(options.navPosition), navHtml); 23711 23712 navContainer = outerWrapper.querySelector('.tns-nav'); 23713 navItems = navContainer.children; 23714 } 23715 23716 updateNavVisibility(); 23717 23718 // add transition 23719 if (TRANSITIONDURATION) { 23720 var prefix = TRANSITIONDURATION.substring(0, TRANSITIONDURATION.length - 18).toLowerCase(), 23721 str = 'transition: all ' + speed / 1000 + 's'; 23722 23723 if (prefix) { 23724 str = '-' + prefix + '-' + str; 23725 } 23726 23727 Object(_helpers_addCSSRule_js__WEBPACK_IMPORTED_MODULE_10__["addCSSRule"])(sheet, '[aria-controls^=' + slideId + '-item]', str, Object(_helpers_getCssRulesLength_js__WEBPACK_IMPORTED_MODULE_12__["getCssRulesLength"])(sheet)); 23728 } 23729 23730 Object(_helpers_setAttrs_js__WEBPACK_IMPORTED_MODULE_21__["setAttrs"])(navItems[navCurrentIndex], {'aria-label': navStr + (navCurrentIndex + 1) + navStrCurrent}); 23731 Object(_helpers_removeAttrs_js__WEBPACK_IMPORTED_MODULE_22__["removeAttrs"])(navItems[navCurrentIndex], 'tabindex'); 23732 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(navItems[navCurrentIndex], navActiveClass); 23733 23734 // add events 23735 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(navContainer, navEvents); 23736 } 23737 23738 23739 23740 // == controlsInit == 23741 if (hasControls) { 23742 if (!controlsContainer && (!prevButton || !nextButton)) { 23743 outerWrapper.insertAdjacentHTML(getInsertPosition(options.controlsPosition), '<div class="tns-controls" aria-label="Carousel Navigation" tabindex="0"><button type="button" data-controls="prev" tabindex="-1" aria-controls="' + slideId +'">' + controlsText[0] + '</button><button type="button" data-controls="next" tabindex="-1" aria-controls="' + slideId +'">' + controlsText[1] + '</button></div>'); 23744 23745 controlsContainer = outerWrapper.querySelector('.tns-controls'); 23746 } 23747 23748 if (!prevButton || !nextButton) { 23749 prevButton = controlsContainer.children[0]; 23750 nextButton = controlsContainer.children[1]; 23751 } 23752 23753 if (options.controlsContainer) { 23754 Object(_helpers_setAttrs_js__WEBPACK_IMPORTED_MODULE_21__["setAttrs"])(controlsContainer, { 23755 'aria-label': 'Carousel Navigation', 23756 'tabindex': '0' 23757 }); 23758 } 23759 23760 if (options.controlsContainer || (options.prevButton && options.nextButton)) { 23761 Object(_helpers_setAttrs_js__WEBPACK_IMPORTED_MODULE_21__["setAttrs"])([prevButton, nextButton], { 23762 'aria-controls': slideId, 23763 'tabindex': '-1', 23764 }); 23765 } 23766 23767 if (options.controlsContainer || (options.prevButton && options.nextButton)) { 23768 Object(_helpers_setAttrs_js__WEBPACK_IMPORTED_MODULE_21__["setAttrs"])(prevButton, {'data-controls' : 'prev'}); 23769 Object(_helpers_setAttrs_js__WEBPACK_IMPORTED_MODULE_21__["setAttrs"])(nextButton, {'data-controls' : 'next'}); 23770 } 23771 23772 prevIsButton = isButton(prevButton); 23773 nextIsButton = isButton(nextButton); 23774 23775 updateControlsStatus(); 23776 23777 // add events 23778 if (controlsContainer) { 23779 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(controlsContainer, controlsEvents); 23780 } else { 23781 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(prevButton, controlsEvents); 23782 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(nextButton, controlsEvents); 23783 } 23784 } 23785 23786 // hide tools if needed 23787 disableUI(); 23788 } 23789 23790 function initEvents () { 23791 // add events 23792 if (carousel && TRANSITIONEND) { 23793 var eve = {}; 23794 eve[TRANSITIONEND] = onTransitionEnd; 23795 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(container, eve); 23796 } 23797 23798 if (touch) { Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(container, touchEvents, options.preventScrollOnTouch); } 23799 if (mouseDrag) { Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(container, dragEvents); } 23800 if (arrowKeys) { Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(doc, docmentKeydownEvent); } 23801 23802 if (nested === 'inner') { 23803 events.on('outerResized', function () { 23804 resizeTasks(); 23805 events.emit('innerLoaded', info()); 23806 }); 23807 } else if (responsive || fixedWidth || autoWidth || autoHeight || !horizontal) { 23808 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(win, {'resize': onResize}); 23809 } 23810 23811 if (autoHeight) { 23812 if (nested === 'outer') { 23813 events.on('innerLoaded', doAutoHeight); 23814 } else if (!disable) { doAutoHeight(); } 23815 } 23816 23817 doLazyLoad(); 23818 if (disable) { disableSlider(); } else if (freeze) { freezeSlider(); } 23819 23820 events.on('indexChanged', additionalUpdates); 23821 if (nested === 'inner') { events.emit('innerLoaded', info()); } 23822 if (typeof onInit === 'function') { onInit(info()); } 23823 isOn = true; 23824 } 23825 23826 function destroy () { 23827 // sheet 23828 sheet.disabled = true; 23829 if (sheet.ownerNode) { sheet.ownerNode.remove(); } 23830 23831 // remove win event listeners 23832 Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(win, {'resize': onResize}); 23833 23834 // arrowKeys, controls, nav 23835 if (arrowKeys) { Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(doc, docmentKeydownEvent); } 23836 if (controlsContainer) { Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(controlsContainer, controlsEvents); } 23837 if (navContainer) { Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(navContainer, navEvents); } 23838 23839 // autoplay 23840 Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(container, hoverEvents); 23841 Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(container, visibilityEvent); 23842 if (autoplayButton) { Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(autoplayButton, {'click': toggleAutoplay}); } 23843 if (autoplay) { clearInterval(autoplayTimer); } 23844 23845 // container 23846 if (carousel && TRANSITIONEND) { 23847 var eve = {}; 23848 eve[TRANSITIONEND] = onTransitionEnd; 23849 Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(container, eve); 23850 } 23851 if (touch) { Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(container, touchEvents); } 23852 if (mouseDrag) { Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(container, dragEvents); } 23853 23854 // cache Object values in options && reset HTML 23855 var htmlList = [containerHTML, controlsContainerHTML, prevButtonHTML, nextButtonHTML, navContainerHTML, autoplayButtonHTML]; 23856 23857 tnsList.forEach(function(item, i) { 23858 var el = item === 'container' ? outerWrapper : options[item]; 23859 23860 if (typeof el === 'object' && el) { 23861 var prevEl = el.previousElementSibling ? el.previousElementSibling : false, 23862 parentEl = el.parentNode; 23863 el.outerHTML = htmlList[i]; 23864 options[item] = prevEl ? prevEl.nextElementSibling : parentEl.firstElementChild; 23865 } 23866 }); 23867 23868 23869 // reset variables 23870 tnsList = animateIn = animateOut = animateDelay = animateNormal = horizontal = outerWrapper = innerWrapper = container = containerParent = containerHTML = slideItems = slideCount = breakpointZone = windowWidth = autoWidth = fixedWidth = edgePadding = gutter = viewport = items = slideBy = viewportMax = arrowKeys = speed = rewind = loop = autoHeight = sheet = lazyload = slidePositions = slideItemsOut = cloneCount = slideCountNew = hasRightDeadZone = rightBoundary = updateIndexBeforeTransform = transformAttr = transformPrefix = transformPostfix = getIndexMax = index = indexCached = indexMin = indexMax = resizeTimer = swipeAngle = moveDirectionExpected = running = onInit = events = newContainerClasses = slideId = disable = disabled = freezable = freeze = frozen = controlsEvents = navEvents = hoverEvents = visibilityEvent = docmentKeydownEvent = touchEvents = dragEvents = hasControls = hasNav = navAsThumbnails = hasAutoplay = hasTouch = hasMouseDrag = slideActiveClass = imgCompleteClass = imgEvents = imgsComplete = controls = controlsText = controlsContainer = controlsContainerHTML = prevButton = nextButton = prevIsButton = nextIsButton = nav = navContainer = navContainerHTML = navItems = pages = pagesCached = navClicked = navCurrentIndex = navCurrentIndexCached = navActiveClass = navStr = navStrCurrent = autoplay = autoplayTimeout = autoplayDirection = autoplayText = autoplayHoverPause = autoplayButton = autoplayButtonHTML = autoplayResetOnVisibility = autoplayHtmlStrings = autoplayTimer = animating = autoplayHoverPaused = autoplayUserPaused = autoplayVisibilityPaused = initPosition = lastPosition = translateInit = disX = disY = panStart = rafIndex = getDist = touch = mouseDrag = null; 23871 // check variables 23872 // [animateIn, animateOut, animateDelay, animateNormal, horizontal, outerWrapper, innerWrapper, container, containerParent, containerHTML, slideItems, slideCount, breakpointZone, windowWidth, autoWidth, fixedWidth, edgePadding, gutter, viewport, items, slideBy, viewportMax, arrowKeys, speed, rewind, loop, autoHeight, sheet, lazyload, slidePositions, slideItemsOut, cloneCount, slideCountNew, hasRightDeadZone, rightBoundary, updateIndexBeforeTransform, transformAttr, transformPrefix, transformPostfix, getIndexMax, index, indexCached, indexMin, indexMax, resizeTimer, swipeAngle, moveDirectionExpected, running, onInit, events, newContainerClasses, slideId, disable, disabled, freezable, freeze, frozen, controlsEvents, navEvents, hoverEvents, visibilityEvent, docmentKeydownEvent, touchEvents, dragEvents, hasControls, hasNav, navAsThumbnails, hasAutoplay, hasTouch, hasMouseDrag, slideActiveClass, imgCompleteClass, imgEvents, imgsComplete, controls, controlsText, controlsContainer, controlsContainerHTML, prevButton, nextButton, prevIsButton, nextIsButton, nav, navContainer, navContainerHTML, navItems, pages, pagesCached, navClicked, navCurrentIndex, navCurrentIndexCached, navActiveClass, navStr, navStrCurrent, autoplay, autoplayTimeout, autoplayDirection, autoplayText, autoplayHoverPause, autoplayButton, autoplayButtonHTML, autoplayResetOnVisibility, autoplayHtmlStrings, autoplayTimer, animating, autoplayHoverPaused, autoplayUserPaused, autoplayVisibilityPaused, initPosition, lastPosition, translateInit, disX, disY, panStart, rafIndex, getDist, touch, mouseDrag ].forEach(function(item) { if (item !== null) { console.log(item); } }); 23873 23874 for (var a in this) { 23875 if (a !== 'rebuild') { this[a] = null; } 23876 } 23877 isOn = false; 23878 } 23879 23880// === ON RESIZE === 23881 // responsive || fixedWidth || autoWidth || !horizontal 23882 function onResize (e) { 23883 Object(_helpers_raf_js__WEBPACK_IMPORTED_MODULE_0__["raf"])(function(){ resizeTasks(getEvent(e)); }); 23884 } 23885 23886 function resizeTasks (e) { 23887 if (!isOn) { return; } 23888 if (nested === 'outer') { events.emit('outerResized', info(e)); } 23889 windowWidth = getWindowWidth(); 23890 var bpChanged, 23891 breakpointZoneTem = breakpointZone, 23892 needContainerTransform = false; 23893 23894 if (responsive) { 23895 setBreakpointZone(); 23896 bpChanged = breakpointZoneTem !== breakpointZone; 23897 // if (hasRightDeadZone) { needContainerTransform = true; } // *? 23898 if (bpChanged) { events.emit('newBreakpointStart', info(e)); } 23899 } 23900 23901 var indChanged, 23902 itemsChanged, 23903 itemsTem = items, 23904 disableTem = disable, 23905 freezeTem = freeze, 23906 arrowKeysTem = arrowKeys, 23907 controlsTem = controls, 23908 navTem = nav, 23909 touchTem = touch, 23910 mouseDragTem = mouseDrag, 23911 autoplayTem = autoplay, 23912 autoplayHoverPauseTem = autoplayHoverPause, 23913 autoplayResetOnVisibilityTem = autoplayResetOnVisibility, 23914 indexTem = index; 23915 23916 if (bpChanged) { 23917 var fixedWidthTem = fixedWidth, 23918 autoHeightTem = autoHeight, 23919 controlsTextTem = controlsText, 23920 centerTem = center, 23921 autoplayTextTem = autoplayText; 23922 23923 if (!CSSMQ) { 23924 var gutterTem = gutter, 23925 edgePaddingTem = edgePadding; 23926 } 23927 } 23928 23929 // get option: 23930 // fixed width: viewport, fixedWidth, gutter => items 23931 // others: window width => all variables 23932 // all: items => slideBy 23933 arrowKeys = getOption('arrowKeys'); 23934 controls = getOption('controls'); 23935 nav = getOption('nav'); 23936 touch = getOption('touch'); 23937 center = getOption('center'); 23938 mouseDrag = getOption('mouseDrag'); 23939 autoplay = getOption('autoplay'); 23940 autoplayHoverPause = getOption('autoplayHoverPause'); 23941 autoplayResetOnVisibility = getOption('autoplayResetOnVisibility'); 23942 23943 if (bpChanged) { 23944 disable = getOption('disable'); 23945 fixedWidth = getOption('fixedWidth'); 23946 speed = getOption('speed'); 23947 autoHeight = getOption('autoHeight'); 23948 controlsText = getOption('controlsText'); 23949 autoplayText = getOption('autoplayText'); 23950 autoplayTimeout = getOption('autoplayTimeout'); 23951 23952 if (!CSSMQ) { 23953 edgePadding = getOption('edgePadding'); 23954 gutter = getOption('gutter'); 23955 } 23956 } 23957 // update options 23958 resetVariblesWhenDisable(disable); 23959 23960 viewport = getViewportWidth(); // <= edgePadding, gutter 23961 if ((!horizontal || autoWidth) && !disable) { 23962 setSlidePositions(); 23963 if (!horizontal) { 23964 updateContentWrapperHeight(); // <= setSlidePositions 23965 needContainerTransform = true; 23966 } 23967 } 23968 if (fixedWidth || autoWidth) { 23969 rightBoundary = getRightBoundary(); // autoWidth: <= viewport, slidePositions, gutter 23970 // fixedWidth: <= viewport, fixedWidth, gutter 23971 indexMax = getIndexMax(); // autoWidth: <= rightBoundary, slidePositions 23972 // fixedWidth: <= rightBoundary, fixedWidth, gutter 23973 } 23974 23975 if (bpChanged || fixedWidth) { 23976 items = getOption('items'); 23977 slideBy = getOption('slideBy'); 23978 itemsChanged = items !== itemsTem; 23979 23980 if (itemsChanged) { 23981 if (!fixedWidth && !autoWidth) { indexMax = getIndexMax(); } // <= items 23982 // check index before transform in case 23983 // slider reach the right edge then items become bigger 23984 updateIndex(); 23985 } 23986 } 23987 23988 if (bpChanged) { 23989 if (disable !== disableTem) { 23990 if (disable) { 23991 disableSlider(); 23992 } else { 23993 enableSlider(); // <= slidePositions, rightBoundary, indexMax 23994 } 23995 } 23996 } 23997 23998 if (freezable && (bpChanged || fixedWidth || autoWidth)) { 23999 freeze = getFreeze(); // <= autoWidth: slidePositions, gutter, viewport, rightBoundary 24000 // <= fixedWidth: fixedWidth, gutter, rightBoundary 24001 // <= others: items 24002 24003 if (freeze !== freezeTem) { 24004 if (freeze) { 24005 doContainerTransform(getContainerTransformValue(getStartIndex(0))); 24006 freezeSlider(); 24007 } else { 24008 unfreezeSlider(); 24009 needContainerTransform = true; 24010 } 24011 } 24012 } 24013 24014 resetVariblesWhenDisable(disable || freeze); // controls, nav, touch, mouseDrag, arrowKeys, autoplay, autoplayHoverPause, autoplayResetOnVisibility 24015 if (!autoplay) { autoplayHoverPause = autoplayResetOnVisibility = false; } 24016 24017 if (arrowKeys !== arrowKeysTem) { 24018 arrowKeys ? 24019 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(doc, docmentKeydownEvent) : 24020 Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(doc, docmentKeydownEvent); 24021 } 24022 if (controls !== controlsTem) { 24023 if (controls) { 24024 if (controlsContainer) { 24025 Object(_helpers_showElement_js__WEBPACK_IMPORTED_MODULE_25__["showElement"])(controlsContainer); 24026 } else { 24027 if (prevButton) { Object(_helpers_showElement_js__WEBPACK_IMPORTED_MODULE_25__["showElement"])(prevButton); } 24028 if (nextButton) { Object(_helpers_showElement_js__WEBPACK_IMPORTED_MODULE_25__["showElement"])(nextButton); } 24029 } 24030 } else { 24031 if (controlsContainer) { 24032 Object(_helpers_hideElement_js__WEBPACK_IMPORTED_MODULE_24__["hideElement"])(controlsContainer); 24033 } else { 24034 if (prevButton) { Object(_helpers_hideElement_js__WEBPACK_IMPORTED_MODULE_24__["hideElement"])(prevButton); } 24035 if (nextButton) { Object(_helpers_hideElement_js__WEBPACK_IMPORTED_MODULE_24__["hideElement"])(nextButton); } 24036 } 24037 } 24038 } 24039 if (nav !== navTem) { 24040 if (nav) { 24041 Object(_helpers_showElement_js__WEBPACK_IMPORTED_MODULE_25__["showElement"])(navContainer); 24042 updateNavVisibility(); 24043 } else { 24044 Object(_helpers_hideElement_js__WEBPACK_IMPORTED_MODULE_24__["hideElement"])(navContainer) 24045 } 24046 } 24047 if (touch !== touchTem) { 24048 touch ? 24049 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(container, touchEvents, options.preventScrollOnTouch) : 24050 Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(container, touchEvents); 24051 } 24052 if (mouseDrag !== mouseDragTem) { 24053 mouseDrag ? 24054 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(container, dragEvents) : 24055 Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(container, dragEvents); 24056 } 24057 if (autoplay !== autoplayTem) { 24058 if (autoplay) { 24059 if (autoplayButton) { Object(_helpers_showElement_js__WEBPACK_IMPORTED_MODULE_25__["showElement"])(autoplayButton); } 24060 if (!animating && !autoplayUserPaused) { startAutoplay(); } 24061 } else { 24062 if (autoplayButton) { Object(_helpers_hideElement_js__WEBPACK_IMPORTED_MODULE_24__["hideElement"])(autoplayButton); } 24063 if (animating) { stopAutoplay(); } 24064 } 24065 } 24066 if (autoplayHoverPause !== autoplayHoverPauseTem) { 24067 autoplayHoverPause ? 24068 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(container, hoverEvents) : 24069 Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(container, hoverEvents); 24070 } 24071 if (autoplayResetOnVisibility !== autoplayResetOnVisibilityTem) { 24072 autoplayResetOnVisibility ? 24073 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(doc, visibilityEvent) : 24074 Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(doc, visibilityEvent); 24075 } 24076 24077 if (bpChanged) { 24078 if (fixedWidth !== fixedWidthTem || center !== centerTem) { needContainerTransform = true; } 24079 24080 if (autoHeight !== autoHeightTem) { 24081 if (!autoHeight) { innerWrapper.style.height = ''; } 24082 } 24083 24084 if (controls && controlsText !== controlsTextTem) { 24085 prevButton.innerHTML = controlsText[0]; 24086 nextButton.innerHTML = controlsText[1]; 24087 } 24088 24089 if (autoplayButton && autoplayText !== autoplayTextTem) { 24090 var i = autoplay ? 1 : 0, 24091 html = autoplayButton.innerHTML, 24092 len = html.length - autoplayTextTem[i].length; 24093 if (html.substring(len) === autoplayTextTem[i]) { 24094 autoplayButton.innerHTML = html.substring(0, len) + autoplayText[i]; 24095 } 24096 } 24097 } else { 24098 if (center && (fixedWidth || autoWidth)) { needContainerTransform = true; } 24099 } 24100 24101 if (itemsChanged || fixedWidth && !autoWidth) { 24102 pages = getPages(); 24103 updateNavVisibility(); 24104 } 24105 24106 indChanged = index !== indexTem; 24107 if (indChanged) { 24108 events.emit('indexChanged', info()); 24109 needContainerTransform = true; 24110 } else if (itemsChanged) { 24111 if (!indChanged) { additionalUpdates(); } 24112 } else if (fixedWidth || autoWidth) { 24113 doLazyLoad(); 24114 updateSlideStatus(); 24115 updateLiveRegion(); 24116 } 24117 24118 if (itemsChanged && !carousel) { updateGallerySlidePositions(); } 24119 24120 if (!disable && !freeze) { 24121 // non-mediaqueries: IE8 24122 if (bpChanged && !CSSMQ) { 24123 // middle wrapper styles 24124 24125 // inner wrapper styles 24126 if (edgePadding !== edgePaddingTem || gutter !== gutterTem) { 24127 innerWrapper.style.cssText = getInnerWrapperStyles(edgePadding, gutter, fixedWidth, speed, autoHeight); 24128 } 24129 24130 if (horizontal) { 24131 // container styles 24132 if (carousel) { 24133 container.style.width = getContainerWidth(fixedWidth, gutter, items); 24134 } 24135 24136 // slide styles 24137 var str = getSlideWidthStyle(fixedWidth, gutter, items) + 24138 getSlideGutterStyle(gutter); 24139 24140 // remove the last line and 24141 // add new styles 24142 Object(_helpers_removeCSSRule_js__WEBPACK_IMPORTED_MODULE_11__["removeCSSRule"])(sheet, Object(_helpers_getCssRulesLength_js__WEBPACK_IMPORTED_MODULE_12__["getCssRulesLength"])(sheet) - 1); 24143 Object(_helpers_addCSSRule_js__WEBPACK_IMPORTED_MODULE_10__["addCSSRule"])(sheet, '#' + slideId + ' > .tns-item', str, Object(_helpers_getCssRulesLength_js__WEBPACK_IMPORTED_MODULE_12__["getCssRulesLength"])(sheet)); 24144 } 24145 } 24146 24147 // auto height 24148 if (autoHeight) { doAutoHeight(); } 24149 24150 if (needContainerTransform) { 24151 doContainerTransformSilent(); 24152 indexCached = index; 24153 } 24154 } 24155 24156 if (bpChanged) { events.emit('newBreakpointEnd', info(e)); } 24157 } 24158 24159 24160 24161 24162 24163 // === INITIALIZATION FUNCTIONS === // 24164 function getFreeze () { 24165 if (!fixedWidth && !autoWidth) { 24166 var a = center ? items - (items - 1) / 2 : items; 24167 return slideCount <= a; 24168 } 24169 24170 var width = fixedWidth ? (fixedWidth + gutter) * slideCount : slidePositions[slideCount], 24171 vp = edgePadding ? viewport + edgePadding * 2 : viewport + gutter; 24172 24173 if (center) { 24174 vp -= fixedWidth ? (viewport - fixedWidth) / 2 : (viewport - (slidePositions[index + 1] - slidePositions[index] - gutter)) / 2; 24175 } 24176 24177 return width <= vp; 24178 } 24179 24180 function setBreakpointZone () { 24181 breakpointZone = 0; 24182 for (var bp in responsive) { 24183 bp = parseInt(bp); // convert string to number 24184 if (windowWidth >= bp) { breakpointZone = bp; } 24185 } 24186 } 24187 24188 // (slideBy, indexMin, indexMax) => index 24189 var updateIndex = (function () { 24190 return loop ? 24191 carousel ? 24192 // loop + carousel 24193 function () { 24194 var leftEdge = indexMin, 24195 rightEdge = indexMax; 24196 24197 leftEdge += slideBy; 24198 rightEdge -= slideBy; 24199 24200 // adjust edges when has edge paddings 24201 // or fixed-width slider with extra space on the right side 24202 if (edgePadding) { 24203 leftEdge += 1; 24204 rightEdge -= 1; 24205 } else if (fixedWidth) { 24206 if ((viewport + gutter)%(fixedWidth + gutter)) { rightEdge -= 1; } 24207 } 24208 24209 if (cloneCount) { 24210 if (index > rightEdge) { 24211 index -= slideCount; 24212 } else if (index < leftEdge) { 24213 index += slideCount; 24214 } 24215 } 24216 } : 24217 // loop + gallery 24218 function() { 24219 if (index > indexMax) { 24220 while (index >= indexMin + slideCount) { index -= slideCount; } 24221 } else if (index < indexMin) { 24222 while (index <= indexMax - slideCount) { index += slideCount; } 24223 } 24224 } : 24225 // non-loop 24226 function() { 24227 index = Math.max(indexMin, Math.min(indexMax, index)); 24228 }; 24229 })(); 24230 24231 function disableUI () { 24232 if (!autoplay && autoplayButton) { Object(_helpers_hideElement_js__WEBPACK_IMPORTED_MODULE_24__["hideElement"])(autoplayButton); } 24233 if (!nav && navContainer) { Object(_helpers_hideElement_js__WEBPACK_IMPORTED_MODULE_24__["hideElement"])(navContainer); } 24234 if (!controls) { 24235 if (controlsContainer) { 24236 Object(_helpers_hideElement_js__WEBPACK_IMPORTED_MODULE_24__["hideElement"])(controlsContainer); 24237 } else { 24238 if (prevButton) { Object(_helpers_hideElement_js__WEBPACK_IMPORTED_MODULE_24__["hideElement"])(prevButton); } 24239 if (nextButton) { Object(_helpers_hideElement_js__WEBPACK_IMPORTED_MODULE_24__["hideElement"])(nextButton); } 24240 } 24241 } 24242 } 24243 24244 function enableUI () { 24245 if (autoplay && autoplayButton) { Object(_helpers_showElement_js__WEBPACK_IMPORTED_MODULE_25__["showElement"])(autoplayButton); } 24246 if (nav && navContainer) { Object(_helpers_showElement_js__WEBPACK_IMPORTED_MODULE_25__["showElement"])(navContainer); } 24247 if (controls) { 24248 if (controlsContainer) { 24249 Object(_helpers_showElement_js__WEBPACK_IMPORTED_MODULE_25__["showElement"])(controlsContainer); 24250 } else { 24251 if (prevButton) { Object(_helpers_showElement_js__WEBPACK_IMPORTED_MODULE_25__["showElement"])(prevButton); } 24252 if (nextButton) { Object(_helpers_showElement_js__WEBPACK_IMPORTED_MODULE_25__["showElement"])(nextButton); } 24253 } 24254 } 24255 } 24256 24257 function freezeSlider () { 24258 if (frozen) { return; } 24259 24260 // remove edge padding from inner wrapper 24261 if (edgePadding) { innerWrapper.style.margin = '0px'; } 24262 24263 // add class tns-transparent to cloned slides 24264 if (cloneCount) { 24265 var str = 'tns-transparent'; 24266 for (var i = cloneCount; i--;) { 24267 if (carousel) { Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(slideItems[i], str); } 24268 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(slideItems[slideCountNew - i - 1], str); 24269 } 24270 } 24271 24272 // update tools 24273 disableUI(); 24274 24275 frozen = true; 24276 } 24277 24278 function unfreezeSlider () { 24279 if (!frozen) { return; } 24280 24281 // restore edge padding for inner wrapper 24282 // for mordern browsers 24283 if (edgePadding && CSSMQ) { innerWrapper.style.margin = ''; } 24284 24285 // remove class tns-transparent to cloned slides 24286 if (cloneCount) { 24287 var str = 'tns-transparent'; 24288 for (var i = cloneCount; i--;) { 24289 if (carousel) { Object(_helpers_removeClass_js__WEBPACK_IMPORTED_MODULE_18__["removeClass"])(slideItems[i], str); } 24290 Object(_helpers_removeClass_js__WEBPACK_IMPORTED_MODULE_18__["removeClass"])(slideItems[slideCountNew - i - 1], str); 24291 } 24292 } 24293 24294 // update tools 24295 enableUI(); 24296 24297 frozen = false; 24298 } 24299 24300 function disableSlider () { 24301 if (disabled) { return; } 24302 24303 sheet.disabled = true; 24304 container.className = container.className.replace(newContainerClasses.substring(1), ''); 24305 Object(_helpers_removeAttrs_js__WEBPACK_IMPORTED_MODULE_22__["removeAttrs"])(container, ['style']); 24306 if (loop) { 24307 for (var j = cloneCount; j--;) { 24308 if (carousel) { Object(_helpers_hideElement_js__WEBPACK_IMPORTED_MODULE_24__["hideElement"])(slideItems[j]); } 24309 Object(_helpers_hideElement_js__WEBPACK_IMPORTED_MODULE_24__["hideElement"])(slideItems[slideCountNew - j - 1]); 24310 } 24311 } 24312 24313 // vertical slider 24314 if (!horizontal || !carousel) { Object(_helpers_removeAttrs_js__WEBPACK_IMPORTED_MODULE_22__["removeAttrs"])(innerWrapper, ['style']); } 24315 24316 // gallery 24317 if (!carousel) { 24318 for (var i = index, l = index + slideCount; i < l; i++) { 24319 var item = slideItems[i]; 24320 Object(_helpers_removeAttrs_js__WEBPACK_IMPORTED_MODULE_22__["removeAttrs"])(item, ['style']); 24321 Object(_helpers_removeClass_js__WEBPACK_IMPORTED_MODULE_18__["removeClass"])(item, animateIn); 24322 Object(_helpers_removeClass_js__WEBPACK_IMPORTED_MODULE_18__["removeClass"])(item, animateNormal); 24323 } 24324 } 24325 24326 // update tools 24327 disableUI(); 24328 24329 disabled = true; 24330 } 24331 24332 function enableSlider () { 24333 if (!disabled) { return; } 24334 24335 sheet.disabled = false; 24336 container.className += newContainerClasses; 24337 doContainerTransformSilent(); 24338 24339 if (loop) { 24340 for (var j = cloneCount; j--;) { 24341 if (carousel) { Object(_helpers_showElement_js__WEBPACK_IMPORTED_MODULE_25__["showElement"])(slideItems[j]); } 24342 Object(_helpers_showElement_js__WEBPACK_IMPORTED_MODULE_25__["showElement"])(slideItems[slideCountNew - j - 1]); 24343 } 24344 } 24345 24346 // gallery 24347 if (!carousel) { 24348 for (var i = index, l = index + slideCount; i < l; i++) { 24349 var item = slideItems[i], 24350 classN = i < index + items ? animateIn : animateNormal; 24351 item.style.left = (i - index) * 100 / items + '%'; 24352 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(item, classN); 24353 } 24354 } 24355 24356 // update tools 24357 enableUI(); 24358 24359 disabled = false; 24360 } 24361 24362 function updateLiveRegion () { 24363 var str = getLiveRegionStr(); 24364 if (liveregionCurrent.innerHTML !== str) { liveregionCurrent.innerHTML = str; } 24365 } 24366 24367 function getLiveRegionStr () { 24368 var arr = getVisibleSlideRange(), 24369 start = arr[0] + 1, 24370 end = arr[1] + 1; 24371 return start === end ? start + '' : start + ' to ' + end; 24372 } 24373 24374 function getVisibleSlideRange (val) { 24375 if (val == null) { val = getContainerTransformValue(); } 24376 var start = index, end, rangestart, rangeend; 24377 24378 // get range start, range end for autoWidth and fixedWidth 24379 if (center || edgePadding) { 24380 if (autoWidth || fixedWidth) { 24381 rangestart = - (parseFloat(val) + edgePadding); 24382 rangeend = rangestart + viewport + edgePadding * 2; 24383 } 24384 } else { 24385 if (autoWidth) { 24386 rangestart = slidePositions[index]; 24387 rangeend = rangestart + viewport; 24388 } 24389 } 24390 24391 // get start, end 24392 // - check auto width 24393 if (autoWidth) { 24394 slidePositions.forEach(function(point, i) { 24395 if (i < slideCountNew) { 24396 if ((center || edgePadding) && point <= rangestart + 0.5) { start = i; } 24397 if (rangeend - point >= 0.5) { end = i; } 24398 } 24399 }); 24400 24401 // - check percentage width, fixed width 24402 } else { 24403 24404 if (fixedWidth) { 24405 var cell = fixedWidth + gutter; 24406 if (center || edgePadding) { 24407 start = Math.floor(rangestart/cell); 24408 end = Math.ceil(rangeend/cell - 1); 24409 } else { 24410 end = start + Math.ceil(viewport/cell) - 1; 24411 } 24412 24413 } else { 24414 if (center || edgePadding) { 24415 var a = items - 1; 24416 if (center) { 24417 start -= a / 2; 24418 end = index + a / 2; 24419 } else { 24420 end = index + a; 24421 } 24422 24423 if (edgePadding) { 24424 var b = edgePadding * items / viewport; 24425 start -= b; 24426 end += b; 24427 } 24428 24429 start = Math.floor(start); 24430 end = Math.ceil(end); 24431 } else { 24432 end = start + items - 1; 24433 } 24434 } 24435 24436 start = Math.max(start, 0); 24437 end = Math.min(end, slideCountNew - 1); 24438 } 24439 24440 return [start, end]; 24441 } 24442 24443 function doLazyLoad () { 24444 if (lazyload && !disable) { 24445 var arg = getVisibleSlideRange(); 24446 arg.push(lazyloadSelector); 24447 24448 getImageArray.apply(null, arg).forEach(function (img) { 24449 if (!Object(_helpers_hasClass_js__WEBPACK_IMPORTED_MODULE_16__["hasClass"])(img, imgCompleteClass)) { 24450 // stop propagation transitionend event to container 24451 var eve = {}; 24452 eve[TRANSITIONEND] = function (e) { e.stopPropagation(); }; 24453 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(img, eve); 24454 24455 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(img, imgEvents); 24456 24457 // update src 24458 img.src = Object(_helpers_getAttr_js__WEBPACK_IMPORTED_MODULE_20__["getAttr"])(img, 'data-src'); 24459 24460 // update srcset 24461 var srcset = Object(_helpers_getAttr_js__WEBPACK_IMPORTED_MODULE_20__["getAttr"])(img, 'data-srcset'); 24462 if (srcset) { img.srcset = srcset; } 24463 24464 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(img, 'loading'); 24465 } 24466 }); 24467 } 24468 } 24469 24470 function onImgLoaded (e) { 24471 imgLoaded(getTarget(e)); 24472 } 24473 24474 function onImgFailed (e) { 24475 imgFailed(getTarget(e)); 24476 } 24477 24478 function imgLoaded (img) { 24479 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(img, 'loaded'); 24480 imgCompleted(img); 24481 } 24482 24483 function imgFailed (img) { 24484 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(img, 'failed'); 24485 imgCompleted(img); 24486 } 24487 24488 function imgCompleted (img) { 24489 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(img, imgCompleteClass); 24490 Object(_helpers_removeClass_js__WEBPACK_IMPORTED_MODULE_18__["removeClass"])(img, 'loading'); 24491 Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(img, imgEvents); 24492 } 24493 24494 function getImageArray (start, end, imgSelector) { 24495 var imgs = []; 24496 if (!imgSelector) { imgSelector = 'img'; } 24497 24498 while (start <= end) { 24499 Object(_helpers_forEach_js__WEBPACK_IMPORTED_MODULE_15__["forEach"])(slideItems[start].querySelectorAll(imgSelector), function (img) { imgs.push(img); }); 24500 start++; 24501 } 24502 24503 return imgs; 24504 } 24505 24506 // check if all visible images are loaded 24507 // and update container height if it's done 24508 function doAutoHeight () { 24509 var imgs = getImageArray.apply(null, getVisibleSlideRange()); 24510 Object(_helpers_raf_js__WEBPACK_IMPORTED_MODULE_0__["raf"])(function(){ imgsLoadedCheck(imgs, updateInnerWrapperHeight); }); 24511 } 24512 24513 function imgsLoadedCheck (imgs, cb) { 24514 // execute callback function if all images are complete 24515 if (imgsComplete) { return cb(); } 24516 24517 // check image classes 24518 imgs.forEach(function (img, index) { 24519 if (!lazyload && img.complete) { imgCompleted(img); } // Check image.complete 24520 if (Object(_helpers_hasClass_js__WEBPACK_IMPORTED_MODULE_16__["hasClass"])(img, imgCompleteClass)) { imgs.splice(index, 1); } 24521 }); 24522 24523 // execute callback function if selected images are all complete 24524 if (!imgs.length) { return cb(); } 24525 24526 // otherwise execute this functiona again 24527 Object(_helpers_raf_js__WEBPACK_IMPORTED_MODULE_0__["raf"])(function(){ imgsLoadedCheck(imgs, cb); }); 24528 } 24529 24530 function additionalUpdates () { 24531 doLazyLoad(); 24532 updateSlideStatus(); 24533 updateLiveRegion(); 24534 updateControlsStatus(); 24535 updateNavStatus(); 24536 } 24537 24538 24539 function update_carousel_transition_duration () { 24540 if (carousel && autoHeight) { 24541 middleWrapper.style[TRANSITIONDURATION] = speed / 1000 + 's'; 24542 } 24543 } 24544 24545 function getMaxSlideHeight (slideStart, slideRange) { 24546 var heights = []; 24547 for (var i = slideStart, l = Math.min(slideStart + slideRange, slideCountNew); i < l; i++) { 24548 heights.push(slideItems[i].offsetHeight); 24549 } 24550 24551 return Math.max.apply(null, heights); 24552 } 24553 24554 // update inner wrapper height 24555 // 1. get the max-height of the visible slides 24556 // 2. set transitionDuration to speed 24557 // 3. update inner wrapper height to max-height 24558 // 4. set transitionDuration to 0s after transition done 24559 function updateInnerWrapperHeight () { 24560 var maxHeight = autoHeight ? getMaxSlideHeight(index, items) : getMaxSlideHeight(cloneCount, slideCount), 24561 wp = middleWrapper ? middleWrapper : innerWrapper; 24562 24563 if (wp.style.height !== maxHeight) { wp.style.height = maxHeight + 'px'; } 24564 } 24565 24566 // get the distance from the top edge of the first slide to each slide 24567 // (init) => slidePositions 24568 function setSlidePositions () { 24569 slidePositions = [0]; 24570 var attr = horizontal ? 'left' : 'top', 24571 attr2 = horizontal ? 'right' : 'bottom', 24572 base = slideItems[0].getBoundingClientRect()[attr]; 24573 24574 Object(_helpers_forEach_js__WEBPACK_IMPORTED_MODULE_15__["forEach"])(slideItems, function(item, i) { 24575 // skip the first slide 24576 if (i) { slidePositions.push(item.getBoundingClientRect()[attr] - base); } 24577 // add the end edge 24578 if (i === slideCountNew - 1) { slidePositions.push(item.getBoundingClientRect()[attr2] - base); } 24579 }); 24580 } 24581 24582 // update slide 24583 function updateSlideStatus () { 24584 var range = getVisibleSlideRange(), 24585 start = range[0], 24586 end = range[1]; 24587 24588 Object(_helpers_forEach_js__WEBPACK_IMPORTED_MODULE_15__["forEach"])(slideItems, function(item, i) { 24589 // show slides 24590 if (i >= start && i <= end) { 24591 if (Object(_helpers_hasAttr_js__WEBPACK_IMPORTED_MODULE_19__["hasAttr"])(item, 'aria-hidden')) { 24592 Object(_helpers_removeAttrs_js__WEBPACK_IMPORTED_MODULE_22__["removeAttrs"])(item, ['aria-hidden', 'tabindex']); 24593 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(item, slideActiveClass); 24594 } 24595 // hide slides 24596 } else { 24597 if (!Object(_helpers_hasAttr_js__WEBPACK_IMPORTED_MODULE_19__["hasAttr"])(item, 'aria-hidden')) { 24598 Object(_helpers_setAttrs_js__WEBPACK_IMPORTED_MODULE_21__["setAttrs"])(item, { 24599 'aria-hidden': 'true', 24600 'tabindex': '-1' 24601 }); 24602 Object(_helpers_removeClass_js__WEBPACK_IMPORTED_MODULE_18__["removeClass"])(item, slideActiveClass); 24603 } 24604 } 24605 }); 24606 } 24607 24608 // gallery: update slide position 24609 function updateGallerySlidePositions () { 24610 var l = index + Math.min(slideCount, items); 24611 for (var i = slideCountNew; i--;) { 24612 var item = slideItems[i]; 24613 24614 if (i >= index && i < l) { 24615 // add transitions to visible slides when adjusting their positions 24616 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(item, 'tns-moving'); 24617 24618 item.style.left = (i - index) * 100 / items + '%'; 24619 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(item, animateIn); 24620 Object(_helpers_removeClass_js__WEBPACK_IMPORTED_MODULE_18__["removeClass"])(item, animateNormal); 24621 } else if (item.style.left) { 24622 item.style.left = ''; 24623 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(item, animateNormal); 24624 Object(_helpers_removeClass_js__WEBPACK_IMPORTED_MODULE_18__["removeClass"])(item, animateIn); 24625 } 24626 24627 // remove outlet animation 24628 Object(_helpers_removeClass_js__WEBPACK_IMPORTED_MODULE_18__["removeClass"])(item, animateOut); 24629 } 24630 24631 // removing '.tns-moving' 24632 setTimeout(function() { 24633 Object(_helpers_forEach_js__WEBPACK_IMPORTED_MODULE_15__["forEach"])(slideItems, function(el) { 24634 Object(_helpers_removeClass_js__WEBPACK_IMPORTED_MODULE_18__["removeClass"])(el, 'tns-moving'); 24635 }); 24636 }, 300); 24637 } 24638 24639 // set tabindex on Nav 24640 function updateNavStatus () { 24641 // get current nav 24642 if (nav) { 24643 navCurrentIndex = navClicked >= 0 ? navClicked : getCurrentNavIndex(); 24644 navClicked = -1; 24645 24646 if (navCurrentIndex !== navCurrentIndexCached) { 24647 var navPrev = navItems[navCurrentIndexCached], 24648 navCurrent = navItems[navCurrentIndex]; 24649 24650 Object(_helpers_setAttrs_js__WEBPACK_IMPORTED_MODULE_21__["setAttrs"])(navPrev, { 24651 'tabindex': '-1', 24652 'aria-label': navStr + (navCurrentIndexCached + 1) 24653 }); 24654 Object(_helpers_removeClass_js__WEBPACK_IMPORTED_MODULE_18__["removeClass"])(navPrev, navActiveClass); 24655 24656 Object(_helpers_setAttrs_js__WEBPACK_IMPORTED_MODULE_21__["setAttrs"])(navCurrent, {'aria-label': navStr + (navCurrentIndex + 1) + navStrCurrent}); 24657 Object(_helpers_removeAttrs_js__WEBPACK_IMPORTED_MODULE_22__["removeAttrs"])(navCurrent, 'tabindex'); 24658 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(navCurrent, navActiveClass); 24659 24660 navCurrentIndexCached = navCurrentIndex; 24661 } 24662 } 24663 } 24664 24665 function getLowerCaseNodeName (el) { 24666 return el.nodeName.toLowerCase(); 24667 } 24668 24669 function isButton (el) { 24670 return getLowerCaseNodeName(el) === 'button'; 24671 } 24672 24673 function isAriaDisabled (el) { 24674 return el.getAttribute('aria-disabled') === 'true'; 24675 } 24676 24677 function disEnableElement (isButton, el, val) { 24678 if (isButton) { 24679 el.disabled = val; 24680 } else { 24681 el.setAttribute('aria-disabled', val.toString()); 24682 } 24683 } 24684 24685 // set 'disabled' to true on controls when reach the edges 24686 function updateControlsStatus () { 24687 if (!controls || rewind || loop) { return; } 24688 24689 var prevDisabled = (prevIsButton) ? prevButton.disabled : isAriaDisabled(prevButton), 24690 nextDisabled = (nextIsButton) ? nextButton.disabled : isAriaDisabled(nextButton), 24691 disablePrev = (index <= indexMin) ? true : false, 24692 disableNext = (!rewind && index >= indexMax) ? true : false; 24693 24694 if (disablePrev && !prevDisabled) { 24695 disEnableElement(prevIsButton, prevButton, true); 24696 } 24697 if (!disablePrev && prevDisabled) { 24698 disEnableElement(prevIsButton, prevButton, false); 24699 } 24700 if (disableNext && !nextDisabled) { 24701 disEnableElement(nextIsButton, nextButton, true); 24702 } 24703 if (!disableNext && nextDisabled) { 24704 disEnableElement(nextIsButton, nextButton, false); 24705 } 24706 } 24707 24708 // set duration 24709 function resetDuration (el, str) { 24710 if (TRANSITIONDURATION) { el.style[TRANSITIONDURATION] = str; } 24711 } 24712 24713 function getSliderWidth () { 24714 return fixedWidth ? (fixedWidth + gutter) * slideCountNew : slidePositions[slideCountNew]; 24715 } 24716 24717 function getCenterGap (num) { 24718 if (num == null) { num = index; } 24719 24720 var gap = edgePadding ? gutter : 0; 24721 return autoWidth ? ((viewport - gap) - (slidePositions[num + 1] - slidePositions[num] - gutter))/2 : 24722 fixedWidth ? (viewport - fixedWidth) / 2 : 24723 (items - 1) / 2; 24724 } 24725 24726 function getRightBoundary () { 24727 var gap = edgePadding ? gutter : 0, 24728 result = (viewport + gap) - getSliderWidth(); 24729 24730 if (center && !loop) { 24731 result = fixedWidth ? - (fixedWidth + gutter) * (slideCountNew - 1) - getCenterGap() : 24732 getCenterGap(slideCountNew - 1) - slidePositions[slideCountNew - 1]; 24733 } 24734 if (result > 0) { result = 0; } 24735 24736 return result; 24737 } 24738 24739 function getContainerTransformValue (num) { 24740 if (num == null) { num = index; } 24741 24742 var val; 24743 if (horizontal && !autoWidth) { 24744 if (fixedWidth) { 24745 val = - (fixedWidth + gutter) * num; 24746 if (center) { val += getCenterGap(); } 24747 } else { 24748 var denominator = TRANSFORM ? slideCountNew : items; 24749 if (center) { num -= getCenterGap(); } 24750 val = - num * 100 / denominator; 24751 } 24752 } else { 24753 val = - slidePositions[num]; 24754 if (center && autoWidth) { 24755 val += getCenterGap(); 24756 } 24757 } 24758 24759 if (hasRightDeadZone) { val = Math.max(val, rightBoundary); } 24760 24761 val += (horizontal && !autoWidth && !fixedWidth) ? '%' : 'px'; 24762 24763 return val; 24764 } 24765 24766 function doContainerTransformSilent (val) { 24767 resetDuration(container, '0s'); 24768 doContainerTransform(val); 24769 } 24770 24771 function doContainerTransform (val) { 24772 if (val == null) { val = getContainerTransformValue(); } 24773 container.style[transformAttr] = transformPrefix + val + transformPostfix; 24774 } 24775 24776 function animateSlide (number, classOut, classIn, isOut) { 24777 var l = number + items; 24778 if (!loop) { l = Math.min(l, slideCountNew); } 24779 24780 for (var i = number; i < l; i++) { 24781 var item = slideItems[i]; 24782 24783 // set item positions 24784 if (!isOut) { item.style.left = (i - index) * 100 / items + '%'; } 24785 24786 if (animateDelay && TRANSITIONDELAY) { 24787 item.style[TRANSITIONDELAY] = item.style[ANIMATIONDELAY] = animateDelay * (i - number) / 1000 + 's'; 24788 } 24789 Object(_helpers_removeClass_js__WEBPACK_IMPORTED_MODULE_18__["removeClass"])(item, classOut); 24790 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(item, classIn); 24791 24792 if (isOut) { slideItemsOut.push(item); } 24793 } 24794 } 24795 24796 // make transfer after click/drag: 24797 // 1. change 'transform' property for mordern browsers 24798 // 2. change 'left' property for legacy browsers 24799 var transformCore = (function () { 24800 return carousel ? 24801 function () { 24802 resetDuration(container, ''); 24803 if (TRANSITIONDURATION || !speed) { 24804 // for morden browsers with non-zero duration or 24805 // zero duration for all browsers 24806 doContainerTransform(); 24807 // run fallback function manually 24808 // when duration is 0 / container is hidden 24809 if (!speed || !Object(_helpers_isVisible_js__WEBPACK_IMPORTED_MODULE_26__["isVisible"])(container)) { onTransitionEnd(); } 24810 24811 } else { 24812 // for old browser with non-zero duration 24813 Object(_helpers_jsTransform_js__WEBPACK_IMPORTED_MODULE_33__["jsTransform"])(container, transformAttr, transformPrefix, transformPostfix, getContainerTransformValue(), speed, onTransitionEnd); 24814 } 24815 24816 if (!horizontal) { updateContentWrapperHeight(); } 24817 } : 24818 function () { 24819 slideItemsOut = []; 24820 24821 var eve = {}; 24822 eve[TRANSITIONEND] = eve[ANIMATIONEND] = onTransitionEnd; 24823 Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(slideItems[indexCached], eve); 24824 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(slideItems[index], eve); 24825 24826 animateSlide(indexCached, animateIn, animateOut, true); 24827 animateSlide(index, animateNormal, animateIn); 24828 24829 // run fallback function manually 24830 // when transition or animation not supported / duration is 0 24831 if (!TRANSITIONEND || !ANIMATIONEND || !speed || !Object(_helpers_isVisible_js__WEBPACK_IMPORTED_MODULE_26__["isVisible"])(container)) { onTransitionEnd(); } 24832 }; 24833 })(); 24834 24835 function render (e, sliderMoved) { 24836 if (updateIndexBeforeTransform) { updateIndex(); } 24837 24838 // render when slider was moved (touch or drag) even though index may not change 24839 if (index !== indexCached || sliderMoved) { 24840 // events 24841 events.emit('indexChanged', info()); 24842 events.emit('transitionStart', info()); 24843 if (autoHeight) { doAutoHeight(); } 24844 24845 // pause autoplay when click or keydown from user 24846 if (animating && e && ['click', 'keydown'].indexOf(e.type) >= 0) { stopAutoplay(); } 24847 24848 running = true; 24849 transformCore(); 24850 } 24851 } 24852 24853 /* 24854 * Transfer prefixed properties to the same format 24855 * CSS: -Webkit-Transform => webkittransform 24856 * JS: WebkitTransform => webkittransform 24857 * @param {string} str - property 24858 * 24859 */ 24860 function strTrans (str) { 24861 return str.toLowerCase().replace(/-/g, ''); 24862 } 24863 24864 // AFTER TRANSFORM 24865 // Things need to be done after a transfer: 24866 // 1. check index 24867 // 2. add classes to visible slide 24868 // 3. disable controls buttons when reach the first/last slide in non-loop slider 24869 // 4. update nav status 24870 // 5. lazyload images 24871 // 6. update container height 24872 function onTransitionEnd (event) { 24873 // check running on gallery mode 24874 // make sure trantionend/animationend events run only once 24875 if (carousel || running) { 24876 events.emit('transitionEnd', info(event)); 24877 24878 if (!carousel && slideItemsOut.length > 0) { 24879 for (var i = 0; i < slideItemsOut.length; i++) { 24880 var item = slideItemsOut[i]; 24881 // set item positions 24882 item.style.left = ''; 24883 24884 if (ANIMATIONDELAY && TRANSITIONDELAY) { 24885 item.style[ANIMATIONDELAY] = ''; 24886 item.style[TRANSITIONDELAY] = ''; 24887 } 24888 Object(_helpers_removeClass_js__WEBPACK_IMPORTED_MODULE_18__["removeClass"])(item, animateOut); 24889 Object(_helpers_addClass_js__WEBPACK_IMPORTED_MODULE_17__["addClass"])(item, animateNormal); 24890 } 24891 } 24892 24893 /* update slides, nav, controls after checking ... 24894 * => legacy browsers who don't support 'event' 24895 * have to check event first, otherwise event.target will cause an error 24896 * => or 'gallery' mode: 24897 * + event target is slide item 24898 * => or 'carousel' mode: 24899 * + event target is container, 24900 * + event.property is the same with transform attribute 24901 */ 24902 if (!event || 24903 !carousel && event.target.parentNode === container || 24904 event.target === container && strTrans(event.propertyName) === strTrans(transformAttr)) { 24905 24906 if (!updateIndexBeforeTransform) { 24907 var indexTem = index; 24908 updateIndex(); 24909 if (index !== indexTem) { 24910 events.emit('indexChanged', info()); 24911 24912 doContainerTransformSilent(); 24913 } 24914 } 24915 24916 if (nested === 'inner') { events.emit('innerLoaded', info()); } 24917 running = false; 24918 indexCached = index; 24919 } 24920 } 24921 24922 } 24923 24924 // # ACTIONS 24925 function goTo (targetIndex, e) { 24926 if (freeze) { return; } 24927 24928 // prev slideBy 24929 if (targetIndex === 'prev') { 24930 onControlsClick(e, -1); 24931 24932 // next slideBy 24933 } else if (targetIndex === 'next') { 24934 onControlsClick(e, 1); 24935 24936 // go to exact slide 24937 } else { 24938 if (running) { 24939 if (preventActionWhenRunning) { return; } else { onTransitionEnd(); } 24940 } 24941 24942 var absIndex = getAbsIndex(), 24943 indexGap = 0; 24944 24945 if (targetIndex === 'first') { 24946 indexGap = - absIndex; 24947 } else if (targetIndex === 'last') { 24948 indexGap = carousel ? slideCount - items - absIndex : slideCount - 1 - absIndex; 24949 } else { 24950 if (typeof targetIndex !== 'number') { targetIndex = parseInt(targetIndex); } 24951 24952 if (!isNaN(targetIndex)) { 24953 // from directly called goTo function 24954 if (!e) { targetIndex = Math.max(0, Math.min(slideCount - 1, targetIndex)); } 24955 24956 indexGap = targetIndex - absIndex; 24957 } 24958 } 24959 24960 // gallery: make sure new page won't overlap with current page 24961 if (!carousel && indexGap && Math.abs(indexGap) < items) { 24962 var factor = indexGap > 0 ? 1 : -1; 24963 indexGap += (index + indexGap - slideCount) >= indexMin ? slideCount * factor : slideCount * 2 * factor * -1; 24964 } 24965 24966 index += indexGap; 24967 24968 // make sure index is in range 24969 if (carousel && loop) { 24970 if (index < indexMin) { index += slideCount; } 24971 if (index > indexMax) { index -= slideCount; } 24972 } 24973 24974 // if index is changed, start rendering 24975 if (getAbsIndex(index) !== getAbsIndex(indexCached)) { 24976 render(e); 24977 } 24978 24979 } 24980 } 24981 24982 // on controls click 24983 function onControlsClick (e, dir) { 24984 if (running) { 24985 if (preventActionWhenRunning) { return; } else { onTransitionEnd(); } 24986 } 24987 var passEventObject; 24988 24989 if (!dir) { 24990 e = getEvent(e); 24991 var target = getTarget(e); 24992 24993 while (target !== controlsContainer && [prevButton, nextButton].indexOf(target) < 0) { target = target.parentNode; } 24994 24995 var targetIn = [prevButton, nextButton].indexOf(target); 24996 if (targetIn >= 0) { 24997 passEventObject = true; 24998 dir = targetIn === 0 ? -1 : 1; 24999 } 25000 } 25001 25002 if (rewind) { 25003 if (index === indexMin && dir === -1) { 25004 goTo('last', e); 25005 return; 25006 } else if (index === indexMax && dir === 1) { 25007 goTo('first', e); 25008 return; 25009 } 25010 } 25011 25012 if (dir) { 25013 index += slideBy * dir; 25014 if (autoWidth) { index = Math.floor(index); } 25015 // pass e when click control buttons or keydown 25016 render((passEventObject || (e && e.type === 'keydown')) ? e : null); 25017 } 25018 } 25019 25020 // on nav click 25021 function onNavClick (e) { 25022 if (running) { 25023 if (preventActionWhenRunning) { return; } else { onTransitionEnd(); } 25024 } 25025 25026 e = getEvent(e); 25027 var target = getTarget(e), navIndex; 25028 25029 // find the clicked nav item 25030 while (target !== navContainer && !Object(_helpers_hasAttr_js__WEBPACK_IMPORTED_MODULE_19__["hasAttr"])(target, 'data-nav')) { target = target.parentNode; } 25031 if (Object(_helpers_hasAttr_js__WEBPACK_IMPORTED_MODULE_19__["hasAttr"])(target, 'data-nav')) { 25032 var navIndex = navClicked = Number(Object(_helpers_getAttr_js__WEBPACK_IMPORTED_MODULE_20__["getAttr"])(target, 'data-nav')), 25033 targetIndexBase = fixedWidth || autoWidth ? navIndex * slideCount / pages : navIndex * items, 25034 targetIndex = navAsThumbnails ? navIndex : Math.min(Math.ceil(targetIndexBase), slideCount - 1); 25035 goTo(targetIndex, e); 25036 25037 if (navCurrentIndex === navIndex) { 25038 if (animating) { stopAutoplay(); } 25039 navClicked = -1; // reset navClicked 25040 } 25041 } 25042 } 25043 25044 // autoplay functions 25045 function setAutoplayTimer () { 25046 autoplayTimer = setInterval(function () { 25047 onControlsClick(null, autoplayDirection); 25048 }, autoplayTimeout); 25049 25050 animating = true; 25051 } 25052 25053 function stopAutoplayTimer () { 25054 clearInterval(autoplayTimer); 25055 animating = false; 25056 } 25057 25058 function updateAutoplayButton (action, txt) { 25059 Object(_helpers_setAttrs_js__WEBPACK_IMPORTED_MODULE_21__["setAttrs"])(autoplayButton, {'data-action': action}); 25060 autoplayButton.innerHTML = autoplayHtmlStrings[0] + action + autoplayHtmlStrings[1] + txt; 25061 } 25062 25063 function startAutoplay () { 25064 setAutoplayTimer(); 25065 if (autoplayButton) { updateAutoplayButton('stop', autoplayText[1]); } 25066 } 25067 25068 function stopAutoplay () { 25069 stopAutoplayTimer(); 25070 if (autoplayButton) { updateAutoplayButton('start', autoplayText[0]); } 25071 } 25072 25073 // programaitcally play/pause the slider 25074 function play () { 25075 if (autoplay && !animating) { 25076 startAutoplay(); 25077 autoplayUserPaused = false; 25078 } 25079 } 25080 function pause () { 25081 if (animating) { 25082 stopAutoplay(); 25083 autoplayUserPaused = true; 25084 } 25085 } 25086 25087 function toggleAutoplay () { 25088 if (animating) { 25089 stopAutoplay(); 25090 autoplayUserPaused = true; 25091 } else { 25092 startAutoplay(); 25093 autoplayUserPaused = false; 25094 } 25095 } 25096 25097 function onVisibilityChange () { 25098 if (doc.hidden) { 25099 if (animating) { 25100 stopAutoplayTimer(); 25101 autoplayVisibilityPaused = true; 25102 } 25103 } else if (autoplayVisibilityPaused) { 25104 setAutoplayTimer(); 25105 autoplayVisibilityPaused = false; 25106 } 25107 } 25108 25109 function mouseoverPause () { 25110 if (animating) { 25111 stopAutoplayTimer(); 25112 autoplayHoverPaused = true; 25113 } 25114 } 25115 25116 function mouseoutRestart () { 25117 if (autoplayHoverPaused) { 25118 setAutoplayTimer(); 25119 autoplayHoverPaused = false; 25120 } 25121 } 25122 25123 // keydown events on document 25124 function onDocumentKeydown (e) { 25125 e = getEvent(e); 25126 var keyIndex = [KEYS.LEFT, KEYS.RIGHT].indexOf(e.keyCode); 25127 25128 if (keyIndex >= 0) { 25129 onControlsClick(e, keyIndex === 0 ? -1 : 1); 25130 } 25131 } 25132 25133 // on key control 25134 function onControlsKeydown (e) { 25135 e = getEvent(e); 25136 var keyIndex = [KEYS.LEFT, KEYS.RIGHT].indexOf(e.keyCode); 25137 25138 if (keyIndex >= 0) { 25139 if (keyIndex === 0) { 25140 if (!prevButton.disabled) { onControlsClick(e, -1); } 25141 } else if (!nextButton.disabled) { 25142 onControlsClick(e, 1); 25143 } 25144 } 25145 } 25146 25147 // set focus 25148 function setFocus (el) { 25149 el.focus(); 25150 } 25151 25152 // on key nav 25153 function onNavKeydown (e) { 25154 e = getEvent(e); 25155 var curElement = doc.activeElement; 25156 if (!Object(_helpers_hasAttr_js__WEBPACK_IMPORTED_MODULE_19__["hasAttr"])(curElement, 'data-nav')) { return; } 25157 25158 // var code = e.keyCode, 25159 var keyIndex = [KEYS.LEFT, KEYS.RIGHT, KEYS.ENTER, KEYS.SPACE].indexOf(e.keyCode), 25160 navIndex = Number(Object(_helpers_getAttr_js__WEBPACK_IMPORTED_MODULE_20__["getAttr"])(curElement, 'data-nav')); 25161 25162 if (keyIndex >= 0) { 25163 if (keyIndex === 0) { 25164 if (navIndex > 0) { setFocus(navItems[navIndex - 1]); } 25165 } else if (keyIndex === 1) { 25166 if (navIndex < pages - 1) { setFocus(navItems[navIndex + 1]); } 25167 } else { 25168 navClicked = navIndex; 25169 goTo(navIndex, e); 25170 } 25171 } 25172 } 25173 25174 function getEvent (e) { 25175 e = e || win.event; 25176 return isTouchEvent(e) ? e.changedTouches[0] : e; 25177 } 25178 function getTarget (e) { 25179 return e.target || win.event.srcElement; 25180 } 25181 25182 function isTouchEvent (e) { 25183 return e.type.indexOf('touch') >= 0; 25184 } 25185 25186 function preventDefaultBehavior (e) { 25187 e.preventDefault ? e.preventDefault() : e.returnValue = false; 25188 } 25189 25190 function getMoveDirectionExpected () { 25191 return Object(_helpers_getTouchDirection_js__WEBPACK_IMPORTED_MODULE_14__["getTouchDirection"])(Object(_helpers_toDegree_js__WEBPACK_IMPORTED_MODULE_13__["toDegree"])(lastPosition.y - initPosition.y, lastPosition.x - initPosition.x), swipeAngle) === options.axis; 25192 } 25193 25194 function onPanStart (e) { 25195 if (running) { 25196 if (preventActionWhenRunning) { return; } else { onTransitionEnd(); } 25197 } 25198 25199 if (autoplay && animating) { stopAutoplayTimer(); } 25200 25201 panStart = true; 25202 if (rafIndex) { 25203 Object(_helpers_caf_js__WEBPACK_IMPORTED_MODULE_1__["caf"])(rafIndex); 25204 rafIndex = null; 25205 } 25206 25207 var $ = getEvent(e); 25208 events.emit(isTouchEvent(e) ? 'touchStart' : 'dragStart', info(e)); 25209 25210 if (!isTouchEvent(e) && ['img', 'a'].indexOf(getLowerCaseNodeName(getTarget(e))) >= 0) { 25211 preventDefaultBehavior(e); 25212 } 25213 25214 lastPosition.x = initPosition.x = $.clientX; 25215 lastPosition.y = initPosition.y = $.clientY; 25216 if (carousel) { 25217 translateInit = parseFloat(container.style[transformAttr].replace(transformPrefix, '')); 25218 resetDuration(container, '0s'); 25219 } 25220 } 25221 25222 function onPanMove (e) { 25223 if (panStart) { 25224 var $ = getEvent(e); 25225 lastPosition.x = $.clientX; 25226 lastPosition.y = $.clientY; 25227 25228 if (carousel) { 25229 if (!rafIndex) { rafIndex = Object(_helpers_raf_js__WEBPACK_IMPORTED_MODULE_0__["raf"])(function(){ panUpdate(e); }); } 25230 } else { 25231 if (moveDirectionExpected === '?') { moveDirectionExpected = getMoveDirectionExpected(); } 25232 if (moveDirectionExpected) { preventScroll = true; } 25233 } 25234 25235 if ((typeof e.cancelable !== 'boolean' || e.cancelable) && preventScroll) { 25236 e.preventDefault(); 25237 } 25238 } 25239 } 25240 25241 function panUpdate (e) { 25242 if (!moveDirectionExpected) { 25243 panStart = false; 25244 return; 25245 } 25246 Object(_helpers_caf_js__WEBPACK_IMPORTED_MODULE_1__["caf"])(rafIndex); 25247 if (panStart) { rafIndex = Object(_helpers_raf_js__WEBPACK_IMPORTED_MODULE_0__["raf"])(function(){ panUpdate(e); }); } 25248 25249 if (moveDirectionExpected === '?') { moveDirectionExpected = getMoveDirectionExpected(); } 25250 if (moveDirectionExpected) { 25251 if (!preventScroll && isTouchEvent(e)) { preventScroll = true; } 25252 25253 try { 25254 if (e.type) { events.emit(isTouchEvent(e) ? 'touchMove' : 'dragMove', info(e)); } 25255 } catch(err) {} 25256 25257 var x = translateInit, 25258 dist = getDist(lastPosition, initPosition); 25259 if (!horizontal || fixedWidth || autoWidth) { 25260 x += dist; 25261 x += 'px'; 25262 } else { 25263 var percentageX = TRANSFORM ? dist * items * 100 / ((viewport + gutter) * slideCountNew): dist * 100 / (viewport + gutter); 25264 x += percentageX; 25265 x += '%'; 25266 } 25267 25268 container.style[transformAttr] = transformPrefix + x + transformPostfix; 25269 } 25270 } 25271 25272 function onPanEnd (e) { 25273 if (panStart) { 25274 if (rafIndex) { 25275 Object(_helpers_caf_js__WEBPACK_IMPORTED_MODULE_1__["caf"])(rafIndex); 25276 rafIndex = null; 25277 } 25278 if (carousel) { resetDuration(container, ''); } 25279 panStart = false; 25280 25281 var $ = getEvent(e); 25282 lastPosition.x = $.clientX; 25283 lastPosition.y = $.clientY; 25284 var dist = getDist(lastPosition, initPosition); 25285 25286 if (Math.abs(dist)) { 25287 // drag vs click 25288 if (!isTouchEvent(e)) { 25289 // prevent "click" 25290 var target = getTarget(e); 25291 Object(_helpers_addEvents_js__WEBPACK_IMPORTED_MODULE_30__["addEvents"])(target, {'click': function preventClick (e) { 25292 preventDefaultBehavior(e); 25293 Object(_helpers_removeEvents_js__WEBPACK_IMPORTED_MODULE_31__["removeEvents"])(target, {'click': preventClick}); 25294 }}); 25295 } 25296 25297 if (carousel) { 25298 rafIndex = Object(_helpers_raf_js__WEBPACK_IMPORTED_MODULE_0__["raf"])(function() { 25299 if (horizontal && !autoWidth) { 25300 var indexMoved = - dist * items / (viewport + gutter); 25301 indexMoved = dist > 0 ? Math.floor(indexMoved) : Math.ceil(indexMoved); 25302 index += indexMoved; 25303 } else { 25304 var moved = - (translateInit + dist); 25305 if (moved <= 0) { 25306 index = indexMin; 25307 } else if (moved >= slidePositions[slideCountNew - 1]) { 25308 index = indexMax; 25309 } else { 25310 var i = 0; 25311 while (i < slideCountNew && moved >= slidePositions[i]) { 25312 index = i; 25313 if (moved > slidePositions[i] && dist < 0) { index += 1; } 25314 i++; 25315 } 25316 } 25317 } 25318 25319 render(e, dist); 25320 events.emit(isTouchEvent(e) ? 'touchEnd' : 'dragEnd', info(e)); 25321 }); 25322 } else { 25323 if (moveDirectionExpected) { 25324 onControlsClick(e, dist > 0 ? -1 : 1); 25325 } 25326 } 25327 } 25328 } 25329 25330 // reset 25331 if (options.preventScrollOnTouch === 'auto') { preventScroll = false; } 25332 if (swipeAngle) { moveDirectionExpected = '?'; } 25333 if (autoplay && !animating) { setAutoplayTimer(); } 25334 } 25335 25336 // === RESIZE FUNCTIONS === // 25337 // (slidePositions, index, items) => vertical_conentWrapper.height 25338 function updateContentWrapperHeight () { 25339 var wp = middleWrapper ? middleWrapper : innerWrapper; 25340 wp.style.height = slidePositions[index + items] - slidePositions[index] + 'px'; 25341 } 25342 25343 function getPages () { 25344 var rough = fixedWidth ? (fixedWidth + gutter) * slideCount / viewport : slideCount / items; 25345 return Math.min(Math.ceil(rough), slideCount); 25346 } 25347 25348 /* 25349 * 1. update visible nav items list 25350 * 2. add "hidden" attributes to previous visible nav items 25351 * 3. remove "hidden" attrubutes to new visible nav items 25352 */ 25353 function updateNavVisibility () { 25354 if (!nav || navAsThumbnails) { return; } 25355 25356 if (pages !== pagesCached) { 25357 var min = pagesCached, 25358 max = pages, 25359 fn = _helpers_showElement_js__WEBPACK_IMPORTED_MODULE_25__["showElement"]; 25360 25361 if (pagesCached > pages) { 25362 min = pages; 25363 max = pagesCached; 25364 fn = _helpers_hideElement_js__WEBPACK_IMPORTED_MODULE_24__["hideElement"]; 25365 } 25366 25367 while (min < max) { 25368 fn(navItems[min]); 25369 min++; 25370 } 25371 25372 // cache pages 25373 pagesCached = pages; 25374 } 25375 } 25376 25377 function info (e) { 25378 return { 25379 container: container, 25380 slideItems: slideItems, 25381 navContainer: navContainer, 25382 navItems: navItems, 25383 controlsContainer: controlsContainer, 25384 hasControls: hasControls, 25385 prevButton: prevButton, 25386 nextButton: nextButton, 25387 items: items, 25388 slideBy: slideBy, 25389 cloneCount: cloneCount, 25390 slideCount: slideCount, 25391 slideCountNew: slideCountNew, 25392 index: index, 25393 indexCached: indexCached, 25394 displayIndex: getCurrentSlide(), 25395 navCurrentIndex: navCurrentIndex, 25396 navCurrentIndexCached: navCurrentIndexCached, 25397 pages: pages, 25398 pagesCached: pagesCached, 25399 sheet: sheet, 25400 isOn: isOn, 25401 event: e || {}, 25402 }; 25403 } 25404 25405 return { 25406 version: '2.9.4', 25407 getInfo: info, 25408 events: events, 25409 goTo: goTo, 25410 play: play, 25411 pause: pause, 25412 isOn: isOn, 25413 updateSliderHeight: updateInnerWrapperHeight, 25414 refresh: initSliderTransform, 25415 destroy: destroy, 25416 rebuild: function() { 25417 return tns(Object(_helpers_extend_js__WEBPACK_IMPORTED_MODULE_2__["extend"])(options, optionsElements)); 25418 } 25419 }; 25420}; 25421 25422 25423/***/ }), 25424
vendor: 767 bytes, lines 25425-25455
25425/***/ "../node_modules/webpack/buildin/global.js": 25426/*!*************************************************!*\ 25427 !*** ../node_modules/webpack/buildin/global.js ***! 25428 \*************************************************/ 25429/*! no static exports found */ 25430/***/ (function(module, exports) { 25431 25432var g; 25433 25434// This works in non-strict mode 25435g = (function() { 25436 return this; 25437})(); 25438 25439try { 25440 // This works if eval is allowed (see CSP) 25441 g = g || new Function("return this")(); 25442} catch (e) { 25443 // This works if the window reference is available 25444 if (typeof window === "object") g = window; 25445} 25446 25447// g can still be undefined, but nothing to do about it... 25448// We return undefined, instead of nothing here, so it's 25449// easier to handle this case. if(!global) { ...} 25450 25451module.exports = g; 25452 25453 25454/***/ }), 25455
25456/***/ "../src/static/js/main.js": 25457/*!********************************!*\ 25458 !*** ../src/static/js/main.js ***! 25459 \********************************/ 25460/*! no exports provided */ 25461/***/ (function(module, __webpack_exports__, __webpack_require__) { 25462 25463"use strict"; 25464__webpack_require__.r(__webpack_exports__); 25465/* harmony import */ var _modules_handle_nav_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modules/handle-nav.js */ "../src/static/js/modules/handle-nav.js"); 25466/* harmony import */ var _modules_handle_nav_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_modules_handle_nav_js__WEBPACK_IMPORTED_MODULE_0__); 25467/* harmony import */ var _modules_handle_dropdown_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modules/handle-dropdown.js */ "../src/static/js/modules/handle-dropdown.js"); 25468/* harmony import */ var _modules_handle_search_dropdown_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modules/handle-search-dropdown.js */ "../src/static/js/modules/handle-search-dropdown.js"); 25469/* harmony import */ var _modules_handle_favourites_dropdown_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/handle-favourites-dropdown.js */ "../src/static/js/modules/handle-favourites-dropdown.js"); 25470/* harmony import */ var _modules_init_sliders_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modules/init-sliders.js */ "../src/static/js/modules/init-sliders.js"); 25471/* harmony import */ var _modules_init_popups_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./modules/init-popups.js */ "../src/static/js/modules/init-popups.js"); 25472/* harmony import */ var _modules_init_tabs_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./modules/init-tabs.js */ "../src/static/js/modules/init-tabs.js"); 25473/* harmony import */ var _modules_init_tabs_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_modules_init_tabs_js__WEBPACK_IMPORTED_MODULE_6__); 25474/* harmony import */ var _modules_init_image_switcher__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./modules/init-image-switcher */ "../src/static/js/modules/init-image-switcher.js"); 25475/* harmony import */ var _modules_init_image_switcher__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_modules_init_image_switcher__WEBPACK_IMPORTED_MODULE_7__); 25476/* harmony import */ var _modules_handle_accordions_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./modules/handle-accordions.js */ "../src/static/js/modules/handle-accordions.js"); 25477/* harmony import */ var _modules_handle_filter_component_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./modules/handle-filter-component.js */ "../src/static/js/modules/handle-filter-component.js"); 25478/* harmony import */ var _modules_handle_filter_day_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./modules/handle-filter-day.js */ "../src/static/js/modules/handle-filter-day.js"); 25479/* harmony import */ var _modules_handle_filter_age_max_checks_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./modules/handle-filter-age-max-checks.js */ "../src/static/js/modules/handle-filter-age-max-checks.js"); 25480/* harmony import */ var _modules_handle_filter_age_max_checks_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_modules_handle_filter_age_max_checks_js__WEBPACK_IMPORTED_MODULE_11__); 25481/* harmony import */ var _modules_handle_tooltips_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./modules/handle-tooltips.js */ "../src/static/js/modules/handle-tooltips.js"); 25482/* harmony import */ var _modules_handle_favourite_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./modules/handle-favourite.js */ "../src/static/js/modules/handle-favourite.js"); 25483/* harmony import */ var _modules_handle_mobile_filters_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./modules/handle-mobile-filters.js */ "../src/static/js/modules/handle-mobile-filters.js"); 25484/* harmony import */ var _modules_handle_cart_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./modules/handle-cart.js */ "../src/static/js/modules/handle-cart.js"); 25485/* harmony import */ var _modules_handle_register_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./modules/handle-register.js */ "../src/static/js/modules/handle-register.js"); 25486/* harmony import */ var _modules_handle_register_js__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_modules_handle_register_js__WEBPACK_IMPORTED_MODULE_16__); 25487/* harmony import */ var _modules_handle_instructions_popup_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./modules/handle-instructions-popup.js */ "../src/static/js/modules/handle-instructions-popup.js"); 25488/* harmony import */ var _modules_handle_instructions_popup_js__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_modules_handle_instructions_popup_js__WEBPACK_IMPORTED_MODULE_17__); 25489/* harmony import */ var _modules_handle_popup_window_component_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./modules/handle-popup-window-component.js */ "../src/static/js/modules/handle-popup-window-component.js"); 25490/* harmony import */ var _modules_handle_popup_window_component_js__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(_modules_handle_popup_window_component_js__WEBPACK_IMPORTED_MODULE_18__); 25491/* harmony import */ var _modules_handle_datepicker_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./modules/handle-datepicker.js */ "../src/static/js/modules/handle-datepicker.js"); 25492/* harmony import */ var _modules_handle_map_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./modules/handle-map.js */ "../src/static/js/modules/handle-map.js"); 25493/* harmony import */ var _modules_handle_map_js__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(_modules_handle_map_js__WEBPACK_IMPORTED_MODULE_20__); 25494/* harmony import */ var _modules_handle_find_y_map_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./modules/handle-find-y-ma
25494p.js */ "../src/static/js/modules/handle-find-y-map.js"); 25495/* harmony import */ var _modules_handle_hero_alert_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./modules/handle-hero-alert.js */ "../src/static/js/modules/handle-hero-alert.js"); 25496/* harmony import */ var _modules_handle_megamenu_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./modules/handle-megamenu.js */ "../src/static/js/modules/handle-megamenu.js"); 25497/* harmony import */ var _modules_handle_megamenu_js__WEBPACK_IMPORTED_MODULE_23___default = /*#__PURE__*/__webpack_require__.n(_modules_handle_megamenu_js__WEBPACK_IMPORTED_MODULE_23__); 25498/* harmony import */ var _modules_handle_minimap_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./modules/handle-minimap.js */ "../src/static/js/modules/handle-minimap.js"); 25499/* harmony import */ var _modules_handle_checkbox_on_map_location_click_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./modules/handle-checkbox-on-map-location-click.js */ "../src/static/js/modules/handle-checkbox-on-map-location-click.js"); 25500/* harmony import */ var _modules_handle_location_checks_and_text_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./modules/handle-location-checks-and-text.js */ "../src/static/js/modules/handle-location-checks-and-text.js"); 25501/* harmony import */ var _modules_handle_location_checks_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./modules/handle-location-checks.js */ "../src/static/js/modules/handle-location-checks.js"); 25502/* harmony import */ var _modules_handle_locations_autocomplete_filter_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./modules/handle-locations-autocomplete-filter.js */ "../src/static/js/modules/handle-locations-autocomplete-filter.js"); 25503/* harmony import */ var _modules_handle_locations_autocomplete_filter_js__WEBPACK_IMPORTED_MODULE_28___default = /*#__PURE__*/__webpack_require__.n(_modules_handle_locations_autocomplete_filter_js__WEBPACK_IMPORTED_MODULE_28__); 25504/* harmony import */ var _modules_handle_who_checks_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./modules/handle-who-checks.js */ "../src/static/js/modules/handle-who-checks.js"); 25505/* harmony import */ var _modules_handle_who_checks_js__WEBPACK_IMPORTED_MODULE_29___default = /*#__PURE__*/__webpack_require__.n(_modules_handle_who_checks_js__WEBPACK_IMPORTED_MODULE_29__); 25506/* harmony import */ var _modules_handle_when_checks_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./modules/handle-when-checks.js */ "../src/static/js/modules/handle-when-checks.js"); 25507/* harmony import */ var _modules_handle_what_checks_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./modules/handle-what-checks.js */ "../src/static/js/modules/handle-what-checks.js"); 25508/* harmony import */ var _modules_handle_what_checks_js__WEBPACK_IMPORTED_MODULE_31___default = /*#__PURE__*/__webpack_require__.n(_modules_handle_what_checks_js__WEBPACK_IMPORTED_MODULE_31__); 25509/* harmony import */ var _modules_handle_cookies_js__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./modules/handle-cookies.js */ "../src/static/js/modules/handle-cookies.js"); 25510/* harmony import */ var _modules_handle_show_content_js__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./modules/handle-show-content.js */ "../src/static/js/modules/handle-show-content.js"); 25511/* harmony import */ var _modules_handle_show_content_js__WEBPACK_IMPORTED_MODULE_33___default = /*#__PURE__*/__webpack_require__.n(_modules_handle_show_content_js__WEBPACK_IMPORTED_MODULE_33__); 25512/* harmony import */ var _modules_handle_filter_selection_js__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./modules/handle-filter-selection.js */ "../src/static/js/modules/handle-filter-selection.js"); 25513/* harmony import */ var _modules_handle_filter_selection_js__WEBPACK_IMPORTED_MODULE_34___default = /*#__PURE__*/__webpack_require__.n(_modules_handle_filter_selection_js__WEBPACK_IMPORTED_MODULE_34__); 25514/* harmony import */ var _modules_handle_review_js__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./modules/handle-review.js */ "../src/static/js/modules/handle-review.js"); 25515/* harmony import */ var _modules_handle_review_js__WEBPACK_IMPORTED_MODULE_35___default = /*#__PURE__*/__webpack_require__.n(_modules_handle_review_js__WEBPACK_IMPORTED_MODULE_35__); 25516/* harmony import */ var _modules_infinite_scroll_reviews_js__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./modules/infinite-scroll-reviews.js */ "../src/static/js/modules/infinite-scroll-reviews.js"); 25517/* harmony import */ var _modules_review_masonry_js__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./modules/review-masonry.js */ "../src/static/js/modules/review-masonry.js"); 25518/* harmony import */ var _modules_review_masonry_js__WEBPACK_IMPORTED_MODULE_37___default = /*#__PURE__*/__webpack_require__.n(_modules_review_masonry_js__WEBPACK_IMPORTED_MODULE_37__); 25519/* harmony import */ var _modules_init_wordcloud__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./modules/init-wordcloud */ "../src/static/js/modules/init-wordcloud.js"); 25520/* harmony import */ var _modules_init_wordcloud__WEBPACK_IMPORTED_MODULE_38___default = /*#__PURE__*/__webpack_require__.n(_modules_init_wordcloud__WEBPACK_IMPORTED_MODULE_38__); 25521/* harmony import */ var _modules_facetedsearch__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./modules/facetedsearch */ "../src/static/js/modules/facetedsearch.js"); 25522/* harmony import */ var _modules_handle_yguide_search__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./modules/handle-yguide-search */ "../src/static/js/modules/handle-yguide-search.js"); 25523/* harmony import */ var _utils_custom_js__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./utils/custom.js */ "../src/static/js/utils/custom.js"); 25524/* harmony import */ var _utils_custom_js__WEBPACK_IMPORTED_MODULE_41___default = /*#__PURE__*/__webpack_require__.n(_utils_custom_js__WEBPACK_IMPORTED_MODULE_41__); 25525/* harmony import */ var _utils_find_y_map_js__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./utils/find-y-ma
25525p.js */ "../src/static/js/utils/find-y-map.js"); 25526/* harmony import */ var _utils_utm_capture_js__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./utils/utm-capture.js */ "../src/static/js/utils/utm-capture.js"); 25527/* harmony import */ var _utils_custom_form_settings_js__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./utils/custom-form-settings.js */ "../src/static/js/utils/custom-form-settings.js"); 25528/* harmony import */ var _utils_custom_form_settings_js__WEBPACK_IMPORTED_MODULE_44___default = /*#__PURE__*/__webpack_require__.n(_utils_custom_form_settings_js__WEBPACK_IMPORTED_MODULE_44__); 25529/* harmony import */ var _utils_js_forms_js__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./utils/js-forms.js */ "../src/static/js/utils/js-forms.js"); 25530/* harmony import */ var _utils_js_forms_js__WEBPACK_IMPORTED_MODULE_45___default = /*#__PURE__*/__webpack_require__.n(_utils_js_forms_js__WEBPACK_IMPORTED_MODULE_45__); 25531/* harmony import */ var _utils_global_print_js__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./utils/global-print.js */ "../src/static/js/utils/global-print.js"); 25532/* harmony import */ var _utils_global_print_js__WEBPACK_IMPORTED_MODULE_46___default = /*#__PURE__*/__webpack_require__.n(_utils_global_print_js__WEBPACK_IMPORTED_MODULE_46__); 25533/* harmony import */ var _utils_global_event_listeners_js__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./utils/global-event-listeners.js */ "../src/static/js/utils/global-event-listeners.js"); 25534/* harmony import */ var _utils_global_event_listeners_js__WEBPACK_IMPORTED_MODULE_47___default = /*#__PURE__*/__webpack_require__.n(_utils_global_event_listeners_js__WEBPACK_IMPORTED_MODULE_47__); 25535 25536 25537 25538 25539 25540 25541 25542 25543 25544 25545 25546 25547 25548 25549 25550 25551 25552 25553 25554 25555 25556 25557 25558 25559 25560 25561 25562 25563 25564 25565 25566 25567 25568 25569 25570 25571 25572 25573 25574 25575 25576 25577 25578 25579 25580 25581 25582 25583 25584/***/ }), 25585
25586/***/ "../src/static/js/modules/facetedsearch.js": 25587/*!*************************************************!*\ 25588 !*** ../src/static/js/modules/facetedsearch.js ***! 25589 \*************************************************/ 25590/*! no exports provided */ 25591/***/ (function(module, __webpack_exports__, __webpack_require__) { 25592 25593"use strict"; 25594__webpack_require__.r(__webpack_exports__); 25595/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var _handle_filter_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./handle-filter-component */ "../src/static/js/modules/handle-filter-component.js"); 25596/* harmony import */ var _handle_cart__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./handle-cart */ "../src/static/js/modules/handle-cart.js"); 25597/* harmony import */ var _handle_mobile_filters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./handle-mobile-filters */ "../src/static/js/modules/handle-mobile-filters.js"); 25598/* harmony import */ var _handle_accordions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./handle-accordions */ "../src/static/js/modules/handle-accordions.js"); 25599/* harmony import */ var _handle_tooltips__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./handle-tooltips */ "../src/static/js/modules/handle-tooltips.js"); 25600/* harmony import */ var _handle_yguide_search__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./handle-yguide-search */ "../src/static/js/modules/handle-yguide-search.js"); 25601/* harmony import */ var _utils_globals__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/globals */ "../src/static/js/utils/globals.js"); 25602/* harmony import */ var _utils_generic_map__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/generic-map */ "../src/static/js/utils/generic-map.js"); 25603/* harmony import */ var _utils_constant__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/constant */ "../src/static/js/utils/constant.js"); 25604/* harmony import */ var _utils_helper__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/helper */ "../src/static/js/utils/helper.js"); 25605function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 25606 25607function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 25608 25609function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 25610 25611 25612 25613 25614 25615 25616 25617 25618 25619 25620 25621 25622var Facetedsearch = function () { 25623 function Facetedsearch(element) { 25624 _classCallCheck(this, Facetedsearch); 25625 25626 this.fSearchActivityListing = $(element); 25627 this.$inner = this.fSearchActivityListing.find('.facetedsearch__body'); 25628 this.hasLoadedOnce = false; 25629 25630 if (this.fSearchActivityListing.length) { 25631 this.bind(); 25632 } 25633 } 25634 25635 _createClass(Facetedsearch, [{ 25636 key: "bind", 25637 value: function bind() { 25638 var searchParameters = this.fSearchActivityListing.data('qsearch'); 25639 this.dxp2ComponentId = this.fSearchActivityListing.data('dxp2-component-id'); 25640 this.defaultParameters = 'custom_data=activity-finder-component'; 25641 25642 if (searchParameters) { 25643 this.defaultParameters += "&".concat(searchParameters); 25644 } 25645 25646 if (this.dxp2ComponentId) { 25647 this.defaultParameters += "&dxp2ComponentId=".concat(this.dxp2ComponentId); 25648 } 25649 25650 this.fetchActivities(); 25651 } 25652 }, { 25653 key: "fetchActivities", 25654 value: function fetchActivities(searchParameters) { 25655 var _this = this; 25656 25657 var queryString = this.defaultParameters; 25658 var extra = searchParameters || ''; 25659 25660 if (this.selectedBusStops && this.selectedBusStops.length > 0) { 25661 if (extra) { 25662 extra = extra.replace(/(^|&)origin\.site_name%5B%5D=[^&]*/g, '').replace(/(^|&)origin\.site_name\[\]=[^&]*/g, '').replace(/(^|&)bussing=1/g, '').replace(/^&/, ''); 25663 } 25664 25665 var siteNameParams = Array.from(this.selectedBusStops).filter(
25665Boolean).map(function (name) { 25666 return "origin.site_name%5B%5D=".concat(encodeURIComponent(name)); 25667 }).join('&'); 25668 var bussingParam = 'bussing=1'; 25669 extra = [extra, bussingParam, siteNameParams].filter(Boolean).join('&'); 25670 } 25671 25672 if (extra) { 25673 queryString += "&".concat(extra); 25674 } 25675 25676 if (queryString.indexOf('&page=') === -1) { 25677 queryString += '&page=1'; 25678 } 25679 25680 this.showLoading(); 25681 this.closeDrawer(); 25682 this.closeMap(); 25683 $.ajax({ 25684 url: '/search/activity-finder-component?' + queryString, 25685 type: 'GET', 25686 dataType: 'json', 25687 success: function success(data) { 25688 var _data$data, _data$data$_request; 25689 25690 _this.$inner.html(data.custom_data.html); 25691 25692 if (!_this.selectedBusStops) { 25693 _this.selectedBusStops = []; 25694 } 25695 25696 var filters = (data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : (_data$data$_request = _data$data._request) === null || _data$data$_request === void 0 ? void 0 : _data$data$_request.filters) || {}; 25697 25698 if (filters.site_name && Array.isArray(filters.site_name)) { 25699 _this.selectedSiteNames = filters.site_name.slice(); 25700 } else { 25701 _this.selectedSiteNames = []; 25702 } 25703 }, 25704 error: function error(err) { 25705 console.error('AJAX error:', err); 25706 25707 _this.$inner.html('<p>Error loading activities</p>'); 25708 }, 25709 complete: function complete() { 25710 var root = _this.fSearchActivityListing; 25711 var $root = $(root); 25712 var target = "#facetedsearch".concat(_this.dxp2ComponentId ? '-' + _this.dxp2ComponentId : ''); 25713 25714 _this.filterEvents($root); 25715 25716 _this.cartEvents($root); 25717 25718 _this.paginationEvents($root); 25719 25720 _this.processCheckbox($root); 25721 25722 if (_this.hasLoadedOnce || Object(_utils_helper__WEBPACK_IMPORTED_MODULE_9__["urlContains"])('find-a-y')) { 25723 _this.navigateToView(target); 25724 } 25725 25726 _this.bussingMap = null; 25727 _this.siteMap = null; 25728 25729 _this.initBussingMap($root); 25730 25731 _this.initSiteMap($root); 25732 25733 _this.hasLoadedOnce = true; 25734 25735 _this.hideLoading(); 25736 } 25737 }); 25738 } 25739 }, { 25740 key: "filterEvents", 25741 value: function filterEvents($root) { 25742 var _this = this; 25743 25744 Object(_handle_accordions__WEBPACK_IMPORTED_MODULE_3__["initAccordions"])($root); 25745 Object(_handle_filter_component__WEBPACK_IMPORTED_MODULE_0__["initFilterComponent"])($root); 25746 Object(_handle_mobile_filters__WEBPACK_IMPORTED_MODULE_2__["initMobileFilters"])($root); 25747 Object(_handle_yguide_search__WEBPACK_IMPORTED_MODULE_5__["initAnnouncementWidget"])($root); 25748 this.resetEvents($root); 25749 this.sortEvents($root); 25750 $root.find('.filter-group').each(function () { 25751 var $group = $(this); 25752 var $badge = $group.find('.filter-count'); 25753 var checkedCount = $group.find('input[type="checkbox"]:checked').length; 25754 25755 if ($badge.length) { 25756 $badge.text(checkedCount); 25757 25758 if (checkedCount > 0) { 25759 $badge.css('display', 'flex'); 25760 } else { 25761 $badge.hide(); 25762 } 25763 } 25764 }); 25765 $root.find('.toggle-btn').off('click.toggleDropdown').on('click.toggleDropdown', function (e) { 25766 e.preventDefault(); 25767 e.stopPropagation(); 25768 var $btn = $(this); 25769 var $parent = $btn.closest('.filter-group'); 25770 var $menu = $parent.find('.dropdown-menu'); 25771 var isActive = $parent.hasClass('active'); 25772 $root.find('.filter-group').not($parent).removeClass('active').find('.dropdown-menu').removeClass('show'); 25773 25774 if (isActive) { 25775 $parent.removeClass('active'); 25776 $menu.removeClass('show'); 25777 } else { 25778 $parent.addClass('active'); 25779 $menu.addClass('show'); 25780 } 25781 }); 25782 $(document).off("click.closeDropdowns_".concat(_this.dxp2ComponentId)).on("click.closeDropdowns_".concat(_this.dxp2ComponentId), function (e) { 25783 if (!$(e.target).closest('.filter-group').length) { 25784 $root.find('.filter-group').removeClass('active').find('.dropdown-menu').removeClass('show'); 25785 } 25786 }); 25787 } 25788 }, { 25789 key: "processCheckbox", 25790 value: function processCheckbox($root) { 25791 var _this = this; 25792 25793 var $checkboxes = $root.find('.filters input[type="checkbox"]').addClass('facetedsearch__checkbox').removeAttr('onclick'); 25794 25795 if (!this.fetchTimer) { 25796 this.fetchTimer = null; 25797 } 25798 25799 $checkboxes.off('change.fsearchCheckboxEvent').on('change.fsearchCheckboxEvent', function (e) { 25800 var $checkbox = $(this); 25801 var isSiteName = $checkbox.attr('name') === 'site_name[]';
25802 var delay = isSiteName ? 2000 : 1500; 25803 25804 if (_this.fetchTimer) { 25805 clearTimeout(_this.fetchTimer); 25806 } 25807 25808 _this.fetchTimer = setTimeout(function () { 25809 var $form = $checkbox.closest('form'); 25810 var params = $form.length ? $form.serialize() : ''; 25811 25812 _this.fetchActivities(params); 25813 }, delay); 25814 }); 25815 } 25816 }, { 25817 key: "resetEvents", 25818 value: function resetEvents($root) { 25819 var _this = this; 25820 25821 $root.find('.js-remove-filter').removeAttr('onclick'); 25822 $root.off('click.activeFilter', '.js-remove-filter').on('click.activeFilter', '.js-remove-filter', function (e) { 25823 e.preventDefault(); 25824 e.stopPropagation(); 25825 var $tag = $(this); 25826 var key = $tag.data('key'); 25827 var value = $tag.data('value'); 25828 if (!key) return; 25829 var selector = "input[type='checkbox'][name='" + key + "[]'][value='" + value + "']"; 25830 var $checkboxes = $root.find(selector); 25831 $checkboxes.each(function () { 25832 var checkbox = this; 25833 25834 if (checkbox.checked) { 25835 checkbox.click(); 25836 } 25837 }); 25838 }); 25839 $root.off('click.resetFilters', '.filter-badge--reset').on('click.resetFilters', '.filter-badge--reset', function (e) { 25840 e.preventDefault(); 25841 25842 _this.fetchActivities(); 25843 }); 25844 $root.off('click.mobileResetFilters', '.filters__clear').on('click.mobileResetFilters', '.filters__clear', function (e) { 25845 e.preventDefault(); 25846 25847 _this.fetchActivities(); 25848 }); 25849 } 25850 }, { 25851 key: "sortEvents", 25852 value: function sortEvents($root) { 25853 var _this = this; 25854 25855 $root.off('click.facetedSortDesktop', '.js-sort-option').on('click.facetedSortDesktop', '.js-sort-option', function (e) { 25856 e.preventDefault(); 25857 e.stopPropagation(); 25858 var $option = $(this); 25859 var sortVal = $option.data('value'); 25860 if (!sortVal) return; 25861 var $form = $option.closest('form'); 25862 25863 if (!$form.length) { 25864 console.warn('Desktop sort — no parent form found'); 25865 return; 25866 } 25867 25868 var $group = $option.closest('.filter-group'); 25869 var $trigger = $group.find('.sort-trigger'); 25870 var labelText = $.trim($option.clone().children('span').remove().end().text()); 25871 $trigger.find('strong').text(labelText); 25872 var $sortMaster = $root.find('#sort-master-' + _this.dxp2ComponentId); 25873 25874 if ($sortMaster.length) { 25875 $sortMaster.val(sortVal); 25876 } 25877 25878 var $menu = $option.closest('.dropdown-menu'); 25879 $menu.find('.sort-check').remove(); 25880 $('<span class="sort-check" style="float:right;">✓</span>').appendTo($option); 25881 var params = $form.serialize(); 25882 $group.removeClass('active'); 25883 $menu.removeClass('show'); 25884 25885 _this.fetchActivities(params); 25886 }); 25887 $root.off('change.facetedSortMobile', '.js-sort-option-mobile').on('change.facetedSortMobile', '.js-sort-option-mobile', function (e) { 25888 e.preventDefault(); 25889 e.stopPropagation(); 25890 var $option = $(this); 25891 var sortVal = $option.val(); 25892 if (!sortVal) return; 25893 var $sortMaster = $root.find('#sort-master-' + _this.dxp2ComponentId); 25894 25895 if (!$sortMaster.length) { 25896 console.warn('Mobile sort — master sort input not found'); 25897 return; 25898 } 25899 25900 $sortMaster.val(sortVal); 25901 var $desktopForm = $sortMaster.closest('form'); 25902 25903 if (!$desktopForm.length) { 25904 console.warn('Mobile sort — desktop form not found'); 25905 return; 25906 } 25907 25908 var params = $desktopForm.serialize(); 25909 25910 _this.fetchActivities(params); 25911 }); 25912 } 25913 }, { 25914 key: "paginationEvents", 25915 value: function paginationEvents($root) { 25916 var _this = this; 25917 25918 $root.off('click.facetedPaging', '.pagination__prev, .pagination__next').on('click.facetedPaging', '.pagination__prev, .pagination__next', function (e) { 25919 e.preventDefault(); 25920 var $link = $(this); 25921 var href = $link.attr('href') || ''; 25922 var qIndex = href.indexOf('?'); 25923 25924 if (qIndex === -1) { 25925 return; 25926 } 25927 25928 var query = href.substring(qIndex + 1); 25929 var pageMatch = query.match(/(?:^|&)page=(\d+)/); 25930 var pageNum = pageMatch ? pageMatch[1] : null; 25931 var $form = $link.closest('form'); 25932 var formParams = $form.length ? $form.serialize() : ''; 25933 25934 if (formParams) { 25935 formParams = formParams.replace(/(^|&)page=\d+/g, '').replace(/^&/, ''); 25936 } 25937 25938 var params = formParams; 25939 25940 if (pageNum) { 25941 if (params) { 25942 params += "&page=".concat(pageNum); 25943 } else { 25944 params = "page=".concat(pageNum); 25945 } 25946 } 25947 25948 _this.fetchActivities(params); 25949 }); 25950 } 25951 }, { 25952 key: "cartEvents", 25953 value: function cartEvents($root) { 25954 $root.find('.js-button--add').off('click.cartAdd').on('click.cartAdd', function (event) { 25955 var src = $(event.currentTarget); 25956 var productId = src.data('product-id'); 25957 var request = '/add-to-guide/' + productId; 25958 event.preventDefault(); 25959 src.addClass('cart-trigger--disabled'); 25960 Object(_handle_cart__WEBPACK_IMPORTED_MODULE_1__["sendCartRequest"])(request); 25961 }); 25962 } 25963 }, { 25964 key: "closeDrawer", 25965 value: function closeDrawer() { 25966 $(this.fSearchActivityListing).find('.js-aside').removeClass('is-active'); 25967 25968 if (_utils_globals__WEBPACK_IMPORTED_MODULE_6__["$body"].hasClass('open-filters')) { 25969 _utils_globals__WEBPACK_IMPORTED_MODULE_6__["$body"].removeClass('open-filters'); 25970 } 25971 } 25972 }, { 25973 key: "closeMap", 25974 value: function closeMap() { 25975 if ($.magnificPopup.instance && $.magnificPopup.instance.isOpen) { 25976 $.magnificPopup.close(); 25977 } 25978 } 25979 }, { 25980 key: "showLoading", 25981 value: function showLoading() { 25982 this.fSearchActivityListing.find('.facetedsearch__loading-indicator').css('display', 'flex'); 25983 } 25984 }, {
25985 key: "hideLoading", 25986 value: function hideLoading() { 25987 this.fSearchActivityListing.find('.facetedsearch__loading-indicator').hide(); 25988 } 25989 }, { 25990 key: "navigateToView", 25991 value: function navigateToView(selector) { 25992 var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; 25993 var speed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 300; 25994 var $el; 25995 25996 if (!selector) { 25997 $el = this.fSearchActivityListing; 25998 } else if (selector.charAt(0) === '#') { 25999 $el = $(selector).first(); 26000 } else { 26001 $el = this.fSearchActivityListing.find(selector).first(); 26002 } 26003 26004 if ($el.length) { 26005 $('html, body').animate({ 26006 scrollTop: $el.offset().top + offset 26007 }, speed); 26008 } 26009 } 26010 }, { 26011 key: "initBussingMap", 26012 value: function initBussingMap($root) { 26013 var self = this; 26014 var dxpId = this.dxp2ComponentId; 26015 var popupSelector = "#bussing-map-".concat(dxpId); 26016 var $popup = $root.find(popupSelector); 26017 26018 if (!$popup.length) { 26019 return; 26020 } 26021 26022 var $hintContainer = $popup.find('.popup__hint'); 26023 var $locationText = $popup.find('.js-location-text'); 26024 var mapSelector = "".concat(popupSelector, " .generic-map"); 26025 var $mapEl = $popup.find('.generic-map'); 26026 26027 if (!$mapEl.length) { 26028 console.warn('Bussing map: .generic-map element not found in popup', popupSelector); 26029 return; 26030 } 26031 26032 var $bussingBlock = $root.find('.bussing-block'); 26033 var $checkbox = $bussingBlock.find('input[name="bussing"]'); 26034 var $popupLink = $bussingBlock.find('.open-bussing-map, .js-generic-map'); 26035 26036 if (!this.selectedBusStops) { 26037 this.selectedBusStops = []; 26038 } 26039 26040 $popupLink.magnificPopup({ 26041 type: 'inline', 26042 preloader: true, 26043 fixedContentPos: true, 26044 closeOnBgClick: true, 26045 mainClass: 'popup-container', 26046 callbacks: { 26047 open: function open() { 26048 if (!self.bussingMap) { 26049 self.bussingMap = new _utils_generic_map__WEBPACK_IMPORTED_MODULE_7__["GenericMap"]({ 26050 mapSelector: mapSelector, 26051 defaultIcon: '/static/images/map-pin.png', 26052 selectedIcon: '/static/images/map-pin-selected.png', 26053 entity: 'Stop', 26054 btnCssClass: 'button button--red card__btn js-bus-stop-select', 26055 applyFilters: function applyFilters() { 26056 this.filteredSites = Object(_handle_yguide_search__WEBPACK_IMPORTED_MODULE_5__["filterBussingStops"])({ 26057 allSites: this.sites, 26058 selectedSiteNames: self.selectedSiteNames, 26059 selectedBusStops: self.selectedBusStops, 26060 markerFilter: this.markerFilter 26061 }); 26062 }, 26063 helpers: { 26064 listAddress: function listAddress(address) { 26065 if (address.street.length < 1) { 26066 return ''; 26067 } 26068 26069 var addressArray = [address.street, address.city, [address.state, address.postcode].join(' ')]; 26070 var addressLines = addressArray.join(', '); 26071 return "\n <div class=\"card__section\">\n <svg class=\"ico-map-location ico--left\">\n <use xlink:href=\"/static/images/sprite.svg#ico-map-location\"></use>\n </svg>\n <div class=\"card__section-text\">\n <address>".concat(addressLines, "</address>\n </div>\n </div>\n "); 26072 } 26073 } 26074 }); 26075 } 26076 26077 self.bussingMap.init().then(function () { 26078 if (Array.isArray(self.selectedBusStops) && self.selectedBusStops.length) { 26079 self.bussingMap.syncSelectedMarkers(self.selectedBusStops); 26080 } 26081 }); 26082 self.bussingMap.helpers.shouldShowHelperText(_utils_globals__WEBPACK_IMPORTED_MODULE_6__["$document"], ".js-bussing-intro-".concat(dxpId), _utils_constant__WEBPACK_IMPORTED_MODULE_8__["MAP_HELPER_TEXT_KEY"]); 26083 self.bussingMap.helpers.updateHintText(self.selectedBusStops, $locationText, $hintContainer); 26084 }, 26085 close: function close() { 26086 var $form = $checkbox.closest('form'); 26087 26088 if (self.selectedBusStops.length === 0) { 26089 $checkbox.prop('checked', false); 26090 26091 var _params = $form.length ? $form.serialize() : ''; 26092 26093 self.fetchActivities(_params); 26094 return; 26095 } 26096 26097 $checkbox.prop('checked', true); 26098 var params = $form.length ? $form.serialize() : ''; 26099 var busParam = self.selectedBusStops.map(function (name) { 26100 return "origin.site_name[]=".concat(encodeURIComponent(name)); 26101 }).join('&'); 26102 params = params ? "".concat(params, "&").concat(busParam) : busParam; 26103 self.fetchActivities(params); 26104 } 26105 } 26106 }); 26107 $checkbox.off('change.bussingToggle').on('change.bussingToggle', function () { 26108 if (this.checked) { 26109 $popupLink.first().trigger('click'); 26110 } else { 26111 self.selectedBusStops = []; 26112 var $form = $checkbox.closest('form'); 26113 var params = $form.length ? $form.serialize() : ''; 26114 self.fetchActivities(params); 26115 } 26116 }); 26117 var ns = "busStopSelect_".concat(dxpId); 26118 _utils_globals__WEBPACK_IMPORTED_MODULE_6__["$body"].off("click.".concat(ns)).on("click.".concat(ns), "".concat(popupSelector, " .js-bus-stop-select"), function (e) { 26119 var _self$bussingMap, _self$bussingMap2; 26120 26121 e.preventDefault(); 26122 var $btn = $(this); 26123 var siteName = $btn.data('site-name'); 26124 26125 if (!siteName) { 26126 return; 26127 } 26128 26129 var key = String(siteName); 26130 26131 if (!Array.isArray(self.selectedBusStops)) { 26132 self.selectedBusStops = []; 26133 } 26134 26135 var idx = self.selectedBusStops.indexOf(key); 26136 var isSelectedNow; 26137 26138 if (idx !== -1) { 26139 self.selectedBusStops.splice(idx, 1); 26140 isSelectedNow = false;
26141 } else { 26142 self.selectedBusStops.push(key); 26143 isSelectedNow = true; 26144 } 26145 26146 var label = isSelectedNow ? "Unselect this ".concat(((_self$bussingMap = self.bussingMap) === null || _self$bussingMap === void 0 ? void 0 : _self$bussingMap.entity) || 'Stop') : "Select this ".concat(((_self$bussingMap2 = self.bussingMap) === null || _self$bussingMap2 === void 0 ? void 0 : _self$bussingMap2.entity) || 'Stop'); 26147 $btn.text(label); 26148 26149 if (self.bussingMap && typeof self.bussingMap.syncSelectedMarkers === 'function') { 26150 self.bussingMap.syncSelectedMarkers(self.selectedBusStops); 26151 } 26152 26153 self.bussingMap.helpers.updateHintText(self.selectedBusStops, $locationText, $hintContainer); 26154 }); 26155 } 26156 }, { 26157 key: "initSiteMap", 26158 value: function initSiteMap($root) { 26159 var self = this; 26160 var dxpId = this.dxp2ComponentId; 26161 var popupSelector = "#site-map".concat(dxpId ? "-".concat(dxpId) : ''); 26162 var $popup = $root.find(popupSelector); 26163 var $popupLink = $root.find('.site-map-widget .js-generic-map'); 26164 var $mobilePopupLink = $root.find('.facetedsearch-map-widget .js-generic-map'); 26165 var $locationText = $popup.find('.js-location-text'); 26166 var $hintContainer = $popup.find('.popup__hint'); 26167 26168 if (!$popup.length) { 26169 return; 26170 } 26171 26172 var mapSelector = "".concat(popupSelector, " .generic-map"); 26173 var $mapEl = $popup.find('.generic-map'); 26174 26175 if (!$mapEl.length) { 26176 console.warn('Site map: .generic-map element not found in popup', popupSelector); 26177 return; 26178 } 26179 26180 if (!Array.isArray(this.selectedSiteNames)) { 26181 this.selectedSiteNames = []; 26182 } 26183 26184 $popupLink.add($mobilePopupLink).magnificPopup({ 26185 type: 'inline', 26186 preloader: true, 26187 fixedContentPos: true, 26188 closeOnBgClick: true, 26189 mainClass: 'popup-container', 26190 callbacks: { 26191 open: function open() { 26192 if (!self.siteMap) { 26193 self.siteMap = new _utils_generic_map__WEBPACK_IMPORTED_MODULE_7__["GenericMap"]({ 26194 mapSelector: mapSelector, 26195 btnCssClass: 'button button--red card__btn js-site-select', 26196 markerFilter: function markerFilter(site) { 26197 return site.stopOnly !== true; 26198 } 26199 }); 26200 } 26201 26202 self.siteMap.init().then(function () { 26203 self.siteMap.syncSelectedMarkers(self.selectedSiteNames); 26204 }); 26205 self.siteMap.helpers.updateHintText(self.selectedSiteNames, $locationText, $hintContainer); 26206 }, 26207 close: function close() { 26208 var $form = $root.find('.facetedsearch__form'); 26209 var selectedNames = Array.isArray(self.selectedSiteNames) ? self.selectedSiteNames : []; 26210 var params = $form.length ? $form.serialize() : ''; 26211 26212 if (params) { 26213 params = params.replace(/(^|&)site_name%5B%5D=[^&]*/g, '').replace(/(^|&)site_name\[\]=[^&]*/g, '').replace(/^&/, ''); 26214 } 26215 26216 if (selectedNames.length) { 26217 var siteParams = selectedNames.map(function (name) { 26218 return "site_name%5B%5D=".concat(encodeURIComponent(name)); 26219 }).join('&'); 26220 params = params ? "".concat(params, "&").concat(siteParams) : siteParams; 26221 } 26222 26223 self.fetchActivities(params); 26224 } 26225 } 26226 }); 26227 var ns = "siteMapSelect_".concat(dxpId); 26228 _utils_globals__WEBPACK_IMPORTED_MODULE_6__["$body"].off("click.".concat(ns)).on("click.".concat(ns), "".concat(popupSelector, " .js-site-select"), function (e) { 26229 e.preventDefault(); 26230 var $btn = $(this); 26231 var siteName = $btn.data('site-name'); 26232 if (!siteName) return; 26233 var key = String(siteName); 26234 26235 if (!Array.isArray(self.selectedSiteNames)) { 26236 self.selectedSiteNames = []; 26237 } 26238 26239 var idx = self.selectedSiteNames.indexOf(key); 26240 var isSelectedNow; 26241 26242 if (idx !== -1) { 26243 self.selectedSiteNames.splice(idx, 1); 26244 isSelectedNow = false;
26245 } else { 26246 self.selectedSiteNames.push(key); 26247 isSelectedNow = true; 26248 } 26249 26250 var label = isSelectedNow ? 'Unselect this location' : 'Select this location'; 26251 $btn.text(label); 26252 26253 if (self.siteMap) { 26254 self.siteMap.syncSelectedMarkers(self.selectedSiteNames); 26255 } 26256 26257 self.siteMap.helpers.updateHintText(self.selectedSiteNames, $locationText, $hintContainer); 26258 }); 26259 } 26260 }]); 26261 26262 return Facetedsearch; 26263}(); 26264 26265$(document).ready(function () { 26266 $('.facetedsearch__content').each(function () { 26267 new Facetedsearch(this); 26268 }); 26269}); 26270/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 26271 26272/***/ }), 26273
26274/***/ "../src/static/js/modules/handle-accordions.js": 26275/*!*****************************************************!*\ 26276 !*** ../src/static/js/modules/handle-accordions.js ***! 26277 \*****************************************************/ 26278/*! exports provided: initAccordions */ 26279/***/ (function(module, __webpack_exports__, __webpack_require__) { 26280 26281"use strict"; 26282__webpack_require__.r(__webpack_exports__); 26283/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initAccordions", function() { return initAccordions; }); 26284/* harmony import */ var _utils_globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/globals */ "../src/static/js/utils/globals.js"); 26285 26286function initAccordions() { 26287 var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 26288 var $root = $(root); 26289 var $accordion = $root.find('.js-accordion'); 26290 $accordion.each(function () { 26291 $(this).find('.accordion__section').not('.is-active').find('.accordion__body').hide(); 26292 }); 26293 $accordion.off('click.accordionMain', '.accordion__head').on('click.accordionMain', '.accordion__head', function (event) { 26294 var $target = $(event.target); 26295 26296 if ($target.hasClass('js-main-checkbox') || $target.closest('.js-main-checkbox').length > 0 || $target.is('a')) { 26297 return; 26298 } 26299 26300 var $head = $(this); 26301 var $section = $head.closest('.accordion__section'); 26302 var $body = $head.next('.accordion__body'); 26303 $body.stop().slideToggle(); 26304 $section.toggleClass('is-active'); 26305 event.preventDefault(); 26306 }); 26307 $accordion.off('click.accordionSection', '.accordion__section').on('click.accordionSection', '.accordion__section', function () { 26308 var $section = $(this); 26309 26310 if ($section.hasClass('is-active')) { 26311 $section.find('.accordion__body').height('auto'); 26312 } 26313 }); 26314 $accordion.off('click.accordionCounter', '.accordion__head').on('click.accordionCounter', '.accordion__head', function (event) { 26315 var $this = $(this); 26316 var $closestAccordionSection = $this.closest('.accordion__section'); 26317 var $currentCounter = $closestAccordionSection.find('.accordion__counter'); 26318 26319 if ($closestAccordionSection.hasClass('is-active') !== true) { 26320 var counterNumber = 0; 26321 $closestAccordionSection.find('.js-counter-outer').each(function (idx, counter) { 26322 var value = parseInt($(counter).text(), 10) || 0; 26323 counterNumber += value; 26324 }); 26325 26326 if (counterNumber > 0) { 26327 $closestAccordionSection.addClass('counter-is-visible'); 26328 $currentCounter.text(counterNumber); 26329 } else { 26330 $closestAccordionSection.removeClass('counter-is-visible'); 26331 $currentCounter.text(0); 26332 } 26333 } 26334 }); 26335 var $accordionProgram = $root.find('.js-accordion-program'); 26336 $accordionProgram.off('click.accordionProgram', '.accordion__head').on('click.accordionProgram', '.accordion__head', function () { 26337 $(this).next().stop().slideToggle().parent().toggleClass('is-active'); 26338 }); 26339 var $accordionSearch = $root.find('.js-accordion-search'); 26340 $accordionSearch.each(function () { 26341 $(this).find('.accordion__section').not('.is-active').find('.accordion__body').hide(); 26342 }); 26343 $accordionSearch.off('click.accordionSearchNav', '.accordion__nav a').on('click.accordionSearchNav', '.accordion__nav a', function (event) { 26344 var $this = $(this); 26345 var dataSearch = $this.data('search'); 26346 var $currentSection = $root.find("#".concat(dataSearch)); 26347 $this.closest('li').toggleClass('is-active').siblings().removeClass('is-active'); 26348 $currentSection.toggleClass('is-active').find('.accordion__head').toggleClass('is-active').siblings('.accordion__body').stop().slideToggle(); 26349 $currentSection.siblings('.accordion__section').removeClass('is-active').find('.accordion__head').removeClass('is-active').siblings('.accordion__body').slideUp(); 26350 event.preventDefault(); 26351 }); 26352 $accordionSearch.off('click.accordionSearchHead', '.accordion__head').on('click.accordionSearchHead', '.accordion__head', function (event) { 26353 var $section = $(this).closest('.accordion__section'); 26354 var currentSectionId = $section.attr('id'); 26355 var $currentAccordionNavLink = $root.find("[data-search='".concat(currentSectionId, "']")); 26356 $(this).next('.accordion__body').stop().slideToggle().parent().toggleClass('is-active').siblings('.accordion__section').removeClass('is-active').find('.accordion__body').slide
26356Up(); 26357 $currentAccordionNavLink.parent().toggleClass('is-active').siblings().removeClass('is-active'); 26358 event.preventDefault(); 26359 }); 26360 26361 var collapseAccordions = function collapseAccordions($scope) { 26362 $scope.find('.accordion-program.js-accordion-program .accordion__section:not(.is-active)').each(function () { 26363 $(this).find('.accordion__body').hide(); 26364 }); 26365 }; 26366 26367 collapseAccordions($root); 26368} 26369$(function () { 26370 initAccordions(document); 26371}); 26372/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 26373 26374/***/ }), 26375
vendor: 9,642 bytes, lines 26376-26390
26376/***/ "../src/static/js/modules/handle-cart.js": 26377/*!***********************************************!*\ 26378 !*** ../src/static/js/modules/handle-cart.js ***! 26379 \***********************************************/ 26380/*! exports provided: sendCartRequest, removeAddons */ 26381/***/ (function(module, __webpack_exports__, __webpack_require__) { 26382 26383"use strict"; 26384__webpack_require__.r(__webpack_exports__); 26385/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sendCartRequest", function() { return sendCartRequest; }); 26386/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAddons", function() { return removeAddons; }); 26387/* harmony import */ var _utils_globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/globals */ "../src/static/js/utils/globals.js"); 26388function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 26389 26390function _regeneratorRuntime() { "use strict"; _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEac
vendor: 4,868 bytes, lines 26390-26398
26390h(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 26391 26392function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } 26393 26394function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 26395 26396function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 26397 26398function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { tr
26398y { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } 26399 26400function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } 26401 26402 26403var $cartTrigger; 26404var $cart; 26405var $cartClose; 26406var $cartRemoveProduct; 26407var $cartRemoveBundle; 26408var $cartAddProduct = $('.js-button--add'); 26409var subcategories = { 26410 'Camps': 'camps-filter-register', 26411 'Certifications & Courses': 'certifications-courses-filter-register', 26412 'Day Camp': 'day-camp-filter-register', 26413 'Family Programs, Trail Passes, Rentals & Retreats': 'family-trail-rentals-retreats-filter-register', 26414 'Leadership Camp': 'leadership-camp-filter-register', 26415 'Leagues': 'leagues-filter-register', 26416 'Licensed School Break Programs': 'licensed-school-break-programs-filter-register', 26417 'Overnight Camp': 'overnight-camp-filter-register', 26418 'Sports': 'sports-filter-register', 26419 'Swimming Lessons': 'swimming-lessons-filter-register' 26420}; 26421$cartAddProduct.on('click', function (event) { 26422 var src = $(event.currentTarget); 26423 var productId = src.data('product-id'); 26424 var request = '/add-to-guide/' + productId; 26425 event.preventDefault(); 26426 src.addClass('cart-trigger--disabled'); 26427 sendCartRequest(request); 26428}); 26429var sendCartRequest = function sendCartRequest(requestUrl) { 26430 var keepOpen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 26431 26432 if ($cart.length === 0) { 26433 return new Promise(function (resolve) { 26434 return resolve(true); 26435 }); 26436 } 26437 26438 return new Promise(function (resolve, reject) { 26439 fetch(requestUrl, { 26440 headers: { 26441 "Accept": "application/json" 26442 } 26443 }).then(function (response) { 26444 return response.json(); 26445 }).then(function (data) { 26446 $cart.replaceWith(data.custom_data.html); 26447 26448 if (keepOpen) { 26449 $('.js-cart').addClass('is-active').addClass('has-open-cart'); 26450 _utils_globals__WEBPACK_IMPORTED_MODULE_0__["$body"].addClass('has-open-cart'); 26451 } 26452 26453 initCartEvents(); 26454 resolve(true); 26455 setGtmTrackClasses(); 26456 }); 26457 }); 26458}; 26459 26460var setGtmTrackClasses = function setGtmTrackClasses() { 26461 var params = new URLSearchParams(window.location.search); 26462 var categories = params.getAll('category.name[]'); 26463 26464 if (categories.length > 0) { 26465 categories.forEach(function (category) { 26466 if (category in subcategories) { 26467 $('.cart__btn').addClass(subcategories[category]); 26468 } 26469 }); 26470 } 26471}; 26472 26473var initVars = function initVars() { 26474 $cartTrigger = $('.js-cart-trigger'); 26475 $cart = $('.js-cart'); 26476 $cartClose = $('.js-cart-close'); 26477 $cartRemoveProduct = $('.js-button--remove'); 26478 $cartRemoveBundle = $('.js-button--remove-bundle'); 26479}; 26480 26481var removeAddons = function removeAddons() { 26482 var addons = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 26483 return new Promise(function () { 26484 var _ref = _asyncToGenerator(_regeneratorRuntime().mark(function _callee(resolve) { 26485 var _iterator, _step, addonId, request; 26486 26487 return _regeneratorRuntime().wrap(function _callee$(_context) { 26488 while (1) { 26489 switch (_context.prev = _context.next) { 26490 case 0: 26491 _iterator = _createForOfIteratorHelper(addons); 26492 _context.prev = 1; 26493 26494 _iterator.s(); 26495 26496 case 3: 26497 if ((_step = _iterator.n()).done) { 26498 _context.next = 10; 26499 break; 26500 } 26501 26502 addonId = _step.value; 26503 request = '/remove-from-guide/' + addonId; 26504 _context.next = 8; 26505 return sendCartRequest(request); 26506 26507 case 8: 26508 _context.next = 3; 26509 break; 26510 26511 case 10: 26512 _context.next = 15; 26513 break; 26514 26515 case 12: 26516 _context.prev = 12; 26517 _context.t0 = _context["catch"](1); 26518 26519 _iterator.e(_context.t0); 26520 26521 case 15: 26522 _context.prev = 15; 26523 26524 _iterator.f(); 26525 26526 return _context.finish(15); 26527 26528 case 18: 26529 resolve(); 26530 26531 case 19: 26532 case "end": 26533 return _context.stop(); 26534 } 26535 } 26536 }, _callee, null, [[1, 12, 15, 18]]); 26537 })); 26538 26539 return function (_x) { 26540 return _ref.apply(this, arguments); 26541 }; 26542 }()); 26543}; 26544 26545var initCartEvents = function initCartEvents() { 26546 initVars(); 26547 $cartTrigger.off().on('click', function (event) { 26548 setGtmTrackClasses(); 26549 $cart.toggleClass('is-active'); 26550 $cart.toggleClass('has-open-cart'); 26551 _utils_globals__WEBPACK_IMPORTED_MODULE_0__["$body"].toggleClass('has-open-cart'); 26552 event.preventDefault(); 26553 }); 26554 $cartClose.on('click', function (event) { 26555 $cart.removeClass('is-active'); 26556 $cart.removeClass('has-open-cart'); 26557 _utils_globals__WEBPACK_IMPORTED_MODULE_0__["$body"].removeClass('has-open-cart'); 26558 26559 if (!$(event.target).hasClass('js-select-addon')) { 26560 event.preventDefault(); 26561 } 26562 }); 26563 $cart.on('click', function (event) { 26564 var $target = $(event.target); 26565 26566 if ($target.closest('.cart__inner').length === 0) { 26567 $cart.removeClass('is-active'); 26568 $cart.removeClass('has-open-cart'); 26569 _utils_globals__WEBPACK_IMPORTED_MODULE_0__["$body"].removeClass('has-open-cart'); 26570 } 26571 }); 26572 $cartRemoveProduct.on('click', function (event) { 26573 var productId = $(event.currentTarget).data('product-id'); 26574 var activityId = $(event.currentTarget).data('activity-id'); 26575 var addons = $(event.currentTarget).data('addons').toString(); 26576 var request = '/remove-from-guide/' + productId; 26577 event.preventDefault();
26578 sendCartRequest(request).then(function () { 26579 return new Promise(function (resolve) { 26580 var $facetedBtn = $('.facetedsearch__content .js-button--add').filter('[data-product-id="' + productId + '"]'); 26581 26582 if ($facetedBtn.length) { 26583 $facetedBtn.removeClass('cart-trigger--disabled'); 26584 } 26585 26586 resolve($cartAddProduct.filter('[data-product-id="' + productId + '"]').removeClass('cart-trigger--disabled')); 26587 }); 26588 }).then(function () { 26589 return new Promise(function (resolve) { 26590 return resolve($.magnificPopup.close()); 26591 }); 26592 }).then(function () { 26593 return removeAddons(addons.length > 0 ? addons.split(',') : []); 26594 }).then(function () { 26595 if (window.location.href.toString().includes(activityId)) { 26596 var redirectUrl = '//' + window.location.hostname + '/activity/' + activityId + '#cart'; 26597 window.location.replace(redirectUrl); 26598 window.location.reload(); 26599 } 26600 }); 26601 }); 26602 $cartRemoveBundle.on('click', function (event) { 26603 var srcButton = $(event.currentTarget); 26604 var removeButton = $('.popup--cart-warning').first().find('.js-button--remove').first(); 26605 event.preventDefault(); 26606 removeButton.attr('data-product-id', srcButton.data('product-id')); 26607 removeButton.attr('data-activity-id', srcButton.data('activity-id')); 26608 removeButton.attr('data-addons', srcButton.data('addons')); 26609 $.magnificPopup.open({ 26610 items: { 26611 src: '.popup--cart-warning', 26612 type: 'inline' 26613 } 26614 }); 26615 }); 26616 $('.js-button--clear').on('click', function (event) { 26617 var request = '/remove-from-guide/all'; 26618 event.preventDefault(); 26619 sendCartRequest(request); 26620 }); 26621 var cartItemsCount = $cart.data('count'); 26622 var tag = $('.cart__tag'); 26623 cartItemsCount > 0 ? tag.show() : tag.hide(); 26624 tag.text(cartItemsCount); 26625}; 26626 26627$(function () { 26628 var openCart = window.location.href.toString().includes('#cart'); 26629 var hideCart = window.location.href.toString().includes('my-guide'); 26630 26631 if ($('.js-cart-loaded').length > 0) { 26632 initCartEvents(); 26633 26634 if (openCart) { 26635 $cart.toggleClass('is-active'); 26636 _utils_globals__WEBPACK_IMPORTED_MODULE_0__["$body"].toggleClass('has-open-cart'); 26637 } 26638 26639 if (hideCart) { 26640 $cartTrigger.hide(); 26641 } 26642 26643 return; 26644 } 26645 26646 initVars(); 26647 sendCartRequest('/my-guide/cart', openCart); 26648}); 26649/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 26650 26651/***/ }), 26652
26653/***/ "../src/static/js/modules/handle-checkbox-on-map-location-click.js": 26654/*!*************************************************************************!*\ 26655 !*** ../src/static/js/modules/handle-checkbox-on-map-location-click.js ***! 26656 \*************************************************************************/ 26657/*! no exports provided */ 26658/***/ (function(module, __webpack_exports__, __webpack_require__) { 26659 26660"use strict"; 26661__webpack_require__.r(__webpack_exports__); 26662/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var _handle_location_checks_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./handle-location-checks.js */ "../src/static/js/modules/handle-location-checks.js"); 26663 26664var $locationCheckboxes = $('.js-location-checkbox'); 26665$(document).on('click', '.js-location-btn', function (event) { 26666 var id = $(this).data('id'); 26667 var $currentCheckbox = $locationCheckboxes.find($("#".concat(id))); 26668 $currentCheckbox.prop('checked', !$currentCheckbox.prop("checked")); 26669 Object(_handle_location_checks_js__WEBPACK_IMPORTED_MODULE_0__["default"])(); 26670}); 26671/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 26672 26673/***/ }), 26674
26675/***/ "../src/static/js/modules/handle-cookies.js": 26676/*!**************************************************!*\ 26677 !*** ../src/static/js/modules/handle-cookies.js ***! 26678 \**************************************************/ 26679/*! no exports provided */ 26680/***/ (function(module, __webpack_exports__, __webpack_require__) { 26681 26682"use strict"; 26683__webpack_require__.r(__webpack_exports__); 26684/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var _utils_globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/globals */ "../src/static/js/utils/globals.js"); 26685/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! js-cookie */ "../node_modules/js-cookie/dist/js.cookie.js"); 26686/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(js_cookie__WEBPACK_IMPORTED_MODULE_1__); 26687/* harmony import */ var _utils_utm_capture_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/utm-capture.js */ "../src/static/js/utils/utm-capture.js"); 26688 26689 26690 26691var $cookies = $('.js-cookies'); 26692_utils_globals__WEBPACK_IMPORTED_MODULE_0__["$body"].addClass('cookie-opened'); 26693$('.js-cookies-close').on('click', function (e) { 26694 e.preventDefault(); 26695 $cookies.fadeOut(); 26696 _utils_globals__WEBPACK_IMPORTED_MODULE_0__["$body"].removeClass('cookie-opened'); 26697 js_cookie__WEBPACK_IMPORTED_MODULE_1___default.a.set('ymcaHub', true, { 26698 expires: 30 26699 }); 26700 Object(_utils_utm_capture_js__WEBPACK_IMPORTED_MODULE_2__["captureUTMParameters"])(); 26701}); 26702 26703if (js_cookie__WEBPACK_IMPORTED_MODULE_1___default.a.get('ymcaHub')) { 26704 $cookies.css('display', 'none'); 26705 _utils_globals__WEBPACK_IMPORTED_MODULE_0__["$body"].removeClass('cookie-opened'); 26706} 26707/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 26708 26709/***/ }), 26710
26711/***/ "../src/static/js/modules/handle-datepicker.js": 26712/*!*****************************************************!*\ 26713 !*** ../src/static/js/modules/handle-datepicker.js ***! 26714 \*****************************************************/ 26715/*! no exports provided */ 26716/***/ (function(module, __webpack_exports__, __webpack_require__) { 26717 26718"use strict"; 26719__webpack_require__.r(__webpack_exports__); 26720/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var jquery_ui__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery-ui */ "../node_modules/jquery-ui-dist/jquery-ui.js"); 26721/* harmony import */ var jquery_ui__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery_ui__WEBPACK_IMPORTED_MODULE_0__); 26722 26723var $date = $('.js-date'); 26724var $whenText = $('.js-when-text'); 26725$(function () { 26726 var dateFormat = "yy/mm/dd", 26727 from = $date.find('.date__start').datepicker({ 26728 defaultDate: "+1w", 26729 changeMonth: true, 26730 numberOfMonths: 1, 26731 dateFormat: dateFormat 26732 }).on("change", function () { 26733 to.val() === "" ? $whenText.text("".concat($(this).val(), " - final date")) : $whenText.text("".concat($(this).val(), " - ").concat(to.val())); 26734 $(this).closest('li').siblings().find('input[type="checkbox"]').prop('checked', false); 26735 to.datepicker("option", "minDate", getDate(this)); 26736 }), 26737 to = $date.find('.date__final').datepicker({ 26738 defaultDate: "+1w", 26739 changeMonth: true, 26740 numberOfMonths: 1, 26741 dateFormat: dateFormat 26742 }).on("change", function () { 26743 from.val() === "" ? $whenText.text("start date - ".concat($(this).val())) : $whenText.text("".concat(from.val(), " - ").concat($(this).val())); 26744 $(this).closest('li').siblings().find('input[type="checkbox"]').prop('checked', false); 26745 from.datepicker("option", "maxDate", getDate(this)); 26746 }); 26747 26748 function getDate(element) { 26749 var date; 26750 console.log(element); 26751 26752 try { 26753 date = $.datepicker.parseDate(dateFormat, element.value); 26754 } catch (error) { 26755 date = null; 26756 } 26757 26758 return date; 26759 } 26760}); 26761/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 26762 26763/***/ }), 26764
26765/***/ "../src/static/js/modules/handle-dropdown.js": 26766/*!***************************************************!*\ 26767 !*** ../src/static/js/modules/handle-dropdown.js ***! 26768 \***************************************************/ 26769/*! no exports provided */ 26770/***/ (function(module, __webpack_exports__, __webpack_require__) { 26771 26772"use strict"; 26773__webpack_require__.r(__webpack_exports__); 26774/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var _utils_globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/globals */ "../src/static/js/utils/globals.js"); 26775 26776var $nav = $('.js-nav'); 26777var navArrow = "<b class=\"nav__arrow\"></b>"; 26778$('.js-nav li').each(function (idx, li) { 26779 var $li = $(li); 26780 26781 if ($li.find('ul').length > 0) { 26782 $li.addClass('has-dropdown').find('> a').append(navArrow); 26783 } 26784}); 26785var $dropdownTrigger = $('.has-dropdown > a'); 26786$dropdownTrigger.on('click', function (event) { 26787 var $li = $(this).closest('li.has-dropdown'); 26788 26789 if (_utils_globals__WEBPACK_IMPORTED_MODULE_0__["$window"].outerWidth() < 767) { 26790 $li.toggleClass('is-active').siblings().removeClass('is-active').find('> ul').slideUp(); 26791 $li.find('> ul').stop().slideToggle(); 26792 } else { 26793 $li.toggleClass('is-active').siblings().removeClass('is-active'); 26794 } 26795 26796 event.preventDefault(); 26797}); 26798_utils_globals__WEBPACK_IMPORTED_MODULE_0__["$document"].on('click', function (event) { 26799 var li = $(event.target).closest('li.has-dropdown'); 26800 26801 if (li.length !== 1) { 26802 if (_utils_globals__WEBPACK_IMPORTED_MODULE_0__["$window"].outerWidth() < 767) { 26803 $dropdownTrigger.closest('li').removeClass('is-active').find('> ul').slideUp(); 26804 } else { 26805 $dropdownTrigger.closest('li').removeClass('is-active'); 26806 } 26807 } 26808}); 26809/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 26810 26811/***/ }), 26812
26813/***/ "../src/static/js/modules/handle-favourite.js": 26814/*!****************************************************!*\ 26815 !*** ../src/static/js/modules/handle-favourite.js ***! 26816 \****************************************************/ 26817/*! exports provided: favList, favElements, updateFavsCount */ 26818/***/ (function(module, __webpack_exports__, __webpack_require__) { 26819 26820"use strict"; 26821__webpack_require__.r(__webpack_exports__); 26822/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "favList", function() { return favList; }); 26823/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "favElements", function() { return favElements; }); 26824/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateFavsCount", function() { return updateFavsCount; }); 26825var favElements = $('.js-favourite'); 26826var favList; 26827favElements.on('click', function (event) { 26828 $(this).toggleClass('is-favourite'); 26829 var activityId = $(this).data('activity-id').toString(); 26830 var found = $.inArray(activityId, favList); 26831 26832 if ($(this).hasClass('is-favourite') && found === -1) { 26833 favList.push(activityId); 26834 } 26835 26836 if (!$(this).hasClass('is-favourite') && found > -1) { 26837 favList.splice(found, 1); 26838 } 26839 26840 localStorage.setItem('fav_programs', favList.join(',')); 26841 updateFavsCount(); 26842 event.preventDefault(); 26843}); 26844$(function () { 26845 favList = localStorage.getItem('fav_programs'); 26846 favList = favList !== null && favList !== '' ? favList.split(',') : []; 26847 favElements.each(function (i, e) { 26848 if ($.inArray($(e).data('activity-id').toString(), favList) > -1) { 26849 $(e).addClass('is-favourite'); 26850 } 26851 }); 26852 updateFavsCount(); 26853}); 26854 26855var updateFavsCount = function updateFavsCount() { 26856 var favsCount = favList.length; 26857 var tag = $('.favourites__tag'); 26858 favsCount > 0 ? tag.show() : tag.hide(); 26859 tag.text(favsCount); 26860}; 26861 26862 26863/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 26864 26865/***/ }), 26866
26867/***/ "../src/static/js/modules/handle-favourites-dropdown.js": 26868/*!**************************************************************!*\ 26869 !*** ../src/static/js/modules/handle-favourites-dropdown.js ***! 26870 \**************************************************************/ 26871/*! no exports provided */ 26872/***/ (function(module, __webpack_exports__, __webpack_require__) { 26873 26874"use strict"; 26875__webpack_require__.r(__webpack_exports__); 26876/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var _utils_globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/globals */ "../src/static/js/utils/globals.js"); 26877/* harmony import */ var _handle_favourite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./handle-favourite */ "../src/static/js/modules/handle-favourite.js"); 26878 26879 26880var $favourites = $('.js-favourites'); 26881$favourites.on('click', '.favourites__trigger', function (event) { 26882 var parent = $(this).closest('.js-favourites'); 26883 parent.toggleClass('is-active'); 26884 event.preventDefault(); 26885 fetch('/search/favourites?activity=' + _handle_favourite__WEBPACK_IMPORTED_MODULE_1__["favList"].join(','), { 26886 headers: { 26887 'Accept': 'text/html' 26888 } 26889 }).then(function (response) { 26890 return response.text(); 26891 }).then(function (html) { 26892 $('.favourites__body').html(html); 26893 $('.favourite__remove').on('click', function (event) { 26894 event.preventDefault(); 26895 event.stopPropagation(); 26896 var activityId = $(this).data('activity-id').toString(); 26897 var found = $.inArray(activityId, _handle_favourite__WEBPACK_IMPORTED_MODULE_1__["favList"]); 26898 26899 if (found > -1) { 26900 _handle_favourite__WEBPACK_IMPORTED_MODULE_1__["favList"].splice(found, 1); 26901 } 26902 26903 localStorage.setItem('fav_programs', _handle_favourite__WEBPACK_IMPORTED_MODULE_1__["favList"].join(',')); 26904 _handle_favourite__WEBPACK_IMPORTED_MODULE_1__["favElements"].filter('[data-activity-id="' + activityId + '"]').removeClass('is-favourite'); 26905 $(this).closest('.favourites__item').remove(); 26906 Object(_handle_favourite__WEBPACK_IMPORTED_MODULE_1__["updateFavsCount"])(); 26907 }); 26908 }); 26909}); 26910_utils_globals__WEBPACK_IMPORTED_MODULE_0__["$document"].on('click', function (event) { 26911 if ($(event.target).closest('.js-favourites').length !== 1) { 26912 $favourites.removeClass('is-active'); 26913 } 26914}); 26915/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 26916 26917/***/ }), 26918
26919/***/ "../src/static/js/modules/handle-filter-age-max-checks.js": 26920/*!****************************************************************!*\ 26921 !*** ../src/static/js/modules/handle-filter-age-max-checks.js ***! 26922 \****************************************************************/ 26923/*! no static exports found */ 26924/***/ (function(module, exports, __webpack_require__) { 26925 26926/* WEBPACK VAR INJECTION */(function($) {var $filterAge = $('.js-filter-age'); 26927$filterAge.on('change', 'input[type="checkbox"]', function () { 26928 var $currentFilter = $(this).closest($filterAge); 26929 var $checkboxesChecked = $currentFilter.find('input[type="checkbox"]:checked'); 26930 var isTwoChecked = $checkboxesChecked.length === 5; 26931 $currentFilter.toggleClass('max-checked', isTwoChecked); 26932}); 26933/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 26934 26935/***/ }), 26936
26937/***/ "../src/static/js/modules/handle-filter-component.js": 26938/*!***********************************************************!*\ 26939 !*** ../src/static/js/modules/handle-filter-component.js ***! 26940 \***********************************************************/ 26941/*! exports provided: initFilterComponent */ 26942/***/ (function(module, __webpack_exports__, __webpack_require__) { 26943 26944"use strict"; 26945__webpack_require__.r(__webpack_exports__); 26946/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initFilterComponent", function() { return initFilterComponent; }); 26947/* harmony import */ var _utils_handle_checkboxes_filter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/handle-checkboxes-filter */ "../src/static/js/utils/handle-checkboxes-filter.js"); 26948 26949function initFilterComponent() { 26950 var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 26951 var $root = $(root); 26952 var $filterComponent = $root.find('.js-filter-component'); 26953 $filterComponent.each(function (idx, filter) { 26954 var $filter = $(filter); 26955 var $checkboxesChecked = $filter.find('input[type="checkbox"]:checked'); 26956 26957 if ($checkboxesChecked.length > 0) { 26958 $filter.addClass('counter-is-visible'); 26959 } else { 26960 $filter.removeClass('counter-is-visible'); 26961 } 26962 26963 $filter.find('.filter-component__head .counter, .filter-component__head .js-counter-outer').text($checkboxesChecked.length); 26964 }); 26965 $filterComponent.off('click.filterComponentHead', '.filter-component__head').on('click.filterComponentHead', '.filter-component__head', function (event) { 26966 var $this = $(this); 26967 var $closestFilter = $this.closest('.js-filter-component'); 26968 $closestFilter.toggleClass('is-active').find('.filter-component__body').stop().slideToggle(); 26969 event.preventDefault(); 26970 }); 26971 Object(_utils_handle_checkboxes_filter__WEBPACK_IMPORTED_MODULE_0__["handleCheckboxesFilter"])($filterComponent); 26972} 26973$(function () { 26974 initFilterComponent(document); 26975}); 26976/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 26977 26978/***/ }), 26979
26980/***/ "../src/static/js/modules/handle-filter-day.js": 26981/*!*****************************************************!*\ 26982 !*** ../src/static/js/modules/handle-filter-day.js ***! 26983 \*****************************************************/ 26984/*! no exports provided */ 26985/***/ (function(module, __webpack_exports__, __webpack_require__) { 26986 26987"use strict"; 26988__webpack_require__.r(__webpack_exports__); 26989/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var _utils_globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/globals */ "../src/static/js/utils/globals.js"); 26990/* harmony import */ var _utils_handle_checkboxes_filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/handle-checkboxes-filter */ "../src/static/js/utils/handle-checkboxes-filter.js"); 26991 26992 26993var $filterWithMainCheckbox = $('.js-main-checkbox-container'); 26994var $mainCheckbox = $filterWithMainCheckbox.find('.js-main-checkbox'); 26995Object(_utils_handle_checkboxes_filter__WEBPACK_IMPORTED_MODULE_1__["handleCheckboxesFilter"])($filterWithMainCheckbox); 26996Object(_utils_handle_checkboxes_filter__WEBPACK_IMPORTED_MODULE_1__["handleMainCheckboxFilter"])($mainCheckbox); 26997/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 26998 26999/***/ }), 27000
27001/***/ "../src/static/js/modules/handle-filter-selection.js": 27002/*!***********************************************************!*\ 27003 !*** ../src/static/js/modules/handle-filter-selection.js ***! 27004 \***********************************************************/ 27005/*! no static exports found */ 27006/***/ (function(module, exports, __webpack_require__) { 27007 27008/* WEBPACK VAR INJECTION */(function(global) {global.removeFilterSelection = function (key, value) { 27009 document.querySelector("input[type='checkbox'][name='" + key + "[]'][value='" + value + "']").click(); 27010}; 27011/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/global.js */ "../node_modules/webpack/buildin/global.js"))) 27012 27013/***/ }), 27014
27015/***/ "../src/static/js/modules/handle-find-y-map.js": 27016/*!*****************************************************!*\ 27017 !*** ../src/static/js/modules/handle-find-y-map.js ***! 27018 \*****************************************************/ 27019/*! no exports provided */ 27020/***/ (function(module, __webpack_exports__, __webpack_require__) { 27021 27022"use strict"; 27023__webpack_require__.r(__webpack_exports__); 27024/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var _utils_find_y_map__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/find-y-map */ "../src/static/js/utils/find-y-map.js"); 27025 27026 27027window.initFindYMap = function () { 27028 var container = $('#find-y-map-container'); 27029 27030 if (container.length > 0) { 27031 window.findY = new _utils_find_y_map__WEBPACK_IMPORTED_MODULE_0__["FindYMap"]('find-y-map-container'); 27032 } 27033}; 27034/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 27035 27036/***/ }), 27037
27038/***/ "../src/static/js/modules/handle-hero-alert.js": 27039/*!*****************************************************!*\ 27040 !*** ../src/static/js/modules/handle-hero-alert.js ***! 27041 \*****************************************************/ 27042/*! no exports provided */ 27043/***/ (function(module, __webpack_exports__, __webpack_require__) { 27044 27045"use strict"; 27046__webpack_require__.r(__webpack_exports__); 27047/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! js-cookie */ "../node_modules/js-cookie/dist/js.cookie.js"); 27048/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(js_cookie__WEBPACK_IMPORTED_MODULE_0__); 27049 27050var $closeAlert = $('.hero__button-close'); 27051var $closeAlertRevision = $closeAlert.data('revision'); 27052$closeAlert.on('click', function (event) { 27053 js_cookie__WEBPACK_IMPORTED_MODULE_0___default.a.set('alertRevision', $closeAlertRevision, { 27054 expires: 30 27055 }); 27056 $(this).parent().slideUp(); 27057}); 27058 27059if (js_cookie__WEBPACK_IMPORTED_MODULE_0___default.a.get('alertRevision') == $closeAlertRevision) { 27060 $closeAlert.parent().hide(); 27061} 27062/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 27063 27064/***/ }), 27065
27066/***/ "../src/static/js/modules/handle-instructions-popup.js": 27067/*!*************************************************************!*\ 27068 !*** ../src/static/js/modules/handle-instructions-popup.js ***! 27069 \*************************************************************/ 27070/*! no static exports found */ 27071/***/ (function(module, exports, __webpack_require__) { 27072 27073/* WEBPACK VAR INJECTION */(function($) {var instructionsPopup = $('.popup--instructions'); 27074var instructionsPopupKeyName = 'accept-instructions'; 27075 27076var initInstructionsPopup = function initInstructionsPopup() { 27077 if (instructionsPopup.length === 0) { 27078 return; 27079 } 27080 27081 if (sessionStorage.getItem(instructionsPopupKeyName)) { 27082 return; 27083 } 27084 27085 if (localStorage.getItem(instructionsPopupKeyName)) { 27086 return; 27087 } 27088 27089 $.magnificPopup.open({ 27090 items: { 27091 src: '.popup--instructions', 27092 type: 'inline' 27093 }, 27094 callbacks: { 27095 close: closeInstructionsPopup 27096 } 27097 }); 27098}; 27099 27100var closeInstructionsPopup = function closeInstructionsPopup() { 27101 if ($('#box-never-display').is(':checked')) { 27102 localStorage.setItem(instructionsPopupKeyName, 'true'); 27103 return; 27104 } 27105 27106 sessionStorage.setItem(instructionsPopupKeyName, 'true'); 27107}; 27108 27109$(function () { 27110 initInstructionsPopup(); 27111}); 27112/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 27113 27114/***/ }), 27115
27116/***/ "../src/static/js/modules/handle-location-checks-and-text.js": 27117/*!*******************************************************************!*\ 27118 !*** ../src/static/js/modules/handle-location-checks-and-text.js ***! 27119 \*******************************************************************/ 27120/*! no exports provided */ 27121/***/ (function(module, __webpack_exports__, __webpack_require__) { 27122 27123"use strict"; 27124__webpack_require__.r(__webpack_exports__); 27125/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var _handle_location_checks_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./handle-location-checks.js */ "../src/static/js/modules/handle-location-checks.js"); 27126 27127var $locationCheckboxesInput = $('.js-location-checkbox input'); 27128$locationCheckboxesInput.on('change', function () { 27129 Object(_handle_location_checks_js__WEBPACK_IMPORTED_MODULE_0__["default"])(); 27130}); 27131/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 27132 27133/***/ }), 27134
27135/***/ "../src/static/js/modules/handle-location-checks.js": 27136/*!**********************************************************!*\ 27137 !*** ../src/static/js/modules/handle-location-checks.js ***! 27138 \**********************************************************/ 27139/*! exports provided: default */ 27140/***/ (function(module, __webpack_exports__, __webpack_require__) { 27141 27142"use strict"; 27143__webpack_require__.r(__webpack_exports__); 27144/* WEBPACK VAR INJECTION */(function($) {var handleLocationChecks = function handleLocationChecks() { 27145 var $locationCheckboxesInput = $('.js-location-checkbox input'); 27146 var $locationTextContainer = $('.js-location-text'); 27147 var $locationTextContainerOnMap = $('.js-location-text').closest('.popup__hint'); 27148 var checkInputs = $locationCheckboxesInput.map(function (idx, input) { 27149 if ($(input).is(':checked')) { 27150 return input; 27151 } 27152 }); 27153 27154 if (checkInputs.length === 0) { 27155 $locationTextContainer.text('Search locations'); 27156 $locationTextContainerOnMap.removeClass('is-visible'); 27157 } else { 27158 checkInputs.each(function (idx, input) { 27159 if (checkInputs.length === 1) { 27160 var labelText = $(input).closest('.checkbox').find('label').text(); 27161 $locationTextContainer.text(labelText); 27162 $locationTextContainerOnMap.addClass('is-visible'); 27163 return; 27164 } 27165 27166 $locationTextContainerOnMap.addClass('is-visible'); 27167 $locationTextContainer.text("".concat(checkInputs.length, " locations selected")); 27168 }); 27169 } 27170}; 27171 27172/* harmony default export */ __webpack_exports__["default"] = (handleLocationChecks); 27173/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 27174 27175/***/ }), 27176
27177/***/ "../src/static/js/modules/handle-locations-autocomplete-filter.js": 27178/*!************************************************************************!*\ 27179 !*** ../src/static/js/modules/handle-locations-autocomplete-filter.js ***! 27180 \************************************************************************/ 27181/*! no static exports found */ 27182/***/ (function(module, exports, __webpack_require__) { 27183 27184/* WEBPACK VAR INJECTION */(function($) {var $locationCheckboxLabel = $('.js-location-checkbox label'); 27185$('.js-search-locations input').on("keyup", function () { 27186 var value = $(this).val().toLowerCase(); 27187 $locationCheckboxLabel.filter(function () { 27188 $(this).closest('li').toggle($(this).text().toLowerCase().indexOf(value) > -1); 27189 }); 27190}); 27191/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 27192 27193/***/ }), 27194
27195/***/ "../src/static/js/modules/handle-map.js": 27196/*!**********************************************!*\ 27197 !*** ../src/static/js/modules/handle-map.js ***! 27198 \**********************************************/ 27199/*! no static exports found */ 27200/***/ (function(module, exports, __webpack_require__) { 27201 27202/* WEBPACK VAR INJECTION */(function($) {function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } 27203 27204function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 27205 27206function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 27207 27208$(function () { 27209 var listAddress = function listAddress(address) { 27210 if (!address || !address.length) return ''; 27211 var addressLines = address.join('<br>'); 27212 return "\n <div class=\"card__section\">\n <svg class=\"ico-location ico--left\">\n <use xlink:href=\"/static/images/sprite.svg#ico-location\"></use>\n </svg>\n <div class=\"card__section-text\">\n <address>".concat(addressLines, "</address>\n </div>\n </div>\n "); 27213 }; 27214 27215 var listActivities = function listActivities(activities) { 27216 if (!activities || !activities.length) return ''; 27217 var info = activities.map(function (item) { 27218 return "<p>".concat(item, "</p>"); 27219 }).join(''); 27220 return "\n <div class=\"card__section\">\n <svg class=\"ico-running ico--left\">\n <use xlink:href=\"/static/images/sprite.svg#ico-running\"></use>\n </svg>\n <div class=\"card__section-text\">\n <p><strong>Programs at this site:</strong></p>\n ".concat(info, "\n </div>\n </div>\n "); 27221 }; 27222 27223 var listBusing = function listBusing(busing) { 27224 if (!busing || !busing.data || !busing.data.length) return ''; 27225 var busInfo = busing.data.map(function (item) { 27226 return "\n <p>Bus to ".concat(item.destination, "</p>\n <p>Route: ").concat(item.route, "</p>\n "); 27227 }).join(''); 27228 return "\n <div class=\"card__section\">\n <svg class=\"".concat(busing.icon, " ico--left\">\n <use xlink:href=\"/static/images/sprite.svg#").concat(busing.icon, "\"></use>\n </svg>\n <div class=\"card__section-text\">\n ").concat(busInfo, "\n </div>\n </div>\n "); 27229 }; 27230 27231 var listExtendedHours = function listExtendedHours(edc) { 27232 if (!edc || !edc.info) return ''; 27233 return "\n <div class=\"card__section\">\n <svg class=\"".concat(edc.iconClass, " ico--left\">\n <use xlink:href=\"/static/images/sprite.svg#").concat(edc.icon, "\"></use>\n </svg>\n <div class=\"card__section-text\">\n ").concat(edc.info, "\n </div>\n </div>\n "); 27234 }; 27235 27236 var setMarkersMainMap = function setMarkersMainMap(dataSet, map, filteredSites) { 27237 var infoWindow = new google.maps.InfoWindow({ 27238 content: '' 27239 }); 27240 var markers = []; 27241 var markerIcon = ''; 27242 27243 var resetMarkers = function resetMarkers() { 27244 for (var j = 0; j < markers.length; j++) { 27245 var marker = markers[j]; 27246 27247 if (!$(".js-location-checkbox input:checked#location-".concat(marker.id)).length) { 27248 marker.setIcon(markerIcon); 27249 } 27250 } 27251 }; 27252 27253 var _iterator = _createForOfIteratorHelper(dataSet.markers), 27254 _step; 27255 27256 try { 27257 var _loop = function _loop() { 27258 var location = _step.value; 27259 var position = location.position, 27260 card = location.card, 27261 siteId = location.siteId, 27262 icon = location.icon, 27263 stopOnly = location.stopOnly; 27264 27265 if (filteredSites && filteredSites.length > 0 && !filteredSites.includes(card.title)) { 27266 return "continue";
27267 } 27268 27269 if (filteredSites && filteredSites.length > 0 && filteredSites.includes(card.title)) { 27270 card.filtered = true; 27271 } 27272 27273 var marker = new google.maps.Marker({ 27274 position: { 27275 lat: position.lat, 27276 lng: position.lng 27277 }, 27278 map: map, 27279 icon: icon, 27280 title: card.title, 27281 id: siteId 27282 }); 27283 var cardElements = ["<h4>".concat(card.title, "</h4>"), listAddress(card.address), listActivities(card.categories), listBusing(card.stop), listExtendedHours(card.edc)]; 27284 27285 if (card.isFilter) { 27286 markerIcon = icon; 27287 var button = "\n <div class=\"card__actions\">\n <a href=\"".concat(card.linkHref, "\" class=\"btn btn--red btn--small card__btn\">\n ").concat(card.linkText, "\n </a>\n </div>"); 27288 cardElements.push(button); 27289 } 27290 27291 if (stopOnly === false && !card.isFilter) { 27292 markerIcon = icon; 27293 27294 var _button = "\n <div class=\"card__actions\">\n <button data-id=\"location-".concat(card.linkHref, "\"\n class=\"btn btn--red btn--small card__btn js-location-btn ").concat(card.filtered ? 'js-trigger-location-submit' : '', "\"\n data-site-name=\"").concat(card.title, "\">\n ").concat(card.linkText, "\n </button>\n </div>"); 27295 27296 cardElements.push(_button); 27297 } 27298 27299 var infoBox = cardElements.join(''); 27300 var contentString = "\n <div class=\"card-map\">\n <div class=\"card__overlay\">\n ".concat(infoBox, "\n </div>\n </div>\n "); 27301 google.maps.event.addListener(marker, 'click', function () { 27302 resetMarkers(); 27303 27304 if (stopOnly === false) { 27305 marker.setIcon('/static/images/map-pin.png'); 27306 } 27307 27308 if ($(".js-location-checkbox input:checked#location-".concat(marker.id)).length) { 27309 contentString = contentString.replace("Select this location", "Unselect this location"); 27310 } else if ($('.facetedsearch__content input.facetedsearch__checkbox[name="site_name[]"]:checked, ' + '.js-filter-component input[name="site_name[]"]:checked').filter(function () { 27311 return $(this).val() === card.title; 27312 }).length > 0) { 27313 contentString = contentString.replace("Select this location", "Unselect this location"); 27314 } else { 27315 contentString = contentString.replace("Unselect this location", "Select this location"); 27316 } 27317 27318 infoWindow.close(); 27319 infoWindow.setContent(contentString); 27320 infoWindow.open({ 27321 anchor: marker, 27322 map: map, 27323 shouldFocus: true 27324 }); 27325 }); 27326 27327 if (stopOnly === false) { 27328 markers.push(marker); 27329 } 27330 }; 27331 27332 for (_iterator.s(); !(_step = _iterator.n()).done;) { 27333 var _ret = _loop(); 27334 27335 if (_ret === "continue") continue; 27336 } 27337 } catch (err) { 27338 _iterator.e(err); 27339 } finally { 27340 _iterator.f(); 27341 } 27342 27343 google.maps.event.addListener(map, "click", function () { 27344 resetMarkers(); 27345 infoWindow.close(); 27346 }); 27347 $('#popup-map').find('.js-popup-close').off('click.mapClose').on('click.mapClose', function () { 27348 resetMarkers(); 27349 infoWindow.close(); 27350 }); 27351 $(document).off('click.mapLocationBtn', '.js-location-btn').on('click.mapLocationBtn', '.js-location-btn', function (event) { 27352 resetMarkers(); 27353 infoWindow.close(); 27354 event.preventDefault(); 27355 }); 27356 $(document).off('click.mapTriggerSubmit', '.js-trigger-location-submit').on('click.mapTriggerSubmit', '.js-trigger-location-submit', function (e) { 27357 e.preventDefault(); 27358 var siteName = $(this).data('site-name'); 27359 var $checkboxes = $('input[type="checkbox"][name="site_name[]"]'); 27360 var $target = $checkboxes.filter(function () { 27361 return $(this).val() === siteName; 27362 }); 27363 27364 if ($target.length) { 27365 $target.trigger('click'); 27366 } else { 27367 console.warn("No site_name[] checkbox found with value \"".concat(siteName, "\"")); 27368 } 27369 }); 27370 }; 27371 27372 var initSingleMap = function initSingleMap(mapEl) { 27373 var $mapEl = $(mapEl); 27374 27375 if ($mapEl.data('mapInitialised')) { 27376 return; 27377 } 27378 27379 if (!window.google || !google.maps || !google.maps.places) { 27380 console.warn('Google Maps JS API not yet loaded.'); 27381 return; 27382 } 27383 27384 $mapEl.data('mapInitialised', true); 27385 var bounds = new google.maps.LatLngBounds(); 27386 var mainInfoWindow = new google.maps.InfoWindow(); 27387 var lat = $mapEl.data('lat'); 27388 var lng = $mapEl.data('lng'); 27389 var zoom = $mapEl.data('zoom'); 27390 var filteredSites = $mapEl.data('filtered'); 27391 var pos = { 27392 lat: lat, 27393 lng: lng 27394 }; 27395 var map = new google.maps.Map(mapEl, { 27396 center: pos, 27397 zoom: zoom, 27398 disableDefaultUI: true, 27399 minZoom: 5, 27400 maxZoom: 16, 27401 styles: [{ 27402 "featureType": "administrative", 27403 "elementType": "all", 27404 "stylers": [{ 27405 "saturation": "-100" 27406 }] 27407 }, { 27408 "featureType": "administrative.province", 27409 "elementType": "all", 27410 "stylers": [{ 27411 "visibility": "off" 27412 }] 27413 }, { 27414 "featureType": "landscape", 27415 "elementType": "all", 27416 "stylers": [{ 27417 "saturation": -70 27418 }, { 27419 "lightness": 65 27420 }, { 27421 "visibility": "on" 27422 }] 27423 }, { 27424 "featureType": "poi", 27425 "elementType": "all", 27426 "stylers": [{ 27427 "saturation": -100 27428 }, { 27429 "lightness": "50" 27430 }, { 27431 "visibility": "simplified" 27432 }] 27433 }, { 27434 "featureType": "poi.school", 27435 "elementType": "all", 27436 "stylers": [{ 27437 "saturation": -50 27438 }, { 27439 "lightness": "10" 27440 }, { 27441 "visibility": "on" 27442 }] 27443 }, { 27444 "featureType": "road", 27445 "elementType": "all", 27446 "stylers": [{ 27447 "saturation": "-100" 27448 }] 27449 }, { 27450 "featureType": "road.highway", 27451 "elementType": "all", 27452 "stylers": [{ 27453 "visibility": "simplified" 27454 }] 27455 }, { 27456 "featureType": "road.arterial", 27457 "elementType": "all", 27458 "stylers": [{ 27459 "lightness": "30" 27460 }] 27461 }, { 27462 "featureType": "road.local", 27463 "elementType": "all", 27464 "stylers": [{ 27465 "lightness": "40" 27466 }] 27467 }, { 27468 "featureType": "transit", 27469 "elementType": "all", 27470 "stylers": [{ 27471 "saturation": -100 27472 }, { 27473 "visibility": "simplified" 27474 }] 27475 }, { 27476 "featureType": "water", 27477 "elementType": "geometry", 27478 "stylers": [{ 27479 "saturation": -75 27480 }] 27481 }, { 27482 "featureType": "water", 27483 "elementType": "labels", 27484 "stylers": [{ 27485 "lightness": -25 27486 }, { 27487 "saturation": -75 27488 }] 27489 }] 27490 }); 27491 var searchMap = document.querySelector('.js-search-map'); 27492 27493 if (searchMap !== null) { 27494 var searchInput = searchMap.querySelector('.search__field'); 27495 var searchBtn = searchMap.querySelector('.search__btn'); 27496 var searchBox = new google.maps.places.SearchBox(searchInput); 27497 27498 searchBtn.onclick = function (event) { 27499 event.preventDefault(); 27500 $("#search-map").focus(); 27501 var pressEnter = new KeyboardEvent('keydown', { 27502 bubbles: true, 27503 cancelable: true, 27504 keyCode: 13, 27505 key: 'Enter' 27506 }); 27507 document.getElementById("search-map").dispatchEvent(pressEnter); 27508 }; 27509 27510 map.addListener("bounds_changed", function () { 27511 searchBox.setBounds(map.getBounds()); 27512 }); 27513 searchBox.addListener("places_changed", function () { 27514 var places = searchBox.getPlaces(); 27515 if (!places || !places.length) return; 27516 var localBounds = new google.maps.LatLngBounds();
27517 places.forEach(function (place) { 27518 if (!place.geometry || !place.geometry.location) return; 27519 27520 if (place.geometry.viewport) { 27521 localBounds.union(place.geometry.viewport); 27522 } else { 27523 localBounds.extend(place.geometry.location); 27524 } 27525 }); 27526 map.fitBounds(localBounds); 27527 }); 27528 } 27529 27530 bounds.extend(pos); 27531 map.setCenter(pos); 27532 var dataUrl = $mapEl.data('map'); 27533 fetch(dataUrl, { 27534 headers: { 27535 "Accept": "application/json" 27536 } 27537 }).then(function (response) { 27538 return response.json(); 27539 }).then(function (data) { 27540 setMarkersMainMap(data, map, filteredSites); 27541 }).catch(function (err) { 27542 return console.error('Error fetching map data:', err); 27543 }); 27544 }; 27545 27546 var initialiseMapsIn = function initialiseMapsIn(root) { 27547 $(root).find('.js-map').each(function () { 27548 initSingleMap(this); 27549 }); 27550 }; 27551 27552 $(document).on('click', '.js-popup-map', function () { 27553 initialiseMapsIn(document); 27554 }); 27555 27556 if ($('.js-map-filter').length > 0) { 27557 initialiseMapsIn(document); 27558 } 27559}); 27560/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 27561 27562/***/ }), 27563
27564/***/ "../src/static/js/modules/handle-megamenu.js": 27565/*!***************************************************!*\ 27566 !*** ../src/static/js/modules/handle-megamenu.js ***! 27567 \***************************************************/ 27568/*! no static exports found */ 27569/***/ (function(module, exports, __webpack_require__) { 27570 27571/* WEBPACK VAR INJECTION */(function($) {var _this = this; 27572 27573var open = "is_open"; 27574var active = "is_active"; 27575var close_active = "isactive"; 27576var breakdownWidth = 910; 27577var $navbar = $(".js-navbar"); 27578var $mobileMenuTrigger = $(".js-navbar-trigger"); 27579var down_arrow = "<b class=\"down_arrow\"></b>"; 27580var $levelOneItem = $(".menu__link"); 27581var $levelTwoItem = $(".menu__dropdown-link"); 27582var $levelThreeItem = $(".menu__dropdown-item-level-2 > a"); 27583$mobileMenuTrigger.on("click", function (e) { 27584 e.preventDefault(); 27585 e.stopPropagation(); 27586 closeSubMenus(); 27587 $(_this).toggleClass(open); 27588 $navbar.stop().slideToggle(); 27589}); 27590$(".js-navbar li").each(function (idx, li) { 27591 var $li = $(li); 27592 var $menu__dropdown = $li.addClass("menu__dropdown"); 27593 27594 if ($li.find("ul").length > 0) { 27595 $menu__dropdown.find("> a").append(down_arrow); 27596 $menu__dropdown.find("> h4").append(down_arrow); 27597 } 27598}); 27599$levelOneItem.on("click", function (e) { 27600 if (e.target.getAttribute('href') !== '#') { 27601 return; 27602 } 27603 27604 var $parent = $(e.currentTarget).parent(); 27605 27606 if ($parent.hasClass(open)) { 27607 $parent.removeClass(open); 27608 } else { 27609 $("li.menu__item.is_open").removeClass(open); 27610 closeSubMenus(); 27611 $parent.addClass(open); 27612 var $levelTwoElement = $parent.find(".menu__dropdown-item:visible:first"); 27613 27614 if (!$parent.hasClass('no-auto-expand') || $(window).outerWidth() > breakdownWidth) { 27615 $levelTwoElement.addClass(active); 27616 } 27617 27618 toggleLevelThreeElement($levelTwoElement); 27619 } 27620 27621 e.preventDefault(); 27622 e.stopPropagation(); 27623}); 27624$levelTwoItem.on("click", function (e) { 27625 if (e.currentTarget.getAttribute('href') !== '#') { 27626 return; 27627 } 27628 27629 e.preventDefault(); 27630 var $parent = $(e.currentTarget).parent(); 27631 27632 if ($parent.hasClass(active) && $(window).outerWidth() < breakdownWidth) { 27633 $parent.removeClass(active); 27634 } else { 27635 closeSubMenus(); 27636 $parent.addClass(active); 27637 toggleLevelThreeElement($parent); 27638 } 27639}); 27640$levelThreeItem.on("click", function (e) { 27641 if (e.currentTarget.getAttribute('href') !== '#') { 27642 return; 27643 } 27644 27645 e.preventDefault(); 27646 e.stopPropagation(); 27647 var $parent = $(e.currentTarget).parent(); 27648 27649 if ($(window).outerWidth() < breakdownWidth) { 27650 $parent.toggleClass(close_active); 27651 } 27652}); 27653 27654var closeSubMenus = function closeSubMenus() { 27655 $("li.menu__dropdown-item.is_active").removeClass(active); 27656 $("li.menu__dropdown-item-level-2.isactive").removeClass(close_active); 27657}; 27658 27659var toggleLevelThreeElement = function toggleLevelThreeElement($levelTwoElement) { 27660 var $levelThreeElements = $levelTwoElement.find(".menu__dropdown-item-level-2"); 27661 27662 if (!$levelTwoElement.parent().parent().hasClass('no-auto-expand')) { 27663 $levelThreeElements.first().addClass(close_active); 27664 } 27665 27666 if ($levelThreeElements.length === 1) { 27667 var parentText = $levelTwoElement.find("a:first").text().trim().toLowerCase(); 27668 var submenuLink = $levelThreeElements.first().find("a:first"); 27669 var submenuText = submenuLink.text().trim().toLowerCase(); 27670 27671 if (parentText === submenuText) { 27672 submenuLink.hide(); 27673 } 27674 } 27675}; 27676 27677$(document).on("click", function (e) { 27678 var li = $(e.target).closest("li.menu__dropdown"); 27679 27680 if (li.length !== 1) { 27681 $levelOneItem.closest("li").removeClass(open); 27682 27683 if ($(window).outerWidth() > breakdownWidth) { 27684 $("li.menu__dropdown-item").removeClass(active); 27685 $("li.menu__dropdown-item:first").addClass(active); 27686 } 27687 } 27688}); 27689$(window).on("resize", function () { 27690 if (window.innerWidth > breakdownWidth) { 27691 $navbar.css("display", "flex"); 27692 } else { 27693 $navbar.css("display", "none"); 27694 } 27695}); 27696/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 27697 27698/***/ }), 27699
27700/***/ "../src/static/js/modules/handle-minimap.js": 27701/*!**************************************************!*\ 27702 !*** ../src/static/js/modules/handle-minimap.js ***! 27703 \**************************************************/ 27704/*! no exports provided */ 27705/***/ (function(module, __webpack_exports__, __webpack_require__) { 27706 27707"use strict"; 27708__webpack_require__.r(__webpack_exports__); 27709/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var _minimap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./minimap */ "../src/static/js/modules/minimap.js"); 27710 27711var minimaps = {}; 27712$('.js-popup-minimap').on('click', function (event) { 27713 event.preventDefault(); 27714 var srcButton = $(event.currentTarget); 27715 var mapId = srcButton.data('map'); 27716 27717 if (!(mapId in minimaps)) { 27718 minimaps[mapId] = new _minimap__WEBPACK_IMPORTED_MODULE_0__["Minimap"](mapId); 27719 } 27720 27721 minimaps[mapId].show(); 27722}); 27723/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 27724 27725/***/ }), 27726
27727/***/ "../src/static/js/modules/handle-mobile-filters.js": 27728/*!*********************************************************!*\ 27729 !*** ../src/static/js/modules/handle-mobile-filters.js ***! 27730 \*********************************************************/ 27731/*! exports provided: initMobileFilters */ 27732/***/ (function(module, __webpack_exports__, __webpack_require__) { 27733 27734"use strict"; 27735__webpack_require__.r(__webpack_exports__); 27736/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initMobileFilters", function() { return initMobileFilters; }); 27737/* harmony import */ var _utils_globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/globals */ "../src/static/js/utils/globals.js"); 27738 27739function initMobileFilters() { 27740 var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 27741 var $root = $(root); 27742 var $navFilters = $root.find('.js-nav-filters'); 27743 var $filterOptions = $root.find('.js-sort-filter-item'); 27744 $filterOptions.off('click.mobileFiltersSort').on('click.mobileFiltersSort', function (event) { 27745 $('#select-sort').prop("disabled", true); 27746 this.form.submit(); 27747 }); 27748 $navFilters.off('click.mobileFiltersNav', '> ul > li > a').on('click.mobileFiltersNav', '> ul > li > a', function (event) { 27749 var href = $(this).attr('href'); 27750 var $currentFilters = $root.find("[data-filter='".concat(href, "']")); 27751 $currentFilters.addClass('is-active'); 27752 _utils_globals__WEBPACK_IMPORTED_MODULE_0__["$body"].addClass('open-filters'); 27753 event.preventDefault(); 27754 }); 27755 $root.off('click.mobileFiltersClose', '.js-aside .aside__close').on('click.mobileFiltersClose', '.js-aside .aside__close', function (event) { 27756 var $currentFilters = $(this).closest('.js-aside'); 27757 $currentFilters.removeClass('is-active'); 27758 _utils_globals__WEBPACK_IMPORTED_MODULE_0__["$body"].removeClass('open-filters'); 27759 event.preventDefault(); 27760 }); 27761 $root.off('click.mobileFiltersOverlay', '.js-aside').on('click.mobileFiltersOverlay', '.js-aside', function (event) { 27762 var $target = $(event.target); 27763 var $currentFilters = $target.closest('.js-aside'); 27764 27765 if ($target.closest('.aside__inner').length === 0) { 27766 $currentFilters.removeClass('is-active'); 27767 _utils_globals__WEBPACK_IMPORTED_MODULE_0__["$body"].removeClass('open-filters'); 27768 } 27769 }); 27770} 27771$(function () { 27772 initMobileFilters(document); 27773}); 27774/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 27775 27776/***/ }), 27777
27778/***/ "../src/static/js/modules/handle-nav.js": 27779/*!**********************************************!*\ 27780 !*** ../src/static/js/modules/handle-nav.js ***! 27781 \**********************************************/ 27782/*! no static exports found */ 27783/***/ (function(module, exports, __webpack_require__) { 27784 27785/* WEBPACK VAR INJECTION */(function($) {var $nav = $('.js-nav'); 27786var $header = $('.header'); 27787var $navTrigger = $('.js-nav-trigger'); 27788$navTrigger.on('click', function (event) { 27789 $(this).toggleClass('is-active'); 27790 $nav.stop().slideToggle(); 27791 event.preventDefault(); 27792}); 27793/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 27794 27795/***/ }), 27796
27797/***/ "../src/static/js/modules/handle-popup-window-component.js": 27798/*!*****************************************************************!*\ 27799 !*** ../src/static/js/modules/handle-popup-window-component.js ***! 27800 \*****************************************************************/ 27801/*! no static exports found */ 27802/***/ (function(module, exports, __webpack_require__) { 27803 27804/* WEBPACK VAR INJECTION */(function($) {function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 27805 27806function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 27807 27808function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 27809 27810var PopupComponent = function () { 27811 function PopupComponent(selector, dismissedPopupsKey) { 27812 _classCallCheck(this, PopupComponent); 27813 27814 this.component = document.querySelector(selector); 27815 this.dismissedPopupsKey = dismissedPopupsKey; 27816 } 27817 27818 _createClass(PopupComponent, [{ 27819 key: "getDismissedPopups", 27820 value: function getDismissedPopups() { 27821 return (localStorage.getItem(this.dismissedPopupsKey) || '').split(',').filter(function (popup) { 27822 return popup !== ''; 27823 }); 27824 } 27825 }, { 27826 key: "isPopupDismissed", 27827 value: function isPopupDismissed() { 27828 var popupId = this.component.id; 27829 return popupId && this.getDismissedPopups().includes(popupId); 27830 } 27831 }, { 27832 key: "init", 27833 value: function init() { 27834 if (!this.component || this.isPopupDismissed()) { 27835 return; 27836 } 27837 27838 $.magnificPopup.open({ 27839 items: { 27840 src: this.component, 27841 type: 'inline' 27842 }, 27843 callbacks: { 27844 close: this.close.bind(this) 27845 } 27846 }); 27847 } 27848 }, { 27849 key: "close", 27850 value: function close() { 27851 var popupId = this.component.id; 27852 if (!popupId) return; 27853 var dismissedPopups = this.getDismissedPopups(); 27854 27855 if (!dismissedPopups.includes(popupId)) { 27856 dismissedPopups.push(popupId); 27857 } 27858 27859 localStorage.setItem(this.dismissedPopupsKey, dismissedPopups.join(',')); 27860 } 27861 }]); 27862 27863 return PopupComponent; 27864}(); 27865 27866document.addEventListener('DOMContentLoaded', function (event) { 27867 var popup = new PopupComponent('.js-popup-component', 'dismissed-popups'); 27868 popup.init(); 27869}); 27870/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 27871 27872/***/ }), 27873
27874/***/ "../src/static/js/modules/handle-register.js": 27875/*!***************************************************!*\ 27876 !*** ../src/static/js/modules/handle-register.js ***! 27877 \***************************************************/ 27878/*! no static exports found */ 27879/***/ (function(module, exports, __webpack_require__) { 27880 27881/* WEBPACK VAR INJECTION */(function($) {var redirectionWarningPopupKeyName = 'accept-redirection-warning'; 27882$('.js-button--register').on('click', function (event) { 27883 var srcButton = $(event.currentTarget); 27884 var displayPopup = sessionStorage.getItem(redirectionWarningPopupKeyName); 27885 27886 if (displayPopup !== null) { 27887 srcButton.closest('.btn-control').addClass('is-disabled'); 27888 return; 27889 } 27890 27891 event.preventDefault(); 27892 var registerButton = $('.popup--external-warning').find('.js-button--popup-register').first(); 27893 registerButton.attr('data-activity-id', srcButton.data('activity-id')); 27894 registerButton.attr('href', srcButton.attr('href')); 27895 $.magnificPopup.open({ 27896 items: { 27897 src: '.popup--external-warning', 27898 type: 'inline' 27899 } 27900 }); 27901}); 27902$('.js-button--popup-register').on('click', function (event) { 27903 var srcButton = $(event.currentTarget); 27904 var registerButton = $('.js-button--register').filter('[data-activity-id="' + srcButton.data('activity-id') + '"]'); 27905 registerButton.closest('.btn-control').addClass('is-disabled'); 27906 $.magnificPopup.close(); 27907 sessionStorage.setItem(redirectionWarningPopupKeyName, 'true'); 27908}); 27909/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 27910 27911/***/ }), 27912
27913/***/ "../src/static/js/modules/handle-review.js": 27914/*!*************************************************!*\ 27915 !*** ../src/static/js/modules/handle-review.js ***! 27916 \*************************************************/ 27917/*! no static exports found */ 27918/***/ (function(module, exports, __webpack_require__) { 27919 27920/* WEBPACK VAR INJECTION */(function($) {function initPagination() { 27921 var nav = document.querySelector('.review-pagination'); 27922 if (!nav) return; 27923 var total = Math.max(1, parseInt(nav.dataset.total || '1', 10)); 27924 var params = new URLSearchParams(window.location.search); 27925 var current = Math.max(1, Math.min(total, parseInt(params.get('page') || '1', 10))); 27926 nav.querySelectorAll('a[data-page]').forEach(function (el) { 27927 el.addEventListener('click', function (ev) { 27928 if (this.classList.contains('is-disabled')) { 27929 ev.preventDefault(); 27930 return; 27931 } 27932 27933 var t = this.dataset.page; 27934 var target = current; 27935 if (t === 'first') target = 1;else if (t === 'last') target = total;else target = Math.max(1, Math.min(total, parseInt(t, 10) || 1)); 27936 params.set('page', target); 27937 this.href = location.pathname + '?' + params.toString(); 27938 }); 27939 }); 27940} 27941 27942function initVideoPosterFrames() { 27943 var videos = document.querySelectorAll('video.js-video-poster-frame'); 27944 if (!videos.length) return; 27945 27946 var loadFrame = function loadFrame(video) { 27947 if (video.dataset.posterFrameLoaded) return; 27948 video.dataset.posterFrameLoaded = 'true'; 27949 video.preload = 'metadata'; 27950 video.load(); 27951 }; 27952 27953 if (!('IntersectionObserver' in window)) { 27954 videos.forEach(loadFrame); 27955 return; 27956 } 27957 27958 var observer = new IntersectionObserver(function (entries) { 27959 entries.forEach(function (entry) { 27960 if (entry.isIntersecting) { 27961 loadFrame(entry.target); 27962 observer.unobserve(entry.target); 27963 } 27964 }); 27965 }, { 27966 rootMargin: '200px' 27967 }); 27968 videos.forEach(function (video) { 27969 return observer.observe(video); 27970 }); 27971} 27972 27973if ($('.reviews-grid-container').length > 0) { 27974 initPagination(); 27975 initVideoPosterFrames(); 27976} 27977/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 27978 27979/***/ }), 27980
27981/***/ "../src/static/js/modules/handle-search-dropdown.js": 27982/*!**********************************************************!*\ 27983 !*** ../src/static/js/modules/handle-search-dropdown.js ***! 27984 \**********************************************************/ 27985/*! no exports provided */ 27986/***/ (function(module, __webpack_exports__, __webpack_require__) { 27987 27988"use strict"; 27989__webpack_require__.r(__webpack_exports__); 27990/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var _utils_globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/globals */ "../src/static/js/utils/globals.js"); 27991 27992var $searchDropdown = $('.js-search-dropdown'); 27993$searchDropdown.on('click', '.search__trigger', function (event) { 27994 event.preventDefault(); 27995 var parent = $(this).closest('.js-search-dropdown'); 27996 var $searchField = $searchDropdown.find('.search__field'); 27997 parent.toggleClass('is-active'); 27998 27999 if (parent.hasClass('is-active') && $searchField.length > 0) { 28000 setTimeout(function () { 28001 $searchField.focus(); 28002 }, 500); 28003 } 28004}); 28005_utils_globals__WEBPACK_IMPORTED_MODULE_0__["$document"].on('click', function (event) { 28006 if ($(event.target).closest('.js-search-dropdown').length !== 1) { 28007 $searchDropdown.removeClass('is-active'); 28008 } 28009}); 28010/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 28011 28012/***/ }), 28013
28014/***/ "../src/static/js/modules/handle-show-content.js": 28015/*!*******************************************************!*\ 28016 !*** ../src/static/js/modules/handle-show-content.js ***! 28017 \*******************************************************/ 28018/*! no static exports found */ 28019/***/ (function(module, exports, __webpack_require__) { 28020 28021/* WEBPACK VAR INJECTION */(function($) {$('.js-show-content-trigger').on('click', function (evt) { 28022 evt.preventDefault(); 28023 var $this = $(this); 28024 var activeClass = 'is-active'; 28025 var defaultText = $this.data('default-text'); 28026 var activeText = $this.data('active-text'); 28027 var $showContentContainer = $this.closest('.js-show-content-container'); 28028 var $showContent = $showContentContainer.find('.js-show-content'); 28029 var contentToggle = !$this.hasClass(activeClass) ? $this.addClass(activeClass).text(activeText) && $showContent.slideDown() : $this.removeClass(activeClass).text(defaultText) && $showContent.slideUp(); 28030}); 28031/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 28032 28033/***/ }), 28034
28035/***/ "../src/static/js/modules/handle-tooltips.js": 28036/*!***************************************************!*\ 28037 !*** ../src/static/js/modules/handle-tooltips.js ***! 28038 \***************************************************/ 28039/*! exports provided: initTooltips */ 28040/***/ (function(module, __webpack_exports__, __webpack_require__) { 28041 28042"use strict"; 28043__webpack_require__.r(__webpack_exports__); 28044/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initTooltips", function() { return initTooltips; }); 28045/* harmony import */ var _utils_globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/globals */ "../src/static/js/utils/globals.js"); 28046 28047var moveDistance = 20; 28048var resizeBound = false; 28049 28050function positionTooltips($tooltips) { 28051 var windowWidth = _utils_globals__WEBPACK_IMPORTED_MODULE_0__["$window"].width(); 28052 $tooltips.each(function (idx, tooltip) { 28053 var $currentTooltip = $(tooltip); 28054 var $content = $currentTooltip.find('.tooltip__content'); 28055 var $arrow = $currentTooltip.find('.tooltip__arrow'); 28056 28057 if (!$content.length) { 28058 return; 28059 } 28060 28061 var tooltipWidth = $content.outerWidth(); 28062 var tooltipOffsetLeft = $content.offset().left; 28063 28064 if (tooltipOffsetLeft + tooltipWidth > windowWidth - moveDistance) { 28065 var tooltipRight = parseInt($content.css('right'), 10) || 0; 28066 var diffRight = tooltipOffsetLeft + tooltipWidth + moveDistance - windowWidth; 28067 var moveRight = tooltipRight + moveDistance + diffRight; 28068 $content.css({ 28069 right: moveRight 28070 }); 28071 $arrow.css({ 28072 left: moveRight, 28073 transform: 'translate(-43%, 30%) rotate(75deg)' 28074 }); 28075 } 28076 28077 if (tooltipOffsetLeft + tooltipWidth + 3 * moveDistance < windowWidth) { 28078 $content.css({ 28079 right: 0 28080 }); 28081 $arrow.css({ 28082 left: 0, 28083 transform: 'translate(-43%, 30%)' 28084 }); 28085 } 28086 }); 28087} 28088 28089function initTooltips() { 28090 var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 28091 var $root = $(root); 28092 var $tooltips = $root.find('.js-tooltip'); 28093 28094 if (_utils_globals__WEBPACK_IMPORTED_MODULE_0__["$window"].outerWidth() < 1024 && $tooltips.length) { 28095 $tooltips.off('click.tooltipIcon'); 28096 $tooltips.on('click.tooltipIcon', '.tooltip__icon', function () { 28097 var $currentTooltip = $(this).closest('.js-tooltip'); 28098 var $allTooltips = $('.js-tooltip'); 28099 28100 if ($currentTooltip.hasClass('is-active')) { 28101 $currentTooltip.removeClass('is-active'); 28102 } else { 28103 $allTooltips.removeClass('is-active'); 28104 $currentTooltip.addClass('is-active'); 28105 } 28106 }); 28107 _utils_globals__WEBPACK_IMPORTED_MODULE_0__["$document"].off('click.tooltipOutside').on('click.tooltipOutside', function (event) { 28108 var $target = $(event.target); 28109 28110 if ($target.closest('.js-tooltip').length === 0) { 28111 $('.js-tooltip').removeClass('is-active'); 28112 } 28113 }); 28114 } 28115 28116 if ($tooltips.length) { 28117 positionTooltips($tooltips); 28118 } 28119 28120 if (!resizeBound) { 28121 resizeBound = true; 28122 _utils_globals__WEBPACK_IMPORTED_MODULE_0__["$window"].on('resize.tooltips load.tooltips', function () { 28123 positionTooltips($('.js-tooltip')); 28124 }); 28125 } 28126} 28127$(function () { 28128 initTooltips(document); 28129}); 28130/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 28131 28132/***/ }), 28133
28134/***/ "../src/static/js/modules/handle-what-checks.js": 28135/*!******************************************************!*\ 28136 !*** ../src/static/js/modules/handle-what-checks.js ***! 28137 \******************************************************/ 28138/*! no static exports found */ 28139/***/ (function(module, exports, __webpack_require__) { 28140 28141/* WEBPACK VAR INJECTION */(function($) {var $whatTextContainer = $('.js-what-text'); 28142var $whatCheckboxesContainer = $('.js-what-checkboxes'); 28143var $whatCheckboxes = $whatCheckboxesContainer.find('.checkboxes.checkboxes--categories input[type="checkbox"]'); 28144$whatCheckboxes.on('change', function (event) { 28145 var $checkboxesChecked = $whatCheckboxesContainer.find('.checkboxes.checkboxes--categories input[type="checkbox"]:checked'); 28146 28147 if ($checkboxesChecked.length === 0) { 28148 $whatTextContainer.text('Add Subcategory'); 28149 } else { 28150 $checkboxesChecked.each(function (idx, input) { 28151 if ($checkboxesChecked.length === 1) { 28152 var labelText = $(input).parent().find('label').text(); 28153 $whatTextContainer.text(labelText); 28154 return; 28155 } 28156 28157 $whatTextContainer.text("".concat($checkboxesChecked.length, " subcategories selected")); 28158 }); 28159 } 28160}); 28161/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 28162 28163/***/ }), 28164
28165/***/ "../src/static/js/modules/handle-when-checks.js": 28166/*!******************************************************!*\ 28167 !*** ../src/static/js/modules/handle-when-checks.js ***! 28168 \******************************************************/ 28169/*! no exports provided */ 28170/***/ (function(module, __webpack_exports__, __webpack_require__) { 28171 28172"use strict"; 28173__webpack_require__.r(__webpack_exports__); 28174/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var _utils_globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/globals */ "../src/static/js/utils/globals.js"); 28175 28176var $whenCheckboxes = $('.js-criterion-input input[type="checkbox"]'); 28177var $whenText = $('.js-when-text'); 28178$whenCheckboxes.on('change', function () { 28179 var $whenDateInput = $(this).closest('.criterion').closest('li').siblings().find('.js-date input'); 28180 $whenDateInput.val(""); 28181 $(this).closest('.criterion').closest('li').siblings().find('input[type="checkbox"]').prop('checked', false); 28182 var $checkboxesChecked = $('.js-criterion-input input[type="checkbox"]:checked'); 28183 var whenKeyWord = $(this).data('when'); 28184 28185 if ($checkboxesChecked.length === 0) { 28186 $whenText.text('Add ages'); 28187 } else { 28188 $checkboxesChecked.each(function (idx, input) { 28189 if ($checkboxesChecked.length === 1) { 28190 var labelText = $(input).parent().find('label').text(); 28191 $whenText.text(labelText); 28192 return; 28193 } 28194 28195 $whenText.text("".concat($checkboxesChecked.length, " ").concat(whenKeyWord, " selected")); 28196 }); 28197 } 28198}); 28199/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 28200 28201/***/ }), 28202
28203/***/ "../src/static/js/modules/handle-who-checks.js": 28204/*!*****************************************************!*\ 28205 !*** ../src/static/js/modules/handle-who-checks.js ***! 28206 \*****************************************************/ 28207/*! no static exports found */ 28208/***/ (function(module, exports, __webpack_require__) { 28209 28210/* WEBPACK VAR INJECTION */(function($) {var $whoTextContainer = $('.js-who-text'); 28211var $whoCheckboxesContainer = $('.js-who-checkboxes'); 28212var $whoCheckboxes = $whoCheckboxesContainer.find('> ul input[type="checkbox"]'); 28213var $whoMainCheckbox = $whoCheckboxesContainer.find('.js-who-checkbox-main input'); 28214$whoMainCheckbox.on('change', function (event) { 28215 $whoCheckboxes.prop('checked', false); 28216 28217 if ($whoMainCheckbox.is(':checked')) { 28218 var labelText = $(this).parent().find('label').text(); 28219 $whoTextContainer.text(labelText); 28220 return; 28221 } 28222 28223 $whoTextContainer.text('Add ages'); 28224}); 28225$whoCheckboxes.on('change', function (event) { 28226 var $checkboxesChecked = $whoCheckboxesContainer.find('> ul input[type="checkbox"]:checked'); 28227 $whoMainCheckbox.prop('checked', false); 28228 28229 if ($checkboxesChecked.length === 0) { 28230 $whoTextContainer.text('Add ages'); 28231 } else { 28232 $checkboxesChecked.each(function (idx, input) { 28233 if ($checkboxesChecked.length === 1) { 28234 var labelText = $(input).parent().find('label').text(); 28235 $whoTextContainer.text(labelText); 28236 return; 28237 } 28238 28239 $whoTextContainer.text("".concat($checkboxesChecked.length, " ages selected")); 28240 }); 28241 } 28242}); 28243/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 28244 28245/***/ }), 28246
28247/***/ "../src/static/js/modules/handle-yguide-search.js": 28248/*!********************************************************!*\ 28249 !*** ../src/static/js/modules/handle-yguide-search.js ***! 28250 \********************************************************/ 28251/*! exports provided: initYGuideDropdowns, initYGuideSort, initYGuideKeywordSearch, initYGuideMaps, initYGuideCustomEvents, initAnnouncementWidget, filterBussingStops */ 28252/***/ (function(module, __webpack_exports__, __webpack_require__) { 28253 28254"use strict"; 28255__webpack_require__.r(__webpack_exports__); 28256/* WEBPACK VAR INJECTION */(function($, global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initYGuideDropdowns", function() { return initYGuideDropdowns; }); 28257/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initYGuideSort", function() { return initYGuideSort; }); 28258/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initYGuideKeywordSearch", function() { return initYGuideKeywordSearch; }); 28259/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initYGuideMaps", function() { return initYGuideMaps; }); 28260/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initYGuideCustomEvents", function() { return initYGuideCustomEvents; }); 28261/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initAnnouncementWidget", function() { return initAnnouncementWidget; }); 28262/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "filterBussingStops", function() { return filterBussingStops; }); 28263/* harmony import */ var _utils_generic_map__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/generic-map */ "../src/static/js/utils/generic-map.js"); 28264/* harmony import */ var _utils_globals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/globals */ "../src/static/js/utils/globals.js"); 28265/* harmony import */ var _utils_constant__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/constant */ "../src/static/js/utils/constant.js"); 28266 28267 28268 28269function initYGuideDropdowns($container) { 28270 $container.find('.filter-group').each(function () { 28271 var $group = $(this); 28272 var $badge = $group.find('.filter-count'); 28273 var checkedCount = $group.find('input[type="checkbox"]:checked').length; 28274 28275 if ($badge.length) { 28276 $badge.text(checkedCount); 28277 28278 if (checkedCount > 0) { 28279 $badge.css('display', 'flex'); 28280 } else { 28281 $badge.hide(); 28282 } 28283 } 28284 }); 28285 $container.off('click.yGuideToggle', '.toggle-btn').on('click.yGuideToggle', '.toggle-btn', function (e) { 28286 e.preventDefault(); 28287 e.stopPropagation(); 28288 var $btn = $(this); 28289 var $parent = $btn.closest('.filter-group'); 28290 var $menu = $parent.find('.dropdown-menu'); 28291 var isActive = $parent.hasClass('active'); 28292 $container.find('.filter-group').not($parent).removeClass('active').find('.dropdown-menu').removeClass('show'); 28293 28294 if (isActive) { 28295 $parent.removeClass('active'); 28296 $menu.removeClass('show'); 28297 } else { 28298 $parent.addClass('active'); 28299 $menu.addClass('show'); 28300 } 28301 }); 28302 $container.off('click.yGuidePrevent', '.dropdown-menu').on('click.yGuidePrevent', '.dropdown-menu', function (e) { 28303 e.stopPropagation(); 28304 }); 28305 $(document).off('click.yGuideOutside').on('click.yGuideOutside', function (e) { 28306 if (!$(e.target).closest('.y-guide-section .filter-group').length) { 28307 $container.find('.filter-group').removeClass('active').find('.dropdown-menu').removeClass('show'); 28308 } 28309 }); 28310} 28311function initYGuideSort($container) { 28312 $container.off('click.yGuideSortDesktop', '.js-sort-option').on('click.yGuideSortDesktop', '.js-sort-option', function (e) { 28313 e.preventDefault(); 28314 e.stopPropagation(); 28315 var $option = $(this); 28316 var sortVal = $option.data('value'); 28317 if (!sortVal) return; 28318 var $form = $option.closest('form'); 28319 28320 if (!$form.length) { 28321 console.warn('YGuide sort (desktop): no parent form found'); 28322 return; 28323 } 28324 28325 var $group = $option.closest('.filter-group'); 28326 var $trigger = $group.find('.sort-trigger'); 28327 var labelText = $.trim($option.clone().children('span').remove().end().text()); 28328 $trigger.find('strong').text(labelText); 28329 var $sortMaster = $form.find('input[type="hidden"][name="sort"]'); 28330 28331 if (!$sortMaster.length) { 28332 console.warn('YGuide sort (desktop): master sort input not found'); 28333 } else { 28334 $sortMaster.val(sortVal); 28335 } 28336 28337 var $menu = $option.closest('.dropdown-menu'); 28338 $menu.find('.sort-check').remove(); 28339 $('<span class="sort-check" style="float:right;">✓</span>').appendTo($option); 28340 $group.removeClass('active'); 28341 $menu.removeClass('show'); 28342 28343 if ($form[0]) { 28344 $form[0].submit(); 28345 } 28346 }); 28347 $container.off('change.yGuideSortMobile', '.js-sort-option-mobile').on('change.yGuideSortMobile', '.js-sort-option-mobile', function (e) { 28348 e.preventDefault(); 28349 e.stopPropagation(); 28350 var $option = $(this); 28351 var sortVal = $option.val(); 28352 if (!sortVal) return; 28353 var $sortMaster = $container.find('form').eq(1).find('input[type="hidden"][name="sort"]').addBack().end(); 28354 var $finalSortMaster = $container.find('input[type="hidden"][name="sort"]').first(); 28355 28356 if (!$finalSortMaster.length) { 28357 console.warn('YGuide sort (mobile): master sort input not found'); 28358 return; 28359 } 28360 28361 $finalSortMaster.val(sortVal); 28362 var $desktopForm = $finalSortMaster.closest('form'); 28363 28364 if (!$desktopForm.length) { 28365 console.warn('YGuide sort (mobile): desktop form not found'); 28366 return; 28367 } 28368 28369 if ($desktopForm[0]) { 28370 $desktopForm[0].submit(); 28371 } 28372 }); 28373} 28374function initYGuideKeywordSearch($container) { 28375 var $desktopForm = $container.find('form.js-yguide-search').first(); 28376 if (!$desktopForm.length) return; 28377 var $desktopInput = $desktopForm.find('input[type="search"][name="q"]'); 28378 var $mobileInput = $container.find('.visible-xs-block.visible-sm-block form input[type="search"][name="q"]').first(); 28379 28380 var bindKeywordInput = function bindKeywordInput($input) { 28381 if (!$input || !$input.length) return; 28382 $input.off('input.yGuideKeyword').on('input.yGuideKeyword', function () { 28383 var value = $(this).val(); 28384 28385 if ($desktopInput[0] !== this) { 28386 $desktopInput.val(value); 28387 } 28388 28389 if ($mobileInput && $mobileInput[0] !== this) { 28390 $mobileInput.val(value); 28391 } 28392 28393 var el = $desktopInput[0]; 28394 if (!el) return; 28395 28396 if (el.__yGuideKeywordTimer) { 28397 clearTimeout(el.__yGuideKeywordTimer); 28398 } 28399 28400 el.__yGuideKeywordTimer = setTimeout(function () { 28401 $desktopForm.trigger('submit'); 28402 }, 2000); 28403 }); 28404 }; 28405 28406 bindKeywordInput($desktopInput); 28407 bindKeywordInput($mobileInput); 28408 $container.off('submit.yGuideMobileSearch', '.visible-xs-block.visible-sm-block form').on('submit.yGuideMobileSearch', '.visible-xs-block.visible-sm-block form', function (e) { 28409 e.preventDefault(); 28410 var value = $(this).find('input[name="q"]').val() || ''; 28411 $desktopInput.val(value); 28412 $desktopForm.trigger('submit'); 28413 }); 28414} 28415function initYGuideMaps() { 28416 initYGuideBussingMap(); 28417 initYGuideSiteMap(); 28418} 28419function initYGuideCustomEvents($container) { 28420 initAnnouncementWidget($container); 28421} 28422 28423function initYGuideBussingMap() { 28424 var $section = $('.y-guide-section'); 28425 if (!$section.length) return; 28426 var $desktopForm = $section.find('form.js-yguide-search').first(); 28427 if (!$desktopForm.length) return; 28428 var $bussingCheckbox = $section.find('input[name="bussing"]'); 28429 if (!$bussingCheckbox.length) return; 28430 var $bussingTrigger = $section.find('.js-generic-map[href^="#bussing-map"], ' + '.open-bussing-map[href^="#bussing-map"]'); 28431 if (!$bussingTrigger.length) return; 28432 var selectedSiteNames = $desktopForm.find('input[name="site_name[]"]:checked').map(function () { 28433 return this.value; 28434 }).get(); 28435 var bussingPopupSelector = $bussingTrigger.attr('href'); 28436 if (!bussingPopupSelector) return; 28437 var bussingMapSelector = "".concat(bussingPopupSelector, " .generic-map"); 28438 var $bussingPopup = $(bussingPopupSelector); 28439 var $bussingMapEl = $bussingPopup.find('.generic-map'); 28440 var $bussingHint = $bussingPopup.find('.popup__hint'); 28441 var $bussingLocationTxt = $bussingPopup.find('.js-location-text'); 28442 28443 if (!$bussingMapEl.length) { 28444 console.warn('YGuide bussing: .generic-map not found'); 28445 return; 28446 } 28447
28448 var urlParams = new URLSearchParams(window.location.search); 28449 var selectedBusStops = urlParams.getAll('origin.site_name[]') || []; 28450 28451 if (selectedBusStops.length) { 28452 $bussingCheckbox.prop('checked', true); 28453 syncOriginHiddenInputs($desktopForm, selectedBusStops); 28454 } 28455 28456 var bussingMap = new _utils_generic_map__WEBPACK_IMPORTED_MODULE_0__["GenericMap"]({ 28457 mapSelector: bussingMapSelector, 28458 defaultIcon: '/static/images/map-pin.png', 28459 selectedIcon: '/static/images/map-pin-selected.png', 28460 entity: 'Stop', 28461 btnCssClass: 'button button--red card__btn js-bus-stop-select', 28462 applyFilters: function applyFilters(requestedFilters) { 28463 this.filteredSites = filterBussingStops({ 28464 allSites: this.sites, 28465 selectedSiteNames: selectedSiteNames, 28466 selectedBusStops: selectedBusStops, 28467 markerFilter: this.markerFilter 28468 }); 28469 }, 28470 helpers: { 28471 listAddress: function listAddress(address) { 28472 if (!address || !address.street || address.street.length < 1) return ''; 28473 var addressArray = [address.street, address.city, [address.state, address.postcode].join(' ')]; 28474 var addressLines = addressArray.join(', '); 28475 return "\n <div class=\"card__section\">\n <svg class=\"ico-map-location ico--left\">\n <use xlink:href=\"/static/images/sprite.svg#ico-map-location\"></use>\n </svg>\n <div class=\"card__section-text\">\n <address>".concat(addressLines, "</address>\n </div>\n </div>\n "); 28476 } 28477 } 28478 }); 28479 $bussingTrigger.magnificPopup({ 28480 type: 'inline', 28481 preloader: true, 28482 fixedContentPos: true, 28483 closeOnBgClick: true, 28484 mainClass: 'popup-container', 28485 callbacks: { 28486 open: function open() { 28487 bussingMap.init().then(function () { 28488 if (selectedBusStops.length) { 28489 bussingMap.syncSelectedMarkers(selectedBusStops); 28490 } 28491 28492 if (typeof bussingMap.helpers.updateHintText === 'function') { 28493 bussingMap.helpers.updateHintText(selectedBusStops, $bussingLocationTxt, $bussingHint); 28494 } 28495 28496 bussingMap.helpers.shouldShowHelperText(_utils_globals__WEBPACK_IMPORTED_MODULE_1__["$document"], ".js-bussing-intro-", _utils_constant__WEBPACK_IMPORTED_MODULE_2__["MAP_HELPER_TEXT_KEY"]); 28497 }); 28498 }, 28499 close: function close() { 28500 syncOriginHiddenInputs($desktopForm, selectedBusStops); 28501 $bussingCheckbox.prop('checked', selectedBusStops.length > 0); 28502 28503 if ($desktopForm[0]) { 28504 $desktopForm[0].submit(); 28505 } 28506 } 28507 } 28508 }); 28509 $bussingTrigger.on('click', function (e) { 28510 e.preventDefault(); 28511 }); 28512 _utils_globals__WEBPACK_IMPORTED_MODULE_1__["$body"].off('click.yGuideBusSelect').on('click.yGuideBusSelect', '.js-bus-stop-select', function (e) { 28513 e.preventDefault(); 28514 var $btn = $(this); 28515 var siteName = $btn.data('site-name'); 28516 if (!siteName) return; 28517 var key = String(siteName); 28518 var idx = selectedBusStops.indexOf(key); 28519 var isSelectedNow; 28520 28521 if (idx !== -1) { 28522 selectedBusStops.splice(idx, 1); 28523 isSelectedNow = false; 28524 } else { 28525 selectedBusStops.push(key); 28526 isSelectedNow = true; 28527 } 28528 28529 var label = isSelectedNow ? "Unselect this ".concat(bussingMap.entity || 'Stop') : "Select this ".concat(bussingMap.entity || 'Stop'); 28530 $btn.text(label); 28531 bussingMap.syncSelectedMarkers(selectedBusStops); 28532 28533 if (typeof bussingMap.helpers.updateHintText === 'function') { 28534 bussingMap.helpers.updateHintText(selectedBusStops, $bussingLocationTxt, $bussingHint); 28535 } 28536 }); 28537 $bussingCheckbox.off('change.yGuideBussingToggle').on('change.yGuideBussingToggle', function () { 28538 if (this.checked) { 28539 $bussingTrigger.first().trigger('click'); 28540 } else { 28541 selectedBusStops = []; 28542 syncOriginHiddenInputs($desktopForm, selectedBusStops); 28543 28544 if ($desktopForm[0]) { 28545 $desktopForm[0].submit(); 28546 } 28547 } 28548 }); 28549} 28550 28551function initYGuideSiteMap() { 28552 var $section = $('.y-guide-section'); 28553 if (!$section.length) return; 28554 var $desktopForm = $section.find('form.js-yguide-search').first(); 28555 if (!$desktopForm.length) return; 28556 var popupSelector = '#site-map'; 28557 var $popup = $section.find(popupSelector); 28558 if (!$popup.length) return; 28559 var mapSelector = "".concat(popupSelector, " .generic-map"); 28560 var $mapEl = $popup.find('.generic-map'); 28561 28562 if (!$mapEl.length) { 28563 console.warn('YGuide site map: .generic-map element not found in popup', popupSelector); 28564 return; 28565 } 28566 28567 var $locationText = $popup.find('.js-location-text'); 28568 var $hintContainer = $popup.find('.popup__hint'); 28569 var $triggers = $section.find('.site-map-widget .js-generic-map, ' + '.facetedsearch-map-widget .js-generic-map, ' + 'a[href^="#site-map"]'); 28570 if (!$triggers.length) return; 28571 var selectedSites = $desktopForm.find('input[name="site_name[]"]:checked').map(function () { 28572 return this.value; 28573 }).get(); 28574 $desktopForm.off('change.yGuideSiteCheckbox', 'input[name="site_name[]"]').on('change.yGuideSiteCheckbox', 'input[name="site_name[]"]', function () { 28575 selectedSites = $desktopForm.find('input[name="site_name[]"]:checked').map(function () { 28576 return this.value; 28577 }).get(); 28578 }); 28579 $triggers.off('click.yGuideSiteHash').on('click.yGuideSiteHash', function (e) { 28580 e.preventDefault(); 28581 }); 28582 var siteMap = new _utils_generic_map__WEBPACK_IMPORTED_MODULE_0__["GenericMap"]({ 28583 mapSelector: mapSelector, 28584 btnCssClass: 'button button--red card__btn js-site-select', 28585 markerFilter: function markerFilter(site) { 28586 return site.stopOnly !== true; 28587 } 28588 }); 28589 $triggers.magnificPopup({ 28590 type: 'inline', 28591 mainClass: 'popup-container', 28592 fixedContentPos: true, 28593 preloader: true, 28594 callbacks: { 28595 open: function open() { 28596 siteMap.init().then(function () { 28597 if (Array.isArray(selectedSites) && selectedSites.length) { 28598 siteMap.syncSelectedMarkers(selectedSites); 28599 } 28600 28601 if (typeof siteMap.helpers.updateHintText === 'function') { 28602 siteMap.helpers.updateHintText(selectedSites, $locationText, $hintContainer); 28603 } 28604 }); 28605 }, 28606 close: function close() { 28607 var list = Array.isArray(selectedSites) ? selectedSites : []; 28608 $desktopForm.find('input[name="site_name[]"]').each(function () { 28609 var val = this.value; 28610 this.checked = list.indexOf(val) !== -1; 28611 }); 28612 28613 if ($desktopForm[0]) { 28614 $desktopForm[0].submit(); 28615 } 28616 } 28617 } 28618 }); 28619 var ns = 'yGuideSiteSelect'; 28620 _utils_globals__WEBPACK_IMPORTED_MODULE_1__["$body"].off("click.".concat(ns), "".concat(popupSelector, " .js-site-select")).on("click.".concat(ns), "".concat(popupSelector, " .js-site-select"), function (e) { 28621 e.preventDefault(); 28622 var $btn = $(this); 28623 var siteName = $btn.data('site-name'); 28624 if (!siteName) return; 28625 var key = String(siteName); 28626 28627 if (!Array.isArray(selectedSites)) { 28628 selectedSites = []; 28629 } 28630 28631 var idx = selectedSites.indexOf(key); 28632 var isSelectedNow; 28633 28634 if (idx !== -1) { 28635 selectedSites.splice(idx, 1); 28636 isSelectedNow = false;
28637 } else { 28638 selectedSites.push(key); 28639 isSelectedNow = true; 28640 } 28641 28642 var label = isSelectedNow ? 'Unselect this location' : 'Select this location'; 28643 $btn.text(label); 28644 28645 if (siteMap) { 28646 siteMap.syncSelectedMarkers(selectedSites); 28647 28648 if (typeof siteMap.helpers.updateHintText === 'function') { 28649 siteMap.helpers.updateHintText(selectedSites, $locationText, $hintContainer); 28650 } 28651 } 28652 }); 28653} 28654 28655function syncOriginHiddenInputs($form, selectedBusStops) { 28656 $form.find('.js-origin-from-map').remove(); 28657 28658 if (!Array.isArray(selectedBusStops) || !selectedBusStops.length) { 28659 return; 28660 } 28661 28662 selectedBusStops.forEach(function (name) { 28663 if (!name) return; 28664 $('<input>', { 28665 type: 'hidden', 28666 class: 'js-origin-from-map', 28667 name: 'origin.site_name[]', 28668 value: name 28669 }).appendTo($form); 28670 }); 28671} 28672 28673function initAnnouncementWidget($container) { 28674 var ns = 'yGuideAnnouncement'; 28675 var iconSelector = '.y-guide-announcement__toggle'; 28676 $container.find('.y-guide-announcement').each(function () { 28677 var $block = $(this); 28678 var $content = $block.find('.y-guide-announcement__content'); 28679 28680 if ($block.hasClass('y-guide-announcement--collapsed')) { 28681 $content.hide(); 28682 } 28683 }); 28684 $container.off("click.".concat(ns), iconSelector).on("click.".concat(ns), iconSelector, function (e) { 28685 e.preventDefault(); 28686 e.stopPropagation(); 28687 var $block = $(this).closest('.y-guide-announcement'); 28688 var $content = $block.find('.y-guide-announcement__content'); 28689 if (!$content.length) return; 28690 var isCollapsed = $block.hasClass('y-guide-announcement--collapsed'); 28691 28692 if (isCollapsed) { 28693 $block.removeClass('y-guide-announcement--collapsed'); 28694 $content.stop(true, true).slideDown(200); 28695 } else { 28696 $block.addClass('y-guide-announcement--collapsed'); 28697 $content.stop(true, true).slideUp(200); 28698 } 28699 }); 28700} 28701function filterBussingStops(_ref) { 28702 var _ref$allSites = _ref.allSites, 28703 allSites = _ref$allSites === void 0 ? [] : _ref$allSites, 28704 _ref$selectedSiteName = _ref.selectedSiteNames, 28705 selectedSiteNames = _ref$selectedSiteName === void 0 ? [] : _ref$selectedSiteName, 28706 _ref$selectedBusStops = _ref.selectedBusStops, 28707 selectedBusStops = _ref$selectedBusStops === void 0 ? [] : _ref$selectedBusStops, 28708 _ref$markerFilter = _ref.markerFilter, 28709 markerFilter = _ref$markerFilter === void 0 ? null : _ref$markerFilter; 28710 var campSet = new Set((selectedSiteNames || []).map(String)); 28711 var selectedStopSet = new Set((selectedBusStops || []).map(String)); 28712
28713 var passesMarkerFilter = function passesMarkerFilter(site) { 28714 return !markerFilter || markerFilter(site); 28715 }; 28716 28717 var matchesCamps = function matchesCamps(site) { 28718 var _site$card; 28719 28720 var destinations = site === null || site === void 0 ? void 0 : (_site$card = site.card) === null || _site$card === void 0 ? void 0 : _site$card.destinations; 28721 if (!Array.isArray(destinations) || !destinations.length) return false; 28722 return destinations.some(function (d) { 28723 return (d === null || d === void 0 ? void 0 : d.site_name) && campSet.has(String(d.site_name)); 28724 }); 28725 }; 28726 28727 return (allSites || []).filter(function (site) { 28728 var _site$card2; 28729 28730 if (!passesMarkerFilter(site)) return false; 28731 var stopName = site !== null && site !== void 0 && (_site$card2 = site.card) !== null && _site$card2 !== void 0 && _site$card2.title ? String(site.card.title) : ''; 28732 var isSelectedStop = stopName && selectedStopSet.has(stopName); 28733 if (isSelectedStop) return true; 28734 if (!campSet.size) return true; 28735 return matchesCamps(site); 28736 }); 28737} 28738$(document).ready(function () { 28739 var $container = $('.y-guide-section'); 28740 if (!$container.length) return; 28741 initYGuideDropdowns($container); 28742 initYGuideSort($container); 28743 initYGuideKeywordSearch($container); 28744 initYGuideMaps($container); 28745 initYGuideCustomEvents($container); 28746}); 28747 28748global.delayedFacetSubmit = function delayedFacetSubmit(el) { 28749 var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1500; 28750 var form = el && el.form; 28751 if (!form) return; 28752 28753 if (form.__facetSubmitTimer) { 28754 clearTimeout(form.__facetSubmitTimer); 28755 } 28756 28757 form.__facetSubmitTimer = setTimeout(function () { 28758 form.submit(); 28759 }, delay); 28760}; 28761/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"), __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/global.js */ "../node_modules/webpack/buildin/global.js"))) 28762 28763/***/ }), 28764
28765/***/ "../src/static/js/modules/infinite-scroll-reviews.js": 28766/*!***********************************************************!*\ 28767 !*** ../src/static/js/modules/infinite-scroll-reviews.js ***! 28768 \***********************************************************/ 28769/*! no exports provided */ 28770/***/ (function(module, __webpack_exports__, __webpack_require__) { 28771 28772"use strict"; 28773__webpack_require__.r(__webpack_exports__); 28774/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var tiny_slider_src_tiny_slider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tiny-slider/src/tiny-slider */ "../node_modules/tiny-slider/src/tiny-slider.js"); 28775 28776var container = document.querySelector('.reviews-grid-container[data-total]'); 28777var sentinel = container ? container.querySelector('.js-reviews-sentinel') : null; 28778var grid = container ? container.querySelector('.reviews-grid') : null; 28779 28780if (container && sentinel && grid) { 28781 var totalPages = parseInt(container.getAttribute('data-total'), 10) || 1; 28782 var currentPage = parseInt(new URL(window.location.href).searchParams.get('page'), 10) || 1; 28783 var loading = false; 28784 28785 var initCardSliders = function initCardSliders(cards) { 28786 cards.forEach(function (card) { 28787 card.querySelectorAll('.js-slider-component .slider__slides').forEach(function (slider) { 28788 var $slider = $(slider); 28789 Object(tiny_slider_src_tiny_slider__WEBPACK_IMPORTED_MODULE_0__["tns"])({ 28790 container: slider, 28791 nav: slider.getAttribute('data-nav') !== 'false', 28792 autoHeight: slider.getAttribute('data-autoheight') === 'true', 28793 items: 1, 28794 autoplay: true, 28795 autoplayHoverPause: true, 28796 autoplayTimeout: slider.hasAttribute('data-speed') ? slider.getAttribute('data-speed') : 10000, 28797 slideBy: 'page', 28798 navPosition: 'bottom', 28799 autoplayButton: $slider.closest('.slider').find('.slider__controls__stop')[0], 28800 prevButton: $slider.closest('.slider').find('.slider__controls__prev')[0], 28801 nextButton: $slider.closest('.slider').find('.slider__controls__next')[0] 28802 }); 28803 $slider.find('.slider__slide').css('display', ''); 28804 }); 28805 }); 28806 }; 28807 28808 var observer = new IntersectionObserver(function (entries) { 28809 if (!entries.some(function (entry) { 28810 return entry.isIntersecting; 28811 }) || loading) { 28812 return; 28813 } 28814 28815 loading = true; 28816 observer.unobserve(sentinel); 28817 sentinel.classList.add('is-loading'); 28818 var url = new URL(window.location.href); 28819 url.searchParams.set('page', String(currentPage + 1)); 28820 fetch(url.toString()).then(function (response) { 28821 if (!response.ok) { 28822 throw new Error("HTTP ".concat(response.status)); 28823 } 28824 28825 return response.text(); 28826 }).then(function (html) { 28827 var doc = new DOMParser().parseFromString(html, 'text/html'); 28828 var cards = Array.from(doc.querySelectorAll('.reviews-grid > .review-card')); 28829 cards.forEach(function (card) { 28830 return grid.appendChild(document.adoptNode(card)); 28831 }); 28832 initCardSliders(cards); 28833 currentPage += 1; 28834 28835 if (currentPage < totalPages && cards.length > 0) { 28836 observer.observe(sentinel); 28837 } else { 28838 sentinel.remove(); 28839 } 28840 }).catch(function () { 28841 observer.observe(sentinel); 28842 }).finally(function () { 28843 loading = false; 28844 sentinel.classList.remove('is-loading'); 28845 }); 28846 }); 28847 28848 if (currentPage < totalPages) { 28849 observer.observe(sentinel); 28850 } else { 28851 sentinel.remove(); 28852 } 28853} 28854/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 28855 28856/***/ }), 28857
28858/***/ "../src/static/js/modules/init-image-switcher.js": 28859/*!*******************************************************!*\ 28860 !*** ../src/static/js/modules/init-image-switcher.js ***! 28861 \*******************************************************/ 28862/*! no static exports found */ 28863/***/ (function(module, exports) { 28864 28865function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 28866 28867function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 28868 28869function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 28870 28871function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 28872 28873function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 28874 28875function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 28876 28877function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 28878 28879function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 28880 28881function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 28882 28883var ImageSwitcher = function () { 28884 function ImageSwitcher() { 28885 _classCallCheck(this, ImageSwitcher); 28886 28887 this.overlayElements = _toConsumableArray(document.querySelectorAll('.overlay-container')); 28888 } 28889 28890 _createClass(ImageSwitcher, [{ 28891 key: "getRandomImageSet", 28892 value: function getRandomImageSet(imageSets) { 28893 var randomIndex = Math.floor(Math.random() * imageSets.length); 28894 return imageSets[randomIndex]; 28895 } 28896 }, { 28897 key: "applyBackgroundImage", 28898 value: function applyBackgroundImage() { 28899 var _this = this; 28900 28901 this.overlayElements.forEach(function (element) { 28902 var encodedImages = element.dataset.images; 28903 var decodedImages = atob(encodedImages); 28904 var imageSets = JSON.parse(decodedImages); 28905 28906 var imageSet = _this.getRandomImageSet(imageSets); 28907 28908 element.style.backgroundImage = "url(".concat(window.innerWidth <= 900 ? imageSet.mobile : imageSet.desktop, ")"); 28909 }); 28910 } 28911 }]); 28912 28913 return ImageSwitcher; 28914}(); 28915 28916window.addEventListener('DOMContentLoaded', function () { 28917 var imageSwitcher = new ImageSwitcher(); 28918 imageSwitcher.applyBackgroundImage(); 28919}); 28920 28921/***/ }), 28922
28923/***/ "../src/static/js/modules/init-popups.js": 28924/*!***********************************************!*\ 28925 !*** ../src/static/js/modules/init-popups.js ***! 28926 \***********************************************/ 28927/*! no exports provided */ 28928/***/ (function(module, __webpack_exports__, __webpack_require__) { 28929 28930"use strict"; 28931__webpack_require__.r(__webpack_exports__); 28932/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var magnific_popup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! magnific-popup */ "../node_modules/magnific-popup/dist/jquery.magnific-popup.js"); 28933/* harmony import */ var magnific_popup__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(magnific_popup__WEBPACK_IMPORTED_MODULE_0__); 28934 28935$('.js-category-popup').magnificPopup({ 28936 type: 'ajax', 28937 mainClass: 'popup-container' 28938}); 28939$('.js-popup-cart').magnificPopup({ 28940 type: 'ajax', 28941 mainClass: 'popup-cart-container' 28942}); 28943$('.js-popup-map').magnificPopup({ 28944 type: 'inline', 28945 preloader: true, 28946 fixedContentPos: true, 28947 closeOnBgClick: true, 28948 mainClass: 'popup-container' 28949}); 28950$('.js-popup-image').magnificPopup({ 28951 type: 'image', 28952 closeOnContentClick: false, 28953 mainClass: 'popup-media', 28954 image: { 28955 verticalFit: false 28956 } 28957}); 28958$('.js-popup-video').magnificPopup({ 28959 type: 'inline', 28960 mainClass: 'popup-media', 28961 preloader: true, 28962 fixedContentPos: true, 28963 closeOnBgClick: true 28964}); 28965$(document).on('click', '.js-popup-close', function (e) { 28966 e.preventDefault(); 28967 $.magnificPopup.close(); 28968}); 28969$('.js-youtube-video').on('click', function (event) { 28970 event.preventDefault(); 28971 var src = $(event.currentTarget); 28972 var videoId = src.data('video-id'); 28973 var autoplay = src.data('autoplay') ? '1' : '0'; 28974 $.magnificPopup.open({ 28975 items: { 28976 src: "<div class=\"video-popup\"><div class=\"video-popup__container\"><iframe class=\"video-popup__iframe\" src=\"//www.youtube.com/embed/".concat(videoId, "?autoplay=").concat(autoplay, "\" allowfullscreen></iframe></div></div>"), 28977 type: 'inline', 28978 preloader: true, 28979 closeOnBgClick: true 28980 } 28981 }); 28982}); 28983$('.js-button--popup-content-modal').on('click', function (event) { 28984 event.preventDefault(); 28985 $.magnificPopup.open({ 28986 items: { 28987 src: event.currentTarget.getAttribute('href'), 28988 type: 'inline', 28989 fixedContentPos: true, 28990 closeOnBgClick: true 28991 } 28992 }); 28993}); 28994/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 28995 28996/***/ }), 28997
28998/***/ "../src/static/js/modules/init-sliders.js": 28999/*!************************************************!*\ 29000 !*** ../src/static/js/modules/init-sliders.js ***! 29001 \************************************************/ 29002/*! no exports provided */ 29003/***/ (function(module, __webpack_exports__, __webpack_require__) { 29004 29005"use strict"; 29006__webpack_require__.r(__webpack_exports__); 29007/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var tiny_slider_src_tiny_slider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tiny-slider/src/tiny-slider */ "../node_modules/tiny-slider/src/tiny-slider.js"); 29008 29009 29010var getBool = function getBool(el, name) { 29011 var def = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 29012 var v = el.getAttribute("data-".concat(name)); 29013 if (v === null) return def; 29014 if (v === '') return true; 29015 return !/^(false|0|no)$/i.test(v); 29016}; 29017 29018if ($('.js-slider-hero').length > 0) { 29019 var _$$data; 29020 29021 var sliderHero = Object(tiny_slider_src_tiny_slider__WEBPACK_IMPORTED_MODULE_0__["tns"])({ 29022 container: '.js-slider-hero .slider__slides', 29023 items: 1, 29024 autoplay: true, 29025 autoplayHoverPause: true, 29026 autoplayTimeout: (_$$data = $('.js-slider-hero').data('speed')) !== null && _$$data !== void 0 ? _$$data : 10000, 29027 slideBy: 'page', 29028 navPosition: "bottom", 29029 autoplayButton: '.slider__stop', 29030 prevButton: '.js-slider-hero .slider__prev', 29031 nextButton: '.js-slider-hero .slider__next' 29032 }); 29033} 29034 29035$('.js-slider-component .slider__slides').each(function (idx, slider) { 29036 Object(tiny_slider_src_tiny_slider__WEBPACK_IMPORTED_MODULE_0__["tns"])({ 29037 container: slider, 29038 nav: getBool(slider, 'nav', true), 29039 autoHeight: getBool(slider, 'autoheight', false), 29040 items: 1, 29041 autoplay: true, 29042 autoplayHoverPause: true, 29043 autoplayTimeout: slider.hasAttribute('data-speed') ? slider.getAttribute('data-speed') : 10000, 29044 slideBy: 'page', 29045 navPosition: "bottom", 29046 autoplayButton: $(slider).closest('.slider').find('.slider__controls__stop')[0], 29047 prevButton: $(slider).closest('.slider').find('.slider__controls__prev')[0], 29048 nextButton: $(slider).closest('.slider').find('.slider__controls__next')[0] 29049 }); 29050 $('.js-slider-component .slider__slides .slider__slide').css('display', ''); 29051}); 29052 29053if ($('.js-slider-categories').length > 0) { 29054 var sliderCategories = Object(tiny_slider_src_tiny_slider__WEBPACK_IMPORTED_MODULE_0__["tns"])({ 29055 container: '.js-slider-categories .slider__slides', 29056 items: 1, 29057 slideBy: 'page', 29058 nav: false, 29059 prevButton: '.js-slider-categories .slider__prev', 29060 nextButton: '.js-slider-categories .slider__next', 29061 responsive: { 29062 375: { 29063 items: 2 29064 }, 29065 767: { 29066 items: 3, 29067 slideBy: 1 29068 }, 29069 1023: { 29070 items: 4 29071 } 29072 } 29073 }); 29074} 29075 29076if ($('.js-slider-programs').length > 0) { 29077 var sliderPrograms = Object(tiny_slider_src_tiny_slider__WEBPACK_IMPORTED_MODULE_0__["tns"])({ 29078 container: '.js-slider-programs .slider__slides', 29079 items: 1, 29080 gutter: 24, 29081 slideBy: 1, 29082 nav: false, 29083 prevButton: '.js-slider-programs .slider__prev', 29084 nextButton: '.js-slider-programs .slider__next', 29085 responsive: { 29086 767: { 29087 items: 2 29088 }, 29089 1023: { 29090 items: 3 29091 }, 29092 1399: { 29093 items: 4 29094 } 29095 } 29096 }); 29097} 29098 29099if ($('.js-slider-images').length > 0) { 29100 var sliderImages = Object(tiny_slider_src_tiny_slider__WEBPACK_IMPORTED_MODULE_0__["tns"])({ 29101 container: '.js-slider-images .slider__slides', 29102 items: 1, 29103 slideBy: 'page', 29104 navPosition: "bottom", 29105 prevButton: '.js-slider-images .slider__prev', 29106 nextButton: '.js-slider-images .slider__next' 29107 }); 29108} 29109 29110if ($('.js-slider-months').length > 0) { 29111 var sliderMonths = Object(tiny_slider_src_tiny_slider__WEBPACK_IMPORTED_MODULE_0__["tns"])({ 29112 container: '.js-slider-months .slider__slides', 29113 items: 1, 29114 slideBy: 1, 29115 loop: false, 29116 nav: false, 29117 prevButton: '.js-slider-months .slider__prev', 29118 nextButton: '.js-slider-months .slider__next', 29119 gutter: 10, 29120 responsive: { 29121 375: { 29122 items: 2 29123 }, 29124 767: { 29125 items: 3 29126 }, 29127 1023: { 29128 items: 4 29129 }, 29130 1199: { 29131 items: 6 29132 } 29133 } 29134 }); 29135} 29136 29137$('.js-slider-card-carousel').each(function (idx, carousel) {
29138 var $carousel = $(carousel); 29139 var track = $carousel.find('.slider__slides')[0]; 29140 if (!track) return; 29141 var cardCarousel = Object(tiny_slider_src_tiny_slider__WEBPACK_IMPORTED_MODULE_0__["tns"])({ 29142 container: track, 29143 items: 1, 29144 gutter: 16, 29145 edgePadding: 40, 29146 slideBy: 1, 29147 loop: false, 29148 nav: true, 29149 navPosition: 'bottom', 29150 mouseDrag: true, 29151 prevButton: $carousel.find('.slider__prev')[0], 29152 nextButton: $carousel.find('.slider__next')[0], 29153 responsive: { 29154 768: { 29155 items: 2, 29156 gutter: 24, 29157 edgePadding: 0 29158 }, 29159 1024: { 29160 items: 3, 29161 gutter: 24, 29162 edgePadding: 0 29163 }, 29164 1200: { 29165 items: 4, 29166 gutter: 24, 29167 edgePadding: 0 29168 }, 29169 1400: { 29170 items: 5, 29171 gutter: 24, 29172 edgePadding: 0 29173 } 29174 } 29175 }); 29176 29177 var syncFocusability = function syncFocusability() { 29178 $carousel.find('.slider__slide').each(function (i, slide) { 29179 var isHidden = slide.getAttribute('aria-hidden') === 'true'; 29180 $(slide).find('a[href], button').attr('tabindex', isHidden ? '-1' : null); 29181 }); 29182 }; 29183 29184 cardCarousel.events.on('indexChanged', syncFocusability); 29185 cardCarousel.events.on('transitionEnd', syncFocusability); 29186 syncFocusability(); 29187}); 29188/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 29189 29190/***/ }), 29191
29192/***/ "../src/static/js/modules/init-tabs.js": 29193/*!*********************************************!*\ 29194 !*** ../src/static/js/modules/init-tabs.js ***! 29195 \*********************************************/ 29196/*! no static exports found */ 29197/***/ (function(module, exports) { 29198 29199function initializeTabs(sectionElement) { 29200 var tabs = sectionElement.querySelectorAll('.tabs__nav-element'); 29201 var tabContents = sectionElement.querySelectorAll('.tabs__content'); 29202 tabs.forEach(function (tab, index) { 29203 tab.addEventListener('click', function () { 29204 tabs.forEach(function (t) { 29205 return t.classList.remove('tabs__nav-element--active'); 29206 }); 29207 tabContents.forEach(function (content) { 29208 return content.classList.remove('tabs__content--active'); 29209 }); 29210 tab.classList.add('tabs__nav-element--active'); 29211 tabContents[index].classList.add('tabs__content--active'); 29212 }); 29213 }); 29214} 29215 29216var sections = document.querySelectorAll('section'); 29217sections.forEach(function (section) { 29218 return initializeTabs(section); 29219}); 29220 29221/***/ }), 29222
29223/***/ "../src/static/js/modules/init-wordcloud.js": 29224/*!**************************************************!*\ 29225 !*** ../src/static/js/modules/init-wordcloud.js ***! 29226 \**************************************************/ 29227/*! no static exports found */ 29228/***/ (function(module, exports) { 29229 29230function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 29231 29232function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 29233 29234function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 29235 29236function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 29237 29238function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 29239 29240function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 29241 29242function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 29243 29244function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 29245 29246function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 29247 29248function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 29249 29250function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 29251 29252function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } 29253 29254function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } 29255 29256function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 29257 29258function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 29259 29260function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 29261 29262function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 29263 29264var TestimonialWordCloud = function () { 29265 function TestimonialWordCloud(canvas, wrap) { 29266 var _this = this; 29267 29268 var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 29269 29270 _classCallCheck(this, TestimonialWordCloud); 29271 29272 this.canvas = typeof canvas === 'string' ? document.querySelector(canvas) : canvas; 29273 this.wrap = typeof wrap === 'string' ? document.querySelector(wrap) : wrap; 29274 this.WC = opts.wordcloud || (typeof window !== 'undefined' ? window.WordCloud : undefined); 29275 if (!this.canvas || !this.wrap) throw new Error('TestimonialWordCloud: canvas or wrap element not found.'); 29276 if (typeof this.WC !== 'function') throw new Error('TestimonialWordCloud: WordCloud library n
29276ot found.'); 29277 this.DEFAULT_PALETTE = ['#E00034', '#A8052B', '#000000', '#4d4d4f', '#0E6251', '#810001', '#8A1005']; 29278 this.FALLBACK_LIST = [['excellent', 50], ['amazing', 40], ['helpful', 35], ['friendly', 30], ['responsive', 28], ['efficient', 25], ['quick', 22], ['reliable', 20], ['professional', 18], ['kind', 16], ['trustworthy', 15], ['supportive', 14], ['accessible', 12], ['clear', 10], ['fair', 8], ['affordable', 7], ['understanding', 6], ['positive', 5], ['fast', 4], ['nice', 3]]; 29279 var storeFromAttr = opts.containerEl ? this._parseJSONAttr(opts.containerEl, 'data-store') : undefined; 29280 this.opts = _objectSpread({ 29281 store: opts.store !== undefined ? opts.store : storeFromAttr || undefined, 29282 list: opts.list, 29283 colors: Array.isArray(opts.colors) && opts.colors.length ? opts.colors.slice() : opts.containerEl ? this._parsePalette(opts.containerEl) : this.DEFAULT_PALETTE.slice(), 29284 backgroundColor: '#fff', 29285 gridSize: 8, 29286 shuffle: false, 29287 rotateRatio: 0, 29288 minRotation: 0, 29289 maxRotation: 0, 29290 drawOutOfBound: false, 29291 shrinkToFit: false, 29292 wordClass: 'wc-word', 29293 sizeSteps: 5, 29294 resizeDebounceMs: 120 29295 }, opts); 29296 this._debouncedRender = this._debounce(function () { 29297 return _this.render(); 29298 }, this.opts.resizeDebounceMs); 29299 this._observer = null; 29300 29301 this._attachResize(); 29302 29303 this.render(); 29304 } 29305 29306 _createClass(TestimonialWordCloud, [{ 29307 key: "setStore", 29308 value: function setStore(storeObj) { 29309 this.opts.store = storeObj; 29310 this.opts.list = undefined; 29311 this.render(); 29312 } 29313 }, { 29314 key: "setList", 29315 value: function setList(list) { 29316 this.opts.list = Array.isArray(list) ? list.slice() : undefined; 29317 this.render(); 29318 } 29319 }, { 29320 key: "setColors", 29321 value: function setColors(colors) { 29322 if (Array.isArray(colors) && colors.length) { 29323 this.opts.colors = colors.slice(); 29324 this.render(); 29325 } 29326 } 29327 }, { 29328 key: "destroy", 29329 value: function destroy() { 29330 if (this._observer) { 29331 try { 29332 this._observer.disconnect(); 29333 } catch (_unused) {} 29334 29335 this._observer = null; 29336 } else { 29337 window.removeEventListener('resize', this._debouncedRender); 29338 } 29339 } 29340 }, { 29341 key: "render", 29342 value: function render() { 29343 var _this2 = this; 29344 29345 if (!this.canvas || !this.wrap || typeof this.WC !== 'function') return; 29346 29347 var src = this._getSourceList(); 29348 29349 if (!src.length) return; 29350 29351 var _this$_sizeCanvasToCS = this._sizeCanvasToCSS(), 29352 width = _this$_sizeCanvasToCS.width, 29353 height = _this$_sizeCanvasToCS.height; 29354 29355 var ctx = this.canvas.getContext('2d'); 29356 ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); 29357 29358 var list = this._assignTiers(src); 29359 29360 this.WC([this.canvas, this.wrap], { 29361 list: list, 29362 color: function color(word) { 29363 return _this2._colorForWord(word); 29364 }, 29365 shuffle: this.opts.shuffle, 29366 rotateRatio: this.opts.rotateRatio, 29367 minRotation: this.opts.minRotation, 29368 maxRotation: this.opts.maxRotation, 29369 drawOutOfBound: this.opts.drawOutOfBound, 29370 shrinkToFit: this.opts.shrinkToFit, 29371 gridSize: this.opts.gridSize, 29372 origin: [width / 2, height / 2], 29373 weightFactor: this._makeWeightFactor(list.length, width, height), 29374 backgroundColor: this.opts.backgroundColor, 29375 classes: this.opts.wordClass 29376 }); 29377 } 29378 }, { 29379 key: "_parseJSONAttr", 29380 value: function _parseJSONAttr(el, name) { 29381 var raw = el.getAttribute(name); 29382 if (!raw) return null; 29383 29384 try { 29385 return JSON.parse(raw); 29386 } catch (_unused2) { 29387 try { 29388 return JSON.parse(raw.replace(/"/g, '"')); 29389 } catch (_unused3) { 29390 return null; 29391 } 29392 } 29393 } 29394 }, { 29395 key: "_parsePalette", 29396 value: function _parsePalette(el) { 29397 var raw = el.getAttribute('data-colors'); 29398 if (!raw || !raw.trim()) return this.DEFAULT_PALETTE.slice(); 29399 29400 try { 29401 var maybeJson = JSON.parse(raw.replace(/"/g, '"')); 29402 29403 if (Array.isArray(maybeJson)) { 29404 var cleaned = maybeJson.map(function (v) { 29405 return String(v).trim(); 29406 }
29406).filter(Boolean); 29407 return cleaned.length ? cleaned : this.DEFAULT_PALETTE.slice(); 29408 } 29409 } catch (_unused4) { 29410 console.error("failed to parse color palette"); 29411 } 29412 29413 var parts = raw.split(',').map(function (s) { 29414 return s.trim(); 29415 }).filter(Boolean); 29416 return parts.length ? parts : this.DEFAULT_PALETTE.slice(); 29417 } 29418 }, { 29419 key: "_getSourceList", 29420 value: function _getSourceList() { 29421 if (Array.isArray(this.opts.list) && this.opts.list.length) return this._normalizeAndSort(this.opts.list); 29422 29423 if (this.opts.store && _typeof(this.opts.store) === 'object') { 29424 var baseList = Object.entries(this.opts.store || {}).map(function (_ref) { 29425 var _ref2 = _slicedToArray(_ref, 2), 29426 w = _ref2[0], 29427 c = _ref2[1]; 29428 29429 return [w, Number(c) || 0]; 29430 }); 29431 return this._normalizeAndSort(baseList); 29432 } 29433 29434 return this.FALLBACK_LIST.slice(); 29435 } 29436 }, { 29437 key: "_normalizeAndSort", 29438 value: function _normalizeAndSort(list) { 29439 return list.map(function (_ref3) { 29440 var _ref4 = _slicedToArray(_ref3, 2), 29441 w = _ref4[0], 29442 c = _ref4[1]; 29443 29444 return [String(w), Number(c) || 0]; 29445 }).sort(function (a, b) { 29446 return b[1] - a[1]; 29447 }); 29448 } 29449 }, { 29450 key: "_clamp", 29451 value: function _clamp(v, min, max) { 29452 return Math.max(min, Math.min(max, v)); 29453 } 29454 }, { 29455 key: "_hashWord", 29456 value: function _hashWord(str) { 29457 var h = 0; 29458 29459 for (var i = 0; i < str.length; i++) { 29460 h = (h << 5) - h + str.charCodeAt(i) | 0; 29461 } 29462 29463 return Math.abs(h); 29464 } 29465 }, { 29466 key: "_colorForWord", 29467 value: function _colorForWord(word) { 29468 var p = this.opts.colors; 29469 return p[this._hashWord(word) % p.length]; 29470 } 29471 }, { 29472 key: "_scaleForCount", 29473 value: function _scaleForCount(n) { 29474 var cap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1.5; 29475 return this._clamp(Math.sqrt(30 / Math.max(1, n)), 1, cap); 29476 } 29477 }, { 29478 key: "_assignTiers", 29479 value: function _assignTiers(src) { 29480 var TIERS = this._tierCount(); 29481 29482 if (!src.length) return []; 29483 29484 var distinct = _toConsumableArray(new Set(src.map(function (_ref5) { 29485 var _ref6 = _slicedToArray(_ref5, 2), 29486 c = _ref6[1]; 29487 29488 return c; 29489 }))).sort(function (a, b) { 29490 return a - b; 29491 }); 29492 29493 if (distinct.length === 1) { 29494 var mid = Math.floor((TIERS - 1) / 2); 29495 return src.map(function (_ref7) { 29496 var _ref8 = _slicedToArray(_ref7, 1), 29497 word = _ref8[0]; 29498 29499 return [word, mid]; 29500 }); 29501 } 29502 29503 var tierByCount = new Map(distinct.map(function (count, i) { 29504 return [count, Math.round(i / (distinct.length - 1) * (TIERS - 1))]; 29505 })); 29506 return src.map(function (_ref9) { 29507 var _ref10 = _slicedToArray(_ref9, 2), 29508 word = _ref10[0], 29509 count = _ref10[1]; 29510 29511 return [word, tierByCount.get(count)]; 29512 }); 29513 } 29514 }, { 29515 key: "_tierCount", 29516 value: function _tierCount() { 29517 return Math.max(2, this.opts.sizeSteps || 5); 29518 } 29519 }, { 29520 key: "_makeWeightFactor", 29521 value: function _makeWeightFactor(wordCount, width, height) { 29522 var _this3 = this; 29523 29524 var TIERS = this._tierCount(); 29525 29526 var side = Math.max(1, Math.min(width, height)); 29527 29528 var crowd = this._scaleForCount(wordCount); 29529 29530 var MAX_PX = Math.min(45, side * 0.15) * crowd; 29531 var MIN_PX = Math.max(12, MAX_PX * 0.35); 29532 return function (tier) { 29533 var step = _this3._clamp(+tier || 0, 0, TIERS - 1); 29534 29535 var px = MIN_PX + step / (TIERS - 1) * (MAX_PX - MIN_PX); 29536 return _this3._clamp(px, MIN_PX, MAX_PX); 29537 }; 29538 } 29539 }, { 29540 key: "_sizeCanvasToCSS", 29541 value: function _sizeCanvasToCSS() { 29542 var rect = this.wrap.getBoundingClientRect(); 29543 var cssW = Math.max(1, Math.round(rect.width || 0)); 29544 var cssH = Math.max(1, Math.round(rect.height || 0)); 29545 this.canvas.width = cssW; 29546 this.canvas.height = cssH; 29547 this.canvas.getContext('2d').setTransform(1, 0, 0, 1, 0, 0); 29548 return { 29549 width: cssW, 29550 height: cssH 29551 }; 29552 } 29553 }, { 29554 key: "_debounce", 29555 value: function _debounce(fn, ms) { 29556 var t; 29557 return function () { 29558 for (var _len = arguments.length, a = new Array(_len), _key = 0; _key < _len; _key++) { 29559 a[_key] = arguments[_key]; 29560 } 29561 29562 clearTimeout(t); 29563 t = setTimeout(function () { 29564 return fn.apply(void 0, a); 29565 }, ms); 29566 }; 29567 } 29568 }, { 29569 key: "_attachResize", 29570 value: function _attachResize() { 29571 if (window.ResizeObserver && this.wrap) { 29572 this._observer = new ResizeObserver(this._debouncedRender); 29573 29574 this._observer.observe(this.wrap); 29575 } else { 29576 window.addEventListener('resize', this._debouncedRender); 29577 } 29578 } 29579 }]); 29580 29581 return TestimonialWordCloud; 29582}(); 29583 29584document.addEventListener('DOMContentLoaded', function () { 29585 var wcRef = typeof window !== 'undefined' && (window.WordCloud || window.wordcloud) || undefined; 29586 if (!wcRef) return; 29587 document.querySelectorAll('.wc-container').forEach(function (container) { 29588 var wrap = container.querySelector('.wc-content'); 29589 var canvas = container.nextElementSibling; 29590 29591 if (!(canvas && canvas.classList.contains('wc-canvas'))) { 29592 canvas = container.querySelector('.wc-canvas'); 29593 } 29594 29595 if (!wrap || !canvas) return; 29596 new TestimonialWordCloud(canvas, wrap, { 29597 containerEl: container, 29598 wordcloud: wcRef 29599 }); 29600 }); 29601}); 29602 29603/***/ }), 29604
29605/***/ "../src/static/js/modules/minimap.js": 29606/*!*******************************************!*\ 29607 !*** ../src/static/js/modules/minimap.js ***! 29608 \*******************************************/ 29609/*! exports provided: Minimap */ 29610/***/ (function(module, __webpack_exports__, __webpack_require__) { 29611 29612"use strict"; 29613__webpack_require__.r(__webpack_exports__); 29614/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Minimap", function() { return Minimap; }); 29615function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } 29616 29617function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 29618 29619function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 29620 29621function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 29622 29623function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 29624 29625function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 29626 29627var Minimap = function () { 29628 function Minimap(container) { 29629 _classCallCheck(this, Minimap); 29630 29631 this.container = $('#' + container); 29632 this.data = JSON.parse(atob(this.container.data('map-data'))); 29633 this.initMap(); 29634 } 29635 29636 _createClass(Minimap, [{ 29637 key: "initMap", 29638 value: function initMap() { 29639 this.map = new google.maps.Map(this.container[0], { 29640 center: this.data.markers[0].geocode, 29641 disableDefaultUI: true, 29642 zoom: 9, 29643 minZoom: 9, 29644 maxZoom: 16, 29645 styles: this.getDefaultMapStyle() 29646 }); 29647 this.initMarkers(); 29648 } 29649 }, { 29650 key: "initMarkers", 29651 value: function initMarkers() { 29652 this.markers = []; 29653 29654 var _iterator = _createForOfIteratorHelper(this.data.markers), 29655 _step; 29656 29657 try { 29658 for (_iterator.s(); !(_step = _iterator.n()).done;) { 29659 var location = _step.value; 29660 var marker = new google.maps.Marker({ 29661 position: location.geocode, 29662 map: this.map, 29663 icon: { 29664 url: location.icon, 29665 labelOrigin: new google.maps.Point(16, location.offset) 29666 }, 29667 label: { 29668 text: location.label, 29669 color: 'red', 29670 fontSize: '14px', 29671 fontFamily: 'Museo Sans, sans-serif', 29672 className: 'map__label' 29673 }, 29674 title: location.label 29675 }); 29676 this.markers.push(marker); 29677 } 29678 } catch (err) { 29679 _iterator.e(err); 29680 } finally { 29681 _iterator.f(); 29682 } 29683 29684 var bounds = new google.maps.LatLngBounds(); 29685 29686 var _iterator2 = _createForOfIteratorHelper(this.markers), 29687 _step2; 29688
29689 try { 29690 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { 29691 var _marker = _step2.value; 29692 bounds.extend(_marker.getPosition()); 29693 } 29694 } catch (err) { 29695 _iterator2.e(err); 29696 } finally { 29697 _iterator2.f(); 29698 } 29699 29700 this.map.fitBounds(bounds); 29701 } 29702 }, { 29703 key: "getDefaultMapStyle", 29704 value: function getDefaultMapStyle() { 29705 return [{ 29706 "featureType": "administrative", 29707 "elementType": "all", 29708 "stylers": [{ 29709 "saturation": "-100" 29710 }] 29711 }, { 29712 "featureType": "administrative.province", 29713 "elementType": "all", 29714 "stylers": [{ 29715 "visibility": "off" 29716 }] 29717 }, { 29718 "featureType": "landscape", 29719 "elementType": "all", 29720 "stylers": [{ 29721 "saturation": -70 29722 }, { 29723 "lightness": 65 29724 }, { 29725 "visibility": "on" 29726 }] 29727 }, { 29728 "featureType": "poi", 29729 "elementType": "all", 29730 "stylers": [{ 29731 "saturation": -100 29732 }, { 29733 "lightness": "50" 29734 }, { 29735 "visibility": "simplified" 29736 }] 29737 }, { 29738 "featureType": "poi.school", 29739 "elementType": "all", 29740 "stylers": [{ 29741 "saturation": -50 29742 }, { 29743 "lightness": "10" 29744 }, { 29745 "visibility": "on" 29746 }] 29747 }, { 29748 "featureType": "road", 29749 "elementType": "all", 29750 "stylers": [{ 29751 "saturation": "-100" 29752 }] 29753 }, { 29754 "featureType": "road.highway", 29755 "elementType": "all", 29756 "stylers": [{ 29757 "visibility": "simplified" 29758 }] 29759 }, { 29760 "featureType": "road.arterial", 29761 "elementType": "all", 29762 "stylers": [{ 29763 "lightness": "30" 29764 }] 29765 }, { 29766 "featureType": "road.local", 29767 "elementType": "all", 29768 "stylers": [{ 29769 "lightness": "40" 29770 }] 29771 }, { 29772 "featureType": "transit", 29773 "elementType": "all", 29774 "stylers": [{ 29775 "saturation": -100 29776 }, { 29777 "visibility": "simplified" 29778 }] 29779 }, { 29780 "featureType": "water", 29781 "elementType": "geometry", 29782 "stylers": [{ 29783 "saturation": -75 29784 }] 29785 }, { 29786 "featureType": "water", 29787 "elementType": "labels", 29788 "stylers": [{ 29789 "lightness": -25 29790 }, { 29791 "saturation": -75 29792 }] 29793 }]; 29794 } 29795 }, { 29796 key: "show", 29797 value: function show() { 29798 $.magnificPopup.open({ 29799 items: { 29800 src: this.container.closest('.popup'), 29801 type: 'inline' 29802 } 29803 }); 29804 } 29805 }]); 29806 29807 return Minimap; 29808}(); 29809/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 29810 29811/***/ }), 29812
29813/***/ "../src/static/js/modules/review-masonry.js": 29814/*!**************************************************!*\ 29815 !*** ../src/static/js/modules/review-masonry.js ***! 29816 \**************************************************/ 29817/*! no static exports found */ 29818/***/ (function(module, exports) { 29819 29820var ROW_UNIT = 2; 29821var GAP = 15; 29822document.querySelectorAll('.reviews-grid').forEach(function (grid) { 29823 var setSpan = function setSpan(card) { 29824 var height = card.getBoundingClientRect().height; 29825 card.style.gridRowEnd = "span ".concat(Math.max(1, Math.ceil((height + GAP) / ROW_UNIT))); 29826 }; 29827 29828 if (!window.ResizeObserver) { 29829 return; 29830 } 29831 29832 grid.classList.add('is-masonry'); 29833 var resizeObserver = new ResizeObserver(function (entries) { 29834 entries.forEach(function (entry) { 29835 return setSpan(entry.target); 29836 }); 29837 }); 29838 29839 var watch = function watch(card) { 29840 setSpan(card); 29841 resizeObserver.observe(card); 29842 }; 29843 29844 grid.querySelectorAll(':scope > .review-card').forEach(watch); 29845 new MutationObserver(function (mutations) { 29846 mutations.forEach(function (mutation) { 29847 mutation.addedNodes.forEach(function (node) { 29848 if (node.nodeType === 1 && node.classList.contains('review-card')) { 29849 watch(node); 29850 } 29851 }); 29852 }); 29853 }).observe(grid, { 29854 childList: true 29855 }); 29856}); 29857 29858/***/ }), 29859
29860/***/ "../src/static/js/utils/constant.js": 29861/*!******************************************!*\ 29862 !*** ../src/static/js/utils/constant.js ***! 29863 \******************************************/ 29864/*! exports provided: DEFAULT_MAP_PIN_ICON, DEFAULT_MAP_SELECTED_PIN_ICON, DEFAULT_MAP_BUS_ICON, DEFAULT_MAP_BUS_SELECTED_ICON, DEFAULT_MAP_CENTER, MAP_HELPER_TEXT_KEY */ 29865/***/ (function(module, __webpack_exports__, __webpack_require__) { 29866 29867"use strict"; 29868__webpack_require__.r(__webpack_exports__); 29869/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_MAP_PIN_ICON", function() { return DEFAULT_MAP_PIN_ICON; }); 29870/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_MAP_SELECTED_PIN_ICON", function() { return DEFAULT_MAP_SELECTED_PIN_ICON; }); 29871/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_MAP_BUS_ICON", function() { return DEFAULT_MAP_BUS_ICON; }); 29872/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_MAP_BUS_SELECTED_ICON", function() { return DEFAULT_MAP_BUS_SELECTED_ICON; }); 29873/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_MAP_CENTER", function() { return DEFAULT_MAP_CENTER; }); 29874/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MAP_HELPER_TEXT_KEY", function() { return MAP_HELPER_TEXT_KEY; }); 29875var DEFAULT_MAP_PIN_ICON = '/static/images/map-pin-greyscale.png'; 29876var DEFAULT_MAP_SELECTED_PIN_ICON = '/static/images/map-pin.png'; 29877var DEFAULT_MAP_BUS_ICON = '/static/images/map-bus-pin-gray.png'; 29878var DEFAULT_MAP_BUS_SELECTED_ICON = '/static/images/icon-bus-red.png'; 29879var DEFAULT_MAP_CENTER = { 29880 lat: 43.7712, 29881 lng: -79.4179 29882}; 29883var MAP_HELPER_TEXT_KEY = 'MAP_HELPER_TEXT_SEEN'; 29884 29885/***/ }), 29886
29887/***/ "../src/static/js/utils/custom-form-settings.js": 29888/*!******************************************************!*\ 29889 !*** ../src/static/js/utils/custom-form-settings.js ***! 29890 \******************************************************/ 29891/*! no static exports found */ 29892/***/ (function(module, exports, __webpack_require__) { 29893 29894/* WEBPACK VAR INJECTION */(function($) {var setValidationOnAvailableForms = function setValidationOnAvailableForms() { 29895 var $allForms = $('form'); 29896 $allForms.each(function (key, form) { 29897 var allSubmitButtons = $(form).find('.submitButton'); 29898 allSubmitButtons.each(function (key2, button) { 29899 $(button).on('click', function (e) { 29900 var $btn = $(this); 29901 29902 if (!validateVisibleFormSteps(form) || !checkIfPhoneFieldIsEmptyOrValidlyFilled(form) || !checkIfNumberFieldIsValid(form)) { 29903 e.stopImmediatePropagation(); 29904 e.preventDefault(); 29905 $btn.prev('.input-element-validation-errors').remove(); 29906 $('<div class="input-element-validation-errors input-element-validation-errors--inline">Please check all required fields</div>').insertBefore($btn); 29907 } 29908 }); 29909 }); 29910 }); 29911}; 29912 29913var validateVisibleFormSteps = function validateVisibleFormSteps(form) { 29914 var valid = true; 29915 $(form).find('.input-element-validation-errors').remove(); 29916 $(form).find('.form-field-required').next('.base-element-block.input-element-block:visible').each(function (key, element) { 29917 var $inputElement = $(element).find('input, select, textarea'); 29918 29919 if ($inputElement.closest('.inputCaptcha').length > 0) { 29920 return; 29921 } 29922 29923 if ($inputElement.length > 1) { 29924 var error = true; 29925 $inputElement.each(function (k, e) { 29926 if ($(e).is('input[type="radio"], input[type="checkbox"]') && $(e).is(':checked')) { 29927 error = false; 29928 } 29929 }); 29930 29931 if (error) { 29932 $(element).append('<div class="input-element-validation-errors">Cannot be empty</div>'); 29933 valid = false; 29934 } 29935 } else if ($inputElement.is('input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="date"], input[type="number"], textarea, select') && !$inputElement.val()) { 29936 $(element).append('<div class="input-element-validation-errors">Cannot be empty</div>'); 29937 valid = false; 29938 } else if ($inputElement.is('input[type="radio"], input[type="checkbox"]') && !$inputElement.is(':checked')) { 29939 $(element).append('<div class="input-element-validation-errors">Cannot be empty</div>'); 29940 valid = false; 29941 } else if ($inputElement.is('input[type="date"]') && $inputElement.val()) { 29942 valid = !validateDate($inputElement); 29943 } 29944 }); 29945 return valid; 29946}; 29947 29948var checkIfPhoneFieldIsEmptyOrValidlyFilled = function checkIfPhoneFieldIsEmptyOrValidlyFilled(form) { 29949 var valid = true; 29950 $(form).find('.input-element-phone-validation-errors').remove(); 29951 var $inputTels = $(form).find('.inputTel:visible'); 29952 29953 if ($inputTels.length) { 29954 $inputTels.each(function (key, element) { 29955 if ($(element).val().length > 0 && $(element).val().length < 14) { 29956 $(element).parent().append('<div class="input-element-phone-validation-errors input-element-validation-errors">Please enter a valid phone number</div>'); 29957 valid = false; 29958 } 29959 }); 29960 } 29961 29962 return valid; 29963}; 29964 29965var checkIfNumberFieldIsValid = function checkIfNumberFieldIsValid(form) { 29966 var valid = true; 29967 $(form).find('.input-element-number-validation-errors').remove(); 29968 var $inputNumbers = $(form).find('.inputNumber:visible'); 29969 29970 if ($inputNumbers.length) { 29971 $inputNumbers.each(function (key, element) { 29972 var $el = $(element); 29973 var min = $el.attr('min'); 29974 var max = $el.attr('max'); 29975 var value = $el.val(); 29976 29977 if (min === undefined || max === undefined || value === '') { 29978 return true; 29979 } 29980 29981 var numValue = Number(value); 29982 29983 if (isNaN(numValue) || numValue < Number(min) || numValue > Number(max)) { 29984 $el.parent().append('<div class="input-element-number-validation-errors input-element-validation-errors">' + "Please enter a number between ".concat(min, " and ").concat(max) + '</div>'); 29985 valid = false;
29986 } 29987 }); 29988 } 29989 29990 return valid; 29991}; 29992 29993var setDefaultTelephoneFormat = function setDefaultTelephoneFormat() { 29994 $('input[type="tel"]').each(function () { 29995 $(this).on('change keypress paste', function (e) { 29996 var output, 29997 $this = $(this), 29998 input = $this.val(); 29999 30000 if (e.which < 48 || e.which > 57 || input.length > 13) { 30001 e.preventDefault(); 30002 } 30003 30004 if (e.keyCode !== 8) { 30005 input = input.replace(/[^0-9]/g, ''); 30006 var area = input.substr(0, 3); 30007 var pre = input.substr(3, 3); 30008 var tel = input.substr(6, 4); 30009 30010 if (area.length !== 0 && area.length < 3) { 30011 output = '(' + area; 30012 } else if (area.length === 3 && pre.length < 3) { 30013 output = '(' + area + ')' + ' ' + pre; 30014 } else if (area.length === 3 && pre.length === 3) { 30015 output = '(' + area + ')' + ' ' + pre + '-' + tel; 30016 } 30017 30018 $this.val(output); 30019 } 30020 }); 30021 }); 30022}; 30023 30024var setOtherOptionForCheckboxAndRadioAndSelect = function setOtherOptionForCheckboxAndRadioAndSelect() { 30025 $('input[type="checkbox"],input[type="radio"],select').on('change', function () { 30026 var $this = $(this); 30027 var inputName = $this.attr('name').replace('[]', ''); 30028 30029 if ($this.val() === 'Other' && ($this.is(':checked') || $this.is("select"))) { 30030 $this.closest('form').find("input[name=\"other_option_".concat(inputName, "\"")).parent().show(); 30031 } else if ($this.val() === 'Other' && !$this.is(':checked') || $this.val() !== 'Other' && $this.is(':radio') || $this.val() !== 'Other' && $this.is('select')) { 30032 $this.closest('form').find("input[name=\"other_option_".concat(inputName, "\"")).parent().hide(); 30033 } 30034 }); 30035}; 30036 30037var validateDate = function validateDate($dateField) { 30038 $dateField.parent().find('.input-element-date-validation-errors').remove(); 30039 $dateField.parent().find('.input-element-validation-errors').remove(); 30040 var selectedDate = new Date($dateField.val() + ' 23:59:59'); 30041 30042 if (selectedDate.toString() !== 'Invalid Date') { 30043 var minDate = new Date($dateField.attr('min')); 30044 30045 if (selectedDate < minDate) { 30046 $dateField.parent().append('<div class="input-element-date-validation-errors input-element-validation-errors">This date is unavailable</div>'); 30047 return true; 30048 } 30049 } 30050 30051 return false; 30052}; 30053 30054var addAddressAutocomplete = function addAddressAutocomplete() { 30055 var $allForms = $('form'); 30056 30057 if ($allForms.length > 0) { 30058 $allForms.each(function () { 30059 var addressField = $(this).find('input[name="address_auto_populate"]'); 30060 30061 if (addressField.length > 0) { 30062 var typingTimer; 30063 var doneTypingInterval = 1000; 30064 $(document).on('click', function (e) { 30065 if (!$(e.target).closest('.auto-populate-addresses').length) { 30066 $('.auto-populate-addresses').css('visibility', 'hidden'); 30067 } 30068 }); 30069 $('.auto-populate-addresses').on('click', function (e) { 30070 e.stopPropagation(); 30071 }); 30072 addressField.on('keyup', function () { 30073 clearTimeout(typingTimer); 30074 var $input = $(this); 30075 var $inputValue = $(this).val(); 30076 30077 if ($inputValue.length >= 2) { 30078 typingTimer = setTimeout(function () { 30079 fetchAvailableAddresses($inputValue).then(function (result) { 30080 $input.parent().find('.auto-populate-addresses').remove(); 30081 $input.parent().append(result); 30082 $input.parent().attr('style', 'position:relative;'); 30083 handleAddressClick(); 30084 }).catch(function (error) { 30085 $input.parent().find('.auto-populate-addresses').remove(); 30086 }); 30087 }, doneTypingInterval); 30088 } 30089 }); 30090 } 30091 }); 30092 } 30093}; 30094 30095var fetchAvailableAddresses = function fetchAvailableAddresses() { 30096 var SearchTerm = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; 30097 var LastId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; 30098 return new Promise(function (resolve, reject) { 30099 var url = 'https://ws1.postescanada-canadapost.ca/AddressComplete/Interactive/Find/v2.10/json3.ws'; 30100 var params = ''; 30101 params += "&Key=" + encodeURIComponent('CY35-NR14-AP25-KB19'); 30102 30103 if (SearchTerm) { 30104 params += "&SearchTerm=" + encodeURIComponent(SearchTerm); 30105 } 30106 30107 if (LastId) { 30108 params += "&LastId=" + encodeURIComponent(LastId); 30109 } 30110 30111 fetch(url, { 30112 method: 'POST', 30113 headers: { 30114 'Content-type': 'application/x-www-form-urlencoded' 30115 }, 30116 body: params 30117 }).then(function (response) { 30118 if (response.ok) { 30119 return response.json(); 30120 } else { 30121 throw new Error('Network response was not ok.'); 30122 } 30123 }).then(function (data) { 30124 if (data.Items.length === 1 && typeof data.Items[0].Error !== "undefined") { 30125 resolve(''); 30126 } else if (data.Items.length === 0) { 30127 resolve(''); 30128 } else { 30129 var listElement = '<ul class="auto-populate-addresses">';
30130 data.Items.forEach(function (item) { 30131 var arrow = ''; 30132 var itemId = ''; 30133 30134 if (item.Next === 'Find') { 30135 arrow = '<i>→</i>'; 30136 itemId = "data-id=\"".concat(item.Id, "\""); 30137 } 30138 30139 listElement += "<li ".concat(itemId, "><b>").concat(item.Text, "</b>, ").concat(item.Description, " ").concat(arrow, "</li>"); 30140 }); 30141 listElement += '</ul>'; 30142 resolve(listElement); 30143 } 30144 }).catch(function (error) { 30145 reject(error); 30146 }); 30147 }); 30148}; 30149 30150var handleAddressClick = function handleAddressClick() { 30151 $('.auto-populate-addresses').on('click', 'li', function () { 30152 var $dataId = $(this).attr('data-id'); 30153 var $input = $(this); 30154 30155 if ($dataId) { 30156 fetchAvailableAddresses('', $dataId).then(function (result) { 30157 $input.parent().parent().append(result); 30158 $input.parent().parent().attr('style', 'position:relative;'); 30159 $input.parent().remove(); 30160 handleAddressClick(); 30161 }).catch(function (error) { 30162 $input.parent().remove(); 30163 }); 30164 } else { 30165 var addressParts = $input.text().split(', '); 30166 var $addressField = $input.parent().parent().parent().find('input[name="address_auto_populate"]'); 30167 var $cityField = $input.parent().parent().parent().find('input[name="address_auto_populate_city"]'); 30168 var $provinceField = $input.parent().parent().parent().find('input[name="address_auto_populate_province"]'); 30169 var $postalField = $input.parent().parent().parent().find('input[name="address_auto_populate_postal"]'); 30170 $addressField.val(''); 30171 $cityField.val(''); 30172 $provinceField.val(''); 30173 $postalField.val(''); 30174 30175 var populateField = function populateField(field, value) { 30176 if (field.length) { 30177 var currentValue = field.val(); 30178 30179 if (currentValue) { 30180 field.val("".concat(currentValue, ", ").concat(value)); 30181 } else { 30182 field.val(value); 30183 } 30184 } 30185 }; 30186 30187 populateField($addressField, addressParts[0]); 30188 30189 if (!$cityField.length) { 30190 populateField($addressField, addressParts[1]); 30191 } else { 30192 populateField($cityField, addressParts[1]); 30193 } 30194 30195 if (!$provinceField.length) { 30196 populateField($addressField, addressParts[2]); 30197 } else { 30198 populateField($provinceField, addressParts[2]); 30199 } 30200 30201 if (!$postalField.length) { 30202 populateField($addressField, addressParts[3]); 30203 } else { 30204 populateField($postalField, addressParts[3]); 30205 } 30206 30207 $input.parent().remove(); 30208 } 30209 }); 30210}; 30211 30212if (document.readyState !== 'loading') { 30213 setValidationOnAvailableForms(); 30214 setDefaultTelephoneFormat(); 30215 setOtherOptionForCheckboxAndRadioAndSelect(); 30216 addAddressAutocomplete(); 30217} else { 30218 document.addEventListener('DOMContentLoaded', setValidationOnAvailableForms); 30219 document.addEventListener('DOMContentLoaded', setDefaultTelephoneFormat); 30220 document.addEventListener('DOMContentLoaded', setOtherOptionForCheckboxAndRadioAndSelect); 30221 document.addEventListener('DOMContentLoaded', addAddressAutocomplete); 30222} 30223 30224var $registrationChangeRequestChildCareAndLhcc = $('#registration-change-request-for-child-care-and-lhcc'); 30225 30226if ($registrationChangeRequestChildCareAndLhcc.length) { 30227 var applyDefaultMins = function applyDefaultMins() { 30228 if ($withdrawalDateChildCare.length && !$withdrawalDateChildCare.prop('disabled')) { 30229 $withdrawalDateChildCare.attr("min", $tenBusinessDays); 30230 } 30231 30232 if ($withdrawalDateLicensedHome.length && !$withdrawalDateLicensedHome.prop('disabled')) { 30233 $withdrawalDateLicensedHome.attr("min", $tenBusinessDays); 30234 } 30235 }; 30236 30237 var ensureSchoolYearMessageInjected = function ensureSchoolYearMessageInjected() { 30238 var $msg = $registrationChangeRequestChildCareAndLhcc.find('#sy-message'); 30239 if ($msg.length) return $msg; 30240 var $lastRadio = $schoolYearRadios.last(); 30241 if (!$lastRadio.length) return $(); 30242 var messageHtml = "\n\t\t\t<div id=\"sy-message\" style=\"display:none;color: red; margin-top: 5px\">\n\t\t\t <small class=\"text-danger\">\n\t\t\t\t2026/2027 Registration: Any registration with a start date of September 7, 2026, will be cancelled.\n\t\t\t </small>\n\t\t\t</div>\n\t\t "; 30243 var $anchor = $lastRadio.closest('label, .form-check, .radio, .field, .input-element-block'); 30244 ($anchor.length ? $anchor : $lastRadio).after(messageHtml); 30245 return $registrationChangeRequestChildCareAndLhcc.find('#sy-message'); 30246 }; 30247 30248 var applySchoolYearRules = function applySchoolYearRules() { 30249 var selected = $schoolYearRadios.filter(':checked').val(); 30250 var $schoolYearMessage = ensureSchoolYearMessageInjected(); 30251 $schoolYearMessage.hide(); 30252 if (!$withdrawalDateChildCare.length) return; 30253 30254 if (selected === '2026/2027') { 30255 $withdrawalDateChildCare.prop('disabled', true).val(''); 30256 $schoolYearMessage.show(); 30257 return; 30258 } 30259 30260 if (selected === '2025/2026' || selected === '2025-2026-2027') { 30261 $withdrawalDateChildCare.prop('disabled', false); 30262 $withdrawalDateChildCare.removeAttr('max'); 30263 $withdrawalDateChildCare.attr('min', $tenBusinessDays); 30264 var defaultDate = LAST_DAY_2526 >= $tenBusinessDays ? LAST_DAY_2526 : $tenBusinessDays; 30265 $withdrawalDateChildCare.val(defaultDate); 30266 return; 30267 } 30268 30269 $withdrawalDateChildCare.prop('disabled', false); 30270 $withdrawalDateChildCare.removeAttr('max'); 30271 $withdrawalDateChildCare.attr('min', $tenBusinessDays || baselineChildCareMin); 30272 }; 30273 30274 var $withdrawalDateChildCare = $('input[name="withdrawal_date_child_care"]'); 30275 var $withdrawalDateLicensedHome = $('input[name="registration_date_licensed_home"]'); 30276 var $tenBusinessDays = addBusinessDays(10); 30277 var $schoolYearRadios = $registrationChangeRequestChildCareAndLhcc.find('input[name="schoolYearRadio_child_care"]'); 30278 var $schoolYearMessage = $registrationChangeRequestChildCareAndLhcc.find('#sy-message');
30279 var LAST_DAY_2526 = '2026-06-26'; 30280 var baselineChildCareMin = $withdrawalDateChildCare.attr('min') || ''; 30281 applyDefaultMins(); 30282 $registrationChangeRequestChildCareAndLhcc.on('change', 'input[name="schoolYearRadio_child_care"]', function () { 30283 applySchoolYearRules(); 30284 }); 30285 $registrationChangeRequestChildCareAndLhcc.on('change', 'select[name="program_child_care"], select[name="type_change_child_care"]', function () { 30286 var $typeOfChange = $('select[name="type_change_child_care"]'); 30287 var selectedSchoolYear = $schoolYearRadios.filter(':checked').val(); 30288 if (selectedSchoolYear === '2025/2026' || selectedSchoolYear === '2025-2026-2027') return; 30289 if (selectedSchoolYear === '2026/2027') return; 30290 30291 if (($typeOfChange.val() || '').toLowerCase() === 'program withdrawal') { 30292 if (!$withdrawalDateChildCare.prop('disabled')) { 30293 $withdrawalDateChildCare.attr('min', $tenBusinessDays); 30294 $withdrawalDateChildCare.val($tenBusinessDays); 30295 } 30296 } 30297 }); 30298 $registrationChangeRequestChildCareAndLhcc.on('change', 'select[name="program_licensed_home"], select[name="type_licensed_home"]', function () { 30299 var $typeOfChange = $('select[name="type_licensed_home"]'); 30300 30301 if (($typeOfChange.val() || '').toLowerCase() === 'program withdrawal') { 30302 if (!$withdrawalDateLicensedHome.prop('disabled')) { 30303 $withdrawalDateLicensedHome.attr('min', $tenBusinessDays); 30304 $withdrawalDateLicensedHome.val($tenBusinessDays); 30305 } 30306 } 30307 }); 30308 applySchoolYearRules(); 30309} 30310 30311function addBusinessDays(daysToAdd) { 30312 var timeZone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "America/Toronto"; 30313 var formatter = new Intl.DateTimeFormat("en-CA", { 30314 timeZone: timeZone, 30315 year: "numeric", 30316 month: "2-digit", 30317 day: "2-digit" 30318 }); 30319 var now = new Date(); 30320 var parts = formatter.formatToParts(now); 30321 var year = parseInt(parts.find(function (p) { 30322 return p.type === "year"; 30323 }).value, 10); 30324 var month = parseInt(parts.find(function (p) { 30325 return p.type === "month"; 30326 }).value, 10); 30327 var day = parseInt(parts.find(function (p) { 30328 return p.type === "day"; 30329 }).value, 10); 30330 30331 function toDateString(y, m, d) { 30332 return "".concat(y, "-").concat(String(m).padStart(2, "0"), "-").concat(String(d).padStart(2, "0")); 30333 } 30334 30335 function nextDay(y, m, d) { 30336 var tmp = new Date(Date.UTC(y, m - 1, d)); 30337 tmp.setUTCDate(tmp.getUTCDate() + 1); 30338 return { 30339 y: tmp.getUTCFullYear(), 30340 m: tmp.getUTCMonth() + 1, 30341 d: tmp.getUTCDate() 30342 }; 30343 } 30344 30345 var _nextDay = nextDay(year, month, day); 30346 30347 year = _nextDay.y; 30348 month = _nextDay.m; 30349 day = _nextDay.d; 30350 var count = 0; 30351 30352 while (count < daysToAdd) { 30353 var tmp = new Date(Date.UTC(year, month - 1, day)); 30354 var dow = tmp.getUTCDay(); 30355 30356 if (dow !== 0 && dow !== 6) { 30357 count++; 30358 } 30359 30360 if (count < daysToAdd) { 30361 var _nextDay2 = nextDay(year, month, day); 30362 30363 year = _nextDay2.y; 30364 month = _nextDay2.m; 30365 day = _nextDay2.d; 30366 } 30367 } 30368 30369 return toDateString(year, month, day); 30370} 30371 30372var $membershipCancellationRequest = $('#membership_cancellation_request'); 30373var $membershipCancellationRequestClass = $('.membership_cancellation_request'); 30374 30375if ($membershipCancellationRequest.length) { 30376 var _$membershipCancellationRequestAll = $membershipCancellationRequest.find(".element-block.static-element-block"); 30377 30378 _$membershipCancellationRequestAll.hide(); 30379 30380 $membershipCancellationRequest.on('change', 'input:radio[name="membership"]', function () { 30381 _$membershipCancellationRequestAll.hide(); 30382 30383 if ($(this).val() === 'Cancellation') { 30384 _$membershipCancellationRequestAll.last().show(); 30385 } else if ($(this).val() === 'Convert my membership fees to monthly donations') { 30386 _$membershipCancellationRequestAll.first().show(); 30387 } 30388 }); 30389} 30390 30391if ($membershipCancellationRequestClass.length) { 30392 $membershipCancellationRequestClass.on('change', 'input:radio[name="type"]', function () { 30393 var $selectedValue = $(this).val().toLowerCase(); 30394 var $childrenAttendingQuestion = $('.membershipCancellationRequest-children-attending'); 30395
30396 if ($selectedValue == 'youth' || $selectedValue == 'family general' || $selectedValue == 'family plus') { 30397 $childrenAttendingQuestion.show(); 30398 } else { 30399 $childrenAttendingQuestion.hide(); 30400 } 30401 }); 30402 $membershipCancellationRequestClass.on('change', 'input:radio[name="childrenAttending"]', function () { 30403 var $selectedValue = $(this).val().toLowerCase(); 30404 var $cancelChild = $('.membershipCancellationRequest-children-attending__cancel-child'); 30405 30406 if ($selectedValue == 'yes') { 30407 $cancelChild.show(); 30408 $membershipCancellationRequestAll.last().show(); 30409 } else if ($selectedValue == 'no') { 30410 $cancelChild.hide(); 30411 $membershipCancellationRequestAll.last().hide(); 30412 } 30413 }); 30414} 30415 30416var $changeRequestFormCc = $('#change_request_form_new'); 30417var changeRequestFormCc = document.getElementById('change_request_form_new'); 30418 30419if ($changeRequestFormCc.length) { 30420 $changeRequestFormCc.find('.submit-button-block').hide(); 30421 var $inputDates = $changeRequestFormCc.find('.inputDatetime'); 30422 $inputDates.attr('min', new Date().toISOString().split('T')[0]); 30423 $inputDates.each(function (key, dateField) { 30424 $(dateField).on('change', function () { 30425 validateDate($(dateField)); 30426 }); 30427 }); 30428 var $program = $changeRequestFormCc.find('#change_request_form__program'); 30429 var $allSteps = $changeRequestFormCc.find('.changeRequestFormStep'); 30430 var $registration = $changeRequestFormCc.find('.change_request_form__registration_year'); 30431 var type = ''; 30432 var program = ''; 30433 var registration = ''; 30434 30435 var _$schoolYearMessage = $('#change_request_form__school_year_message'); 30436 30437 $registration.each(function () { 30438 var $reg = $(this); 30439 var $radioInput = $reg.find('input[type="radio"][value="2025/2026"]'); 30440 30441 if ($radioInput.length > 0) { 30442 var currentDate = new Date(); 30443 var targetDate = new Date('2025-05-01'); 30444 30445 if (currentDate < targetDate) { 30446 $radioInput.parent().hide(); 30447 } 30448 } 30449 }); 30450 $changeRequestFormCc.on('change', 'select[name="type"]', function () { 30451 type = $(this).val(); 30452 $program.hide(); 30453 30454 if (type === 'Registration change' || type === 'Program Withdrawal') { 30455 $program.show(); 30456 } 30457 30458 $changeRequestFormCc.find('select[name="program"]').trigger('change'); 30459 }); 30460 $changeRequestFormCc.on('change', 'select[name="program"]', function () { 30461 program = $(this).val(); 30462 $registration.hide(); 30463 30464 if (program === 'Before & After School - Kindergarten' || program === 'Before & After School - School Age') { 30465 if (type === 'Registration change') { 30466 $changeRequestFormCc.find('#change_request_form__registration_year_change').show(); 30467 } else if (type === 'Program Withdrawal') { 30468 $changeRequestFormCc.find('#change_request_form__registration_year_withdrawal').show(); 30469 } 30470 } 30471 }); 30472 $changeRequestFormCc.on('change', 'input[name="registration_year_change"]', function () { 30473 registration = $(this).val(); 30474 $changeRequestFormCc.find('#change_request_form__registration_year_2025').hide(); 30475 30476 if (registration === '2024/2025') { 30477 $changeRequestFormCc.find('#change_request_form__registration_year_2025').show(); 30478 } 30479 }); 30480 $changeRequestFormCc.on('change', 'input[name="registration_year_withdrawal"]', function () { 30481 registration = $(this).val(); 30482 }); 30483 changeRequestFormCc.querySelectorAll('input[name="schoolYearRadio"]').forEach(function (radio) { 30484 radio.addEventListener('change', function () { 30485 var todaysDate = new Date().toISOString().split('T')[0]; 30486 var withdrawalDate = changeRequestFormCc.querySelector('input[name="withdrawal_date"]'); 30487 var $withdrawalDateContainer = $('#change_request_form__withdrawal_date'); 30488 30489 if (radio.value == '2025-2026') { 30490 _$schoolYearMessage.show(); 30491 30492 withdrawalDate.value = ''; 30493 $withdrawalDateContainer.hide(); 30494 } else if (radio.value == '2024-2025' || radio.value == '2024-2025-2026') { 30495 _$schoolYearMessage.hide(); 30496 30497 withdrawalDate.value = todaysDate; 30498 $withdrawalDateContainer.show(); 30499 } 30500 }); 30501 }); 30502 $changeRequestFormCc.on('click', '#change_request_form__next', function () { 30503 if (validateForm()) { 30504 return false;
30505 } 30506 30507 hideAllSteps($allSteps); 30508 hideCalendar(); 30509 showResultMessage(); 30510 $('#change_request_form__school_year').hide(); 30511 30512 _$schoolYearMessage.hide(); 30513 30514 if (type === 'Registration change') { 30515 calendarNote(registration); 30516 $changeRequestFormCc.find('#change_request_form__registration_change').show(); 30517 } else if (type === 'Program Withdrawal') { 30518 $('#change_request_form__result_message').hide(); 30519 $('#change_request_form__result_message_withdrawal').show(); 30520 30521 if (program === 'Before & After School - Kindergarten' || program === 'Before & After School - School Age') { 30522 $('#change_request_form__school_year').show(); 30523 } 30524 30525 calendarNote(registration); 30526 $changeRequestFormCc.find('#change_request_form__withdrawal').show(); 30527 } else if (type === 'Parent/Guardian contact information update') { 30528 $changeRequestFormCc.find('#change_request_form__guardian').show(); 30529 } else if (type === 'Emergency contact information update') { 30530 $changeRequestFormCc.find('#change_request_form__emergency').show(); 30531 } else if (type === 'Medical/Allergy Update') { 30532 $changeRequestFormCc.find('#change_request_form__medical').show(); 30533 } else if (type === 'Payment Information Change') { 30534 $changeRequestFormCc.find('#change_request_form__payment_information').show(); 30535 } 30536 30537 $changeRequestFormCc.find('#change_request_form__captcha').show(); 30538 $changeRequestFormCc.find('#change_request_form__back').show(); 30539 $changeRequestFormCc.find('#change_request_form__submit').show(); 30540 $changeRequestFormCc.find('#change_request_form__next').hide(); 30541 }); 30542 $changeRequestFormCc.on('click', '#change_request_form__back', function () { 30543 hideAllSteps($allSteps); 30544 hideCalendar(); 30545 $changeRequestFormCc.find('#change_request_form__main').show(); 30546 $changeRequestFormCc.find('#change_request_form__captcha').hide(); 30547 $changeRequestFormCc.find('#change_request_form__back').hide(); 30548 $changeRequestFormCc.find('#change_request_form__submit').hide(); 30549 $changeRequestFormCc.find('#change_request_form__next').show(); 30550 }); 30551 30552 var validateForm = function validateForm() { 30553 var $firstName = $('input[name="first_name"]').val(); 30554 var $lastName = $('input[name="last_name"]').val(); 30555 var $email = $('input[name="email"]').val(); 30556 var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 30557 var $childFirstName = $('input[name="child_first_name"]').val(); 30558 var $childLastName = $('input[name="child_last_name"]').val(); 30559 var $phone = $('input[name="phone"]').val(); 30560 var $location = $('select[name="location"]').val(); 30561 var $type = $('select[name="type"]').val(); 30562 var $program = $('select[name="program"]').val(); 30563 var $inputDates = $('.inputDatetime:visible'); 30564 30565 if ($firstName.length < 1) { 30566 return true; 30567 } 30568 30569 if ($lastName.length < 1) { 30570 return true; 30571 } 30572 30573 if (!regex.test($email)) { 30574 return true; 30575 } 30576 30577 if ($childFirstName.length < 1) { 30578 return true; 30579 } 30580 30581 if ($childLastName.length < 1) { 30582 return true; 30583 } 30584 30585 if ($phone.length < 1) { 30586 return true; 30587 } 30588 30589 if ($location.length < 1) { 30590 return true; 30591 } 30592 30593 if ($type.length < 1) { 30594 return true; 30595 } 30596 30597 if (($type === 'Registration change' || $type === 'Program Withdrawal') && $program < 1) { 30598 return true; 30599 } 30600 30601 $inputDates.each(function (key, dateField) { 30602 validateDate($(dateField)); 30603 }); 30604 }; 30605 30606 var hideAllSteps = function hideAllSteps($allSteps) { 30607 $allSteps.each(function (key, step) { 30608 $(step).hide(); 30609 }); 30610 }; 30611 30612 var hideCalendar = function hideCalendar() { 30613 $changeRequestFormCc.find('.change_request_form__calendar').hide(); 30614 }; 30615 30616 var showResultMessage = function showResultMessage() { 30617 $('.change_request_form__result_message').hide(); 30618 $('#change_request_form__result_message').show(); 30619 }; 30620 30621 var calendarNote = function calendarNote(registration) { 30622 $changeRequestFormCc.find('#change_request_form__withdrawal_date').show(); 30623 $changeRequestFormCc.find('#change_request_form__registration_date').show(); 30624 30625 if ((program === 'Before & After School - Kindergarten' || program === 'Before & After School - School Age') && registration === '2024/2025') { 30626 $changeRequestFormCc.find('#change_request_form__withdrawal_date').hide(); 30627 $changeRequestFormCc.find('#change_request_form__registration_date').hide(); 30628 } 30629 }; 30630} 30631 30632var $changeRequestFormLhcc = $('#change_request_form_lhcc'); 30633 30634if ($changeRequestFormLhcc.length) { 30635 $changeRequestFormLhcc.find('.submit-button-block').hide(); 30636 30637 var _$inputDates = $changeRequestFormLhcc.find('.inputDatetime'); 30638 30639 _$inputDates.attr('min', new Date().toISOString().split('T')[0]); 30640 30641 _$inputDates.each(function (key, dateField) { 30642 $(dateField).on('change', function () { 30643 validateDate($(dateField)); 30644 }); 30645 }); 30646 30647 var _$program = $changeRequestFormLhcc.find('#change_request_form__program'); 30648 30649 var _$allSteps = $changeRequestFormLhcc.find('.changeRequestFormStep'); 30650 30651 var _type = ''; 30652 $changeRequestFormLhcc.on('change', 'select[name="type"]', function () { 30653 _type = $(this).val(); 30654 30655 _$program.hide(); 30656 30657 if (_type === 'Registration change' || _type === 'Program Withdrawal') { 30658 _$program.show(); 30659 } 30660 }); 30661 $changeRequestFormLhcc.on('click', '#change_request_form__next', function () { 30662 if (_validateForm()) { 30663 return false;
30664 } 30665 30666 _hideAllSteps(_$allSteps); 30667 30668 if (_type === 'Registration change') { 30669 $changeRequestFormLhcc.find('#change_request_form__registration_change').show(); 30670 } else if (_type === 'Program Withdrawal') { 30671 $changeRequestFormLhcc.find('#change_request_form__withdrawal').show(); 30672 } else if (_type === 'Parent/Guardian contact information update') { 30673 $changeRequestFormLhcc.find('#change_request_form__guardian').show(); 30674 } else if (_type === 'Emergency contact information update') { 30675 $changeRequestFormLhcc.find('#change_request_form__emergency').show(); 30676 } else if (_type === 'Medical/Allergy Update') { 30677 $changeRequestFormLhcc.find('#change_request_form__medical').show(); 30678 } else if (_type === 'Payment Information Change') { 30679 $changeRequestFormLhcc.find('#change_request_form__payment_information').show(); 30680 } 30681 30682 $changeRequestFormLhcc.find('#change_request_form__captcha').show(); 30683 $changeRequestFormLhcc.find('#change_request_form__back').show(); 30684 $changeRequestFormLhcc.find('#change_request_form__submit').show(); 30685 $changeRequestFormLhcc.find('#change_request_form__next').hide(); 30686 }); 30687 $changeRequestFormLhcc.on('click', '#change_request_form__back', function () { 30688 _hideAllSteps(_$allSteps); 30689 30690 $changeRequestFormLhcc.find('#change_request_form__main').show(); 30691 $changeRequestFormLhcc.find('#change_request_form__captcha').hide(); 30692 $changeRequestFormLhcc.find('#change_request_form__back').hide(); 30693 $changeRequestFormLhcc.find('#change_request_form__submit').hide(); 30694 $changeRequestFormLhcc.find('#change_request_form__next').show(); 30695 }); 30696 30697 var _validateForm = function _validateForm() { 30698 var $firstName = $('input[name="first_name"]').val(); 30699 var $lastName = $('input[name="last_name"]').val(); 30700 var $email = $('input[name="email"]').val(); 30701 var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 30702 var $childFirstName = $('input[name="child_first_name"]').val(); 30703 var $childLastName = $('input[name="child_last_name"]').val(); 30704 var $phone = $('input[name="phone"]').val(); 30705 var $location = $('select[name="location"]').val(); 30706 var $type = $('select[name="type"]').val(); 30707 var $program = $('select[name="program"]').val(); 30708 var $inputDates = $('.inputDatetime:visible'); 30709 30710 if ($firstName.length < 1) { 30711 return true; 30712 } 30713 30714 if ($lastName.length < 1) { 30715 return true; 30716 } 30717 30718 if (!regex.test($email)) { 30719 return true; 30720 } 30721 30722 if ($childFirstName.length < 1) { 30723 return true; 30724 } 30725 30726 if ($childLastName.length < 1) { 30727 return true; 30728 } 30729 30730 if ($phone.length < 1) { 30731 return true; 30732 } 30733 30734 if ($location.length < 1) { 30735 return true; 30736 } 30737 30738 if ($type.length < 1) { 30739 return true; 30740 } 30741 30742 if (($type === 'Registration change' || $type === 'Program Withdrawal') && $program < 1) { 30743 return true; 30744 } 30745 30746 $inputDates.each(function (key, dateField) { 30747 validateDate($(dateField)); 30748 }); 30749 }; 30750 30751 var _hideAllSteps = function _hideAllSteps($allSteps) { 30752 $allSteps.each(function (key, step) { 30753 $(step).hide(); 30754 }); 30755 }; 30756} 30757 30758var $changeRequestFormCcCopy = $('#change_request_form'); 30759 30760if ($changeRequestFormCcCopy.length) { 30761 $changeRequestFormCcCopy.find('.submit-button-block').hide(); 30762 30763 var _$inputDates2 = $changeRequestFormCcCopy.find('.inputDatetime'); 30764 30765 _$inputDates2.attr('min', new Date().toISOString().split('T')[0]); 30766 30767 _$inputDates2.each(function (key, dateField) { 30768 $(dateField).on('change', function () { 30769 validateDate($(dateField)); 30770 }); 30771 }); 30772 30773 var _$program2 = $changeRequestFormCcCopy.find('#change_request_form__program'); 30774 30775 var _$allSteps2 = $changeRequestFormCcCopy.find('.changeRequestFormStep'); 30776 30777 var _type2 = ''; 30778 $changeRequestFormCcCopy.on('change', 'select[name="type"]', function () { 30779 _type2 = $(this).val(); 30780 30781 _$program2.hide(); 30782 30783 if (_type2 === 'Registration change' || _type2 === 'Program Withdrawal') { 30784 _$program2.show(); 30785 } 30786 }); 30787 $changeRequestFormCcCopy.on('click', '#change_request_form__next', function () { 30788 if (_validateForm2()) { 30789 return false;
30790 } 30791 30792 _hideAllSteps2(_$allSteps2); 30793 30794 if (_type2 === 'Registration change') { 30795 $changeRequestFormCcCopy.find('#change_request_form__registration_change').show(); 30796 } else if (_type2 === 'Program Withdrawal') { 30797 $changeRequestFormCcCopy.find('#change_request_form__withdrawal').show(); 30798 } else if (_type2 === 'Parent/Guardian contact information update') { 30799 $changeRequestFormCcCopy.find('#change_request_form__guardian').show(); 30800 } else if (_type2 === 'Emergency contact information update') { 30801 $changeRequestFormCcCopy.find('#change_request_form__emergency').show(); 30802 } else if (_type2 === 'Medical/Allergy Update') { 30803 $changeRequestFormCcCopy.find('#change_request_form__medical').show(); 30804 } else if (_type2 === 'Payment Information Change') { 30805 $changeRequestFormCcCopy.find('#change_request_form__payment_information').show(); 30806 } 30807 30808 $changeRequestFormCcCopy.find('#change_request_form__captcha').show(); 30809 $changeRequestFormCcCopy.find('#change_request_form__back').show(); 30810 $changeRequestFormCcCopy.find('#change_request_form__submit').show(); 30811 $changeRequestFormCcCopy.find('#change_request_form__next').hide(); 30812 }); 30813 $changeRequestFormCcCopy.on('click', '#change_request_form__back', function () { 30814 _hideAllSteps2(_$allSteps2); 30815 30816 $changeRequestFormCcCopy.find('#change_request_form__main').show(); 30817 $changeRequestFormCcCopy.find('#change_request_form__captcha').hide(); 30818 $changeRequestFormCcCopy.find('#change_request_form__back').hide(); 30819 $changeRequestFormCcCopy.find('#change_request_form__submit').hide(); 30820 $changeRequestFormCcCopy.find('#change_request_form__next').show(); 30821 }); 30822 30823 var _validateForm2 = function _validateForm2() { 30824 var $firstName = $('input[name="first_name"]').val(); 30825 var $lastName = $('input[name="last_name"]').val(); 30826 var $email = $('input[name="email"]').val(); 30827 var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 30828 var $childFirstName = $('input[name="child_first_name"]').val(); 30829 var $childLastName = $('input[name="child_last_name"]').val(); 30830 var $phone = $('input[name="phone"]').val(); 30831 var $location = $('select[name="location"]').val(); 30832 var $type = $('select[name="type"]').val(); 30833 var $program = $('select[name="program"]').val(); 30834 var $inputDates = $('.inputDatetime:visible'); 30835 30836 if ($firstName.length < 1) { 30837 return true; 30838 } 30839 30840 if ($lastName.length < 1) { 30841 return true; 30842 } 30843 30844 if (!regex.test($email)) { 30845 return true; 30846 } 30847 30848 if ($childFirstName.length < 1) { 30849 return true; 30850 } 30851 30852 if ($childLastName.length < 1) { 30853 return true; 30854 } 30855 30856 if ($phone.length < 1) { 30857 return true; 30858 } 30859 30860 if ($location.length < 1) { 30861 return true; 30862 } 30863 30864 if ($type.length < 1) { 30865 return true; 30866 } 30867 30868 if (($type === 'Registration change' || $type === 'Program Withdrawal') && $program < 1) { 30869 return true; 30870 } 30871 30872 $inputDates.each(function (key, dateField) { 30873 validateDate($(dateField)); 30874 }); 30875 }; 30876 30877 var _hideAllSteps2 = function _hideAllSteps2($allSteps) { 30878 $allSteps.each(function (key, step) { 30879 $(step).hide(); 30880 }); 30881 }; 30882} 30883 30884var $volunteerForm = $('#volunteer_form'); 30885 30886if ($volunteerForm.length) { 30887 $('input[name="question_1"]').on('change', function () { 30888 var $condition = $('#question_1_condition'); 30889 var answer = $(this).val(); 30890 $condition.hide(); 30891 30892 if (answer === 'Yes') { 30893 $condition.show(); 30894 } 30895 }); 30896} 30897 30898var $sprottHouseApplicationForm = $('#sprott_house_application_form'); 30899 30900if ($sprottHouseApplicationForm.length) { 30901 $('select[name="permission"]').on('change', function () { 30902 var $condition = $('#permission_contact_info'); 30903 var answer = $(this).val(); 30904 $condition.hide(); 30905 30906 if (answer === 'Yes') { 30907 $condition.show(); 30908 } 30909 }); 30910 $('input[name="question_4"]').on('change', function () { 30911 var $conditions = $('.question_4_yes_no'); 30912 var $condition1 = $('#question_4_yes'); 30913 var $condition2 = $('#question_4_no'); 30914 var answer = $(this).val(); 30915 $conditions.hide(); 30916 30917 if (answer === 'Yes') { 30918 $condition1.show(); 30919 } else { 30920 $condition2.show(); 30921 } 30922 }); 30923 $('input[name="question_5"]').on('change', function () { 30924 var $condition = $('#question_5_no'); 30925 var answer = $(this).val(); 30926 $condition.hide(); 30927 30928 if (answer === 'No') { 30929 $condition.show(); 30930 } 30931 }); 30932 $('input[name="question_6"]').on('change', function () { 30933 var $condition = $('#question_6_yes'); 30934 var answer = $(this).val(); 30935 $condition.hide(); 30936 30937 if (answer === 'Yes') { 30938 $condition.show(); 30939 } 30940 }); 30941 $('input[name="question_7"]').on('change', function () { 30942 var $condition = $('#question_7_yes'); 30943 var answer = $(this).val(); 30944 $condition.hide(); 30945 30946 if (answer === 'Yes') { 30947 $condition.show(); 30948 } 30949 }); 30950 $('input[name="income[]"]').on('change', function () { 30951 var allCheckboxes = $('input[name="income[]"]'); 30952 var $condition = $('#income_employer'); 30953 $condition.hide(); 30954 allCheckboxes.each(function (key, checkbox) { 30955 var $checkbox = $(checkbox); 30956 30957 if ($checkbox.is(':checked')) { 30958 if ($checkbox.val() === 'Full Time Employment' || $checkbox.val() === 'Part Time Employment') { 30959 $condition.show(); 30960 } 30961 } 30962 }); 30963 }); 30964 $('input[name="question_8"]').on('change', function () { 30965 var $condition = $('#question_8_yes'); 30966 var answer = $(this).val(); 30967 $condition.hide(); 30968 30969 if (answer === 'Yes') { 30970 $condition.show(); 30971 } 30972 }); 30973 $('input[name="question_12"]').on('change', function () { 30974 var $condition = $('#question_12_yes'); 30975 var answer = $(this).val(); 30976 $condition.hide(); 30977 30978 if (answer === 'Yes') { 30979 $condition.show(); 30980 } 30981 }); 30982} 30983 30984var $sweatForGoodForm = $('#sweat_for_good_form'); 30985 30986if ($sweatForGoodForm.length) { 30987 var $email = $sweatForGoodForm.find('input[name="email"]'); 30988 var $confirmEmail = $sweatForGoodForm.find('input[name="confirmEmail"]'); 30989 $sweatForGoodForm.on('submit', function (e) { 30990 if ($email.val() !== $confirmEmail.val()) { 30991 e.preventDefault(); 30992 $confirmEmail.parent().append('<div class="input-element-validation-errors">Please enter the matching email address</div>'); 30993 } 30994 }); 30995} 30996 30997var $youthExchangesInquiryForm = $('#youth_exchanges_inquiry_form'); 30998 30999if ($youthExchangesInquiryForm.length) { 31000 $('input[name="question_1"]').on('change', function () { 31001 var $this = $(this); 31002 var $info = $('#are-you-a-info'); 31003 $info.hide(); 31004 31005 if ($this.val() === 'Student' || $this.val() === 'Parent/Guardian') { 31006 $info.show(); 31007 } 31008 }); 31009} 31010 31011var $youthExchangesInquiryFormFr = $('#youth_exchanges_inquiry_form_fr'); 31012 31013if ($youthExchangesInquiryFormFr.length) { 31014 $('input[name="question_1"]').on('change', function () { 31015 var $this = $(this); 31016 var $info = $('#are-you-a-info'); 31017 $info.hide(); 31018 31019 if ($this.val() === 'Étudiant.e' || $this.val() === 'Parent/tuteur.trice') { 31020 $info.show(); 31021 } 31022 }); 31023} 31024 31025var $tryTheYForm = $('.form-try-the-y'); 31026 31027if ($tryTheYForm.length) { 31028 window.addEventListener('message', function (e) { 31029 var _e$data; 31030 31031 var container = document.querySelector('.calendly-inline-widget'); 31032 if (!container || !((_e$data = e.data) !== null && _e$data !== void 0 && _e$data.event) || e.data.event !== 'calendly.page_height') return; 31033 container.style.height = e.data.payload.height; 31034 }); 31035} 31036 31037var $reviewForm = $('#reviewForm'); 31038 31039if ($reviewForm.length) { 31040 var $fileInput = $reviewForm.find('input[type="file"]'); 31041 31042 if ($fileInput.length) { 31043 var allowVideo = $reviewForm.find('input[name="_allowVideo"]').val() === '1'; 31044 var acceptValue = 'image/*'; 31045 if (allowVideo) acceptValue += ',video/*'; 31046 var $fileInputs = $reviewForm.find('input[type="file"]'); 31047 31048 if ($fileInputs.length) { 31049 $fileInputs.attr('accept', acceptValue); 31050 $fileInputs.each(function () { 31051 var $input = $(this); 31052 var id = $input.attr('id') || 'file_' + Math.random().toString(36).slice(2); 31053 $input.attr('id', id); 31054 $input.wrap('<span class="file-picker"></span>'); 31055 var $trigger = $("\n\t\t\t\t\t<label class=\"file-picker__trigger\" for=\"".concat(id, "\">\n\t\t\t\t\t <span aria-hidden=\"true\">\n\t\t\t\t\t\t<!-- Paperclip icon -->\n\t\t\t\t\t\t<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" role=\"img\" focusable=\"false\">\n\t\t\t\t\t\t <path d=\"M16.5 6.5l-7.78 7.78a3 3 0 104.24 4.24l7.78-7.78a5 5 0 10-7.07-7.07L5.9 11.44\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t </span>\n\t\t\t\t\t <span>Attach files</span>\n\t\t\t\t\t</label>\n\t\t\t\t")); 31056 var $msg = $('<span class="file-picker__msg" aria-live="polite">No file selected</span>'); 31057 $input.after($trigger); 31058 $trigger.after($msg); 31059 }); 31060 $fileInputs.on('change', function () { 31061 var files = this.files ? Array.from(this.files) : []; 31062 var $msg = $(this).siblings('.file-picker__msg'); 31063 31064 if (!files.length) { 31065 $msg.text('No file selected'); 31066 return; 31067 } 31068 31069 if (files.length === 1) { 31070 $msg.text("1 file selected: ".concat(files[0].name)); 31071 } else { 31072 $msg.text("".concat(files.length, " files selected")); 31073 } 31074 }); 31075 var MAX_FILE_BYTES = 30 * 1024 * 1024; 31076 31077 var setFilePickerError = function setFilePickerError($input, message) { 31078 $input.closest('.file-picker').find('.file-picker__error').remove(); 31079 31080 if (message) { 31081 $input.closest('.file-picker').append("<div class=\"input-element-validation-errors file-picker__error\">".concat(message, "</div>")); 31082 } 31083 }; 31084
31085 var validateReviewFile = function validateReviewFile(file) { 31086 var mimeOK = file.type.startsWith('image/') || allowVideo && file.type.startsWith('video/'); 31087 var ext = (file.name.split('.').pop() || '').toLowerCase(); 31088 var extOKList = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp', 'svg']; 31089 if (allowVideo) extOKList.push('mp4', 'mov', 'avi', 'mkv', 'webm', 'm4v', 'hevc', 'heif', 'heic'); 31090 31091 if (!mimeOK && !extOKList.includes(ext)) { 31092 return allowVideo ? 'Only image or video files are allowed.' : 'Only image files are allowed.'; 31093 } 31094 31095 if (file.size > MAX_FILE_BYTES) { 31096 return 'This file is too large. The maximum size is 30 MB.'; 31097 } 31098 31099 return ''; 31100 }; 31101 31102 $fileInputs.on('change', function () { 31103 var $input = $(this); 31104 setFilePickerError($input, ''); 31105 var error = ''; 31106 Array.from(this.files || []).some(function (file) { 31107 error = validateReviewFile(file); 31108 return !!error; 31109 }); 31110 31111 if (error) { 31112 setFilePickerError($input, error); 31113 this.value = ''; 31114 $input.siblings('.file-picker__msg').text('No file selected'); 31115 } 31116 }); 31117 $reviewForm.on('submit', function (e) { 31118 var invalid = false; 31119 $fileInputs.each(function () { 31120 var $input = $(this); 31121 setFilePickerError($input, ''); 31122 Array.from(this.files || []).some(function (file) { 31123 var error = validateReviewFile(file); 31124 31125 if (error) { 31126 setFilePickerError($input, error); 31127 invalid = true; 31128 } 31129 31130 return !!error; 31131 }); 31132 }); 31133 31134 if (invalid) { 31135 e.preventDefault(); 31136 return false; 31137 } 31138 }); 31139 } 31140 } 31141 31142 var escapePreviewHtml = function escapePreviewHtml(str) { 31143 return $('<div>').text(str).html(); 31144 }; 31145 31146 var normaliseReviewText = function normaliseReviewText(text) { 31147 var html = escapePreviewHtml(text).replace(/\r\n|\r|\n/g, '<br>'); 31148 html = html.replace(/(?:<br>\s*){2,}/gi, '<br>'); 31149 return html.replace(/^(?:<br>\s*)+|(?:\s*<br>)+$/gi, '').trim(); 31150 }; 31151 31152 var getPreviewDisplayName = function getPreviewDisplayName() { 31153 var name = ''; 31154 $reviewForm.find('input[name="nickname"], input[name="displayName"], input[name="display_name"], input[name="firstName"]').each(function () { 31155 if (!name && $(this).val()) { 31156 name = $(this).val().trim(); 31157 } 31158 }); 31159 return name; 31160 }; 31161 31162 var previewObjectUrls = []; 31163 31164 var revokePreviewUrls = function revokePreviewUrls() { 31165 previewObjectUrls.forEach(function (url) { 31166 return URL.revokeObjectURL(url); 31167 }); 31168 previewObjectUrls = []; 31169 }; 31170 31171 var removeReviewPreview = function removeReviewPreview() { 31172 revokePreviewUrls(); 31173 $('.review-preview').remove(); 31174 }; 31175 31176 var buildReviewPreview = function buildReviewPreview() { 31177 removeReviewPreview(); 31178 var files = []; 31179 $reviewForm.find('input[type="file"]').each(function () { 31180 Array.from(this.files || []).forEach(function (file) { 31181 if (file.type.startsWith('image/') || file.type.startsWith('video/')) { 31182 files.push(file); 31183 } 31184 }); 31185 }); 31186 var mediaHtml = ''; 31187 files.forEach(function (file) { 31188 var url = URL.createObjectURL(file); 31189 previewObjectUrls.push(url); 31190 mediaHtml += file.type.startsWith('video/') ? "<video src=\"".concat(url, "\" controls muted playsinline></video>") : "<img src=\"".concat(url, "\" alt=\"\">"); 31191 }); 31192 var content = normaliseReviewText($reviewForm.find('textarea[name="review"]').val() || ''); 31193 var displayName = getPreviewDisplayName(); 31194 var $preview = $("\n\t\t\t<div class=\"reviews-grid-container review-preview\">\n\t\t\t\t<p class=\"review-preview__note\">Preview</p>\n\t\t\t\t<article class=\"review-card".concat(files.length ? '' : ' review-card--no-media', "\">\n\t\t\t\t\t").concat(files.length ? "<div class=\"review-card__media\">".concat(mediaHtml, "</div>") : '', "\n\t\t\t\t\t<div class=\"review-card__body component--theme-white\">\n\t\t\t\t\t\t").concat(content ? "<div class=\"review-card__text\">".concat(content, "</div>") : '', "\n\t\t\t\t\t\t").concat(displayName ? "<div class=\"review-card__text review-card__from\">From ".concat(escapePreviewHtml(displayName), "</div>") : '', "\n\t\t\t\t\t</div>\n\t\t\t\t</article>\n\t\t\t\t<div class=\"review-preview__actions\">
31194\n\t\t\t\t\t<button type=\"button\" class=\"button button--white button--large review-preview__back\">Edit</button>\n\t\t\t\t\t<button type=\"button\" class=\"button button--red button--large review-preview__confirm\">Submit</button>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t")); 31195 $reviewForm.hide().after($preview); 31196 $preview.get(0).scrollIntoView({ 31197 behavior: 'smooth', 31198 block: 'start' 31199 }); 31200 }; 31201 31202 var initReviewPreview = function initReviewPreview() { 31203 $reviewForm.find('.submitButton').on('click', function (e) { 31204 e.preventDefault(); 31205 buildReviewPreview(); 31206 }); 31207 }; 31208 31209 if (document.readyState !== 'loading') { 31210 initReviewPreview(); 31211 } else { 31212 document.addEventListener('DOMContentLoaded', initReviewPreview); 31213 } 31214 31215 $(document).on('click', '.review-preview__back', function () { 31216 removeReviewPreview(); 31217 $reviewForm.show(); 31218 $reviewForm.get(0).scrollIntoView({ 31219 behavior: 'smooth', 31220 block: 'start' 31221 }); 31222 }); 31223 $(document).on('click', '.review-preview__confirm', function () { 31224 var $confirm = $(this); 31225 31226 if ($confirm.hasClass('is-loading')) { 31227 return; 31228 } 31229 31230 $confirm.addClass('is-loading').attr('disabled', 'disabled').text('Submitting…'); 31231 $('.review-preview__back').attr('disabled', 'disabled'); 31232 var formEl = $reviewForm.get(0); 31233 31234 if (typeof formEl.requestSubmit === 'function') { 31235 formEl.requestSubmit($reviewForm.find('.submitButton').get(0)); 31236 } else { 31237 $reviewForm.trigger('submit'); 31238 } 31239 }); 31240} 31241 31242var $swseInquiryForms = $('#wip-swse-inquiry-form-en-delivra, #wip-swse-inquiry-form-fr-delivra'); 31243 31244if ($swseInquiryForms.length) { 31245 $swseInquiryForms.each(function () { 31246 var $form = $(this); 31247 $form.find('select[name^="city_"], input[name="city_other"]').each(function () { 31248 var name = $(this).attr('name').replace('[]', ''); 31249 var $block = $(this).closest('.base-element-block.input-element-block'); 31250 31251 if ($block.length && !$block.prev('#' + name).length) { 31252 $block.before('<div class="form-field-hidden" id="' + name + '"></div>'); 31253 } 31254 }); 31255 $form.on('change', 'select[name="province"]', function () { 31256 var selectedProvince = $(this).val(); 31257 31258 if (selectedProvince) { 31259 $form.find('select[name^="city_"]').prop('selectedIndex', 0); 31260 var formattedProvince = selectedProvince.replace(/[^a-zA-Z]/g, ''); 31261 var targetDivId = '#city_' + formattedProvince.toLowerCase(); 31262 $form.find('div[id^="city_"]').removeClass('form-field-required').addClass('form-field-hidden'); 31263 $form.find(targetDivId).removeClass('form-field-hidden').addClass('form-field-required'); 31264 $form.find('input[name="city_other"]').val(''); 31265 } 31266 }); 31267 $form.on('change', 'select[name^="city_"]', function () { 31268 var selectedValue = $(this).val(); 31269 var $cityOther = $form.find('#city_other'); 31270 31271 if (selectedValue === 'Other' || selectedValue === 'Autre') { 31272 $cityOther.removeClass('form-field-hidden').addClass('form-field-required'); 31273 } else { 31274 $cityOther.removeClass('form-field-required').addClass('form-field-hidden'); 31275 $form.find('input[name="city_other"]').val(''); 31276 } 31277 }); 31278 }); 31279} 31280 31281var $campsEarlyBirdForm = $('#camps-early-bird-v2'); 31282 31283if ($campsEarlyBirdForm.length) { 31284 var $emailField = $campsEarlyBirdForm.find('[name="EmailAddress"]'); 31285 var $fieldToCopy = $campsEarlyBirdForm.find('[name="eml"]'); 31286 31287 if ($emailField.length && $fieldToCopy.length) { 31288 $emailField.on('input', function () { 31289 $fieldToCopy.val(this.value); 31290 }); 31291 } 31292} 31293/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 31294 31295/***/ }), 31296
31297/***/ "../src/static/js/utils/custom.js": 31298/*!****************************************!*\ 31299 !*** ../src/static/js/utils/custom.js ***! 31300 \****************************************/ 31301/*! no static exports found */ 31302/***/ (function(module, exports, __webpack_require__) { 31303 31304/* WEBPACK VAR INJECTION */(function($) {setTimeout(function () { 31305 $(document).ready(function () { 31306 function isImageBroken(img) { 31307 return img.naturalWidth === 0 || img.complete === false; 31308 } 31309 31310 $('.blog-item__body img').each(function () { 31311 if (isImageBroken(this)) { 31312 $(this).attr('src', 'https://www.ymcagta.org/files/images/layouts/place.png?w=435&h=228&s=fit'); 31313 console.warn('Broken image replaced with placeholder:', this.alt); 31314 } 31315 }); 31316 }); 31317}, 1500); 31318$(document).ready(function () { 31319 var originalTextElements = $(".blog-item__body"); 31320 originalTextElements.each(function () { 31321 var htmlContent = $(this).html(); 31322 var modifiedHTML = htmlContent.replace(/\[[^\]]*\]/g, ''); 31323 $(this).html(modifiedHTML); 31324 }); 31325}); 31326/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 31327 31328/***/ }), 31329
vendor: 9,729 bytes, lines 31330-31344
31330/***/ "../src/static/js/utils/find-y-map.js": 31331/*!********************************************!*\ 31332 !*** ../src/static/js/utils/find-y-map.js ***! 31333 \********************************************/ 31334/*! exports provided: FindYMap */ 31335/***/ (function(module, __webpack_exports__, __webpack_require__) { 31336 31337"use strict"; 31338__webpack_require__.r(__webpack_exports__); 31339/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FindYMap", function() { return FindYMap; }); 31340/* harmony import */ var core_js_internals_array_iteration_from_last__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/internals/array-iteration-from-last */ "../node_modules/core-js/internals/array-iteration-from-last.js"); 31341/* harmony import */ var core_js_internals_array_iteration_from_last__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_internals_array_iteration_from_last__WEBPACK_IMPORTED_MODULE_0__); 31342function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 31343 31344function _regeneratorRuntime() { "use strict"; _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEac
vendor: 7,304 bytes, lines 31344-31384
31344h(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 31345 31346function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } 31347 31348function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } 31349 31350function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } 31351 31352function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 31353 31354function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 31355 31356function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 31357 31358function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 31359 31360function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 31361 31362function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 31363 31364 31365var FindYMap = function () { 31366 function FindYMap(container) { 31367 var _this = this; 31368 31369 _classCallCheck(this, FindYMap); 31370 31371 _defineProperty(this, "_listDistance", function (marker) { 31372 if (!marker.distance || !_this.filters.location) { 31373 return ''; 31374 } 31375 31376 return "<div class=\"card__sub-heading\">".concat(Math.round(marker.distance / 10) / 100, " km away from ").concat(_this.filters.location.name, "</div>"); 31377 }); 31378 31379 _defineProperty(this, "_listHours", function (centre) { 31380 if (!centre.hours) { 31381 return ''; 31382 } 31383 31384 return "\n\t\t\t<div class=\"card__section\">\n\t\t\t <div class=\"card__section-icon\">\n <svg class=\"ico-clock\">\n <use xlink:href=\"/static/images/sprite.svg#ico-clock\"></use>\n </svg>\n </div>\n\t\t\t\t<div class=\"card__section-text\">
31384\n\t\t\t\t\tToday's hours: ".concat(centre.hours, "\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t"); 31385 }); 31386 31387 _defineProperty(this, "_listButtons", function (centre) { 31388 var links = []; 31389 centre.links.forEach(function (link) { 31390 if (link.title === null) { 31391 return; 31392 } 31393 31394 if (_this.tryTheYDropdown && link.url.toLowerCase().includes('google')) { 31395 return; 31396 } 31397 31398 links.push("<a class=\"button ".concat(link.class, " mapViewCTA\" href=\"").concat(link.url, "\" target=\"").concat(link.target, "\" data-location-id=\"").concat(centre.id, "\">").concat(link.title, "</a>")); 31399 }); 31400 return "<div class=\"card__actions\">".concat(links.join('<br>'), "</div>"); 31401 }); 31402 31403 _defineProperty(this, "_listAddress", function (address) { 31404 if (address.street.length < 1) { 31405 return ''; 31406 } 31407 31408 var addressArray = [address.street, address.city, [address.state, address.postcode].join(' ')]; 31409 var addressLines = addressArray.join(', '); 31410 return "\n\t\t\t<div class=\"card__section\">\n\t\t\t <div class=\"card__section-icon\">\n <svg class=\"ico-location\">\n <use xlink:href=\"/static/images/sprite.svg#ico-location\"></use>\n </svg>\n </div>\n\t\t\t\t<div class=\"card__section-text\">\n\t\t\t\t\t<address>".concat(addressLines, "</address>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t"); 31411 }); 31412 31413 _defineProperty(this, "_listPrograms", function (programs) { 31414 if (programs.length < 1) { 31415 return ''; 31416 } 31417 31418 var programLines = []; 31419 31420 var _iterator = _createForOfIteratorHelper(programs), 31421 _step; 31422 31423 try { 31424 for (_iterator.s(); !(_step = _iterator.n()).done;) { 31425 var programId = _step.value; 31426 var program = _this.programs[programId]; 31427 programLines.push("\n <div class=\"card__section\">\n <div class=\"card__section-icon\">\n <img class=\"ico-map-program\" src=\"".concat(program.icon, "\" alt=\"").concat(program.name, "\">\n </div>\n <div class=\"card__section-text\">\n ").concat(program.name, "\n </div>\n </div>\n\t\t ")); 31428 } 31429 } catch (err) { 31430 _iterator.e(err); 31431 } finally { 31432 _iterator.f(); 31433 } 31434 31435 return programLines.join(''); 31436 }); 31437 31438 _defineProperty(this, "_listInfoSections", function (infoSections) { 31439 if (infoSections.length < 1) { 31440 return ''; 31441 } 31442 31443 var sectionLines = []; 31444 31445 var _iterator2 = _createForOfIteratorHelper(infoSections), 31446 _step2; 31447 31448 try { 31449 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { 31450 var section = _step2.value; 31451 var icon = section.icon ? "<img class=\"ico-map-program\" src=\"".concat(section.icon, "\" alt=\"").concat(section.name, "\">") : ''; 31452 var iconHtml = icon.length > 0 ? "<div class=\"card__section-icon\">".concat(icon, "</div>") : ''; 31453 sectionLines.push("\n <div class=\"card__section\">\n ".concat(iconHtml, "\n <div class=\"card__section-text\">\n ").concat(section.text, "\n </div>\n </div>\n\t\t ")); 31454 } 31455 } catch (err) { 31456 _iterator2.e(err); 31457 } finally { 31458 _iterator2.f(); 31459 } 31460 31461 return sectionLines.join(''); 31462 }); 31463 31464 this.container = document.getElementById(container); 31465 this.tryTheYDropdown = document.querySelector('.form-try-the-y .select select'); 31466 this.init().then(function () { 31467 console.debug('map initialised'); 31468 }); 31469 } 31470 31471 _createClass(FindYMap, [{ 31472 key: "init", 31473 value: function () { 31474 var _init = _asyncToGenerator(_regeneratorRuntime().mark(function _callee() { 31475 return _regeneratorRuntime().wrap(function _callee$(_context) { 31476 while (1) { 31477 switch (_context.prev = _context.next) { 31478 case 0: 31479 _context.next = 2; 31480 return this.initData(); 31481 31482 case 2: 31483 _context.next = 4; 31484 return this.initMap(); 31485 31486 case 4: 31487 _context.next = 6; 31488 return this.initInfoWindow(); 31489 31490 case 6: 31491 this.initSearchByCategoryForm(); 31492 this.initSearchByLocationForm(); 31493 this.initMyLocation(); 31494 this.initUrlParams(); 31495 this.initListView(); 31496 this.initDropdownSelection(); 31497 this.applyFilters(); 31498 this.handleCategoryFilterUpdate(); 31499 this.redrawMap(); 31500 this.initLocationSelectionHandler(); 31501 31502 case 16: 31503 case "end": 31504 return _context.stop(); 31505 } 31506 } 31507 }, _callee, this); 31508 })); 31509
31510 function init() { 31511 return _init.apply(this, arguments); 31512 } 31513 31514 return init; 31515 }() 31516 }, { 31517 key: "initData", 31518 value: function () { 31519 var _initData = _asyncToGenerator(_regeneratorRuntime().mark(function _callee2() { 31520 var response; 31521 return _regeneratorRuntime().wrap(function _callee2$(_context2) { 31522 while (1) { 31523 switch (_context2.prev = _context2.next) { 31524 case 0: 31525 _context2.next = 2; 31526 return fetch(this.container.dataset.centres, { 31527 headers: { 31528 "Accept": "application/json" 31529 } 31530 }); 31531 31532 case 2: 31533 response = _context2.sent; 31534 _context2.next = 5; 31535 return response.json(); 31536 31537 case 5: 31538 this.centres = _context2.sent; 31539 this.programs = JSON.parse(atob(this.container.dataset.programs)); 31540 this.markers = []; 31541 this.results = []; 31542 this.filters = { 31543 category: [], 31544 location: null 31545 }; 31546 this.origin = { 31547 position: { 31548 lat: +this.container.dataset.lat, 31549 lng: +this.container.dataset.lng 31550 }, 31551 name: 'Toronto, ON', 31552 address: 'Toronto, ON' 31553 }; 31554 this.mapSettings = { 31555 center: this.origin.position, 31556 zoom: +this.container.dataset.zoom || 9, 31557 minZoom: 8, 31558 maxZoom: 17, 31559 disableDefaultUI: true, 31560 styles: this.getDefaultMapStyle() 31561 }; 31562 this.locationPinIcon = this.container.dataset.icon; 31563 this.locationSelectedIcon = this.container.dataset.selectedicon; 31564 this.minPlacesToShow = +this.container.dataset.minPlaces || 5; 31565 console.log('data loaded'); 31566 31567 case 16: 31568 case "end": 31569 return _context2.stop(); 31570 } 31571 } 31572 }, _callee2, this); 31573 })); 31574 31575 function initData() { 31576 return _initData.apply(this, arguments); 31577 } 31578 31579 return initData; 31580 }() 31581 }, { 31582 key: "initUrlParams", 31583 value: function initUrlParams() { 31584 var url = window.location.hash.slice(1); 31585 var programs = url.split('/'); 31586 31587 var _iterator3 = _createForOfIteratorHelper(programs), 31588 _step3; 31589 31590 try { 31591 for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { 31592 var program = _step3.value; 31593 31594 if (!this.programs[program]) { 31595 continue; 31596 } 31597 31598 this.filters.category.push(program); 31599 var checkbox = document.getElementById('filter-' + program); 31600 31601 if (checkbox) { 31602 checkbox.checked = true; 31603 } 31604 } 31605 } catch (err) { 31606 _iterator3.e(err); 31607 } finally { 31608 _iterator3.f(); 31609 } 31610 } 31611 }, { 31612 key: "initMap", 31613 value: function () { 31614 var _initMap = _asyncToGenerator(_regeneratorRuntime().mark(function _callee3() { 31615 return _regeneratorRuntime().wrap(function _callee3$(_context3) { 31616 while (1) { 31617 switch (_context3.prev = _context3.next) { 31618 case 0: 31619 this.map = new google.maps.Map(this.container, this.mapSettings); 31620 31621 case 1: 31622 case "end": 31623 return _context3.stop(); 31624 } 31625 } 31626 }, _callee3, this); 31627 })); 31628 31629 function initMap() { 31630 return _initMap.apply(this, arguments); 31631 } 31632 31633 return initMap; 31634 }() 31635 }, { 31636 key: "initInfoWindow", 31637 value: function () { 31638 var _initInfoWindow = _asyncToGenerator(_regeneratorRuntime().mark(function _callee4() { 31639 var _this2 = this; 31640 31641 return _regeneratorRuntime().wrap(function _callee4$(_context4) { 31642 while (1) { 31643 switch (_context4.prev = _context4.next) { 31644 case 0: 31645 this.infoWindow = new google.maps.InfoWindow({ 31646 content: '' 31647 }); 31648 google.maps.event.addListener(this.map, "click", function () { 31649 _this2.infoWindow.close(); 31650 }); 31651 31652 case 2: 31653 case "end": 31654 return _context4.stop(); 31655 } 31656 } 31657 }, _callee4, this); 31658 })); 31659 31660 function initInfoWindow() { 31661 return _initInfoWindow.apply(this, arguments); 31662 } 31663 31664 return initInfoWindow; 31665 }() 31666 }, { 31667 key: "initLocationSelectionHandler", 31668 value: function initLocationSelectionHandler() {
31669 var mapContainer = document.querySelector('.find-y-map'); 31670 mapContainer.addEventListener('click', function (event) { 31671 var target = event.target; 31672 var mapContainer = document.querySelector('.find-y-map'); 31673 31674 while (target && target !== mapContainer && !target.classList.contains('button--red')) { 31675 target = target.parentElement; 31676 } 31677 31678 if (target && target.classList.contains('button--red')) { 31679 var centreId = +target.dataset.locationId; 31680 31681 if (!centreId) { 31682 return; 31683 } 31684 31685 var centre = findY.findCentreById(centreId); 31686 31687 if (!centre) { 31688 return; 31689 } 31690 31691 console.log("Location selected: ".concat(location)); 31692 document.dispatchEvent(new CustomEvent('location_selected', { 31693 detail: { 31694 location: centre 31695 } 31696 })); 31697 } 31698 }); 31699 } 31700 }, { 31701 key: "initListView", 31702 value: function initListView() { 31703 var _this3 = this; 31704 31705 this.listViewContainer = document.getElementById('find-y-list'); 31706 this.listViewMoreButton = document.getElementById('find-y-list-button'); 31707 this.listViewMessage = document.getElementById('find-y-list-message'); 31708 this.hasListView = this.listViewContainer && this.listViewMoreButton && this.listViewMessage; 31709 31710 if (!this.hasListView) { 31711 return; 31712 } 31713 31714 this.listViewItemsPerPage = parseInt(this.listViewContainer.dataset.itemsPerPage) || 10; 31715 this.listViewMoreButton.addEventListener("click", function (event) { 31716 event.preventDefault(); 31717 31718 _this3.showMore(); 31719 }); 31720 } 31721 }, { 31722 key: "setStartingPosition", 31723 value: function setStartingPosition() { 31724 var bounds = new google.maps.LatLngBounds(); 31725 bounds.extend(this.origin.position); 31726 this.map.fitBounds(bounds); 31727 this.map.setCenter(this.origin.position); 31728 this.map.setZoom(this.mapSettings.zoom); 31729 } 31730 }, { 31731 key: "applyFilters", 31732 value: function applyFilters() { 31733 var _this4 = this; 31734 31735 this.results = []; 31736 31737 if (this.filters.category.length > 0) { 31738 this.results = this.centres.filter(function (program) { 31739 return _this4.filters.category.every(function (filter) { 31740 return program.services.includes(filter); 31741 }); 31742 }).map(function (program) { 31743 return program.id; 31744 }); 31745 return; 31746 } 31747 31748 var _iterator4 = _createForOfIteratorHelper(this.centres), 31749 _step4; 31750 31751 try { 31752 for (_iterator4.s();
31752 !(_step4 = _iterator4.n()).done;) { 31753 var centre = _step4.value; 31754 this.results.push(centre.id); 31755 } 31756 } catch (err) { 31757 _iterator4.e(err); 31758 } finally { 31759 _iterator4.f(); 31760 } 31761 } 31762 }, { 31763 key: "resetMarkers", 31764 value: function resetMarkers() { 31765 var _iterator5 = _createForOfIteratorHelper(this.markers), 31766 _step5; 31767 31768 try { 31769 for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { 31770 var marker = _step5.value; 31771 marker.setMap(null); 31772 } 31773 } catch (err) { 31774 _iterator5.e(err); 31775 } finally { 31776 _iterator5.f(); 31777 } 31778 31779 this.markers = []; 31780 } 31781 }, { 31782 key: "redrawMap", 31783 value: function redrawMap() { 31784 var _this5 = this; 31785 31786 this.resetMarkers(); 31787 this.toggleNotFoundMessage('none'); 31788 31789 var _iterator6 = _createForOfIteratorHelper(this.results), 31790 _step6; 31791 31792 try { 31793 var _loop = function _loop() { 31794 var centreId = _step6.value; 31795 31796 var centre = _this5.findCentreById(centreId); 31797 31798 var marker = new google.maps.Marker({ 31799 position: centre.position, 31800 map: _this5.map, 31801 icon: _this5.locationPinIcon, 31802 title: centre.name, 31803 centre: centre, 31804 distance: null, 31805 rendered: false, 31806 id: centreId 31807 }); 31808 google.maps.event.addListener(marker, 'click', function () { 31809 if (_this5.tryTheYDropdown) { 31810 _this5.markers.forEach(function (m) { 31811 return m.setIcon(_this5.locationPinIcon); 31812 }); 31813 31814 marker.setIcon(_this5.locationSelectedIcon); 31815 } 31816 31817 findY.infoWindow.close(); 31818 findY.infoWindow.setContent(findY.getCentreInfo(marker)); 31819 findY.infoWindow.open({ 31820 anchor: marker, 31821 map: _this5.map, 31822 shouldFocus: true 31823 }); 31824 31825 if (_this5.tryTheYDropdown) { 31826 _this5.tryTheYDropdown.value = marker.id; 31827 31828 _this5.map.panTo(centre.position); 31829 31830 var inputElement = document.querySelector('input[name="location"]'); 31831 var locationIdInput = document.querySelector('input[name="location_id"]'); 31832 31833 if (locationIdInput) { 31834 locationIdInput.value = centre.id; 31835 } 31836 31837 if (inputElement) { 31838 inputElement.value = centre.name; 31839 } 31840 31841 _this5.updateSubmitButtonsState(true); 31842 } 31843 }); 31844 31845 _this5.markers.push(marker); 31846 }; 31847 31848 for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { 31849 _loop(); 31850 } 31851 } catch (err) { 31852 _iterator6.e(err); 31853 } finally { 31854 _iterator6.f(); 31855 } 31856 31857 if (this.markers.length === 0) { 31858 this.toggleNotFoundMessage('block'); 31859 this.setStartingPosition(); 31860 this.redrawList(); 31861 return; 31862 } 31863 31864 var bounds = new google.maps.LatLngBounds(); 31865 var closestMarkers = this.markers; 31866 31867 if (this.filters.location) { 31868 var originPosition = this.filters.location.position; 31869 this.markers.forEach(function (marker) { 31870 marker.distance = google.maps.geometry.spherical.computeDistanceBetween(originPosition, marker.getPosition()); 31871 }); 31872 this.markers.sort(function (a, b) { 31873 return a.distance - b.distance; 31874 }); 31875 closestMarkers = this.markers.slice(0, this.minPlacesToShow); 31876 31877 if (closestMarkers[0].distance > 1000000) { 31878 this.filters.location = null; 31879 console.debug('Cannot use location. Distance is ' + closestMarkers[0].distance); 31880 } else { 31881 bounds.extend(originPosition); 31882 } 31883 } 31884 31885 closestMarkers.forEach(function (marker) { 31886 return bounds.extend(marker.getPosition()); 31887 }); 31888 this.map.fitBounds(bounds); 31889 this.redrawList(); 31890 } 31891 }, { 31892 key: "redrawList", 31893 value: function redrawList() { 31894 if (!this.hasListView) { 31895 return; 31896 } 31897 31898 this.listViewContainer.innerHTML = ''; 31899 this.showMore(); 31900 } 31901 }, { 31902 key: "showMore", 31903 value: function showMore() { 31904 var _this6 = this; 31905 31906 if (!this.hasListView) { 31907 return; 31908 } 31909 31910 var items = []; 31911 var hasMore = false;
31912 this.markers.forEach(function (marker, index) { 31913 if (marker.rendered) { 31914 return; 31915 } 31916 31917 if (items.length === _this6.listViewItemsPerPage) { 31918 hasMore = true; 31919 return; 31920 } 31921 31922 items.push(_this6.renderListItem(marker)); 31923 marker.rendered = true; 31924 }); 31925 this.listViewContainer.innerHTML += items.join(''); 31926 this.listViewMoreButton.style.display = hasMore ? 'inline-block' : 'none'; 31927 this.listViewMessage.style.display = this.markers.length === 0 ? 'block' : 'none'; 31928 } 31929 }, { 31930 key: "renderListItem", 31931 value: function renderListItem(marker) { 31932 var _this7 = this; 31933 31934 var centre = marker.centre; 31935 var address = [centre.address.street, centre.address.city, [centre.address.state, centre.address.postcode].join(' ')].join(', '); 31936 var headerItems = []; 31937 headerItems.push("<h3 class=\"find-y-list-item__head__title\">".concat(centre.name, "</h3>")); 31938 31939 if (marker.distance && this.filters.location) { 31940 headerItems.push("<div class=\"find-y-list-item__head__sub-title\">".concat(Math.round(marker.distance / 10) / 100, " km away from ").concat(this.filters.location.name, "</div>")); 31941 } 31942 31943 headerItems.push("<address>".concat(address, "</address>")); 31944 31945 if (centre.hours) { 31946 headerItems.push("<div>Today's hours: ".concat(centre.hours, "</div>")); 31947 } 31948 31949 if (centre.info) { 31950 var _iterator7 = _createForOfIteratorHelper(centre.info), 31951 _step7; 31952 31953 try { 31954 for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { 31955 var section = _step7.value; 31956 headerItems.push("<div>".concat(section.text, "</div>")); 31957 } 31958 } catch (err) { 31959 _iterator7.e(err); 31960 } finally { 31961 _iterator7.f(); 31962 } 31963 } 31964 31965 var programIcons = []; 31966 centre.services.forEach(function (programId) { 31967 var program = _this7.programs[programId]; 31968 programIcons.push("<img src=\"".concat(program.icon, "\" alt=\"").concat(program.name, "\" title=\"").concat(program.name, "\">")); 31969 }); 31970 var links = []; 31971 centre.links.forEach(function (link) { 31972 links.push("<li><a class=\"button ".concat(link.class, " listViewCTA\" href=\"").concat(link.url, "\" target=\"").concat(link.target, "\" data-location-id=\"").concat(centre.id, "\">").concat(link.title, "</a></li>")); 31973 }); 31974 return "\n <div class=\"find-y-list-item\">\n <div class=\"find-y-list-item__main\"> \n <div class=\"find-y-list-item__head\">\n ".concat(headerItems.join(''), "\n </div>\n <div class=\"find-y-list-item__icons\">\n ").concat(programIcons.join(''), "\n </div>\n </div>\n <ul class=\"find-y-list-item__links\">\n ").concat(links.join(''), "\n </ul>\n </div>\n "); 31975 } 31976 }, { 31977 key: "findCentreById", 31978 value: function findCentreById(centreId) { 31979 return this.centres.find(function (element) { 31980 return element.id === centreId; 31981 }); 31982 } 31983 }, { 31984 key: "initSearchByLocationForm", 31985 value: function initSearchByLocationForm() { 31986 var _this8 = this; 31987 31988 var searchForm = document.getElementById('js-find-y-form'); 31989 31990 if (searchForm == null) { 31991 return; 31992 } 31993 31994 var searchInput = searchForm.querySelector('.search-form__input'); 31995 var searchBtn = searchForm.querySelector('.search-form__button'); 31996 var searchBox = new google.maps.places.SearchBox(searchInput); 31997 31998 searchBtn.onclick = function (event) { 31999 event.preventDefault(); 32000 var pressEnter = new KeyboardEvent('keydown', { 32001 bubbles: true, 32002 cancelable: true, 32003 keyCode: 13, 32004 key: 'Enter' 32005 }); 32006 document.getElementById("js-find-y-form").dispatchEvent(pressEnter); 32007 findY.redrawMap(); 32008 }; 32009 32010 this.map.addListener("bounds_changed", function () { 32011 searchBox.setBounds(_this8.map.getBounds()); 32012 }); 32013 searchBox.addListener("places_changed", function () { 32014 var places = searchBox.getPlaces(); 32015 32016 if (places.length > 0) { 32017 _this8.handleLocationChange(places[0]); 32018 } 32019 }); 32020 } 32021 }, { 32022 key: "initMyLocation", 32023 value: function initMyLocation() { 32024 var myLocationBtn = document.getElementById('js-btn-detect-location'); 32025 32026 if (!("geolocation" in navigator) || !myLocationBtn) { 32027 console.log('geolocation is not available on this device'); 32028 return; 32029 } 32030 32031 myLocationBtn.addEventListener("click", function (event) { 32032 event.preventDefault(); 32033 navigator.geolocation.getCurrentPosition(function (position) { 32034 var latitude = position.coords.latitude; 32035 var longitude = position.coords.longitude; 32036 var geocoder = new google.maps.Geocoder(); 32037 var latlng = new google.maps.LatLng(latitude, longitude); 32038 geocoder.geocode({ 32039 "location": latlng 32040 }, function (results, status) { 32041 if (status !== google.maps.GeocoderStatus.OK || !results[0]) { 32042 return; 32043 } 32044 32045 var addressComponents = results[0].address_components; 32046 32047 for (var i = 0; i < addressComponents.length; i++) { 32048 var types = addressComponents[i].types; 32049 32050 if (types.indexOf("postal_code") !== -1) { 32051 document.getElementById("js-btn-location").value = addressComponents[i].long_name; 32052 break; 32053 } 32054 } 32055 32056 findY.handleLocationChange(results[0]); 32057 }); 32058 }, function (error) { 32059 console.error("Error getting geolocation: " + error.message); 32060 }); 32061 }); 32062 } 32063 }, { 32064 key: "initSearchByCategoryForm", 32065 value: function initSearchByCategoryForm() { 32066 var checkboxes = document.querySelectorAll('input[name="category-filter"]');
32067 checkboxes.forEach(function (checkbox) { 32068 checkbox.addEventListener('click', function () { 32069 return findY.handleCategoryFilterUpdate(); 32070 }); 32071 }); 32072 } 32073 }, { 32074 key: "initDropdownSelection", 32075 value: function initDropdownSelection() { 32076 var _this9 = this; 32077 32078 if (!this.tryTheYDropdown) { 32079 return; 32080 } 32081 32082 this.updateSubmitButtonsState(false); 32083 this.tryTheYDropdown.addEventListener('change', function (event) { 32084 if (_this9.tryTheYDropdown.selectedIndex === 0) { 32085 _this9.updateSubmitButtonsState(false); 32086 32087 return; 32088 } 32089 32090 var selectedId = parseInt(_this9.tryTheYDropdown.value, 10); 32091 32092 var marker = _this9.markers.find(function (m) { 32093 return m.id === selectedId; 32094 }); 32095 32096 if (marker) { 32097 google.maps.event.trigger(marker, 'click'); 32098 32099 _this9.updateSubmitButtonsState(true); 32100 } 32101 }); 32102 } 32103 }, { 32104 key: "updateSubmitButtonsState", 32105 value: function updateSubmitButtonsState(isEnabled) { 32106 var submitButtons = document.getElementsByClassName('submitButton'); 32107 32108 if (submitButtons.length) { 32109 Array.from(submitButtons).forEach(function (btn) { 32110 btn.disabled = !isEnabled; 32111 btn.style.backgroundColor = isEnabled ? '#a8052b' : '#ccc'; 32112 btn.style.borderColor = isEnabled ? '#a8052b' : '#ccc'; 32113 }); 32114 } 32115 } 32116 }, { 32117 key: "handleCategoryFilterUpdate", 32118 value: function handleCategoryFilterUpdate() { 32119 var _this10 = this; 32120 32121 this.filters.category = []; 32122 var checkboxes = document.querySelectorAll('input[name="category-filter"]:checked'); 32123 if (checkboxes.length === 0) return; 32124 checkboxes.forEach(function (checkbox) { 32125 _this10.filters.category.push(checkbox.value); 32126 }); 32127 32128 if (window.location.hash) { 32129 history.replaceState(null, '', window.location.href.split('#')[0]); 32130 } 32131 32132 if (this.filters.category.length > 0) { 32133 window.location.hash = this.filters.category.join('/'); 32134 } 32135 32136 this.applyFilters(); 32137 this.redrawMap(); 32138 } 32139 }, { 32140 key: "handleLocationChange", 32141 value: function handleLocationChange(place) { 32142 if (!place.geometry || !place.geometry.location) { 32143 return; 32144 } 32145 32146 document.getElementById("find-y-filters-form").scrollIntoView({ 32147 behavior: "smooth", 32148 block: "start" 32149 }); 32150 this.filters.location = { 32151 position: { 32152 'lat': place.geometry.location.lat(), 32153 'lng': place.geometry.location.lng() 32154 }, 32155 name: place.name, 32156 address: place.formatted_address 32157 }; 32158 this.redrawMap(); 32159 } 32160 }, { 32161 key: "toggleNotFoundMessage", 32162 value: function toggleNotFoundMessage(state) { 32163 document.getElementById('find-y-map-overlay').style.display = state; 32164 } 32165 }, { 32166 key: "getCentreInfo", 32167 value: function getCentreInfo(marker) { 32168 var centre = marker.centre; 32169 var cardElements = ["<h4>
32169".concat(centre.name, "</h4>"), this._listDistance(marker), this._listAddress(centre.address || []), this._listHours(centre), this._listPrograms(centre.services || []), this._listInfoSections(centre.info || []), this._listButtons(centre)]; 32170 var infoBox = cardElements.join(''); 32171 return "\n <div class=\"card-map card-map--centres\">\n <div class=\"card__overlay\">\n ".concat(infoBox, "\n </div>\n </div>\n "); 32172 } 32173 }, { 32174 key: "getDefaultMapStyle", 32175 value: function getDefaultMapStyle() { 32176 return [{ 32177 "featureType": "administrative", 32178 "elementType": "all", 32179 "stylers": [{ 32180 "saturation": "-100" 32181 }] 32182 }, { 32183 "featureType": "administrative.province", 32184 "elementType": "all", 32185 "stylers": [{ 32186 "visibility": "off" 32187 }] 32188 }, { 32189 "featureType": "landscape", 32190 "elementType": "all", 32191 "stylers": [{ 32192 "saturation": -70 32193 }, { 32194 "lightness": 65 32195 }, { 32196 "visibility": "on" 32197 }] 32198 }, { 32199 "featureType": "poi", 32200 "elementType": "all", 32201 "stylers": [{ 32202 "saturation": -100 32203 }, { 32204 "lightness": "50" 32205 }, { 32206 "visibility": "simplified" 32207 }] 32208 }, { 32209 "featureType": "poi.school", 32210 "elementType": "all", 32211 "stylers": [{ 32212 "saturation": -50 32213 }, { 32214 "lightness": "10" 32215 }, { 32216 "visibility": "on" 32217 }] 32218 }, { 32219 "featureType": "road", 32220 "elementType": "all", 32221 "stylers": [{ 32222 "saturation": "-100" 32223 }] 32224 }, { 32225 "featureType": "road.highway", 32226 "elementType": "all", 32227 "stylers": [{ 32228 "visibility": "simplified" 32229 }] 32230 }, { 32231 "featureType": "road.arterial", 32232 "elementType": "all", 32233 "stylers": [{ 32234 "lightness": "30" 32235 }] 32236 }, { 32237 "featureType": "road.local", 32238 "elementType": "all", 32239 "stylers": [{ 32240 "lightness": "40" 32241 }] 32242 }, { 32243 "featureType": "transit", 32244 "elementType": "all", 32245 "stylers": [{ 32246 "saturation": -100 32247 }, { 32248 "visibility": "simplified" 32249 }] 32250 }, { 32251 "featureType": "water", 32252 "elementType": "geometry", 32253 "stylers": [{ 32254 "saturation": -75 32255 }] 32256 }, { 32257 "featureType": "water", 32258 "elementType": "labels", 32259 "stylers": [{ 32260 "lightness": -25 32261 }, { 32262 "saturation": -75 32263 }] 32264 }]; 32265 } 32266 }]); 32267 32268 return FindYMap; 32269}(); 32270 32271/***/ }), 32272
vendor: 5,182 bytes, lines 32273-32296
32273/***/ "../src/static/js/utils/generic-map.js": 32274/*!*********************************************!*\ 32275 !*** ../src/static/js/utils/generic-map.js ***! 32276 \*********************************************/ 32277/*! exports provided: GenericMap */ 32278/***/ (function(module, __webpack_exports__, __webpack_require__) { 32279 32280"use strict"; 32281__webpack_require__.r(__webpack_exports__); 32282/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GenericMap", function() { return GenericMap; }); 32283/* harmony import */ var _constant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constant */ "../src/static/js/utils/constant.js"); 32284function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } 32285 32286function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 32287 32288function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 32289 32290function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } 32291 32292function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } 32293 32294function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 32295 32296function _regeneratorRuntime() { "use strict"; _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 6,612 bytes, line 32296
32296 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEac
32296h(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 32297 32298function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } 32299 32300function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } 32301 32302function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 32303 32304function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 32305 32306function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 32307 32308function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 32309 32310 32311var GenericMap = function () { 32312 function GenericMap() { 32313 var _this = this; 32314 32315 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 32316 32317 _classCallCheck(this, GenericMap); 32318 32319 this.mapSelector = options.mapSelector; 32320 this.mapContainer = $(this.mapSelector); 32321 this.searchFormSelector = options.searchFormSelector || '.js-search-map'; 32322 this.defaultIcon = options.defaultIcon || _constant__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_MAP_PIN_ICON"]; 32323 this.selectedIcon = options.selectedIcon || _constant__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_MAP_SELECTED_PIN_ICON"]; 32324 this.dataAttrUrl = options.dataAttrUrl || 'map'; 32325 this.dataAttrLat = options.dataAttrLat || 'lat'; 32326 this.dataAttrLng = options.dataAttrLng || 'lng'; 32327 this.dataAttrZoom = options.dataAttrZoom || 'zoom'; 32328 this.dataAttrMinZoom = options.dataAttrMinZoom || 'min-zoom'; 32329 this.dataAttrMaxZoom = options.dataAttrMaxZoom || 'max-zoom'; 32330 this.dataAttrFilter = options.dataAttrFilter || 'filtered'; 32331 this.entity = options.entity || 'Site'; 32332 this.btnCssClass = options.btnCssClass || 'btn--red btn--small card__btn'; 32333 this.defaultMapSettings = { 32334 center: _constant__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_MAP_CENTER"], 32335 disableDefaultUI: true, 32336 zoom: 9, 32337 minZoom: 5, 32338 maxZoom: 16, 32339 styles: this.getDefaultMapStyle() 32340 }; 32341 this.mapSettings = options.mapSettings || this.defaultMapSettings; 32342 this.helpers = Object.assign({ 32343 listAddress: function listAddress(address) { 32344 if (!address || !address.length) return ''; 32345 var addressLines = address.join('<br>'); 32346 return "\n <div class=\"card__section\">\n <svg class=\"ico-map-location ico--left\">\n <use xlink:href=\"/static/images/sprite.svg#ico-map-location\"></use>\n </svg>\n <div class=\"card__section-text\">\n <address>".concat(addressLines, "</address>\n </div>\n </div>\n "); 32347 }, 32348 listPrograms: function listPrograms(programs) { 32349 if (!programs || !programs.length) return ''; 32350 var info = ''; 32351 32352 var isNumericArray = _this._isArrayOfNumbers && _this._isArrayOfNumbers(programs); 32353 32354 if (isNumericArray && (!_this.programs || !_this.programs.length)) return ''; 32355 32356 if (isNumericArray) { 32357 info = programs.map(function (id) { 32358 var _this$programs; 32359 32360 var program = (_this$programs = _this.programs) === null || _this$programs === void 0 ? void 0 : _this$programs[id]; 32361 return program ? "<p>".concat(program.name, "</p>") : ''; 32362 }).join(''); 32363 } else { 32364 info = programs.map(function (name) { 32365 return "<p>".concat(name, "</p>"); 32366 }).join(''); 32367 } 32368 32369 if (!info) return ''; 32370 return "\n <div class=\"card__section\">\n <svg class=\"ico-running ico--left\">\n <use xlink:href=\"/static/images/sprite.svg#ico-running\"></use>\n </svg>\n <div class=\"card__section-text\">\n <p><strong>Programs at this site:</strong></p>\n ".concat(info, "\n </div>\n </div>\n "); 32371 }, 32372 listBusStops: function listBusStops(stopOrDestinations) { 32373 if (!stopOrDestinations) return ''; 32374 var icon = 'ico-bus'; 32375 var data; 32376 32377 if (Array.isArray(stopOrDestinations)) { 32378 data = stopOrDestinations; 32379 } else if (stopOrDestinations.data && Array.isArray(stopOrDestinations.data)) { 32380 data = stopOrDestinations.data; 32381 if (stopOrDestinations.icon) icon = stopOrDestinations.icon; 32382 } else { 32383 return ''; 32384 } 32385 32386 if (!data.length) return ''; 32387 var busInfo = data.map(function (item) { 32388 return "\n <p>
32388Bus to ".concat(item.destination, "</p>\n <p>Route: ").concat(item.route, "</p>\n "); 32389 }).join(''); 32390 return "\n <div class=\"card__section\">\n <svg class=\"".concat(icon, " ico--left\">\n <use xlink:href=\"/static/images/sprite.svg#").concat(icon, "\"></use>\n </svg>\n <div class=\"card__section-text\">\n ").concat(busInfo, "\n </div>\n </div>\n "); 32391 }, 32392 listExtendedHours: function listExtendedHours(edc) { 32393 if (!edc || !edc.info) return ''; 32394 return "\n <div class=\"card__section\">\n <svg class=\"".concat(edc.iconClass, " ico--left\">\n <use xlink:href=\"/static/images/sprite.svg#").concat(edc.icon, "\"></use>\n </svg>\n <div class=\"card__section-text\">\n ").concat(edc.info, "\n </div>\n </div>\n "); 32395 }, 32396 listButtons: function listButtons(site) { 32397 if (!site) return ''; 32398 var isSelected = !!site.isSelected; 32399 var btnText = isSelected ? "Unselect this ".concat(_this.entity) : "Select this ".concat(_this.entity); 32400 return "\n <div class=\"card__actions\">\n <button\n class=\"".concat(_this.btnCssClass, "\"\n type=\"button\"\n data-site-name=\"").concat(site.card.title, "\"\n data-id=\"").concat(site.siteId, "\"\n >\n ").concat(btnText, "\n </button>\n </div>\n "); 32401 }, 32402 updateHintText: function updateHintText(selectedList, $locationText, $hintContainer) { 32403 var count = selectedList ? selectedList.length : 0; 32404 32405 if (!count) { 32406 if ($locationText) $locationText.text(''); 32407 if ($hintContainer) $hintContainer.removeClass('is-visible'); 32408 return; 32409 } 32410 32411 if ($hintContainer) { 32412 $hintContainer.addClass('is-visible'); 32413 } 32414 32415 if (count === 1) { 32416 var name = Array.from(selectedList)[0] || '1 location selected'; 32417 if ($locationText) $locationText.text(name); 32418 } else { 32419 if ($locationText) $locationText.text("".concat(count, " locations selected")); 32420 } 32421 }, 32422 shouldShowHelperText: function shouldShowHelperText($root, selector, key) { 32423 if (!$root || !selector) return; 32424 32425 try { 32426 var hasSeenIntro = window.sessionStorage && window.sessionStorage.getItem(key) === '1'; 32427 var $intro = $root.find(selector); 32428 32429 if (!hasSeenIntro && $intro.length) { 32430 $intro.show(); 32431 $intro.off('click.bussingIntro').on('click.bussingIntro', function () { 32432 $intro.hide(); 32433 sessionStorage.setItem(key, '1'); 32434 }); 32435 } else if ($intro.length) { 32436 $intro.hide(); 32437 } 32438 } catch (e) {} 32439 }, 32440 updateButtons: function updateButtons() {} 32441 }, options.helpers || {}); 32442 32443 this.cardBuilder = options.cardBuilder || function (marker) { 32444 var site = marker.site; 32445 var card = site.card; 32446 var _this$helpers = _this.helpers, 32447 listAddress = _this$helpers.listAddress, 32448 listPrograms = _this$helpers.listPrograms, 32449 listBusStops = _this$helpers.listBusStops, 32450 listExtendedHours = _this$helpers.listExtendedHours, 32451 listButtons = _this$helpers.listButtons; 32452 var cardElements = ["<h4>".concat(card.title, "</h4>"), listAddress(card.address), listPrograms(card.categories), listBusStops(card.stop || card.destinations), listExtendedHours(card.edc), listButtons(site)]; 32453 var infoBox = cardElements.join(''); 32454 return "\n <div class=\"card-map\">\n <div class=\"card__overlay\">\n ".concat(infoBox, "\n </div>\n </div>\n "); 32455 }; 32456 32457 this.applyFiltersOverride = typeof options.applyFilters === 'function' ? options.applyFilters : null; 32458 this.onMarkerClick = options.onMarkerClick || null; 32459 this.markerFilter = options.markerFilter || null;
32460 this.mapInitialised = false; 32461 this.dataInitialised = false; 32462 } 32463 32464 _createClass(GenericMap, [{ 32465 key: "_googleAvailable", 32466 value: function _googleAvailable() { 32467 var requirePlaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; 32468 if (typeof window === 'undefined') return false; 32469 32470 if (!window.google || !google.maps) { 32471 console.warn('Google Maps JS API not available.'); 32472 return false; 32473 } 32474 32475 if (requirePlaces && !google.maps.places) { 32476 console.warn('Google Maps Places library not available.'); 32477 return false; 32478 } 32479 32480 return true; 32481 } 32482 }, { 32483 key: "_isArrayOfNumbers", 32484 value: function _isArrayOfNumbers(arr) { 32485 if (!Array.isArray(arr)) { 32486 return false; 32487 } 32488 32489 return arr.every(function (el) { 32490 return typeof el === 'number' || typeof el === 'string' && el.trim() !== '' && !isNaN(el); 32491 }); 32492 } 32493 }, { 32494 key: "_normaliseToArray", 32495 value: function _normaliseToArray(input) { 32496 if (Array.isArray(input)) { 32497 return input; 32498 } 32499 32500 if (input && _typeof(input) === 'object') { 32501 for (var _i = 0, _Object$keys = Object.keys(input); _i < _Object$keys.length; _i++) { 32502 var key = _Object$keys[_i]; 32503 var value = input[key]; 32504 32505 if (Array.isArray(value)) { 32506 return value; 32507 } 32508 32509 if (value && _typeof(value) === 'object') { 32510 return Object.values(value); 32511 } 32512 } 32513 } 32514 32515 console.warn('Normalisation failed. Expected array or object with array-like property:', input); 32516 return []; 32517 } 32518 }, { 32519 key: "_getInitialFilterFromDom", 32520 value: function _getInitialFilterFromDom() { 32521 var raw = this.mapContainer.data(this.dataAttrFilter); 32522 if (!raw) return []; 32523 32524 if (Array.isArray(raw)) { 32525 return raw; 32526 } 32527 32528 if (typeof raw === 'string') { 32529 try { 32530 var parsed = JSON.parse(raw); 32531 return Array.isArray(parsed) ? parsed : []; 32532 } catch (e) { 32533 console.warn('Could not parse data-' + this.dataAttrFilter + ' JSON:', raw, e); 32534 return []; 32535 } 32536 } 32537 32538 return []; 32539 } 32540 }, { 32541 key: "init", 32542 value: function () { 32543 var _init = _asyncToGenerator(_regeneratorRuntime().mark(function _callee() { 32544 var initialFilter; 32545 return _regeneratorRuntime().wrap(function _callee$(_context) { 32546 while (1) { 32547 switch (_context.prev = _context.next) { 32548 case 0: 32549 if (this._googleAvailable()) { 32550 _context.next = 2; 32551 break; 32552 } 32553 32554 return _context.abrupt("return"); 32555 32556 case 2: 32557 if (this.dataInitialised) { 32558 _context.next = 5; 32559 break; 32560 } 32561 32562 _context.next = 5; 32563 return this.initData(); 32564 32565 case 5: 32566 if (this.mapInitialised) { 32567 _context.next = 11; 32568 break; 32569 } 32570 32571 _context.next = 8; 32572 return this.initMap(); 32573 32574 case 8: 32575 _context.next = 10; 32576 return this.initInfoWindow(); 32577 32578 case 10: 32579 this.initPlacesSearch(); 32580 32581 case 11: 32582 initialFilter = this._getInitialFilterFromDom(); 32583 this.applyFilters(initialFilter); 32584 this.redrawMap(); 32585 32586 case 14: 32587 case "end": 32588 return _context.stop(); 32589 } 32590 } 32591 }, _callee, this); 32592 })); 32593 32594 function init() { 32595 return _init.apply(this, arguments); 32596 } 32597 32598 return init; 32599 }() 32600 }, { 32601 key: "initData", 32602 value: function () { 32603 var _initData = _asyncToGenerator(_regeneratorRuntime().mark(function _callee2() { 32604 var _this2 = this; 32605 32606 var dataUrl; 32607 return _regeneratorRuntime().wrap(function _callee2$(_context2) { 32608 while (1) { 32609 switch (_context2.prev = _context2.next) { 32610 case 0: 32611 dataUrl = this.mapContainer.data(this.dataAttrUrl); 32612 32613 if (dataUrl) { 32614 _context2.next = 4; 32615 break; 32616 } 32617 32618 console.warn('No data URL found on map element (data-' + this.dataAttrUrl + ').'); 32619 return _context2.abrupt("return"); 32620 32621 case 4: 32622 this.sites = []; 32623 this.filteredSites = []; 32624 this.markers = []; 32625 _context2.next = 9; 32626 return fetch(dataUrl, { 32627 headers: { 32628 "Accept": "application/json" 32629 } 32630 }).then(function (response) { 32631 return response.json(); 32632 }).then(function (data) { 32633 _this2.sites = _this2._normaliseToArray(data); 32634 }).catch(function (err) { 32635 return console.error('Error fetching map data:', err); 32636 }); 32637 32638 case 9:
32639 this.dataInitialised = true; 32640 32641 case 10: 32642 case "end": 32643 return _context2.stop(); 32644 } 32645 } 32646 }, _callee2, this); 32647 })); 32648 32649 function initData() { 32650 return _initData.apply(this, arguments); 32651 } 32652 32653 return initData; 32654 }() 32655 }, { 32656 key: "initPlacesSearch", 32657 value: function initPlacesSearch() { 32658 var _this3 = this; 32659 32660 if (!this._googleAvailable(true)) return; 32661 var $popupRoot = this.mapContainer.closest('.popup, .popup--map').length ? this.mapContainer.closest('.popup, .popup--map') : this.mapContainer; 32662 var searchMap = $popupRoot.find(this.searchFormSelector); 32663 32664 if (!searchMap.length) { 32665 console.warn('initPlacesSearch: no search container found for selector', this.searchFormSelector, 'near', this.mapContainer); 32666 return; 32667 } 32668 32669 var searchInput = searchMap.find('.search__field'); 32670 var searchBtn = searchMap.find('.search__btn'); 32671 if (!searchInput.length || !searchBtn.length) return; 32672 var searchBox = new google.maps.places.SearchBox(searchInput[0]); 32673 searchBtn.on('click', function (event) { 32674 event.preventDefault(); 32675 searchInput.focus(); 32676 var pressEnter = new KeyboardEvent('keydown', { 32677 bubbles: true, 32678 cancelable: true, 32679 keyCode: 13, 32680 key: 'Enter' 32681 }); 32682 searchInput[0].dispatchEvent(pressEnter); 32683 }); 32684 this.map.addListener("bounds_changed", function () { 32685 var bounds = _this3.map.getBounds(); 32686 32687 if (bounds) { 32688 searchBox.setBounds(bounds); 32689 } 32690 }); 32691 searchBox.addListener("places_changed", function () { 32692 var places = searchBox.getPlaces(); 32693 if (!places || !places.length) return; 32694 var localBounds = new google.maps.LatLngBounds(); 32695 places.forEach(function (place) { 32696 if (!place.geometry || !place.geometry.location) return; 32697 32698 if (place.geometry.viewport) { 32699 localBounds.union(place.geometry.viewport); 32700 } else { 32701 localBounds.extend(place.geometry.location); 32702 } 32703 }); 32704 32705 _this3.map.fitBounds(localBounds); 32706 }); 32707 } 32708 }, { 32709 key: "initMap", 32710 value: function () { 32711 var _initMap = _asyncToGenerator(_regeneratorRuntime().mark(function _callee3() { 32712 var latRaw, lngRaw, zoomRaw, minZoomRaw, maxZoomRaw, lat, lng, zoom, minZoom, maxZoom, finalCenter, finalZoom, finalMinZoom, finalMaxZoom, mapSettings; 32713 return _regeneratorRuntime().wrap(function _callee3$(_context3) { 32714 while (1) { 32715 switch (_context3.prev = _context3.next) { 32716 case 0: 32717 this.mapInitialised = true; 32718 latRaw = this.mapContainer.data(this.dataAttrLat); 32719 lngRaw = this.mapContainer.data(this.dataAttrLng); 32720 zoomRaw = this.mapContainer.data(this.dataAttrZoom); 32721 minZoomRaw = this.mapContainer.data(this.dataAttrMinZoom); 32722 maxZoomRaw = this.mapContainer.data(this.dataAttrMaxZoom); 32723 lat = latRaw != null ? parseFloat(latRaw) : null; 32724 lng = lngRaw != null ? parseFloat(lngRaw) : null; 32725 zoom = zoomRaw != null ? parseInt(zoomRaw, 10) : null; 32726 minZoom = minZoomRaw != null ? parseInt(minZoomRaw, 10) : null; 32727 maxZoom = maxZoomRaw != null ? parseInt(maxZoomRaw, 10) : null; 32728 finalCenter = !Number.isNaN(lat) && !Number.isNaN(lng) ? { 32729 lat: lat, 32730 lng: lng 32731 } : this.defaultMapSettings.center; 32732 finalZoom = !Number.isNaN(zoom) ? zoom : this.defaultMapSettings.zoom; 32733 finalMinZoom = !Number.isNaN(minZoom) ? minZoom : this.defaultMapSettings.minZoom; 32734 finalMaxZoom = !Number.isNaN(maxZoom) ? maxZoom : this.defaultMapSettings.maxZoom; 32735 mapSettings = _objectSpread(_objectSpread({}, this.mapSettings), {}, { 32736 center: finalCenter, 32737 zoom: finalZoom, 32738 minZoom: finalMinZoom, 32739 maxZoom: finalMaxZoom 32740 }); 32741 this.map = new google.maps.Map(this.mapContainer[0], mapSettings);
32742 this.mapInitialised = true; 32743 32744 case 18: 32745 case "end": 32746 return _context3.stop(); 32747 } 32748 } 32749 }, _callee3, this); 32750 })); 32751 32752 function initMap() { 32753 return _initMap.apply(this, arguments); 32754 } 32755 32756 return initMap; 32757 }() 32758 }, { 32759 key: "initInfoWindow", 32760 value: function () { 32761 var _initInfoWindow = _asyncToGenerator(_regeneratorRuntime().mark(function _callee4() { 32762 var _this4 = this; 32763 32764 return _regeneratorRuntime().wrap(function _callee4$(_context4) { 32765 while (1) { 32766 switch (_context4.prev = _context4.next) { 32767 case 0: 32768 this.infoWindow = new google.maps.InfoWindow({ 32769 maxWidth: 300, 32770 pixelOffset: new google.maps.Size(0, 20) 32771 }); 32772 google.maps.event.addListener(this.map, "click", function () { 32773 _this4.infoWindow.close(); 32774 }); 32775 32776 case 2: 32777 case "end": 32778 return _context4.stop(); 32779 } 32780 } 32781 }, _callee4, this); 32782 })); 32783 32784 function initInfoWindow() { 32785 return _initInfoWindow.apply(this, arguments); 32786 } 32787 32788 return initInfoWindow; 32789 }() 32790 }, { 32791 key: "setMarkers", 32792 value: function setMarkers(sites) { 32793 if (!sites || !sites.length) return; 32794 32795 var _iterator = _createForOfIteratorHelper(sites), 32796 _step; 32797 32798 try { 32799 for (_iterator.s(); !(_step = _iterator.n()).done;) { 32800 var site = _step.value; 32801 32802 if (this.markerFilter && !this.markerFilter(site)) { 32803 continue; 32804 } 32805 32806 this.setMarker(site); 32807 } 32808 } catch (err) { 32809 _iterator.e(err); 32810 } finally { 32811 _iterator.f(); 32812 } 32813 } 32814 }, { 32815 key: "setMarker", 32816 value: function setMarker(site) { 32817 var _this5 = this; 32818 32819 if (!site) return; 32820 var _site$isSelected = site.isSelected, 32821 isSelected = _site$isSelected === void 0 ? false : _site$isSelected; 32822 var icon; 32823 32824 if (isSelected) { 32825 if (site.icons && site.icons.selected) { 32826 icon = site.icons.selected; 32827 } else { 32828 icon = this.selectedIcon; 32829 } 32830 } else { 32831 if (site.icons && site.icons.default) { 32832 icon = site.icons.default; 32833 } else { 32834 icon = this.defaultIcon; 32835 } 32836 } 32837 32838 var marker = new google.maps.Marker({ 32839 position: site.position, 32840 map: this.map, 32841 icon: icon, 32842 title: site.card.title, 32843 id: site.siteId, 32844 site: site, 32845 isSelected: isSelected 32846 }); 32847 google.maps.event.addListener(marker, 'click', function () { 32848 _this5.infoWindow.close(); 32849 32850 _this5.infoWindow.setContent(_this5.cardBuilder(marker)); 32851 32852 _this5.infoWindow.open({ 32853 anchor: marker, 32854 map: _this5.map, 32855 shouldFocus: true 32856 }); 32857 }); 32858 this.markers.push(marker); 32859 } 32860 }, { 32861 key: "resetMarkers", 32862 value: function resetMarkers() { 32863 var _iterator2 = _createForOfIteratorHelper(this.markers), 32864 _step2; 32865 32866 try { 32867 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { 32868 var marker = _step2.value; 32869 marker.setMap(null); 32870 } 32871 } catch (err) { 32872 _iterator2.e(err); 32873 } finally { 32874 _iterator2.f(); 32875 } 32876 32877 this.markers = []; 32878 } 32879 }, { 32880 key: "redrawMap", 32881 value: function redrawMap() { 32882 this.resetMarkers(); 32883 var hasResults = this.filteredSites && this.filteredSites.length > 0; 32884 this.toggleNotFoundMessage('no-results', hasResults ? 'hide' : 'show'); 32885 this.setMarkers(this.filteredSites); 32886 } 32887 }, { 32888 key: "syncSelectedMarkers", 32889 value: function syncSelectedMarkers(selectedNames) { 32890 var _this6 = this; 32891 32892 if (!Array.isArray(this.markers) || !this.markers.length) { 32893 return; 32894 } 32895 32896 var list = Array.isArray(selectedNames) ? selectedNames.map(String) : []; 32897 this.markers.forEach(function (marker) { 32898 var site = marker.site || {}; 32899 var title = site.card && site.card.title || marker.title || ''; 32900 var isSelected = title && list.indexOf(String(title)) !== -1; 32901 var iconDefault = site.icons && site.icons.default || _this6.defaultIcon; 32902 var iconSelected = site.icons && site.icons.selected || _this6.selectedIcon; 32903 marker.isSelected = isSelected; 32904 32905 if (marker.site) { 32906 marker.site.isSelected = isSelected; 32907 } 32908 32909 marker.setIcon(isSelected ? iconSelected : iconDefault); 32910 32911 if (_this6.helpers && typeof _this6.helpers.updateButtons === 'function' && title) { 32912 _this6.helpers.updateButtons({ 32913 marker: marker, 32914 site: site, 32915 title: title, 32916 isSelected: isSelected 32917 }); 32918 } 32919 }); 32920 } 32921 }, { 32922 key: "applyFilters", 32923 value: function applyFilters(requestedFilters) { 32924 var _this7 = this; 32925 32926 if (this.applyFiltersOverride) { 32927 var result = this.applyFiltersOverride(requestedFilters, { 32928 allSites: this.sites, 32929 markerFilter: this.markerFilter, 32930 isArrayOfNumbers: function isArrayOfNumbers(arr) { 32931 return _this7._isArrayOfNumbers(arr); 32932 }, 32933 findById: function findById(id) { 32934 return _this7.findSiteById(id); 32935 }, 32936 findByName: function findByName(name) { 32937 return _this7.findSiteByName(name); 32938 } 32939 }); 32940 32941 if (Array.isArray(result)) { 32942 this.filteredSites = result; 32943 } 32944 32945 return; 32946 } 32947 32948 this.filteredSites = []; 32949
32950 var passesMarkerFilter = function passesMarkerFilter(site) { 32951 if (!site) return false; 32952 return !(_this7.markerFilter && !_this7.markerFilter(site)); 32953 }; 32954 32955 if (!requestedFilters || !requestedFilters.length) { 32956 var _iterator3 = _createForOfIteratorHelper(this.sites), 32957 _step3; 32958 32959 try { 32960 for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { 32961 var site = _step3.value; 32962 32963 if (passesMarkerFilter(site)) { 32964 this.filteredSites.push(site); 32965 } 32966 } 32967 } catch (err) { 32968 _iterator3.e(err); 32969 } finally { 32970 _iterator3.f(); 32971 } 32972 32973 return; 32974 } 32975 32976 if (this._isArrayOfNumbers(requestedFilters)) { 32977 var _iterator4 = _createForOfIteratorHelper(requestedFilters), 32978 _step4; 32979 32980 try { 32981 for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { 32982 var siteId = _step4.value; 32983 var found = this.findSiteById(siteId); 32984 32985 if (found && passesMarkerFilter(found)) { 32986 this.filteredSites.push(found); 32987 } 32988 } 32989 } catch (err) { 32990 _iterator4.e(err); 32991 } finally { 32992 _iterator4.f(); 32993 } 32994 32995 return; 32996 } 32997 32998 var _iterator5 = _createForOfIteratorHelper(requestedFilters), 32999 _step5; 33000 33001 try { 33002 for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { 33003 var siteName = _step5.value; 33004 33005 var _found = this.findSiteByName(siteName); 33006 33007 if (_found && passesMarkerFilter(_found)) { 33008 this.filteredSites.push(_found); 33009 } 33010 } 33011 } catch (err) { 33012 _iterator5.e(err); 33013 } finally { 33014 _iterator5.f(); 33015 } 33016 } 33017 }, { 33018 key: "toggleNotFoundMessage", 33019 value: function toggleNotFoundMessage(container, state) { 33020 var $el = this.mapContainer.find(".".concat(container)); 33021 if (!$el.length) return; 33022 33023 if (state === 'show') { 33024 $el.show(); 33025 } else { 33026 $el.hide(); 33027 } 33028 } 33029 }, { 33030 key: "findSiteById", 33031 value: function findSiteById(siteId) { 33032 return this.sites.find(function (site) { 33033 return site.siteId == siteId; 33034 }); 33035 } 33036 }, { 33037 key: "findSiteByName", 33038 value: function findSiteByName(siteName) { 33039 return this.sites.find(function (site) { 33040 return site.card.title === siteName; 33041 }); 33042 } 33043 }, { 33044 key: "getDefaultMapStyle", 33045 value: function getDefaultMapStyle() { 33046 return [{ 33047 "featureType": "administrative", 33048 "elementType": "all", 33049 "stylers": [{ 33050 "saturation": "-100" 33051 }] 33052 }, { 33053 "featureType": "administrative.province", 33054 "elementType": "all", 33055 "stylers": [{ 33056 "visibility": "off" 33057 }] 33058 }, { 33059 "featureType": "landscape", 33060 "elementType": "all", 33061 "stylers": [{ 33062 "saturation": -70 33063 }, { 33064 "lightness": 65 33065 }, { 33066 "visibility": "on" 33067 }] 33068 }, { 33069 "featureType": "poi", 33070 "elementType": "all", 33071 "stylers": [{ 33072 "saturation": -100 33073 }, { 33074 "lightness": "50" 33075 }, { 33076 "visibility": "simplified" 33077 }] 33078 }, { 33079 "featureType": "poi.school", 33080 "elementType": "all", 33081 "stylers": [{ 33082 "saturation": -50 33083 }, { 33084 "lightness": "10" 33085 }, { 33086 "visibility": "on" 33087 }] 33088 }, { 33089 "featureType": "road", 33090 "elementType": "all", 33091 "stylers": [{ 33092 "saturation": "-100" 33093 }] 33094 }, { 33095 "featureType": "road.highway", 33096 "elementType": "all", 33097 "stylers": [{ 33098 "visibility": "simplified" 33099 }] 33100 }, { 33101 "featureType": "road.arterial", 33102 "elementType": "all", 33103 "stylers": [{ 33104 "lightness": "30" 33105 }] 33106 }, { 33107 "featureType": "road.local", 33108 "elementType": "all", 33109 "stylers": [{ 33110 "lightness": "40" 33111 }] 33112 }, { 33113 "featureType": "transit", 33114 "elementType": "all", 33115 "stylers": [{ 33116 "saturation": -100 33117 }, { 33118 "visibility": "simplified" 33119 }] 33120 }, { 33121 "featureType": "water", 33122 "elementType": "geometry", 33123 "stylers": [{ 33124 "saturation": -75 33125 }] 33126 }, { 33127 "featureType": "water", 33128 "elementType": "labels", 33129 "stylers": [{ 33130 "lightness": -25 33131 }, { 33132 "saturation": -75 33133 }] 33134 }]; 33135 } 33136 }]); 33137 33138 return GenericMap; 33139}(); 33140/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 33141 33142/***/ }), 33143
33144/***/ "../src/static/js/utils/global-event-listeners.js": 33145/*!********************************************************!*\ 33146 !*** ../src/static/js/utils/global-event-listeners.js ***! 33147 \********************************************************/ 33148/*! no static exports found */ 33149/***/ (function(module, exports) { 33150 33151var iframes = document.querySelectorAll('.rich-text .calx-emd-cal-frame'); 33152 33153if (iframes.length > 0) { 33154 window.addEventListener('message', function (event) { 33155 if (event.origin !== 'https://www.calendarx.com' && event.origin !== 'https://www.addevent.com') { 33156 return; 33157 } 33158 33159 iframes.forEach(function (iframe) { 33160 iframe.style.height = event.data.h + 'px'; 33161 }); 33162 }, false); 33163} 33164 33165var JotFormIFrames = document.querySelectorAll('iframe[id^="JotFormIFrame"]'); 33166JotFormIFrames.forEach(function (ifr) { 33167 if (ifr) { 33168 var src = ifr.src; 33169 var iframeParams = []; 33170 33171 if (window.location.href && window.location.href.indexOf("?") > -1) { 33172 iframeParams = iframeParams.concat(window.location.href.substr(window.location.href.indexOf("?") + 1).split('&')); 33173 } 33174 33175 if (src && src.indexOf("?") > -1) { 33176 iframeParams = iframeParams.concat(src.substr(src.indexOf("?") + 1).split("&")); 33177 src = src.substr(0, src.indexOf("?")); 33178 } 33179 33180 iframeParams.push("isIframeEmbed=1"); 33181 ifr.src = src + "?" + iframeParams.join('&'); 33182 } 33183}); 33184window.addEventListener('load', function () { 33185 var inputCaptchaElements = document.querySelectorAll('.inputCaptcha'); 33186 var inputCaptchaTextareaElements = document.querySelectorAll('.g-recaptcha-response'); 33187 33188 var setHiddenAttributes = function setHiddenAttributes(elements) { 33189 elements.forEach(function (element) { 33190 element.setAttribute('aria-hidden', 'true'); 33191 element.setAttribute('aria-label', 'do not use'); 33192 element.setAttribute('aria-readonly', 'true'); 33193 }); 33194 }; 33195 33196 if (inputCaptchaElements.length > 0 || inputCaptchaTextareaElements.length > 0) { 33197 setHiddenAttributes(inputCaptchaElements); 33198 setHiddenAttributes(inputCaptchaTextareaElements); 33199 } 33200}); 33201 33202/***/ }), 33203
33204/***/ "../src/static/js/utils/global-print.js": 33205/*!**********************************************!*\ 33206 !*** ../src/static/js/utils/global-print.js ***! 33207 \**********************************************/ 33208/*! no static exports found */ 33209/***/ (function(module, exports, __webpack_require__) { 33210 33211/* WEBPACK VAR INJECTION */(function($) {var $pagePrint = $('.breadcrumbs__print'); 33212 33213if ($pagePrint) { 33214 $pagePrint.each(function (key, button) { 33215 $(button).on('click', function (e) { 33216 window.print(); 33217 }); 33218 }); 33219} 33220 33221var $richTextTablesPrint = $('.rich-text table.print'); 33222 33223if ($richTextTablesPrint) { 33224 $richTextTablesPrint.each(function (key, table) { 33225 var $responsiveTable = $(table).parent(); 33226 $responsiveTable.prepend('<a class="table-print">\n' + ' <i>\n' + ' <svg class="ico-print-black">\n' + ' <use xlink:href="/static/images/sprite.svg#ico-print-black"></use>\n' + ' </svg>\n' + ' </i>\n' + ' Print\n' + ' </a>'); 33227 $responsiveTable.find('.table-print').on('click', function (e) { 33228 var WinPrint = window.open('', '');
33229 WinPrint.document.write('<html><head>'); 33230 WinPrint.document.write('<style> table { border-collapse: collapse; } tbody tr th, td { border: 1px solid black;} @media print{@page {size: landscape}} .table-print { display: none; }</style>'); 33231 WinPrint.document.write('</head><body">'); 33232 WinPrint.document.write($responsiveTable.html()); 33233 WinPrint.document.write('</body></html>'); 33234 WinPrint.document.close(); 33235 WinPrint.focus(); 33236 WinPrint.print(); 33237 }); 33238 }); 33239} 33240/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 33241 33242/***/ }), 33243
33244/***/ "../src/static/js/utils/globals.js": 33245/*!*****************************************!*\ 33246 !*** ../src/static/js/utils/globals.js ***! 33247 \*****************************************/ 33248/*! exports provided: $window, $document, $body */ 33249/***/ (function(module, __webpack_exports__, __webpack_require__) { 33250 33251"use strict"; 33252__webpack_require__.r(__webpack_exports__); 33253/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "$window", function() { return $window; }); 33254/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "$document", function() { return $document; }); 33255/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "$body", function() { return $body; }); 33256var $window = $(window); 33257var $document = $(document); 33258var $body = $('body'); 33259/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 33260 33261/***/ }), 33262
33263/***/ "../src/static/js/utils/handle-checkboxes-filter.js": 33264/*!**********************************************************!*\ 33265 !*** ../src/static/js/utils/handle-checkboxes-filter.js ***! 33266 \**********************************************************/ 33267/*! exports provided: handleCheckboxesFilter, handleMainCheckboxFilter */ 33268/***/ (function(module, __webpack_exports__, __webpack_require__) { 33269 33270"use strict"; 33271__webpack_require__.r(__webpack_exports__); 33272/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "handleCheckboxesFilter", function() { return handleCheckboxesFilter; }); 33273/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "handleMainCheckboxFilter", function() { return handleMainCheckboxFilter; }); 33274var handleCheckboxesFilter = function handleCheckboxesFilter($parent) { 33275 $parent.find('input[type="checkbox"]').on('change', function (event) { 33276 var $this = $(this); 33277 var $currentFilter = $this.closest($parent); 33278 var hasMainCheckbox = $currentFilter.hasClass('js-main-checkbox-container'); 33279 var $checkboxesChecked = $currentFilter.find('input[type="checkbox"]:checked'); 33280 var hasChecked = $checkboxesChecked.length > 0; 33281 $currentFilter.toggleClass('counter-is-visible', hasChecked); 33282 var $filterCounter = $currentFilter.find('.js-counter-outer'); 33283 $filterCounter.text($checkboxesChecked.length); 33284 33285 if (hasMainCheckbox) { 33286 $filterCounter = $currentFilter.find('.js-counter-inner'); 33287 $filterCounter.text("[+".concat($checkboxesChecked.length, "]")); 33288 } 33289 33290 var $allGroupCheckboxes = $currentFilter.find('input[type="checkbox"]'); 33291 var areAllChecked = $checkboxesChecked.length === $allGroupCheckboxes.length; 33292 var isOneChecked = $checkboxesChecked.length > 0; 33293 $currentFilter.toggleClass('has-some-active', isOneChecked && !areAllChecked); 33294 }); 33295}; 33296 33297var handleMainCheckboxFilter = function handleMainCheckboxFilter($mainCheckbox) { 33298 $mainCheckbox.on('click', function () { 33299 var $currentFilter = $(this).closest('.js-main-checkbox-container'); 33300 var $parent = $currentFilter.closest('.js-filter-component'); 33301 var $innerCounter = $currentFilter.find('.js-counter-inner'); 33302 var $outerCounter = $parent.find('.js-counter-outer'); 33303 var $checkboxes = $currentFilter.find('ul input[type="checkbox"]'); 33304 var $checkboxesChecked = $currentFilter.find('ul input[type="checkbox"]:checked'); 33305 var areAllChecked = $checkboxes.length !== $checkboxesChecked.length; 33306 $currentFilter.toggleClass('counter-is-visible', areAllChecked); 33307 $currentFilter.find('ul input[type="checkbox"]').prop("checked", areAllChecked); 33308 $currentFilter.removeClass('has-some-active'); 33309 $checkboxesChecked = $currentFilter.find('ul input[type="checkbox"]:checked'); 33310 var $allCheckedBoxes = $parent.find('input[type="checkbox"]:checked'); 33311 $parent.toggleClass('counter-is-visible', $allCheckedBoxes.length > 0); 33312 $innerCounter.text("[+".concat($checkboxesChecked.length, "]")); 33313 $outerCounter.text($allCheckedBoxes.length); 33314 }); 33315}; 33316 33317 33318/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 33319 33320/***/ }), 33321
33322/***/ "../src/static/js/utils/helper.js": 33323/*!****************************************!*\ 33324 !*** ../src/static/js/utils/helper.js ***! 33325 \****************************************/ 33326/*! exports provided: urlContains */ 33327/***/ (function(module, __webpack_exports__, __webpack_require__) { 33328 33329"use strict"; 33330__webpack_require__.r(__webpack_exports__); 33331/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "urlContains", function() { return urlContains; }); 33332function urlContains(searchString) { 33333 if (!searchString || typeof searchString !== 'string') return false; 33334 return window.location.href.toLowerCase().includes(searchString.toLowerCase()); 33335} 33336 33337/***/ }), 33338
33339/***/ "../src/static/js/utils/js-forms.js": 33340/*!******************************************!*\ 33341 !*** ../src/static/js/utils/js-forms.js ***! 33342 \******************************************/ 33343/*! no static exports found */ 33344/***/ (function(module, exports) { 33345 33346function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } 33347 33348function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } 33349 33350function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 33351 33352function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 33353 33354var formDataToObject = function formDataToObject(form) { 33355 var fields = form.querySelectorAll('input, select, textarea'); 33356 var output = {}; 33357 33358 for (var i = 0, imax = fields.length; i < imax; ++i) { 33359 var field = fields[i]; 33360 var sKey = field.name || field.id; 33361 33362 if (field.type === 'button' || field.type === 'image' || field.type === 'submit' || !sKey) { 33363 continue; 33364 } 33365 33366 switch (field.type) { 33367 case 'checkbox': 33368 if (!field.checked) { 33369 break; 33370 } 33371 33372 if (form.querySelectorAll("input[name=\"".concat(field.name, "\"]")).length < 2) { 33373 output[sKey] = field.value; 33374 break; 33375 } 33376 33377 if (typeof output[sKey] === 'undefined') { 33378 output[sKey] = []; 33379 } 33380 33381 output[sKey].push(field.value); 33382 break; 33383 33384 case 'radio': 33385 if (typeof output[sKey] === 'undefined') { 33386 output[sKey] = ''; 33387 } 33388 33389 if (field.checked) { 33390 output[sKey] = field.value; 33391 } 33392 33393 break; 33394 33395 case 'select-multiple': 33396 var entries = []; 33397 33398 for (var j = 0, jmax = field.options.length; j < jmax; ++j) { 33399 if (field.options[j].selected) { 33400 entries.push(field.options[j].value); 33401 } 33402 } 33403 33404 output[sKey] = entries; 33405 break; 33406 33407 case 'file': 33408 var selectedFile = field.files[0]; 33409 output[sKey] = selectedFile; 33410 break; 33411 33412 default: 33413 output[sKey] = field.value; 33414 } 33415 } 33416 33417 return output; 33418}; 33419 33420var submitForm = function submitForm(url, data) { 33421 var xhr = new XMLHttpRequest(); 33422 xhr.open('POST', url); 33423 return new Promise(function (resolve, reject) { 33424 xhr.onreadystatechange = function () { 33425 if (xhr.readyState === XMLHttpRequest.DONE) { 33426 resolve(xhr); 33427 } 33428 }; 33429 33430 xhr.send(data); 33431 }); 33432}; 33433 33434var handleJsForms = function handleJsForms() { 33435 document.querySelectorAll('.coredna-js-form').forEach(handleJsForm); 33436}; 33437 33438var handleJsForm = function handleJsForm(formContainer) { 33439 var formIdField = formContainer.querySelector('input[name="_formId"]'); 33440 33441 if (!formIdField) { 33442 console.error('_formId input is required'); 33443 return; 33444 } 33445 33446 var getCallback = function getCallback(dataFieldName) { 33447 var callbackName = formContainer.dataset[dataFieldName] || null; 33448 33449 if (!callbackName) { 33450 return null; 33451 } 33452 33453 return typeof window[callbackName] === 'function' ? window[callbackName] : null; 33454 }; 33455 33456 var formId = formIdField.value; 33457 var steps = Array.from(formContainer.querySelectorAll('.form-step')); 33458 var forms = Array.from(formContainer.querySelectorAll('.form-step form')); 33459 var elements = Array.from(formContainer.querySelectorAll('input, select, textarea')); 33460 var lastStep = steps[steps.length - 1]; 33461 var lastForm = forms[forms.length - 1]; 33462 var redirectUrl = formContainer.querySelector('input[name="_redirectUrl"]'); 33463 var endpoint = (formContainer.dataset.endpoint || '/cdna-api/forms/submission/FORM_ID').replace('FORM_ID', formId); 33464 var formStarted = false;
33465 var currentStep = steps[0]; 33466 var formStartedCallback = getCallback('startCallback'); 33467 var navigateCallback = getCallback('navigateCallback'); 33468 var submitModifierCallback = getCallback('submitModifierCallback'); 33469 var submitCallback = getCallback('submitCallback'); 33470 var submitResultCallback = getCallback('submitResultCallback'); 33471 33472 var handleSubmitError = function handleSubmitError(response, form) { 33473 var submitButtons = currentStep.querySelectorAll('button[type="submit"], input[type="submit"]'); 33474 submitButtons.forEach(function (button) { 33475 button.removeAttribute('disabled'); 33476 }); 33477 var currentStepErrorMessages = currentStep.querySelectorAll('.submit-error-message'); 33478 currentStepErrorMessages.forEach(function (messageContainer) { 33479 messageContainer.classList.remove('js-hidden'); 33480 33481 if (!response.message) { 33482 return; 33483 } 33484 33485 if (response.validationErrors) { 33486 var errors = response.validationErrors; 33487 33488 var _loop = function _loop(key) { 33489 errors[key].forEach(function (error) { 33490 if (error.message) { 33491 var formFieldWrapper = form.querySelector("[name=\"".concat(key, "\"]")).closest('.base-element-block.input-element-block'); 33492 33493 if (formFieldWrapper) { 33494 formFieldWrapper.innerHTML += "<div class=\"input-element-validation-errors\">".concat(error.message, "</div>"); 33495 } 33496 } 33497 }); 33498 }; 33499 33500 for (var key in errors) { 33501 _loop(key); 33502 } 33503 } 33504 33505 typeof messageContainer.dataset.originalHtml === 'undefined' ? messageContainer.dataset.originalHtml = messageContainer.innerHTML : messageContainer.innerHTML = messageContainer.dataset.originalHtml; 33506 messageContainer.dataset.originalHtml.indexOf('%message%') === -1 ? messageContainer.innerHTML = response.message : messageContainer.innerHTML = messageContainer.dataset.originalHtml.replace(/%message%/, response.message); 33507 }); 33508 }; 33509 33510 var handleSubmitInProgress = function handleSubmitInProgress() { 33511 var currentStepErrorMessages = currentStep.querySelectorAll('.submit-error-message'); 33512 currentStepErrorMessages.forEach(function (container) { 33513 container.classList.add('js-hidden'); 33514 }); 33515 var submitButtons = currentStep.querySelectorAll('button[type="submit"], input[type="submit"]'); 33516 submitButtons.forEach(function (button) { 33517 button.setAttribute('disabled', 'disabled'); 33518 }); 33519 }; 33520 33521 var handleResponse = function handleResponse(xhr, form) { 33522 if (xhr.status >= 199 && xhr.status < 300) { 33523 if (redirectUrl) { 33524 window.location.replace(redirectUrl.value); 33525 return; 33526 } 33527 33528 navigateToStep(lastStep); 33529 return; 33530 } 33531 33532 if (xhr.response) { 33533 var jsonResponse = JSON.parse(xhr.response); 33534 handleSubmitError(_typeof(jsonResponse) === 'object' && typeof jsonResponse.message === 'string' ? jsonResponse : '', form); 33535 } 33536 }; 33537 33538 var getAllFormData = function getAllFormData() { 33539 var formData = new FormData(); 33540 forms.forEach(function (form) { 33541 var fields = formDataToObject(form); 33542 Object.keys(fields).forEach(function (key) { 33543 formData.append(key, fields[key]); 33544 }); 33545 }); 33546 return formData; 33547 }; 33548 33549 var compileCallbackData = function compileCallbackData(additionalData) { 33550 return _objectSpread({ 33551 currentStepNumber: parseInt(currentStep.dataset.step), 33552 currentStep: currentStep, 33553 formContainer: formContainer, 33554 formId: formId 33555 }, additionalData); 33556 }; 33557 33558 var navigateToStep = function navigateToStep(requestedStep) { 33559 var callbackData = compileCallbackData({ 33560 data: getAllFormData(), 33561 requestedStep: requestedStep, 33562 requestedStepNumber: parseInt(requestedStep.dataset.step) 33563 }); 33564 Promise.resolve(typeof navigateCallback === 'function' ? navigateCallback(callbackData) : true).then(function (result) { 33565 if (result === false) { 33566 return; 33567 } 33568 33569 changedDisplayedStep(requestedStep); 33570 }).catch(function (err) { 33571 if (err) { 33572 console.error(err); 33573 } 33574 }); 33575 }; 33576 33577 var changedDisplayedStep = function changedDisplayedStep(requestedStep) { 33578 currentStep.classList.add('js-hidden'); 33579 requestedStep.classList.remove('js-hidden'); 33580 currentStep = requestedStep; 33581 }; 33582 33583 var handleElementAction = function handleElementAction(event) { 33584 if (formStarted) { 33585 return; 33586 } 33587 33588 if (formStartedCallback) { 33589 formStartedCallback(compileCallbackData({ 33590 event: event 33591 })); 33592 } 33593 33594 formStarted = true; 33595 }; 33596 33597 if (formStartedCallback) {
33598 elements.forEach(function (element) { 33599 element.addEventListener('keyup', handleElementAction); 33600 element.addEventListener('change', handleElementAction); 33601 }); 33602 } 33603 33604 steps.forEach(function (step, index) { 33605 step.dataset.step = (index + 1).toString(); 33606 step.querySelectorAll('.navigate-previous').forEach(function (element) { 33607 var requestedStepNr = index - 1; 33608 element.addEventListener('click', function (event) { 33609 event.preventDefault(); 33610 33611 if (typeof steps[requestedStepNr] === 'undefined') { 33612 console.error('Can not navigate to previous step, as no previous step exists'); 33613 return; 33614 } 33615 33616 navigateToStep(steps[requestedStepNr]); 33617 }); 33618 }); 33619 step.querySelectorAll('.go-to-step').forEach(function (element) { 33620 if (!element.dataset.step) { 33621 console.error('Expected data-step with 1-based target step number on element', element); 33622 return; 33623 } 33624 33625 var requestedStepNr = parseInt(element.dataset.step) - 1; 33626 element.addEventListener('click', function (event) { 33627 event.preventDefault(); 33628 33629 if (typeof steps[requestedStepNr] === 'undefined') { 33630 console.error("Can not navigate to target step, as step with 1-based index ".concat(element.dataset.step, " does not exist")); 33631 return; 33632 } 33633 33634 navigateToStep(steps[requestedStepNr]); 33635 }); 33636 }); 33637 }); 33638 forms.forEach(function (form, index) { 33639 if (form === lastForm) { 33640 return; 33641 } 33642 33643 form.addEventListener('submit', function (event) { 33644 var requestedStep = steps[parseInt(currentStep.dataset.step)]; 33645 event.preventDefault(); 33646 navigateToStep(requestedStep); 33647 }); 33648 }); 33649 lastForm.addEventListener('submit', function (event) { 33650 event.preventDefault(); 33651 handleSubmitInProgress(); 33652 var allFormData = getAllFormData(); 33653 var submitModifierCallbackData = compileCallbackData({ 33654 resultStepNumber: parseInt(lastStep.dataset.step), 33655 resultStep: lastStep, 33656 data: allFormData, 33657 event: event 33658 }); 33659 Promise.resolve(typeof submitModifierCallback === 'function' ? submitModifierCallback(submitModifierCallbackData) : allFormData).then(function (allFormData) { 33660 var submitCallbackData = compileCallbackData({ 33661 resultStepNumber: parseInt(lastStep.dataset.step), 33662 resultStep: lastStep, 33663 data: allFormData, 33664 event: event 33665 }); 33666 33667 var handleSubmitFormResult = function handleSubmitFormResult(xhr) { 33668 if (typeof submitResultCallback !== 'function') { 33669 handleResponse(xhr, event.target); 33670 return; 33671 } 33672 33673 var resultCallbackData = compileCallbackData({ 33674 resultStepNumber: parseInt(lastStep.dataset.step), 33675 resultStep: lastStep, 33676 data: allFormData, 33677 xhr: xhr 33678 }); 33679 Promise.resolve(submitResultCallback(resultCallbackData)).then(function (result) { 33680 if (result) { 33681 handleResponse(xhr, event.target); 33682 } 33683 }).catch(function (err) { 33684 if (err) { 33685 console.error(err); 33686 } 33687 }); 33688 }; 33689 33690 Promise.resolve(typeof submitCallback === 'function' ? submitCallback(submitCallbackData) : true).then(function (response) { 33691 if (response === false) { 33692 return; 33693 } 33694 33695 submitForm(endpoint, allFormData).then(handleSubmitFormResult).catch(handleSubmitFormResult); 33696 }).catch(function (err) { 33697 if (err) { 33698 console.error(err); 33699 } 33700 }); 33701 }); 33702 }); 33703}; 33704 33705if (document.readyState !== 'loading') { 33706 handleJsForms(); 33707} else { 33708 document.addEventListener('DOMContentLoaded', handleJsForms); 33709} 33710 33711/***/ }), 33712
33713/***/ "../src/static/js/utils/utm-capture.js": 33714/*!*********************************************!*\ 33715 !*** ../src/static/js/utils/utm-capture.js ***! 33716 \*********************************************/ 33717/*! exports provided: captureUTMParameters */ 33718/***/ (function(module, __webpack_exports__, __webpack_require__) { 33719 33720"use strict"; 33721__webpack_require__.r(__webpack_exports__); 33722/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "captureUTMParameters", function() { return captureUTMParameters; }); 33723/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! js-cookie */ "../node_modules/js-cookie/dist/js.cookie.js"); 33724/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(js_cookie__WEBPACK_IMPORTED_MODULE_0__); 33725function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 33726 33727function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 33728 33729function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 33730 33731function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 33732 33733function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } 33734 33735function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 33736 33737function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 33738 33739 33740var captureUTMParameters = function captureUTMParameters() { 33741 var urlParams = new URLSearchParams(window.location.search); 33742 var utmParameters = {}; 33743 33744 var _iterator = _createForOfIteratorHelper(urlParams.entries()), 33745 _step; 33746 33747 try { 33748 for (_iterator.s(); !(_step = _iterator.n()).done;) { 33749 var _step$value = _slicedToArray(_step.value, 2), 33750 param = _step$value[0], 33751 value = _step$value[1]; 33752 33753 if (param.startsWith('utm_')) { 33754 utmParameters[param] = value; 33755 } 33756 } 33757 } catch (err) { 33758 _iterator.e(err); 33759 } finally { 33760 _iterator.f(); 33761 } 33762 33763 if (Object.keys(utmParameters).length > 0) { 33764 localStorage.setItem('utmParameters', JSON.stringify(utmParameters)); 33765 } 33766 33767 var currentURLWithoutParams = window.location.origin + window.location.pathname; 33768 localStorage.setItem('currentURLWithoutParams', currentURLWithoutParams);
33769 localStorage.setItem('consentToTrack', 'Unchanged'); 33770 33771 if (js_cookie__WEBPACK_IMPORTED_MODULE_0___default.a.get('ymcaHub')) { 33772 localStorage.setItem('consentToTrack', 'Yes'); 33773 } 33774 33775 fillFormFields(); 33776}; 33777 33778var fillFormFields = function fillFormFields() { 33779 var forms = document.querySelectorAll('form'); 33780 var utmParameters = JSON.parse(localStorage.getItem('utmParameters')); 33781 var currentURLWithoutParams = localStorage.getItem('currentURLWithoutParams'); 33782 var consentToTrack = localStorage.getItem('consentToTrack'); 33783 forms.forEach(function (form) { 33784 var formFields = form.elements; 33785 33786 var _iterator2 = _createForOfIteratorHelper(formFields), 33787 _step2; 33788 33789 try { 33790 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { 33791 var field = _step2.value; 33792 33793 if (field.name === 'url') { 33794 field.value = currentURLWithoutParams; 33795 } else if (field.name === 'ConsentToTrack') { 33796 field.value = consentToTrack; 33797 } else if (utmParameters && utmParameters.hasOwnProperty(field.name)) { 33798 field.value = utmParameters[field.name]; 33799 } 33800 } 33801 } catch (err) { 33802 _iterator2.e(err); 33803 } finally { 33804 _iterator2.f(); 33805 } 33806 }); 33807}; 33808 33809captureUTMParameters(); 33810 33811/***/ })
33811, 33812 33813/***/ "jquery": 33814/*!*************************!*\ 33815 !*** external "jQuery" ***! 33816 \*************************/ 33817/*! no static exports found */ 33818/***/ (function(module, exports) { 33819 33820module.exports = jQuery; 33821 33822/***/ }) 33823 33824/******/ });
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.