vendor: 4,823 bytes, lines 1-148
1/*� *� * /modules/nsUtilities-bundle/nsg-module-feedback/assets/js/handlebars-v4.0.10.js� *�*//**! 2 3 @license 4 handlebars v4.0.10 5 6Copyright (C) 2011-2016 by Yehuda Katz 7 8Permission is hereby granted, free of charge, to any person obtaining a copy 9of this software and associated documentation files (the "Software"), to deal 10in the Software without restriction, including without limitation the rights 11to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12copies of the Software, and to permit persons to whom the Software is 13furnished to do so, subject to the following conditions: 14 15The above copyright notice and this permission notice shall be included in 16all copies or substantial portions of the Software. 17 18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24THE SOFTWARE. 25 26*/ 27(function webpackUniversalModuleDefinition(root, factory) { 28 if(typeof exports === 'object' && typeof module === 'object') 29 module.exports = factory(); 30 else if(typeof define === 'function' && define.amd) 31 define([], factory); 32 else if(typeof exports === 'object') 33 exports["Handlebars"] = factory(); 34 else 35 root["Handlebars"] = factory(); 36})(this, function() { 37return /******/ (function(modules) { // webpackBootstrap 38/******/ // The module cache 39/******/ var installedModules = {}; 40 41/******/ // The require function 42/******/ function __webpack_require__(moduleId) { 43 44/******/ // Check if module is in cache 45/******/ if(installedModules[moduleId]) 46/******/ return installedModules[moduleId].exports; 47 48/******/ // Create a new module (and put it into the cache) 49/******/ var module = installedModules[moduleId] = { 50/******/ exports: {}, 51/******/ id: moduleId, 52/******/ loaded: false 53/******/ }; 54 55/******/ // Execute the module function 56/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 57 58/******/ // Flag the module as loaded 59/******/ module.loaded = true; 60 61/******/ // Return the exports of the module 62/******/ return module.exports; 63/******/ } 64 65 66/******/ // expose the modules object (__webpack_modules__) 67/******/ __webpack_require__.m = modules; 68 69/******/ // expose the module cache 70/******/ __webpack_require__.c = installedModules; 71 72/******/ // __webpack_public_path__ 73/******/ __webpack_require__.p = ""; 74 75/******/ // Load entry module and return exports 76/******/ return __webpack_require__(0); 77/******/ }) 78/************************************************************************/ 79/******/ ([ 80/* 0 */ 81/***/ (function(module, exports, __webpack_require__) { 82 83 'use strict'; 84 85 var _interopRequireDefault = __webpack_require__(1)['default']; 86 87 exports.__esModule = true; 88 89 var _handlebarsRuntime = __webpack_require__(2); 90 91 var _handlebarsRuntime2 = _interopRequireDefault(_handlebarsRuntime); 92 93 // Compiler imports 94 95 var _handlebarsCompilerAst = __webpack_require__(35); 96 97 var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst); 98 99 var _handlebarsCompilerBase = __webpack_require__(36); 100 101 var _handlebarsCompilerCompiler = __webpack_require__(41); 102 103 var _handlebarsCompilerJavascriptCompiler = __webpack_require__(42); 104 105 var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler); 106 107 var _handlebarsCompilerVisitor = __webpack_require__(39); 108 109 var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor); 110 111 var _handlebarsNoConflict = __webpack_require__(34); 112 113 var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 114 115 var _create = _handlebarsRuntime2['default'].create; 116 function create() { 117 var hb = _create(); 118 119 hb.compile = function (input, options) { 120 return _handlebarsCompilerCompiler.compile(input, options, hb); 121 }; 122 hb.precompile = function (input, options) { 123 return _handlebarsCompilerCompiler.precompile(input, options, hb); 124 }; 125 126 hb.AST = _handlebarsCompilerAst2['default']; 127 hb.Compiler = _handlebarsCompilerCompiler.Compiler; 128 hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default']; 129 hb.Parser = _handlebarsCompilerBase.parser; 130 hb.parse = _handlebarsCompilerBase.parse; 131 132 return hb; 133 } 134 135 var inst = create(); 136 inst.create = create; 137 138 _handlebarsNoConflict2['default'](inst); 139 140 inst.Visitor = _handlebarsCompilerVisitor2['default']; 141 142 inst['default'] = inst; 143 144 exports['default'] = inst; 145 module.exports = exports['default']; 146 147/***/ }), 148/* 1 */
vendor: 5,342 bytes, lines 149-361
149/***/ (function(module, exports) { 150 151 "use strict"; 152 153 exports["default"] = function (obj) { 154 return obj && obj.__esModule ? obj : { 155 "default": obj 156 }; 157 }; 158 159 exports.__esModule = true; 160 161/***/ }), 162/* 2 */ 163/***/ (function(module, exports, __webpack_require__) { 164 165 'use strict'; 166 167 var _interopRequireWildcard = __webpack_require__(3)['default']; 168 169 var _interopRequireDefault = __webpack_require__(1)['default']; 170 171 exports.__esModule = true; 172 173 var _handlebarsBase = __webpack_require__(4); 174 175 var base = _interopRequireWildcard(_handlebarsBase); 176 177 // Each of these augment the Handlebars object. No need to setup here. 178 // (This is done to easily share code between commonjs and browse envs) 179 180 var _handlebarsSafeString = __webpack_require__(21); 181 182 var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); 183 184 var _handlebarsException = __webpack_require__(6); 185 186 var _handlebarsException2 = _interopRequireDefault(_handlebarsException); 187 188 var _handlebarsUtils = __webpack_require__(5); 189 190 var Utils = _interopRequireWildcard(_handlebarsUtils); 191 192 var _handlebarsRuntime = __webpack_require__(22); 193 194 var runtime = _interopRequireWildcard(_handlebarsRuntime); 195 196 var _handlebarsNoConflict = __webpack_require__(34); 197 198 var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 199 200 // For compatibility and usage outside of module systems, make the Handlebars object a namespace 201 function create() { 202 var hb = new base.HandlebarsEnvironment(); 203 204 Utils.extend(hb, base); 205 hb.SafeString = _handlebarsSafeString2['default']; 206 hb.Exception = _handlebarsException2['default']; 207 hb.Utils = Utils; 208 hb.escapeExpression = Utils.escapeExpression; 209 210 hb.VM = runtime; 211 hb.template = function (spec) { 212 return runtime.template(spec, hb); 213 }; 214 215 return hb; 216 } 217 218 var inst = create(); 219 inst.create = create; 220 221 _handlebarsNoConflict2['default'](inst); 222 223 inst['default'] = inst; 224 225 exports['default'] = inst; 226 module.exports = exports['default']; 227 228/***/ }), 229/* 3 */ 230/***/ (function(module, exports) { 231 232 "use strict"; 233 234 exports["default"] = function (obj) { 235 if (obj && obj.__esModule) { 236 return obj; 237 } else { 238 var newObj = {}; 239 240 if (obj != null) { 241 for (var key in obj) { 242 if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; 243 } 244 } 245 246 newObj["default"] = obj; 247 return newObj; 248 } 249 }; 250 251 exports.__esModule = true; 252 253/***/ }), 254/* 4 */ 255/***/ (function(module, exports, __webpack_require__) { 256 257 'use strict'; 258 259 var _interopRequireDefault = __webpack_require__(1)['default']; 260 261 exports.__esModule = true; 262 exports.HandlebarsEnvironment = HandlebarsEnvironment; 263 264 var _utils = __webpack_require__(5); 265 266 var _exception = __webpack_require__(6); 267 268 var _exception2 = _interopRequireDefault(_exception); 269 270 var _helpers = __webpack_require__(10); 271 272 var _decorators = __webpack_require__(18); 273 274 var _logger = __webpack_require__(20); 275 276 var _logger2 = _interopRequireDefault(_logger); 277 278 var VERSION = '4.0.10'; 279 exports.VERSION = VERSION; 280 var COMPILER_REVISION = 7; 281 282 exports.COMPILER_REVISION = COMPILER_REVISION; 283 var REVISION_CHANGES = { 284 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 285 2: '== 1.0.0-rc.3', 286 3: '== 1.0.0-rc.4', 287 4: '== 1.x.x', 288 5: '== 2.0.0-alpha.x', 289 6: '>= 2.0.0-beta.1', 290 7: '>= 4.0.0' 291 }; 292 293 exports.REVISION_CHANGES = REVISION_CHANGES; 294 var objectType = '[object Object]'; 295 296 function HandlebarsEnvironment(helpers, partials, decorators) { 297 this.helpers = helpers || {}; 298 this.partials = partials || {}; 299 this.decorators = decorators || {}; 300 301 _helpers.registerDefaultHelpers(this); 302 _decorators.registerDefaultDecorators(this); 303 } 304 305 HandlebarsEnvironment.prototype = { 306 constructor: HandlebarsEnvironment, 307 308 logger: _logger2['default'], 309 log: _logger2['default'].log, 310 311 registerHelper: function registerHelper(name, fn) { 312 if (_utils.toString.call(name) === objectType) { 313 if (fn) { 314 throw new _exception2['default']('Arg not supported with multiple helpers'); 315 } 316 _utils.extend(this.helpers, name); 317 } else { 318 this.helpers[name] = fn; 319 } 320 }, 321 unregisterHelper: function unregisterHelper(name) { 322 delete this.helpers[name]; 323 }, 324 325 registerPartial: function registerPartial(name, partial) { 326 if (_utils.toString.call(name) === objectType) { 327 _utils.extend(this.partials, name); 328 } else { 329 if (typeof partial === 'undefined') { 330 throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); 331 } 332 this.partials[name] = partial; 333 } 334 }, 335 unregisterPartial: function unregisterPartial(name) { 336 delete this.partials[name]; 337 }, 338 339 registerDecorator: function registerDecorator(name, fn) { 340 if (_utils.toString.call(name) === objectType) { 341 if (fn) { 342 throw new _exception2['default']('Arg not supported with multiple decorators'); 343 } 344 _utils.extend(this.decorators, name); 345 } else { 346 this.decorators[name] = fn; 347 } 348 }, 349 unregisterDecorator: function unregisterDecorator(name) { 350 delete this.decorators[name]; 351 } 352 }; 353 354 var log = _logger2['default'].log; 355 356 exports.log = log; 357 exports.createFrame = _utils.createFrame; 358 exports.logger = _logger2['default']; 359 360/***/ }), 361/* 5 */
vendor: 10,036 bytes, lines 362-746
362/***/ (function(module, exports) { 363 364 'use strict'; 365 366 exports.__esModule = true; 367 exports.extend = extend; 368 exports.indexOf = indexOf; 369 exports.escapeExpression = escapeExpression; 370 exports.isEmpty = isEmpty; 371 exports.createFrame = createFrame; 372 exports.blockParams = blockParams; 373 exports.appendContextPath = appendContextPath; 374 var escape = { 375 '&': '&', 376 '<': '<', 377 '>': '>', 378 '"': '"', 379 "'": ''', 380 '`': '`', 381 '=': '=' 382 }; 383 384 var badChars = /[&<>"'`=]/g, 385 possible = /[&<>"'`=]/; 386 387 function escapeChar(chr) { 388 return escape[chr]; 389 } 390 391 function extend(obj /* , ...source */) { 392 for (var i = 1; i < arguments.length; i++) { 393 for (var key in arguments[i]) { 394 if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { 395 obj[key] = arguments[i][key]; 396 } 397 } 398 } 399 400 return obj; 401 } 402 403 var toString = Object.prototype.toString; 404 405 exports.toString = toString; 406 // Sourced from lodash 407 // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt 408 /* eslint-disable func-style */ 409 var isFunction = function isFunction(value) { 410 return typeof value === 'function'; 411 }; 412 // fallback for older versions of Chrome and Safari 413 /* istanbul ignore next */ 414 if (isFunction(/x/)) { 415 exports.isFunction = isFunction = function (value) { 416 return typeof value === 'function' && toString.call(value) === '[object Function]'; 417 }; 418 } 419 exports.isFunction = isFunction; 420 421 /* eslint-enable func-style */ 422 423 /* istanbul ignore next */ 424 var isArray = Array.isArray || function (value) { 425 return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; 426 }; 427 428 exports.isArray = isArray; 429 // Older IE versions do not directly support indexOf so we must implement our own, sadly. 430 431 function indexOf(array, value) { 432 for (var i = 0, len = array.length; i < len; i++) { 433 if (array[i] === value) { 434 return i; 435 } 436 } 437 return -1; 438 } 439 440 function escapeExpression(string) { 441 if (typeof string !== 'string') { 442 // don't escape SafeStrings, since they're already safe 443 if (string && string.toHTML) { 444 return string.toHTML(); 445 } else if (string == null) { 446 return ''; 447 } else if (!string) { 448 return string + ''; 449 } 450 451 // Force a string conversion as this will be done by the append regardless and 452 // the regex test will do this transparently behind the scenes, causing issues if 453 // an object's to string has escaped characters in it. 454 string = '' + string; 455 } 456 457 if (!possible.test(string)) { 458 return string; 459 } 460 return string.replace(badChars, escapeChar); 461 } 462 463 function isEmpty(value) { 464 if (!value && value !== 0) { 465 return true; 466 } else if (isArray(value) && value.length === 0) { 467 return true; 468 } else { 469 return false; 470 } 471 } 472 473 function createFrame(object) { 474 var frame = extend({}, object); 475 frame._parent = object; 476 return frame; 477 } 478 479 function blockParams(params, ids) { 480 params.path = ids; 481 return params; 482 } 483 484 function appendContextPath(contextPath, id) { 485 return (contextPath ? contextPath + '.' : '') + id; 486 } 487 488/***/ }), 489/* 6 */ 490/***/ (function(module, exports, __webpack_require__) { 491 492 'use strict'; 493 494 var _Object$defineProperty = __webpack_require__(7)['default']; 495 496 exports.__esModule = true; 497 498 var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; 499 500 function Exception(message, node) { 501 var loc = node && node.loc, 502 line = undefined, 503 column = undefined; 504 if (loc) { 505 line = loc.start.line; 506 column = loc.start.column; 507 508 message += ' - ' + line + ':' + column; 509 } 510 511 var tmp = Error.prototype.constructor.call(this, message); 512 513 // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. 514 for (var idx = 0; idx < errorProps.length; idx++) { 515 this[errorProps[idx]] = tmp[errorProps[idx]]; 516 } 517 518 /* istanbul ignore else */ 519 if (Error.captureStackTrace) { 520 Error.captureStackTrace(this, Exception); 521 } 522 523 try { 524 if (loc) { 525 this.lineNumber = line; 526 527 // Work around issue under safari where we can't directly set the column value 528 /* istanbul ignore next */ 529 if (_Object$defineProperty) { 530 Object.defineProperty(this, 'column', { 531 value: column, 532 enumerable: true 533 }); 534 } else { 535 this.column = column; 536 } 537 } 538 } catch (nop) { 539 /* Ignore if the browser is very particular */ 540 } 541 } 542 543 Exception.prototype = new Error(); 544 545 exports['default'] = Exception; 546 module.exports = exports['default']; 547 548/***/ }), 549/* 7 */ 550/***/ (function(module, exports, __webpack_require__) { 551 552 module.exports = { "default": __webpack_require__(8), __esModule: true }; 553 554/***/ }), 555/* 8 */ 556/***/ (function(module, exports, __webpack_require__) { 557 558 var $ = __webpack_require__(9); 559 module.exports = function defineProperty(it, key, desc){ 560 return $.setDesc(it, key, desc); 561 }; 562 563/***/ }), 564/* 9 */ 565/***/ (function(module, exports) { 566 567 var $Object = Object; 568 module.exports = { 569 create: $Object.create, 570 getProto: $Object.getPrototypeOf, 571 isEnum: {}.propertyIsEnumerable, 572 getDesc: $Object.getOwnPropertyDescriptor, 573 setDesc: $Object.defineProperty, 574 setDescs: $Object.defineProperties, 575 getKeys: $Object.keys, 576 getNames: $Object.getOwnPropertyNames, 577 getSymbols: $Object.getOwnPropertySymbols, 578 each: [].forEach 579 }; 580 581/***/ }), 582/* 10 */ 583/***/ (function(module, exports, __webpack_require__) { 584 585 'use strict'; 586 587 var _interopRequireDefault = __webpack_require__(1)['default']; 588 589 exports.__esModule = true; 590 exports.registerDefaultHelpers = registerDefaultHelpers; 591 592 var _helpersBlockHelperMissing = __webpack_require__(11); 593 594 var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); 595 596 var _helpersEach = __webpack_require__(12); 597 598 var _helpersEach2 = _interopRequireDefault(_helpersEach); 599 600 var _helpersHelperMissing = __webpack_require__(13); 601 602 var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); 603 604 var _helpersIf = __webpack_require__(14); 605 606 var _helpersIf2 = _interopRequireDefault(_helpersIf); 607 608 var _helpersLog = __webpack_require__(15); 609 610 var _helpersLog2 = _interopRequireDefault(_helpersLog); 611 612 var _helpersLookup = __webpack_require__(16); 613 614 var _helpersLookup2 = _interopRequireDefault(_helpersLookup); 615 616 var _helpersWith = __webpack_require__(17); 617 618 var _helpersWith2 = _interopRequireDefault(_helpersWith); 619 620 function registerDefaultHelpers(instance) { 621 _helpersBlockHelperMissing2['default'](instance); 622 _helpersEach2['default'](instance); 623 _helpersHelperMissing2['default'](instance); 624 _helpersIf2['default'](instance); 625 _helpersLog2['default'](instance); 626 _helpersLookup2['default'](instance); 627 _helpersWith2['default'](instance); 628 } 629 630/***/ }), 631/* 11 */ 632/***/ (function(module, exports, __webpack_require__) { 633 634 'use strict'; 635 636 exports.__esModule = true; 637 638 var _utils = __webpack_require__(5); 639 640 exports['default'] = function (instance) { 641 instance.registerHelper('blockHelperMissing', function (context, options) { 642 var inverse = options.inverse, 643 fn = options.fn; 644 645 if (context === true) { 646 return fn(this); 647 } else if (context === false || context == null) { 648 return inverse(this); 649 } else if (_utils.isArray(context)) { 650 if (context.length > 0) { 651 if (options.ids) { 652 options.ids = [options.name]; 653 } 654 655 return instance.helpers.each(context, options); 656 } else { 657 return inverse(this); 658 } 659 } else { 660 if (options.data && options.ids) { 661 var data = _utils.createFrame(options.data); 662 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); 663 options = { data: data }; 664 } 665 666 return fn(context, options); 667 } 668 }); 669 }; 670 671 module.exports = exports['default']; 672 673/***/ }), 674/* 12 */ 675/***/ (function(module, exports, __webpack_require__) { 676 677 'use strict'; 678 679 var _interopRequireDefault = __webpack_require__(1)['default']; 680 681 exports.__esModule = true; 682 683 var _utils = __webpack_require__(5); 684 685 var _exception = __webpack_require__(6); 686 687 var _exception2 = _interopRequireDefault(_exception); 688 689 exports['default'] = function (instance) { 690 instance.registerHelper('each', function (context, options) { 691 if (!options) { 692 throw new _exception2['default']('Must pass iterator to #each'); 693 } 694 695 var fn = options.fn, 696 inverse = options.inverse, 697 i = 0, 698 ret = '', 699 data = undefined, 700 contextPath = undefined; 701 702 if (options.data && options.ids) { 703 contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; 704 } 705 706 if (_utils.isFunction(context)) { 707 context = context.call(this); 708 } 709 710 if (options.data) { 711 data = _utils.createFrame(options.data); 712 } 713 714 function execIteration(field, index, last) { 715 if (data) { 716 data.key = field; 717 data.index = index; 718 data.first = index === 0; 719 data.last = !!last; 720 721 if (contextPath) { 722 data.contextPath = contextPath + field; 723 } 724 } 725 726 ret = ret + fn(context[field], { 727 data: data, 728 blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) 729 }); 730 } 731 732 if (context && typeof context === 'object') { 733 if (_utils.isArray(context)) { 734 for (var j = context.length; i < j; i++) { 735 if (i in context) { 736 execIteration(i, i, i === context.length - 1); 737 } 738 } 739 } else { 740 var priorKey = undefined; 741 742 for (var key in context) { 743 if (context.hasOwnProperty(key)) { 744 // We're running the iterations one step out of sync so we can detect 745 // the last iteration without have to scan the object twice and create 746 // an itermediate keys array.
vendor: 17,949 bytes, lines 747-1356
747 if (priorKey !== undefined) { 748 execIteration(priorKey, i - 1); 749 } 750 priorKey = key; 751 i++; 752 } 753 } 754 if (priorKey !== undefined) { 755 execIteration(priorKey, i - 1, true); 756 } 757 } 758 } 759 760 if (i === 0) { 761 ret = inverse(this); 762 } 763 764 return ret; 765 }); 766 }; 767 768 module.exports = exports['default']; 769 770/***/ }), 771/* 13 */ 772/***/ (function(module, exports, __webpack_require__) { 773 774 'use strict'; 775 776 var _interopRequireDefault = __webpack_require__(1)['default']; 777 778 exports.__esModule = true; 779 780 var _exception = __webpack_require__(6); 781 782 var _exception2 = _interopRequireDefault(_exception); 783 784 exports['default'] = function (instance) { 785 instance.registerHelper('helperMissing', function () /* [args, ]options */{ 786 if (arguments.length === 1) { 787 // A missing field in a {{foo}} construct. 788 return undefined; 789 } else { 790 // Someone is actually trying to call something, blow up. 791 throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); 792 } 793 }); 794 }; 795 796 module.exports = exports['default']; 797 798/***/ }), 799/* 14 */ 800/***/ (function(module, exports, __webpack_require__) { 801 802 'use strict'; 803 804 exports.__esModule = true; 805 806 var _utils = __webpack_require__(5); 807 808 exports['default'] = function (instance) { 809 instance.registerHelper('if', function (conditional, options) { 810 if (_utils.isFunction(conditional)) { 811 conditional = conditional.call(this); 812 } 813 814 // Default behavior is to render the positive path if the value is truthy and not empty. 815 // The `includeZero` option may be set to treat the condtional as purely not empty based on the 816 // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. 817 if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { 818 return options.inverse(this); 819 } else { 820 return options.fn(this); 821 } 822 }); 823 824 instance.registerHelper('unless', function (conditional, options) { 825 return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); 826 }); 827 }; 828 829 module.exports = exports['default']; 830 831/***/ }), 832/* 15 */ 833/***/ (function(module, exports) { 834 835 'use strict'; 836 837 exports.__esModule = true; 838 839 exports['default'] = function (instance) { 840 instance.registerHelper('log', function () /* message, options */{ 841 var args = [undefined], 842 options = arguments[arguments.length - 1]; 843 for (var i = 0; i < arguments.length - 1; i++) { 844 args.push(arguments[i]); 845 } 846 847 var level = 1; 848 if (options.hash.level != null) { 849 level = options.hash.level; 850 } else if (options.data && options.data.level != null) { 851 level = options.data.level; 852 } 853 args[0] = level; 854 855 instance.log.apply(instance, args); 856 }); 857 }; 858 859 module.exports = exports['default']; 860 861/***/ }), 862/* 16 */ 863/***/ (function(module, exports) { 864 865 'use strict'; 866 867 exports.__esModule = true; 868 869 exports['default'] = function (instance) { 870 instance.registerHelper('lookup', function (obj, field) { 871 return obj && obj[field]; 872 }); 873 }; 874 875 module.exports = exports['default']; 876 877/***/ }), 878/* 17 */ 879/***/ (function(module, exports, __webpack_require__) { 880 881 'use strict'; 882 883 exports.__esModule = true; 884 885 var _utils = __webpack_require__(5); 886 887 exports['default'] = function (instance) { 888 instance.registerHelper('with', function (context, options) { 889 if (_utils.isFunction(context)) { 890 context = context.call(this); 891 } 892 893 var fn = options.fn; 894 895 if (!_utils.isEmpty(context)) { 896 var data = options.data; 897 if (options.data && options.ids) { 898 data = _utils.createFrame(options.data); 899 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); 900 } 901 902 return fn(context, { 903 data: data, 904 blockParams: _utils.blockParams([context], [data && data.contextPath]) 905 }); 906 } else { 907 return options.inverse(this); 908 } 909 }); 910 }; 911 912 module.exports = exports['default']; 913 914/***/ }), 915/* 18 */ 916/***/ (function(module, exports, __webpack_require__) { 917 918 'use strict'; 919 920 var _interopRequireDefault = __webpack_require__(1)['default']; 921 922 exports.__esModule = true; 923 exports.registerDefaultDecorators = registerDefaultDecorators; 924 925 var _decoratorsInline = __webpack_require__(19); 926 927 var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); 928 929 function registerDefaultDecorators(instance) { 930 _decoratorsInline2['default'](instance); 931 } 932 933/***/ }), 934/* 19 */ 935/***/ (function(module, exports, __webpack_require__) { 936 937 'use strict'; 938 939 exports.__esModule = true; 940 941 var _utils = __webpack_require__(5); 942 943 exports['default'] = function (instance) { 944 instance.registerDecorator('inline', function (fn, props, container, options) { 945 var ret = fn; 946 if (!props.partials) { 947 props.partials = {}; 948 ret = function (context, options) { 949 // Create a new partials stack frame prior to exec. 950 var original = container.partials; 951 container.partials = _utils.extend({}, original, props.partials); 952 var ret = fn(context, options); 953 container.partials = original; 954 return ret; 955 }; 956 } 957 958 props.partials[options.args[0]] = options.fn; 959 960 return ret; 961 }); 962 }; 963 964 module.exports = exports['default']; 965 966/***/ }), 967/* 20 */ 968/***/ (function(module, exports, __webpack_require__) { 969 970 'use strict'; 971 972 exports.__esModule = true; 973 974 var _utils = __webpack_require__(5); 975 976 var logger = { 977 methodMap: ['debug', 'info', 'warn', 'error'], 978 level: 'info', 979 980 // Maps a given level value to the `methodMap` indexes above. 981 lookupLevel: function lookupLevel(level) { 982 if (typeof level === 'string') { 983 var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); 984 if (levelMap >= 0) { 985 level = levelMap; 986 } else { 987 level = parseInt(level, 10); 988 } 989 } 990 991 return level; 992 }, 993 994 // Can be overridden in the host environment 995 log: function log(level) { 996 level = logger.lookupLevel(level); 997 998 if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { 999 var method = logger.methodMap[level]; 1000 if (!console[method]) { 1001 // eslint-disable-line no-console 1002 method = 'log'; 1003 } 1004 1005 for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 1006 message[_key - 1] = arguments[_key]; 1007 } 1008 1009 console[method].apply(console, message); // eslint-disable-line no-console 1010 } 1011 } 1012 }; 1013 1014 exports['default'] = logger; 1015 module.exports = exports['default']; 1016 1017/***/ }), 1018/* 21 */ 1019/***/ (function(module, exports) { 1020 1021 // Build out our basic SafeString type 1022 'use strict'; 1023 1024 exports.__esModule = true; 1025 function SafeString(string) { 1026 this.string = string; 1027 } 1028 1029 SafeString.prototype.toString = SafeString.prototype.toHTML = function () { 1030 return '' + this.string; 1031 }; 1032 1033 exports['default'] = SafeString; 1034 module.exports = exports['default']; 1035 1036/***/ }), 1037/* 22 */ 1038/***/ (function(module, exports, __webpack_require__) { 1039 1040 'use strict'; 1041 1042 var _Object$seal = __webpack_require__(23)['default']; 1043 1044 var _interopRequireWildcard = __webpack_require__(3)['default']; 1045 1046 var _interopRequireDefault = __webpack_require__(1)['default']; 1047 1048 exports.__esModule = true; 1049 exports.checkRevision = checkRevision; 1050 exports.template = template; 1051 exports.wrapProgram = wrapProgram; 1052 exports.resolvePartial = resolvePartial; 1053 exports.invokePartial = invokePartial; 1054 exports.noop = noop; 1055 1056 var _utils = __webpack_require__(5); 1057 1058 var Utils = _interopRequireWildcard(_utils); 1059 1060 var _exception = __webpack_require__(6); 1061 1062 var _exception2 = _interopRequireDefault(_exception); 1063 1064 var _base = __webpack_require__(4); 1065 1066 function checkRevision(compilerInfo) { 1067 var compilerRevision = compilerInfo && compilerInfo[0] || 1, 1068 currentRevision = _base.COMPILER_REVISION; 1069 1070 if (compilerRevision !== currentRevision) { 1071 if (compilerRevision < currentRevision) { 1072 var runtimeVersions = _base.REVISION_CHANGES[currentRevision], 1073 compilerVersions = _base.REVISION_CHANGES[compilerRevision]; 1074 throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); 1075 } else { 1076 // Use the embedded version info since the runtime doesn't know about this revision yet 1077 throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); 1078 } 1079 } 1080 } 1081 1082 function template(templateSpec, env) { 1083 /* istanbul ignore next */ 1084 if (!env) { 1085 throw new _exception2['default']('No environment passed to template'); 1086 } 1087 if (!templateSpec || !templateSpec.main) { 1088 throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); 1089 } 1090 1091 templateSpec.main.decorator = templateSpec.main_d; 1092 1093 // Note: Using env.VM references rather than local var references throughout this section to allow 1094 // for external users to override these as psuedo-supported APIs. 1095 env.VM.checkRevision(templateSpec.compiler); 1096 1097 function invokePartialWrapper(partial, context, options) { 1098 if (options.hash) { 1099 context = Utils.extend({}, context, options.hash); 1100 if (options.ids) { 1101 options.ids[0] = true; 1102 } 1103 } 1104 1105 partial = env.VM.resolvePartial.call(this, partial, context, options); 1106 var result = env.VM.invokePartial.call(this, partial, context, options); 1107 1108 if (result == null && env.compile) { 1109 options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); 1110 result = options.partials[options.name](context, options); 1111 } 1112 if (result != null) { 1113 if (options.indent) { 1114 var lines = result.split('\n'); 1115 for (var i = 0, l = lines.length; i < l; i++) { 1116 if (!lines[i] && i + 1 === l) { 1117 break; 1118 } 1119 1120 lines[i] = options.indent + lines[i]; 1121 } 1122 result = lines.join('\n'); 1123 } 1124 return result; 1125 } else { 1126 throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); 1127 } 1128 } 1129 1130 // Just add water 1131 var container = { 1132 strict: function strict(obj, name) { 1133 if (!(name in obj)) { 1134 throw new _exception2['default']('"' + name + '" not defined in ' + obj); 1135 } 1136 return obj[name]; 1137 }, 1138 lookup: function lookup(depths, name) { 1139 var len = depths.length; 1140 for (var i = 0; i < len; i++) { 1141 if (depths[i] && depths[i][name] != null) { 1142 return depths[i][name]; 1143 } 1144 } 1145 }, 1146 lambda: function lambda(current, context) { 1147 return typeof current === 'function' ? current.call(context) : current; 1148 }, 1149 1150 escapeExpression: Utils.escapeExpression, 1151 invokePartial: invokePartialWrapper, 1152 1153 fn: function fn(i) { 1154 var ret = templateSpec[i]; 1155 ret.decorator = templateSpec[i + '_d']; 1156 return ret; 1157 }, 1158 1159 programs: [], 1160 program: function program(i, data, declaredBlockParams, blockParams, depths) { 1161 var programWrapper = this.programs[i], 1162 fn = this.fn(i); 1163 if (data || depths || blockParams || declaredBlockParams) { 1164 programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); 1165 } else if (!programWrapper) { 1166 programWrapper = this.programs[i] = wrapProgram(this, i, fn); 1167 } 1168 return programWrapper; 1169 }, 1170 1171 data: function data(value, depth) { 1172 while (value && depth--) { 1173 value = value._parent; 1174 } 1175 return value; 1176 }, 1177 merge: function merge(param, common) { 1178 var obj = param || common; 1179 1180 if (param && common && param !== common) { 1181 obj = Utils.extend({}, common, param); 1182 } 1183 1184 return obj; 1185 }, 1186 // An empty object to use as replacement for null-contexts 1187 nullContext: _Object$seal({}), 1188 1189 noop: env.VM.noop, 1190 compilerInfo: templateSpec.compiler 1191 }; 1192 1193 function ret(context) { 1194 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 1195 1196 var data = options.data; 1197 1198 ret._setup(options); 1199 if (!options.partial && templateSpec.useData) { 1200 data = initData(context, data); 1201 } 1202 var depths = undefined, 1203 blockParams = templateSpec.useBlockParams ? [] : undefined; 1204 if (templateSpec.useDepths) { 1205 if (options.depths) { 1206 depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths; 1207 } else { 1208 depths = [context]; 1209 } 1210 } 1211 1212 function main(context /*, options*/) { 1213 return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); 1214 } 1215 main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); 1216 return main(context, options); 1217 } 1218 ret.isTop = true; 1219 1220 ret._setup = function (options) { 1221 if (!options.partial) { 1222 container.helpers = container.merge(options.helpers, env.helpers); 1223 1224 if (templateSpec.usePartial) { 1225 container.partials = container.merge(options.partials, env.partials); 1226 } 1227 if (templateSpec.usePartial || templateSpec.useDecorators) { 1228 container.decorators = container.merge(options.decorators, env.decorators); 1229 } 1230 } else { 1231 container.helpers = options.helpers; 1232 container.partials = options.partials; 1233 container.decorators = options.decorators; 1234 } 1235 }; 1236 1237 ret._child = function (i, data, blockParams, depths) { 1238 if (templateSpec.useBlockParams && !blockParams) { 1239 throw new _exception2['default']('must pass block params'); 1240 } 1241 if (templateSpec.useDepths && !depths) { 1242 throw new _exception2['default']('must pass parent depths'); 1243 } 1244 1245 return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); 1246 }; 1247 return ret; 1248 } 1249 1250 function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { 1251 function prog(context) { 1252 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 1253 1254 var currentDepths = depths; 1255 if (depths && context != depths[0] && !(context === container.nullContext && depths[0] === null)) { 1256 currentDepths = [context].concat(depths); 1257 } 1258 1259 return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); 1260 } 1261 1262 prog = executeDecorators(fn, prog, container, depths, data, blockParams); 1263 1264 prog.program = i; 1265 prog.depth = depths ? depths.length : 0; 1266 prog.blockParams = declaredBlockParams || 0; 1267 return prog; 1268 } 1269 1270 function resolvePartial(partial, context, options) { 1271 if (!partial) { 1272 if (options.name === '@partial-block') { 1273 partial = options.data['partial-block']; 1274 } else { 1275 partial = options.partials[options.name]; 1276 } 1277 } else if (!partial.call && !options.name) { 1278 // This is a dynamic partial that returned a string 1279 options.name = partial; 1280 partial = options.partials[partial]; 1281 } 1282 return partial; 1283 } 1284 1285 function invokePartial(partial, context, options) { 1286 // Use the current closure context to save the partial-block if this partial 1287 var currentPartialBlock = options.data && options.data['partial-block']; 1288 options.partial = true; 1289 if (options.ids) { 1290 options.data.contextPath = options.ids[0] || options.data.contextPath; 1291 } 1292 1293 var partialBlock = undefined; 1294 if (options.fn && options.fn !== noop) { 1295 (function () { 1296 options.data = _base.createFrame(options.data); 1297 // Wrapper function to get access to currentPartialBlock from the closure 1298 var fn = options.fn; 1299 partialBlock = options.data['partial-block'] = function partialBlockWrapper(context) { 1300 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 1301 1302 // Restore the partial-block from the closure for the execution of the block 1303 // i.e. the part inside the block of the partial call. 1304 options.data = _base.createFrame(options.data); 1305 options.data['partial-block'] = currentPartialBlock; 1306 return fn(context, options); 1307 }; 1308 if (fn.partials) { 1309 options.partials = Utils.extend({}, options.partials, fn.partials); 1310 } 1311 })(); 1312 } 1313 1314 if (partial === undefined && partialBlock) { 1315 partial = partialBlock; 1316 } 1317 1318 if (partial === undefined) { 1319 throw new _exception2['default']('The partial ' + options.name + ' could not be found'); 1320 } else if (partial instanceof Function) { 1321 return partial(context, options); 1322 } 1323 } 1324 1325 function noop() { 1326 return ''; 1327 } 1328 1329 function initData(context, data) { 1330 if (!data || !('root' in data)) { 1331 data = data ? _base.createFrame(data) : {}; 1332 data.root = context; 1333 } 1334 return data; 1335 } 1336 1337 function executeDecorators(fn, prog, container, depths, data, blockParams) { 1338 if (fn.decorator) { 1339 var props = {}; 1340 prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); 1341 Utils.extend(prog, props); 1342 } 1343 return prog; 1344 } 1345 1346/***/ }), 1347/* 23 */ 1348/***/ (function(module, exports, __webpack_require__) { 1349 1350 module.exports = { "default": __webpack_require__(24), __esModule: true }; 1351 1352/***/ }), 1353/* 24 */ 1354/***/ (function(module, exports, __webpack_require__) { 1355 1356 __webpack_require__(25);
vendor: 4,201 bytes, lines 1357-1497
1357 module.exports = __webpack_require__(30).Object.seal; 1358 1359/***/ }), 1360/* 25 */ 1361/***/ (function(module, exports, __webpack_require__) { 1362 1363 // 19.1.2.17 Object.seal(O) 1364 var isObject = __webpack_require__(26); 1365 1366 __webpack_require__(27)('seal', function($seal){ 1367 return function seal(it){ 1368 return $seal && isObject(it) ? $seal(it) : it; 1369 }; 1370 }); 1371 1372/***/ }), 1373/* 26 */ 1374/***/ (function(module, exports) { 1375 1376 module.exports = function(it){ 1377 return typeof it === 'object' ? it !== null : typeof it === 'function'; 1378 }; 1379 1380/***/ }), 1381/* 27 */ 1382/***/ (function(module, exports, __webpack_require__) { 1383 1384 // most Object methods by ES6 should accept primitives 1385 var $export = __webpack_require__(28) 1386 , core = __webpack_require__(30) 1387 , fails = __webpack_require__(33); 1388 module.exports = function(KEY, exec){ 1389 var fn = (core.Object || {})[KEY] || Object[KEY] 1390 , exp = {}; 1391 exp[KEY] = exec(fn); 1392 $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); 1393 }; 1394 1395/***/ }), 1396/* 28 */ 1397/***/ (function(module, exports, __webpack_require__) { 1398 1399 var global = __webpack_require__(29) 1400 , core = __webpack_require__(30) 1401 , ctx = __webpack_require__(31) 1402 , PROTOTYPE = 'prototype'; 1403 1404 var $export = function(type, name, source){ 1405 var IS_FORCED = type & $export.F 1406 , IS_GLOBAL = type & $export.G 1407 , IS_STATIC = type & $export.S 1408 , IS_PROTO = type & $export.P 1409 , IS_BIND = type & $export.B 1410 , IS_WRAP = type & $export.W 1411 , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) 1412 , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] 1413 , key, own, out; 1414 if(IS_GLOBAL)source = name; 1415 for(key in source){ 1416 // contains in native 1417 own = !IS_FORCED && target && key in target; 1418 if(own && key in exports)continue; 1419 // export native or passed 1420 out = own ? target[key] : source[key]; 1421 // prevent global pollution for namespaces 1422 exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] 1423 // bind timers to global for call from export context 1424 : IS_BIND && own ? ctx(out, global) 1425 // wrap global constructors for prevent change them in library 1426 : IS_WRAP && target[key] == out ? (function(C){ 1427 var F = function(param){ 1428 return this instanceof C ? new C(param) : C(param); 1429 }; 1430 F[PROTOTYPE] = C[PROTOTYPE]; 1431 return F; 1432 // make static versions for prototype methods 1433 })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; 1434 if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; 1435 } 1436 }; 1437 // type bitmap 1438 $export.F = 1; // forced 1439 $export.G = 2; // global 1440 $export.S = 4; // static 1441 $export.P = 8; // proto 1442 $export.B = 16; // bind 1443 $export.W = 32; // wrap 1444 module.exports = $export; 1445 1446/***/ }), 1447/* 29 */ 1448/***/ (function(module, exports) { 1449 1450 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 1451 var global = module.exports = typeof window != 'undefined' && window.Math == Math 1452 ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); 1453 if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef 1454 1455/***/ }), 1456/* 30 */ 1457/***/ (function(module, exports) { 1458 1459 var core = module.exports = {version: '1.2.6'}; 1460 if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef 1461 1462/***/ }), 1463/* 31 */ 1464/***/ (function(module, exports, __webpack_require__) { 1465 1466 // optional / simple context binding 1467 var aFunction = __webpack_require__(32); 1468 module.exports = function(fn, that, length){ 1469 aFunction(fn); 1470 if(that === undefined)return fn; 1471 switch(length){ 1472 case 1: return function(a){ 1473 return fn.call(that, a); 1474 }; 1475 case 2: return function(a, b){ 1476 return fn.call(that, a, b); 1477 }; 1478 case 3: return function(a, b, c){ 1479 return fn.call(that, a, b, c); 1480 }; 1481 } 1482 return function(/* ...args */){ 1483 return fn.apply(that, arguments); 1484 }; 1485 }; 1486 1487/***/ }), 1488/* 32 */ 1489/***/ (function(module, exports) { 1490 1491 module.exports = function(it){ 1492 if(typeof it != 'function')throw TypeError(it + ' is not a function!'); 1493 return it; 1494 }; 1495 1496/***/ }), 1497/* 33 */
vendor: 5,346 bytes, lines 1498-1630
1498/***/ (function(module, exports) { 1499 1500 module.exports = function(exec){ 1501 try { 1502 return !!exec(); 1503 } catch(e){ 1504 return true; 1505 } 1506 }; 1507 1508/***/ }), 1509/* 34 */ 1510/***/ (function(module, exports) { 1511 1512 /* WEBPACK VAR INJECTION */(function(global) {/* global window */ 1513 'use strict'; 1514 1515 exports.__esModule = true; 1516 1517 exports['default'] = function (Handlebars) { 1518 /* istanbul ignore next */ 1519 var root = typeof global !== 'undefined' ? global : window, 1520 $Handlebars = root.Handlebars; 1521 /* istanbul ignore next */ 1522 Handlebars.noConflict = function () { 1523 if (root.Handlebars === Handlebars) { 1524 root.Handlebars = $Handlebars; 1525 } 1526 return Handlebars; 1527 }; 1528 }; 1529 1530 module.exports = exports['default']; 1531 /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) 1532 1533/***/ }), 1534/* 35 */ 1535/***/ (function(module, exports) { 1536 1537 'use strict'; 1538 1539 exports.__esModule = true; 1540 var AST = { 1541 // Public API used to evaluate derived attributes regarding AST nodes 1542 helpers: { 1543 // a mustache is definitely a helper if: 1544 // * it is an eligible helper, and 1545 // * it has at least one parameter or hash segment 1546 helperExpression: function helperExpression(node) { 1547 return node.type === 'SubExpression' || (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && !!(node.params && node.params.length || node.hash); 1548 }, 1549 1550 scopedId: function scopedId(path) { 1551 return (/^\.|this\b/.test(path.original) 1552 ); 1553 }, 1554 1555 // an ID is simple if it only has one part, and that part is not 1556 // `..` or `this`. 1557 simpleId: function simpleId(path) { 1558 return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth; 1559 } 1560 } 1561 }; 1562 1563 // Must be exported as an object rather than the root of the module as the jison lexer 1564 // must modify the object to operate properly. 1565 exports['default'] = AST; 1566 module.exports = exports['default']; 1567 1568/***/ }), 1569/* 36 */ 1570/***/ (function(module, exports, __webpack_require__) { 1571 1572 'use strict'; 1573 1574 var _interopRequireDefault = __webpack_require__(1)['default']; 1575 1576 var _interopRequireWildcard = __webpack_require__(3)['default']; 1577 1578 exports.__esModule = true; 1579 exports.parse = parse; 1580 1581 var _parser = __webpack_require__(37); 1582 1583 var _parser2 = _interopRequireDefault(_parser); 1584 1585 var _whitespaceControl = __webpack_require__(38); 1586 1587 var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl); 1588 1589 var _helpers = __webpack_require__(40); 1590 1591 var Helpers = _interopRequireWildcard(_helpers); 1592 1593 var _utils = __webpack_require__(5); 1594 1595 exports.parser = _parser2['default']; 1596 1597 var yy = {}; 1598 _utils.extend(yy, Helpers); 1599 1600 function parse(input, options) { 1601 // Just return if an already-compiled AST was passed in. 1602 if (input.type === 'Program') { 1603 return input; 1604 } 1605 1606 _parser2['default'].yy = yy; 1607 1608 // Altering the shared object here, but this is ok as parser is a sync operation 1609 yy.locInfo = function (locInfo) { 1610 return new yy.SourceLocation(options && options.srcName, locInfo); 1611 }; 1612 1613 var strip = new _whitespaceControl2['default'](options); 1614 return strip.accept(_parser2['default'].parse(input)); 1615 } 1616 1617/***/ }), 1618/* 37 */ 1619/***/ (function(module, exports) { 1620 1621 // File ignored in coverage tests via setting in .istanbul.yml 1622 /* Jison generated parser */ 1623 "use strict"; 1624 1625 exports.__esModule = true; 1626 var handlebars = (function () { 1627 var parser = { trace: function trace() {}, 1628 yy: {}, 1629 symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition_plus0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 }, 1630 terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT",
vendor: 26,539 bytes, lines 1630-1886
163018: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" }, 1631 productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 1], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]], 1632 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$ 1633 /**/) { 1634 1635 var $0 = $$.length - 1; 1636 switch (yystate) { 1637 case 1: 1638 return $$[$0 - 1]; 1639 break; 1640 case 2: 1641 this.$ = yy.prepareProgram($$[$0]); 1642 break; 1643 case 3: 1644 this.$ = $$[$0]; 1645 break; 1646 case 4: 1647 this.$ = $$[$0]; 1648 break; 1649 case 5: 1650 this.$ = $$[$0]; 1651 break; 1652 case 6: 1653 this.$ = $$[$0]; 1654 break; 1655 case 7: 1656 this.$ = $$[$0]; 1657 break; 1658 case 8: 1659 this.$ = $$[$0]; 1660 break; 1661 case 9: 1662 this.$ = { 1663 type: 'CommentStatement', 1664 value: yy.stripComment($$[$0]), 1665 strip: yy.stripFlags($$[$0], $$[$0]), 1666 loc: yy.locInfo(this._$) 1667 }; 1668 1669 break; 1670 case 10: 1671 this.$ = { 1672 type: 'ContentStatement', 1673 original: $$[$0], 1674 value: $$[$0], 1675 loc: yy.locInfo(this._$) 1676 }; 1677 1678 break; 1679 case 11: 1680 this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 1681 break; 1682 case 12: 1683 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] }; 1684 break; 1685 case 13: 1686 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$); 1687 break; 1688 case 14: 1689 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$); 1690 break; 1691 case 15: 1692 this.$ = { open: $$[$0 - 5], path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 1693 break; 1694 case 16: 1695 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 1696 break; 1697 case 17: 1698 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 1699 break; 1700 case 18: 1701 this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] }; 1702 break; 1703 case 19: 1704 var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$), 1705 program = yy.prepareProgram([inverse], $$[$0 - 1].loc); 1706 program.chained = true; 1707 1708 this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true }; 1709 1710 break; 1711 case 20: 1712 this.$ = $$[$0]; 1713 break; 1714 case 21: 1715 this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) }; 1716 break; 1717 case 22: 1718 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 1719 break; 1720 case 23: 1721 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 1722 break; 1723 case 24: 1724 this.$ = { 1725 type: 'PartialStatement', 1726 name: $$[$0 - 3], 1727 params: $$[$0 - 2], 1728 hash: $$[$0 - 1], 1729 indent: '', 1730 strip: yy.stripFlags($$[$0 - 4], $$[$0]), 1731 loc: yy.locInfo(this._$) 1732 }; 1733 1734 break; 1735 case 25: 1736 this.$ = yy.preparePartialBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 1737 break; 1738 case 26: 1739 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 4], $$[$0]) }; 1740 break; 1741 case 27: 1742 this.$ = $$[$0]; 1743 break; 1744 case 28: 1745 this.$ = $$[$0]; 1746 break; 1747 case 29: 1748 this.$ = { 1749 type: 'SubExpression', 1750 path: $$[$0 - 3], 1751 params: $$[$0 - 2], 1752 hash: $$[$0 - 1], 1753 loc: yy.locInfo(this._$) 1754 }; 1755 1756 break; 1757 case 30: 1758 this.$ = { type: 'Hash', pairs: $$[$0], loc: yy.locInfo(this._$) }; 1759 break; 1760 case 31: 1761 this.$ = { type: 'HashPair', key: yy.id($$[$0 - 2]), value: $$[$0], loc: yy.locInfo(this._$) }; 1762 break; 1763 case 32: 1764 this.$ = yy.id($$[$0 - 1]); 1765 break; 1766 case 33: 1767 this.$ = $$[$0]; 1768 break; 1769 case 34: 1770 this.$ = $$[$0]; 1771 break; 1772 case 35: 1773 this.$ = { type: 'StringLiteral', value: $$[$0], original: $$[$0], loc: yy.locInfo(this._$) }; 1774 break; 1775 case 36: 1776 this.$ = { type: 'NumberLiteral', value: Number($$[$0]), original: Number($$[$0]), loc: yy.locInfo(this._$) }; 1777 break; 1778 case 37: 1779 this.$ = { type: 'BooleanLiteral', value: $$[$0] === 'true', original: $$[$0] === 'true', loc: yy.locInfo(this._$) }; 1780 break; 1781 case 38: 1782 this.$ = { type: 'UndefinedLiteral', original: undefined, value: undefined, loc: yy.locInfo(this._$) }; 1783 break; 1784 case 39: 1785 this.$ = { type: 'NullLiteral', original: null, value: null, loc: yy.locInfo(this._$) }; 1786 break; 1787 case 40: 1788 this.$ = $$[$0]; 1789 break; 1790 case 41: 1791 this.$ = $$[$0]; 1792 break; 1793 case 42: 1794 this.$ = yy.preparePath(true, $$[$0], this._$); 1795 break; 1796 case 43: 1797 this.$ = yy.preparePath(false, $$[$0], this._$); 1798 break; 1799 case 44: 1800 $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2]; 1801 break; 1802 case 45: 1803 this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }]; 1804 break; 1805 case 46: 1806 this.$ = []; 1807 break; 1808 case 47: 1809 $$[$0 - 1].push($$[$0]); 1810 break; 1811 case 48: 1812 this.$ = [$$[$0]]; 1813 break; 1814 case 49: 1815 $$[$0 - 1].push($$[$0]); 1816 break; 1817 case 50: 1818 this.$ = []; 1819 break; 1820 case 51: 1821 $$[$0 - 1].push($$[$0]); 1822 break; 1823 case 58: 1824 this.$ = []; 1825 break; 1826 case 59: 1827 $$[$0 - 1].push($$[$0]); 1828 break; 1829 case 64: 1830 this.$ = []; 1831 break; 1832 case 65: 1833 $$[$0 - 1].push($$[$0]); 1834 break; 1835 case 70: 1836 this.$ = []; 1837 break; 1838 case 71: 1839 $$[$0 - 1].push($$[$0]); 1840 break; 1841 case 78: 1842 this.$ = []; 1843 break; 1844 case 79: 1845 $$[$0 - 1].push($$[$0]); 1846 break; 1847 case 82: 1848 this.$ = []; 1849 break; 1850 case 83: 1851 $$[$0 - 1].push($$[$0]); 1852 break; 1853 case 86: 1854 this.$ = []; 1855 break; 1856 case 87: 1857 $$[$0 - 1].push($$[$0]); 1858 break; 1859 case 90: 1860 this.$ = []; 1861 break; 1862 case 91: 1863 $$[$0 - 1].push($$[$0]); 1864 break; 1865 case 94: 1866 this.$ = []; 1867 break; 1868 case 95: 1869 $$[$0 - 1].push($$[$0]); 1870 break; 1871 case 98: 1872 this.$ = [$$[$0]]; 1873 break; 1874 case 99: 1875 $$[$0 - 1].push($$[$0]); 1876 break; 1877 case 100: 1878 this.$ = [$$[$0]]; 1879 break; 1880 case 101: 1881 $$[$0 - 1].push($$[$0]); 1882 break; 1883 } 1884 }, 1885 table: [{ 3: 1, 4: 2, 5: [2, 46], 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: [1, 12], 15: [1, 20], 16: 17, 19: [1, 23], 24: 15, 27: 16, 29: [1, 21], 34: [1, 22], 39: [2, 2], 44: [2, 2], 47: [2, 2], 48: [1, 13], 51: [1, 14], 55: [1, 18], 59: 19, 60: [1, 24] }, { 1: [2, 1] }, { 5: [2, 47], 14: [2, 47], 15: [2, 47], 19: [2, 47], 29: [2, 47], 34: [2, 47], 39: [2, 47], 44: [2, 47], 47: [2, 47], 48: [2, 47], 51: [2, 47], 55: [2, 47], 60: [2, 47] }, { 5: [2, 3], 14: [2, 3], 15: [2, 3], 19: [2, 3], 29: [2, 3], 34: [2, 3], 39: [2, 3], 44: [2, 3], 47: [2, 3], 48: [2, 3], 51: [2, 3], 55: [2, 3], 60: [2, 3] }, { 5: [2, 4], 14: [2, 4], 15: [2, 4], 19: [2, 4], 29: [2, 4], 34: [2, 4], 39: [2, 4], 44: [2, 4], 47: [2, 4], 48: [2, 4], 51: [2, 4], 55: [2, 4], 60: [2, 4] }, { 5: [2, 5], 14: [2, 5], 15: [2, 5], 19: [2, 5], 29: [2, 5], 34: [2, 5], 39: [2, 5], 44: [2, 5], 47: [2, 5], 48: [2, 5], 51: [2, 5], 55: [2, 5], 60: [2, 5] }, { 5: [2, 6], 14: [2, 6], 15: [2, 6], 19: [2, 6], 29: [2, 6], 34: [2, 6], 39: [2, 6], 44: [2, 6], 47: [2, 6], 48: [2, 6], 51: [2, 6], 55: [2, 6], 60: [2, 6] }, { 5: [2, 7], 14: [2, 7], 15: [2, 7], 19: [2, 7], 29: [2, 7], 34: [2, 7], 39: [2, 7], 44: [2, 7], 47: [2, 7], 48: [2, 7], 51: [2, 7], 55: [2, 7], 60: [2, 7] }, { 5: [2, 8], 14: [2, 8], 15: [2, 8], 19: [2, 8], 29: [2, 8], 34: [2, 8], 39: [2, 8], 44: [2, 8], 47: [2, 8], 48: [2, 8], 51: [2, 8], 55: [2, 8], 60: [2, 8] }, { 5: [2, 9], 14: [2, 9], 15: [2, 9], 19: [2, 9], 29: [2, 9], 34: [2, 9], 39: [2, 9], 44: [2, 9], 47: [2, 9], 48: [2, 9], 51: [2, 9], 55: [2, 9], 60: [2, 9] }, { 20: 25, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 36, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 37, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 4: 38, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 13: 40, 15: [1, 20], 17: 39 }, { 20: 42, 56: 41, 64: 43, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 45, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 5: [2, 10], 14: [2, 10], 15: [2, 10], 18: [2, 10], 19: [2, 10], 29: [2, 10], 34: [2, 10], 39: [2, 10], 44: [2, 10], 47: [2, 10], 48: [2, 10], 51: [2, 10], 55: [2, 10], 60: [2, 10] }, { 20: 46, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 47, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 48, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 42, 56: 49, 64: 43, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [2, 78], 49: 50, 65: [2, 78], 72: [2, 78], 80: [2, 78], 81: [2, 78], 82: [2, 78], 83: [2, 78], 84: [2, 78], 85: [2, 78] }, { 23: [2, 33], 33: [2, 33], 54: [2, 33], 65: [2, 33], 68: [2, 33], 72: [2, 33], 75: [2, 33], 80: [2, 33], 81: [2, 33], 82: [2, 33], 83: [2, 33], 84: [2, 33], 85: [2, 33] }, { 23: [2, 34], 33: [2, 34], 54: [2, 34], 65: [2, 34], 68: [2, 34], 72: [2, 34], 75: [2, 34], 80: [2, 34], 81: [2, 34], 82: [2, 34], 83: [2, 34], 84: [2, 34], 85: [2, 34] }, { 23: [2, 35], 33: [2, 35], 54: [2, 35], 65: [2, 35], 68: [2, 35], 72: [2, 35], 75: [2, 35], 80: [2, 35], 81: [2, 35], 82: [2, 35], 83: [2, 35], 84: [2, 35], 85: [2, 35] }, { 23: [2, 36], 33: [2, 36], 54: [2, 36], 65: [2, 36], 68: [2, 36], 72: [2, 36], 75: [2, 36], 80: [2, 36], 81: [2, 36], 82: [2, 36], 83: [2, 36], 84: [2, 36], 85: [2, 36] }, { 23: [2, 37], 33: [2, 37], 54: [2, 37], 65: [2, 37], 68: [2, 37], 72: [2, 37], 75: [2, 37], 80: [2, 37], 81: [2, 37], 82: [2, 37], 83: [2, 37], 84: [2, 37], 85: [2, 37] }, { 23: [2, 38], 33: [2, 38], 54: [2, 38], 65: [2, 38], 68: [2, 38], 72: [2, 38], 75: [2, 38], 80: [2, 38], 81: [2, 38], 82: [2, 38], 83: [2, 38], 84: [2, 38], 85: [2, 38] }, { 23: [2, 39], 33: [2, 39], 54: [2, 39], 65: [2, 39], 68: [2, 39], 72: [2, 39], 75: [2, 39], 80: [2, 39], 81: [2, 39], 82: [2, 39], 83: [2, 39], 84: [2, 39], 85: [2, 39] }, { 23: [2, 43], 33: [2, 43], 54: [2, 43], 65: [2, 43], 68: [2, 43], 72: [2, 43], 75: [2, 43], 80: [2, 43], 81: [2, 43], 82: [2, 43], 83: [2, 43], 84: [2, 43], 85: [2, 43], 87: [1, 51] }, { 72: [1, 35], 86: 52 }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 52: 53, 54: [2, 82], 65: [2, 82], 72: [2, 82], 80: [2, 82], 81: [2, 82], 82: [2, 82], 83: [2, 82], 84: [2, 82], 85: [2, 82] }, { 25: 54, 38: 56, 39: [1, 58], 43: 57, 44: [1, 59], 45: 55, 47: [2, 54] }, { 28: 60, 43: 61, 44: [1, 59], 47: [2, 56] }, { 13: 63, 15: [1, 20], 18: [1, 62] }, { 15: [2, 48], 18: [2, 48] }, { 33: [2, 86], 57: 64, 65: [2, 86], 72: [2, 86], 80: [2, 86], 81: [2, 86], 82: [2, 86], 83: [2, 86], 84: [2, 86], 85: [2, 86] }, { 33: [2, 40], 65: [2, 40], 72: [2, 40], 80: [2, 40], 81: [2, 40], 82: [2, 40], 83: [2, 40], 84: [2, 40], 85: [2, 40] }, { 33: [2, 41], 65: [2, 41], 72: [2, 41], 80: [2, 41], 81: [2, 41], 82: [2, 41], 83: [2, 41], 84: [2, 41], 85: [2, 41] }, { 20: 65, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 66, 47: [1, 67] }, { 30: 68, 33: [2, 58], 65: [2, 58], 72: [2, 58], 75: [2, 58], 80: [2, 58], 81: [2, 58], 82: [2, 58], 83: [2, 58], 84: [2, 58], 85: [2, 58] }, { 33: [2, 64], 35: 69, 65: [2, 64], 72: [2, 64], 75: [2, 64], 80: [2, 64], 81: [2, 64], 82: [2, 64], 83: [2, 64], 84: [2, 64], 85: [2, 64] }, { 21: 70, 23: [2, 50], 65: [2, 50], 72: [2, 50], 80: [2, 50], 81: [2, 50], 82: [2, 50], 83: [2, 50], 84: [2, 50], 85: [2, 50] }, { 33: [2, 90], 61: 71, 65: [2, 90], 72: [2, 90], 80: [2, 90], 81: [2, 90], 82: [2, 90], 83: [2, 90], 84: [2, 90], 85: [2, 90] }, { 20: 75, 33: [2, 80], 50: 72, 63: 73, 64: 76, 65: [1, 44], 69: 74, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 72: [1, 80] }, { 23: [2, 42], 33: [2, 42], 54: [2, 42], 65: [2, 42], 68: [2, 42], 72: [2, 42], 75: [2, 42], 80: [2, 42], 81: [2, 42], 82: [2, 42], 83: [2, 42], 84: [2, 42], 85: [2, 42], 87: [1, 51] }, { 20: 75, 53: 81, 54: [2, 84], 63: 82, 64: 76, 65: [1, 44], 69: 83, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 84, 47: [1, 67] }, { 47: [2, 55] }, { 4: 85, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 47: [2, 20] }, { 20: 86, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 87, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 26: 88, 47: [1, 67] }, { 47: [2, 57] }, { 5: [2, 11], 14: [2, 11], 15: [2, 11], 19: [2, 11], 29: [2, 11], 34: [2, 11], 39: [2, 11], 44: [2, 11], 47: [2, 11], 48: [2, 11], 51: [2, 11], 55: [2, 11], 60: [2, 11] }, { 15: [2, 49], 18: [2, 49] }, { 20: 75, 33: [2, 88], 58: 89, 63: 90, 64: 76, 65: [1, 44], 69: 91, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 65: [2, 94], 66: 92, 68: [2, 94], 72: [2, 94], 80: [2, 94], 81: [2, 94], 82: [2, 94], 83: [2, 94], 84: [2, 94], 85: [2, 94] }, { 5: [2, 25], 14: [2, 25], 15: [2, 25], 19: [2, 25], 29: [2, 25], 34: [2, 25], 39: [2, 25], 44: [2, 25], 47: [2, 25], 48: [2, 25], 51: [2, 25], 55: [2, 25], 60: [2, 25] }, { 20: 93, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 31: 94, 33: [2, 60], 63: 95, 64: 76, 65: [1, 44], 69: 96, 70: 77, 71: 78, 72: [1, 79], 75: [2, 60], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 33: [2, 66], 36: 97, 63: 98, 64: 76, 65: [1, 44], 69: 99, 70: 77, 71: 78, 72: [1, 79], 75: [2, 66], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 22: 100, 23: [2, 52], 63: 101, 64: 76, 65: [1, 44], 69: 102, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 33: [2, 92], 62: 103, 63: 104, 64: 76, 65: [1, 44], 69: 105, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 106] }, { 33: [2, 79], 65: [2, 79], 72: [2, 79], 80: [2, 79], 81: [2, 79], 82: [2, 79], 83: [2, 79], 84: [2, 79], 85: [2, 79] }, { 33: [2, 81] }, { 23: [2, 27], 33: [2, 27], 54: [2, 27], 65: [2, 27], 68: [2, 27], 72: [2, 27], 75: [2, 27], 80: [2, 27], 81: [2, 27], 82: [2, 27], 83: [2, 27], 84: [2, 27], 85: [2, 27] }, { 23: [2, 28], 33: [2, 28], 54: [2, 28], 65: [2, 28], 68: [2, 28], 72: [2, 28], 75: [2, 28], 80: [2, 28], 81: [2, 28], 82: [2, 28], 83: [2, 28], 84: [2, 28], 85: [2, 28] }, { 23: [2, 30], 33: [2, 30], 54: [2, 30], 68: [2, 30], 71: 107, 72: [1, 108], 75: [2, 30] }, { 23: [2, 98], 33: [2, 98], 54: [2, 98], 68: [2, 98], 72: [2, 98], 75: [2, 98] }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 73: [1, 109], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 23: [2, 44], 33: [2, 44], 54: [2, 44], 65: [2, 44], 68: [2, 44], 72: [2, 44], 75: [2, 44], 80: [2, 44], 81: [2, 44], 82: [2, 44], 83: [2, 44], 84: [2, 44], 85: [2, 44], 87: [2, 44] }, { 54: [1, 110] }, { 54: [2, 83], 65: [2, 83], 72: [2, 83], 80: [2, 83], 81: [2, 83], 82: [2, 83], 83: [2, 83], 84: [2, 83], 85: [2, 83] }, { 54: [2, 85] }, { 5: [2, 13], 14: [2, 13], 15: [2, 13], 19: [2, 13], 29: [2, 13], 34: [2, 13], 39: [2, 13], 44: [2, 13], 47: [2, 13], 48: [2, 13], 51: [2, 13], 55: [2, 13], 60: [2, 13] }, { 38: 56, 39: [1, 58], 43: 57, 44: [1, 59], 45: 112, 46: 111, 47: [2, 76] }, { 33: [2, 70], 40: 113, 65: [2, 70], 72: [2, 70], 75: [2, 70], 80: [2, 70], 81: [2, 70], 82: [2, 70], 83: [2, 70], 84: [2, 70], 85: [2, 70] }, { 47: [2, 18] }, { 5: [2, 14], 14: [2, 14], 15: [2, 14], 19: [2, 14], 29: [2, 14], 34: [2, 14], 39: [2, 14], 44: [2, 14], 47: [2, 14], 48: [2, 14], 51: [2, 14], 55: [2, 14], 60: [2, 14] }, { 33: [1, 114] }, { 33: [2, 87], 65: [2, 87], 72: [2, 87], 80: [2, 87], 81: [2, 87], 82: [2, 87], 83: [2, 87], 84: [2, 87], 85: [2, 87] }, { 33: [2, 89] }, { 20: 75, 63: 116, 64: 76, 65: [1, 44], 67: 115, 68: [2, 96], 69: 117, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 118] }, { 32: 119, 33: [2, 62], 74: 120, 75: [1, 121] }, { 33: [2, 59], 65: [2, 59], 72: [2, 59], 75: [2, 59], 80: [2, 59], 81: [2, 59], 82: [2, 59], 83: [2, 59], 84: [2, 59], 85: [2, 59] }, { 33: [2, 61], 75: [2, 61] }, { 33: [2, 68], 37: 122, 74: 123, 75: [1, 121] }, { 33: [2, 65], 65: [2, 65], 72: [2, 65], 75: [2, 65], 80: [2, 65], 81: [2, 65], 82: [2, 65], 83: [2, 65], 84: [2, 65], 85: [2, 65] }, { 33: [2, 67], 75: [2, 67] }, { 23: [1, 124] }, { 23: [2, 51], 65: [2, 51], 72: [2, 51], 80: [2, 51], 81: [2, 51], 82: [2, 51], 83: [2, 51], 84: [2, 51], 85: [2, 51] }, { 23: [2, 53] }, { 33: [1, 125] }, { 33: [2, 91], 65: [2, 91], 72: [2, 91], 80: [2, 91], 81: [2, 91], 82: [2, 91], 83: [2, 91], 84: [2, 91], 85: [2, 91] }, { 33: [2, 93] }, { 5: [2, 22], 14: [2, 22], 15: [2, 22], 19: [2, 22], 29: [2, 22], 34: [2, 22], 39: [2, 22], 44: [2, 22], 47: [2, 22], 48: [2, 22], 51: [2, 22], 55: [2, 22], 60: [2, 22] }, { 23: [2, 99], 33: [2, 99], 54: [2, 99], 68: [2, 99], 72: [2, 99], 75: [2, 99] }, { 73: [1, 109] }, { 20: 75, 63: 126, 64: 76, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 23], 14: [2, 23], 15: [2, 23], 19: [2, 23], 29: [2, 23], 34: [2, 23], 39: [2, 23], 44: [2, 23], 47: [2, 23], 48: [2, 23], 51: [2, 23], 55: [2, 23], 60: [2, 23] }, { 47: [2, 19] }, { 47: [2, 77] }, { 20: 75, 33: [2, 72], 41: 127, 63: 128, 64: 76, 65: [1, 44], 69: 129, 70: 77, 71: 78, 72: [1, 79], 75: [2, 72], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 24], 14: [2, 24], 15: [2, 24], 19: [2, 24], 29: [2, 24], 34: [2, 24], 39: [2, 24], 44: [2, 24], 47: [2, 24], 48: [2, 24], 51: [2, 24], 55: [2, 24], 60: [2, 24] }, { 68: [1, 130] }, { 65: [2, 95], 68: [2, 95], 72: [2, 95], 80: [2, 95], 81: [2, 95], 82: [2, 95], 83: [2, 95], 84: [2, 95], 85: [2, 95] }, { 68: [2, 97] }, { 5: [2, 21], 14: [2, 21], 15: [2, 21], 19: [2, 21], 29: [2, 21], 34: [2, 21], 39: [2, 21], 44: [2, 21], 47: [2, 21], 48: [2, 21], 51: [2, 21], 55: [2, 21], 60: [2, 21] }, { 33: [1, 131] }, { 33: [2, 63] }, { 72: [1, 133], 76: 132 }, { 33: [1, 134] }, { 33: [2, 69] }, { 15: [2, 12] }, { 14: [2, 26], 15: [2, 26], 19: [2, 26], 29: [2, 26], 34: [2, 26], 47: [2, 26], 48: [2, 26], 51: [2, 26], 55: [2, 26], 60: [2, 26] }, { 23: [2, 31], 33: [2, 31], 54: [2, 31], 68: [2, 31], 72: [2, 31], 75: [2, 31] }, { 33: [2, 74], 42: 135, 74: 136, 75: [1, 121] }, { 33: [2, 71], 65: [2, 71], 72: [2, 71], 75: [2, 71], 80: [2, 71], 81: [2, 71], 82: [2, 71], 83: [2, 71], 84: [2, 71], 85: [2, 71] }, { 33: [2, 73], 75: [2, 73] }, { 23: [2, 29], 33: [2, 29], 54: [2, 29], 65: [2, 29], 68: [2, 29], 72: [2, 29], 75: [2, 29], 80: [2, 29], 81: [2, 29], 82: [2, 29], 83: [2, 29], 84: [2, 29], 85: [2, 29] }, { 14: [2, 15], 15: [2, 15], 19: [2, 15], 29: [2, 15], 34: [2, 15], 39: [2, 15], 44: [2, 15], 47: [2, 15], 48: [2, 15], 51: [2, 15], 55: [2, 15], 60: [2, 15] }, { 72: [1, 138], 77: [1, 137] }, { 72: [2, 100], 77: [2, 100] }, { 14: [2, 16], 15: [2, 16], 19: [2, 16], 29: [2, 16], 34: [2, 16], 44: [2, 16], 47: [2, 16], 48: [2, 16], 51: [2, 16], 55: [2, 16], 60: [2, 16] }, { 33: [1, 139] }, { 33: [2, 75] }, { 33: [2, 32] }, { 72: [2, 101], 77: [2, 101] }, { 14: [2, 17], 15: [2, 17], 19: [2, 17], 29: [2, 17], 34: [2, 17], 39: [2, 17], 44: [2, 17], 47: [2, 17], 48: [2, 17], 51: [2, 17], 55: [2, 17], 60: [2, 17] }], 1886 defaultActions: { 4: [2, 1], 55: [2, 55], 57: [2, 20], 61: [2, 57], 74: [2, 81], 83: [2, 85], 87: [2, 18], 91: [2, 89], 102: [2, 53], 105: [2, 93], 111: [2, 19], 112: [2, 77], 117: [2, 97
1886], 120: [2, 63], 123: [2, 69], 124: [2, 12], 136: [2, 75], 137
vendor: 13,423 bytes, lines 1886-2170
1886: [2, 32] }, 1887 parseError: function parseError(str, hash) { 1888 throw new Error(str); 1889 }, 1890 parse: function parse(input) { 1891 var self = this, 1892 stack = [0], 1893 vstack = [null], 1894 lstack = [], 1895 table = this.table, 1896 yytext = "", 1897 yylineno = 0, 1898 yyleng = 0, 1899 recovering = 0, 1900 TERROR = 2, 1901 EOF = 1; 1902 this.lexer.setInput(input); 1903 this.lexer.yy = this.yy; 1904 this.yy.lexer = this.lexer; 1905 this.yy.parser = this; 1906 if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {}; 1907 var yyloc = this.lexer.yylloc; 1908 lstack.push(yyloc); 1909 var ranges = this.lexer.options && this.lexer.options.ranges; 1910 if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError; 1911 function popStack(n) { 1912 stack.length = stack.length - 2 * n; 1913 vstack.length = vstack.length - n; 1914 lstack.length = lstack.length - n; 1915 } 1916 function lex() { 1917 var token; 1918 token = self.lexer.lex() || 1; 1919 if (typeof token !== "number") { 1920 token = self.symbols_[token] || token; 1921 } 1922 return token; 1923 } 1924 var symbol, 1925 preErrorSymbol, 1926 state, 1927 action, 1928 a, 1929 r, 1930 yyval = {}, 1931 p, 1932 len, 1933 newState, 1934 expected; 1935 while (true) { 1936 state = stack[stack.length - 1]; 1937 if (this.defaultActions[state]) { 1938 action = this.defaultActions[state]; 1939 } else { 1940 if (symbol === null || typeof symbol == "undefined") { 1941 symbol = lex(); 1942 } 1943 action = table[state] && table[state][symbol]; 1944 } 1945 if (typeof action === "undefined" || !action.length || !action[0]) { 1946 var errStr = ""; 1947 if (!recovering) { 1948 expected = []; 1949 for (p in table[state]) if (this.terminals_[p] && p > 2) { 1950 expected.push("'" + this.terminals_[p] + "'"); 1951 } 1952 if (this.lexer.showPosition) { 1953 errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; 1954 } else { 1955 errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); 1956 } 1957 this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected }); 1958 } 1959 } 1960 if (action[0] instanceof Array && action.length > 1) { 1961 throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); 1962 } 1963 switch (action[0]) { 1964 case 1: 1965 stack.push(symbol); 1966 vstack.push(this.lexer.yytext); 1967 lstack.push(this.lexer.yylloc); 1968 stack.push(action[1]); 1969 symbol = null; 1970 if (!preErrorSymbol) { 1971 yyleng = this.lexer.yyleng; 1972 yytext = this.lexer.yytext; 1973 yylineno = this.lexer.yylineno; 1974 yyloc = this.lexer.yylloc; 1975 if (recovering > 0) recovering--; 1976 } else { 1977 symbol = preErrorSymbol; 1978 preErrorSymbol = null; 1979 } 1980 break; 1981 case 2: 1982 len = this.productions_[action[1]][1]; 1983 yyval.$ = vstack[vstack.length - len]; 1984 yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; 1985 if (ranges) { 1986 yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; 1987 } 1988 r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); 1989 if (typeof r !== "undefined") { 1990 return r; 1991 } 1992 if (len) { 1993 stack = stack.slice(0, -1 * len * 2); 1994 vstack = vstack.slice(0, -1 * len); 1995 lstack = lstack.slice(0, -1 * len); 1996 } 1997 stack.push(this.productions_[action[1]][0]); 1998 vstack.push(yyval.$); 1999 lstack.push(yyval._$); 2000 newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; 2001 stack.push(newState); 2002 break; 2003 case 3: 2004 return true; 2005 } 2006 } 2007 return true; 2008 } 2009 }; 2010 /* Jison generated lexer */ 2011 var lexer = (function () { 2012 var lexer = { EOF: 1, 2013 parseError: function parseError(str, hash) { 2014 if (this.yy.parser) { 2015 this.yy.parser.parseError(str, hash); 2016 } else { 2017 throw new Error(str); 2018 } 2019 }, 2020 setInput: function setInput(input) { 2021 this._input = input; 2022 this._more = this._less = this.done = false; 2023 this.yylineno = this.yyleng = 0; 2024 this.yytext = this.matched = this.match = ''; 2025 this.conditionStack = ['INITIAL']; 2026 this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; 2027 if (this.options.ranges) this.yylloc.range = [0, 0]; 2028 this.offset = 0; 2029 return this; 2030 }, 2031 input: function input() { 2032 var ch = this._input[0]; 2033 this.yytext += ch; 2034 this.yyleng++; 2035 this.offset++; 2036 this.match += ch; 2037 this.matched += ch; 2038 var lines = ch.match(/(?:\r\n?|\n).*/g); 2039 if (lines) { 2040 this.yylineno++; 2041 this.yylloc.last_line++; 2042 } else { 2043 this.yylloc.last_column++; 2044 } 2045 if (this.options.ranges) this.yylloc.range[1]++; 2046 2047 this._input = this._input.slice(1); 2048 return ch; 2049 }, 2050 unput: function unput(ch) { 2051 var len = ch.length; 2052 var lines = ch.split(/(?:\r\n?|\n)/g); 2053 2054 this._input = ch + this._input; 2055 this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); 2056 //this.yyleng -= len; 2057 this.offset -= len; 2058 var oldLines = this.match.split(/(?:\r\n?|\n)/g); 2059 this.match = this.match.substr(0, this.match.length - 1); 2060 this.matched = this.matched.substr(0, this.matched.length - 1); 2061 2062 if (lines.length - 1) this.yylineno -= lines.length - 1; 2063 var r = this.yylloc.range; 2064 2065 this.yylloc = { first_line: this.yylloc.first_line, 2066 last_line: this.yylineno + 1, 2067 first_column: this.yylloc.first_column, 2068 last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len 2069 }; 2070 2071 if (this.options.ranges) { 2072 this.yylloc.range = [r[0], r[0] + this.yyleng - len]; 2073 } 2074 return this; 2075 }, 2076 more: function more() { 2077 this._more = true; 2078 return this; 2079 }, 2080 less: function less(n) { 2081 this.unput(this.match.slice(n)); 2082 }, 2083 pastInput: function pastInput() { 2084 var past = this.matched.substr(0, this.matched.length - this.match.length); 2085 return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); 2086 }, 2087 upcomingInput: function upcomingInput() { 2088 var next = this.match; 2089 if (next.length < 20) { 2090 next += this._input.substr(0, 20 - next.length); 2091 } 2092 return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); 2093 }, 2094 showPosition: function showPosition() { 2095 var pre = this.pastInput(); 2096 var c = new Array(pre.length + 1).join("-"); 2097 return pre + this.upcomingInput() + "\n" + c + "^"; 2098 }, 2099 next: function next() { 2100 if (this.done) { 2101 return this.EOF; 2102 } 2103 if (!this._input) this.done = true; 2104 2105 var token, match, tempMatch, index, col, lines; 2106 if (!this._more) { 2107 this.yytext = ''; 2108 this.match = ''; 2109 } 2110 var rules = this._currentRules(); 2111 for (var i = 0; i < rules.length; i++) { 2112 tempMatch = this._input.match(this.rules[rules[i]]); 2113 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { 2114 match = tempMatch; 2115 index = i; 2116 if (!this.options.flex) break; 2117 } 2118 } 2119 if (match) { 2120 lines = match[0].match(/(?:\r\n?|\n).*/g); 2121 if (lines) this.yylineno += lines.length; 2122 this.yylloc = { first_line: this.yylloc.last_line, 2123 last_line: this.yylineno + 1, 2124 first_column: this.yylloc.last_column, 2125 last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; 2126 this.yytext += match[0]; 2127 this.match += match[0]; 2128 this.matches = match; 2129 this.yyleng = this.yytext.length; 2130 if (this.options.ranges) { 2131 this.yylloc.range = [this.offset, this.offset += this.yyleng]; 2132 } 2133 this._more = false; 2134 this._input = this._input.slice(match[0].length); 2135 this.matched += match[0]; 2136 token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]); 2137 if (this.done && this._input) this.done = false; 2138 if (token) return token;else return; 2139 } 2140 if (this._input === "") { 2141 return this.EOF; 2142 } else { 2143 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); 2144 } 2145 }, 2146 lex: function lex() { 2147 var r = this.next(); 2148 if (typeof r !== 'undefined') { 2149 return r; 2150 } else { 2151 return this.lex(); 2152 } 2153 }, 2154 begin: function begin(condition) { 2155 this.conditionStack.push(condition); 2156 }, 2157 popState: function popState() { 2158 return this.conditionStack.pop(); 2159 }, 2160 _currentRules: function _currentRules() { 2161 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; 2162 }, 2163 topState: function topState() { 2164 return this.conditionStack[this.conditionStack.length - 2]; 2165 }, 2166 pushState: function begin(condition) { 2167 this.begin(condition); 2168 } }; 2169 lexer.options = {}; 2170 lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START
vendor: 7,146 bytes, lines 2170-2350
2170 2171 /**/) { 2172 2173 function strip(start, end) { 2174 return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng - end); 2175 } 2176 2177 var YYSTATE = YY_START; 2178 switch ($avoiding_name_collisions) { 2179 case 0: 2180 if (yy_.yytext.slice(-2) === "\\\\") { 2181 strip(0, 1); 2182 this.begin("mu"); 2183 } else if (yy_.yytext.slice(-1) === "\\") { 2184 strip(0, 1); 2185 this.begin("emu"); 2186 } else { 2187 this.begin("mu"); 2188 } 2189 if (yy_.yytext) return 15; 2190 2191 break; 2192 case 1: 2193 return 15; 2194 break; 2195 case 2: 2196 this.popState(); 2197 return 15; 2198 2199 break; 2200 case 3: 2201 this.begin('raw');return 15; 2202 break; 2203 case 4: 2204 this.popState(); 2205 // Should be using `this.topState()` below, but it currently 2206 // returns the second top instead of the first top. Opened an 2207 // issue about it at https://github.com/zaach/jison/issues/291 2208 if (this.conditionStack[this.conditionStack.length - 1] === 'raw') { 2209 return 15; 2210 } else { 2211 yy_.yytext = yy_.yytext.substr(5, yy_.yyleng - 9); 2212 return 'END_RAW_BLOCK'; 2213 } 2214 2215 break; 2216 case 5: 2217 return 15; 2218 break; 2219 case 6: 2220 this.popState(); 2221 return 14; 2222 2223 break; 2224 case 7: 2225 return 65; 2226 break; 2227 case 8: 2228 return 68; 2229 break; 2230 case 9: 2231 return 19; 2232 break; 2233 case 10: 2234 this.popState(); 2235 this.begin('raw'); 2236 return 23; 2237 2238 break; 2239 case 11: 2240 return 55; 2241 break; 2242 case 12: 2243 return 60; 2244 break; 2245 case 13: 2246 return 29; 2247 break; 2248 case 14: 2249 return 47; 2250 break; 2251 case 15: 2252 this.popState();return 44; 2253 break; 2254 case 16: 2255 this.popState();return 44; 2256 break; 2257 case 17: 2258 return 34; 2259 break; 2260 case 18: 2261 return 39; 2262 break; 2263 case 19: 2264 return 51; 2265 break; 2266 case 20: 2267 return 48; 2268 break; 2269 case 21: 2270 this.unput(yy_.yytext); 2271 this.popState(); 2272 this.begin('com'); 2273 2274 break; 2275 case 22: 2276 this.popState(); 2277 return 14; 2278 2279 break; 2280 case 23: 2281 return 48; 2282 break; 2283 case 24: 2284 return 73; 2285 break; 2286 case 25: 2287 return 72; 2288 break; 2289 case 26: 2290 return 72; 2291 break; 2292 case 27: 2293 return 87; 2294 break; 2295 case 28: 2296 // ignore whitespace 2297 break; 2298 case 29: 2299 this.popState();return 54; 2300 break; 2301 case 30: 2302 this.popState();return 33; 2303 break; 2304 case 31: 2305 yy_.yytext = strip(1, 2).replace(/\\"/g, '"');return 80; 2306 break; 2307 case 32: 2308 yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 80; 2309 break; 2310 case 33: 2311 return 85; 2312 break; 2313 case 34: 2314 return 82; 2315 break; 2316 case 35: 2317 return 82; 2318 break; 2319 case 36: 2320 return 83; 2321 break; 2322 case 37: 2323 return 84; 2324 break; 2325 case 38: 2326 return 81; 2327 break; 2328 case 39: 2329 return 75; 2330 break; 2331 case 40: 2332 return 77; 2333 break; 2334 case 41: 2335 return 72; 2336 break; 2337 case 42: 2338 yy_.yytext = yy_.yytext.replace(/\\([\\\]])/g, '$1');return 72; 2339 break; 2340 case 43: 2341 return 'INVALID'; 2342 break; 2343 case 44: 2344 return 5; 2345 break; 2346 } 2347 }; 2348 lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^\/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]*?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/]; 2349 lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } }; 2350 return lexer;
vendor: 13,265 bytes, lines 2351-2813
2351 })(); 2352 parser.lexer = lexer; 2353 function Parser() { 2354 this.yy = {}; 2355 }Parser.prototype = parser;parser.Parser = Parser; 2356 return new Parser(); 2357 })();exports["default"] = handlebars; 2358 module.exports = exports["default"]; 2359 2360/***/ }), 2361/* 38 */ 2362/***/ (function(module, exports, __webpack_require__) { 2363 2364 'use strict'; 2365 2366 var _interopRequireDefault = __webpack_require__(1)['default']; 2367 2368 exports.__esModule = true; 2369 2370 var _visitor = __webpack_require__(39); 2371 2372 var _visitor2 = _interopRequireDefault(_visitor); 2373 2374 function WhitespaceControl() { 2375 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; 2376 2377 this.options = options; 2378 } 2379 WhitespaceControl.prototype = new _visitor2['default'](); 2380 2381 WhitespaceControl.prototype.Program = function (program) { 2382 var doStandalone = !this.options.ignoreStandalone; 2383 2384 var isRoot = !this.isRootSeen; 2385 this.isRootSeen = true; 2386 2387 var body = program.body; 2388 for (var i = 0, l = body.length; i < l; i++) { 2389 var current = body[i], 2390 strip = this.accept(current); 2391 2392 if (!strip) { 2393 continue; 2394 } 2395 2396 var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), 2397 _isNextWhitespace = isNextWhitespace(body, i, isRoot), 2398 openStandalone = strip.openStandalone && _isPrevWhitespace, 2399 closeStandalone = strip.closeStandalone && _isNextWhitespace, 2400 inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; 2401 2402 if (strip.close) { 2403 omitRight(body, i, true); 2404 } 2405 if (strip.open) { 2406 omitLeft(body, i, true); 2407 } 2408 2409 if (doStandalone && inlineStandalone) { 2410 omitRight(body, i); 2411 2412 if (omitLeft(body, i)) { 2413 // If we are on a standalone node, save the indent info for partials 2414 if (current.type === 'PartialStatement') { 2415 // Pull out the whitespace from the final line 2416 current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1]; 2417 } 2418 } 2419 } 2420 if (doStandalone && openStandalone) { 2421 omitRight((current.program || current.inverse).body); 2422 2423 // Strip out the previous content node if it's whitespace only 2424 omitLeft(body, i); 2425 } 2426 if (doStandalone && closeStandalone) { 2427 // Always strip the next node 2428 omitRight(body, i); 2429 2430 omitLeft((current.inverse || current.program).body); 2431 } 2432 } 2433 2434 return program; 2435 }; 2436 2437 WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) { 2438 this.accept(block.program); 2439 this.accept(block.inverse); 2440 2441 // Find the inverse program that is involed with whitespace stripping. 2442 var program = block.program || block.inverse, 2443 inverse = block.program && block.inverse, 2444 firstInverse = inverse, 2445 lastInverse = inverse; 2446 2447 if (inverse && inverse.chained) { 2448 firstInverse = inverse.body[0].program; 2449 2450 // Walk the inverse chain to find the last inverse that is actually in the chain. 2451 while (lastInverse.chained) { 2452 lastInverse = lastInverse.body[lastInverse.body.length - 1].program; 2453 } 2454 } 2455 2456 var strip = { 2457 open: block.openStrip.open, 2458 close: block.closeStrip.close, 2459 2460 // Determine the standalone candiacy. Basically flag our content as being possibly standalone 2461 // so our parent can determine if we actually are standalone 2462 openStandalone: isNextWhitespace(program.body), 2463 closeStandalone: isPrevWhitespace((firstInverse || program).body) 2464 }; 2465 2466 if (block.openStrip.close) { 2467 omitRight(program.body, null, true); 2468 } 2469 2470 if (inverse) { 2471 var inverseStrip = block.inverseStrip; 2472 2473 if (inverseStrip.open) { 2474 omitLeft(program.body, null, true); 2475 } 2476 2477 if (inverseStrip.close) { 2478 omitRight(firstInverse.body, null, true); 2479 } 2480 if (block.closeStrip.open) { 2481 omitLeft(lastInverse.body, null, true); 2482 } 2483 2484 // Find standalone else statments 2485 if (!this.options.ignoreStandalone && isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) { 2486 omitLeft(program.body); 2487 omitRight(firstInverse.body); 2488 } 2489 } else if (block.closeStrip.open) { 2490 omitLeft(program.body, null, true); 2491 } 2492 2493 return strip; 2494 }; 2495 2496 WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function (mustache) { 2497 return mustache.strip; 2498 }; 2499 2500 WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) { 2501 /* istanbul ignore next */ 2502 var strip = node.strip || {}; 2503 return { 2504 inlineStandalone: true, 2505 open: strip.open, 2506 close: strip.close 2507 }; 2508 }; 2509 2510 function isPrevWhitespace(body, i, isRoot) { 2511 if (i === undefined) { 2512 i = body.length; 2513 } 2514 2515 // Nodes that end with newlines are considered whitespace (but are special 2516 // cased for strip operations) 2517 var prev = body[i - 1], 2518 sibling = body[i - 2]; 2519 if (!prev) { 2520 return isRoot; 2521 } 2522 2523 if (prev.type === 'ContentStatement') { 2524 return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original); 2525 } 2526 } 2527 function isNextWhitespace(body, i, isRoot) { 2528 if (i === undefined) { 2529 i = -1; 2530 } 2531 2532 var next = body[i + 1], 2533 sibling = body[i + 2]; 2534 if (!next) { 2535 return isRoot; 2536 } 2537 2538 if (next.type === 'ContentStatement') { 2539 return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original); 2540 } 2541 } 2542 2543 // Marks the node to the right of the position as omitted. 2544 // I.e. {{foo}}' ' will mark the ' ' node as omitted. 2545 // 2546 // If i is undefined, then the first child will be marked as such. 2547 // 2548 // If mulitple is truthy then all whitespace will be stripped out until non-whitespace 2549 // content is met. 2550 function omitRight(body, i, multiple) { 2551 var current = body[i == null ? 0 : i + 1]; 2552 if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) { 2553 return; 2554 } 2555 2556 var original = current.value; 2557 current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, ''); 2558 current.rightStripped = current.value !== original; 2559 } 2560 2561 // Marks the node to the left of the position as omitted. 2562 // I.e. ' '{{foo}} will mark the ' ' node as omitted. 2563 // 2564 // If i is undefined then the last child will be marked as such. 2565 // 2566 // If mulitple is truthy then all whitespace will be stripped out until non-whitespace 2567 // content is met. 2568 function omitLeft(body, i, multiple) { 2569 var current = body[i == null ? body.length - 1 : i - 1]; 2570 if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) { 2571 return; 2572 } 2573 2574 // We omit the last node if it's whitespace only and not preceeded by a non-content node. 2575 var original = current.value; 2576 current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, ''); 2577 current.leftStripped = current.value !== original; 2578 return current.leftStripped; 2579 } 2580 2581 exports['default'] = WhitespaceControl; 2582 module.exports = exports['default']; 2583 2584/***/ }), 2585/* 39 */ 2586/***/ (function(module, exports, __webpack_require__) { 2587 2588 'use strict'; 2589 2590 var _interopRequireDefault = __webpack_require__(1)['default']; 2591 2592 exports.__esModule = true; 2593 2594 var _exception = __webpack_require__(6); 2595 2596 var _exception2 = _interopRequireDefault(_exception); 2597 2598 function Visitor() { 2599 this.parents = []; 2600 } 2601 2602 Visitor.prototype = { 2603 constructor: Visitor, 2604 mutating: false, 2605 2606 // Visits a given value. If mutating, will replace the value if necessary. 2607 acceptKey: function acceptKey(node, name) { 2608 var value = this.accept(node[name]); 2609 if (this.mutating) { 2610 // Hacky sanity check: This may have a few false positives for type for the helper 2611 // methods but will generally do the right thing without a lot of overhead. 2612 if (value && !Visitor.prototype[value.type]) { 2613 throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); 2614 } 2615 node[name] = value; 2616 } 2617 }, 2618 2619 // Performs an accept operation with added sanity check to ensure 2620 // required keys are not removed. 2621 acceptRequired: function acceptRequired(node, name) { 2622 this.acceptKey(node, name); 2623 2624 if (!node[name]) { 2625 throw new _exception2['default'](node.type + ' requires ' + name); 2626 } 2627 }, 2628 2629 // Traverses a given array. If mutating, empty respnses will be removed 2630 // for child elements. 2631 acceptArray: function acceptArray(array) { 2632 for (var i = 0, l = array.length; i < l; i++) { 2633 this.acceptKey(array, i); 2634 2635 if (!array[i]) { 2636 array.splice(i, 1); 2637 i--; 2638 l--; 2639 } 2640 } 2641 }, 2642 2643 accept: function accept(object) { 2644 if (!object) { 2645 return; 2646 } 2647 2648 /* istanbul ignore next: Sanity code */ 2649 if (!this[object.type]) { 2650 throw new _exception2['default']('Unknown type: ' + object.type, object); 2651 } 2652 2653 if (this.current) { 2654 this.parents.unshift(this.current); 2655 } 2656 this.current = object; 2657 2658 var ret = this[object.type](object); 2659 2660 this.current = this.parents.shift(); 2661 2662 if (!this.mutating || ret) { 2663 return ret; 2664 } else if (ret !== false) { 2665 return object; 2666 } 2667 }, 2668 2669 Program: function Program(program) { 2670 this.acceptArray(program.body); 2671 }, 2672 2673 MustacheStatement: visitSubExpression, 2674 Decorator: visitSubExpression, 2675 2676 BlockStatement: visitBlock, 2677 DecoratorBlock: visitBlock, 2678 2679 PartialStatement: visitPartial, 2680 PartialBlockStatement: function PartialBlockStatement(partial) { 2681 visitPartial.call(this, partial); 2682 2683 this.acceptKey(partial, 'program'); 2684 }, 2685 2686 ContentStatement: function ContentStatement() /* content */{}, 2687 CommentStatement: function CommentStatement() /* comment */{}, 2688 2689 SubExpression: visitSubExpression, 2690 2691 PathExpression: function PathExpression() /* path */{}, 2692 2693 StringLiteral: function StringLiteral() /* string */{}, 2694 NumberLiteral: function NumberLiteral() /* number */{}, 2695 BooleanLiteral: function BooleanLiteral() /* bool */{}, 2696 UndefinedLiteral: function UndefinedLiteral() /* literal */{}, 2697 NullLiteral: function NullLiteral() /* literal */{}, 2698 2699 Hash: function Hash(hash) { 2700 this.acceptArray(hash.pairs); 2701 }, 2702 HashPair: function HashPair(pair) { 2703 this.acceptRequired(pair, 'value'); 2704 } 2705 }; 2706 2707 function visitSubExpression(mustache) { 2708 this.acceptRequired(mustache, 'path'); 2709 this.acceptArray(mustache.params); 2710 this.acceptKey(mustache, 'hash'); 2711 } 2712 function visitBlock(block) { 2713 visitSubExpression.call(this, block); 2714 2715 this.acceptKey(block, 'program'); 2716 this.acceptKey(block, 'inverse'); 2717 } 2718 function visitPartial(partial) { 2719 this.acceptRequired(partial, 'name'); 2720 this.acceptArray(partial.params); 2721 this.acceptKey(partial, 'hash'); 2722 } 2723 2724 exports['default'] = Visitor; 2725 module.exports = exports['default']; 2726 2727/***/ }), 2728/* 40 */ 2729/***/ (function(module, exports, __webpack_require__) { 2730 2731 'use strict'; 2732 2733 var _interopRequireDefault = __webpack_require__(1)['default']; 2734 2735 exports.__esModule = true; 2736 exports.SourceLocation = SourceLocation; 2737 exports.id = id; 2738 exports.stripFlags = stripFlags; 2739 exports.stripComment = stripComment; 2740 exports.preparePath = preparePath; 2741 exports.prepareMustache = prepareMustache; 2742 exports.prepareRawBlock = prepareRawBlock; 2743 exports.prepareBlock = prepareBlock; 2744 exports.prepareProgram = prepareProgram; 2745 exports.preparePartialBlock = preparePartialBlock; 2746 2747 var _exception = __webpack_require__(6); 2748 2749 var _exception2 = _interopRequireDefault(_exception); 2750 2751 function validateClose(open, close) { 2752 close = close.path ? close.path.original : close; 2753 2754 if (open.path.original !== close) { 2755 var errorNode = { loc: open.path.loc }; 2756 2757 throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode); 2758 } 2759 } 2760 2761 function SourceLocation(source, locInfo) { 2762 this.source = source; 2763 this.start = { 2764 line: locInfo.first_line, 2765 column: locInfo.first_column 2766 }; 2767 this.end = { 2768 line: locInfo.last_line, 2769 column: locInfo.last_column 2770 }; 2771 } 2772 2773 function id(token) { 2774 if (/^\[.*\]$/.test(token)) { 2775 return token.substr(1, token.length - 2); 2776 } else { 2777 return token; 2778 } 2779 } 2780 2781 function stripFlags(open, close) { 2782 return { 2783 open: open.charAt(2) === '~', 2784 close: close.charAt(close.length - 3) === '~' 2785 }; 2786 } 2787 2788 function stripComment(comment) { 2789 return comment.replace(/^\{\{~?\!-?-?/, '').replace(/-?-?~?\}\}$/, ''); 2790 } 2791 2792 function preparePath(data, parts, loc) { 2793 loc = this.locInfo(loc); 2794 2795 var original = data ? '@' : '', 2796 dig = [], 2797 depth = 0, 2798 depthString = ''; 2799 2800 for (var i = 0, l = parts.length; i < l; i++) { 2801 var part = parts[i].part, 2802 2803 // If we have [] syntax then we do not treat path references as operators, 2804 // i.e. foo.[this] resolves to approximately context.foo['this'] 2805 isLiteral = parts[i].original !== part; 2806 original += (parts[i].separator || '') + part; 2807 2808 if (!isLiteral && (part === '..' || part === '.' || part === 'this')) { 2809 if (dig.length > 0) { 2810 throw new _exception2['default']('Invalid path: ' + original, { loc: loc }); 2811 } else if (part === '..') { 2812 depth++; 2813 depthString += '../'
vendor: 3,286 bytes, lines 2813-2961
2813; 2814 } 2815 } else { 2816 dig.push(part); 2817 } 2818 } 2819 2820 return { 2821 type: 'PathExpression', 2822 data: data, 2823 depth: depth, 2824 parts: dig, 2825 original: original, 2826 loc: loc 2827 }; 2828 } 2829 2830 function prepareMustache(path, params, hash, open, strip, locInfo) { 2831 // Must use charAt to support IE pre-10 2832 var escapeFlag = open.charAt(3) || open.charAt(2), 2833 escaped = escapeFlag !== '{' && escapeFlag !== '&'; 2834 2835 var decorator = /\*/.test(open); 2836 return { 2837 type: decorator ? 'Decorator' : 'MustacheStatement', 2838 path: path, 2839 params: params, 2840 hash: hash, 2841 escaped: escaped, 2842 strip: strip, 2843 loc: this.locInfo(locInfo) 2844 }; 2845 } 2846 2847 function prepareRawBlock(openRawBlock, contents, close, locInfo) { 2848 validateClose(openRawBlock, close); 2849 2850 locInfo = this.locInfo(locInfo); 2851 var program = { 2852 type: 'Program', 2853 body: contents, 2854 strip: {}, 2855 loc: locInfo 2856 }; 2857 2858 return { 2859 type: 'BlockStatement', 2860 path: openRawBlock.path, 2861 params: openRawBlock.params, 2862 hash: openRawBlock.hash, 2863 program: program, 2864 openStrip: {}, 2865 inverseStrip: {}, 2866 closeStrip: {}, 2867 loc: locInfo 2868 }; 2869 } 2870 2871 function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { 2872 if (close && close.path) { 2873 validateClose(openBlock, close); 2874 } 2875 2876 var decorator = /\*/.test(openBlock.open); 2877 2878 program.blockParams = openBlock.blockParams; 2879 2880 var inverse = undefined, 2881 inverseStrip = undefined; 2882 2883 if (inverseAndProgram) { 2884 if (decorator) { 2885 throw new _exception2['default']('Unexpected inverse block on decorator', inverseAndProgram); 2886 } 2887 2888 if (inverseAndProgram.chain) { 2889 inverseAndProgram.program.body[0].closeStrip = close.strip; 2890 } 2891 2892 inverseStrip = inverseAndProgram.strip; 2893 inverse = inverseAndProgram.program; 2894 } 2895 2896 if (inverted) { 2897 inverted = inverse; 2898 inverse = program; 2899 program = inverted; 2900 } 2901 2902 return { 2903 type: decorator ? 'DecoratorBlock' : 'BlockStatement', 2904 path: openBlock.path, 2905 params: openBlock.params, 2906 hash: openBlock.hash, 2907 program: program, 2908 inverse: inverse, 2909 openStrip: openBlock.strip, 2910 inverseStrip: inverseStrip, 2911 closeStrip: close && close.strip, 2912 loc: this.locInfo(locInfo) 2913 }; 2914 } 2915 2916 function prepareProgram(statements, loc) { 2917 if (!loc && statements.length) { 2918 var firstLoc = statements[0].loc, 2919 lastLoc = statements[statements.length - 1].loc; 2920 2921 /* istanbul ignore else */ 2922 if (firstLoc && lastLoc) { 2923 loc = { 2924 source: firstLoc.source, 2925 start: { 2926 line: firstLoc.start.line, 2927 column: firstLoc.start.column 2928 }, 2929 end: { 2930 line: lastLoc.end.line, 2931 column: lastLoc.end.column 2932 } 2933 }; 2934 } 2935 } 2936 2937 return { 2938 type: 'Program', 2939 body: statements, 2940 strip: {}, 2941 loc: loc 2942 }; 2943 } 2944 2945 function preparePartialBlock(open, program, close, locInfo) { 2946 validateClose(open, close); 2947 2948 return { 2949 type: 'PartialBlockStatement', 2950 name: open.path, 2951 params: open.params, 2952 hash: open.hash, 2953 program: program, 2954 openStrip: open.strip, 2955 closeStrip: close && close.strip, 2956 loc: this.locInfo(locInfo) 2957 }; 2958 } 2959 2960/***/ }), 2961/* 4
29611 */ 2962/***/ (function(module, exports, __webpack_require__) { 2963 2964 /* eslint-disable new-cap */ 2965 2966 'use strict'; 2967 2968 var _interopRequireDefault = __webpack_require__(1)['default']; 2969 2970 exports.__esModule = true; 2971 exports.Compiler = Compiler; 2972 exports.precompile = precompile; 2973 exports.compile = compile; 2974 2975 var _exception = __webpack_require__(6); 2976 2977 var _exception2 = _interopRequireDefault(_exception); 2978 2979 var _utils = __webpack_require__(5); 2980 2981 var _ast = __webpack_require__(35); 2982 2983 var _ast2 = _interopRequireDefault(_ast); 2984 2985 var slice = [].slice; 2986 2987 function Compiler() {} 2988 2989 // the foundHelper register will disambiguate helper lookup from finding a 2990 // function in a context. This is necessary for mustache compatibility, which 2991 // requires that context functions in blocks are evaluated by blockHelperMissing, 2992 // and then proceed as if the resulting value was provided to blockHelperMissing. 2993 2994 Compiler.prototype = { 2995 compiler: Compiler, 2996 2997 equals: function equals(other) { 2998 var len = this.opcodes.length; 2999 if (other.opcodes.length !== len) { 3000 return false; 3001 } 3002 3003 for (var i = 0; i < len; i++) { 3004 var opcode = this.opcodes[i], 3005 otherOpcode = other.opcodes[i]; 3006 if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) { 3007 return false; 3008 } 3009 } 3010 3011 // We know that length is the same between the two arrays because they are directly tied 3012 // to the opcode behavior above. 3013 len = this.children.length; 3014 for (var i = 0; i < len; i++) { 3015 if (!this.children[i].equals(other.children[i])) { 3016 return false; 3017 } 3018 } 3019 3020 return true; 3021 }, 3022 3023 guid: 0, 3024 3025 compile: function compile(program, options) { 3026 this.sourceNode = []; 3027 this.opcodes = []; 3028 this.children = []; 3029 this.options = options; 3030 this.stringParams = options.stringParams; 3031 this.trackIds = options.trackIds; 3032 3033 options.blockParams = options.blockParams || []; 3034 3035 // These changes will propagate to the other compiler components 3036 var knownHelpers = options.knownHelpers; 3037 options.knownHelpers = { 3038 'helperMissing': true, 3039 'blockHelperMissing': true, 3040 'each': true, 3041 'if': true, 3042 'unless': true, 3043 'with': true, 3044 'log': true, 3045 'lookup': true 3046 }; 3047 if (knownHelpers) { 3048 for (var _name in knownHelpers) { 3049 /* istanbul ignore else */ 3050 if (_name in knownHelpers) { 3051 this.options.knownHelpers[_name] = knownHelpers[_name]; 3052 } 3053 } 3054 }
vendor: 8,795 bytes, lines 3054-3348
3054 3055 3056 return this.accept(program); 3057 }, 3058 3059 compileProgram: function compileProgram(program) { 3060 var childCompiler = new this.compiler(), 3061 // eslint-disable-line new-cap 3062 result = childCompiler.compile(program, this.options), 3063 guid = this.guid++; 3064 3065 this.usePartial = this.usePartial || result.usePartial; 3066 3067 this.children[guid] = result; 3068 this.useDepths = this.useDepths || result.useDepths; 3069 3070 return guid; 3071 }, 3072 3073 accept: function accept(node) { 3074 /* istanbul ignore next: Sanity code */ 3075 if (!this[node.type]) { 3076 throw new _exception2['default']('Unknown type: ' + node.type, node); 3077 } 3078 3079 this.sourceNode.unshift(node); 3080 var ret = this[node.type](node); 3081 this.sourceNode.shift(); 3082 return ret; 3083 }, 3084 3085 Program: function Program(program) { 3086 this.options.blockParams.unshift(program.blockParams); 3087 3088 var body = program.body, 3089 bodyLength = body.length; 3090 for (var i = 0; i < bodyLength; i++) { 3091 this.accept(body[i]); 3092 } 3093 3094 this.options.blockParams.shift(); 3095 3096 this.isSimple = bodyLength === 1; 3097 this.blockParams = program.blockParams ? program.blockParams.length : 0; 3098 3099 return this; 3100 }, 3101 3102 BlockStatement: function BlockStatement(block) { 3103 transformLiteralToPath(block); 3104 3105 var program = block.program, 3106 inverse = block.inverse; 3107 3108 program = program && this.compileProgram(program); 3109 inverse = inverse && this.compileProgram(inverse); 3110 3111 var type = this.classifySexpr(block); 3112 3113 if (type === 'helper') { 3114 this.helperSexpr(block, program, inverse); 3115 } else if (type === 'simple') { 3116 this.simpleSexpr(block); 3117 3118 // now that the simple mustache is resolved, we need to 3119 // evaluate it by executing `blockHelperMissing` 3120 this.opcode('pushProgram', program); 3121 this.opcode('pushProgram', inverse); 3122 this.opcode('emptyHash'); 3123 this.opcode('blockValue', block.path.original); 3124 } else { 3125 this.ambiguousSexpr(block, program, inverse); 3126 3127 // now that the simple mustache is resolved, we need to 3128 // evaluate it by executing `blockHelperMissing` 3129 this.opcode('pushProgram', program); 3130 this.opcode('pushProgram', inverse); 3131 this.opcode('emptyHash'); 3132 this.opcode('ambiguousBlockValue'); 3133 } 3134 3135 this.opcode('append'); 3136 }, 3137 3138 DecoratorBlock: function DecoratorBlock(decorator) { 3139 var program = decorator.program && this.compileProgram(decorator.program); 3140 var params = this.setupFullMustacheParams(decorator, program, undefined), 3141 path = decorator.path; 3142 3143 this.useDecorators = true; 3144 this.opcode('registerDecorator', params.length, path.original); 3145 }, 3146 3147 PartialStatement: function PartialStatement(partial) { 3148 this.usePartial = true; 3149 3150 var program = partial.program; 3151 if (program) { 3152 program = this.compileProgram(partial.program); 3153 } 3154 3155 var params = partial.params; 3156 if (params.length > 1) { 3157 throw new _exception2['default']('Unsupported number of partial arguments: ' + params.length, partial); 3158 } else if (!params.length) { 3159 if (this.options.explicitPartialContext) { 3160 this.opcode('pushLiteral', 'undefined'); 3161 } else { 3162 params.push({ type: 'PathExpression', parts: [], depth: 0 }); 3163 } 3164 } 3165 3166 var partialName = partial.name.original, 3167 isDynamic = partial.name.type === 'SubExpression'; 3168 if (isDynamic) { 3169 this.accept(partial.name); 3170 } 3171 3172 this.setupFullMustacheParams(partial, program, undefined, true); 3173 3174 var indent = partial.indent || ''; 3175 if (this.options.preventIndent && indent) { 3176 this.opcode('appendContent', indent); 3177 indent = ''; 3178 } 3179 3180 this.opcode('invokePartial', isDynamic, partialName, indent); 3181 this.opcode('append'); 3182 }, 3183 PartialBlockStatement: function PartialBlockStatement(partialBlock) { 3184 this.PartialStatement(partialBlock); 3185 }, 3186 3187 MustacheStatement: function MustacheStatement(mustache) { 3188 this.SubExpression(mustache); 3189 3190 if (mustache.escaped && !this.options.noEscape) { 3191 this.opcode('appendEscaped'); 3192 } else { 3193 this.opcode('append'); 3194 } 3195 }, 3196 Decorator: function Decorator(decorator) { 3197 this.DecoratorBlock(decorator); 3198 }, 3199 3200 ContentStatement: function ContentStatement(content) { 3201 if (content.value) { 3202 this.opcode('appendContent', content.value); 3203 } 3204 }, 3205 3206 CommentStatement: function CommentStatement() {}, 3207 3208 SubExpression: function SubExpression(sexpr) { 3209 transformLiteralToPath(sexpr); 3210 var type = this.classifySexpr(sexpr); 3211 3212 if (type === 'simple') { 3213 this.simpleSexpr(sexpr); 3214 } else if (type === 'helper') { 3215 this.helperSexpr(sexpr); 3216 } else { 3217 this.ambiguousSexpr(sexpr); 3218 } 3219 }, 3220 ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) { 3221 var path = sexpr.path, 3222 name = path.parts[0], 3223 isBlock = program != null || inverse != null; 3224 3225 this.opcode('getContext', path.depth); 3226 3227 this.opcode('pushProgram', program); 3228 this.opcode('pushProgram', inverse); 3229 3230 path.strict = true; 3231 this.accept(path); 3232 3233 this.opcode('invokeAmbiguous', name, isBlock); 3234 }, 3235 3236 simpleSexpr: function simpleSexpr(sexpr) { 3237 var path = sexpr.path; 3238 path.strict = true; 3239 this.accept(path); 3240 this.opcode('resolvePossibleLambda'); 3241 }, 3242 3243 helperSexpr: function helperSexpr(sexpr, program, inverse) { 3244 var params = this.setupFullMustacheParams(sexpr, program, inverse), 3245 path = sexpr.path, 3246 name = path.parts[0]; 3247 3248 if (this.options.knownHelpers[name]) { 3249 this.opcode('invokeKnownHelper', params.length, name); 3250 } else if (this.options.knownHelpersOnly) { 3251 throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr); 3252 } else { 3253 path.strict = true; 3254 path.falsy = true; 3255 3256 this.accept(path); 3257 this.opcode('invokeHelper', params.length, path.original, _ast2['default'].helpers.simpleId(path)); 3258 } 3259 }, 3260 3261 PathExpression: function PathExpression(path) { 3262 this.addDepth(path.depth); 3263 this.opcode('getContext', path.depth); 3264 3265 var name = path.parts[0], 3266 scoped = _ast2['default'].helpers.scopedId(path), 3267 blockParamId = !path.depth && !scoped && this.blockParamIndex(name); 3268 3269 if (blockParamId) { 3270 this.opcode('lookupBlockParam', blockParamId, path.parts); 3271 } else if (!name) { 3272 // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` 3273 this.opcode('pushContext'); 3274 } else if (path.data) { 3275 this.options.data = true; 3276 this.opcode('lookupData', path.depth, path.parts, path.strict); 3277 } else { 3278 this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped); 3279 } 3280 }, 3281 3282 StringLiteral: function StringLiteral(string) { 3283 this.opcode('pushString', string.value); 3284 }, 3285 3286 NumberLiteral: function NumberLiteral(number) { 3287 this.opcode('pushLiteral', number.value); 3288 }, 3289 3290 BooleanLiteral: function BooleanLiteral(bool) { 3291 this.opcode('pushLiteral', bool.value); 3292 }, 3293 3294 UndefinedLiteral: function UndefinedLiteral() { 3295 this.opcode('pushLiteral', 'undefined'); 3296 }, 3297 3298 NullLiteral: function NullLiteral() { 3299 this.opcode('pushLiteral', 'null'); 3300 }, 3301 3302 Hash: function Hash(hash) { 3303 var pairs = hash.pairs, 3304 i = 0, 3305 l = pairs.length; 3306 3307 this.opcode('pushHash'); 3308 3309 for (; i < l; i++) { 3310 this.pushParam(pairs[i].value); 3311 } 3312 while (i--) { 3313 this.opcode('assignToHash', pairs[i].key); 3314 } 3315 this.opcode('popHash'); 3316 }, 3317 3318 // HELPERS 3319 opcode: function opcode(name) { 3320 this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc }); 3321 }, 3322 3323 addDepth: function addDepth(depth) { 3324 if (!depth) { 3325 return; 3326 } 3327 3328 this.useDepths = true; 3329 }, 3330 3331 classifySexpr: function classifySexpr(sexpr) { 3332 var isSimple = _ast2['default'].helpers.simpleId(sexpr.path); 3333 3334 var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]); 3335 3336 // a mustache is an eligible helper if: 3337 // * its id is simple (a single part, not `this` or `..`) 3338 var isHelper = !isBlockParam && _ast2['default'].helpers.helperExpression(sexpr); 3339 3340 // if a mustache is an eligible helper but not a definite 3341 // helper, it is ambiguous, and will be resolved in a later 3342 // pass or at runtime. 3343 var isEligible = !isBlockParam && (isHelper || isSimple); 3344 3345 // if ambiguous, we can possibly resolve the ambiguity now 3346 // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. 3347 if (isEligible && !isHelper) { 3348 var _name
vendor: 4,602 bytes, lines 3348-3505
33482 = sexpr.path.parts[0], 3349 options = this.options; 3350 3351 if (options.knownHelpers[_name2]) { 3352 isHelper = true; 3353 } else if (options.knownHelpersOnly) { 3354 isEligible = false; 3355 } 3356 } 3357 3358 if (isHelper) { 3359 return 'helper'; 3360 } else if (isEligible) { 3361 return 'ambiguous'; 3362 } else { 3363 return 'simple'; 3364 } 3365 }, 3366 3367 pushParams: function pushParams(params) { 3368 for (var i = 0, l = params.length; i < l; i++) { 3369 this.pushParam(params[i]); 3370 } 3371 }, 3372 3373 pushParam: function pushParam(val) { 3374 var value = val.value != null ? val.value : val.original || ''; 3375 3376 if (this.stringParams) { 3377 if (value.replace) { 3378 value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.'); 3379 } 3380 3381 if (val.depth) { 3382 this.addDepth(val.depth); 3383 } 3384 this.opcode('getContext', val.depth || 0); 3385 this.opcode('pushStringParam', value, val.type); 3386 3387 if (val.type === 'SubExpression') { 3388 // SubExpressions get evaluated and passed in 3389 // in string params mode. 3390 this.accept(val); 3391 } 3392 } else { 3393 if (this.trackIds) { 3394 var blockParamIndex = undefined; 3395 if (val.parts && !_ast2['default'].helpers.scopedId(val) && !val.depth) { 3396 blockParamIndex = this.blockParamIndex(val.parts[0]); 3397 } 3398 if (blockParamIndex) { 3399 var blockParamChild = val.parts.slice(1).join('.'); 3400 this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild); 3401 } else { 3402 value = val.original || value; 3403 if (value.replace) { 3404 value = value.replace(/^this(?:\.|$)/, '').replace(/^\.\//, '').replace(/^\.$/, ''); 3405 } 3406 3407 this.opcode('pushId', val.type, value); 3408 } 3409 } 3410 this.accept(val); 3411 } 3412 }, 3413 3414 setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) { 3415 var params = sexpr.params; 3416 this.pushParams(params); 3417 3418 this.opcode('pushProgram', program); 3419 this.opcode('pushProgram', inverse); 3420 3421 if (sexpr.hash) { 3422 this.accept(sexpr.hash); 3423 } else { 3424 this.opcode('emptyHash', omitEmpty); 3425 } 3426 3427 return params; 3428 }, 3429 3430 blockParamIndex: function blockParamIndex(name) { 3431 for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) { 3432 var blockParams = this.options.blockParams[depth], 3433 param = blockParams && _utils.indexOf(blockParams, name); 3434 if (blockParams && param >= 0) { 3435 return [depth, param]; 3436 } 3437 } 3438 } 3439 }; 3440 3441 function precompile(input, options, env) { 3442 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 3443 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input); 3444 } 3445 3446 options = options || {}; 3447 if (!('data' in options)) { 3448 options.data = true; 3449 } 3450 if (options.compat) { 3451 options.useDepths = true; 3452 } 3453 3454 var ast = env.parse(input, options), 3455 environment = new env.Compiler().compile(ast, options); 3456 return new env.JavaScriptCompiler().compile(environment, options); 3457 } 3458 3459 function compile(input, options, env) { 3460 if (options === undefined) options = {}; 3461 3462 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 3463 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input); 3464 } 3465 3466 options = _utils.extend({}, options); 3467 if (!('data' in options)) { 3468 options.data = true; 3469 } 3470 if (options.compat) { 3471 options.useDepths = true; 3472 } 3473 3474 var compiled = undefined; 3475 3476 function compileInput() { 3477 var ast = env.parse(input, options), 3478 environment = new env.Compiler().compile(ast, options), 3479 templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); 3480 return env.template(templateSpec); 3481 } 3482 3483 // Template is only compiled on first use and cached after that point. 3484 function ret(context, execOptions) { 3485 if (!compiled) { 3486 compiled = compileInput(); 3487 } 3488 return compiled.call(this, context, execOptions); 3489 } 3490 ret._setup = function (setupOptions) { 3491 if (!compiled) { 3492 compiled = compileInput(); 3493 } 3494 return compiled._setup(setupOptions); 3495 }; 3496 ret._child = function (i, data, blockParams, depths) { 3497 if (!compiled) { 3498 compiled = compileInput(); 3499 } 3500 return compiled._child(i, data, blockParams, depths); 3501 }; 3502 return ret; 3503 } 3504 3505 function argEquals(a, b) {
vendor: 8,012 bytes, lines 3506-3772
3506 if (a === b) { 3507 return true; 3508 } 3509 3510 if (_utils.isArray(a) && _utils.isArray(b) && a.length === b.length) { 3511 for (var i = 0; i < a.length; i++) { 3512 if (!argEquals(a[i], b[i])) { 3513 return false; 3514 } 3515 } 3516 return true; 3517 } 3518 } 3519 3520 function transformLiteralToPath(sexpr) { 3521 if (!sexpr.path.parts) { 3522 var literal = sexpr.path; 3523 // Casting to string here to make false and 0 literal values play nicely with the rest 3524 // of the system. 3525 sexpr.path = { 3526 type: 'PathExpression', 3527 data: false, 3528 depth: 0, 3529 parts: [literal.original + ''], 3530 original: literal.original + '', 3531 loc: literal.loc 3532 }; 3533 } 3534 } 3535 3536/***/ }), 3537/* 42 */ 3538/***/ (function(module, exports, __webpack_require__) { 3539 3540 'use strict'; 3541 3542 var _interopRequireDefault = __webpack_require__(1)['default']; 3543 3544 exports.__esModule = true; 3545 3546 var _base = __webpack_require__(4); 3547 3548 var _exception = __webpack_require__(6); 3549 3550 var _exception2 = _interopRequireDefault(_exception); 3551 3552 var _utils = __webpack_require__(5); 3553 3554 var _codeGen = __webpack_require__(43); 3555 3556 var _codeGen2 = _interopRequireDefault(_codeGen); 3557 3558 function Literal(value) { 3559 this.value = value; 3560 } 3561 3562 function JavaScriptCompiler() {} 3563 3564 JavaScriptCompiler.prototype = { 3565 // PUBLIC API: You can override these methods in a subclass to provide 3566 // alternative compiled forms for name lookup and buffering semantics 3567 nameLookup: function nameLookup(parent, name /* , type*/) { 3568 if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { 3569 return [parent, '.', name]; 3570 } else { 3571 return [parent, '[', JSON.stringify(name), ']']; 3572 } 3573 }, 3574 depthedLookup: function depthedLookup(name) { 3575 return [this.aliasable('container.lookup'), '(depths, "', name, '")']; 3576 }, 3577 3578 compilerInfo: function compilerInfo() { 3579 var revision = _base.COMPILER_REVISION, 3580 versions = _base.REVISION_CHANGES[revision]; 3581 return [revision, versions]; 3582 }, 3583 3584 appendToBuffer: function appendToBuffer(source, location, explicit) { 3585 // Force a source as this simplifies the merge logic. 3586 if (!_utils.isArray(source)) { 3587 source = [source]; 3588 } 3589 source = this.source.wrap(source, location); 3590 3591 if (this.environment.isSimple) { 3592 return ['return ', source, ';']; 3593 } else if (explicit) { 3594 // This is a case where the buffer operation occurs as a child of another 3595 // construct, generally braces. We have to explicitly output these buffer 3596 // operations to ensure that the emitted code goes in the correct location. 3597 return ['buffer += ', source, ';']; 3598 } else { 3599 source.appendToBuffer = true; 3600 return source; 3601 } 3602 }, 3603 3604 initializeBuffer: function initializeBuffer() { 3605 return this.quotedString(''); 3606 }, 3607 // END PUBLIC API 3608 3609 compile: function compile(environment, options, context, asObject) { 3610 this.environment = environment; 3611 this.options = options; 3612 this.stringParams = this.options.stringParams; 3613 this.trackIds = this.options.trackIds; 3614 this.precompile = !asObject; 3615 3616 this.name = this.environment.name; 3617 this.isChild = !!context; 3618 this.context = context || { 3619 decorators: [], 3620 programs: [], 3621 environments: [] 3622 }; 3623 3624 this.preamble(); 3625 3626 this.stackSlot = 0; 3627 this.stackVars = []; 3628 this.aliases = {}; 3629 this.registers = { list: [] }; 3630 this.hashes = []; 3631 this.compileStack = []; 3632 this.inlineStack = []; 3633 this.blockParams = []; 3634 3635 this.compileChildren(environment, options); 3636 3637 this.useDepths = this.useDepths || environment.useDepths || environment.useDecorators || this.options.compat; 3638 this.useBlockParams = this.useBlockParams || environment.useBlockParams; 3639 3640 var opcodes = environment.opcodes, 3641 opcode = undefined, 3642 firstLoc = undefined, 3643 i = undefined, 3644 l = undefined; 3645 3646 for (i = 0, l = opcodes.length; i < l; i++) { 3647 opcode = opcodes[i]; 3648 3649 this.source.currentLocation = opcode.loc; 3650 firstLoc = firstLoc || opcode.loc; 3651 this[opcode.opcode].apply(this, opcode.args); 3652 } 3653 3654 // Flush any trailing content that might be pending. 3655 this.source.currentLocation = firstLoc; 3656 this.pushSource(''); 3657 3658 /* istanbul ignore next */ 3659 if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { 3660 throw new _exception2['default']('Compile completed with content left on stack'); 3661 } 3662 3663 if (!this.decorators.isEmpty()) { 3664 this.useDecorators = true; 3665 3666 this.decorators.prepend('var decorators = container.decorators;\n'); 3667 this.decorators.push('return fn;'); 3668 3669 if (asObject) { 3670 this.decorators = Function.apply(this, ['fn', 'props', 'container', 'depth0', 'data', 'blockParams', 'depths', this.decorators.merge()]); 3671 } else { 3672 this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths) {\n'); 3673 this.decorators.push('}\n'); 3674 this.decorators = this.decorators.merge(); 3675 } 3676 } else { 3677 this.decorators = undefined; 3678 } 3679 3680 var fn = this.createFunctionContext(asObject); 3681 if (!this.isChild) { 3682 var ret = { 3683 compiler: this.compilerInfo(), 3684 main: fn 3685 }; 3686 3687 if (this.decorators) { 3688 ret.main_d = this.decorators; // eslint-disable-line camelcase 3689 ret.useDecorators = true; 3690 } 3691 3692 var _context = this.context; 3693 var programs = _context.programs; 3694 var decorators = _context.decorators; 3695 3696 for (i = 0, l = programs.length; i < l; i++) { 3697 if (programs[i]) { 3698 ret[i] = programs[i]; 3699 if (decorators[i]) { 3700 ret[i + '_d'] = decorators[i]; 3701 ret.useDecorators = true; 3702 } 3703 } 3704 } 3705 3706 if (this.environment.usePartial) { 3707 ret.usePartial = true; 3708 } 3709 if (this.options.data) { 3710 ret.useData = true; 3711 } 3712 if (this.useDepths) { 3713 ret.useDepths = true; 3714 } 3715 if (this.useBlockParams) { 3716 ret.useBlockParams = true; 3717 } 3718 if (this.options.compat) { 3719 ret.compat = true; 3720 } 3721 3722 if (!asObject) { 3723 ret.compiler = JSON.stringify(ret.compiler); 3724 3725 this.source.currentLocation = { start: { line: 1, column: 0 } }; 3726 ret = this.objectLiteral(ret); 3727 3728 if (options.srcName) { 3729 ret = ret.toStringWithSourceMap({ file: options.destName }); 3730 ret.map = ret.map && ret.map.toString(); 3731 } else { 3732 ret = ret.toString(); 3733 } 3734 } else { 3735 ret.compilerOptions = this.options; 3736 } 3737 3738 return ret; 3739 } else { 3740 return fn; 3741 } 3742 }, 3743 3744 preamble: function preamble() { 3745 // track the last context pushed into place to allow skipping the 3746 // getContext opcode when it would be a noop 3747 this.lastContext = 0; 3748 this.source = new _codeGen2['default'](this.options.srcName); 3749 this.decorators = new _codeGen2['default'](this.options.srcName); 3750 }, 3751 3752 createFunctionContext: function createFunctionContext(asObject) { 3753 var varDeclarations = ''; 3754 3755 var locals = this.stackVars.concat(this.registers.list); 3756 if (locals.length > 0) { 3757 varDeclarations += ', ' + locals.join(', '); 3758 } 3759 3760 // Generate minimizer alias mappings 3761 // 3762 // When using true SourceNodes, this will update all references to the given alias 3763 // as the source nodes are reused in situ. For the non-source node compilation mode, 3764 // aliases will not be used, but this case is already being run on the client and 3765 // we aren't concern about minimizing the template size. 3766 var aliasCount = 0; 3767 for (var alias in this.aliases) { 3768 // eslint-disable-line guard-for-in 3769 var node = this.aliases[alias]; 3770 3771 if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) { 3772 varDeclarations += ', alias' + ++aliasCount + '=' + alias;
vendor: 4,556 bytes, lines 3773-3922
3773 node.children[0] = 'alias' + aliasCount; 3774 } 3775 } 3776 3777 var params = ['container', 'depth0', 'helpers', 'partials', 'data']; 3778 3779 if (this.useBlockParams || this.useDepths) { 3780 params.push('blockParams'); 3781 } 3782 if (this.useDepths) { 3783 params.push('depths'); 3784 } 3785 3786 // Perform a second pass over the output to merge content when possible 3787 var source = this.mergeSource(varDeclarations); 3788 3789 if (asObject) { 3790 params.push(source); 3791 3792 return Function.apply(this, params); 3793 } else { 3794 return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); 3795 } 3796 }, 3797 mergeSource: function mergeSource(varDeclarations) { 3798 var isSimple = this.environment.isSimple, 3799 appendOnly = !this.forceBuffer, 3800 appendFirst = undefined, 3801 sourceSeen = undefined, 3802 bufferStart = undefined, 3803 bufferEnd = undefined; 3804 this.source.each(function (line) { 3805 if (line.appendToBuffer) { 3806 if (bufferStart) { 3807 line.prepend(' + '); 3808 } else { 3809 bufferStart = line; 3810 } 3811 bufferEnd = line; 3812 } else { 3813 if (bufferStart) { 3814 if (!sourceSeen) { 3815 appendFirst = true; 3816 } else { 3817 bufferStart.prepend('buffer += '); 3818 } 3819 bufferEnd.add(';'); 3820 bufferStart = bufferEnd = undefined; 3821 } 3822 3823 sourceSeen = true; 3824 if (!isSimple) { 3825 appendOnly = false; 3826 } 3827 } 3828 }); 3829 3830 if (appendOnly) { 3831 if (bufferStart) { 3832 bufferStart.prepend('return '); 3833 bufferEnd.add(';'); 3834 } else if (!sourceSeen) { 3835 this.source.push('return "";'); 3836 } 3837 } else { 3838 varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer()); 3839 3840 if (bufferStart) { 3841 bufferStart.prepend('return buffer + '); 3842 bufferEnd.add(';'); 3843 } else { 3844 this.source.push('return buffer;'); 3845 } 3846 } 3847 3848 if (varDeclarations) { 3849 this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); 3850 } 3851 3852 return this.source.merge(); 3853 }, 3854 3855 // [blockValue] 3856 // 3857 // On stack, before: hash, inverse, program, value 3858 // On stack, after: return value of blockHelperMissing 3859 // 3860 // The purpose of this opcode is to take a block of the form 3861 // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and 3862 // replace it on the stack with the result of properly 3863 // invoking blockHelperMissing. 3864 blockValue: function blockValue(name) { 3865 var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), 3866 params = [this.contextName(0)]; 3867 this.setupHelperArgs(name, 0, params); 3868 3869 var blockName = this.popStack(); 3870 params.splice(1, 0, blockName); 3871 3872 this.push(this.source.functionCall(blockHelperMissing, 'call', params)); 3873 }, 3874 3875 // [ambiguousBlockValue] 3876 // 3877 // On stack, before: hash, inverse, program, value 3878 // Compiler value, before: lastHelper=value of last found helper, if any 3879 // On stack, after, if no lastHelper: same as [blockValue] 3880 // On stack, after, if lastHelper: value 3881 ambiguousBlockValue: function ambiguousBlockValue() { 3882 // We're being a bit cheeky and reusing the options value from the prior exec 3883 var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), 3884 params = [this.contextName(0)]; 3885 this.setupHelperArgs('', 0, params, true); 3886 3887 this.flushInline(); 3888 3889 var current = this.topStack(); 3890 params.splice(1, 0, current); 3891 3892 this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']); 3893 }, 3894 3895 // [appendContent] 3896 // 3897 // On stack, before: ... 3898 // On stack, after: ... 3899 // 3900 // Appends the string value of `content` to the current buffer 3901 appendContent: function appendContent(content) { 3902 if (this.pendingContent) { 3903 content = this.pendingContent + content; 3904 } else { 3905 this.pendingLocation = this.source.currentLocation; 3906 } 3907 3908 this.pendingContent = content; 3909 }, 3910 3911 // [append] 3912 // 3913 // On stack, before: value, ... 3914 // On stack, after: ... 3915 // 3916 // Coerces `value` to a String and appends it to the current buffer. 3917 // 3918 // If `value` is truthy, or 0, it is coerced into a string and appended 3919 // Otherwise, the empty string is appended 3920 append: function append() { 3921 if (this.isInline()) { 3922 this.replaceStack(function (current) {
vendor: 5,813 bytes, lines 3923-4115
3923 return [' != null ? ', current, ' : ""']; 3924 }); 3925 3926 this.pushSource(this.appendToBuffer(this.popStack())); 3927 } else { 3928 var local = this.popStack(); 3929 this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); 3930 if (this.environment.isSimple) { 3931 this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']); 3932 } 3933 } 3934 }, 3935 3936 // [appendEscaped] 3937 // 3938 // On stack, before: value, ... 3939 // On stack, after: ... 3940 // 3941 // Escape `value` and append it to the buffer 3942 appendEscaped: function appendEscaped() { 3943 this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'), '(', this.popStack(), ')'])); 3944 }, 3945 3946 // [getContext] 3947 // 3948 // On stack, before: ... 3949 // On stack, after: ... 3950 // Compiler value, after: lastContext=depth 3951 // 3952 // Set the value of the `lastContext` compiler value to the depth 3953 getContext: function getContext(depth) { 3954 this.lastContext = depth; 3955 }, 3956 3957 // [pushContext] 3958 // 3959 // On stack, before: ... 3960 // On stack, after: currentContext, ... 3961 // 3962 // Pushes the value of the current context onto the stack. 3963 pushContext: function pushContext() { 3964 this.pushStackLiteral(this.contextName(this.lastContext)); 3965 }, 3966 3967 // [lookupOnContext] 3968 // 3969 // On stack, before: ... 3970 // On stack, after: currentContext[name], ... 3971 // 3972 // Looks up the value of `name` on the current context and pushes 3973 // it onto the stack. 3974 lookupOnContext: function lookupOnContext(parts, falsy, strict, scoped) { 3975 var i = 0; 3976 3977 if (!scoped && this.options.compat && !this.lastContext) { 3978 // The depthed query is expected to handle the undefined logic for the root level that 3979 // is implemented below, so we evaluate that directly in compat mode 3980 this.push(this.depthedLookup(parts[i++])); 3981 } else { 3982 this.pushContext(); 3983 } 3984 3985 this.resolvePath('context', parts, i, falsy, strict); 3986 }, 3987 3988 // [lookupBlockParam] 3989 // 3990 // On stack, before: ... 3991 // On stack, after: blockParam[name], ... 3992 // 3993 // Looks up the value of `parts` on the given block param and pushes 3994 // it onto the stack. 3995 lookupBlockParam: function lookupBlockParam(blockParamId, parts) { 3996 this.useBlockParams = true; 3997 3998 this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); 3999 this.resolvePath('context', parts, 1); 4000 }, 4001 4002 // [lookupData] 4003 // 4004 // On stack, before: ... 4005 // On stack, after: data, ... 4006 // 4007 // Push the data lookup operator 4008 lookupData: function lookupData(depth, parts, strict) { 4009 if (!depth) { 4010 this.pushStackLiteral('data'); 4011 } else { 4012 this.pushStackLiteral('container.data(data, ' + depth + ')'); 4013 } 4014 4015 this.resolvePath('data', parts, 0, true, strict); 4016 }, 4017 4018 resolvePath: function resolvePath(type, parts, i, falsy, strict) { 4019 // istanbul ignore next 4020 4021 var _this = this; 4022 4023 if (this.options.strict || this.options.assumeObjects) { 4024 this.push(strictLookup(this.options.strict && strict, this, parts, type)); 4025 return; 4026 } 4027 4028 var len = parts.length; 4029 for (; i < len; i++) { 4030 /* eslint-disable no-loop-func */ 4031 this.replaceStack(function (current) { 4032 var lookup = _this.nameLookup(current, parts[i], type); 4033 // We want to ensure that zero and false are handled properly if the context (falsy flag) 4034 // needs to have the special handling for these values. 4035 if (!falsy) { 4036 return [' != null ? ', lookup, ' : ', current]; 4037 } else { 4038 // Otherwise we can use generic falsy handling 4039 return [' && ', lookup]; 4040 } 4041 }); 4042 /* eslint-enable no-loop-func */ 4043 } 4044 }, 4045 4046 // [resolvePossibleLambda] 4047 // 4048 // On stack, before: value, ... 4049 // On stack, after: resolved value, ... 4050 // 4051 // If the `value` is a lambda, replace it on the stack by 4052 // the return value of the lambda 4053 resolvePossibleLambda: function resolvePossibleLambda() { 4054 this.push([this.aliasable('container.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); 4055 }, 4056 4057 // [pushStringParam] 4058 // 4059 // On stack, before: ... 4060 // On stack, after: string, currentContext, ... 4061 // 4062 // This opcode is designed for use in string mode, which 4063 // provides the string value of a parameter along with its 4064 // depth rather than resolving it immediately. 4065 pushStringParam: function pushStringParam(string, type) { 4066 this.pushContext(); 4067 this.pushString(type); 4068 4069 // If it's a subexpression, the string result 4070 // will be pushed after this opcode. 4071 if (type !== 'SubExpression') { 4072 if (typeof string === 'string') { 4073 this.pushString(string); 4074 } else { 4075 this.pushStackLiteral(string); 4076 } 4077 } 4078 }, 4079 4080 emptyHash: function emptyHash(omitEmpty) { 4081 if (this.trackIds) { 4082 this.push('{}'); // hashIds 4083 } 4084 if (this.stringParams) { 4085 this.push('{}'); // hashContexts 4086 this.push('{}'); // hashTypes 4087 } 4088 this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); 4089 }, 4090 pushHash: function pushHash() { 4091 if (this.hash) { 4092 this.hashes.push(this.hash); 4093 } 4094 this.hash = { values: [], types: [], contexts: [], ids: [] }; 4095 }, 4096 popHash: function popHash() { 4097 var hash = this.hash; 4098 this.hash = this.hashes.pop(); 4099 4100 if (this.trackIds) { 4101 this.push(this.objectLiteral(hash.ids)); 4102 } 4103 if (this.stringParams) { 4104 this.push(this.objectLiteral(hash.contexts)); 4105 this.push(this.objectLiteral(hash.types)); 4106 } 4107 4108 this.push(this.objectLiteral(hash.values)); 4109 }, 4110 4111 // [pushString] 4112 // 4113 // On stack, before: ... 4114 // On stack, after: quotedString(string), ... 4115 //
4116 // Push a quoted version of `string` onto the stack 4117 pushString: function pushString(string) { 4118 this.pushStackLiteral(this.quotedString(string)); 4119 }, 4120 4121 // [pushLiteral] 4122 // 4123 // On stack, before: ... 4124 // On stack, after: value, ... 4125 // 4126 // Pushes a value onto the stack. This operation prevents 4127 // the compiler from creating a temporary variable to hold 4128 // it. 4129 pushLiteral: function pushLiteral(value) { 4130 this.pushStackLiteral(value); 4131 }, 4132 4133 // [pushProgram] 4134 // 4135 // On stack, before: ... 4136 // On stack, after: program(guid), ... 4137 // 4138 // Push a program expression onto the stack. This takes 4139 // a compile-time guid and converts it into a runtime-accessible 4140 // expression. 4141 pushProgram: function pushProgram(guid) { 4142 if (guid != null) { 4143 this.pushStackLiteral(this.programExpression(guid)); 4144 } else { 4145 this.pushStackLiteral(null); 4146 } 4147 }, 4148 4149 // [registerDecorator] 4150 // 4151 // On stack, before: hash, program, params..., ... 4152 // On stack, after: ... 4153 // 4154 // Pops off the decorator's parameters, invokes the decorator, 4155 // and inserts the decorator into the decorators list. 4156 registerDecorator: function registerDecorator(paramSize, name) { 4157 var foundDecorator = this.nameLookup('decorators', name, 'decorator'), 4158 options = this.setupHelperArgs(name, paramSize); 4159 4160 this.decorators.push(['fn = ', this.decorators.functionCall(foundDecorator, '', ['fn', 'props', 'container', options]), ' || fn;']); 4161 }, 4162 4163 // [invokeHelper] 4164 // 4165 // On stack, before: hash, inverse, program, params..., ... 4166 // On stack, after: result of helper invocation 4167 // 4168 // Pops off the helper's parameters, invokes the helper, 4169 // and pushes the helper's return value onto the stack. 4170 // 4171 // If the helper is not found, `helperMissing` is called. 4172 invokeHelper: function invokeHelper(paramSize, name, isSimple) { 4173 var nonHelper = this.popStack(), 4174 helper = this.setupHelper(paramSize, name), 4175 simple = isSimple ? [helper.name, ' || '] : ''; 4176 4177 var lookup = ['('].concat(simple, nonHelper); 4178 if (!this.options.strict) { 4179 lookup.push(' || ', this.aliasable('helpers.helperMissing')); 4180 } 4181 lookup.push(')'); 4182 4183 this.push(this.source.functionCall(lookup, 'call', helper.callParams)); 4184 }, 4185 4186 // [invokeKnownHelper] 4187 // 4188 // On stack, before: hash, inverse, program, params..., ... 4189 // On stack, after: result of helper invocation 4190 // 4191 // This operation is used when the helper is known to exist, 4192 // so a `helperMissing` fallback is not required. 4193 invokeKnownHelper: function invokeKnownHelper(paramSize, name) { 4194 var helper = this.setupHelper(paramSize, name); 4195 this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); 4196 }, 4197 4198 // [invokeAmbiguous] 4199 // 4200 // On stack, before: hash, inverse, program, params..., ... 4201 // On stack, after: result of disambiguation 4202 // 4203 // This operation is used when an expression like `{{foo}}` 4204 // is provided, but we don't know at compile-time whether it 4205 // is a helper or a path. 4206 // 4207 // This operation emits more code than the other options, 4208 // and can be avoided by passing the `knownHelpers` and 4209 // `knownHelpersOnly` flags at compile-time. 4210 invokeAmbiguous: function invokeAmbiguous(name, helperCall) { 4211 this.useRegister('helper'); 4212 4213 var nonHelper = this.popStack(); 4214 4215 this.emptyHash(); 4216 var helper = this.setupHelper(0, name, helperCall); 4217 4218 var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); 4219 4220 var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; 4221 if (!this.options.strict) { 4222 lookup[0] = '(helper = '; 4223 lookup.push(' != null ? helper : ', this.aliasable('helper
vendor: 11,305 bytes, lines 4223-4617
4223s.helperMissing')); 4224 } 4225 4226 this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']); 4227 }, 4228 4229 // [invokePartial] 4230 // 4231 // On stack, before: context, ... 4232 // On stack after: result of partial invocation 4233 // 4234 // This operation pops off a context, invokes a partial with that context, 4235 // and pushes the result of the invocation back. 4236 invokePartial: function invokePartial(isDynamic, name, indent) { 4237 var params = [], 4238 options = this.setupParams(name, 1, params); 4239 4240 if (isDynamic) { 4241 name = this.popStack(); 4242 delete options.name; 4243 } 4244 4245 if (indent) { 4246 options.indent = JSON.stringify(indent); 4247 } 4248 options.helpers = 'helpers'; 4249 options.partials = 'partials'; 4250 options.decorators = 'container.decorators'; 4251 4252 if (!isDynamic) { 4253 params.unshift(this.nameLookup('partials', name, 'partial')); 4254 } else { 4255 params.unshift(name); 4256 } 4257 4258 if (this.options.compat) { 4259 options.depths = 'depths'; 4260 } 4261 options = this.objectLiteral(options); 4262 params.push(options); 4263 4264 this.push(this.source.functionCall('container.invokePartial', '', params)); 4265 }, 4266 4267 // [assignToHash] 4268 // 4269 // On stack, before: value, ..., hash, ... 4270 // On stack, after: ..., hash, ... 4271 // 4272 // Pops a value off the stack and assigns it to the current hash 4273 assignToHash: function assignToHash(key) { 4274 var value = this.popStack(), 4275 context = undefined, 4276 type = undefined, 4277 id = undefined; 4278 4279 if (this.trackIds) { 4280 id = this.popStack(); 4281 } 4282 if (this.stringParams) { 4283 type = this.popStack(); 4284 context = this.popStack(); 4285 } 4286 4287 var hash = this.hash; 4288 if (context) { 4289 hash.contexts[key] = context; 4290 } 4291 if (type) { 4292 hash.types[key] = type; 4293 } 4294 if (id) { 4295 hash.ids[key] = id; 4296 } 4297 hash.values[key] = value; 4298 }, 4299 4300 pushId: function pushId(type, name, child) { 4301 if (type === 'BlockParam') { 4302 this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : '')); 4303 } else if (type === 'PathExpression') { 4304 this.pushString(name); 4305 } else if (type === 'SubExpression') { 4306 this.pushStackLiteral('true'); 4307 } else { 4308 this.pushStackLiteral('null'); 4309 } 4310 }, 4311 4312 // HELPERS 4313 4314 compiler: JavaScriptCompiler, 4315 4316 compileChildren: function compileChildren(environment, options) { 4317 var children = environment.children, 4318 child = undefined, 4319 compiler = undefined; 4320 4321 for (var i = 0, l = children.length; i < l; i++) { 4322 child = children[i]; 4323 compiler = new this.compiler(); // eslint-disable-line new-cap 4324 4325 var existing = this.matchExistingProgram(child); 4326 4327 if (existing == null) { 4328 this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children 4329 var index = this.context.programs.length; 4330 child.index = index; 4331 child.name = 'program' + index; 4332 this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); 4333 this.context.decorators[index] = compiler.decorators; 4334 this.context.environments[index] = child; 4335 4336 this.useDepths = this.useDepths || compiler.useDepths; 4337 this.useBlockParams = this.useBlockParams || compiler.useBlockParams; 4338 child.useDepths = this.useDepths; 4339 child.useBlockParams = this.useBlockParams; 4340 } else { 4341 child.index = existing.index; 4342 child.name = 'program' + existing.index; 4343 4344 this.useDepths = this.useDepths || existing.useDepths; 4345 this.useBlockParams = this.useBlockParams || existing.useBlockParams; 4346 } 4347 } 4348 }, 4349 matchExistingProgram: function matchExistingProgram(child) { 4350 for (var i = 0, len = this.context.environments.length; i < len; i++) { 4351 var environment = this.context.environments[i]; 4352 if (environment && environment.equals(child)) { 4353 return environment; 4354 } 4355 } 4356 }, 4357 4358 programExpression: function programExpression(guid) { 4359 var child = this.environment.children[guid], 4360 programParams = [child.index, 'data', child.blockParams]; 4361 4362 if (this.useBlockParams || this.useDepths) { 4363 programParams.push('blockParams'); 4364 } 4365 if (this.useDepths) { 4366 programParams.push('depths'); 4367 } 4368 4369 return 'container.program(' + programParams.join(', ') + ')'; 4370 }, 4371 4372 useRegister: function useRegister(name) { 4373 if (!this.registers[name]) { 4374 this.registers[name] = true; 4375 this.registers.list.push(name); 4376 } 4377 }, 4378 4379 push: function push(expr) { 4380 if (!(expr instanceof Literal)) { 4381 expr = this.source.wrap(expr); 4382 } 4383 4384 this.inlineStack.push(expr); 4385 return expr; 4386 }, 4387 4388 pushStackLiteral: function pushStackLiteral(item) { 4389 this.push(new Literal(item)); 4390 }, 4391 4392 pushSource: function pushSource(source) { 4393 if (this.pendingContent) { 4394 this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation)); 4395 this.pendingContent = undefined; 4396 } 4397 4398 if (source) { 4399 this.source.push(source); 4400 } 4401 }, 4402 4403 replaceStack: function replaceStack(callback) { 4404 var prefix = ['('], 4405 stack = undefined, 4406 createdStack = undefined, 4407 usedLiteral = undefined; 4408 4409 /* istanbul ignore next */ 4410 if (!this.isInline()) { 4411 throw new _exception2['default']('replaceStack on non-inline'); 4412 } 4413 4414 // We want to merge the inline statement into the replacement statement via ',' 4415 var top = this.popStack(true); 4416 4417 if (top instanceof Literal) { 4418 // Literals do not need to be inlined 4419 stack = [top.value]; 4420 prefix = ['(', stack]; 4421 usedLiteral = true; 4422 } else { 4423 // Get or create the current stack name for use by the inline 4424 createdStack = true; 4425 var _name = this.incrStack(); 4426 4427 prefix = ['((', this.push(_name), ' = ', top, ')']; 4428 stack = this.topStack(); 4429 } 4430 4431 var item = callback.call(this, stack); 4432 4433 if (!usedLiteral) { 4434 this.popStack(); 4435 } 4436 if (createdStack) { 4437 this.stackSlot--; 4438 } 4439 this.push(prefix.concat(item, ')')); 4440 }, 4441 4442 incrStack: function incrStack() { 4443 this.stackSlot++; 4444 if (this.stackSlot > this.stackVars.length) { 4445 this.stackVars.push('stack' + this.stackSlot); 4446 } 4447 return this.topStackName(); 4448 }, 4449 topStackName: function topStackName() { 4450 return 'stack' + this.stackSlot; 4451 }, 4452 flushInline: function flushInline() { 4453 var inlineStack = this.inlineStack; 4454 this.inlineStack = []; 4455 for (var i = 0, len = inlineStack.length; i < len; i++) { 4456 var entry = inlineStack[i]; 4457 /* istanbul ignore if */ 4458 if (entry instanceof Literal) { 4459 this.compileStack.push(entry); 4460 } else { 4461 var stack = this.incrStack(); 4462 this.pushSource([stack, ' = ', entry, ';']); 4463 this.compileStack.push(stack); 4464 } 4465 } 4466 }, 4467 isInline: function isInline() { 4468 return this.inlineStack.length; 4469 }, 4470 4471 popStack: function popStack(wrapped) { 4472 var inline = this.isInline(), 4473 item = (inline ? this.inlineStack : this.compileStack).pop(); 4474 4475 if (!wrapped && item instanceof Literal) { 4476 return item.value; 4477 } else { 4478 if (!inline) { 4479 /* istanbul ignore next */ 4480 if (!this.stackSlot) { 4481 throw new _exception2['default']('Invalid stack pop'); 4482 } 4483 this.stackSlot--; 4484 } 4485 return item; 4486 } 4487 }, 4488 4489 topStack: function topStack() { 4490 var stack = this.isInline() ? this.inlineStack : this.compileStack, 4491 item = stack[stack.length - 1]; 4492 4493 /* istanbul ignore if */ 4494 if (item instanceof Literal) { 4495 return item.value; 4496 } else { 4497 return item; 4498 } 4499 }, 4500 4501 contextName: function contextName(context) { 4502 if (this.useDepths && context) { 4503 return 'depths[' + context + ']'; 4504 } else { 4505 return 'depth' + context; 4506 } 4507 }, 4508 4509 quotedString: function quotedString(str) { 4510 return this.source.quotedString(str); 4511 }, 4512 4513 objectLiteral: function objectLiteral(obj) { 4514 return this.source.objectLiteral(obj); 4515 }, 4516 4517 aliasable: function aliasable(name) { 4518 var ret = this.aliases[name]; 4519 if (ret) { 4520 ret.referenceCount++; 4521 return ret; 4522 } 4523 4524 ret = this.aliases[name] = this.source.wrap(name); 4525 ret.aliasable = true; 4526 ret.referenceCount = 1; 4527 4528 return ret; 4529 }, 4530 4531 setupHelper: function setupHelper(paramSize, name, blockHelper) { 4532 var params = [], 4533 paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); 4534 var foundHelper = this.nameLookup('helpers', name, 'helper'), 4535 callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : (container.nullContext || {})'); 4536 4537 return { 4538 params: params, 4539 paramsInit: paramsInit, 4540 name: foundHelper, 4541 callParams: [callContext].concat(params) 4542 }; 4543 }, 4544 4545 setupParams: function setupParams(helper, paramSize, params) { 4546 var options = {}, 4547 contexts = [], 4548 types = [], 4549 ids = [], 4550 objectArgs = !params, 4551 param = undefined; 4552 4553 if (objectArgs) { 4554 params = []; 4555 } 4556 4557 options.name = this.quotedString(helper); 4558 options.hash = this.popStack(); 4559 4560 if (this.trackIds) { 4561 options.hashIds = this.popStack(); 4562 } 4563 if (this.stringParams) { 4564 options.hashTypes = this.popStack(); 4565 options.hashContexts = this.popStack(); 4566 } 4567 4568 var inverse = this.popStack(), 4569 program = this.popStack(); 4570 4571 // Avoid setting fn and inverse if neither are set. This allows 4572 // helpers to do a check for `if (options.fn)` 4573 if (program || inverse) { 4574 options.fn = program || 'container.noop'; 4575 options.inverse = inverse || 'container.noop'; 4576 } 4577 4578 // The parameters go on to the stack in order (making sure that they are evaluated in order) 4579 // so we need to pop them off the stack in reverse order 4580 var i = paramSize; 4581 while (i--) { 4582 param = this.popStack(); 4583 params[i] = param; 4584 4585 if (this.trackIds) { 4586 ids[i] = this.popStack(); 4587 } 4588 if (this.stringParams) { 4589 types[i] = this.popStack(); 4590 contexts[i] = this.popStack(); 4591 } 4592 } 4593 4594 if (objectArgs) { 4595 options.args = this.source.generateArray(params); 4596 } 4597 4598 if (this.trackIds) { 4599 options.ids = this.source.generateArray(ids); 4600 } 4601 if (this.stringParams) { 4602 options.types = this.source.generateArray(types); 4603 options.contexts = this.source.generateArray(contexts); 4604 } 4605 4606 if (this.options.data) { 4607 options.data = 'data'; 4608 } 4609 if (this.useBlockParams) { 4610 options.blockParams = 'blockParams'; 4611 } 4612 return options; 4613 }, 4614 4615 setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) { 4616 var options = this.setupParams(helper, paramSize, params); 4617 options
vendor: 1,005 bytes, lines 4617-4640
4617 = this.objectLiteral(options); 4618 if (useRegister) { 4619 this.useRegister('options'); 4620 params.push('options'); 4621 return ['options=', options]; 4622 } else if (params) { 4623 params.push(options); 4624 return ''; 4625 } else { 4626 return options; 4627 } 4628 } 4629 }; 4630 4631 (function () { 4632 var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' '); 4633 4634 var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; 4635 4636 for (var i = 0, l = reservedWords.length; i < l; i++) { 4637 compilerWords[reservedWords[i]] = true; 4638 } 4639 })(); 4640
vendor: 4,122 bytes, lines 4641-4792
4641 JavaScriptCompiler.isValidJavaScriptVariableName = function (name) { 4642 return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); 4643 }; 4644 4645 function strictLookup(requireTerminal, compiler, parts, type) { 4646 var stack = compiler.popStack(), 4647 i = 0, 4648 len = parts.length; 4649 if (requireTerminal) { 4650 len--; 4651 } 4652 4653 for (; i < len; i++) { 4654 stack = compiler.nameLookup(stack, parts[i], type); 4655 } 4656 4657 if (requireTerminal) { 4658 return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')']; 4659 } else { 4660 return stack; 4661 } 4662 } 4663 4664 exports['default'] = JavaScriptCompiler; 4665 module.exports = exports['default']; 4666 4667/***/ }), 4668/* 43 */ 4669/***/ (function(module, exports, __webpack_require__) { 4670 4671 /* global define */ 4672 'use strict'; 4673 4674 exports.__esModule = true; 4675 4676 var _utils = __webpack_require__(5); 4677 4678 var SourceNode = undefined; 4679 4680 try { 4681 /* istanbul ignore next */ 4682 if (false) { 4683 // We don't support this in AMD environments. For these environments, we asusme that 4684 // they are running on the browser and thus have no need for the source-map library. 4685 var SourceMap = require('source-map'); 4686 SourceNode = SourceMap.SourceNode; 4687 } 4688 } catch (err) {} 4689 /* NOP */ 4690 4691 /* istanbul ignore if: tested but not covered in istanbul due to dist build */ 4692 if (!SourceNode) { 4693 SourceNode = function (line, column, srcFile, chunks) { 4694 this.src = ''; 4695 if (chunks) { 4696 this.add(chunks); 4697 } 4698 }; 4699 /* istanbul ignore next */ 4700 SourceNode.prototype = { 4701 add: function add(chunks) { 4702 if (_utils.isArray(chunks)) { 4703 chunks = chunks.join(''); 4704 } 4705 this.src += chunks; 4706 }, 4707 prepend: function prepend(chunks) { 4708 if (_utils.isArray(chunks)) { 4709 chunks = chunks.join(''); 4710 } 4711 this.src = chunks + this.src; 4712 }, 4713 toStringWithSourceMap: function toStringWithSourceMap() { 4714 return { code: this.toString() }; 4715 }, 4716 toString: function toString() { 4717 return this.src; 4718 } 4719 }; 4720 } 4721 4722 function castChunk(chunk, codeGen, loc) { 4723 if (_utils.isArray(chunk)) { 4724 var ret = []; 4725 4726 for (var i = 0, len = chunk.length; i < len; i++) { 4727 ret.push(codeGen.wrap(chunk[i], loc)); 4728 } 4729 return ret; 4730 } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { 4731 // Handle primitives that the SourceNode will throw up on 4732 return chunk + ''; 4733 } 4734 return chunk; 4735 } 4736 4737 function CodeGen(srcFile) { 4738 this.srcFile = srcFile; 4739 this.source = []; 4740 } 4741 4742 CodeGen.prototype = { 4743 isEmpty: function isEmpty() { 4744 return !this.source.length; 4745 }, 4746 prepend: function prepend(source, loc) { 4747 this.source.unshift(this.wrap(source, loc)); 4748 }, 4749 push: function push(source, loc) { 4750 this.source.push(this.wrap(source, loc)); 4751 }, 4752 4753 merge: function merge() { 4754 var source = this.empty(); 4755 this.each(function (line) { 4756 source.add([' ', line, '\n']); 4757 }); 4758 return source; 4759 }, 4760 4761 each: function each(iter) { 4762 for (var i = 0, len = this.source.length; i < len; i++) { 4763 iter(this.source[i]); 4764 } 4765 }, 4766 4767 empty: function empty() { 4768 var loc = this.currentLocation || { start: {} }; 4769 return new SourceNode(loc.start.line, loc.start.column, this.srcFile); 4770 }, 4771 wrap: function wrap(chunk) { 4772 var loc = arguments.length <= 1 || arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1]; 4773 4774 if (chunk instanceof SourceNode) { 4775 return chunk; 4776 } 4777 4778 chunk = castChunk(chunk, this, loc); 4779 4780 return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); 4781 }, 4782 4783 functionCall: function functionCall(fn, type, params) { 4784 params = this.generateList(params); 4785 return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); 4786 }, 4787 4788 quotedString: function quotedString(str) { 4789 return '"' + (str + '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 4790 .replace(/\u2029/g, '\\u2029') + '"'; 4791 }, 4792
4793 objectLiteral: function objectLiteral(obj) { 4794 var pairs = []; 4795 4796 for (var key in obj) { 4797 if (obj.hasOwnProperty(key)) { 4798 var value = castChunk(obj[key], this); 4799 if (value !== 'undefined') { 4800 pairs.push([this.quotedString(key), ':', value]); 4801 } 4802 } 4803 } 4804 4805 var ret = this.generateList(pairs); 4806 ret.prepend('{'); 4807 ret.add('}'); 4808 return ret; 4809 }, 4810 4811 generateList: function generateList(entries) { 4812 var ret = this.empty(); 4813 4814 for (var i = 0, len = entries.length; i < len; i++) { 4815 if (i) { 4816 ret.add(','); 4817 } 4818 4819 ret.add(castChunk(entries[i], this)); 4820 } 4821 4822 return ret; 4823 }, 4824 4825 generateArray: function generateArray(entries) { 4826 var ret = this.generateList(entries); 4827 ret.prepend('['); 4828 ret.add(']'); 4829 4830 return ret; 4831 } 4832 }; 4833 4834 exports['default'] = CodeGen; 4835 module.exports = exports['default']; 4836 4837/***/ }) 4838/******/ ]) 4839}); 4840;/*� *� * /modules/nsUtilities-bundle/nsg-module-feedback/assets/js/site-feedback.js� *�*/// Product Note Object 4841 (function ($, nsg_siteFeedback, undefined ){ 4842 nsg_siteFeedback.settings = { 4843 triggerButton: $('#mark_for_review_modal_trigger'), 4844 modal: $('#nsg-sf-modal'), 4845 isErrorCheckbox: $('#isError'), 4846 noteInput: $('#note'), 4847 saveButton: $('#saveNote'), 4848 product_id: $('#productSKU-desktop').text(), 4849 authUserID: $('#authUser').data('id'), 4850 targetID: 0 4851 }; 4852 4853 var getCookie = function(cname) {var name = cname + "=";var ca = document.cookie.split(';');for(var i = 0; i <ca.length; i++) {var c = ca[i];while (c.charAt(0)==' ') {c = c.substring(1);}if (c.indexOf(name) == 0) {return c.substring(name.length,c.length);}}return "";}; 4854 nsg_siteFeedback.init = function(settings){ 4855 var has_feedback = typeof nsg_feedback !== 'undefined' && 'ip' in nsg_feedback; 4856 var is_internal = getCookie('_NSG_IP') === '%2296.80.189.61%22'; 4857 if( has_feedback ){ 4858 // Pass data into Form 4859 var context = { 4860 href: window.location.href, 4861 host: window.location.hostname, 4862 path: window.location.pathname, 4863 ip: nsg_feedback.ip, 4864 is_product_page: window.location.pathname.indexOf("/p/"), 4865 is_manufacturer_page: window.location.pathname.indexOf("/m/"), 4866 is_category_page: window.location.pathname.indexOf("/c/"), 4867 is_directive_page: window.location.pathname.indexOf("/s/"), 4868 page_title: document.title, 4869 // ehid: Cookies.get('EHID') || '', 4870 // emopid: Cookies.get('emopID') || '', 4871 // cid: Cookies.get('CID') || '', 4872 // ga: Cookies.get('_ga') || '', 4873 is_internal: is_internal 4874 }; 4875 4876 // Page-Specific 4877 if( context.is_product_page ){ 4878 // Product Page 4879 context.reference_id = $('#productSKU-desktop').html(); 4880 context.reference_type = "product"; 4881 }else if( context.is_manufacturer_page ){ 4882 // Manufacturer 4883 }else if( context.is_category_page ){ 4884 // Category 4885 }else if( context.is_directive_page ){ 4886 // Directive 4887 } 4888 4889 // Render Form 4890 $.get({url: '/modules/nsUtilities-bundle/nsg-module-feedback/assets/js/hbs/feedback-modal.hbs', cache: false, contentType: 'html'}).then(function (data,jsonData) { 4891 // Compile with Handlebars 4892 var modal_window = Handlebars.compile(data); 4893 // Set to Modal Content 4894 document.getElementById('nsg-sf-content').innerHTML = modal_window(context); 4895 4896 // Trigger Show/Hide 4897 $('#nsg-sf-trigger').click(function(){ 4898 $('#nsg-sf-modal').modal('toggle'); 4899 }) 4900 4901 // Get Endpoint 4902 var domainArr = document.domain.split("."); 4903 // console.log(domainArr); 4904 if( domainArr.length === 3 ){ 4905 var subDomain = domainArr[0]; 4906 var domain = domainArr[1]; 4907 var tld = domainArr[3]; 4908 // console.log(domain); 4909 var feedbackEndpoint = "https://www.outlandusa.com/outlandusa/home/newFeedback"; 4910 // var feedbackEndpoint = "https://" + "test.outlandusa.com/outlandusa/home/newFeedback"; 4911 } 4912 4913 // Trigger Submit 4914 $('#nsg-sf-submit').click(function(){ 4915 var $submit = $(this); 4916 $submit.removeClass('btn-success').removeClass('btn-warning').removeClass('btn-danger').addClass('btn-warning'); 4917 $submit.html('<i class="fa fa-spin fa-spinner"></i> Submitting...'); 4918 var submission = $("#nsg-sf-form :input[value!='']").serializeArray(); 4919 for( var i = 0; i < submission.length; i++ ){ 4920 context[ submission[i]['name'] ] = submission[i]['value']; 4921 } 4922 // AJAX 4923 if( typeof feedbackEndpoint != 'undefined' && feedbackEndpoint.length ){ 4924 $.ajax({
vendor: 21,962 bytes, lines 4925-5767
4925 url: feedbackEndpoint, 4926 data: context, 4927 method: "GET", 4928 // contentType: "application/json", 4929 // dataType: 'json', 4930 success: function (response) { 4931 // if( response.error == false ){ 4932 $submit.removeClass('btn-success').removeClass('btn-warning').removeClass('btn-danger').addClass('btn-success'); 4933 $submit.html('<i class="fa fa-check" style="color:#6da227;"></i> Feedback Submitted'); 4934 // }else { 4935 // console.log("else response.error:", response.error); 4936 // $submit.removeClass('btn-success').removeClass('btn-warning').removeClass('btn-danger').addClass('btn-danger'); 4937 // $submit.html('<i class="fa fa-remove"></i> Error Submitting Feedback'); 4938 // } 4939 // Hide Modal 4940 $('#nsg-sf-modal').modal('hide'); 4941 }, 4942 error: function (response, item2, item3) { 4943 console.log("error", response, item2, item3); 4944 // console.log("context", context); 4945 $submit.removeClass('btn-success').removeClass('btn-warning').removeClass('btn-danger').addClass('btn-danger'); 4946 $submit.html('<i class="fa fa-remove"></i> Error Submitting Feedback'); 4947 // $submit.removeClass('btn-success').removeClass('btn-warning').removeClass('btn-danger').addClass('btn-success'); 4948 // $submit.html('<i class="fa fa-check" style="color:#6da227;"></i> Feedback Submitted'); 4949 }, 4950 complete: function (response) { 4951 // console.log( '[Add Product Note] Response:' ); 4952 console.log( "completed" ); 4953 } 4954 }) 4955 } 4956 }); 4957 }); 4958 4959 }; 4960 }; 4961 }(jQuery, window.nsg_siteFeedback = window.nsg_siteFeedback || {})) 4962 4963 nsg_siteFeedback.init(); 4964/*� *� * /modules/searchSolr/assets/js/isotope.pkgd.js� *�*//*! 4965 * Isotope PACKAGED v3.0.2 4966 * 4967 * Licensed GPLv3 for open source use 4968 * or Isotope Commercial License for commercial use 4969 * 4970 * http://isotope.metafizzy.co 4971 * Copyright 2016 Metafizzy 4972 */ 4973 4974/** 4975 * Bridget makes jQuery widgets 4976 * v2.0.1 4977 * MIT license 4978 */ 4979 4980/* jshint browser: true, strict: true, undef: true, unused: true */ 4981 4982( function( window, factory ) { 4983 // universal module definition 4984 /*jshint strict: false */ /* globals define, module, require */ 4985 if ( typeof define == 'function' && define.amd ) { 4986 // AMD 4987 define( 'jquery-bridget/jquery-bridget',[ 'jquery' ], function( jQuery ) { 4988 return factory( window, jQuery ); 4989 }); 4990 } else if ( typeof module == 'object' && module.exports ) { 4991 // CommonJS 4992 module.exports = factory( 4993 window, 4994 require('jquery') 4995 ); 4996 } else { 4997 // browser global 4998 window.jQueryBridget = factory( 4999 window, 5000 window.jQuery 5001 ); 5002 } 5003 5004}( window, function factory( window, jQuery ) { 5005'use strict'; 5006 5007// ----- utils ----- // 5008 5009var arraySlice = Array.prototype.slice; 5010 5011// helper function for logging errors 5012// $.error breaks jQuery chaining 5013var console = window.console; 5014var logError = typeof console == 'undefined' ? function() {} : 5015 function( message ) { 5016 console.error( message ); 5017 }; 5018 5019// ----- jQueryBridget ----- // 5020 5021function jQueryBridget( namespace, PluginClass, $ ) { 5022 $ = $ || jQuery || window.jQuery; 5023 if ( !$ ) { 5024 return; 5025 } 5026 5027 // add option method -> $().plugin('option', {...}) 5028 if ( !PluginClass.prototype.option ) { 5029 // option setter 5030 PluginClass.prototype.option = function( opts ) { 5031 // bail out if not an object 5032 if ( !$.isPlainObject( opts ) ){ 5033 return; 5034 } 5035 this.options = $.extend( true, this.options, opts ); 5036 }; 5037 } 5038 5039 // make jQuery plugin 5040 $.fn[ namespace ] = function( arg0 /*, arg1 */ ) { 5041 if ( typeof arg0 == 'string' ) { 5042 // method call $().plugin( 'methodName', { options } ) 5043 // shift arguments by 1 5044 var args = arraySlice.call( arguments, 1 ); 5045 return methodCall( this, arg0, args ); 5046 } 5047 // just $().plugin({ options }) 5048 plainCall( this, arg0 ); 5049 return this; 5050 }; 5051 5052 // $().plugin('methodName') 5053 function methodCall( $elems, methodName, args ) { 5054 var returnValue; 5055 var pluginMethodStr = '$().' + namespace + '("' + methodName + '")'; 5056 5057 $elems.each( function( i, elem ) { 5058 // get instance 5059 var instance = $.data( elem, namespace ); 5060 if ( !instance ) { 5061 logError( namespace + ' not initialized. Cannot call methods, i.e. ' + 5062 pluginMethodStr ); 5063 return; 5064 } 5065 5066 var method = instance[ methodName ]; 5067 if ( !method || methodName.charAt(0) == '_' ) { 5068 logError( pluginMethodStr + ' is not a valid method' ); 5069 return; 5070 } 5071 5072 // apply method, get return value 5073 var value = method.apply( instance, args ); 5074 // set return value if value is returned, use only first value 5075 returnValue = returnValue === undefined ? value : returnValue; 5076 }); 5077 5078 return returnValue !== undefined ? returnValue : $elems; 5079 } 5080 5081 function plainCall( $elems, options ) { 5082 $elems.each( function( i, elem ) { 5083 var instance = $.data( elem, namespace ); 5084 if ( instance ) { 5085 // set options & init 5086 instance.option( options ); 5087 instance._init(); 5088 } else { 5089 // initialize new instance 5090 instance = new PluginClass( elem, options ); 5091 $.data( elem, namespace, instance ); 5092 } 5093 }); 5094 } 5095 5096 updateJQuery( $ ); 5097 5098} 5099 5100// ----- updateJQuery ----- // 5101 5102// set $.bridget for v1 backwards compatibility 5103function updateJQuery( $ ) { 5104 if ( !$ || ( $ && $.bridget ) ) { 5105 return; 5106 } 5107 $.bridget = jQueryBridget; 5108} 5109 5110updateJQuery( jQuery || window.jQuery ); 5111 5112// ----- ----- // 5113 5114return jQueryBridget; 5115 5116})); 5117 5118/** 5119 * EvEmitter v1.0.3 5120 * Lil' event emitter 5121 * MIT License 5122 */ 5123 5124/* jshint unused: true, undef: true, strict: true */ 5125 5126( function( global, factory ) { 5127 // universal module definition 5128 /* jshint strict: false */ /* globals define, module, window */ 5129 if ( typeof define == 'function' && define.amd ) { 5130 // AMD - RequireJS 5131 define( 'ev-emitter/ev-emitter',factory ); 5132 } else if ( typeof module == 'object' && module.exports ) { 5133 // CommonJS - Browserify, Webpack 5134 module.exports = factory(); 5135 } else { 5136 // Browser globals 5137 global.EvEmitter = factory(); 5138 } 5139 5140}( typeof window != 'undefined' ? window : this, function() { 5141 5142 5143 5144function EvEmitter() {} 5145 5146var proto = EvEmitter.prototype; 5147 5148proto.on = function( eventName, listener ) { 5149 if ( !eventName || !listener ) { 5150 return; 5151 } 5152 // set events hash 5153 var events = this._events = this._events || {}; 5154 // set listeners array 5155 var listeners = events[ eventName ] = events[ eventName ] || []; 5156 // only add once 5157 if ( listeners.indexOf( listener ) == -1 ) { 5158 listeners.push( listener ); 5159 } 5160 5161 return this; 5162}; 5163 5164proto.once = function( eventName, listener ) { 5165 if ( !eventName || !listener ) { 5166 return; 5167 } 5168 // add event 5169 this.on( eventName, listener ); 5170 // set once flag 5171 // set onceEvents hash 5172 var onceEvents = this._onceEvents = this._onceEvents || {}; 5173 // set onceListeners object 5174 var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; 5175 // set flag 5176 onceListeners[ listener ] = true; 5177 5178 return this; 5179}; 5180 5181proto.off = function( eventName, listener ) { 5182 var listeners = this._events && this._events[ eventName ]; 5183 if ( !listeners || !listeners.length ) { 5184 return; 5185 } 5186 var index = listeners.indexOf( listener ); 5187 if ( index != -1 ) { 5188 listeners.splice( index, 1 ); 5189 } 5190 5191 return this; 5192}; 5193 5194proto.emitEvent = function( eventName, args ) { 5195 var listeners = this._events && this._events[ eventName ]; 5196 if ( !listeners || !listeners.length ) { 5197 return; 5198 } 5199 var i = 0; 5200 var listener = listeners[i]; 5201 args = args || []; 5202 // once stuff 5203 var onceListeners = this._onceEvents && this._onceEvents[ eventName ]; 5204 5205 while ( listener ) { 5206 var isOnce = onceListeners && onceListeners[ listener ]; 5207 if ( isOnce ) { 5208 // remove listener 5209 // remove before trigger to prevent recursion 5210 this.off( eventName, listener ); 5211 // unset once flag 5212 delete onceListeners[ listener ]; 5213 } 5214 // trigger listener 5215 listener.apply( this, args ); 5216 // get next listener 5217 i += isOnce ? 0 : 1; 5218 listener = listeners[i]; 5219 } 5220 5221 return this; 5222}; 5223 5224return EvEmitter; 5225 5226})); 5227 5228/*! 5229 * getSize v2.0.2 5230 * measure size of elements 5231 * MIT license 5232 */ 5233 5234/*jshint browser: true, strict: true, undef: true, unused: true */ 5235/*global define: false, module: false, console: false */ 5236 5237( function( window, factory ) { 5238 'use strict'; 5239 5240 if ( typeof define == 'function' && define.amd ) { 5241 // AMD 5242 define( 'get-size/get-size',[],function() { 5243 return factory(); 5244 }); 5245 } else if ( typeof module == 'object' && module.exports ) { 5246 // CommonJS 5247 module.exports = factory(); 5248 } else { 5249 // browser global 5250 window.getSize = factory(); 5251 } 5252 5253})( window, function factory() { 5254'use strict'; 5255 5256// -------------------------- helpers -------------------------- // 5257 5258// get a number from a string, not a percentage 5259function getStyleSize( value ) { 5260 var num = parseFloat( value ); 5261 // not a percent like '100%', and a number 5262 var isValid = value.indexOf('%') == -1 && !isNaN( num ); 5263 return isValid && num; 5264} 5265 5266function noop() {} 5267 5268var logError = typeof console == 'undefined' ? noop : 5269 function( message ) { 5270 console.error( message ); 5271 }; 5272 5273// -------------------------- measurements -------------------------- // 5274 5275var measurements = [ 5276 'paddingLeft', 5277 'paddingRight', 5278 'paddingTop', 5279 'paddingBottom', 5280 'marginLeft', 5281 'marginRight', 5282 'marginTop', 5283 'marginBottom', 5284 'borderLeftWidth', 5285 'borderRightWidth', 5286 'borderTopWidth', 5287 'borderBottomWidth' 5288]; 5289 5290var measurementsLength = measurements.length; 5291 5292function getZeroSize() { 5293 var size = { 5294 width: 0, 5295 height: 0, 5296 innerWidth: 0, 5297 innerHeight: 0, 5298 outerWidth: 0, 5299 outerHeight: 0 5300 }; 5301 for ( var i=0; i < measurementsLength; i++ ) { 5302 var measurement = measurements[i]; 5303 size[ measurement ] = 0; 5304 } 5305 return size; 5306} 5307 5308// -------------------------- getStyle -------------------------- // 5309 5310/** 5311 * getStyle, get style of element, check for Firefox bug 5312 * https://bugzilla.mozilla.org/show_bug.cgi?id=548397 5313 */ 5314function getStyle( elem ) { 5315 var style = getComputedStyle( elem ); 5316 if ( !style ) { 5317 logError( 'Style returned ' + style + 5318 '. Are you running this code in a hidden iframe on Firefox? ' + 5319 'See http://bit.ly/getsizebug1' ); 5320 } 5321 return style; 5322} 5323 5324// -------------------------- setup -------------------------- // 5325 5326var isSetup = false; 5327 5328var isBoxSizeOuter; 5329 5330/** 5331 * setup 5332 * check isBoxSizerOuter 5333 * do on first getSize() rather than on page load for Firefox bug 5334 */ 5335function setup() { 5336 // setup once 5337 if ( isSetup ) { 5338 return; 5339 } 5340 isSetup = true; 5341 5342 // -------------------------- box sizing -------------------------- // 5343 5344 /** 5345 * WebKit measures the outer-width on style.width on border-box elems 5346 * IE & Firefox<29 measures the inner-width 5347 */ 5348 var div = document.createElement('div'); 5349 div.style.width = '200px'; 5350 div.style.padding = '1px 2px 3px 4px'; 5351 div.style.borderStyle = 'solid'; 5352 div.style.borderWidth = '1px 2px 3px 4px'; 5353 div.style.boxSizing = 'border-box'; 5354 5355 var body = document.body || document.documentElement; 5356 body.appendChild( div ); 5357 var style = getStyle( div ); 5358 5359 getSize.isBoxSizeOuter = isBoxSizeOuter = getStyleSize( style.width ) == 200; 5360 body.removeChild( div ); 5361 5362} 5363 5364// -------------------------- getSize -------------------------- // 5365 5366function getSize( elem ) { 5367 setup(); 5368 5369 // use querySeletor if elem is string 5370 if ( typeof elem == 'string' ) { 5371 elem = document.querySelector( elem ); 5372 } 5373 5374 // do not proceed on non-objects 5375 if ( !elem || typeof elem != 'object' || !elem.nodeType ) { 5376 return; 5377 } 5378 5379 var style = getStyle( elem ); 5380 5381 // if hidden, everything is 0 5382 if ( style.display == 'none' ) { 5383 return getZeroSize(); 5384 } 5385 5386 var size = {}; 5387 size.width = elem.offsetWidth; 5388 size.height = elem.offsetHeight; 5389 5390 var isBorderBox = size.isBorderBox = style.boxSizing == 'border-box'; 5391 5392 // get all measurements 5393 for ( var i=0; i < measurementsLength; i++ ) { 5394 var measurement = measurements[i]; 5395 var value = style[ measurement ]; 5396 var num = parseFloat( value ); 5397 // any 'auto', 'medium' value will be 0 5398 size[ measurement ] = !isNaN( num ) ? num : 0; 5399 } 5400 5401 var paddingWidth = size.paddingLeft + size.paddingRight; 5402 var paddingHeight = size.paddingTop + size.paddingBottom; 5403 var marginWidth = size.marginLeft + size.marginRight; 5404 var marginHeight = size.marginTop + size.marginBottom; 5405 var borderWidth = size.borderLeftWidth + size.borderRightWidth; 5406 var borderHeight = size.borderTopWidth + size.borderBottomWidth; 5407 5408 var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter; 5409 5410 // overwrite width and height if we can get it from style 5411 var styleWidth = getStyleSize( style.width ); 5412 if ( styleWidth !== false ) { 5413 size.width = styleWidth + 5414 // add padding and border unless it's already including it 5415 ( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth ); 5416 } 5417 5418 var styleHeight = getStyleSize( style.height ); 5419 if ( styleHeight !== false ) { 5420 size.height = styleHeight + 5421 // add padding and border unless it's already including it 5422 ( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight ); 5423 } 5424 5425 size.innerWidth = size.width - ( paddingWidth + borderWidth ); 5426 size.innerHeight = size.height - ( paddingHeight + borderHeight ); 5427 5428 size.outerWidth = size.width + marginWidth; 5429 size.outerHeight = size.height + marginHeight; 5430 5431 return size; 5432} 5433 5434return getSize; 5435 5436}); 5437 5438/** 5439 * matchesSelector v2.0.1 5440 * matchesSelector( element, '.selector' ) 5441 * MIT license 5442 */ 5443 5444/*jshint browser: true, strict: true, undef: true, unused: true */ 5445 5446( function( window, factory ) { 5447 /*global define: false, module: false */ 5448 'use strict'; 5449 // universal module definition 5450 if ( typeof define == 'function' && define.amd ) { 5451 // AMD 5452 define( 'desandro-matches-selector/matches-selector',factory ); 5453 } else if ( typeof module == 'object' && module.exports ) { 5454 // CommonJS 5455 module.exports = factory(); 5456 } else { 5457 // browser global 5458 window.matchesSelector = factory(); 5459 } 5460 5461}( window, function factory() { 5462 'use strict'; 5463 5464 var matchesMethod = ( function() { 5465 var ElemProto = Element.prototype; 5466 // check for the standard method name first 5467 if ( ElemProto.matches ) { 5468 return 'matches'; 5469 } 5470 // check un-prefixed 5471 if ( ElemProto.matchesSelector ) { 5472 return 'matchesSelector'; 5473 } 5474 // check vendor prefixes 5475 var prefixes = [ 'webkit', 'moz', 'ms', 'o' ]; 5476 5477 for ( var i=0; i < prefixes.length; i++ ) { 5478 var prefix = prefixes[i]; 5479 var method = prefix + 'MatchesSelector'; 5480 if ( ElemProto[ method ] ) { 5481 return method; 5482 } 5483 } 5484 })(); 5485 5486 return function matchesSelector( elem, selector ) { 5487 return elem[ matchesMethod ]( selector ); 5488 }; 5489 5490})); 5491 5492/** 5493 * Fizzy UI utils v2.0.3 5494 * MIT license 5495 */ 5496 5497/*jshint browser: true, undef: true, unused: true, strict: true */ 5498 5499( function( window, factory ) { 5500 // universal module definition 5501 /*jshint strict: false */ /*globals define, module, require */ 5502 5503 if ( typeof define == 'function' && define.amd ) { 5504 // AMD 5505 define( 'fizzy-ui-utils/utils',[ 5506 'desandro-matches-selector/matches-selector' 5507 ], function( matchesSelector ) { 5508 return factory( window, matchesSelector ); 5509 }); 5510 } else if ( typeof module == 'object' && module.exports ) { 5511 // CommonJS 5512 module.exports = factory( 5513 window, 5514 require('desandro-matches-selector') 5515 ); 5516 } else { 5517 // browser global 5518 window.fizzyUIUtils = factory( 5519 window, 5520 window.matchesSelector 5521 ); 5522 } 5523 5524}( window, function factory( window, matchesSelector ) { 5525 5526 5527 5528var utils = {}; 5529 5530// ----- extend ----- // 5531 5532// extends objects 5533utils.extend = function( a, b ) { 5534 for ( var prop in b ) { 5535 a[ prop ] = b[ prop ]; 5536 } 5537 return a; 5538}; 5539 5540// ----- modulo ----- // 5541 5542utils.modulo = function( num, div ) { 5543 return ( ( num % div ) + div ) % div; 5544}; 5545 5546// ----- makeArray ----- // 5547 5548// turn element or nodeList into an array 5549utils.makeArray = function( obj ) { 5550 var ary = []; 5551 if ( Array.isArray( obj ) ) { 5552 // use object if already an array 5553 ary = obj; 5554 } else if ( obj && typeof obj.length == 'number' ) { 5555 // convert nodeList to array 5556 for ( var i=0; i < obj.length; i++ ) { 5557 ary.push( obj[i] ); 5558 } 5559 } else { 5560 // array of single index 5561 ary.push( obj ); 5562 } 5563 return ary; 5564}; 5565 5566// ----- removeFrom ----- // 5567 5568utils.removeFrom = function( ary, obj ) { 5569 var index = ary.indexOf( obj ); 5570 if ( index != -1 ) { 5571 ary.splice( index, 1 ); 5572 } 5573}; 5574 5575// ----- getParent ----- // 5576 5577utils.getParent = function( elem, selector ) { 5578 while ( elem != document.body ) { 5579 elem = elem.parentNode; 5580 if ( matchesSelector( elem, selector ) ) { 5581 return elem; 5582 } 5583 } 5584}; 5585 5586// ----- getQueryElement ----- // 5587 5588// use element as selector string 5589utils.getQueryElement = function( elem ) { 5590 if ( typeof elem == 'string' ) { 5591 return document.querySelector( elem ); 5592 } 5593 return elem; 5594}; 5595 5596// ----- handleEvent ----- // 5597 5598// enable .ontype to trigger from .addEventListener( elem, 'type' ) 5599utils.handleEvent = function( event ) { 5600 var method = 'on' + event.type; 5601 if ( this[ method ] ) { 5602 this[ method ]( event ); 5603 } 5604}; 5605 5606// ----- filterFindElements ----- // 5607 5608utils.filterFindElements = function( elems, selector ) { 5609 // make array of elems 5610 elems = utils.makeArray( elems ); 5611 var ffElems = []; 5612 5613 elems.forEach( function( elem ) { 5614 // check that elem is an actual element 5615 if ( !( elem instanceof HTMLElement ) ) { 5616 return; 5617 } 5618 // add elem if no selector 5619 if ( !selector ) { 5620 ffElems.push( elem ); 5621 return; 5622 } 5623 // filter & find items if we have a selector 5624 // filter 5625 if ( matchesSelector( elem, selector ) ) { 5626 ffElems.push( elem ); 5627 } 5628 // find children 5629 var childElems = elem.querySelectorAll( selector ); 5630 // concat childElems to filterFound array 5631 for ( var i=0; i < childElems.length; i++ ) { 5632 ffElems.push( childElems[i] ); 5633 } 5634 }); 5635 5636 return ffElems; 5637}; 5638 5639// ----- debounceMethod ----- // 5640 5641utils.debounceMethod = function( _class, methodName, threshold ) { 5642 // original method 5643 var method = _class.prototype[ methodName ]; 5644 var timeoutName = methodName + 'Timeout'; 5645 5646 _class.prototype[ methodName ] = function() { 5647 var timeout = this[ timeoutName ]; 5648 if ( timeout ) { 5649 clearTimeout( timeout ); 5650 } 5651 var args = arguments; 5652 5653 var _this = this; 5654 this[ timeoutName ] = setTimeout( function() { 5655 method.apply( _this, args ); 5656 delete _this[ timeoutName ]; 5657 }, threshold || 100 ); 5658 }; 5659}; 5660 5661// ----- docReady ----- // 5662 5663utils.docReady = function( callback ) { 5664 var readyState = document.readyState; 5665 if ( readyState == 'complete' || readyState == 'interactive' ) { 5666 // do async to allow for other scripts to run. metafizzy/flickity#441 5667 setTimeout( callback ); 5668 } else { 5669 document.addEventListener( 'DOMContentLoaded', callback ); 5670 } 5671}; 5672 5673// ----- htmlInit ----- // 5674 5675// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/ 5676utils.toDashed = function( str ) { 5677 return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) { 5678 return $1 + '-' + $2; 5679 }).toLowerCase(); 5680}; 5681 5682var console = window.console; 5683/** 5684 * allow user to initialize classes via [data-namespace] or .js-namespace class 5685 * htmlInit( Widget, 'widgetName' ) 5686 * options are parsed from data-namespace-options 5687 */ 5688utils.htmlInit = function( WidgetClass, namespace ) { 5689 utils.docReady( function() { 5690 var dashedNamespace = utils.toDashed( namespace ); 5691 var dataAttr = 'data-' + dashedNamespace; 5692 var dataAttrElems = document.querySelectorAll( '[' + dataAttr + ']' ); 5693 var jsDashElems = document.querySelectorAll( '.js-' + dashedNamespace ); 5694 var elems = utils.makeArray( dataAttrElems ) 5695 .concat( utils.makeArray( jsDashElems ) ); 5696 var dataOptionsAttr = dataAttr + '-options'; 5697 var jQuery = window.jQuery; 5698 5699 elems.forEach( function( elem ) { 5700 var attr = elem.getAttribute( dataAttr ) || 5701 elem.getAttribute( dataOptionsAttr ); 5702 var options; 5703 try { 5704 options = attr && JSON.parse( attr ); 5705 } catch ( error ) { 5706 // log error, do not initialize 5707 if ( console ) { 5708 console.error( 'Error parsing ' + dataAttr + ' on ' + elem.className + 5709 ': ' + error ); 5710 } 5711 return; 5712 } 5713 // initialize 5714 var instance = new WidgetClass( elem, options ); 5715 // make available via $().data('namespace') 5716 if ( jQuery ) { 5717 jQuery.data( elem, namespace, instance ); 5718 } 5719 }); 5720 5721 }); 5722}; 5723 5724// ----- ----- // 5725 5726return utils; 5727 5728})); 5729 5730/** 5731 * Outlayer Item 5732 */ 5733 5734( function( window, factory ) { 5735 // universal module definition 5736 /* jshint strict: false */ /* globals define, module, require */ 5737 if ( typeof define == 'function' && define.amd ) { 5738 // AMD - RequireJS 5739 define( 'outlayer/item',[ 5740 'ev-emitter/ev-emitter', 5741 'get-size/get-size' 5742 ], 5743 factory 5744 ); 5745 } else if ( typeof module == 'object' && module.exports ) { 5746 // CommonJS - Browserify, Webpack 5747 module.exports = factory( 5748 require('ev-emitter'), 5749 require('get-size') 5750 ); 5751 } else { 5752 // browser global 5753 window.Outlayer = {}; 5754 window.Outlayer.Item = factory( 5755 window.EvEmitter, 5756 window.getSize 5757 ); 5758 } 5759 5760}( window, function factory( EvEmitter, getSize ) { 5761'use strict'; 5762 5763// ----- helpers ----- // 5764 5765function isEmptyObj( obj ) { 5766 for ( var prop in obj ) { 5767 return false;
vendor: 4,399 bytes, lines 5768-5924
5768 } 5769 prop = null; 5770 return true; 5771} 5772 5773// -------------------------- CSS3 support -------------------------- // 5774 5775 5776var docElemStyle = document.documentElement.style; 5777 5778var transitionProperty = typeof docElemStyle.transition == 'string' ? 5779 'transition' : 'WebkitTransition'; 5780var transformProperty = typeof docElemStyle.transform == 'string' ? 5781 'transform' : 'WebkitTransform'; 5782 5783var transitionEndEvent = { 5784 WebkitTransition: 'webkitTransitionEnd', 5785 transition: 'transitionend' 5786}[ transitionProperty ]; 5787 5788// cache all vendor properties that could have vendor prefix 5789var vendorProperties = { 5790 transform: transformProperty, 5791 transition: transitionProperty, 5792 transitionDuration: transitionProperty + 'Duration', 5793 transitionProperty: transitionProperty + 'Property', 5794 transitionDelay: transitionProperty + 'Delay' 5795}; 5796 5797// -------------------------- Item -------------------------- // 5798 5799function Item( element, layout ) { 5800 if ( !element ) { 5801 return; 5802 } 5803 5804 this.element = element; 5805 // parent layout class, i.e. Masonry, Isotope, or Packery 5806 this.layout = layout; 5807 this.position = { 5808 x: 0, 5809 y: 0 5810 }; 5811 5812 this._create(); 5813} 5814 5815// inherit EvEmitter 5816var proto = Item.prototype = Object.create( EvEmitter.prototype ); 5817proto.constructor = Item; 5818 5819proto._create = function() { 5820 // transition objects 5821 this._transn = { 5822 ingProperties: {}, 5823 clean: {}, 5824 onEnd: {} 5825 }; 5826 5827 this.css({ 5828 position: 'absolute' 5829 }); 5830}; 5831 5832// trigger specified handler for event type 5833proto.handleEvent = function( event ) { 5834 var method = 'on' + event.type; 5835 if ( this[ method ] ) { 5836 this[ method ]( event ); 5837 } 5838}; 5839 5840proto.getSize = function() { 5841 this.size = getSize( this.element ); 5842}; 5843 5844/** 5845 * apply CSS styles to element 5846 * @param {Object} style 5847 */ 5848proto.css = function( style ) { 5849 var elemStyle = this.element.style; 5850 5851 for ( var prop in style ) { 5852 // use vendor property if available 5853 var supportedProp = vendorProperties[ prop ] || prop; 5854 elemStyle[ supportedProp ] = style[ prop ]; 5855 } 5856}; 5857 5858 // measure position, and sets it 5859proto.getPosition = function() { 5860 var style = getComputedStyle( this.element ); 5861 var isOriginLeft = this.layout._getOption('originLeft'); 5862 var isOriginTop = this.layout._getOption('originTop'); 5863 var xValue = style[ isOriginLeft ? 'left' : 'right' ]; 5864 var yValue = style[ isOriginTop ? 'top' : 'bottom' ]; 5865 // convert percent to pixels 5866 var layoutSize = this.layout.size; 5867 var x = xValue.indexOf('%') != -1 ? 5868 ( parseFloat( xValue ) / 100 ) * layoutSize.width : parseInt( xValue, 10 ); 5869 var y = yValue.indexOf('%') != -1 ? 5870 ( parseFloat( yValue ) / 100 ) * layoutSize.height : parseInt( yValue, 10 ); 5871 5872 // clean up 'auto' or other non-integer values 5873 x = isNaN( x ) ? 0 : x; 5874 y = isNaN( y ) ? 0 : y; 5875 // remove padding from measurement 5876 x -= isOriginLeft ? layoutSize.paddingLeft : layoutSize.paddingRight; 5877 y -= isOriginTop ? layoutSize.paddingTop : layoutSize.paddingBottom; 5878 5879 this.position.x = x; 5880 this.position.y = y; 5881}; 5882 5883// set settled position, apply padding 5884proto.layoutPosition = function() { 5885 var layoutSize = this.layout.size; 5886 var style = {}; 5887 var isOriginLeft = this.layout._getOption('originLeft'); 5888 var isOriginTop = this.layout._getOption('originTop'); 5889 5890 // x 5891 var xPadding = isOriginLeft ? 'paddingLeft' : 'paddingRight'; 5892 var xProperty = isOriginLeft ? 'left' : 'right'; 5893 var xResetProperty = isOriginLeft ? 'right' : 'left'; 5894 5895 var x = this.position.x + layoutSize[ xPadding ]; 5896 // set in percentage or pixels 5897 style[ xProperty ] = this.getXValue( x ); 5898 // reset other property 5899 style[ xResetProperty ] = ''; 5900 5901 // y 5902 var yPadding = isOriginTop ? 'paddingTop' : 'paddingBottom'; 5903 var yProperty = isOriginTop ? 'top' : 'bottom'; 5904 var yResetProperty = isOriginTop ? 'bottom' : 'top'; 5905 5906 var y = this.position.y + layoutSize[ yPadding ]; 5907 // set in percentage or pixels 5908 style[ yProperty ] = this.getYValue( y ); 5909 // reset other property 5910 style[ yResetProperty ] = ''; 5911 5912 this.css( style ); 5913 this.emitEvent( 'layout', [ this ] ); 5914}; 5915 5916proto.getXValue = function( x ) { 5917 var isHorizontal = this.layout._getOption('horizontal'); 5918 return this.layout.options.percentPosition && !isHorizontal ? 5919 ( ( x / this.layout.size.width ) * 100 ) + '%' : x + 'px'; 5920}; 5921 5922proto.getYValue = function( y ) { 5923 var isHorizontal = this.layout._getOption('horizontal'); 5924 return this.layout.options.percentPosition && isHorizontal ?
vendor: 6,161 bytes, lines 5925-6136
5925 ( ( y / this.layout.size.height ) * 100 ) + '%' : y + 'px'; 5926}; 5927 5928proto._transitionTo = function( x, y ) { 5929 this.getPosition(); 5930 // get current x & y from top/left 5931 var curX = this.position.x; 5932 var curY = this.position.y; 5933 5934 var compareX = parseInt( x, 10 ); 5935 var compareY = parseInt( y, 10 ); 5936 var didNotMove = compareX === this.position.x && compareY === this.position.y; 5937 5938 // save end position 5939 this.setPosition( x, y ); 5940 5941 // if did not move and not transitioning, just go to layout 5942 if ( didNotMove && !this.isTransitioning ) { 5943 this.layoutPosition(); 5944 return; 5945 } 5946 5947 var transX = x - curX; 5948 var transY = y - curY; 5949 var transitionStyle = {}; 5950 transitionStyle.transform = this.getTranslate( transX, transY ); 5951 5952 this.transition({ 5953 to: transitionStyle, 5954 onTransitionEnd: { 5955 transform: this.layoutPosition 5956 }, 5957 isCleaning: true 5958 }); 5959}; 5960 5961proto.getTranslate = function( x, y ) { 5962 // flip cooridinates if origin on right or bottom 5963 var isOriginLeft = this.layout._getOption('originLeft'); 5964 var isOriginTop = this.layout._getOption('originTop'); 5965 x = isOriginLeft ? x : -x; 5966 y = isOriginTop ? y : -y; 5967 return 'translate3d(' + x + 'px, ' + y + 'px, 0)'; 5968}; 5969 5970// non transition + transform support 5971proto.goTo = function( x, y ) { 5972 this.setPosition( x, y ); 5973 this.layoutPosition(); 5974}; 5975 5976proto.moveTo = proto._transitionTo; 5977 5978proto.setPosition = function( x, y ) { 5979 this.position.x = parseInt( x, 10 ); 5980 this.position.y = parseInt( y, 10 ); 5981}; 5982 5983// ----- transition ----- // 5984 5985/** 5986 * @param {Object} style - CSS 5987 * @param {Function} onTransitionEnd 5988 */ 5989 5990// non transition, just trigger callback 5991proto._nonTransition = function( args ) { 5992 this.css( args.to ); 5993 if ( args.isCleaning ) { 5994 this._removeStyles( args.to ); 5995 } 5996 for ( var prop in args.onTransitionEnd ) { 5997 args.onTransitionEnd[ prop ].call( this ); 5998 } 5999}; 6000 6001/** 6002 * proper transition 6003 * @param {Object} args - arguments 6004 * @param {Object} to - style to transition to 6005 * @param {Object} from - style to start transition from 6006 * @param {Boolean} isCleaning - removes transition styles after transition 6007 * @param {Function} onTransitionEnd - callback 6008 */ 6009proto.transition = function( args ) { 6010 // redirect to nonTransition if no transition duration 6011 if ( !parseFloat( this.layout.options.transitionDuration ) ) { 6012 this._nonTransition( args ); 6013 return; 6014 } 6015 6016 var _transition = this._transn; 6017 // keep track of onTransitionEnd callback by css property 6018 for ( var prop in args.onTransitionEnd ) { 6019 _transition.onEnd[ prop ] = args.onTransitionEnd[ prop ]; 6020 } 6021 // keep track of properties that are transitioning 6022 for ( prop in args.to ) { 6023 _transition.ingProperties[ prop ] = true; 6024 // keep track of properties to clean up when transition is done 6025 if ( args.isCleaning ) { 6026 _transition.clean[ prop ] = true; 6027 } 6028 } 6029 6030 // set from styles 6031 if ( args.from ) { 6032 this.css( args.from ); 6033 // force redraw. http://blog.alexmaccaw.com/css-transitions 6034 var h = this.element.offsetHeight; 6035 // hack for JSHint to hush about unused var 6036 h = null; 6037 } 6038 // enable transition 6039 this.enableTransition( args.to ); 6040 // set styles that are transitioning 6041 this.css( args.to ); 6042 6043 this.isTransitioning = true; 6044 6045}; 6046 6047// dash before all cap letters, including first for 6048// WebkitTransform => -webkit-transform 6049function toDashedAll( str ) { 6050 return str.replace( /([A-Z])/g, function( $1 ) { 6051 return '-' + $1.toLowerCase(); 6052 }); 6053} 6054 6055var transitionProps = 'opacity,' + toDashedAll( transformProperty ); 6056 6057proto.enableTransition = function(/* style */) { 6058 // HACK changing transitionProperty during a transition 6059 // will cause transition to jump 6060 if ( this.isTransitioning ) { 6061 return; 6062 } 6063 6064 // make `transition: foo, bar, baz` from style object 6065 // HACK un-comment this when enableTransition can work 6066 // while a transition is happening 6067 // var transitionValues = []; 6068 // for ( var prop in style ) { 6069 // // dash-ify camelCased properties like WebkitTransition 6070 // prop = vendorProperties[ prop ] || prop; 6071 // transitionValues.push( toDashedAll( prop ) ); 6072 // } 6073 // munge number to millisecond, to match stagger 6074 var duration = this.layout.options.transitionDuration; 6075 duration = typeof duration == 'number' ? duration + 'ms' : duration; 6076 // enable transition styles 6077 this.css({ 6078 transitionProperty: transitionProps, 6079 transitionDuration: duration, 6080 transitionDelay: this.staggerDelay || 0 6081 }); 6082 // listen for transition end event 6083 this.element.addEventListener( transitionEndEvent, this, false ); 6084}; 6085 6086// ----- events ----- // 6087 6088proto.onwebkitTransitionEnd = function( event ) { 6089 this.ontransitionend( event ); 6090}; 6091 6092proto.onotransitionend = function( event ) { 6093 this.ontransitionend( event ); 6094}; 6095 6096// properties that I munge to make my life easier 6097var dashedVendorProperties = { 6098 '-webkit-transform': 'transform' 6099}; 6100 6101proto.ontransitionend = function( event ) { 6102 // disregard bubbled events from children 6103 if ( event.target !== this.element ) { 6104 return; 6105 } 6106 var _transition = this._transn; 6107 // get property name of transitioned property, convert to prefix-free 6108 var propertyName = dashedVendorProperties[ event.propertyName ] || event.propertyName; 6109 6110 // remove property that has completed transitioning 6111 delete _transition.ingProperties[ propertyName ]; 6112 // check if any properties are still transitioning 6113 if ( isEmptyObj( _transition.ingProperties ) ) { 6114 // all properties have completed transitioning 6115 this.disableTransition(); 6116 } 6117 // clean style 6118 if ( propertyName in _transition.clean ) { 6119 // clean up style 6120 this.element.style[ event.propertyName ] = ''; 6121 delete _transition.clean[ propertyName ]; 6122 } 6123 // trigger onTransitionEnd callback 6124 if ( propertyName in _transition.onEnd ) { 6125 var onTransitionEnd = _transition.onEnd[ propertyName ]; 6126 onTransitionEnd.call( this ); 6127 delete _transition.onEnd[ propertyName ]; 6128 } 6129 6130 this.emitEvent( 'transitionEnd', [ this ] ); 6131}; 6132 6133proto.disableTransition = function() { 6134 this.removeTransitionStyles(); 6135 this.element.removeEventListener( transitionEndEvent, this, false ); 6136 this.isTransitioning = false;
vendor: 3,261 bytes, lines 6137-6285
6137}; 6138 6139/** 6140 * removes style property from element 6141 * @param {Object} style 6142**/ 6143proto._removeStyles = function( style ) { 6144 // clean up transition styles 6145 var cleanStyle = {}; 6146 for ( var prop in style ) { 6147 cleanStyle[ prop ] = ''; 6148 } 6149 this.css( cleanStyle ); 6150}; 6151 6152var cleanTransitionStyle = { 6153 transitionProperty: '', 6154 transitionDuration: '', 6155 transitionDelay: '' 6156}; 6157 6158proto.removeTransitionStyles = function() { 6159 // remove transition 6160 this.css( cleanTransitionStyle ); 6161}; 6162 6163// ----- stagger ----- // 6164 6165proto.stagger = function( delay ) { 6166 delay = isNaN( delay ) ? 0 : delay; 6167 this.staggerDelay = delay + 'ms'; 6168}; 6169 6170// ----- show/hide/remove ----- // 6171 6172// remove element from DOM 6173proto.removeElem = function() { 6174 this.element.parentNode.removeChild( this.element ); 6175 // remove display: none 6176 this.css({ display: '' }); 6177 this.emitEvent( 'remove', [ this ] ); 6178}; 6179 6180proto.remove = function() { 6181 // just remove element if no transition support or no transition 6182 if ( !transitionProperty || !parseFloat( this.layout.options.transitionDuration ) ) { 6183 this.removeElem(); 6184 return; 6185 } 6186 6187 // start transition 6188 this.once( 'transitionEnd', function() { 6189 this.removeElem(); 6190 }); 6191 this.hide(); 6192}; 6193 6194proto.reveal = function() { 6195 delete this.isHidden; 6196 // remove display: none 6197 this.css({ display: '' }); 6198 6199 var options = this.layout.options; 6200 6201 var onTransitionEnd = {}; 6202 var transitionEndProperty = this.getHideRevealTransitionEndProperty('visibleStyle'); 6203 onTransitionEnd[ transitionEndProperty ] = this.onRevealTransitionEnd; 6204 6205 this.transition({ 6206 from: options.hiddenStyle, 6207 to: options.visibleStyle, 6208 isCleaning: true, 6209 onTransitionEnd: onTransitionEnd 6210 }); 6211}; 6212 6213proto.onRevealTransitionEnd = function() { 6214 // check if still visible 6215 // during transition, item may have been hidden 6216 if ( !this.isHidden ) { 6217 this.emitEvent('reveal'); 6218 } 6219}; 6220 6221/** 6222 * get style property use for hide/reveal transition end 6223 * @param {String} styleProperty - hiddenStyle/visibleStyle 6224 * @returns {String} 6225 */ 6226proto.getHideRevealTransitionEndProperty = function( styleProperty ) { 6227 var optionStyle = this.layout.options[ styleProperty ]; 6228 // use opacity 6229 if ( optionStyle.opacity ) { 6230 return 'opacity'; 6231 } 6232 // get first property 6233 for ( var prop in optionStyle ) { 6234 return prop; 6235 } 6236}; 6237 6238proto.hide = function() { 6239 // set flag 6240 this.isHidden = true; 6241 // remove display: none 6242 this.css({ display: '' }); 6243 6244 var options = this.layout.options; 6245 6246 var onTransitionEnd = {}; 6247 var transitionEndProperty = this.getHideRevealTransitionEndProperty('hiddenStyle'); 6248 onTransitionEnd[ transitionEndProperty ] = this.onHideTransitionEnd; 6249 6250 this.transition({ 6251 from: options.visibleStyle, 6252 to: options.hiddenStyle, 6253 // keep hidden stuff hidden 6254 isCleaning: true, 6255 onTransitionEnd: onTransitionEnd 6256 }); 6257}; 6258 6259proto.onHideTransitionEnd = function() { 6260 // check if still hidden 6261 // during transition, item may have been un-hidden 6262 if ( this.isHidden ) { 6263 this.css({ display: 'none' }); 6264 this.emitEvent('hide'); 6265 } 6266}; 6267 6268proto.destroy = function() { 6269 this.css({ 6270 position: '', 6271 left: '', 6272 right: '', 6273 top: '', 6274 bottom: '', 6275 transition: '', 6276 transform: '' 6277 }); 6278}; 6279 6280return Item; 6281 6282})); 6283 6284/*! 6285 * Outlayer v2.1.0
vendor: 22,038 bytes, lines 6285-7225
6285 6286 * the brains and guts of a layout library 6287 * MIT license 6288 */ 6289 6290( function( window, factory ) { 6291 'use strict'; 6292 // universal module definition 6293 /* jshint strict: false */ /* globals define, module, require */ 6294 if ( typeof define == 'function' && define.amd ) { 6295 // AMD - RequireJS 6296 define( 'outlayer/outlayer',[ 6297 'ev-emitter/ev-emitter', 6298 'get-size/get-size', 6299 'fizzy-ui-utils/utils', 6300 './item' 6301 ], 6302 function( EvEmitter, getSize, utils, Item ) { 6303 return factory( window, EvEmitter, getSize, utils, Item); 6304 } 6305 ); 6306 } else if ( typeof module == 'object' && module.exports ) { 6307 // CommonJS - Browserify, Webpack 6308 module.exports = factory( 6309 window, 6310 require('ev-emitter'), 6311 require('get-size'), 6312 require('fizzy-ui-utils'), 6313 require('./item') 6314 ); 6315 } else { 6316 // browser global 6317 window.Outlayer = factory( 6318 window, 6319 window.EvEmitter, 6320 window.getSize, 6321 window.fizzyUIUtils, 6322 window.Outlayer.Item 6323 ); 6324 } 6325 6326}( window, function factory( window, EvEmitter, getSize, utils, Item ) { 6327'use strict'; 6328 6329// ----- vars ----- // 6330 6331var console = window.console; 6332var jQuery = window.jQuery; 6333var noop = function() {}; 6334 6335// -------------------------- Outlayer -------------------------- // 6336 6337// globally unique identifiers 6338var GUID = 0; 6339// internal store of all Outlayer intances 6340var instances = {}; 6341 6342 6343/** 6344 * @param {Element, String} element 6345 * @param {Object} options 6346 * @constructor 6347 */ 6348function Outlayer( element, options ) { 6349 var queryElement = utils.getQueryElement( element ); 6350 if ( !queryElement ) { 6351 if ( console ) { 6352 console.error( 'Bad element for ' + this.constructor.namespace + 6353 ': ' + ( queryElement || element ) ); 6354 } 6355 return; 6356 } 6357 this.element = queryElement; 6358 // add jQuery 6359 if ( jQuery ) { 6360 this.$element = jQuery( this.element ); 6361 } 6362 6363 // options 6364 this.options = utils.extend( {}, this.constructor.defaults ); 6365 this.option( options ); 6366 6367 // add id for Outlayer.getFromElement 6368 var id = ++GUID; 6369 this.element.outlayerGUID = id; // expando 6370 instances[ id ] = this; // associate via id 6371 6372 // kick it off 6373 this._create(); 6374 6375 var isInitLayout = this._getOption('initLayout'); 6376 if ( isInitLayout ) { 6377 this.layout(); 6378 } 6379} 6380 6381// settings are for internal use only 6382Outlayer.namespace = 'outlayer'; 6383Outlayer.Item = Item; 6384 6385// default options 6386Outlayer.defaults = { 6387 containerStyle: { 6388 position: 'relative' 6389 }, 6390 initLayout: true, 6391 originLeft: true, 6392 originTop: true, 6393 resize: true, 6394 resizeContainer: true, 6395 // item options 6396 transitionDuration: '0.4s', 6397 hiddenStyle: { 6398 opacity: 0, 6399 transform: 'scale(0.001)' 6400 }, 6401 visibleStyle: { 6402 opacity: 1, 6403 transform: 'scale(1)' 6404 } 6405}; 6406 6407var proto = Outlayer.prototype; 6408// inherit EvEmitter 6409utils.extend( proto, EvEmitter.prototype ); 6410 6411/** 6412 * set options 6413 * @param {Object} opts 6414 */ 6415proto.option = function( opts ) { 6416 utils.extend( this.options, opts ); 6417}; 6418 6419/** 6420 * get backwards compatible option value, check old name 6421 */ 6422proto._getOption = function( option ) { 6423 var oldOption = this.constructor.compatOptions[ option ]; 6424 return oldOption && this.options[ oldOption ] !== undefined ? 6425 this.options[ oldOption ] : this.options[ option ]; 6426}; 6427 6428Outlayer.compatOptions = { 6429 // currentName: oldName 6430 initLayout: 'isInitLayout', 6431 horizontal: 'isHorizontal', 6432 layoutInstant: 'isLayoutInstant', 6433 originLeft: 'isOriginLeft', 6434 originTop: 'isOriginTop', 6435 resize: 'isResizeBound', 6436 resizeContainer: 'isResizingContainer' 6437}; 6438 6439proto._create = function() { 6440 // get items from children 6441 this.reloadItems(); 6442 // elements that affect layout, but are not laid out 6443 this.stamps = []; 6444 this.stamp( this.options.stamp ); 6445 // set container style 6446 utils.extend( this.element.style, this.options.containerStyle ); 6447 6448 // bind resize method 6449 var canBindResize = this._getOption('resize'); 6450 if ( canBindResize ) { 6451 this.bindResize(); 6452 } 6453}; 6454 6455// goes through all children again and gets bricks in proper order 6456proto.reloadItems = function() { 6457 // collection of item elements 6458 this.items = this._itemize( this.element.children ); 6459}; 6460 6461 6462/** 6463 * turn elements into Outlayer.Items to be used in layout 6464 * @param {Array or NodeList or HTMLElement} elems 6465 * @returns {Array} items - collection of new Outlayer Items 6466 */ 6467proto._itemize = function( elems ) { 6468 6469 var itemElems = this._filterFindItemElements( elems ); 6470 var Item = this.constructor.Item; 6471 6472 // create new Outlayer Items for collection 6473 var items = []; 6474 for ( var i=0; i < itemElems.length; i++ ) { 6475 var elem = itemElems[i]; 6476 var item = new Item( elem, this ); 6477 items.push( item ); 6478 } 6479 6480 return items; 6481}; 6482 6483/** 6484 * get item elements to be used in layout 6485 * @param {Array or NodeList or HTMLElement} elems 6486 * @returns {Array} items - item elements 6487 */ 6488proto._filterFindItemElements = function( elems ) { 6489 return utils.filterFindElements( elems, this.options.itemSelector ); 6490}; 6491 6492/** 6493 * getter method for getting item elements 6494 * @returns {Array} elems - collection of item elements 6495 */ 6496proto.getItemElements = function() { 6497 return this.items.map( function( item ) { 6498 return item.element; 6499 }); 6500}; 6501 6502// ----- init & layout ----- // 6503 6504/** 6505 * lays out all items 6506 */ 6507proto.layout = function() { 6508 this._resetLayout(); 6509 this._manageStamps(); 6510 6511 // don't animate first layout 6512 var layoutInstant = this._getOption('layoutInstant'); 6513 var isInstant = layoutInstant !== undefined ? 6514 layoutInstant : !this._isLayoutInited; 6515 this.layoutItems( this.items, isInstant ); 6516 6517 // flag for initalized 6518 this._isLayoutInited = true; 6519}; 6520 6521// _init is alias for layout 6522proto._init = proto.layout; 6523 6524/** 6525 * logic before any new layout 6526 */ 6527proto._resetLayout = function() { 6528 this.getSize(); 6529}; 6530 6531 6532proto.getSize = function() { 6533 this.size = getSize( this.element ); 6534}; 6535 6536/** 6537 * get measurement from option, for columnWidth, rowHeight, gutter 6538 * if option is String -> get element from selector string, & get size of element 6539 * if option is Element -> get size of element 6540 * else use option as a number 6541 * 6542 * @param {String} measurement 6543 * @param {String} size - width or height 6544 * @private 6545 */ 6546proto._getMeasurement = function( measurement, size ) { 6547 var option = this.options[ measurement ]; 6548 var elem; 6549 if ( !option ) { 6550 // default to 0 6551 this[ measurement ] = 0; 6552 } else { 6553 // use option as an element 6554 if ( typeof option == 'string' ) { 6555 elem = this.element.querySelector( option ); 6556 } else if ( option instanceof HTMLElement ) { 6557 elem = option; 6558 } 6559 // use size of element, if element 6560 this[ measurement ] = elem ? getSize( elem )[ size ] : option; 6561 } 6562}; 6563 6564/** 6565 * layout a collection of item elements 6566 * @api public 6567 */ 6568proto.layoutItems = function( items, isInstant ) { 6569 items = this._getItemsForLayout( items ); 6570 6571 this._layoutItems( items, isInstant ); 6572 6573 this._postLayout(); 6574}; 6575 6576/** 6577 * get the items to be laid out 6578 * you may want to skip over some items 6579 * @param {Array} items 6580 * @returns {Array} items 6581 */ 6582proto._getItemsForLayout = function( items ) { 6583 return items.filter( function( item ) { 6584 return !item.isIgnored; 6585 }); 6586}; 6587 6588/** 6589 * layout items 6590 * @param {Array} items 6591 * @param {Boolean} isInstant 6592 */ 6593proto._layoutItems = function( items, isInstant ) { 6594 this._emitCompleteOnItems( 'layout', items ); 6595 6596 if ( !items || !items.length ) { 6597 // no items, emit event with empty array 6598 return; 6599 } 6600 6601 var queue = []; 6602 6603 items.forEach( function( item ) { 6604 // get x/y object from method 6605 var position = this._getItemLayoutPosition( item ); 6606 // enqueue 6607 position.item = item; 6608 position.isInstant = isInstant || item.isLayoutInstant; 6609 queue.push( position ); 6610 }, this ); 6611 6612 this._processLayoutQueue( queue ); 6613}; 6614 6615/** 6616 * get item layout position 6617 * @param {Outlayer.Item} item 6618 * @returns {Object} x and y position 6619 */ 6620proto._getItemLayoutPosition = function( /* item */ ) { 6621 return { 6622 x: 0, 6623 y: 0 6624 }; 6625}; 6626 6627/** 6628 * iterate over array and position each item 6629 * Reason being - separating this logic prevents 'layout invalidation' 6630 * thx @paul_irish 6631 * @param {Array} queue 6632 */ 6633proto._processLayoutQueue = function( queue ) { 6634 this.updateStagger(); 6635 queue.forEach( function( obj, i ) { 6636 this._positionItem( obj.item, obj.x, obj.y, obj.isInstant, i ); 6637 }, this ); 6638}; 6639 6640// set stagger from option in milliseconds number 6641proto.updateStagger = function() { 6642 var stagger = this.options.stagger; 6643 if ( stagger === null || stagger === undefined ) { 6644 this.stagger = 0; 6645 return; 6646 } 6647 this.stagger = getMilliseconds( stagger ); 6648 return this.stagger; 6649}; 6650 6651/** 6652 * Sets position of item in DOM 6653 * @param {Outlayer.Item} item 6654 * @param {Number} x - horizontal position 6655 * @param {Number} y - vertical position 6656 * @param {Boolean} isInstant - disables transitions 6657 */ 6658proto._positionItem = function( item, x, y, isInstant, i ) { 6659 if ( isInstant ) { 6660 // if not transition, just set CSS 6661 item.goTo( x, y ); 6662 } else { 6663 item.stagger( i * this.stagger ); 6664 item.moveTo( x, y ); 6665 } 6666}; 6667 6668/** 6669 * Any logic you want to do after each layout, 6670 * i.e. size the container 6671 */ 6672proto._postLayout = function() { 6673 this.resizeContainer(); 6674}; 6675 6676proto.resizeContainer = function() { 6677 var isResizingContainer = this._getOption('resizeContainer'); 6678 if ( !isResizingContainer ) { 6679 return; 6680 } 6681 var size = this._getContainerSize(); 6682 if ( size ) { 6683 this._setContainerMeasure( size.width, true ); 6684 this._setContainerMeasure( size.height, false ); 6685 } 6686}; 6687 6688/** 6689 * Sets width or height of container if returned 6690 * @returns {Object} size 6691 * @param {Number} width 6692 * @param {Number} height 6693 */ 6694proto._getContainerSize = noop; 6695 6696/** 6697 * @param {Number} measure - size of width or height 6698 * @param {Boolean} isWidth 6699 */ 6700proto._setContainerMeasure = function( measure, isWidth ) { 6701 if ( measure === undefined ) { 6702 return; 6703 } 6704 6705 var elemSize = this.size; 6706 // add padding and border width if border box 6707 if ( elemSize.isBorderBox ) { 6708 measure += isWidth ? elemSize.paddingLeft + elemSize.paddingRight + 6709 elemSize.borderLeftWidth + elemSize.borderRightWidth : 6710 elemSize.paddingBottom + elemSize.paddingTop + 6711 elemSize.borderTopWidth + elemSize.borderBottomWidth; 6712 } 6713 6714 measure = Math.max( measure, 0 ); 6715 this.element.style[ isWidth ? 'width' : 'height' ] = measure + 'px'; 6716}; 6717 6718/** 6719 * emit eventComplete on a collection of items events 6720 * @param {String} eventName 6721 * @param {Array} items - Outlayer.Items 6722 */ 6723proto._emitCompleteOnItems = function( eventName, items ) { 6724 var _this = this; 6725 function onComplete() { 6726 _this.dispatchEvent( eventName + 'Complete', null, [ items ] ); 6727 } 6728 6729 var count = items.length; 6730 if ( !items || !count ) { 6731 onComplete(); 6732 return; 6733 } 6734 6735 var doneCount = 0; 6736 function tick() { 6737 doneCount++; 6738 if ( doneCount == count ) { 6739 onComplete(); 6740 } 6741 } 6742 6743 // bind callback 6744 items.forEach( function( item ) { 6745 item.once( eventName, tick ); 6746 }); 6747}; 6748 6749/** 6750 * emits events via EvEmitter and jQuery events 6751 * @param {String} type - name of event 6752 * @param {Event} event - original event 6753 * @param {Array} args - extra arguments 6754 */ 6755proto.dispatchEvent = function( type, event, args ) { 6756 // add original event to arguments 6757 var emitArgs = event ? [ event ].concat( args ) : args; 6758 this.emitEvent( type, emitArgs ); 6759 6760 if ( jQuery ) { 6761 // set this.$element 6762 this.$element = this.$element || jQuery( this.element ); 6763 if ( event ) { 6764 // create jQuery event 6765 var $event = jQuery.Event( event ); 6766 $event.type = type; 6767 this.$element.trigger( $event, args ); 6768 } else { 6769 // just trigger with type if no event available 6770 this.$element.trigger( type, args ); 6771 } 6772 } 6773}; 6774 6775// -------------------------- ignore & stamps -------------------------- // 6776 6777 6778/** 6779 * keep item in collection, but do not lay it out 6780 * ignored items do not get skipped in layout 6781 * @param {Element} elem 6782 */ 6783proto.ignore = function( elem ) { 6784 var item = this.getItem( elem ); 6785 if ( item ) { 6786 item.isIgnored = true; 6787 } 6788}; 6789 6790/** 6791 * return item to layout collection 6792 * @param {Element} elem 6793 */ 6794proto.unignore = function( elem ) { 6795 var item = this.getItem( elem ); 6796 if ( item ) { 6797 delete item.isIgnored; 6798 } 6799}; 6800 6801/** 6802 * adds elements to stamps 6803 * @param {NodeList, Array, Element, or String} elems 6804 */ 6805proto.stamp = function( elems ) { 6806 elems = this._find( elems ); 6807 if ( !elems ) { 6808 return; 6809 } 6810 6811 this.stamps = this.stamps.concat( elems ); 6812 // ignore 6813 elems.forEach( this.ignore, this ); 6814}; 6815 6816/** 6817 * removes elements to stamps 6818 * @param {NodeList, Array, or Element} elems 6819 */ 6820proto.unstamp = function( elems ) { 6821 elems = this._find( elems ); 6822 if ( !elems ){ 6823 return; 6824 } 6825 6826 elems.forEach( function( elem ) { 6827 // filter out removed stamp elements 6828 utils.removeFrom( this.stamps, elem ); 6829 this.unignore( elem ); 6830 }, this ); 6831}; 6832 6833/** 6834 * finds child elements 6835 * @param {NodeList, Array, Element, or String} elems 6836 * @returns {Array} elems 6837 */ 6838proto._find = function( elems ) { 6839 if ( !elems ) { 6840 return; 6841 } 6842 // if string, use argument as selector string 6843 if ( typeof elems == 'string' ) { 6844 elems = this.element.querySelectorAll( elems ); 6845 } 6846 elems = utils.makeArray( elems ); 6847 return elems; 6848}; 6849 6850proto._manageStamps = function() { 6851 if ( !this.stamps || !this.stamps.length ) { 6852 return; 6853 } 6854 6855 this._getBoundingRect(); 6856 6857 this.stamps.forEach( this._manageStamp, this ); 6858}; 6859 6860// update boundingLeft / Top 6861proto._getBoundingRect = function() { 6862 // get bounding rect for container element 6863 var boundingRect = this.element.getBoundingClientRect(); 6864 var size = this.size; 6865 this._boundingRect = { 6866 left: boundingRect.left + size.paddingLeft + size.borderLeftWidth, 6867 top: boundingRect.top + size.paddingTop + size.borderTopWidth, 6868 right: boundingRect.right - ( size.paddingRight + size.borderRightWidth ), 6869 bottom: boundingRect.bottom - ( size.paddingBottom + size.borderBottomWidth ) 6870 }; 6871}; 6872 6873/** 6874 * @param {Element} stamp 6875**/ 6876proto._manageStamp = noop; 6877 6878/** 6879 * get x/y position of element relative to container element 6880 * @param {Element} elem 6881 * @returns {Object} offset - has left, top, right, bottom 6882 */ 6883proto._getElementOffset = function( elem ) { 6884 var boundingRect = elem.getBoundingClientRect(); 6885 var thisRect = this._boundingRect; 6886 var size = getSize( elem ); 6887 var offset = { 6888 left: boundingRect.left - thisRect.left - size.marginLeft, 6889 top: boundingRect.top - thisRect.top - size.marginTop, 6890 right: thisRect.right - boundingRect.right - size.marginRight, 6891 bottom: thisRect.bottom - boundingRect.bottom - size.marginBottom 6892 }; 6893 return offset; 6894}; 6895 6896// -------------------------- resize -------------------------- // 6897 6898// enable event handlers for listeners 6899// i.e. resize -> onresize 6900proto.handleEvent = utils.handleEvent; 6901 6902/** 6903 * Bind layout to window resizing 6904 */ 6905proto.bindResize = function() { 6906 window.addEventListener( 'resize', this ); 6907 this.isResizeBound = true; 6908}; 6909 6910/** 6911 * Unbind layout to window resizing 6912 */ 6913proto.unbindResize = function() { 6914 window.removeEventListener( 'resize', this ); 6915 this.isResizeBound = false; 6916}; 6917 6918proto.onresize = function() { 6919 this.resize(); 6920}; 6921 6922utils.debounceMethod( Outlayer, 'onresize', 100 ); 6923 6924proto.resize = function() { 6925 // don't trigger if size did not change 6926 // or if resize was unbound. See #9 6927 if ( !this.isResizeBound || !this.needsResizeLayout() ) { 6928 return; 6929 } 6930 6931 this.layout(); 6932}; 6933 6934/** 6935 * check if layout is needed post layout 6936 * @returns Boolean 6937 */ 6938proto.needsResizeLayout = function() { 6939 var size = getSize( this.element ); 6940 // check that this.size and size are there 6941 // IE8 triggers resize on body size change, so they might not be 6942 var hasSizes = this.size && size; 6943 return hasSizes && size.innerWidth !== this.size.innerWidth; 6944}; 6945 6946// -------------------------- methods -------------------------- // 6947 6948/** 6949 * add items to Outlayer instance 6950 * @param {Array or NodeList or Element} elems 6951 * @returns {Array} items - Outlayer.Items 6952**/ 6953proto.addItems = function( elems ) { 6954 var items = this._itemize( elems ); 6955 // add items to collection 6956 if ( items.length ) { 6957 this.items = this.items.concat( items ); 6958 } 6959 return items; 6960}; 6961 6962/** 6963 * Layout newly-appended item elements 6964 * @param {Array or NodeList or Element} elems 6965 */ 6966proto.appended = function( elems ) { 6967 var items = this.addItems( elems ); 6968 if ( !items.length ) { 6969 return; 6970 } 6971 // layout and reveal just the new items 6972 this.layoutItems( items, true ); 6973 this.reveal( items ); 6974}; 6975 6976/** 6977 * Layout prepended elements 6978 * @param {Array or NodeList or Element} elems 6979 */ 6980proto.prepended = function( elems ) { 6981 var items = this._itemize( elems ); 6982 if ( !items.length ) { 6983 return; 6984 } 6985 // add items to beginning of collection 6986 var previousItems = this.items.slice(0); 6987 this.items = items.concat( previousItems ); 6988 // start new layout 6989 this._resetLayout(); 6990 this._manageStamps(); 6991 // layout new stuff without transition 6992 this.layoutItems( items, true ); 6993 this.reveal( items ); 6994 // layout previous items 6995 this.layoutItems( previousItems ); 6996}; 6997 6998/** 6999 * reveal a collection of items 7000 * @param {Array of Outlayer.Items} items 7001 */ 7002proto.reveal = function( items ) { 7003 this._emitCompleteOnItems( 'reveal', items ); 7004 if ( !items || !items.length ) { 7005 return; 7006 } 7007 var stagger = this.updateStagger(); 7008 items.forEach( function( item, i ) { 7009 item.stagger( i * stagger ); 7010 item.reveal(); 7011 }); 7012}; 7013 7014/** 7015 * hide a collection of items 7016 * @param {Array of Outlayer.Items} items 7017 */ 7018proto.hide = function( items ) { 7019 this._emitCompleteOnItems( 'hide', items ); 7020 if ( !items || !items.length ) { 7021 return; 7022 } 7023 var stagger = this.updateStagger(); 7024 items.forEach( function( item, i ) { 7025 item.stagger( i * stagger ); 7026 item.hide(); 7027 }); 7028}; 7029 7030/** 7031 * reveal item elements 7032 * @param {Array}, {Element}, {NodeList} items 7033 */ 7034proto.revealItemElements = function( elems ) { 7035 var items = this.getItems( elems ); 7036 this.reveal( items ); 7037}; 7038 7039/** 7040 * hide item elements 7041 * @param {Array}, {Element}, {NodeList} items 7042 */ 7043proto.hideItemElements = function( elems ) { 7044 var items = this.getItems( elems ); 7045 this.hide( items ); 7046}; 7047 7048/** 7049 * get Outlayer.Item, given an Element 7050 * @param {Element} elem 7051 * @param {Function} callback 7052 * @returns {Outlayer.Item} item 7053 */ 7054proto.getItem = function( elem ) { 7055 // loop through items to get the one that matches 7056 for ( var i=0; i < this.items.length; i++ ) { 7057 var item = this.items[i]; 7058 if ( item.element == elem ) { 7059 // return item 7060 return item; 7061 } 7062 } 7063}; 7064 7065/** 7066 * get collection of Outlayer.Items, given Elements 7067 * @param {Array} elems 7068 * @returns {Array} items - Outlayer.Items 7069 */ 7070proto.getItems = function( elems ) { 7071 elems = utils.makeArray( elems ); 7072 var items = []; 7073 elems.forEach( function( elem ) { 7074 var item = this.getItem( elem ); 7075 if ( item ) { 7076 items.push( item ); 7077 } 7078 }, this ); 7079 7080 return items; 7081}; 7082 7083/** 7084 * remove element(s) from instance and DOM 7085 * @param {Array or NodeList or Element} elems 7086 */ 7087proto.remove = function( elems ) { 7088 var removeItems = this.getItems( elems ); 7089 7090 this._emitCompleteOnItems( 'remove', removeItems ); 7091 7092 // bail if no items to remove 7093 if ( !removeItems || !removeItems.length ) { 7094 return; 7095 } 7096 7097 removeItems.forEach( function( item ) { 7098 item.remove(); 7099 // remove item from collection 7100 utils.removeFrom( this.items, item ); 7101 }, this ); 7102}; 7103 7104// ----- destroy ----- // 7105 7106// remove and disable Outlayer instance 7107proto.destroy = function() { 7108 // clean up dynamic styles 7109 var style = this.element.style; 7110 style.height = ''; 7111 style.position = ''; 7112 style.width = ''; 7113 // destroy items 7114 this.items.forEach( function( item ) { 7115 item.destroy(); 7116 }); 7117 7118 this.unbindResize(); 7119 7120 var id = this.element.outlayerGUID; 7121 delete instances[ id ]; // remove reference to instance by id 7122 delete this.element.outlayerGUID; 7123 // remove data for jQuery 7124 if ( jQuery ) { 7125 jQuery.removeData( this.element, this.constructor.namespace ); 7126 } 7127 7128}; 7129 7130// -------------------------- data -------------------------- // 7131 7132/** 7133 * get Outlayer instance from element 7134 * @param {Element} elem 7135 * @returns {Outlayer} 7136 */ 7137Outlayer.data = function( elem ) { 7138 elem = utils.getQueryElement( elem ); 7139 var id = elem && elem.outlayerGUID; 7140 return id && instances[ id ]; 7141}; 7142 7143 7144// -------------------------- create Outlayer class -------------------------- // 7145 7146/** 7147 * create a layout class 7148 * @param {String} namespace 7149 */ 7150Outlayer.create = function( namespace, options ) { 7151 // sub-class Outlayer 7152 var Layout = subclass( Outlayer ); 7153 // apply new options and compatOptions 7154 Layout.defaults = utils.extend( {}, Outlayer.defaults ); 7155 utils.extend( Layout.defaults, options ); 7156 Layout.compatOptions = utils.extend( {}, Outlayer.compatOptions ); 7157 7158 Layout.namespace = namespace; 7159 7160 Layout.data = Outlayer.data; 7161 7162 // sub-class Item 7163 Layout.Item = subclass( Item ); 7164 7165 // -------------------------- declarative -------------------------- // 7166 7167 utils.htmlInit( Layout, namespace ); 7168 7169 // -------------------------- jQuery bridge -------------------------- // 7170 7171 // make into jQuery plugin 7172 if ( jQuery && jQuery.bridget ) { 7173 jQuery.bridget( namespace, Layout ); 7174 } 7175 7176 return Layout; 7177}; 7178 7179function subclass( Parent ) { 7180 function SubClass() { 7181 Parent.apply( this, arguments ); 7182 } 7183 7184 SubClass.prototype = Object.create( Parent.prototype ); 7185 SubClass.prototype.constructor = SubClass; 7186 7187 return SubClass; 7188} 7189 7190// ----- helpers ----- // 7191 7192// how many milliseconds are in each unit 7193var msUnits = { 7194 ms: 1, 7195 s: 1000 7196}; 7197 7198// munge time-like parameter into millisecond number 7199// '0.4s' -> 40 7200function getMilliseconds( time ) { 7201 if ( typeof time == 'number' ) { 7202 return time; 7203 } 7204 var matches = time.match( /(^\d*\.?\d*)(\w*)/ ); 7205 var num = matches && matches[1]; 7206 var unit = matches && matches[2]; 7207 if ( !num.length ) { 7208 return 0; 7209 } 7210 num = parseFloat( num ); 7211 var mult = msUnits[ unit ] || 1; 7212 return num * mult; 7213} 7214 7215// ----- fin ----- // 7216 7217// back in global 7218Outlayer.Item = Item; 7219 7220return Outlayer; 7221 7222})); 7223 7224/** 7225 *
vendor: 23,322 bytes, lines 7225-8100
7225Isotope Item 7226**/ 7227 7228( function( window, factory ) { 7229 // universal module definition 7230 /* jshint strict: false */ /*globals define, module, require */ 7231 if ( typeof define == 'function' && define.amd ) { 7232 // AMD 7233 define( 'isotope/js/item',[ 7234 'outlayer/outlayer' 7235 ], 7236 factory ); 7237 } else if ( typeof module == 'object' && module.exports ) { 7238 // CommonJS 7239 module.exports = factory( 7240 require('outlayer') 7241 ); 7242 } else { 7243 // browser global 7244 window.Isotope = window.Isotope || {}; 7245 window.Isotope.Item = factory( 7246 window.Outlayer 7247 ); 7248 } 7249 7250}( window, function factory( Outlayer ) { 7251'use strict'; 7252 7253// -------------------------- Item -------------------------- // 7254 7255// sub-class Outlayer Item 7256function Item() { 7257 Outlayer.Item.apply( this, arguments ); 7258} 7259 7260var proto = Item.prototype = Object.create( Outlayer.Item.prototype ); 7261 7262var _create = proto._create; 7263proto._create = function() { 7264 // assign id, used for original-order sorting 7265 this.id = this.layout.itemGUID++; 7266 _create.call( this ); 7267 this.sortData = {}; 7268}; 7269 7270proto.updateSortData = function() { 7271 if ( this.isIgnored ) { 7272 return; 7273 } 7274 // default sorters 7275 this.sortData.id = this.id; 7276 // for backward compatibility 7277 this.sortData['original-order'] = this.id; 7278 this.sortData.random = Math.random(); 7279 // go thru getSortData obj and apply the sorters 7280 var getSortData = this.layout.options.getSortData; 7281 var sorters = this.layout._sorters; 7282 for ( var key in getSortData ) { 7283 var sorter = sorters[ key ]; 7284 this.sortData[ key ] = sorter( this.element, this ); 7285 } 7286}; 7287 7288var _destroy = proto.destroy; 7289proto.destroy = function() { 7290 // call super 7291 _destroy.apply( this, arguments ); 7292 // reset display, #741 7293 this.css({ 7294 display: '' 7295 }); 7296}; 7297 7298return Item; 7299 7300})); 7301 7302/** 7303 * Isotope LayoutMode 7304 */ 7305 7306( function( window, factory ) { 7307 // universal module definition 7308 /* jshint strict: false */ /*globals define, module, require */ 7309 if ( typeof define == 'function' && define.amd ) { 7310 // AMD 7311 define( 'isotope/js/layout-mode',[ 7312 'get-size/get-size', 7313 'outlayer/outlayer' 7314 ], 7315 factory ); 7316 } else if ( typeof module == 'object' && module.exports ) { 7317 // CommonJS 7318 module.exports = factory( 7319 require('get-size'), 7320 require('outlayer') 7321 ); 7322 } else { 7323 // browser global 7324 window.Isotope = window.Isotope || {}; 7325 window.Isotope.LayoutMode = factory( 7326 window.getSize, 7327 window.Outlayer 7328 ); 7329 } 7330 7331}( window, function factory( getSize, Outlayer ) { 7332 'use strict'; 7333 7334 // layout mode class 7335 function LayoutMode( isotope ) { 7336 this.isotope = isotope; 7337 // link properties 7338 if ( isotope ) { 7339 this.options = isotope.options[ this.namespace ]; 7340 this.element = isotope.element; 7341 this.items = isotope.filteredItems; 7342 this.size = isotope.size; 7343 } 7344 } 7345 7346 var proto = LayoutMode.prototype; 7347 7348 /** 7349 * some methods should just defer to default Outlayer method 7350 * and reference the Isotope instance as `this` 7351 **/ 7352 var facadeMethods = [ 7353 '_resetLayout', 7354 '_getItemLayoutPosition', 7355 '_manageStamp', 7356 '_getContainerSize', 7357 '_getElementOffset', 7358 'needsResizeLayout', 7359 '_getOption' 7360 ]; 7361 7362 facadeMethods.forEach( function( methodName ) { 7363 proto[ methodName ] = function() { 7364 return Outlayer.prototype[ methodName ].apply( this.isotope, arguments ); 7365 }; 7366 }); 7367 7368 // ----- ----- // 7369 7370 // for horizontal layout modes, check vertical size 7371 proto.needsVerticalResizeLayout = function() { 7372 // don't trigger if size did not change 7373 var size = getSize( this.isotope.element ); 7374 // check that this.size and size are there 7375 // IE8 triggers resize on body size change, so they might not be 7376 var hasSizes = this.isotope.size && size; 7377 return hasSizes && size.innerHeight != this.isotope.size.innerHeight; 7378 }; 7379 7380 // ----- measurements ----- // 7381 7382 proto._getMeasurement = function() { 7383 this.isotope._getMeasurement.apply( this, arguments ); 7384 }; 7385 7386 proto.getColumnWidth = function() { 7387 this.getSegmentSize( 'column', 'Width' ); 7388 }; 7389 7390 proto.getRowHeight = function() { 7391 this.getSegmentSize( 'row', 'Height' ); 7392 }; 7393 7394 /** 7395 * get columnWidth or rowHeight 7396 * segment: 'column' or 'row' 7397 * size 'Width' or 'Height' 7398 **/ 7399 proto.getSegmentSize = function( segment, size ) { 7400 var segmentName = segment + size; 7401 var outerSize = 'outer' + size; 7402 // columnWidth / outerWidth // rowHeight / outerHeight 7403 this._getMeasurement( segmentName, outerSize ); 7404 // got rowHeight or columnWidth, we can chill 7405 if ( this[ segmentName ] ) { 7406 return; 7407 } 7408 // fall back to item of first element 7409 var firstItemSize = this.getFirstItemSize(); 7410 this[ segmentName ] = firstItemSize && firstItemSize[ outerSize ] || 7411 // or size of container 7412 this.isotope.size[ 'inner' + size ]; 7413 }; 7414 7415 proto.getFirstItemSize = function() { 7416 var firstItem = this.isotope.filteredItems[0]; 7417 return firstItem && firstItem.element && getSize( firstItem.element ); 7418 }; 7419 7420 // ----- methods that should reference isotope ----- // 7421 7422 proto.layout = function() { 7423 this.isotope.layout.apply( this.isotope, arguments ); 7424 }; 7425 7426 proto.getSize = function() { 7427 this.isotope.getSize(); 7428 this.size = this.isotope.size; 7429 }; 7430 7431 // -------------------------- create -------------------------- // 7432 7433 LayoutMode.modes = {}; 7434 7435 LayoutMode.create = function( namespace, options ) { 7436 7437 function Mode() { 7438 LayoutMode.apply( this, arguments ); 7439 } 7440 7441 Mode.prototype = Object.create( proto ); 7442 Mode.prototype.constructor = Mode; 7443 7444 // default options 7445 if ( options ) { 7446 Mode.options = options; 7447 } 7448 7449 Mode.prototype.namespace = namespace; 7450 // register in Isotope 7451 LayoutMode.modes[ namespace ] = Mode; 7452 7453 return Mode; 7454 }; 7455 7456 return LayoutMode; 7457 7458})); 7459 7460/*! 7461 * Masonry v4.1.1 7462 * Cascading grid layout library 7463 * http://masonry.desandro.com 7464 * MIT License 7465 * by David DeSandro 7466 */ 7467 7468( function( window, factory ) { 7469 // universal module definition 7470 /* jshint strict: false */ /*globals define, module, require */ 7471 if ( typeof define == 'function' && define.amd ) { 7472 // AMD 7473 define( 'masonry/masonry',[ 7474 'outlayer/outlayer', 7475 'get-size/get-size' 7476 ], 7477 factory ); 7478 } else if ( typeof module == 'object' && module.exports ) { 7479 // CommonJS 7480 module.exports = factory( 7481 require('outlayer'), 7482 require('get-size') 7483 ); 7484 } else { 7485 // browser global 7486 window.Masonry = factory( 7487 window.Outlayer, 7488 window.getSize 7489 ); 7490 } 7491 7492}( window, function factory( Outlayer, getSize ) { 7493 7494 7495 7496// -------------------------- masonryDefinition -------------------------- // 7497 7498 // create an Outlayer layout class 7499 var Masonry = Outlayer.create('masonry'); 7500 // isFitWidth -> fitWidth 7501 Masonry.compatOptions.fitWidth = 'isFitWidth'; 7502 7503 Masonry.prototype._resetLayout = function() { 7504 this.getSize(); 7505 this._getMeasurement( 'columnWidth', 'outerWidth' ); 7506 this._getMeasurement( 'gutter', 'outerWidth' ); 7507 this.measureColumns(); 7508 7509 // reset column Y 7510 this.colYs = []; 7511 for ( var i=0; i < this.cols; i++ ) { 7512 this.colYs.push( 0 ); 7513 } 7514 7515 this.maxY = 0; 7516 }; 7517 7518 Masonry.prototype.measureColumns = function() { 7519 this.getContainerWidth(); 7520 // if columnWidth is 0, default to outerWidth of first item 7521 if ( !this.columnWidth ) { 7522 var firstItem = this.items[0]; 7523 var firstItemElem = firstItem && firstItem.element; 7524 // columnWidth fall back to item of first element 7525 this.columnWidth = firstItemElem && getSize( firstItemElem ).outerWidth || 7526 // if first elem has no width, default to size of container 7527 this.containerWidth; 7528 } 7529 7530 var columnWidth = this.columnWidth += this.gutter; 7531 7532 // calculate columns 7533 var containerWidth = this.containerWidth + this.gutter; 7534 var cols = containerWidth / columnWidth; 7535 // fix rounding errors, typically with gutters 7536 var excess = columnWidth - containerWidth % columnWidth; 7537 // if overshoot is less than a pixel, round up, otherwise floor it 7538 var mathMethod = excess && excess < 1 ? 'round' : 'floor'; 7539 cols = Math[ mathMethod ]( cols ); 7540 this.cols = Math.max( cols, 1 ); 7541 }; 7542 7543 Masonry.prototype.getContainerWidth = function() { 7544 // container is parent if fit width 7545 var isFitWidth = this._getOption('fitWidth'); 7546 var container = isFitWidth ? this.element.parentNode : this.element; 7547 // check that this.size and size are there 7548 // IE8 triggers resize on body size change, so they might not be 7549 var size = getSize( container ); 7550 this.containerWidth = size && size.innerWidth; 7551 }; 7552 7553 Masonry.prototype._getItemLayoutPosition = function( item ) { 7554 item.getSize(); 7555 // how many columns does this brick span 7556 var remainder = item.size.outerWidth % this.columnWidth; 7557 var mathMethod = remainder && remainder < 1 ? 'round' : 'ceil'; 7558 // round if off by 1 pixel, otherwise use ceil 7559 var colSpan = Math[ mathMethod ]( item.size.outerWidth / this.columnWidth ); 7560 colSpan = Math.min( colSpan, this.cols ); 7561 7562 var colGroup = this._getColGroup( colSpan ); 7563 // get the minimum Y value from the columns 7564 var minimumY = Math.min.apply( Math, colGroup ); 7565 var shortColIndex = colGroup.indexOf( minimumY ); 7566 7567 // position the brick 7568 var position = { 7569 x: this.columnWidth * shortColIndex, 7570 y: minimumY 7571 }; 7572 7573 // apply setHeight to necessary columns 7574 var setHeight = minimumY + item.size.outerHeight; 7575 var setSpan = this.cols + 1 - colGroup.length; 7576 for ( var i = 0; i < setSpan; i++ ) { 7577 this.colYs[ shortColIndex + i ] = setHeight; 7578 } 7579 7580 return position; 7581 }; 7582 7583 /** 7584 * @param {Number} colSpan - number of columns the element spans 7585 * @returns {Array} colGroup 7586 */ 7587 Masonry.prototype._getColGroup = function( colSpan ) { 7588 if ( colSpan < 2 ) { 7589 // if brick spans only one column, use all the column Ys 7590 return this.colYs; 7591 } 7592 7593 var colGroup = []; 7594 // how many different places could this brick fit horizontally 7595 var groupCount = this.cols + 1 - colSpan; 7596 // for each group potential horizontal position 7597 for ( var i = 0; i < groupCount; i++ ) { 7598 // make an array of colY values for that one group 7599 var groupColYs = this.colYs.slice( i, i + colSpan ); 7600 // and get the max value of the array 7601 colGroup[i] = Math.max.apply( Math, groupColYs ); 7602 } 7603 return colGroup; 7604 }; 7605 7606 Masonry.prototype._manageStamp = function( stamp ) { 7607 var stampSize = getSize( stamp ); 7608 var offset = this._getElementOffset( stamp ); 7609 // get the columns that this stamp affects 7610 var isOriginLeft = this._getOption('originLeft'); 7611 var firstX = isOriginLeft ? offset.left : offset.right; 7612 var lastX = firstX + stampSize.outerWidth; 7613 var firstCol = Math.floor( firstX / this.columnWidth ); 7614 firstCol = Math.max( 0, firstCol ); 7615 var lastCol = Math.floor( lastX / this.columnWidth ); 7616 // lastCol should not go over if multiple of columnWidth #425 7617 lastCol -= lastX % this.columnWidth ? 0 : 1; 7618 lastCol = Math.min( this.cols - 1, lastCol ); 7619 // set colYs to bottom of the stamp 7620 7621 var isOriginTop = this._getOption('originTop'); 7622 var stampMaxY = ( isOriginTop ? offset.top : offset.bottom ) + 7623 stampSize.outerHeight; 7624 for ( var i = firstCol; i <= lastCol; i++ ) { 7625 this.colYs[i] = Math.max( stampMaxY, this.colYs[i] ); 7626 } 7627 }; 7628 7629 Masonry.prototype._getContainerSize = function() { 7630 this.maxY = Math.max.apply( Math, this.colYs ); 7631 var size = { 7632 height: this.maxY 7633 }; 7634 7635 if ( this._getOption('fitWidth') ) { 7636 size.width = this._getContainerFitWidth(); 7637 } 7638 7639 return size; 7640 }; 7641 7642 Masonry.prototype._getContainerFitWidth = function() { 7643 var unusedCols = 0; 7644 // count unused columns 7645 var i = this.cols; 7646 while ( --i ) { 7647 if ( this.colYs[i] !== 0 ) { 7648 break; 7649 } 7650 unusedCols++; 7651 } 7652 // fit container to columns that have been used 7653 return ( this.cols - unusedCols ) * this.columnWidth - this.gutter; 7654 }; 7655 7656 Masonry.prototype.needsResizeLayout = function() { 7657 var previousWidth = this.containerWidth; 7658 this.getContainerWidth(); 7659 return previousWidth != this.containerWidth; 7660 }; 7661 7662 return Masonry; 7663 7664})); 7665 7666/*! 7667 * Masonry layout mode 7668 * sub-classes Masonry 7669 * http://masonry.desandro.com 7670 */ 7671 7672( function( window, factory ) { 7673 // universal module definition 7674 /* jshint strict: false */ /*globals define, module, require */ 7675 if ( typeof define == 'function' && define.amd ) { 7676 // AMD 7677 define( 'isotope/js/layout-modes/masonry',[ 7678 '../layout-mode', 7679 'masonry/masonry' 7680 ], 7681 factory ); 7682 } else if ( typeof module == 'object' && module.exports ) { 7683 // CommonJS 7684 module.exports = factory( 7685 require('../layout-mode'), 7686 require('masonry-layout') 7687 ); 7688 } else { 7689 // browser global 7690 factory( 7691 window.Isotope.LayoutMode, 7692 window.Masonry 7693 ); 7694 } 7695 7696}( window, function factory( LayoutMode, Masonry ) { 7697'use strict'; 7698 7699// -------------------------- masonryDefinition -------------------------- // 7700 7701 // create an Outlayer layout class 7702 var MasonryMode = LayoutMode.create('masonry'); 7703 7704 var proto = MasonryMode.prototype; 7705 7706 var keepModeMethods = { 7707 _getElementOffset: true, 7708 layout: true, 7709 _getMeasurement: true 7710 }; 7711 7712 // inherit Masonry prototype 7713 for ( var method in Masonry.prototype ) { 7714 // do not inherit mode methods 7715 if ( !keepModeMethods[ method ] ) { 7716 proto[ method ] = Masonry.prototype[ method ]; 7717 } 7718 } 7719 7720 var measureColumns = proto.measureColumns; 7721 proto.measureColumns = function() { 7722 // set items, used if measuring first item 7723 this.items = this.isotope.filteredItems; 7724 measureColumns.call( this ); 7725 }; 7726 7727 // point to mode options for fitWidth 7728 var _getOption = proto._getOption; 7729 proto._getOption = function( option ) { 7730 if ( option == 'fitWidth' ) { 7731 return this.options.isFitWidth !== undefined ? 7732 this.options.isFitWidth : this.options.fitWidth; 7733 } 7734 return _getOption.apply( this.isotope, arguments ); 7735 }; 7736 7737 return MasonryMode; 7738 7739})); 7740 7741/** 7742 * fitRows layout mode 7743 */ 7744 7745( function( window, factory ) { 7746 // universal module definition 7747 /* jshint strict: false */ /*globals define, module, require */ 7748 if ( typeof define == 'function' && define.amd ) { 7749 // AMD 7750 define( 'isotope/js/layout-modes/fit-rows',[ 7751 '../layout-mode' 7752 ], 7753 factory ); 7754 } else if ( typeof exports == 'object' ) { 7755 // CommonJS 7756 module.exports = factory( 7757 require('../layout-mode') 7758 ); 7759 } else { 7760 // browser global 7761 factory( 7762 window.Isotope.LayoutMode 7763 ); 7764 } 7765 7766}( window, function factory( LayoutMode ) { 7767'use strict'; 7768 7769var FitRows = LayoutMode.create('fitRows'); 7770 7771var proto = FitRows.prototype; 7772 7773proto._resetLayout = function() { 7774 this.x = 0; 7775 this.y = 0; 7776 this.maxY = 0; 7777 this._getMeasurement( 'gutter', 'outerWidth' ); 7778}; 7779 7780proto._getItemLayoutPosition = function( item ) { 7781 item.getSize(); 7782 7783 var itemWidth = item.size.outerWidth + this.gutter; 7784 // if this element cannot fit in the current row 7785 var containerWidth = this.isotope.size.innerWidth + this.gutter; 7786 if ( this.x !== 0 && itemWidth + this.x > containerWidth ) { 7787 this.x = 0; 7788 this.y = this.maxY; 7789 } 7790 7791 var position = { 7792 x: this.x, 7793 y: this.y 7794 }; 7795 7796 this.maxY = Math.max( this.maxY, this.y + item.size.outerHeight ); 7797 this.x += itemWidth; 7798 7799 return position; 7800}; 7801 7802proto._getContainerSize = function() { 7803 return { height: this.maxY }; 7804}; 7805 7806return FitRows; 7807 7808})); 7809 7810/** 7811 * vertical layout mode 7812 */ 7813 7814( function( window, factory ) { 7815 // universal module definition 7816 /* jshint strict: false */ /*globals define, module, require */ 7817 if ( typeof define == 'function' && define.amd ) { 7818 // AMD 7819 define( 'isotope/js/layout-modes/vertical',[ 7820 '../layout-mode' 7821 ], 7822 factory ); 7823 } else if ( typeof module == 'object' && module.exports ) { 7824 // CommonJS 7825 module.exports = factory( 7826 require('../layout-mode') 7827 ); 7828 } else { 7829 // browser global 7830 factory( 7831 window.Isotope.LayoutMode 7832 ); 7833 } 7834 7835}( window, function factory( LayoutMode ) { 7836'use strict'; 7837 7838var Vertical = LayoutMode.create( 'vertical', { 7839 horizontalAlignment: 0 7840}); 7841 7842var proto = Vertical.prototype; 7843 7844proto._resetLayout = function() { 7845 this.y = 0; 7846}; 7847 7848proto._getItemLayoutPosition = function( item ) { 7849 item.getSize(); 7850 var x = ( this.isotope.size.innerWidth - item.size.outerWidth ) * 7851 this.options.horizontalAlignment; 7852 var y = this.y; 7853 this.y += item.size.outerHeight; 7854 return { x: x, y: y }; 7855}; 7856 7857proto._getContainerSize = function() { 7858 return { height: this.y }; 7859}; 7860 7861return Vertical; 7862 7863})); 7864 7865/*! 7866 * Isotope v3.0.2 7867 * 7868 * Licensed GPLv3 for open source use 7869 * or Isotope Commercial License for commercial use 7870 * 7871 * http://isotope.metafizzy.co 7872 * Copyright 2016 Metafizzy 7873 */ 7874 7875( function( window, factory ) { 7876 // universal module definition 7877 /* jshint strict: false */ /*globals define, module, require */ 7878 if ( typeof define == 'function' && define.amd ) { 7879 // AMD 7880 define( [ 7881 'outlayer/outlayer', 7882 'get-size/get-size', 7883 'desandro-matches-selector/matches-selector', 7884 'fizzy-ui-utils/utils', 7885 'isotope/js/item', 7886 'isotope/js/layout-mode', 7887 // include default layout modes 7888 'isotope/js/layout-modes/masonry', 7889 'isotope/js/layout-modes/fit-rows', 7890 'isotope/js/layout-modes/vertical' 7891 ], 7892 function( Outlayer, getSize, matchesSelector, utils, Item, LayoutMode ) { 7893 return factory( window, Outlayer, getSize, matchesSelector, utils, Item, LayoutMode ); 7894 }); 7895 } else if ( typeof module == 'object' && module.exports ) { 7896 // CommonJS 7897 module.exports = factory( 7898 window, 7899 require('outlayer'), 7900 require('get-size'), 7901 require('desandro-matches-selector'), 7902 require('fizzy-ui-utils'), 7903 require('isotope/js/item'), 7904 require('isotope/js/layout-mode'), 7905 // include default layout modes 7906 require('isotope/js/layout-modes/masonry'), 7907 require('isotope/js/layout-modes/fit-rows'), 7908 require('isotope/js/layout-modes/vertical') 7909 ); 7910 } else { 7911 // browser global 7912 window.Isotope = factory( 7913 window, 7914 window.Outlayer, 7915 window.getSize, 7916 window.matchesSelector, 7917 window.fizzyUIUtils, 7918 window.Isotope.Item, 7919 window.Isotope.LayoutMode 7920 ); 7921 } 7922 7923}( window, function factory( window, Outlayer, getSize, matchesSelector, utils, 7924 Item, LayoutMode ) { 7925 7926 7927 7928// -------------------------- vars -------------------------- // 7929 7930var jQuery = window.jQuery; 7931 7932// -------------------------- helpers -------------------------- // 7933 7934var trim = String.prototype.trim ? 7935 function( str ) { 7936 return str.trim(); 7937 } : 7938 function( str ) { 7939 return str.replace( /^\s+|\s+$/g, '' ); 7940 }; 7941 7942// -------------------------- isotopeDefinition -------------------------- // 7943 7944 // create an Outlayer layout class 7945 var Isotope = Outlayer.create( 'isotope', { 7946 layoutMode: 'masonry', 7947 isJQueryFiltering: true, 7948 sortAscending: true 7949 }); 7950 7951 Isotope.Item = Item; 7952 Isotope.LayoutMode = LayoutMode; 7953 7954 var proto = Isotope.prototype; 7955 7956 proto._create = function() { 7957 this.itemGUID = 0; 7958 // functions that sort items 7959 this._sorters = {}; 7960 this._getSorters(); 7961 // call super 7962 Outlayer.prototype._create.call( this ); 7963 7964 // create layout modes 7965 this.modes = {}; 7966 // start filteredItems with all items 7967 this.filteredItems = this.items; 7968 // keep of track of sortBys 7969 this.sortHistory = [ 'original-order' ]; 7970 // create from registered layout modes 7971 for ( var name in LayoutMode.modes ) { 7972 this._initLayoutMode( name ); 7973 } 7974 }; 7975 7976 proto.reloadItems = function() { 7977 // reset item ID counter 7978 this.itemGUID = 0; 7979 // call super 7980 Outlayer.prototype.reloadItems.call( this ); 7981 }; 7982 7983 proto._itemize = function() { 7984 var items = Outlayer.prototype._itemize.apply( this, arguments ); 7985 // assign ID for original-order 7986 for ( var i=0; i < items.length; i++ ) { 7987 var item = items[i]; 7988 item.id = this.itemGUID++; 7989 } 7990 this._updateItemsSortData( items ); 7991 return items; 7992 }; 7993 7994 7995 // -------------------------- layout -------------------------- // 7996 7997 proto._initLayoutMode = function( name ) { 7998 var Mode = LayoutMode.modes[ name ]; 7999 // set mode options 8000 // HACK extend initial options, back-fill in default options 8001 var initialOpts = this.options[ name ] || {}; 8002 this.options[ name ] = Mode.options ? 8003 utils.extend( Mode.options, initialOpts ) : initialOpts; 8004 // init layout mode instance 8005 this.modes[ name ] = new Mode( this ); 8006 }; 8007 8008 8009 proto.layout = function() { 8010 // if first time doing layout, do all magic 8011 if ( !this._isLayoutInited && this._getOption('initLayout') ) { 8012 this.arrange(); 8013 return; 8014 } 8015 this._layout(); 8016 }; 8017 8018 // private method to be used in layout() & magic() 8019 proto._layout = function() { 8020 // don't animate first layout 8021 var isInstant = this._getIsInstant(); 8022 // layout flow 8023 this._resetLayout(); 8024 this._manageStamps(); 8025 this.layoutItems( this.filteredItems, isInstant ); 8026 8027 // flag for initalized 8028 this._isLayoutInited = true; 8029 }; 8030 8031 // filter + sort + layout 8032 proto.arrange = function( opts ) { 8033 // set any options pass 8034 this.option( opts ); 8035 this._getIsInstant(); 8036 // filter, sort, and layout 8037 8038 // filter 8039 var filtered = this._filter( this.items ); 8040 this.filteredItems = filtered.matches; 8041 8042 this._bindArrangeComplete(); 8043 8044 if ( this._isInstant ) { 8045 this._noTransition( this._hideReveal, [ filtered ] ); 8046 } else { 8047 this._hideReveal( filtered ); 8048 } 8049 8050 this._sort(); 8051 this._layout(); 8052 }; 8053 // alias to _init for main plugin method 8054 proto._init = proto.arrange; 8055 8056 proto._hideReveal = function( filtered ) { 8057 this.reveal( filtered.needReveal ); 8058 this.hide( filtered.needHide ); 8059 }; 8060 8061 // HACK 8062 // Don't animate/transition first layout 8063 // Or don't animate/transition other layouts 8064 proto._getIsInstant = function() { 8065 var isLayoutInstant = this._getOption('layoutInstant'); 8066 var isInstant = isLayoutInstant !== undefined ? isLayoutInstant : 8067 !this._isLayoutInited; 8068 this._isInstant = isInstant; 8069 return isInstant; 8070 }; 8071 8072 // listen for layoutComplete, hideComplete and revealComplete 8073 // to trigger arrangeComplete 8074 proto._bindArrangeComplete = function() { 8075 // listen for 3 events to trigger arrangeComplete 8076 var isLayoutComplete, isHideComplete, isRevealComplete; 8077 var _this = this; 8078 function arrangeParallelCallback() { 8079 if ( isLayoutComplete && isHideComplete && isRevealComplete ) { 8080 _this.dispatchEvent( 'arrangeComplete', null, [ _this.filteredItems ] ); 8081 } 8082 } 8083 this.once( 'layoutComplete', function() { 8084 isLayoutComplete = true; 8085 arrangeParallelCallback(); 8086 }); 8087 this.once( 'hideComplete', function() { 8088 isHideComplete = true; 8089 arrangeParallelCallback(); 8090 }); 8091 this.once( 'revealComplete', function() { 8092 isRevealComplete = true; 8093 arrangeParallelCallback(); 8094 }); 8095 }; 8096 8097 // -------------------------- filter -------------------------- // 8098 8099 proto._filter = function( items ) { 8100 var filter = this.options.filter;
vendor: 5,649 bytes, lines 8101-8294
8101 filter = filter || '*'; 8102 var matches = []; 8103 var hiddenMatched = []; 8104 var visibleUnmatched = []; 8105 8106 var test = this._getFilterTest( filter ); 8107 8108 // test each item 8109 for ( var i=0; i < items.length; i++ ) { 8110 var item = items[i]; 8111 if ( item.isIgnored ) { 8112 continue; 8113 } 8114 // add item to either matched or unmatched group 8115 var isMatched = test( item ); 8116 // item.isFilterMatched = isMatched; 8117 // add to matches if its a match 8118 if ( isMatched ) { 8119 matches.push( item ); 8120 } 8121 // add to additional group if item needs to be hidden or revealed 8122 if ( isMatched && item.isHidden ) { 8123 hiddenMatched.push( item ); 8124 } else if ( !isMatched && !item.isHidden ) { 8125 visibleUnmatched.push( item ); 8126 } 8127 } 8128 8129 // return collections of items to be manipulated 8130 return { 8131 matches: matches, 8132 needReveal: hiddenMatched, 8133 needHide: visibleUnmatched 8134 }; 8135 }; 8136 8137 // get a jQuery, function, or a matchesSelector test given the filter 8138 proto._getFilterTest = function( filter ) { 8139 if ( jQuery && this.options.isJQueryFiltering ) { 8140 // use jQuery 8141 return function( item ) { 8142 return jQuery( item.element ).is( filter ); 8143 }; 8144 } 8145 if ( typeof filter == 'function' ) { 8146 // use filter as function 8147 return function( item ) { 8148 return filter( item.element ); 8149 }; 8150 } 8151 // default, use filter as selector string 8152 return function( item ) { 8153 return matchesSelector( item.element, filter ); 8154 }; 8155 }; 8156 8157 // -------------------------- sorting -------------------------- // 8158 8159 /** 8160 * @params {Array} elems 8161 * @public 8162 */ 8163 proto.updateSortData = function( elems ) { 8164 // get items 8165 var items; 8166 if ( elems ) { 8167 elems = utils.makeArray( elems ); 8168 items = this.getItems( elems ); 8169 } else { 8170 // update all items if no elems provided 8171 items = this.items; 8172 } 8173 8174 this._getSorters(); 8175 this._updateItemsSortData( items ); 8176 }; 8177 8178 proto._getSorters = function() { 8179 var getSortData = this.options.getSortData; 8180 for ( var key in getSortData ) { 8181 var sorter = getSortData[ key ]; 8182 this._sorters[ key ] = mungeSorter( sorter ); 8183 } 8184 }; 8185 8186 /** 8187 * @params {Array} items - of Isotope.Items 8188 * @private 8189 */ 8190 proto._updateItemsSortData = function( items ) { 8191 // do not update if no items 8192 var len = items && items.length; 8193 8194 for ( var i=0; len && i < len; i++ ) { 8195 var item = items[i]; 8196 item.updateSortData(); 8197 } 8198 }; 8199 8200 // ----- munge sorter ----- // 8201 8202 // encapsulate this, as we just need mungeSorter 8203 // other functions in here are just for munging 8204 var mungeSorter = ( function() { 8205 // add a magic layer to sorters for convienent shorthands 8206 // `.foo-bar` will use the text of .foo-bar querySelector 8207 // `[foo-bar]` will use attribute 8208 // you can also add parser 8209 // `.foo-bar parseInt` will parse that as a number 8210 function mungeSorter( sorter ) { 8211 // if not a string, return function or whatever it is 8212 if ( typeof sorter != 'string' ) { 8213 return sorter; 8214 } 8215 // parse the sorter string 8216 var args = trim( sorter ).split(' '); 8217 var query = args[0]; 8218 // check if query looks like [an-attribute] 8219 var attrMatch = query.match( /^\[(.+)\]$/ ); 8220 var attr = attrMatch && attrMatch[1]; 8221 var getValue = getValueGetter( attr, query ); 8222 // use second argument as a parser 8223 var parser = Isotope.sortDataParsers[ args[1] ]; 8224 // parse the value, if there was a parser 8225 sorter = parser ? function( elem ) { 8226 return elem && parser( getValue( elem ) ); 8227 } : 8228 // otherwise just return value 8229 function( elem ) { 8230 return elem && getValue( elem ); 8231 }; 8232 8233 return sorter; 8234 } 8235 8236 // get an attribute getter, or get text of the querySelector 8237 function getValueGetter( attr, query ) { 8238 // if query looks like [foo-bar], get attribute 8239 if ( attr ) { 8240 return function getAttribute( elem ) { 8241 return elem.getAttribute( attr ); 8242 }; 8243 } 8244 8245 // otherwise, assume its a querySelector, and get its text 8246 return function getChildText( elem ) { 8247 var child = elem.querySelector( query ); 8248 return child && child.textContent; 8249 }; 8250 } 8251 8252 return mungeSorter; 8253 })(); 8254 8255 // parsers used in getSortData shortcut strings 8256 Isotope.sortDataParsers = { 8257 'parseInt': function( val ) { 8258 return parseInt( val, 10 ); 8259 }, 8260 'parseFloat': function( val ) { 8261 return parseFloat( val ); 8262 } 8263 }; 8264 8265 // ----- sort method ----- // 8266 8267 // sort filteredItem order 8268 proto._sort = function() { 8269 var sortByOpt = this.options.sortBy; 8270 if ( !sortByOpt ) { 8271 return; 8272 } 8273 // concat all sortBy and sortHistory 8274 var sortBys = [].concat.apply( sortByOpt, this.sortHistory ); 8275 // sort magic 8276 var itemSorter = getItemSorter( sortBys, this.options.sortAscending ); 8277 this.filteredItems.sort( itemSorter ); 8278 // keep track of sortBy History 8279 if ( sortByOpt != this.sortHistory[0] ) { 8280 // add to front, oldest goes in last 8281 this.sortHistory.unshift( sortByOpt ); 8282 } 8283 }; 8284 8285 // returns a function used for sorting 8286 function getItemSorter( sortBys, sortAsc ) { 8287 return function sorter( itemA, itemB ) { 8288 // cycle through all sortKeys 8289 for ( var i = 0; i < sortBys.length; i++ ) { 8290 var sortBy = sortBys[i]; 8291 var a = itemA.sortData[ sortBy ]; 8292 var b = itemB.sortData[ sortBy ]; 8293 if ( a > b || a < b ) { 8294 // if sortAsc is an object, use the value given the sortBy key
8295 var isAscending = sortAsc[ sortBy ] !== undefined ? sortAsc[ sortBy ] : sortAsc; 8296 var direction = isAscending ? 1 : -1; 8297 return ( a > b ? 1 : -1 ) * direction; 8298 } 8299 } 8300 return 0; 8301 }; 8302 } 8303 8304 // -------------------------- methods -------------------------- // 8305 8306 // get layout mode 8307 proto._mode = function() { 8308 var layoutMode = this.options.layoutMode; 8309 var mode = this.modes[ layoutMode ]; 8310 if ( !mode ) { 8311 // TODO console.error 8312 throw new Error( 'No layout mode: ' + layoutMode ); 8313 } 8314 // HACK sync mode's options 8315 // any options set after init for layout mode need to be synced 8316 mode.options = this.options[ layoutMode ]; 8317 return mode; 8318 }; 8319 8320 proto._resetLayout = function() { 8321 // trigger original reset layout 8322 Outlayer.prototype._resetLayout.call( this ); 8323 this._mode()._resetLayout(); 8324 }; 8325 8326 proto._getItemLayoutPosition = function( item ) { 8327 return this._mode()._getItemLayoutPosition( item ); 8328 }; 8329 8330 proto._manageStamp = function( stamp ) { 8331 this._mode()._manageStamp( stamp ); 8332 }; 8333 8334 proto._getContainerSize = function() { 8335 return this._mode()._getContainerSize(); 8336 }; 8337 8338 proto.needsResizeLayout = function() { 8339 return this._mode().needsResizeLayout(); 8340 }; 8341 8342 // -------------------------- adding & removing -------------------------- // 8343 8344 // HEADS UP overwrites default Outlayer appended 8345 proto.appended = function( elems ) { 8346 var items = this.addItems( elems ); 8347 if ( !items.length ) { 8348 return; 8349 } 8350 // filter, layout, reveal new items 8351 var filteredItems = this._filterRevealAdded( items ); 8352 // add to filteredItems 8353 this.filteredItems = this.filteredItems.concat( filteredItems ); 8354 }; 8355 8356 // HEADS UP overwrites default Outlayer prepended 8357 proto.prepended = function( elems ) { 8358 var items = this._itemize( elems ); 8359 if ( !items.length ) { 8360 return; 8361 } 8362 // start new layout 8363 this._resetLayout(); 8364 this._manageStamps(); 8365 // filter, layout, reveal new items 8366 var filteredItems = this._filterRevealAdded( items ); 8367 // layout previous items 8368 this.layoutItems( this.filteredItems ); 8369 // add to items and filteredItems 8370 this.filteredItems = filteredItems.concat( this.filteredItems ); 8371 this.items = items.concat( this.items ); 8372 }; 8373 8374 proto._filterRevealAdded = function( items ) { 8375 var filtered = this._filter( items ); 8376 this.hide( filtered.needHide ); 8377 // reveal all new items 8378 this.reveal( filtered.matches ); 8379 // layout new items, no transition 8380 this.layoutItems( filtered.matches, true ); 8381 return filtered.matches; 8382 }; 8383 8384 /** 8385 * Filter, sort, and layout newly-appended item elements 8386 * @param {Array or NodeList or Element} elems 8387 */ 8388 proto.insert = function( elems ) { 8389 var items = this.addItems( elems ); 8390 if ( !items.length ) { 8391 return; 8392 } 8393 // append item elements 8394 var i, item; 8395 var len = items.length; 8396 for ( i=0; i < len; i++ ) { 8397 item = items[i]; 8398 this.element.appendChild( item.element ); 8399 } 8400 // filter new stuff 8401 var filteredInsertItems = this._filter( items ).matches; 8402 // set flag 8403 for ( i=0; i < len; i++ ) { 8404 items[i].isLayoutInstant = true; 8405 } 8406 this.arrange(); 8407 // reset flag 8408 for ( i=0; i < len; i++ ) { 8409 delete items[i].isLayoutInstant; 8410 } 8411 this.reveal( filteredInsertItems ); 8412 }; 8413 8414 var _remove = proto.remove; 8415 proto.remove = function( elems ) { 8416 elems = utils.makeArray( elems ); 8417 var removeItems = this.getItems( elems ); 8418 // do regular thing 8419 _remove.call( this, elems ); 8420 // bail if no items to remove 8421 var len = removeItems && removeItems.length; 8422 // remove elems from filteredItems 8423 for ( var i=0; len && i < len; i++ ) { 8424 var item = removeItems[i]; 8425 // remove item from collection 8426 utils.removeFrom( this.filteredItems, item ); 8427 } 8428 }; 8429 8430 proto.shuffle = function() { 8431 // update random sortData 8432 for ( var i=0; i < this.items.length; i++ ) { 8433 var item = this.items[i]; 8434 item.sortData.random = Math.random(); 8435 } 8436 this.options.sortBy = 'random'; 8437 this._sort(); 8438 this._layout(); 8439 }; 8440 8441 /** 8442 * trigger fn without transition 8443 * kind of hacky to have this in the first place 8444 * @param {Function} fn 8445 * @param {Array} args 8446 * @returns ret 8447 * @private 8448 */ 8449 proto._noTransition = function( fn, args ) { 8450 // save transitionDuration before disabling 8451 var transitionDuration = this.options.transitionDuration; 8452 // disable transition 8453 this.options.transitionDuration = 0; 8454 // do it 8455 var returnValue = fn.apply( this, args ); 8456 // re-enable transition for reveal 8457 this.options.transitionDuration = transitionDuration; 8458 return returnValue; 8459 }; 8460 8461 // ----- helper methods ----- // 8462 8463 /** 8464 * getter method for getting filtered item elements 8465 * @returns {Array} elems - collection of item elements 8466 */ 8467 proto.getFilteredItemElements = function() { 8468 return this.filteredItems.map( function( item ) { 8469 return item.element; 8470 }); 8471 }; 8472 8473 // ----- ----- // 8474 8475 return Isotope; 8476 8477})); 8478 8479/*� *� * /modules/searchSolr/assets/js/imagesloaded.pkgd.min.js� *�*//*! 8480 * imagesLoaded PACKAGED v4.1.0 8481 * JavaScript is all like "You images are done yet or what?" 8482 * MIT License 8483 */ 8484 8485!function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}(this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||[];return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=0,o=i[n];e=e||[];for(var r=this._onceEvents&&this._onceEvents[t];o;){var s=r&&r[o];s&&(this.off(t,o),delete r[o]),o.apply(this,e),n+=s?0:1,o=i[n]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}(window,function(t,e){function i(t,e){for(var i in e)t[i]=e[i];return t}function n(t){var e=[];
vendor: 4,436 bytes, lines 8485-8495
8485if(Array.isArray(t))e=t;else if("number"==typeof t.length)for(var i=0;i<t.length;i++)e.push(t[i]);else e.push(t);return e}function o(t,e,r){return this instanceof o?("string"==typeof t&&(t=document.querySelectorAll(t)),this.elements=n(t),this.options=i({},this.options),"function"==typeof e?r=e:i(this.options,e),r&&this.on("always",r),this.getImages(),h&&(this.jqDeferred=new h.Deferred),void setTimeout(function(){this.check()}.bind(this))):new o(t,e,r)}function r(t){this.img=t}function s(t,e){this.url=t,this.element=e,this.img=new Image}var h=t.jQuery,a=t.console;o.prototype=Object.create(e.prototype),o.prototype.options={},o.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},o.prototype.addElementImages=function(t){"IMG"==t.nodeName&&this.addImage(t),this.options.background===!0&&this.addElementBackgroundImages(t);var e=t.nodeType;if(e&&d[e]){for(var i=t.querySelectorAll("img"),n=0;n<i.length;n++){var o=i[n];this.addImage(o)}if("string"==typeof this.options.background){var r=t.querySelectorAll(this.options.background);for(n=0;n<r.length;n++){var s=r[n];this.addElementBackgroundImages(s)}}}};var d={1:!0,9:!0,11:!0};return o.prototype.addElementBackgroundImages=function(t){var e=getComputedStyle(t);if(e)for(var i=/url\((['"])?(.*?)\1\)/gi,n=i.exec(e.backgroundImage);null!==n;){var o=n&&n[2];o&&this.addBackground(o,t),n=i.exec(e.backgroundImage)}},o.prototype.addImage=function(t){var e=new r(t);this.images.push(e)},o.prototype.addBackground=function(t,e){var i=new s(t,e);this.images.push(i)},o.prototype.check=function(){function t(t,i,n){setTimeout(function(){e.progress(t,i,n)})}var e=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(e){e.once("progress",t),e.check()}):void this.complete()},o.prototype.progress=function(t,e,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded,this.emitEvent("progress",[this,t,e]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,t),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&a&&a.log("progress: "+i,t,e)},o.prototype.complete=function(){var t=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(t,[this]),this.emitEvent("always",[this]),this.jqDeferred){var e=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[e](this)}},r.prototype=Object.create(e.prototype),r.prototype.check=function(){var t=this.getIsImageComplete();return t?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),void(this.proxyImage.src=this.img.src))},r.prototype.getIsImageComplete=function(){return this.img.complete&&void 0!==this.img.naturalWidth},r.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.img,e])},r.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},r.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},r.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},r.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype=Object.create(r.prototype),s.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url;var t=this.getIsImageComplete();t&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},s.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.element,e])},o.makeJQueryPlugin=function(e){e=e||t.jQuery,e&&(h=e,h.fn.imagesLoaded=function(t,e){var i=new o(this,t,e);return i.jqDeferred.promise(h(this))})},o.makeJQueryPlugin(),o});/*� *� * /modules/nsMain-bundle/nsg-module-layout/assets/js/flickity.pkgd.js� *�*//*! 8486 * Flickity PACKAGED v2.0.4 8487 * Touch, responsive, flickable carousels 8488 * 8489 * Licensed GPLv3 for open source use 8490 * or Flickity Commercial License for commercial use 8491 * 8492 * http://flickity.metafizzy.co 8493 * Copyright 2016 Metafizzy 8494 */ 8495
vendor: 15,483 bytes, lines 8496-9134
8496/** 8497 * Bridget makes jQuery widgets 8498 * v2.0.1 8499 * MIT license 8500 */ 8501 8502/* jshint browser: true, strict: true, undef: true, unused: true */ 8503 8504( function( window, factory ) { 8505 // universal module definition 8506 /*jshint strict: false */ /* globals define, module, require */ 8507 if ( typeof define == 'function' && define.amd ) { 8508 // AMD 8509 define( 'jquery-bridget/jquery-bridget',[ 'jquery' ], function( jQuery ) { 8510 return factory( window, jQuery ); 8511 }); 8512 } else if ( typeof module == 'object' && module.exports ) { 8513 // CommonJS 8514 module.exports = factory( 8515 window, 8516 require('jquery') 8517 ); 8518 } else { 8519 // browser global 8520 window.jQueryBridget = factory( 8521 window, 8522 window.jQuery 8523 ); 8524 } 8525 8526}( window, function factory( window, jQuery ) { 8527'use strict'; 8528 8529// ----- utils ----- // 8530 8531var arraySlice = Array.prototype.slice; 8532 8533// helper function for logging errors 8534// $.error breaks jQuery chaining 8535var console = window.console; 8536var logError = typeof console == 'undefined' ? function() {} : 8537 function( message ) { 8538 console.error( message ); 8539 }; 8540 8541// ----- jQueryBridget ----- // 8542 8543function jQueryBridget( namespace, PluginClass, $ ) { 8544 $ = $ || jQuery || window.jQuery; 8545 if ( !$ ) { 8546 return; 8547 } 8548 8549 // add option method -> $().plugin('option', {...}) 8550 if ( !PluginClass.prototype.option ) { 8551 // option setter 8552 PluginClass.prototype.option = function( opts ) { 8553 // bail out if not an object 8554 if ( !$.isPlainObject( opts ) ){ 8555 return; 8556 } 8557 this.options = $.extend( true, this.options, opts ); 8558 }; 8559 } 8560 8561 // make jQuery plugin 8562 $.fn[ namespace ] = function( arg0 /*, arg1 */ ) { 8563 if ( typeof arg0 == 'string' ) { 8564 // method call $().plugin( 'methodName', { options } ) 8565 // shift arguments by 1 8566 var args = arraySlice.call( arguments, 1 ); 8567 return methodCall( this, arg0, args ); 8568 } 8569 // just $().plugin({ options }) 8570 plainCall( this, arg0 ); 8571 return this; 8572 }; 8573 8574 // $().plugin('methodName') 8575 function methodCall( $elems, methodName, args ) { 8576 var returnValue; 8577 var pluginMethodStr = '$().' + namespace + '("' + methodName + '")'; 8578 8579 $elems.each( function( i, elem ) { 8580 // get instance 8581 var instance = $.data( elem, namespace ); 8582 if ( !instance ) { 8583 logError( namespace + ' not initialized. Cannot call methods, i.e. ' + 8584 pluginMethodStr ); 8585 return; 8586 } 8587 8588 var method = instance[ methodName ]; 8589 if ( !method || methodName.charAt(0) == '_' ) { 8590 logError( pluginMethodStr + ' is not a valid method' ); 8591 return; 8592 } 8593 8594 // apply method, get return value 8595 var value = method.apply( instance, args ); 8596 // set return value if value is returned, use only first value 8597 returnValue = returnValue === undefined ? value : returnValue; 8598 }); 8599 8600 return returnValue !== undefined ? returnValue : $elems; 8601 } 8602 8603 function plainCall( $elems, options ) { 8604 $elems.each( function( i, elem ) { 8605 var instance = $.data( elem, namespace ); 8606 if ( instance ) { 8607 // set options & init 8608 instance.option( options ); 8609 instance._init(); 8610 } else { 8611 // initialize new instance 8612 instance = new PluginClass( elem, options ); 8613 $.data( elem, namespace, instance ); 8614 } 8615 }); 8616 } 8617 8618 updateJQuery( $ ); 8619 8620} 8621 8622// ----- updateJQuery ----- // 8623 8624// set $.bridget for v1 backwards compatibility 8625function updateJQuery( $ ) { 8626 if ( !$ || ( $ && $.bridget ) ) { 8627 return; 8628 } 8629 $.bridget = jQueryBridget; 8630} 8631 8632updateJQuery( jQuery || window.jQuery ); 8633 8634// ----- ----- // 8635 8636return jQueryBridget; 8637 8638})); 8639 8640/** 8641 * EvEmitter v1.0.3 8642 * Lil' event emitter 8643 * MIT License 8644 */ 8645 8646/* jshint unused: true, undef: true, strict: true */ 8647 8648( function( global, factory ) { 8649 // universal module definition 8650 /* jshint strict: false */ /* globals define, module, window */ 8651 if ( typeof define == 'function' && define.amd ) { 8652 // AMD - RequireJS 8653 define( 'ev-emitter/ev-emitter',factory ); 8654 } else if ( typeof module == 'object' && module.exports ) { 8655 // CommonJS - Browserify, Webpack 8656 module.exports = factory(); 8657 } else { 8658 // Browser globals 8659 global.EvEmitter = factory(); 8660 } 8661 8662}( typeof window != 'undefined' ? window : this, function() { 8663 8664 8665 8666function EvEmitter() {} 8667 8668var proto = EvEmitter.prototype; 8669 8670proto.on = function( eventName, listener ) { 8671 if ( !eventName || !listener ) { 8672 return; 8673 } 8674 // set events hash 8675 var events = this._events = this._events || {}; 8676 // set listeners array 8677 var listeners = events[ eventName ] = events[ eventName ] || []; 8678 // only add once 8679 if ( listeners.indexOf( listener ) == -1 ) { 8680 listeners.push( listener ); 8681 } 8682 8683 return this; 8684}; 8685 8686proto.once = function( eventName, listener ) { 8687 if ( !eventName || !listener ) { 8688 return; 8689 } 8690 // add event 8691 this.on( eventName, listener ); 8692 // set once flag 8693 // set onceEvents hash 8694 var onceEvents = this._onceEvents = this._onceEvents || {}; 8695 // set onceListeners object 8696 var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; 8697 // set flag 8698 onceListeners[ listener ] = true; 8699 8700 return this; 8701}; 8702 8703proto.off = function( eventName, listener ) { 8704 var listeners = this._events && this._events[ eventName ]; 8705 if ( !listeners || !listeners.length ) { 8706 return; 8707 } 8708 var index = listeners.indexOf( listener ); 8709 if ( index != -1 ) { 8710 listeners.splice( index, 1 ); 8711 } 8712 8713 return this; 8714}; 8715 8716proto.emitEvent = function( eventName, args ) { 8717 var listeners = this._events && this._events[ eventName ]; 8718 if ( !listeners || !listeners.length ) { 8719 return; 8720 } 8721 var i = 0; 8722 var listener = listeners[i]; 8723 args = args || []; 8724 // once stuff 8725 var onceListeners = this._onceEvents && this._onceEvents[ eventName ]; 8726 8727 while ( listener ) { 8728 var isOnce = onceListeners && onceListeners[ listener ]; 8729 if ( isOnce ) { 8730 // remove listener 8731 // remove before trigger to prevent recursion 8732 this.off( eventName, listener ); 8733 // unset once flag 8734 delete onceListeners[ listener ]; 8735 } 8736 // trigger listener 8737 listener.apply( this, args ); 8738 // get next listener 8739 i += isOnce ? 0 : 1; 8740 listener = listeners[i]; 8741 } 8742 8743 return this; 8744}; 8745 8746return EvEmitter; 8747 8748})); 8749 8750/*! 8751 * getSize v2.0.2 8752 * measure size of elements 8753 * MIT license 8754 */ 8755 8756/*jshint browser: true, strict: true, undef: true, unused: true */ 8757/*global define: false, module: false, console: false */ 8758 8759( function( window, factory ) { 8760 'use strict'; 8761 8762 if ( typeof define == 'function' && define.amd ) { 8763 // AMD 8764 define( 'get-size/get-size',[],function() { 8765 return factory(); 8766 }); 8767 } else if ( typeof module == 'object' && module.exports ) { 8768 // CommonJS 8769 module.exports = factory(); 8770 } else { 8771 // browser global 8772 window.getSize = factory(); 8773 } 8774 8775})( window, function factory() { 8776'use strict'; 8777 8778// -------------------------- helpers -------------------------- // 8779 8780// get a number from a string, not a percentage 8781function getStyleSize( value ) { 8782 var num = parseFloat( value ); 8783 // not a percent like '100%', and a number 8784 var isValid = value.indexOf('%') == -1 && !isNaN( num ); 8785 return isValid && num; 8786} 8787 8788function noop() {} 8789 8790var logError = typeof console == 'undefined' ? noop : 8791 function( message ) { 8792 console.error( message ); 8793 }; 8794 8795// -------------------------- measurements -------------------------- // 8796 8797var measurements = [ 8798 'paddingLeft', 8799 'paddingRight', 8800 'paddingTop', 8801 'paddingBottom', 8802 'marginLeft', 8803 'marginRight', 8804 'marginTop', 8805 'marginBottom', 8806 'borderLeftWidth', 8807 'borderRightWidth', 8808 'borderTopWidth', 8809 'borderBottomWidth' 8810]; 8811 8812var measurementsLength = measurements.length; 8813 8814function getZeroSize() { 8815 var size = { 8816 width: 0, 8817 height: 0, 8818 innerWidth: 0, 8819 innerHeight: 0, 8820 outerWidth: 0, 8821 outerHeight: 0 8822 }; 8823 for ( var i=0; i < measurementsLength; i++ ) { 8824 var measurement = measurements[i]; 8825 size[ measurement ] = 0; 8826 } 8827 return size; 8828} 8829 8830// -------------------------- getStyle -------------------------- // 8831 8832/** 8833 * getStyle, get style of element, check for Firefox bug 8834 * https://bugzilla.mozilla.org/show_bug.cgi?id=548397 8835 */ 8836function getStyle( elem ) { 8837 var style = getComputedStyle( elem ); 8838 if ( !style ) { 8839 logError( 'Style returned ' + style + 8840 '. Are you running this code in a hidden iframe on Firefox? ' + 8841 'See http://bit.ly/getsizebug1' ); 8842 } 8843 return style; 8844} 8845 8846// -------------------------- setup -------------------------- // 8847 8848var isSetup = false; 8849 8850var isBoxSizeOuter; 8851 8852/** 8853 * setup 8854 * check isBoxSizerOuter 8855 * do on first getSize() rather than on page load for Firefox bug 8856 */ 8857function setup() { 8858 // setup once 8859 if ( isSetup ) { 8860 return; 8861 } 8862 isSetup = true; 8863 8864 // -------------------------- box sizing -------------------------- // 8865 8866 /** 8867 * WebKit measures the outer-width on style.width on border-box elems 8868 * IE & Firefox<29 measures the inner-width 8869 */ 8870 var div = document.createElement('div'); 8871 div.style.width = '200px'; 8872 div.style.padding = '1px 2px 3px 4px'; 8873 div.style.borderStyle = 'solid'; 8874 div.style.borderWidth = '1px 2px 3px 4px'; 8875 div.style.boxSizing = 'border-box'; 8876 8877 var body = document.body || document.documentElement; 8878 body.appendChild( div ); 8879 var style = getStyle( div ); 8880 8881 getSize.isBoxSizeOuter = isBoxSizeOuter = getStyleSize( style.width ) == 200; 8882 body.removeChild( div ); 8883 8884} 8885 8886// -------------------------- getSize -------------------------- // 8887 8888function getSize( elem ) { 8889 setup(); 8890 8891 // use querySeletor if elem is string 8892 if ( typeof elem == 'string' ) { 8893 elem = document.querySelector( elem ); 8894 } 8895 8896 // do not proceed on non-objects 8897 if ( !elem || typeof elem != 'object' || !elem.nodeType ) { 8898 return; 8899 } 8900 8901 var style = getStyle( elem ); 8902 8903 // if hidden, everything is 0 8904 if ( style.display == 'none' ) { 8905 return getZeroSize(); 8906 } 8907 8908 var size = {}; 8909 size.width = elem.offsetWidth; 8910 size.height = elem.offsetHeight; 8911 8912 var isBorderBox = size.isBorderBox = style.boxSizing == 'border-box'; 8913 8914 // get all measurements 8915 for ( var i=0; i < measurementsLength; i++ ) { 8916 var measurement = measurements[i]; 8917 var value = style[ measurement ]; 8918 var num = parseFloat( value ); 8919 // any 'auto', 'medium' value will be 0 8920 size[ measurement ] = !isNaN( num ) ? num : 0; 8921 } 8922 8923 var paddingWidth = size.paddingLeft + size.paddingRight; 8924 var paddingHeight = size.paddingTop + size.paddingBottom; 8925 var marginWidth = size.marginLeft + size.marginRight; 8926 var marginHeight = size.marginTop + size.marginBottom; 8927 var borderWidth = size.borderLeftWidth + size.borderRightWidth; 8928 var borderHeight = size.borderTopWidth + size.borderBottomWidth; 8929 8930 var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter; 8931 8932 // overwrite width and height if we can get it from style 8933 var styleWidth = getStyleSize( style.width ); 8934 if ( styleWidth !== false ) { 8935 size.width = styleWidth + 8936 // add padding and border unless it's already including it 8937 ( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth ); 8938 } 8939 8940 var styleHeight = getStyleSize( style.height ); 8941 if ( styleHeight !== false ) { 8942 size.height = styleHeight + 8943 // add padding and border unless it's already including it 8944 ( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight ); 8945 } 8946 8947 size.innerWidth = size.width - ( paddingWidth + borderWidth ); 8948 size.innerHeight = size.height - ( paddingHeight + borderHeight ); 8949 8950 size.outerWidth = size.width + marginWidth; 8951 size.outerHeight = size.height + marginHeight; 8952 8953 return size; 8954} 8955 8956return getSize; 8957 8958}); 8959 8960/** 8961 * matchesSelector v2.0.1 8962 * matchesSelector( element, '.selector' ) 8963 * MIT license 8964 */ 8965 8966/*jshint browser: true, strict: true, undef: true, unused: true */ 8967 8968( function( window, factory ) { 8969 /*global define: false, module: false */ 8970 'use strict'; 8971 // universal module definition 8972 if ( typeof define == 'function' && define.amd ) { 8973 // AMD 8974 define( 'desandro-matches-selector/matches-selector',factory ); 8975 } else if ( typeof module == 'object' && module.exports ) { 8976 // CommonJS 8977 module.exports = factory(); 8978 } else { 8979 // browser global 8980 window.matchesSelector = factory(); 8981 } 8982 8983}( window, function factory() { 8984 'use strict'; 8985 8986 var matchesMethod = ( function() { 8987 var ElemProto = Element.prototype; 8988 // check for the standard method name first 8989 if ( ElemProto.matches ) { 8990 return 'matches'; 8991 } 8992 // check un-prefixed 8993 if ( ElemProto.matchesSelector ) { 8994 return 'matchesSelector'; 8995 } 8996 // check vendor prefixes 8997 var prefixes = [ 'webkit', 'moz', 'ms', 'o' ]; 8998 8999 for ( var i=0; i < prefixes.length; i++ ) { 9000 var prefix = prefixes[i]; 9001 var method = prefix + 'MatchesSelector'; 9002 if ( ElemProto[ method ] ) { 9003 return method; 9004 } 9005 } 9006 })(); 9007 9008 return function matchesSelector( elem, selector ) { 9009 return elem[ matchesMethod ]( selector ); 9010 }; 9011 9012})); 9013 9014/** 9015 * Fizzy UI utils v2.0.3 9016 * MIT license 9017 */ 9018 9019/*jshint browser: true, undef: true, unused: true, strict: true */ 9020 9021( function( window, factory ) { 9022 // universal module definition 9023 /*jshint strict: false */ /*globals define, module, require */ 9024 9025 if ( typeof define == 'function' && define.amd ) { 9026 // AMD 9027 define( 'fizzy-ui-utils/utils',[ 9028 'desandro-matches-selector/matches-selector' 9029 ], function( matchesSelector ) { 9030 return factory( window, matchesSelector ); 9031 }); 9032 } else if ( typeof module == 'object' && module.exports ) { 9033 // CommonJS 9034 module.exports = factory( 9035 window, 9036 require('desandro-matches-selector') 9037 ); 9038 } else { 9039 // browser global 9040 window.fizzyUIUtils = factory( 9041 window, 9042 window.matchesSelector 9043 ); 9044 } 9045 9046}( window, function factory( window, matchesSelector ) { 9047 9048 9049 9050var utils = {}; 9051 9052// ----- extend ----- // 9053 9054// extends objects 9055utils.extend = function( a, b ) { 9056 for ( var prop in b ) { 9057 a[ prop ] = b[ prop ]; 9058 } 9059 return a; 9060}; 9061 9062// ----- modulo ----- // 9063 9064utils.modulo = function( num, div ) { 9065 return ( ( num % div ) + div ) % div; 9066}; 9067 9068// ----- makeArray ----- // 9069 9070// turn element or nodeList into an array 9071utils.makeArray = function( obj ) { 9072 var ary = []; 9073 if ( Array.isArray( obj ) ) { 9074 // use object if already an array 9075 ary = obj; 9076 } else if ( obj && typeof obj.length == 'number' ) { 9077 // convert nodeList to array 9078 for ( var i=0; i < obj.length; i++ ) { 9079 ary.push( obj[i] ); 9080 } 9081 } else { 9082 // array of single index 9083 ary.push( obj ); 9084 } 9085 return ary; 9086}; 9087 9088// ----- removeFrom ----- // 9089 9090utils.removeFrom = function( ary, obj ) { 9091 var index = ary.indexOf( obj ); 9092 if ( index != -1 ) { 9093 ary.splice( index, 1 ); 9094 } 9095}; 9096 9097// ----- getParent ----- // 9098 9099utils.getParent = function( elem, selector ) { 9100 while ( elem != document.body ) { 9101 elem = elem.parentNode; 9102 if ( matchesSelector( elem, selector ) ) { 9103 return elem; 9104 } 9105 } 9106}; 9107 9108// ----- getQueryElement ----- // 9109 9110// use element as selector string 9111utils.getQueryElement = function( elem ) { 9112 if ( typeof elem == 'string' ) { 9113 return document.querySelector( elem ); 9114 } 9115 return elem; 9116}; 9117 9118// ----- handleEvent ----- // 9119 9120// enable .ontype to trigger from .addEventListener( elem, 'type' ) 9121utils.handleEvent = function( event ) { 9122 var method = 'on' + event.type; 9123 if ( this[ method ] ) { 9124 this[ method ]( event ); 9125 } 9126}; 9127 9128// ----- filterFindElements ----- // 9129 9130utils.filterFindElements = function( elems, selector ) { 9131 // make array of elems 9132 elems = utils.makeArray( elems ); 9133 var ffElems = []; 9134
9135 elems.forEach( function( elem ) { 9136 // check that elem is an actual element 9137 if ( !( elem instanceof HTMLElement ) ) { 9138 return; 9139 } 9140 // add elem if no selector 9141 if ( !selector ) { 9142 ffElems.push( elem ); 9143 return; 9144 } 9145 // filter & find items if we have a selector 9146 // filter 9147 if ( matchesSelector( elem, selector ) ) { 9148 ffElems.push( elem ); 9149 } 9150 // find children 9151 var childElems = elem.querySelectorAll( selector ); 9152 // concat childElems to filterFound array 9153 for ( var i=0; i < childElems.length; i++ ) { 9154 ffElems.push( childElems[i] ); 9155 } 9156 }); 9157 9158 return ffElems; 9159}; 9160 9161// ----- debounceMethod ----- // 9162 9163utils.debounceMethod = function( _class, methodName, threshold ) { 9164 // original method 9165 var method = _class.prototype[ methodName ]; 9166 var timeoutName = methodName + 'Timeout'; 9167 9168 _class.prototype[ methodName ] = function() { 9169 var timeout = this[ timeoutName ]; 9170 if ( timeout ) { 9171 clearTimeout( timeout ); 9172 } 9173 var args = arguments; 9174 9175 var _this = this; 9176 this[ timeoutName ] = setTimeout( function() { 9177 method.apply( _this, args ); 9178 delete _this[ timeoutName ]; 9179 }, threshold || 100 ); 9180 }; 9181}; 9182 9183// ----- docReady ----- // 9184 9185utils.docReady = function( callback ) { 9186 var readyState = document.readyState; 9187 if ( readyState == 'complete' || readyState == 'interactive' ) { 9188 // do async to allow for other scripts to run. metafizzy/flickity#441 9189 setTimeout( callback ); 9190 } else { 9191 document.addEventListener( 'DOMContentLoaded', callback ); 9192 } 9193}; 9194 9195// ----- htmlInit ----- // 9196 9197// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/ 9198utils.toDashed = function( str ) { 9199 return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) { 9200 return $1 + '-' + $2; 9201 }).toLowerCase(); 9202}; 9203 9204var console = window.console; 9205/** 9206 * allow user to initialize classes via [data-namespace] or .js-namespace class 9207 * htmlInit( Widget, 'widgetName' ) 9208 * options are parsed from data-namespace-options 9209 */ 9210utils.htmlInit = function( WidgetClass, namespace ) { 9211 utils.docReady( function() { 9212 var dashedNamespace = utils.toDashed( namespace ); 9213 var dataAttr = 'data-' + dashedNamespace; 9214 var dataAttrElems = document.querySelectorAll( '[' + dataAttr + ']' ); 9215 var jsDashElems = document.querySelectorAll( '.js-' + dashedNamespace ); 9216 var elems = utils.makeArray( dataAttrElems ) 9217 .concat( utils.makeArray( jsDashElems ) ); 9218 var dataOptionsAttr = dataAttr + '-options'; 9219 var jQuery = window.jQuery; 9220 9221 elems.forEach( function( elem ) { 9222 var attr = elem.getAttribute( dataAttr ) || 9223 elem.getAttribute( dataOptionsAttr ); 9224 var options; 9225 try { 9226 options = attr && JSON.parse( attr ); 9227 } catch ( error ) { 9228 // log error, do not initialize 9229 if ( console ) { 9230 console.error( 'Error parsing ' + dataAttr + ' on ' + elem.className + 9231 ': ' + error ); 9232 } 9233 return; 9234 } 9235 // initialize 9236 var instance = new WidgetClass( elem, options ); 9237 // make available via $().data('namespace') 9238 if ( jQuery ) { 9239 jQuery.data( elem, namespace, instance ); 9240 } 9241 }); 9242 9243 }); 9244}; 9245 9246// ----- ----- // 9247 9248return utils; 9249 9250})); 9251 9252// Flickity.Cell 9253( function( window, factory ) { 9254 // universal module definition 9255 /* jshint strict: false */ 9256 if ( typeof define == 'function' && define.amd ) { 9257 // AMD 9258 define( 'flickity/js/cell',[ 9259 'get-size/get-size' 9260 ], function( getSize ) { 9261 return factory( window, getSize ); 9262 }); 9263 } else if ( typeof module == 'object' && module.exports ) { 9264 // CommonJS 9265 module.exports = factory( 9266 window, 9267 require('get-size') 9268 ); 9269 } else { 9270 // browser global 9271 window.Flickity = window.Flickity || {}; 9272 window.Flickity.Cell = factory( 9273 window, 9274 window.getSize 9275 ); 9276 } 9277 9278}( window, function factory( window, getSize ) { 9279 9280 9281 9282function Cell( elem, parent ) { 9283 this.element = elem; 9284 this.parent = parent; 9285 9286 this.create(); 9287} 9288 9289var proto = Cell.prototype; 9290 9291proto.create = function() { 9292 this.element.style.position = 'absolute'; 9293 this.x = 0; 9294 this.shift = 0; 9295}; 9296 9297proto.destroy = function() { 9298 // reset style 9299 this.element.style.position = ''; 9300 var side = this.parent.originSide; 9301 this.element.style[ side ] = ''; 9302}; 9303 9304proto.getSize = function() { 9305 this.size = getSize( this.element ); 9306}; 9307 9308proto.setPosition = function( x ) { 9309 this.x = x; 9310 this.updateTarget(); 9311 this.renderPosition( x ); 9312}; 9313 9314// setDefaultTarget v1 method, backwards compatibility, remove in v3 9315proto.updateTarget = proto.setDefaultTarget = function() { 9316 var marginProperty = this.parent.originSide == 'left' ? 'marginLeft' : 'marginRight'; 9317 this.target = this.x + this.size[ marginProperty ] + 9318 this.size.width * this.parent.cellAlign; 9319}; 9320 9321proto.renderPosition = function( x ) { 9322 // render position of cell with in slider 9323 var side = this.parent.originSide; 9324 this.element.style[ side ] = this.parent.getPositionValue( x ); 9325}; 9326 9327/** 9328 * @param {Integer} factor - 0, 1, or -1 9329**/ 9330proto.wrapShift = function( shift ) { 9331 this.shift = shift; 9332 this.renderPosition( this.x + this.parent.slideableWidth * shift ); 9333}; 9334 9335proto.remove = function() { 9336 this.element.parentNode.removeChild( this.element ); 9337}; 9338 9339return Cell; 9340 9341})); 9342 9343// slide 9344( function( window, factory ) { 9345 // universal module definition 9346 /* jshint strict: false */ 9347 if ( typeof define == 'function' && define.amd ) { 9348 // AMD 9349 define( 'flickity/js/slide',factory ); 9350 } else if ( typeof module == 'object' && module.exports ) { 9351 // CommonJS 9352 module.exports = factory(); 9353 } else { 9354 // browser global 9355 window.Flickity = window.Flickity || {}; 9356 window.Flickity.Slide = factory(); 9357 } 9358 9359}( window, function factory() { 9360'use strict'; 9361 9362function Slide( parent ) { 9363 this.parent = parent; 9364 this.isOriginLeft = parent.originSide == 'left'; 9365 this.cells = []; 9366 this.outerWidth = 0; 9367 this.height = 0; 9368} 9369 9370var proto = Slide.prototype; 9371 9372proto.addCell = function( cell ) { 9373 this.cells.push( cell ); 9374 this.outerWidth += cell.size.outerWidth; 9375 this.height = Math.max( cell.size.outerHeight, this.height ); 9376 // first cell stuff 9377 if ( this.cells.length == 1 ) { 9378 this.x = cell.x; // x comes from first cell 9379 var beginMargin = this.isOriginLeft ? 'marginLeft' : 'marginRight'; 9380 this.firstMargin = cell.size[ beginMargin ]; 9381 } 9382}; 9383 9384proto.updateTarget = function() { 9385 var endMargin = this.isOriginLeft ? 'marginRight' : 'marginLeft'; 9386 var lastCell = this.getLastCell(); 9387 var lastMargin = lastCell ? lastCell.size[ endMargin ] : 0; 9388 var slideWidth = this.outerWidth - ( this.firstMargin + lastMargin ); 9389 this.target = this.x + this.firstMargin + slideWidth * this.parent.cellAlign; 9390}; 9391 9392proto.getLastCell = function() { 9393 return this.cells[ this.cells.length - 1 ]; 9394}; 9395 9396proto.select = function() { 9397 this.changeSelectedClass('add'); 9398}; 9399 9400proto.unselect = function() { 9401 this.changeSelectedClass('remove'); 9402}; 9403 9404proto.changeSelectedClass = function( method ) {
9405 this.cells.forEach( function( cell ) { 9406 cell.element.classList[ method ]('is-selected'); 9407 }); 9408}; 9409 9410proto.getCellElements = function() { 9411 return this.cells.map( function( cell ) { 9412 return cell.element; 9413 }); 9414}; 9415 9416return Slide; 9417 9418})); 9419 9420// animate 9421( function( window, factory ) { 9422 // universal module definition 9423 /* jshint strict: false */ 9424 if ( typeof define == 'function' && define.amd ) { 9425 // AMD 9426 define( 'flickity/js/animate',[ 9427 'fizzy-ui-utils/utils' 9428 ], function( utils ) { 9429 return factory( window, utils ); 9430 }); 9431 } else if ( typeof module == 'object' && module.exports ) { 9432 // CommonJS 9433 module.exports = factory( 9434 window, 9435 require('fizzy-ui-utils') 9436 ); 9437 } else { 9438 // browser global 9439 window.Flickity = window.Flickity || {}; 9440 window.Flickity.animatePrototype = factory( 9441 window, 9442 window.fizzyUIUtils 9443 ); 9444 } 9445 9446}( window, function factory( window, utils ) { 9447 9448 9449 9450// -------------------------- requestAnimationFrame -------------------------- // 9451 9452// get rAF, prefixed, if present 9453var requestAnimationFrame = window.requestAnimationFrame || 9454 window.webkitRequestAnimationFrame; 9455 9456// fallback to setTimeout 9457var lastTime = 0; 9458if ( !requestAnimationFrame ) { 9459 requestAnimationFrame = function( callback ) { 9460 var currTime = new Date().getTime(); 9461 var timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) ); 9462 var id = setTimeout( callback, timeToCall ); 9463 lastTime = currTime + timeToCall; 9464 return id; 9465 }; 9466} 9467 9468// -------------------------- animate -------------------------- // 9469 9470var proto = {}; 9471 9472proto.startAnimation = function() { 9473 if ( this.isAnimating ) { 9474 return; 9475 } 9476 9477 this.isAnimating = true; 9478 this.restingFrames = 0; 9479 this.animate(); 9480}; 9481 9482proto.animate = function() { 9483 this.applyDragForce(); 9484 this.applySelectedAttraction(); 9485 9486 var previousX = this.x; 9487 9488 this.integratePhysics(); 9489 this.positionSlider(); 9490 this.settle( previousX ); 9491 // animate next frame 9492 if ( this.isAnimating ) { 9493 var _this = this; 9494 requestAnimationFrame( function animateFrame() { 9495 _this.animate(); 9496 }); 9497 } 9498}; 9499 9500 9501var transformProperty = ( function () { 9502 var style = document.documentElement.style; 9503 if ( typeof style.transform == 'string' ) { 9504 return 'transform'; 9505 } 9506 return 'WebkitTransform'; 9507})(); 9508 9509proto.positionSlider = function() { 9510 var x = this.x; 9511 // wrap position around 9512 if ( this.options.wrapAround && this.cells.length > 1 ) { 9513 x = utils.modulo( x, this.slideableWidth ); 9514 x = x - this.slideableWidth; 9515 this.shiftWrapCells( x ); 9516 } 9517 9518 x = x + this.cursorPosition; 9519 // reverse if right-to-left and using transform 9520 x = this.options.rightToLeft && transformProperty ? -x : x; 9521 var value = this.getPositionValue( x ); 9522 // use 3D tranforms for hardware acceleration on iOS 9523 // but use 2D when settled, for better font-rendering 9524 this.slider.style[ transformProperty ] = this.isAnimating ? 9525 'translate3d(' + value + ',0,0)' : 'translateX(' + value + ')'; 9526 9527 // scroll event 9528 var firstSlide = this.slides[0]; 9529 if ( firstSlide ) { 9530 var positionX = -this.x - firstSlide.target; 9531 var progress = positionX / this.slidesWidth; 9532 this.dispatchEvent( 'scroll', null, [ progress, positionX ] ); 9533 } 9534}; 9535 9536proto.positionSliderAtSelected = function() { 9537 if ( !this.cells.length ) { 9538 return; 9539 } 9540 this.x = -this.selectedSlide.target; 9541 this.positionSlider(); 9542}; 9543 9544proto.getPositionValue = function( position ) { 9545 if ( this.options.percentPosition ) { 9546 // percent position, round to 2 digits, like 12.34% 9547 return ( Math.round( ( position / this.size.innerWidth ) * 10000 ) * 0.01 )+ '%'; 9548 } else { 9549 // pixel positioning 9550 return Math.round( position ) + 'px'; 9551 } 9552}; 9553 9554proto.settle = function( previousX ) { 9555 // keep track of frames where x hasn't moved 9556 if ( !this.isPointerDown && Math.round( this.x * 100 ) == Math.round( previousX * 100 ) ) { 9557 this.restingFrames++; 9558 } 9559 // stop animating if resting for 3 or more frames 9560 if ( this.restingFrames > 2 ) { 9561 this.isAnimating = false; 9562 delete this.isFreeScrolling; 9563 // render position with translateX when settled 9564 this.positionSlider(); 9565 this.dispatchEvent('settle'); 9566 } 9567}; 9568 9569proto.shiftWrapCells = function( x ) { 9570 // shift before cells 9571 var beforeGap = this.cursorPosition + x; 9572 this._shiftCells( this.beforeShiftCells, beforeGap, -1 ); 9573 // shift after cells 9574 var afterGap = this.size.innerWidth - ( x + this.slideableWidth + this.cursorPosition ); 9575 this._shiftCells( this.afterShiftCells, afterGap, 1 ); 9576}; 9577 9578proto._shiftCells = function( cells, gap, shift ) { 9579 for ( var i=0; i < cells.length; i++ ) { 9580 var cell = cells[i]; 9581 var cellShift = gap > 0 ? shift : 0; 9582 cell.wrapShift( cellShift ); 9583 gap -= cell.size.outerWidth; 9584 } 9585}; 9586 9587proto._unshiftCells = function( cells ) { 9588 if ( !cells || !cells.length ) { 9589 return; 9590 } 9591 for ( var i=0; i < cells.length; i++ ) { 9592 cells[i].wrapShift( 0 ); 9593 } 9594}; 9595 9596// -------------------------- physics -------------------------- // 9597 9598proto.integratePhysics = function() { 9599 this.x += this.velocity; 9600 this.velocity *= this.getFrictionFactor(); 9601}; 9602 9603proto.applyForce = function( force ) { 9604 this.velocity += force; 9605}; 9606 9607proto.getFrictionFactor = function() { 9608 return 1 - this.options[ this.isFreeScrolling ? 'freeScrollFriction' : 'friction' ]; 9609}; 9610 9611proto.getRestingPosition = function() { 9612 // my thanks to Steven Wittens, who simplified this math greatly 9613 return this.x + this.velocity / ( 1 - this.getFrictionFactor() ); 9614}; 9615 9616proto.applyDragForce = function() { 9617 if ( !this.isPointerDown ) { 9618 return; 9619 } 9620 // change the position to drag position by applying force 9621 var dragVelocity = this.dragX - this.x; 9622 var dragForce = dragVelocity - this.velocity; 9623 this.applyForce( dragForce ); 9624}; 9625 9626proto.applySelectedAttraction = function() { 9627 // do not attract if pointer down or no cells 9628 if ( this.isPointerDown || this.isFreeScrolling || !this.cells.length ) { 9629 return; 9630 } 9631 var distance = this.selectedSlide.target * -1 - this.x; 9632 var force = distance * this.options.selectedAttraction; 9633 this.applyForce( force ); 9634}; 9635 9636return proto; 9637 9638})); 9639 9640// Flickity main 9641( function( window, factory ) { 9642 // universal module definition 9643 /* jshint strict: false */ 9644 if ( typeof define == 'function' && define.amd ) { 9645 // AMD 9646 define( 'flickity/js/flickity',[ 9647 'ev-emitter/ev-emitter', 9648 'get-size/get-size', 9649 'fizzy-ui-utils/utils', 9650 './cell', 9651 './slide', 9652 './animate' 9653 ], function( EvEmitter, getSize, utils, Cell, Slide, animatePrototype ) { 9654 return factory( window, EvEmitter, getSize, utils, Cell, Slide, animatePrototype ); 9655 }); 9656 } else if ( typeof module == 'object' && module.exports ) { 9657 // CommonJS 9658 module.exports = factory( 9659 window, 9660 require('ev-emitter'), 9661 require('get-size'), 9662 require('fizzy-ui-utils'), 9663 require('./cell'), 9664 require('./slide'), 9665 require('./animate') 9666 ); 9667 } else { 9668 // browser global 9669 var _Flickity = window.Flickity; 9670 9671 window.Flickity = factory( 9672 window, 9673 window.EvEmitter, 9674 window.getSize, 9675 window.fizzyUIUtils, 9676 _Flickity.Cell, 9677 _Flickity.Slide, 9678 _Flickity.animatePrototype 9679 ); 9680 } 9681 9682}( window, function factory( window, EvEmitter, getSize, 9683 utils, Cell, Slide, animatePrototype ) { 9684 9685 9686 9687// vars 9688var jQuery = window.jQuery; 9689var getComputedStyle = window.getComputedStyle; 9690var console = window.console; 9691 9692function moveElements( elems, toElem ) { 9693 elems = utils.makeArray( elems ); 9694 while ( elems.length ) { 9695 toElem.appendChild( elems.shift() ); 9696 } 9697} 9698 9699// -------------------------- Flickity -------------------------- // 9700 9701// globally unique identifiers 9702var GUID = 0; 9703// internal store of all Flickity intances 9704var instances = {}; 9705 9706function Flickity( element, options ) { 9707 var queryElement = utils.getQueryElement( element ); 9708 if ( !queryElement ) { 9709 if ( console ) { 9710 console.error( 'Bad element for Flickity: ' + ( queryElement || element ) ); 9711 } 9712 return; 9713 } 9714 this.element = queryElement; 9715 // do not initialize twice on same element 9716 if ( this.element.flickityGUID ) { 9717 var instance = instances[ this.element.flickityGUID ]; 9718 instance.option( options ); 9719 return instance; 9720 } 9721 9722 // add jQuery 9723 if ( jQuery ) { 9724 this.$element = jQuery( this.element ); 9725 } 9726 // options 9727 this.options = utils.extend( {}, this.constructor.defaults ); 9728 this.option( options ); 9729 9730 // kick things off 9731 this._create(); 9732} 9733 9734Flickity.defaults = { 9735 accessibility: true, 9736 // adaptiveHeight: false, 9737 cellAlign: 'center', 9738 // cellSelector: undefined,
9739 // contain: false, 9740 freeScrollFriction: 0.075, // friction when free-scrolling 9741 friction: 0.28, // friction when selecting 9742 namespaceJQueryEvents: true, 9743 // initialIndex: 0, 9744 percentPosition: true, 9745 resize: true, 9746 selectedAttraction: 0.025, 9747 setGallerySize: true 9748 // watchCSS: false, 9749 // wrapAround: false 9750}; 9751 9752// hash of methods triggered on _create() 9753Flickity.createMethods = []; 9754 9755var proto = Flickity.prototype; 9756// inherit EventEmitter 9757utils.extend( proto, EvEmitter.prototype ); 9758 9759proto._create = function() { 9760 // add id for Flickity.data 9761 var id = this.guid = ++GUID; 9762 this.element.flickityGUID = id; // expando 9763 instances[ id ] = this; // associate via id 9764 // initial properties 9765 this.selectedIndex = 0; 9766 // how many frames slider has been in same position 9767 this.restingFrames = 0; 9768 // initial physics properties 9769 this.x = 0; 9770 this.velocity = 0; 9771 this.originSide = this.options.rightToLeft ? 'right' : 'left'; 9772 // create viewport & slider 9773 this.viewport = document.createElement('div'); 9774 this.viewport.className = 'flickity-viewport'; 9775 this._createSlider(); 9776 9777 if ( this.options.resize || this.options.watchCSS ) { 9778 window.addEventListener( 'resize', this ); 9779 } 9780 9781 Flickity.createMethods.forEach( function( method ) { 9782 this[ method ](); 9783 }, this ); 9784 9785 if ( this.options.watchCSS ) { 9786 this.watchCSS(); 9787 } else { 9788 this.activate(); 9789 } 9790 9791}; 9792 9793/** 9794 * set options 9795 * @param {Object} opts 9796 */ 9797proto.option = function( opts ) { 9798 utils.extend( this.options, opts ); 9799}; 9800 9801proto.activate = function() { 9802 if ( this.isActive ) { 9803 return; 9804 } 9805 this.isActive = true; 9806 this.element.classList.add('flickity-enabled'); 9807 if ( this.options.rightToLeft ) { 9808 this.element.classList.add('flickity-rtl'); 9809 } 9810 9811 this.getSize(); 9812 // move initial cell elements so they can be loaded as cells 9813 var cellElems = this._filterFindCellElements( this.element.children ); 9814 moveElements( cellElems, this.slider ); 9815 this.viewport.appendChild( this.slider ); 9816 this.element.appendChild( this.viewport ); 9817 // get cells from children 9818 this.reloadCells(); 9819 9820 if ( this.options.accessibility ) { 9821 // allow element to focusable 9822 this.element.tabIndex = 0; 9823 // listen for key presses 9824 this.element.addEventListener( 'keydown', this ); 9825 } 9826 9827 this.emitEvent('activate'); 9828 9829 var index; 9830 var initialIndex = this.options.initialIndex; 9831 if ( this.isInitActivated ) { 9832 index = this.selectedIndex; 9833 } else if ( initialIndex !== undefined ) { 9834 index = this.cells[ initialIndex ] ? initialIndex : 0; 9835 } else { 9836 index = 0; 9837 } 9838 // select instantly 9839 this.select( index, false, true ); 9840 // flag for initial activation, for using initialIndex 9841 this.isInitActivated = true; 9842}; 9843 9844// slider positions the cells 9845proto._createSlider = function() { 9846 // slider element does all the positioning 9847 var slider = document.createElement('div'); 9848 slider.className = 'flickity-slider'; 9849 slider.style[ this.originSide ] = 0; 9850 this.slider = slider; 9851}; 9852 9853proto._filterFindCellElements = function( elems ) { 9854 return utils.filterFindElements( elems, this.options.cellSelector ); 9855}; 9856 9857// goes through all children 9858proto.reloadCells = function() { 9859 // collection of item elements 9860 this.cells = this._makeCells( this.slider.children ); 9861 this.positionCells(); 9862 this._getWrapShiftCells(); 9863 this.setGallerySize(); 9864}; 9865 9866/** 9867 * turn elements into Flickity.Cells 9868 * @param {Array or NodeList or HTMLElement} elems 9869 * @returns {Array} items - collection of new Flickity Cells 9870 */ 9871proto._makeCells = function( elems ) { 9872 var cellElems = this._filterFindCellElements( elems ); 9873 9874 // create new Flickity for collection 9875 var cells = cellElems.map( function( cellElem ) { 9876 return new Cell( cellElem, this ); 9877 }, this ); 9878 9879 return cells; 9880}; 9881 9882proto.getLastCell = function() { 9883 return this.cells[ this.cells.length - 1 ]; 9884}; 9885 9886proto.getLastSlide = function() { 9887 return this.slides[ this.slides.length - 1 ]; 9888}; 9889 9890// positions all cells 9891proto.positionCells = function() { 9892 // size all cells 9893 this._sizeCells( this.cells ); 9894 // position all cells 9895 this._positionCells( 0 ); 9896}; 9897 9898/** 9899 * position certain cells 9900 * @param {Integer} index - which cell to start with 9901 */ 9902proto._positionCells = function( index ) { 9903 index = index || 0; 9904 // also measure maxCellHeight 9905 // start 0 if positioning all cells 9906 this.maxCellHeight = index ? this.maxCellHeight || 0 : 0; 9907 var cellX = 0; 9908 // get cellX 9909 if ( index > 0 ) { 9910 var startCell = this.cells[ index - 1 ]; 9911 cellX = startCell.x + startCell.size.outerWidth; 9912 } 9913 var len = this.cells.length; 9914 for ( var i=index; i < len; i++ ) { 9915 var cell = this.cells[i]; 9916 cell.setPosition( cellX ); 9917 cellX += cell.size.outerWidth; 9918 this.maxCellHeight = Math.max( cell.size.outerHeight, this.maxCellHeight ); 9919 } 9920 // keep track of cellX for wrap-around 9921 this.slideableWidth = cellX; 9922 // slides 9923 this.updateSlides(); 9924 // contain slides target 9925 this._containSlides(); 9926 // update slidesWidth 9927 this.slidesWidth = len ? this.getLastSlide().target - this.slides[0].target : 0; 9928}; 9929 9930/** 9931 * cell.getSize() on multiple cells 9932 * @param {Array} cells 9933 */ 9934proto._sizeCells = function( cells ) {
9935 cells.forEach( function( cell ) { 9936 cell.getSize(); 9937 }); 9938}; 9939 9940// -------------------------- -------------------------- // 9941 9942proto.updateSlides = function() { 9943 this.slides = []; 9944 if ( !this.cells.length ) { 9945 return; 9946 } 9947 9948 var slide = new Slide( this ); 9949 this.slides.push( slide ); 9950 var isOriginLeft = this.originSide == 'left'; 9951 var nextMargin = isOriginLeft ? 'marginRight' : 'marginLeft'; 9952 9953 var canCellFit = this._getCanCellFit(); 9954 9955 this.cells.forEach( function( cell, i ) { 9956 // just add cell if first cell in slide 9957 if ( !slide.cells.length ) { 9958 slide.addCell( cell ); 9959 return; 9960 } 9961 9962 var slideWidth = ( slide.outerWidth - slide.firstMargin ) + 9963 ( cell.size.outerWidth - cell.size[ nextMargin ] ); 9964 9965 if ( canCellFit.call( this, i, slideWidth ) ) { 9966 slide.addCell( cell ); 9967 } else { 9968 // doesn't fit, new slide 9969 slide.updateTarget(); 9970 9971 slide = new Slide( this ); 9972 this.slides.push( slide ); 9973 slide.addCell( cell ); 9974 } 9975 }, this ); 9976 // last slide 9977 slide.updateTarget(); 9978 // update .selectedSlide 9979 this.updateSelectedSlide(); 9980}; 9981 9982proto._getCanCellFit = function() { 9983 var groupCells = this.options.groupCells; 9984 if ( !groupCells ) { 9985 return function() { 9986 return false; 9987 }; 9988 } else if ( typeof groupCells == 'number' ) { 9989 // group by number. 3 -> [0,1,2], [3,4,5], ... 9990 var number = parseInt( groupCells, 10 ); 9991 return function( i ) { 9992 return ( i % number ) !== 0; 9993 }; 9994 } 9995 // default, group by width of slide 9996 // parse '75% 9997 var percentMatch = typeof groupCells == 'string' && 9998 groupCells.match(/^(\d+)%$/); 9999 var percent = percentMatch ? parseInt( percentMatch[1], 10 ) / 100 : 1; 10000 return function( i, slideWidth ) { 10001 return slideWidth <= ( this.size.innerWidth + 1 ) * percent; 10002 }; 10003}; 10004 10005// alias _init for jQuery plugin .flickity() 10006proto._init = 10007proto.reposition = function() { 10008 this.positionCells(); 10009 this.positionSliderAtSelected(); 10010}; 10011 10012proto.getSize = function() { 10013 this.size = getSize( this.element ); 10014 this.setCellAlign(); 10015 this.cursorPosition = this.size.innerWidth * this.cellAlign; 10016}; 10017 10018var cellAlignShorthands = { 10019 // cell align, then based on origin side 10020 center: { 10021 left: 0.5, 10022 right: 0.5 10023 }, 10024 left: { 10025 left: 0, 10026 right: 1 10027 }, 10028 right: { 10029 right: 0, 10030 left: 1 10031 } 10032}; 10033 10034proto.setCellAlign = function() { 10035 var shorthand = cellAlignShorthands[ this.options.cellAlign ]; 10036 this.cellAlign = shorthand ? shorthand[ this.originSide ] : this.options.cellAlign; 10037}; 10038 10039proto.setGallerySize = function() { 10040 if ( this.options.setGallerySize ) { 10041 var height = this.options.adaptiveHeight && this.selectedSlide ? 10042 this.selectedSlide.height : this.maxCellHeight; 10043 this.viewport.style.height = height + 'px'; 10044 } 10045}; 10046 10047proto._getWrapShiftCells = function() { 10048 // only for wrap-around 10049 if ( !this.options.wrapAround ) { 10050 return; 10051 } 10052 // unshift previous cells 10053 this._unshiftCells( this.beforeShiftCells ); 10054 this._unshiftCells( this.afterShiftCells ); 10055 // get before cells 10056 // initial gap 10057 var gapX = this.cursorPosition; 10058 var cellIndex = this.cells.length - 1; 10059 this.beforeShiftCells = this._getGapCells( gapX, cellIndex, -1 ); 10060 // get after cells 10061 // ending gap between last cell and end of gallery viewport 10062 gapX = this.size.innerWidth - this.cursorPosition; 10063 // start cloning at first cell, working forwards 10064 this.afterShiftCells = this._getGapCells( gapX, 0, 1 ); 10065}; 10066 10067proto._getGapCells = function( gapX, cellIndex, increment ) { 10068 // keep adding cells until the cover the initial gap 10069 var cells = []; 10070 while ( gapX > 0 ) { 10071 var cell = this.cells[ cellIndex ]; 10072 if ( !cell ) { 10073 break; 10074 } 10075 cells.push( cell ); 10076 cellIndex += increment; 10077 gapX -= cell.size.outerWidth; 10078 } 10079 return cells; 10080}; 10081 10082// ----- contain ----- // 10083 10084// contain cell targets so no excess sliding 10085proto._containSlides = function() { 10086 if ( !this.options.contain || this.options.wrapAround || !this.cells.length ) { 10087 return; 10088 } 10089 var isRightToLeft = this.options.rightToLeft; 10090 var beginMargin = isRightToLeft ? 'marginRight' : 'marginLeft'; 10091 var endMargin = isRightToLeft ? 'marginLeft' : 'marginRight'; 10092 var contentWidth = this.slideableWidth - this.getLastCell().size[ endMargin ]; 10093 // content is less than gallery size 10094 var isContentSmaller = contentWidth < this.size.innerWidth; 10095 // bounds 10096 var beginBound = this.cursorPosition + this.cells[0].size[ beginMargin ]; 10097 var endBound = contentWidth - this.size.innerWidth * ( 1 - this.cellAlign ); 10098 // contain each cell target
10099 this.slides.forEach( function( slide ) { 10100 if ( isContentSmaller ) { 10101 // all cells fit inside gallery 10102 slide.target = contentWidth * this.cellAlign; 10103 } else { 10104 // contain to bounds 10105 slide.target = Math.max( slide.target, beginBound ); 10106 slide.target = Math.min( slide.target, endBound ); 10107 } 10108 }, this ); 10109}; 10110 10111// ----- ----- // 10112 10113/** 10114 * emits events via eventEmitter and jQuery events 10115 * @param {String} type - name of event 10116 * @param {Event} event - original event 10117 * @param {Array} args - extra arguments 10118 */ 10119proto.dispatchEvent = function( type, event, args ) { 10120 var emitArgs = event ? [ event ].concat( args ) : args; 10121 this.emitEvent( type, emitArgs ); 10122 10123 if ( jQuery && this.$element ) { 10124 // default trigger with type if no event 10125 type += this.options.namespaceJQueryEvents ? '.flickity' : ''; 10126 var $event = type; 10127 if ( event ) { 10128 // create jQuery event 10129 var jQEvent = jQuery.Event( event ); 10130 jQEvent.type = type; 10131 $event = jQEvent; 10132 } 10133 this.$element.trigger( $event, args ); 10134 } 10135}; 10136 10137// -------------------------- select -------------------------- // 10138 10139/** 10140 * @param {Integer} index - index of the slide 10141 * @param {Boolean} isWrap - will wrap-around to last/first if at the end 10142 * @param {Boolean} isInstant - will immediately set position at selected cell 10143 */ 10144proto.select = function( index, isWrap, isInstant ) { 10145 if ( !this.isActive ) { 10146 return; 10147 } 10148 index = parseInt( index, 10 ); 10149 this._wrapSelect( index ); 10150 10151 if ( this.options.wrapAround || isWrap ) { 10152 index = utils.modulo( index, this.slides.length ); 10153 } 10154 // bail if invalid index 10155 if ( !this.slides[ index ] ) { 10156 return; 10157 } 10158 this.selectedIndex = index; 10159 this.updateSelectedSlide(); 10160 if ( isInstant ) { 10161 this.positionSliderAtSelected(); 10162 } else { 10163 this.startAnimation(); 10164 } 10165 if ( this.options.adaptiveHeight ) { 10166 this.setGallerySize(); 10167 } 10168 10169 this.dispatchEvent('select'); 10170 // old v1 event name, remove in v3 10171 this.dispatchEvent('cellSelect'); 10172}; 10173 10174// wraps position for wrapAround, to move to closest slide. #113 10175proto._wrapSelect = function( index ) { 10176 var len = this.slides.length; 10177 var isWrapping = this.options.wrapAround && len > 1; 10178 if ( !isWrapping ) { 10179 return index; 10180 } 10181 var wrapIndex = utils.modulo( index, len ); 10182 // go to shortest 10183 var delta = Math.abs( wrapIndex - this.selectedIndex ); 10184 var backWrapDelta = Math.abs( ( wrapIndex + len ) - this.selectedIndex ); 10185 var forewardWrapDelta = Math.abs( ( wrapIndex - len ) - this.selectedIndex ); 10186 if ( !this.isDragSelect && backWrapDelta < delta ) { 10187 index += len; 10188 } else if ( !this.isDragSelect && forewardWrapDelta < delta ) { 10189 index -= len; 10190 } 10191 // wrap position so slider is within normal area 10192 if ( index < 0 ) { 10193 this.x -= this.slideableWidth; 10194 } else if ( index >= len ) { 10195 this.x += this.slideableWidth; 10196 } 10197}; 10198 10199proto.previous = function( isWrap, isInstant ) { 10200 this.select( this.selectedIndex - 1, isWrap, isInstant ); 10201}; 10202 10203proto.next = function( isWrap, isInstant ) { 10204 this.select( this.selectedIndex + 1, isWrap, isInstant ); 10205}; 10206 10207proto.updateSelectedSlide = function() { 10208 var slide = this.slides[ this.selectedIndex ]; 10209 // selectedIndex could be outside of slides, if triggered before resize() 10210 if ( !slide ) { 10211 return; 10212 } 10213 // unselect previous selected slide 10214 this.unselectSelectedSlide(); 10215 // update new selected slide 10216 this.selectedSlide = slide; 10217 slide.select(); 10218 this.selectedCells = slide.cells; 10219 this.selectedElements = slide.getCellElements(); 10220 // HACK: selectedCell & selectedElement is first cell in slide, backwards compatibility 10221 // Remove in v3? 10222 this.selectedCell = slide.cells[0]; 10223 this.selectedElement = this.selectedElements[0]; 10224}; 10225 10226proto.unselectSelectedSlide = function() { 10227 if ( this.selectedSlide ) { 10228 this.selectedSlide.unselect(); 10229 } 10230}; 10231 10232/** 10233 * select slide from number or cell element 10234 * @param {Element or Number} elem 10235 */ 10236proto.selectCell = function( value, isWrap, isInstant ) { 10237 // get cell 10238 var cell; 10239 if ( typeof value == 'number' ) { 10240 cell = this.cells[ value ]; 10241 } else { 10242 // use string as selector 10243 if ( typeof value == 'string' ) { 10244 value = this.element.querySelector( value ); 10245 } 10246 // get cell from element 10247 cell = this.getCell( value ); 10248 } 10249 // select slide that has cell 10250 for ( var i=0; cell && i < this.slides.length; i++ ) { 10251 var slide = this.slides[i]; 10252 var index = slide.cells.indexOf( cell ); 10253 if ( index != -1 ) { 10254 this.select( i, isWrap, isInstant ); 10255 return; 10256 } 10257 } 10258}; 10259 10260// -------------------------- get cells -------------------------- // 10261 10262/** 10263 * get Flickity.Cell, given an Element 10264 * @param {Element} elem 10265 * @returns {Flickity.Cell} item 10266 */ 10267proto.getCell = function( elem ) { 10268 // loop through cells to get the one that matches 10269 for ( var i=0; i < this.cells.length; i++ ) { 10270 var cell = this.cells[i]; 10271 if ( cell.element == elem ) { 10272 return cell; 10273 } 10274 } 10275}; 10276 10277/** 10278 * get collection of Flickity.Cells, given Elements 10279 * @param {Element, Array, NodeList} elems 10280 * @returns {Array} cells - Flickity.Cells 10281 */ 10282proto.getCells = function( elems ) { 10283 elems = utils.makeArray( elems ); 10284 var cells = [];
10285 elems.forEach( function( elem ) { 10286 var cell = this.getCell( elem ); 10287 if ( cell ) { 10288 cells.push( cell ); 10289 } 10290 }, this ); 10291 return cells; 10292}; 10293 10294/** 10295 * get cell elements 10296 * @returns {Array} cellElems 10297 */ 10298proto.getCellElements = function() { 10299 return this.cells.map( function( cell ) { 10300 return cell.element; 10301 }); 10302}; 10303 10304/** 10305 * get parent cell from an element 10306 * @param {Element} elem 10307 * @returns {Flickit.Cell} cell 10308 */ 10309proto.getParentCell = function( elem ) { 10310 // first check if elem is cell 10311 var cell = this.getCell( elem ); 10312 if ( cell ) { 10313 return cell; 10314 } 10315 // try to get parent cell elem 10316 elem = utils.getParent( elem, '.flickity-slider > *' ); 10317 return this.getCell( elem ); 10318}; 10319 10320/** 10321 * get cells adjacent to a slide 10322 * @param {Integer} adjCount - number of adjacent slides 10323 * @param {Integer} index - index of slide to start 10324 * @returns {Array} cells - array of Flickity.Cells 10325 */ 10326proto.getAdjacentCellElements = function( adjCount, index ) { 10327 if ( !adjCount ) { 10328 return this.selectedSlide.getCellElements(); 10329 } 10330 index = index === undefined ? this.selectedIndex : index; 10331 10332 var len = this.slides.length; 10333 if ( 1 + ( adjCount * 2 ) >= len ) { 10334 return this.getCellElements(); 10335 } 10336 10337 var cellElems = []; 10338 for ( var i = index - adjCount; i <= index + adjCount ; i++ ) { 10339 var slideIndex = this.options.wrapAround ? utils.modulo( i, len ) : i; 10340 var slide = this.slides[ slideIndex ]; 10341 if ( slide ) { 10342 cellElems = cellElems.concat( slide.getCellElements() ); 10343 } 10344 } 10345 return cellElems; 10346}; 10347 10348// -------------------------- events -------------------------- // 10349 10350proto.uiChange = function() { 10351 this.emitEvent('uiChange'); 10352}; 10353 10354proto.childUIPointerDown = function( event ) { 10355 this.emitEvent( 'childUIPointerDown', [ event ] ); 10356}; 10357 10358// ----- resize ----- // 10359 10360proto.onresize = function() { 10361 this.watchCSS(); 10362 this.resize(); 10363}; 10364 10365utils.debounceMethod( Flickity, 'onresize', 150 ); 10366 10367proto.resize = function() { 10368 if ( !this.isActive ) { 10369 return; 10370 } 10371 this.getSize(); 10372 // wrap values 10373 if ( this.options.wrapAround ) { 10374 this.x = utils.modulo( this.x, this.slideableWidth ); 10375 } 10376 this.positionCells(); 10377 this._getWrapShiftCells(); 10378 this.setGallerySize(); 10379 this.emitEvent('resize'); 10380 // update selected index for group slides, instant 10381 // TODO: position can be lost between groups of various numbers 10382 var selectedElement = this.selectedElements && this.selectedElements[0]; 10383 this.selectCell( selectedElement, false, true ); 10384}; 10385 10386// watches the :after property, activates/deactivates 10387proto.watchCSS = function() { 10388 var watchOption = this.options.watchCSS; 10389 if ( !watchOption ) { 10390 return; 10391 } 10392 10393 var afterContent = getComputedStyle( this.element, ':after' ).content; 10394 // activate if :after { content: 'flickity' } 10395 if ( afterContent.indexOf('flickity') != -1 ) { 10396 this.activate(); 10397 } else { 10398 this.deactivate(); 10399 } 10400}; 10401 10402// ----- keydown ----- // 10403 10404// go previous/next if left/right keys pressed 10405proto.onkeydown = function( event ) { 10406 // only work if element is in focus 10407 if ( !this.options.accessibility || 10408 ( document.activeElement && document.activeElement != this.element ) ) { 10409 return; 10410 } 10411 10412 if ( event.keyCode == 37 ) { 10413 // go left 10414 var leftMethod = this.options.rightToLeft ? 'next' : 'previous'; 10415 this.uiChange(); 10416 this[ leftMethod ](); 10417 } else if ( event.keyCode == 39 ) { 10418 // go right 10419 var rightMethod = this.options.rightToLeft ? 'previous' : 'next'; 10420 this.uiChange(); 10421 this[ rightMethod ](); 10422 } 10423}; 10424 10425// -------------------------- destroy -------------------------- // 10426 10427// deactivate all Flickity functionality, but keep stuff available 10428proto.deactivate = function() { 10429 if ( !this.isActive ) { 10430 return; 10431 } 10432 this.element.classList.remove('flickity-enabled'); 10433 this.element.classList.remove('flickity-rtl'); 10434 // destroy cells 10435 this.cells.forEach( function( cell ) { 10436 cell.destroy(); 10437 }); 10438 this.unselectSelectedSlide(); 10439 this.element.removeChild( this.viewport ); 10440 // move child elements back into element 10441 moveElements( this.slider.children, this.element ); 10442 if ( this.options.accessibility ) { 10443 this.element.removeAttribute('tabIndex'); 10444 this.element.removeEventListener( 'keydown', this ); 10445 } 10446 // set flags 10447 this.isActive = false;
10448 this.emitEvent('deactivate'); 10449}; 10450 10451proto.destroy = function() { 10452 this.deactivate(); 10453 window.removeEventListener( 'resize', this ); 10454 this.emitEvent('destroy'); 10455 if ( jQuery && this.$element ) { 10456 jQuery.removeData( this.element, 'flickity' ); 10457 } 10458 delete this.element.flickityGUID; 10459 delete instances[ this.guid ]; 10460}; 10461 10462// -------------------------- prototype -------------------------- // 10463 10464utils.extend( proto, animatePrototype ); 10465 10466// -------------------------- extras -------------------------- // 10467 10468/** 10469 * get Flickity instance from element 10470 * @param {Element} elem 10471 * @returns {Flickity} 10472 */ 10473Flickity.data = function( elem ) { 10474 elem = utils.getQueryElement( elem ); 10475 var id = elem && elem.flickityGUID; 10476 return id && instances[ id ]; 10477}; 10478 10479utils.htmlInit( Flickity, 'flickity' ); 10480 10481if ( jQuery && jQuery.bridget ) { 10482 jQuery.bridget( 'flickity', Flickity ); 10483} 10484 10485Flickity.Cell = Cell; 10486 10487return Flickity; 10488 10489})); 10490 10491/*! 10492 * Unipointer v2.1.0 10493 * base class for doing one thing with pointer event 10494 * MIT license 10495 */ 10496 10497/*jshint browser: true, undef: true, unused: true, strict: true */ 10498 10499( function( window, factory ) { 10500 // universal module definition 10501 /* jshint strict: false */ /*global define, module, require */ 10502 if ( typeof define == 'function' && define.amd ) { 10503 // AMD 10504 define( 'unipointer/unipointer',[ 10505 'ev-emitter/ev-emitter' 10506 ], function( EvEmitter ) { 10507 return factory( window, EvEmitter ); 10508 }); 10509 } else if ( typeof module == 'object' && module.exports ) { 10510 // CommonJS 10511 module.exports = factory( 10512 window, 10513 require('ev-emitter') 10514 ); 10515 } else { 10516 // browser global 10517 window.Unipointer = factory( 10518 window, 10519 window.EvEmitter 10520 ); 10521 } 10522 10523}( window, function factory( window, EvEmitter ) { 10524 10525 10526 10527function noop() {} 10528 10529function Unipointer() {} 10530 10531// inherit EvEmitter 10532var proto = Unipointer.prototype = Object.create( EvEmitter.prototype ); 10533 10534proto.bindStartEvent = function( elem ) { 10535 this._bindStartEvent( elem, true ); 10536}; 10537 10538proto.unbindStartEvent = function( elem ) { 10539 this._bindStartEvent( elem, false ); 10540}; 10541 10542/** 10543 * works as unbinder, as you can ._bindStart( false ) to unbind 10544 * @param {Boolean} isBind - will unbind if falsey 10545 */ 10546proto._bindStartEvent = function( elem, isBind ) { 10547 // munge isBind, default to true 10548 isBind = isBind === undefined ? true : !!isBind; 10549 var bindMethod = isBind ? 'addEventListener' : 'removeEventListener'; 10550 10551 if ( window.navigator.pointerEnabled ) { 10552 // W3C Pointer Events, IE11. See https://coderwall.com/p/mfreca 10553 elem[ bindMethod ]( 'pointerdown', this ); 10554 } else if ( window.navigator.msPointerEnabled ) { 10555 // IE10 Pointer Events 10556 elem[ bindMethod ]( 'MSPointerDown', this ); 10557 } else { 10558 // listen for both, for devices like Chrome Pixel 10559 elem[ bindMethod ]( 'mousedown', this ); 10560 elem[ bindMethod ]( 'touchstart', this ); 10561 } 10562}; 10563 10564// trigger handler methods for events 10565proto.handleEvent = function( event ) { 10566 var method = 'on' + event.type; 10567 if ( this[ method ] ) { 10568 this[ method ]( event ); 10569 } 10570}; 10571 10572// returns the touch that we're keeping track of 10573proto.getTouch = function( touches ) { 10574 for ( var i=0; i < touches.length; i++ ) { 10575 var touch = touches[i]; 10576 if ( touch.identifier == this.pointerIdentifier ) { 10577 return touch; 10578 } 10579 } 10580}; 10581 10582// ----- start event ----- // 10583 10584proto.onmousedown = function( event ) { 10585 // dismiss clicks from right or middle buttons 10586 var button = event.button; 10587 if ( button && ( button !== 0 && button !== 1 ) ) { 10588 return; 10589 } 10590 this._pointerDown( event, event ); 10591}; 10592 10593proto.ontouchstart = function( event ) { 10594 this._pointerDown( event, event.changedTouches[0] ); 10595}; 10596 10597proto.onMSPointerDown = 10598proto.onpointerdown = function( event ) { 10599 this._pointerDown( event, event ); 10600}; 10601 10602/** 10603 * pointer start 10604 * @param {Event} event 10605 * @param {Event or Touch} pointer 10606 */ 10607proto._pointerDown = function( event, pointer ) { 10608 // dismiss other pointers 10609 if ( this.isPointerDown ) { 10610 return; 10611 } 10612 10613 this.isPointerDown = true; 10614 // save pointer identifier to match up touch events 10615 this.pointerIdentifier = pointer.pointerId !== undefined ? 10616 // pointerId for pointer events, touch.indentifier for touch events 10617 pointer.pointerId : pointer.identifier; 10618 10619 this.pointerDown( event, pointer ); 10620}; 10621 10622proto.pointerDown = function( event, pointer ) { 10623 this._bindPostStartEvents( event ); 10624 this.emitEvent( 'pointerDown', [ event, pointer ] ); 10625}; 10626 10627// hash of events to be bound after start event 10628var postStartEvents = {
10629 mousedown: [ 'mousemove', 'mouseup' ], 10630 touchstart: [ 'touchmove', 'touchend', 'touchcancel' ], 10631 pointerdown: [ 'pointermove', 'pointerup', 'pointercancel' ], 10632 MSPointerDown: [ 'MSPointerMove', 'MSPointerUp', 'MSPointerCancel' ] 10633}; 10634 10635proto._bindPostStartEvents = function( event ) { 10636 if ( !event ) { 10637 return; 10638 } 10639 // get proper events to match start event 10640 var events = postStartEvents[ event.type ]; 10641 // bind events to node 10642 events.forEach( function( eventName ) { 10643 window.addEventListener( eventName, this ); 10644 }, this ); 10645 // save these arguments 10646 this._boundPointerEvents = events; 10647}; 10648 10649proto._unbindPostStartEvents = function() { 10650 // check for _boundEvents, in case dragEnd triggered twice (old IE8 bug) 10651 if ( !this._boundPointerEvents ) { 10652 return; 10653 } 10654 this._boundPointerEvents.forEach( function( eventName ) { 10655 window.removeEventListener( eventName, this ); 10656 }, this ); 10657 10658 delete this._boundPointerEvents; 10659}; 10660 10661// ----- move event ----- // 10662 10663proto.onmousemove = function( event ) { 10664 this._pointerMove( event, event ); 10665}; 10666 10667proto.onMSPointerMove = 10668proto.onpointermove = function( event ) { 10669 if ( event.pointerId == this.pointerIdentifier ) { 10670 this._pointerMove( event, event ); 10671 } 10672}; 10673 10674proto.ontouchmove = function( event ) { 10675 var touch = this.getTouch( event.changedTouches ); 10676 if ( touch ) { 10677 this._pointerMove( event, touch ); 10678 } 10679}; 10680 10681/** 10682 * pointer move 10683 * @param {Event} event 10684 * @param {Event or Touch} pointer 10685 * @private 10686 */ 10687proto._pointerMove = function( event, pointer ) { 10688 this.pointerMove( event, pointer ); 10689}; 10690 10691// public 10692proto.pointerMove = function( event, pointer ) { 10693 this.emitEvent( 'pointerMove', [ event, pointer ] ); 10694}; 10695 10696// ----- end event ----- // 10697 10698 10699proto.onmouseup = function( event ) { 10700 this._pointerUp( event, event ); 10701}; 10702 10703proto.onMSPointerUp = 10704proto.onpointerup = function( event ) { 10705 if ( event.pointerId == this.pointerIdentifier ) { 10706 this._pointerUp( event, event ); 10707 } 10708}; 10709 10710proto.ontouchend = function( event ) { 10711 var touch = this.getTouch( event.changedTouches ); 10712 if ( touch ) { 10713 this._pointerUp( event, touch ); 10714 } 10715}; 10716 10717/** 10718 * pointer up 10719 * @param {Event} event 10720 * @param {Event or Touch} pointer 10721 * @private 10722 */ 10723proto._pointerUp = function( event, pointer ) { 10724 this._pointerDone(); 10725 this.pointerUp( event, pointer ); 10726}; 10727 10728// public 10729proto.pointerUp = function( event, pointer ) { 10730 this.emitEvent( 'pointerUp', [ event, pointer ] ); 10731}; 10732 10733// ----- pointer done ----- // 10734 10735// triggered on pointer up & pointer cancel 10736proto._pointerDone = function() { 10737 // reset properties 10738 this.isPointerDown = false; 10739 delete this.pointerIdentifier; 10740 // remove events 10741 this._unbindPostStartEvents(); 10742 this.pointerDone(); 10743}; 10744 10745proto.pointerDone = noop; 10746 10747// ----- pointer cancel ----- // 10748 10749proto.onMSPointerCancel = 10750proto.onpointercancel = function( event ) { 10751 if ( event.pointerId == this.pointerIdentifier ) { 10752 this._pointerCancel( event, event ); 10753 } 10754}; 10755 10756proto.ontouchcancel = function( event ) { 10757 var touch = this.getTouch( event.changedTouches ); 10758 if ( touch ) { 10759 this._pointerCancel( event, touch ); 10760 } 10761}; 10762 10763/** 10764 * pointer cancel 10765 * @param {Event} event 10766 * @param {Event or Touch} pointer 10767 * @private 10768 */ 10769proto._pointerCancel = function( event, pointer ) { 10770 this._pointerDone(); 10771 this.pointerCancel( event, pointer ); 10772}; 10773 10774// public 10775proto.pointerCancel = function( event, pointer ) { 10776 this.emitEvent( 'pointerCancel', [ event, pointer ] ); 10777}; 10778 10779// ----- ----- // 10780 10781// utility function for getting x/y coords from event 10782Unipointer.getPointerPoint = function( pointer ) { 10783 return { 10784 x: pointer.pageX, 10785 y: pointer.pageY 10786 }; 10787}; 10788 10789// ----- ----- // 10790 10791return Unipointer; 10792 10793})); 10794 10795/*! 10796 * Unidragger v2.1.0 10797 * Draggable base class 10798 * MIT license 10799 */ 10800 10801/*jshint browser: true, unused: true, undef: true, strict: true */ 10802 10803( function( window, factory ) { 10804 // universal module definition 10805 /*jshint strict: false */ /*globals define, module, require */ 10806 10807 if ( typeof define == 'function' && define.amd ) { 10808 // AMD 10809 define( 'unidragger/unidragger',[ 10810 'unipointer/unipointer' 10811 ], function( Unipointer ) { 10812 return factory( window, Unipointer ); 10813 }); 10814 } else if ( typeof module == 'object' && module.exports ) { 10815 // CommonJS 10816 module.exports = factory( 10817 window, 10818 require('unipointer') 10819 ); 10820 } else { 10821 // browser global 10822 window.Unidragger = factory( 10823 window, 10824 window.Unipointer 10825 ); 10826 } 10827 10828}( window, function factory( window, Unipointer ) { 10829 10830 10831 10832// ----- ----- // 10833 10834function noop() {} 10835 10836// -------------------------- Unidragger -------------------------- // 10837 10838function Unidragger() {} 10839 10840// inherit Unipointer & EvEmitter 10841var proto = Unidragger.prototype = Object.create( Unipointer.prototype ); 10842 10843// ----- bind start ----- // 10844 10845proto.bindHandles = function() { 10846 this._bindHandles( true ); 10847}; 10848 10849proto.unbindHandles = function() { 10850 this._bindHandles( false ); 10851}; 10852 10853var navigator = window.navigator; 10854/** 10855 * works as unbinder, as you can .bindHandles( false ) to unbind 10856 * @param {Boolean} isBind - will unbind if falsey 10857 */ 10858proto._bindHandles = function( isBind ) { 10859 // munge isBind, default to true 10860 isBind = isBind === undefined ? true : !!isBind; 10861 // extra bind logic 10862 var binderExtra; 10863 if ( navigator.pointerEnabled ) { 10864 binderExtra = function( handle ) { 10865 // disable scrolling on the element 10866 handle.style.touchAction = isBind ? 'none' : ''; 10867 }; 10868 } else if ( navigator.msPointerEnabled ) { 10869 binderExtra = function( handle ) { 10870 // disable scrolling on the element 10871 handle.style.msTouchAction = isBind ? 'none' : ''; 10872 }; 10873 } else { 10874 binderExtra = noop; 10875 } 10876 // bind each handle 10877 var bindMethod = isBind ? 'addEventListener' : 'removeEventListener'; 10878 for ( var i=0; i < this.handles.length; i++ ) { 10879 var handle = this.handles[i]; 10880 this._bindStartEvent( handle, isBind ); 10881 binderExtra( handle ); 10882 handle[ bindMethod ]( 'click', this ); 10883 } 10884}; 10885 10886// ----- start event ----- // 10887 10888/** 10889 * pointer start 10890 * @param {Event} event 10891 * @param {Event or Touch} pointer 10892 */ 10893proto.pointerDown = function( event, pointer ) { 10894 // dismiss range sliders 10895 if ( event.target.nodeName == 'INPUT' && event.target.type == 'range' ) { 10896 // reset pointerDown logic 10897 this.isPointerDown = false;
10898 delete this.pointerIdentifier; 10899 return; 10900 } 10901 10902 this._dragPointerDown( event, pointer ); 10903 // kludge to blur focused inputs in dragger 10904 var focused = document.activeElement; 10905 if ( focused && focused.blur ) { 10906 focused.blur(); 10907 } 10908 // bind move and end events 10909 this._bindPostStartEvents( event ); 10910 this.emitEvent( 'pointerDown', [ event, pointer ] ); 10911}; 10912 10913// base pointer down logic 10914proto._dragPointerDown = function( event, pointer ) { 10915 // track to see when dragging starts 10916 this.pointerDownPoint = Unipointer.getPointerPoint( pointer ); 10917 10918 var canPreventDefault = this.canPreventDefaultOnPointerDown( event, pointer ); 10919 if ( canPreventDefault ) { 10920 event.preventDefault(); 10921 } 10922}; 10923 10924// overwriteable method so Flickity can prevent for scrolling 10925proto.canPreventDefaultOnPointerDown = function( event ) { 10926 // prevent default, unless touchstart or <select> 10927 return event.target.nodeName != 'SELECT'; 10928}; 10929 10930// ----- move event ----- // 10931 10932/** 10933 * drag move 10934 * @param {Event} event 10935 * @param {Event or Touch} pointer 10936 */ 10937proto.pointerMove = function( event, pointer ) { 10938 var moveVector = this._dragPointerMove( event, pointer ); 10939 this.emitEvent( 'pointerMove', [ event, pointer, moveVector ] ); 10940 this._dragMove( event, pointer, moveVector ); 10941}; 10942 10943// base pointer move logic 10944proto._dragPointerMove = function( event, pointer ) { 10945 var movePoint = Unipointer.getPointerPoint( pointer ); 10946 var moveVector = { 10947 x: movePoint.x - this.pointerDownPoint.x, 10948 y: movePoint.y - this.pointerDownPoint.y 10949 }; 10950 // start drag if pointer has moved far enough to start drag 10951 if ( !this.isDragging && this.hasDragStarted( moveVector ) ) { 10952 this._dragStart( event, pointer ); 10953 } 10954 return moveVector; 10955}; 10956 10957// condition if pointer has moved far enough to start drag 10958proto.hasDragStarted = function( moveVector ) { 10959 return Math.abs( moveVector.x ) > 3 || Math.abs( moveVector.y ) > 3; 10960}; 10961 10962 10963// ----- end event ----- // 10964 10965/** 10966 * pointer up 10967 * @param {Event} event 10968 * @param {Event or Touch} pointer 10969 */ 10970proto.pointerUp = function( event, pointer ) { 10971 this.emitEvent( 'pointerUp', [ event, pointer ] ); 10972 this._dragPointerUp( event, pointer ); 10973}; 10974 10975proto._dragPointerUp = function( event, pointer ) { 10976 if ( this.isDragging ) { 10977 this._dragEnd( event, pointer ); 10978 } else { 10979 // pointer didn't move enough for drag to start 10980 this._staticClick( event, pointer ); 10981 } 10982}; 10983 10984// -------------------------- drag -------------------------- // 10985 10986// dragStart 10987proto._dragStart = function( event, pointer ) { 10988 this.isDragging = true; 10989 this.dragStartPoint = Unipointer.getPointerPoint( pointer ); 10990 // prevent clicks
10991 this.isPreventingClicks = true; 10992 10993 this.dragStart( event, pointer ); 10994}; 10995 10996proto.dragStart = function( event, pointer ) { 10997 this.emitEvent( 'dragStart', [ event, pointer ] ); 10998}; 10999 11000// dragMove 11001proto._dragMove = function( event, pointer, moveVector ) { 11002 // do not drag if not dragging yet 11003 if ( !this.isDragging ) { 11004 return; 11005 } 11006 11007 this.dragMove( event, pointer, moveVector ); 11008}; 11009 11010proto.dragMove = function( event, pointer, moveVector ) { 11011 event.preventDefault(); 11012 this.emitEvent( 'dragMove', [ event, pointer, moveVector ] ); 11013}; 11014 11015// dragEnd 11016proto._dragEnd = function( event, pointer ) { 11017 // set flags 11018 this.isDragging = false; 11019 // re-enable clicking async 11020 setTimeout( function() { 11021 delete this.isPreventingClicks; 11022 }.bind( this ) ); 11023 11024 this.dragEnd( event, pointer ); 11025}; 11026 11027proto.dragEnd = function( event, pointer ) { 11028 this.emitEvent( 'dragEnd', [ event, pointer ] ); 11029}; 11030 11031// ----- onclick ----- // 11032 11033// handle all clicks and prevent clicks when dragging 11034proto.onclick = function( event ) { 11035 if ( this.isPreventingClicks ) { 11036 event.preventDefault(); 11037 } 11038}; 11039 11040// ----- staticClick ----- // 11041 11042// triggered after pointer down & up with no/tiny movement 11043proto._staticClick = function( event, pointer ) { 11044 // ignore emulated mouse up clicks 11045 if ( this.isIgnoringMouseUp && event.type == 'mouseup' ) { 11046 return; 11047 } 11048 11049 // allow click in <input>s and <textarea>s 11050 var nodeName = event.target.nodeName; 11051 if ( nodeName == 'INPUT' || nodeName == 'TEXTAREA' ) { 11052 event.target.focus(); 11053 } 11054 this.staticClick( event, pointer ); 11055 11056 // set flag for emulated clicks 300ms after touchend 11057 if ( event.type != 'mouseup' ) { 11058 this.isIgnoringMouseUp = true; 11059 // reset flag after 300ms 11060 setTimeout( function() { 11061 delete this.isIgnoringMouseUp; 11062 }.bind( this ), 400 ); 11063 } 11064}; 11065 11066proto.staticClick = function( event, pointer ) { 11067 this.emitEvent( 'staticClick', [ event, pointer ] ); 11068}; 11069 11070// ----- utils ----- // 11071 11072Unidragger.getPointerPoint = Unipointer.getPointerPoint; 11073 11074// ----- ----- // 11075 11076return Unidragger; 11077 11078})); 11079 11080// drag 11081( function( window, factory ) { 11082 // universal module definition 11083 /* jshint strict: false */ 11084 if ( typeof define == 'function' && define.amd ) { 11085 // AMD 11086 define( 'flickity/js/drag',[ 11087 './flickity', 11088 'unidragger/unidragger', 11089 'fizzy-ui-utils/utils' 11090 ], function( Flickity, Unidragger, utils ) { 11091 return factory( window, Flickity, Unidragger, utils ); 11092 }); 11093 } else if ( typeof module == 'object' && module.exports ) { 11094 // CommonJS 11095 module.exports = factory( 11096 window, 11097 require('./flickity'), 11098 require('unidragger'), 11099 require('fizzy-ui-utils') 11100 ); 11101 } else { 11102 // browser global 11103 window.Flickity = factory( 11104 window, 11105 window.Flickity, 11106 window.Unidragger, 11107 window.fizzyUIUtils 11108 ); 11109 } 11110 11111}( window, function factory( window, Flickity, Unidragger, utils ) { 11112 11113 11114 11115// ----- defaults ----- // 11116 11117utils.extend( Flickity.defaults, { 11118 draggable: true, 11119 dragThreshold: 3, 11120}); 11121 11122// ----- create ----- // 11123 11124Flickity.createMethods.push('_createDrag'); 11125 11126// -------------------------- drag prototype -------------------------- // 11127 11128var proto = Flickity.prototype; 11129utils.extend( proto, Unidragger.prototype ); 11130 11131// -------------------------- -------------------------- // 11132 11133proto._createDrag = function() { 11134 this.on( 'activate', this.bindDrag ); 11135 this.on( 'uiChange', this._uiChangeDrag ); 11136 this.on( 'childUIPointerDown', this._childUIPointerDownDrag ); 11137 this.on( 'deactivate', this.unbindDrag ); 11138}; 11139 11140proto.bindDrag = function() { 11141 if ( !this.options.draggable || this.isDragBound ) { 11142 return; 11143 } 11144 this.element.classList.add('is-draggable'); 11145 this.handles = [ this.viewport ]; 11146 this.bindHandles(); 11147 this.isDragBound = true; 11148}; 11149 11150proto.unbindDrag = function() { 11151 if ( !this.isDragBound ) { 11152 return; 11153 } 11154 this.element.classList.remove('is-draggable'); 11155 this.unbindHandles(); 11156 delete this.isDragBound; 11157}; 11158 11159proto._uiChangeDrag = function() { 11160 delete this.isFreeScrolling; 11161}; 11162 11163proto._childUIPointerDownDrag = function( event ) { 11164 event.preventDefault(); 11165 this.pointerDownFocus( event ); 11166}; 11167 11168// -------------------------- pointer events -------------------------- // 11169 11170// nodes that have text fields 11171var cursorNodes = { 11172 TEXTAREA: true, 11173 INPUT: true, 11174 OPTION: true, 11175}; 11176 11177// input types that do not have text fields 11178var clickTypes = { 11179 radio: true, 11180 checkbox: true, 11181 button: true, 11182 submit: true, 11183 image: true, 11184 file: true, 11185}; 11186 11187proto.pointerDown = function( event, pointer ) { 11188 // dismiss inputs with text fields. #403, #404 11189 var isCursorInput = cursorNodes[ event.target.nodeName ] && 11190 !clickTypes[ event.target.type ]; 11191 if ( isCursorInput ) { 11192 // reset pointerDown logic 11193 this.isPointerDown = false;
11194 delete this.pointerIdentifier; 11195 return; 11196 } 11197 11198 this._dragPointerDown( event, pointer ); 11199 11200 // kludge to blur focused inputs in dragger 11201 var focused = document.activeElement; 11202 if ( focused && focused.blur && focused != this.element && 11203 // do not blur body for IE9 & 10, #117 11204 focused != document.body ) { 11205 focused.blur(); 11206 } 11207 this.pointerDownFocus( event ); 11208 // stop if it was moving 11209 this.dragX = this.x; 11210 this.viewport.classList.add('is-pointer-down'); 11211 // bind move and end events 11212 this._bindPostStartEvents( event ); 11213 // track scrolling 11214 this.pointerDownScroll = getScrollPosition(); 11215 window.addEventListener( 'scroll', this ); 11216 11217 this.dispatchEvent( 'pointerDown', event, [ pointer ] ); 11218}; 11219 11220var touchStartEvents = { 11221 touchstart: true, 11222 MSPointerDown: true 11223}; 11224 11225var focusNodes = { 11226 INPUT: true, 11227 SELECT: true 11228}; 11229 11230proto.pointerDownFocus = function( event ) { 11231 // focus element, if not touch, and its not an input or select 11232 if ( !this.options.accessibility || touchStartEvents[ event.type ] || 11233 focusNodes[ event.target.nodeName ] ) { 11234 return; 11235 } 11236 var prevScrollY = window.pageYOffset; 11237 this.element.focus(); 11238 // hack to fix scroll jump after focus, #76 11239 if ( window.pageYOffset != prevScrollY ) { 11240 window.scrollTo( window.pageXOffset, prevScrollY ); 11241 } 11242}; 11243 11244proto.canPreventDefaultOnPointerDown = function( event ) { 11245 // prevent default, unless touchstart or <select> 11246 var isTouchstart = event.type == 'touchstart'; 11247 var targetNodeName = event.target.nodeName; 11248 return !isTouchstart && targetNodeName != 'SELECT'; 11249}; 11250 11251// ----- move ----- // 11252 11253proto.hasDragStarted = function( moveVector ) { 11254 return Math.abs( moveVector.x ) > this.options.dragThreshold; 11255}; 11256 11257// ----- up ----- // 11258 11259proto.pointerUp = function( event, pointer ) { 11260 delete this.isTouchScrolling; 11261 this.viewport.classList.remove('is-pointer-down'); 11262 this.dispatchEvent( 'pointerUp', event, [ pointer ] ); 11263 this._dragPointerUp( event, pointer ); 11264}; 11265 11266proto.pointerDone = function() { 11267 window.removeEventListener( 'scroll', this ); 11268 delete this.pointerDownScroll; 11269}; 11270 11271// -------------------------- dragging -------------------------- // 11272 11273proto.dragStart = function( event, pointer ) { 11274 this.dragStartPosition = this.x; 11275 this.startAnimation(); 11276 this.dispatchEvent( 'dragStart', event, [ pointer ] ); 11277}; 11278 11279proto.pointerMove = function( event, pointer ) { 11280 var moveVector = this._dragPointerMove( event, pointer ); 11281 this.dispatchEvent( 'pointerMove', event, [ pointer, moveVector ] ); 11282 this._dragMove( event, pointer, moveVector ); 11283}; 11284 11285proto.dragMove = function( event, pointer, moveVector ) { 11286 event.preventDefault(); 11287 11288 this.previousDragX = this.dragX; 11289 // reverse if right-to-left 11290 var direction = this.options.rightToLeft ? -1 : 1; 11291 var dragX = this.dragStartPosition + moveVector.x * direction; 11292 11293 if ( !this.options.wrapAround && this.slides.length ) { 11294 // slow drag 11295 var originBound = Math.max( -this.slides[0].target, this.dragStartPosition ); 11296 dragX = dragX > originBound ? ( dragX + originBound ) * 0.5 : dragX; 11297 var endBound = Math.min( -this.getLastSlide().target, this.dragStartPosition ); 11298 dragX = dragX < endBound ? ( dragX + endBound ) * 0.5 : dragX; 11299 } 11300 11301 this.dragX = dragX; 11302 11303 this.dragMoveTime = new Date(); 11304 this.dispatchEvent( 'dragMove', event, [ pointer, moveVector ] ); 11305}; 11306 11307proto.dragEnd = function( event, pointer ) { 11308 if ( this.options.freeScroll ) { 11309 this.isFreeScrolling = true; 11310 } 11311 // set selectedIndex based on where flick will end up 11312 var index = this.dragEndRestingSelect(); 11313 11314 if ( this.options.freeScroll && !this.options.wrapAround ) { 11315 // if free-scroll & not wrap around 11316 // do not free-scroll if going outside of bounding slides 11317 // so bounding slides can attract slider, and keep it in bounds 11318 var restingX = this.getRestingPosition(); 11319 this.isFreeScrolling = -restingX > this.slides[0].target && 11320 -restingX < this.getLastSlide().target; 11321 } else if ( !this.options.freeScroll && index == this.selectedIndex ) { 11322 // boost selection if selected index has not changed 11323 index += this.dragEndBoostSelect(); 11324 } 11325 delete this.previousDragX; 11326 // apply selection 11327 // TODO refactor this, selecting here feels weird 11328 // HACK, set flag so dragging stays in correct direction 11329 this.isDragSelect = this.options.wrapAround; 11330 this.select( index ); 11331 delete this.isDragSelect; 11332 this.dispatchEvent( 'dragEnd', event, [ pointer ] ); 11333}; 11334 11335proto.dragEndRestingSelect = function() { 11336 var restingX = this.getRestingPosition(); 11337 // how far away from selected slide
11338 var distance = Math.abs( this.getSlideDistance( -restingX, this.selectedIndex ) ); 11339 // get closet resting going up and going down 11340 var positiveResting = this._getClosestResting( restingX, distance, 1 ); 11341 var negativeResting = this._getClosestResting( restingX, distance, -1 ); 11342 // use closer resting for wrap-around 11343 var index = positiveResting.distance < negativeResting.distance ? 11344 positiveResting.index : negativeResting.index; 11345 return index; 11346}; 11347 11348/** 11349 * given resting X and distance to selected cell 11350 * get the distance and index of the closest cell 11351 * @param {Number} restingX - estimated post-flick resting position 11352 * @param {Number} distance - distance to selected cell 11353 * @param {Integer} increment - +1 or -1, going up or down 11354 * @returns {Object} - { distance: {Number}, index: {Integer} } 11355 */ 11356proto._getClosestResting = function( restingX, distance, increment ) { 11357 var index = this.selectedIndex; 11358 var minDistance = Infinity; 11359 var condition = this.options.contain && !this.options.wrapAround ? 11360 // if contain, keep going if distance is equal to minDistance 11361 function( d, md ) { return d <= md; } : function( d, md ) { return d < md; }; 11362 while ( condition( distance, minDistance ) ) { 11363 // measure distance to next cell 11364 index += increment; 11365 minDistance = distance; 11366 distance = this.getSlideDistance( -restingX, index ); 11367 if ( distance === null ) { 11368 break; 11369 } 11370 distance = Math.abs( distance ); 11371 } 11372 return { 11373 distance: minDistance, 11374 // selected was previous index 11375 index: index - increment 11376 }; 11377}; 11378 11379/** 11380 * measure distance between x and a slide target 11381 * @param {Number} x 11382 * @param {Integer} index - slide index 11383 */ 11384proto.getSlideDistance = function( x, index ) { 11385 var len = this.slides.length; 11386 // wrap around if at least 2 slides 11387 var isWrapAround = this.options.wrapAround && len > 1; 11388 var slideIndex = isWrapAround ? utils.modulo( index, len ) : index; 11389 var slide = this.slides[ slideIndex ]; 11390 if ( !slide ) { 11391 return null; 11392 } 11393 // add distance for wrap-around slides 11394 var wrap = isWrapAround ? this.slideableWidth * Math.floor( index / len ) : 0; 11395 return x - ( slide.target + wrap ); 11396}; 11397 11398proto.dragEndBoostSelect = function() { 11399 // do not boost if no previousDragX or dragMoveTime 11400 if ( this.previousDragX === undefined || !this.dragMoveTime || 11401 // or if drag was held for 100 ms 11402 new Date() - this.dragMoveTime > 100 ) { 11403 return 0; 11404 } 11405 11406 var distance = this.getSlideDistance( -this.dragX, this.selectedIndex ); 11407 var delta = this.previousDragX - this.dragX; 11408 if ( distance > 0 && delta > 0 ) { 11409 // boost to next if moving towards the right, and positive velocity 11410 return 1; 11411 } else if ( distance < 0 && delta < 0 ) { 11412 // boost to previous if moving towards the left, and negative velocity 11413 return -1; 11414 } 11415 return 0; 11416}; 11417 11418// ----- staticClick ----- // 11419 11420proto.staticClick = function( event, pointer ) { 11421 // get clickedCell, if cell was clicked 11422 var clickedCell = this.getParentCell( event.target ); 11423 var cellElem = clickedCell && clickedCell.element; 11424 var cellIndex = clickedCell && this.cells.indexOf( clickedCell ); 11425 this.dispatchEvent( 'staticClick', event, [ pointer, cellElem, cellIndex ] ); 11426}; 11427 11428// ----- scroll ----- // 11429 11430proto.onscroll = function() { 11431 var scroll = getScrollPosition(); 11432 var scrollMoveX = this.pointerDownScroll.x - scroll.x; 11433 var scrollMoveY = this.pointerDownScroll.y - scroll.y; 11434 // cancel click/tap if scroll is too much 11435 if ( Math.abs( scrollMoveX ) > 3 || Math.abs( scrollMoveY ) > 3 ) { 11436 this._pointerDone(); 11437 } 11438}; 11439 11440// ----- utils ----- // 11441 11442function getScrollPosition() { 11443 return { 11444 x: window.pageXOffset, 11445 y: window.pageYOffset 11446 }; 11447} 11448 11449// ----- ----- // 11450 11451return Flickity; 11452 11453})); 11454 11455/*! 11456 * Tap listener v2.0.0 11457 * listens to taps 11458 * MIT license 11459 */ 11460 11461/*jshint browser: true, unused: true, undef: true, strict: true */ 11462 11463( function( window, factory ) { 11464 // universal module definition 11465 /*jshint strict: false*/ /*globals define, module, require */ 11466 11467 if ( typeof define == 'function' && define.amd ) { 11468 // AMD 11469 define( 'tap-listener/tap-listener',[
11470 'unipointer/unipointer' 11471 ], function( Unipointer ) { 11472 return factory( window, Unipointer ); 11473 }); 11474 } else if ( typeof module == 'object' && module.exports ) { 11475 // CommonJS 11476 module.exports = factory( 11477 window, 11478 require('unipointer') 11479 ); 11480 } else { 11481 // browser global 11482 window.TapListener = factory( 11483 window, 11484 window.Unipointer 11485 ); 11486 } 11487 11488}( window, function factory( window, Unipointer ) { 11489 11490 11491 11492// -------------------------- TapListener -------------------------- // 11493 11494function TapListener( elem ) { 11495 this.bindTap( elem ); 11496} 11497 11498// inherit Unipointer & EventEmitter 11499var proto = TapListener.prototype = Object.create( Unipointer.prototype ); 11500 11501/** 11502 * bind tap event to element 11503 * @param {Element} elem 11504 */ 11505proto.bindTap = function( elem ) { 11506 if ( !elem ) { 11507 return; 11508 } 11509 this.unbindTap(); 11510 this.tapElement = elem; 11511 this._bindStartEvent( elem, true ); 11512}; 11513 11514proto.unbindTap = function() { 11515 if ( !this.tapElement ) { 11516 return; 11517 } 11518 this._bindStartEvent( this.tapElement, true ); 11519 delete this.tapElement; 11520}; 11521 11522/** 11523 * pointer up 11524 * @param {Event} event 11525 * @param {Event or Touch} pointer 11526 */ 11527proto.pointerUp = function( event, pointer ) { 11528 // ignore emulated mouse up clicks 11529 if ( this.isIgnoringMouseUp && event.type == 'mouseup' ) { 11530 return; 11531 } 11532 11533 var pointerPoint = Unipointer.getPointerPoint( pointer ); 11534 var boundingRect = this.tapElement.getBoundingClientRect(); 11535 var scrollX = window.pageXOffset; 11536 var scrollY = window.pageYOffset; 11537 // calculate if pointer is inside tapElement 11538 var isInside = pointerPoint.x >
11538= boundingRect.left + scrollX && 11539 pointerPoint.x <= boundingRect.right + scrollX && 11540 pointerPoint.y >= boundingRect.top + scrollY && 11541 pointerPoint.y <= boundingRect.bottom + scrollY; 11542 // trigger callback if pointer is inside element 11543 if ( isInside ) { 11544 this.emitEvent( 'tap', [ event, pointer ] ); 11545 } 11546 11547 // set flag for emulated clicks 300ms after touchend 11548 if ( event.type != 'mouseup' ) { 11549 this.isIgnoringMouseUp = true; 11550 // reset flag after 300ms 11551 var _this = this; 11552 setTimeout( function() { 11553 delete _this.isIgnoringMouseUp; 11554 }, 400 ); 11555 } 11556}; 11557 11558proto.destroy = function() { 11559 this.pointerDone(); 11560 this.unbindTap(); 11561}; 11562 11563// ----- ----- // 11564 11565return TapListener; 11566 11567})); 11568 11569// prev/next buttons 11570( function( window, factory ) { 11571 // universal module definition 11572 /* jshint strict: false */ 11573 if ( typeof define == 'function' && define.amd ) { 11574 // AMD 11575 define( 'flickity/js/prev-next-button',[ 11576 './flickity', 11577 'tap-listener/tap-listener', 11578 'fizzy-ui-utils/utils' 11579 ], function( Flickity, TapListener, utils ) { 11580 return factory( window, Flickity, TapListener, utils ); 11581 }); 11582 } else if ( typeof module == 'object' && module.exports ) { 11583 // CommonJS 11584 module.exports = factory( 11585 window, 11586 require('./flickity'), 11587 require('tap-listener'), 11588 require('fizzy-ui-utils') 11589 ); 11590 } else { 11591 // browser global 11592 factory( 11593 window, 11594 window.Flickity, 11595 window.TapListener, 11596 window.fizzyUIUtils 11597 ); 11598 } 11599 11600}( window, function factory( window, Flickity, TapListener, utils ) { 11601'use strict'; 11602 11603var svgURI = 'http://www.w3.org/2000/svg'; 11604 11605// -------------------------- PrevNextButton -------------------------- // 11606 11607function PrevNextButton( direction, parent ) { 11608 this.direction = direction; 11609 this.parent = parent; 11610 this._create(); 11611} 11612 11613PrevNextButton.prototype = new TapListener(); 11614 11615PrevNextButton.prototype._create = function() { 11616 // properties 11617 this.isEnabled = true; 11618 this.isPrevious = this.direction == -1; 11619 var leftDirection = this.parent.options.rightToLeft ? 1 : -1; 11620 this.isLeft = this.direction == leftDirection; 11621 11622 var element = this.element = document.createElement('button'); 11623 element.className = 'flickity-prev-next-button'; 11624 element.className += this.isPrevious ? ' previous' : ' next'; 11625 // prevent button from submitting form http://stackoverflow.com/a/10836076/182183 11626 element.setAttribute( 'type', 'button' ); 11627 // init as disabled 11628 this.disable(); 11629 11630 element.setAttribute( 'aria-label', this.isPrevious ? 'previous' : 'next' ); 11631 11632 // create arrow 11633 var svg = this.createSVG(); 11634 element.appendChild( svg ); 11635 // events 11636 this.on( 'tap', this.onTap ); 11637 this.parent.on( 'select', this.update.bind( this ) ); 11638 this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) ); 11639}; 11640 11641PrevNextButton.prototype.activate = function() { 11642 this.bindTap( this.element ); 11643 // click events from keyboard 11644 this.element.addEventListener( 'click', this ); 11645 // add to DOM 11646 this.parent.element.appendChild( this.element ); 11647}; 11648 11649PrevNextButton.prototype.deactivate = function() { 11650 // remove from DOM 11651 this.parent.element.removeChild( this.element ); 11652 // do regular TapListener destroy 11653 TapListener.prototype.destroy.call( this ); 11654 // click events from keyboard 11655 this.element.removeEventListener( 'click', this ); 11656}; 11657 11658PrevNextButton.prototype.createSVG = function() { 11659 var svg = document.createElementNS( svgURI, 'svg'); 11660 svg.setAttribute( 'viewBox', '0 0 100 100' ); 11661 var path = document.createElementNS( svgURI, 'path'); 11662 var pathMovements = getArrowMovements( this.parent.options.arrowShape ); 11663 path.setAttribute( 'd', pathMovements ); 11664 path.setAttribute( 'class', 'arrow' ); 11665 // rotate arrow 11666 if ( !this.isLeft ) { 11667 path.setAttribute( 'transform', 'translate(100, 100) rotate(180) ' ); 11668 } 11669 svg.appendChild( path ); 11670 return svg; 11671}; 11672 11673// get SVG path movmement 11674function getArrowMovements( shape ) { 11675 // use shape as movement if string 11676 if ( typeof shape == 'string' ) { 11677 return shape; 11678 } 11679 // create movement string 11680 return 'M ' + shape.x0 + ',50' + 11681 ' L ' + shape.x1 + ',' + ( shape.y1 + 50 ) + 11682 ' L ' + shape.x2 + ',' + ( shape.y2 + 50 ) + 11683 ' L ' + shape.x3 + ',50 ' + 11684 ' L ' + shape.x2 + ',' + ( 50 - shape.y2 ) + 11685 ' L ' + shape.x1 + ',' + ( 50 - shape.y1 ) + 11686 ' Z'; 11687} 11688 11689PrevNextButton.prototype.onTap = function() { 11690 if ( !this.isEnabled ) { 11691 return; 11692 } 11693 this.parent.uiChange(); 11694 var method = this.isPrevious ? 'previous' : 'next'; 11695 this.parent[ method ](); 11696}; 11697 11698PrevNextButton.prototype.handleEvent = utils.handleEvent; 11699 11700PrevNextButton.prototype.onclick = function() { 11701 // only allow clicks from keyboard 11702 var focused = document.activeElement;
11703 if ( focused && focused == this.element ) { 11704 this.onTap(); 11705 } 11706}; 11707 11708// ----- ----- // 11709 11710PrevNextButton.prototype.enable = function() { 11711 if ( this.isEnabled ) { 11712 return; 11713 } 11714 this.element.disabled = false; 11715 this.isEnabled = true; 11716}; 11717 11718PrevNextButton.prototype.disable = function() { 11719 if ( !this.isEnabled ) { 11720 return; 11721 } 11722 this.element.disabled = true; 11723 this.isEnabled = false; 11724}; 11725 11726PrevNextButton.prototype.update = function() { 11727 // index of first or last slide, if previous or next 11728 var slides = this.parent.slides; 11729 // enable is wrapAround and at least 2 slides 11730 if ( this.parent.options.wrapAround && slides.length > 1 ) { 11731 this.enable(); 11732 return; 11733 } 11734 var lastIndex = slides.length ? slides.length - 1 : 0; 11735 var boundIndex = this.isPrevious ? 0 : lastIndex; 11736 var method = this.parent.selectedIndex == boundIndex ? 'disable' : 'enable'; 11737 this[ method ](); 11738}; 11739 11740PrevNextButton.prototype.destroy = function() { 11741 this.deactivate(); 11742}; 11743 11744// -------------------------- Flickity prototype -------------------------- // 11745 11746utils.extend( Flickity.defaults, { 11747 prevNextButtons: true, 11748 arrowShape: { 11749 x0: 10, 11750 x1: 60, y1: 50, 11751 x2: 70, y2: 40, 11752 x3: 30 11753 } 11754}); 11755 11756Flickity.createMethods.push('_createPrevNextButtons'); 11757var proto = Flickity.prototype; 11758 11759proto._createPrevNextButtons = function() { 11760 if ( !this.options.prevNextButtons ) { 11761 return; 11762 } 11763 11764 this.prevButton = new PrevNextButton( -1, this ); 11765 this.nextButton = new PrevNextButton( 1, this ); 11766 11767 this.on( 'activate', this.activatePrevNextButtons ); 11768}; 11769 11770proto.activatePrevNextButtons = function() { 11771 this.prevButton.activate(); 11772 this.nextButton.activate(); 11773 this.on( 'deactivate', this.deactivatePrevNextButtons ); 11774}; 11775 11776proto.deactivatePrevNextButtons = function() { 11777 this.prevButton.deactivate(); 11778 this.nextButton.deactivate(); 11779 this.off( 'deactivate', this.deactivatePrevNextButtons ); 11780}; 11781 11782// -------------------------- -------------------------- // 11783 11784Flickity.PrevNextButton = PrevNextButton; 11785 11786return Flickity; 11787 11788})); 11789 11790// page dots 11791( function( window, factory ) { 11792 // universal module definition 11793 /* jshint strict: false */ 11794 if ( typeof define == 'function' && define.amd ) { 11795 // AMD 11796 define( 'flickity/js/page-dots',[ 11797 './flickity', 11798 'tap-listener/tap-listener', 11799 'fizzy-ui-utils/utils' 11800 ], function( Flickity, TapListener, utils ) { 11801 return factory( window, Flickity, TapListener, utils ); 11802 }); 11803 } else if ( typeof module == 'object' && module.exports ) { 11804 // CommonJS 11805 module.exports = factory( 11806 window, 11807 require('./flickity'), 11808 require('tap-listener'), 11809 require('fizzy-ui-utils') 11810 ); 11811 } else { 11812 // browser global 11813 factory( 11814 window, 11815 window.Flickity, 11816 window.TapListener, 11817 window.fizzyUIUtils 11818 ); 11819 } 11820 11821}( window, function factory( window, Flickity, TapListener, utils ) { 11822 11823// -------------------------- PageDots -------------------------- // 11824 11825 11826 11827function PageDots( parent ) { 11828 this.parent = parent; 11829 this._create(); 11830} 11831 11832PageDots.prototype = new TapListener(); 11833 11834PageDots.prototype._create = function() { 11835 // create holder element 11836 this.holder = document.createElement('ol'); 11837 this.holder.className = 'flickity-page-dots'; 11838 // create dots, array of elements 11839 this.dots = []; 11840 // events 11841 this.on( 'tap', this.onTap ); 11842 this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) ); 11843}; 11844 11845PageDots.prototype.activate = function() { 11846 this.setDots(); 11847 this.bindTap( this.holder ); 11848 // add to DOM 11849 this.parent.element.appendChild( this.holder ); 11850}; 11851 11852PageDots.prototype.deactivate = function() { 11853 // remove from DOM 11854 this.parent.element.removeChild( this.holder ); 11855 TapListener.prototype.destroy.call( this ); 11856}; 11857 11858PageDots.prototype.setDots = function() { 11859 // get difference between number of slides and number of dots 11860 var delta = this.parent.slides.length - this.dots.length; 11861 if ( delta > 0 ) { 11862 this.addDots( delta ); 11863 } else if ( delta < 0 ) { 11864 this.removeDots( -delta ); 11865 } 11866}; 11867 11868PageDots.prototype.addDots = function( count ) { 11869 var fragment = document.createDocumentFragment(); 11870 var newDots = []; 11871 while ( count ) { 11872 var dot = document.createElement('li'); 11873 dot.className = 'dot'; 11874 fragment.appendChild( dot ); 11875 newDots.push( dot ); 11876 count--; 11877 } 11878 this.holder.appendChild( fragment ); 11879 this.dots = this.dots.concat( newDots ); 11880}; 11881 11882PageDots.prototype.removeDots = function( count ) { 11883 // remove from this.dots collection 11884 var removeDots = this.dots.splice( this.dots.length - count, count ); 11885 // remove from DOM
11886 removeDots.forEach( function( dot ) { 11887 this.holder.removeChild( dot ); 11888 }, this ); 11889}; 11890 11891PageDots.prototype.updateSelected = function() { 11892 // remove selected class on previous 11893 if ( this.selectedDot ) { 11894 this.selectedDot.className = 'dot'; 11895 } 11896 // don't proceed if no dots 11897 if ( !this.dots.length ) { 11898 return; 11899 } 11900 this.selectedDot = this.dots[ this.parent.selectedIndex ]; 11901 this.selectedDot.className = 'dot is-selected'; 11902}; 11903 11904PageDots.prototype.onTap = function( event ) { 11905 var target = event.target; 11906 // only care about dot clicks 11907 if ( target.nodeName != 'LI' ) { 11908 return; 11909 } 11910 11911 this.parent.uiChange(); 11912 var index = this.dots.indexOf( target ); 11913 this.parent.select( index ); 11914}; 11915 11916PageDots.prototype.destroy = function() { 11917 this.deactivate(); 11918}; 11919 11920Flickity.PageDots = PageDots; 11921 11922// -------------------------- Flickity -------------------------- // 11923 11924utils.extend( Flickity.defaults, { 11925 pageDots: true 11926}); 11927 11928Flickity.createMethods.push('_createPageDots'); 11929 11930var proto = Flickity.prototype; 11931 11932proto._createPageDots = function() { 11933 if ( !this.options.pageDots ) { 11934 return; 11935 } 11936 this.pageDots = new PageDots( this ); 11937 // events 11938 this.on( 'activate', this.activatePageDots ); 11939 this.on( 'select', this.updateSelectedPageDots ); 11940 this.on( 'cellChange', this.updatePageDots ); 11941 this.on( 'resize', this.updatePageDots ); 11942 this.on( 'deactivate', this.deactivatePageDots ); 11943}; 11944 11945proto.activatePageDots = function() { 11946 this.pageDots.activate(); 11947}; 11948 11949proto.updateSelectedPageDots = function() { 11950 this.pageDots.updateSelected(); 11951}; 11952 11953proto.updatePageDots = function() { 11954 this.pageDots.setDots(); 11955}; 11956 11957proto.deactivatePageDots = function() { 11958 this.pageDots.deactivate(); 11959}; 11960 11961// ----- ----- // 11962 11963Flickity.PageDots = PageDots; 11964 11965return Flickity; 11966 11967})); 11968 11969// player & autoPlay 11970( function( window, factory ) { 11971 // universal module definition 11972 /* jshint strict: false */ 11973 if ( typeof define == 'function' && define.amd ) { 11974 // AMD 11975 define( 'flickity/js/player',[ 11976 'ev-emitter/ev-emitter', 11977 'fizzy-ui-utils/utils', 11978 './flickity' 11979 ], function( EvEmitter, utils, Flickity ) { 11980 return factory( EvEmitter, utils, Flickity ); 11981 }); 11982 } else if ( typeof module == 'object' && module.exports ) { 11983 // CommonJS 11984 module.exports = factory( 11985 require('ev-emitter'), 11986 require('fizzy-ui-utils'), 11987 require('./flickity') 11988 ); 11989 } else { 11990 // browser global 11991 factory( 11992 window.EvEmitter, 11993 window.fizzyUIUtils, 11994 window.Flickity 11995 ); 11996 } 11997 11998}( window, function factory( EvEmitter, utils, Flickity ) { 11999 12000 12001 12002// -------------------------- Page Visibility -------------------------- // 12003// https://developer.mozilla.org/en-US/docs/Web/Guide/User_experience/Using_the_Page_Visibility_API 12004 12005var hiddenProperty, visibilityEvent; 12006if ( 'hidden' in document ) { 12007 hiddenProperty = 'hidden'; 12008 visibilityEvent = 'visibilitychange'; 12009} else if ( 'webkitHidden' in document ) { 12010 hiddenProperty = 'webkitHidden'; 12011 visibilityEvent = 'webkitvisibilitychange'; 12012} 12013 12014// -------------------------- Player -------------------------- // 12015 12016function Player( parent ) { 12017 this.parent = parent; 12018 this.state = 'stopped'; 12019 // visibility change event handler 12020 if ( visibilityEvent ) { 12021 this.onVisibilityChange = function() { 12022 this.visibilityChange(); 12023 }.bind( this ); 12024 this.onVisibilityPlay = function() { 12025 this.visibilityPlay(); 12026 }.bind( this ); 12027 } 12028} 12029 12030Player.prototype = Object.create( EvEmitter.prototype ); 12031 12032// start play 12033Player.prototype.play = function() { 12034 if ( this.state == 'playing' ) { 12035 return; 12036 } 12037 // do not play if page is hidden, start playing when page is visible 12038 var isPageHidden = document[ hiddenProperty ]; 12039 if ( visibilityEvent && isPageHidden ) { 12040 document.addEventListener( visibilityEvent, this.onVisibilityPlay ); 12041 return; 12042 } 12043 12044 this.state = 'playing'; 12045 // listen to visibility change 12046 if ( visibilityEvent ) { 12047 document.addEventListener( visibilityEvent, this.onVisibilityChange ); 12048 } 12049 // start ticking 12050 this.tick(); 12051}; 12052 12053Player.prototype.tick = function() { 12054 // do not tick if not playing 12055 if ( this.state != 'playing' ) { 12056 return; 12057 } 12058 12059 var time = this.parent.options.autoPlay; 12060 // default to 3 seconds 12061 time = typeof time == 'number' ? time : 3000; 12062 var _this = this; 12063 // HACK: reset ticks if stopped and started within interval 12064 this.clear(); 12065 this.timeout = setTimeout( function() { 12066 _this.parent.next( true ); 12067 _this.tick(); 12068 }, time ); 12069}; 12070 12071Player.prototype.stop = function() { 12072 this.state = 'stopped'; 12073 this.clear(); 12074 // remove visibility change event 12075 if ( visibilityEvent ) { 12076 document.removeEventListener( visibilityEvent, this.onVisibilityChange ); 12077 } 12078}; 12079 12080Player.prototype.clear = function() { 12081 clearTimeout( this.timeout ); 12082}; 12083 12084Player.prototype.pause = function() { 12085 if ( this.state == 'playing' ) { 12086 this.state = 'paused'; 12087 this.clear(); 12088 } 12089}; 12090 12091Player.prototype.unpause = function() { 12092 // re-start play if paused 12093 if ( this.state == 'paused' ) { 12094 this.play(); 12095 } 12096}; 12097 12098// pause if page visibility is hidden, unpause if visible 12099Player.prototype.visibilityChange = function() { 12100 var isPageHidden = document[ hiddenProperty ]; 12101 this[ isPageHidden ? 'pause' : 'unpause' ](); 12102}; 12103 12104Player.prototype.visibilityPlay = function() { 12105 this.play(); 12106 document.removeEventListener( visibilityEvent, this.onVisibilityPlay ); 12107}; 12108 12109// -------------------------- Flickity -------------------------- // 12110 12111utils.extend( Flickity.defaults, { 12112 pauseAutoPlayOnHover: true 12113}); 12114 12115Flickity.createMethods.push('_createPlayer'); 12116var proto = Flickity.prototype; 12117 12118proto._createPlayer = function() { 12119 this.player = new Player( this ); 12120 12121 this.on( 'activate', this.activatePlayer ); 12122 this.on( 'uiChange', this.stopPlayer ); 12123 this.on( 'pointerDown', this.stopPlayer ); 12124 this.on( 'deactivate', this.deactivatePlayer ); 12125}; 12126 12127proto.activatePlayer = function() { 12128 if ( !this.options.autoPlay ) { 12129 return; 12130 } 12131 this.player.play(); 12132 this.element.addEventListener( 'mouseenter', this ); 12133}; 12134 12135// Player API, don't hate the ... thanks I know where the door is 12136 12137proto.playPlayer = function() { 12138 this.player.play(); 12139}; 12140 12141proto.stopPlayer = function() { 12142 this.player.stop(); 12143}; 12144 12145proto.pausePlayer = function() { 12146 this.player.pause(); 12147}; 12148 12149proto.unpausePlayer = function() { 12150 this.player.unpause(); 12151}; 12152 12153proto.deactivatePlayer = function() { 12154 this.player.stop(); 12155 this.element.removeEventListener( 'mouseenter', this ); 12156}; 12157 12158// ----- mouseenter/leave ----- // 12159 12160// pause auto-play on hover 12161proto.onmouseenter = function() { 12162 if ( !this.options.pauseAutoPlayOnHover ) { 12163 return; 12164 } 12165 this.player.pause(); 12166 this.element.addEventListener( 'mouseleave', this ); 12167}; 12168 12169// resume auto-play on hover off 12170proto.onmouseleave = function() { 12171 this.player.unpause(); 12172 this.element.removeEventListener( 'mouseleave', this ); 12173}; 12174 12175// ----- ----- // 12176 12177Flickity.Player = Player; 12178 12179return Flickity; 12180 12181})); 12182 12183// add, remove cell 12184( function( window, factory ) { 12185 // universal module definition 12186 /* jshint strict: false */ 12187 if ( typeof define == 'function' && define.amd ) { 12188 // AMD 12189 define( 'flickity/js/add-remove-cell',[ 12190 './flickity', 12191 'fizzy-ui-utils/utils' 12192 ], function( Flickity, utils ) { 12193 return factory( window, Flickity, utils ); 12194 }); 12195 } else if ( typeof module == 'object' && module.exports ) { 12196 // CommonJS 12197 module.exports = factory( 12198 window, 12199 require('./flickity'), 12200 require('fizzy-ui-utils') 12201 ); 12202 } else { 12203 // browser global 12204 factory( 12205 window, 12206 window.Flickity, 12207 window.fizzyUIUtils 12208 ); 12209 } 12210 12211}( window, function factory( window, Flickity, utils ) { 12212 12213 12214 12215// append cells to a document fragment 12216function getCellsFragment( cells ) { 12217 var fragment = document.createDocumentFragment();
12218 cells.forEach( function( cell ) { 12219 fragment.appendChild( cell.element ); 12220 }); 12221 return fragment; 12222} 12223 12224// -------------------------- add/remove cell prototype -------------------------- // 12225 12226var proto = Flickity.prototype; 12227 12228/** 12229 * Insert, prepend, or append cells 12230 * @param {Element, Array, NodeList} elems 12231 * @param {Integer} index 12232 */ 12233proto.insert = function( elems, index ) { 12234 var cells = this._makeCells( elems ); 12235 if ( !cells || !cells.length ) { 12236 return; 12237 } 12238 var len = this.cells.length; 12239 // default to append 12240 index = index === undefined ? len : index; 12241 // add cells with document fragment 12242 var fragment = getCellsFragment( cells ); 12243 // append to slider 12244 var isAppend = index == len; 12245 if ( isAppend ) { 12246 this.slider.appendChild( fragment ); 12247 } else { 12248 var insertCellElement = this.cells[ index ].element; 12249 this.slider.insertBefore( fragment, insertCellElement ); 12250 } 12251 // add to this.cells 12252 if ( index === 0 ) { 12253 // prepend, add to start 12254 this.cells = cells.concat( this.cells ); 12255 } else if ( isAppend ) { 12256 // append, add to end 12257 this.cells = this.cells.concat( cells ); 12258 } else { 12259 // insert in this.cells 12260 var endCells = this.cells.splice( index, len - index ); 12261 this.cells = this.cells.concat( cells ).concat( endCells ); 12262 } 12263 12264 this._sizeCells( cells ); 12265 12266 var selectedIndexDelta = index > this.selectedIndex ? 0 : cells.length; 12267 this._cellAddedRemoved( index, selectedIndexDelta ); 12268}; 12269 12270proto.append = function( elems ) { 12271 this.insert( elems, this.cells.length ); 12272}; 12273 12274proto.prepend = function( elems ) { 12275 this.insert( elems, 0 ); 12276}; 12277 12278/** 12279 * Remove cells 12280 * @param {Element, Array, NodeList} elems 12281 */ 12282proto.remove = function( elems ) { 12283 var cells = this.getCells( elems ); 12284 var selectedIndexDelta = 0; 12285 var len = cells.length; 12286 var i, cell; 12287 // calculate selectedIndexDelta, easier if done in seperate loop 12288 for ( i=0; i < len; i++ ) { 12289 cell = cells[i]; 12290 var wasBefore = this.cells.indexOf( cell ) < this.selectedIndex; 12291 selectedIndexDelta -= wasBefore ? 1 : 0; 12292 } 12293 12294 for ( i=0; i < len; i++ ) { 12295 cell = cells[i]; 12296 cell.remove(); 12297 // remove item from collection 12298 utils.removeFrom( this.cells, cell ); 12299 } 12300 12301 if ( cells.length ) { 12302 // update stuff 12303 this._cellAddedRemoved( 0, selectedIndexDelta ); 12304 } 12305}; 12306 12307// updates when cells are added or removed 12308proto._cellAddedRemoved = function( changedCellIndex, selectedIndexDelta ) { 12309 // TODO this math isn't perfect with grouped slides 12310 selectedIndexDelta = selectedIndexDelta || 0; 12311 this.selectedIndex += selectedIndexDelta; 12312 this.selectedIndex = Math.max( 0, Math.min( this.slides.length - 1, this.selectedIndex ) ); 12313 12314 this.cellChange( changedCellIndex, true ); 12315 // backwards compatibility 12316 this.emitEvent( 'cellAddedRemoved', [ changedCellIndex, selectedIndexDelta ] ); 12317}; 12318 12319/** 12320 * logic to be run after a cell's size changes 12321 * @param {Element} elem - cell's element 12322 */ 12323proto.cellSizeChange = function( elem ) { 12324 var cell = this.getCell( elem ); 12325 if ( !cell ) { 12326 return; 12327 } 12328 cell.getSize(); 12329 12330 var index = this.cells.indexOf( cell ); 12331 this.cellChange( index ); 12332}; 12333 12334/** 12335 * logic any time a cell is changed: added, removed, or size changed 12336 * @param {Integer} changedCellIndex - index of the changed cell, optional 12337 */ 12338proto.cellChange = function( changedCellIndex, isPositioningSlider ) { 12339 var prevSlideableWidth = this.slideableWidth; 12340 this._positionCells( changedCellIndex ); 12341 this._getWrapShiftCells(); 12342 this.setGallerySize(); 12343 this.emitEvent( 'cellChange', [ changedCellIndex ] ); 12344 // position slider 12345 if ( this.options.freeScroll ) { 12346 // shift x by change in slideableWidth 12347 // TODO fix position shifts when prepending w/ freeScroll 12348 var deltaX = prevSlideableWidth - this.slideableWidth; 12349 this.x += deltaX * this.cellAlign; 12350 this.positionSlider(); 12351 } else { 12352 // do not position slider after lazy load 12353 if ( isPositioningSlider ) { 12354 this.positionSliderAtSelected(); 12355 } 12356 this.select( this.selectedIndex ); 12357 } 12358}; 12359 12360// ----- ----- // 12361 12362return Flickity; 12363 12364})); 12365 12366// lazyload 12367( function( window, factory ) { 12368 // universal module definition 12369 /* jshint strict: false */ 12370 if ( typeof define == 'function' && define.amd ) { 12371 // AMD 12372 define( 'flickity/js/lazyload',[ 12373 './flickity', 12374 'fizzy-ui-utils/utils' 12375 ], function( Flickity, utils ) { 12376 return factory( window, Flickity, utils ); 12377 }); 12378 } else if ( typeof module == 'object' && module.exports ) { 12379 // CommonJS 12380 module.exports = factory( 12381 window, 12382 require('./flickity'), 12383 require('fizzy-ui-utils') 12384 ); 12385 } else { 12386 // browser global 12387 factory( 12388 window, 12389 window.Flickity, 12390 window.fizzyUIUtils 12391 ); 12392 } 12393 12394}( window, function factory( window, Flickity, utils ) { 12395'use strict'; 12396 12397Flickity.createMethods.push('_createLazyload'); 12398var proto = Flickity.prototype; 12399 12400proto._createLazyload = function() { 12401 this.on( 'select', this.lazyLoad ); 12402}; 12403 12404proto.lazyLoad = function() { 12405 var lazyLoad = this.options.lazyLoad; 12406 if ( !lazyLoad ) { 12407 return; 12408 } 12409 // get adjacent cells, use lazyLoad option for adjacent count 12410 var adjCount = typeof lazyLoad == 'number' ? lazyLoad : 0; 12411 var cellElems = this.getAdjacentCellElements( adjCount ); 12412 // get lazy images in those cells 12413 var lazyImages = [];
12414 cellElems.forEach( function( cellElem ) { 12415 var lazyCellImages = getCellLazyImages( cellElem ); 12416 lazyImages = lazyImages.concat( lazyCellImages ); 12417 }); 12418 // load lazy images 12419 lazyImages.forEach( function( img ) { 12420 new LazyLoader( img, this ); 12421 }, this ); 12422}; 12423 12424function getCellLazyImages( cellElem ) { 12425 // check if cell element is lazy image 12426 if ( cellElem.nodeName == 'IMG' && 12427 cellElem.getAttribute('data-flickity-lazyload') ) { 12428 return [ cellElem ]; 12429 } 12430 // select lazy images in cell 12431 var imgs = cellElem.querySelectorAll('img[data-flickity-lazyload]'); 12432 return utils.makeArray( imgs ); 12433} 12434 12435// -------------------------- LazyLoader -------------------------- // 12436 12437/** 12438 * class to handle loading images 12439 */ 12440function LazyLoader( img, flickity ) { 12441 this.img = img; 12442 this.flickity = flickity; 12443 this.load(); 12444} 12445 12446LazyLoader.prototype.handleEvent = utils.handleEvent; 12447 12448LazyLoader.prototype.load = function() { 12449 this.img.addEventListener( 'load', this ); 12450 this.img.addEventListener( 'error', this ); 12451 // load image 12452 this.img.src = this.img.getAttribute('data-flickity-lazyload'); 12453 // remove attr 12454 this.img.removeAttribute('data-flickity-lazyload'); 12455}; 12456 12457LazyLoader.prototype.onload = function( event ) { 12458 this.complete( event, 'flickity-lazyloaded' ); 12459}; 12460 12461LazyLoader.prototype.onerror = function( event ) { 12462 this.complete( event, 'flickity-lazyerror' ); 12463}; 12464 12465LazyLoader.prototype.complete = function( event, className ) { 12466 // unbind events 12467 this.img.removeEventListener( 'load', this ); 12468 this.img.removeEventListener( 'error', this ); 12469 12470 var cell = this.flickity.getParentCell( this.img ); 12471 var cellElem = cell && cell.element; 12472 this.flickity.cellSizeChange( cellElem ); 12473 12474 this.img.classList.add( className ); 12475 this.flickity.dispatchEvent( 'lazyLoad', event, cellElem ); 12476}; 12477 12478// ----- ----- // 12479 12480Flickity.LazyLoader = LazyLoader; 12481 12482return Flickity; 12483 12484})); 12485 12486/*! 12487 * Flickity v2.0.4 12488 * Touch, responsive, flickable carousels 12489 * 12490 * Licensed GPLv3 for open source use 12491 * or Flickity Commercial License for commercial use 12492 * 12493 * http://flickity.metafizzy.co 12494 * Copyright 2016 Metafizzy 12495 */ 12496 12497( function( window, factory ) { 12498 // universal module definition 12499 /* jshint strict: false */ 12500 if ( typeof define == 'function' && define.amd ) { 12501 // AMD 12502 define( 'flickity/js/index',[ 12503 './flickity', 12504 './drag', 12505 './prev-next-button', 12506 './page-dots', 12507 './player', 12508 './add-remove-cell', 12509 './lazyload' 12510 ], factory ); 12511 } else if ( typeof module == 'object' && module.exports ) { 12512 // CommonJS 12513 module.exports = factory( 12514 require('./flickity'), 12515 require('./drag'), 12516 require('./prev-next-button'), 12517 require('./page-dots'), 12518 require('./player'), 12519 require('./add-remove-cell'), 12520 require('./lazyload') 12521 ); 12522 } 12523 12524})( window, function factory( Flickity ) { 12525 /*jshint strict: false*/ 12526 return Flickity; 12527}); 12528 12529/*! 12530 * Flickity asNavFor v2.0.1 12531 * enable asNavFor for Flickity 12532 */ 12533 12534/*jshint browser: true, undef: true, unused: true, strict: true*/ 12535 12536( function( window, factory ) { 12537 // universal module definition 12538 /*jshint strict: false */ /*globals define, module, require */ 12539 if ( typeof define == 'function' && define.amd ) { 12540 // AMD 12541 define( 'flickity-as-nav-for/as-nav-for',[ 12542 'flickity/js/index', 12543 'fizzy-ui-utils/utils' 12544 ], factory ); 12545 } else if ( typeof module == 'object' && module.exports ) { 12546 // CommonJS 12547 module.exports = factory( 12548 require('flickity'), 12549 require('fizzy-ui-utils') 12550 ); 12551 } else { 12552 // browser global 12553 window.Flickity = factory( 12554 window.Flickity, 12555 window.fizzyUIUtils 12556 ); 12557 } 12558 12559}( window, function factory( Flickity, utils ) { 12560 12561 12562 12563// -------------------------- asNavFor prototype -------------------------- // 12564 12565// Flickity.defaults.asNavFor = null; 12566 12567Flickity.createMethods.push('_createAsNavFor'); 12568 12569var proto = Flickity.prototype; 12570 12571proto._createAsNavFor = function() { 12572 this.on( 'activate', this.activateAsNavFor ); 12573 this.on( 'deactivate', this.deactivateAsNavFor ); 12574 this.on( 'destroy', this.destroyAsNavFor ); 12575 12576 var asNavForOption = this.options.asNavFor; 12577 if ( !asNavForOption ) { 12578 return; 12579 } 12580 // HACK do async, give time for other flickity to be initalized 12581 var _this = this; 12582 setTimeout( function initNavCompanion() { 12583 _this.setNavCompanion( asNavForOption ); 12584 }); 12585}; 12586 12587proto.setNavCompanion = function( elem ) { 12588 elem = utils.getQueryElement( elem ); 12589 var companion = Flickity.data( elem ); 12590 // stop if no companion or companion is self 12591 if ( !companion || companion == this ) { 12592 return; 12593 } 12594 12595 this.navCompanion = companion; 12596 // companion select 12597 var _this = this; 12598 this.onNavCompanionSelect = function() { 12599 _this.navCompanionSelect(); 12600 }; 12601 companion.on( 'select', this.onNavCompanionSelect ); 12602 // click 12603 this.on( 'staticClick', this.onNavStaticClick ); 12604 12605 this.navCompanionSelect( true ); 12606}; 12607 12608proto.navCompanionSelect = function( isInstant ) { 12609 if ( !this.navCompanion ) { 12610 return; 12611 } 12612 // select slide that matches first cell of slide 12613 var selectedCell = this.navCompanion.selectedCells[0]; 12614 var firstIndex = this.navCompanion.cells.indexOf( selectedCell ); 12615 var lastIndex = firstIndex + this.navCompanion.selectedCells.length - 1; 12616 var selectIndex = Math.floor( lerp( firstIndex, lastIndex, 12617 this.navCompanion.cellAlign ) ); 12618 this.selectCell( selectIndex, false, isInstant ); 12619 // set nav selected class 12620 this.removeNavSelectedElements();
12621 // stop if companion has more cells than this one 12622 if ( selectIndex >= this.cells.length ) { 12623 return; 12624 } 12625 12626 var selectedCells = this.cells.slice( firstIndex, lastIndex + 1 ); 12627 this.navSelectedElements = selectedCells.map( function( cell ) { 12628 return cell.element; 12629 }); 12630 this.changeNavSelectedClass('add'); 12631}; 12632 12633function lerp( a, b, t ) { 12634 return ( b - a ) * t + a; 12635} 12636 12637proto.changeNavSelectedClass = function( method ) { 12638 this.navSelectedElements.forEach( function( navElem ) { 12639 navElem.classList[ method ]('is-nav-selected'); 12640 }); 12641}; 12642 12643proto.activateAsNavFor = function() { 12644 this.navCompanionSelect( true ); 12645}; 12646 12647proto.removeNavSelectedElements = function() { 12648 if ( !this.navSelectedElements ) { 12649 return; 12650 } 12651 this.changeNavSelectedClass('remove'); 12652 delete this.navSelectedElements; 12653}; 12654 12655proto.onNavStaticClick = function( event, pointer, cellElement, cellIndex ) { 12656 if ( typeof cellIndex == 'number' ) { 12657 this.navCompanion.selectCell( cellIndex ); 12658 } 12659}; 12660 12661proto.deactivateAsNavFor = function() { 12662 this.removeNavSelectedElements(); 12663}; 12664 12665proto.destroyAsNavFor = function() { 12666 if ( !this.navCompanion ) { 12667 return; 12668 } 12669 this.navCompanion.off( 'select', this.onNavCompanionSelect ); 12670 this.off( 'staticClick', this.onNavStaticClick ); 12671 delete this.navCompanion; 12672}; 12673 12674// ----- ----- // 12675 12676return Flickity; 12677 12678})); 12679 12680/*! 12681 * imagesLoaded v4.1.1 12682 * JavaScript is all like "You images are done yet or what?" 12683 * MIT License 12684 */ 12685 12686( function( window, factory ) { 'use strict'; 12687 // universal module definition 12688 12689 /*global define: false, module: false, require: false */ 12690 12691 if ( typeof define == 'function' && define.amd ) { 12692 // AMD 12693 define( 'imagesloaded/imagesloaded',[ 12694 'ev-emitter/ev-emitter' 12695 ], function( EvEmitter ) { 12696 return factory( window, EvEmitter ); 12697 }); 12698 } else if ( typeof module == 'object' && module.exports ) { 12699 // CommonJS 12700 module.exports = factory( 12701 window, 12702 require('ev-emitter') 12703 ); 12704 } else { 12705 // browser global 12706 window.imagesLoaded = factory( 12707 window, 12708 window.EvEmitter 12709 ); 12710 } 12711 12712})( window, 12713 12714// -------------------------- factory -------------------------- // 12715 12716function factory( window, EvEmitter ) { 12717 12718 12719 12720var $ = window.jQuery; 12721var console = window.console; 12722 12723// -------------------------- helpers -------------------------- // 12724 12725// extend objects 12726function extend( a, b ) { 12727 for ( var prop in b ) { 12728 a[ prop ] = b[ prop ]; 12729 } 12730 return a; 12731} 12732 12733// turn element or nodeList into an array 12734function makeArray( obj ) { 12735 var ary = []; 12736 if ( Array.isArray( obj ) ) { 12737 // use object if already an array 12738 ary = obj; 12739 } else if ( typeof obj.length == 'number' ) { 12740 // convert nodeList to array 12741 for ( var i=0; i < obj.length; i++ ) { 12742 ary.push( obj[i] ); 12743 } 12744 } else { 12745 // array of single index 12746 ary.push( obj ); 12747 } 12748 return ary; 12749} 12750 12751// -------------------------- imagesLoaded -------------------------- // 12752 12753/** 12754 * @param {Array, Element, NodeList, String} elem 12755 * @param {Object or Function} options - if function, use as callback 12756 * @param {Function} onAlways - callback function 12757 */ 12758function ImagesLoaded( elem, options, onAlways ) { 12759 // coerce ImagesLoaded() without new, to be new ImagesLoaded() 12760 if ( !( this instanceof ImagesLoaded ) ) { 12761 return new ImagesLoaded( elem, options, onAlways ); 12762 } 12763 // use elem as selector string 12764 if ( typeof elem == 'string' ) { 12765 elem = document.querySelectorAll( elem ); 12766 } 12767 12768 this.elements = makeArray( elem ); 12769 this.options = extend( {}, this.options ); 12770 12771 if ( typeof options == 'function' ) { 12772 onAlways = options; 12773 } else { 12774 extend( this.options, options ); 12775 } 12776 12777 if ( onAlways ) { 12778 this.on( 'always', onAlways ); 12779 } 12780 12781 this.getImages(); 12782 12783 if ( $ ) { 12784 // add jQuery Deferred object 12785 this.jqDeferred = new $.Deferred(); 12786 } 12787 12788 // HACK check async to allow time to bind listeners 12789 setTimeout( function() { 12790 this.check(); 12791 }.bind( this )); 12792} 12793 12794ImagesLoaded.prototype = Object.create( EvEmitter.prototype ); 12795 12796ImagesLoaded.prototype.options = {}; 12797 12798ImagesLoaded.prototype.getImages = function() { 12799 this.images = []; 12800 12801 // filter & find items if we have an item selector
vendor: 4,347 bytes, lines 12802-12958
12802 this.elements.forEach( this.addElementImages, this ); 12803}; 12804 12805/** 12806 * @param {Node} element 12807 */ 12808ImagesLoaded.prototype.addElementImages = function( elem ) { 12809 // filter siblings 12810 if ( elem.nodeName == 'IMG' ) { 12811 this.addImage( elem ); 12812 } 12813 // get background image on element 12814 if ( this.options.background === true ) { 12815 this.addElementBackgroundImages( elem ); 12816 } 12817 12818 // find children 12819 // no non-element nodes, #143 12820 var nodeType = elem.nodeType; 12821 if ( !nodeType || !elementNodeTypes[ nodeType ] ) { 12822 return; 12823 } 12824 var childImgs = elem.querySelectorAll('img'); 12825 // concat childElems to filterFound array 12826 for ( var i=0; i < childImgs.length; i++ ) { 12827 var img = childImgs[i]; 12828 this.addImage( img ); 12829 } 12830 12831 // get child background images 12832 if ( typeof this.options.background == 'string' ) { 12833 var children = elem.querySelectorAll( this.options.background ); 12834 for ( i=0; i < children.length; i++ ) { 12835 var child = children[i]; 12836 this.addElementBackgroundImages( child ); 12837 } 12838 } 12839}; 12840 12841var elementNodeTypes = { 12842 1: true, 12843 9: true, 12844 11: true 12845}; 12846 12847ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) { 12848 var style = getComputedStyle( elem ); 12849 if ( !style ) { 12850 // Firefox returns null if in a hidden iframe https://bugzil.la/548397 12851 return; 12852 } 12853 // get url inside url("...") 12854 var reURL = /url\((['"])?(.*?)\1\)/gi; 12855 var matches = reURL.exec( style.backgroundImage ); 12856 while ( matches !== null ) { 12857 var url = matches && matches[2]; 12858 if ( url ) { 12859 this.addBackground( url, elem ); 12860 } 12861 matches = reURL.exec( style.backgroundImage ); 12862 } 12863}; 12864 12865/** 12866 * @param {Image} img 12867 */ 12868ImagesLoaded.prototype.addImage = function( img ) { 12869 var loadingImage = new LoadingImage( img ); 12870 this.images.push( loadingImage ); 12871}; 12872 12873ImagesLoaded.prototype.addBackground = function( url, elem ) { 12874 var background = new Background( url, elem ); 12875 this.images.push( background ); 12876}; 12877 12878ImagesLoaded.prototype.check = function() { 12879 var _this = this; 12880 this.progressedCount = 0; 12881 this.hasAnyBroken = false; 12882 // complete if no images 12883 if ( !this.images.length ) { 12884 this.complete(); 12885 return; 12886 } 12887 12888 function onProgress( image, elem, message ) { 12889 // HACK - Chrome triggers event before object properties have changed. #83 12890 setTimeout( function() { 12891 _this.progress( image, elem, message ); 12892 }); 12893 } 12894 12895 this.images.forEach( function( loadingImage ) { 12896 loadingImage.once( 'progress', onProgress ); 12897 loadingImage.check(); 12898 }); 12899}; 12900 12901ImagesLoaded.prototype.progress = function( image, elem, message ) { 12902 this.progressedCount++; 12903 this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; 12904 // progress event 12905 this.emitEvent( 'progress', [ this, image, elem ] ); 12906 if ( this.jqDeferred && this.jqDeferred.notify ) { 12907 this.jqDeferred.notify( this, image ); 12908 } 12909 // check if completed 12910 if ( this.progressedCount == this.images.length ) { 12911 this.complete(); 12912 } 12913 12914 if ( this.options.debug && console ) { 12915 console.log( 'progress: ' + message, image, elem ); 12916 } 12917}; 12918 12919ImagesLoaded.prototype.complete = function() { 12920 var eventName = this.hasAnyBroken ? 'fail' : 'done'; 12921 this.isComplete = true; 12922 this.emitEvent( eventName, [ this ] ); 12923 this.emitEvent( 'always', [ this ] ); 12924 if ( this.jqDeferred ) { 12925 var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve'; 12926 this.jqDeferred[ jqMethod ]( this ); 12927 } 12928}; 12929 12930// -------------------------- -------------------------- // 12931 12932function LoadingImage( img ) { 12933 this.img = img; 12934} 12935 12936LoadingImage.prototype = Object.create( EvEmitter.prototype ); 12937 12938LoadingImage.prototype.check = function() { 12939 // If complete is true and browser supports natural sizes, 12940 // try to check for image status manually. 12941 var isComplete = this.getIsImageComplete(); 12942 if ( isComplete ) { 12943 // report based on naturalWidth 12944 this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); 12945 return; 12946 } 12947 12948 // If none of the checks above matched, simulate loading on detached element. 12949 this.proxyImage = new Image(); 12950 this.proxyImage.addEventListener( 'load', this ); 12951 this.proxyImage.addEventListener( 'error', this ); 12952 // bind to image as well for Firefox. #191 12953 this.img.addEventListener( 'load', this ); 12954 this.img.addEventListener( 'error', this ); 12955 this.proxyImage.src = this.img.src; 12956}; 12957 12958LoadingImage.prototype.getIsImageComplete = function() {
12959 return this.img.complete && this.img.naturalWidth !== undefined; 12960}; 12961 12962LoadingImage.prototype.confirm = function( isLoaded, message ) { 12963 this.isLoaded = isLoaded; 12964 this.emitEvent( 'progress', [ this, this.img, message ] ); 12965}; 12966 12967// ----- events ----- // 12968 12969// trigger specified handler for event type 12970LoadingImage.prototype.handleEvent = function( event ) { 12971 var method = 'on' + event.type; 12972 if ( this[ method ] ) { 12973 this[ method ]( event ); 12974 } 12975}; 12976 12977LoadingImage.prototype.onload = function() { 12978 this.confirm( true, 'onload' ); 12979 this.unbindEvents(); 12980}; 12981 12982LoadingImage.prototype.onerror = function() { 12983 this.confirm( false, 'onerror' ); 12984 this.unbindEvents(); 12985}; 12986 12987LoadingImage.prototype.unbindEvents = function() { 12988 this.proxyImage.removeEventListener( 'load', this ); 12989 this.proxyImage.removeEventListener( 'error', this ); 12990 this.img.removeEventListener( 'load', this ); 12991 this.img.removeEventListener( 'error', this ); 12992}; 12993 12994// -------------------------- Background -------------------------- // 12995 12996function Background( url, element ) { 12997 this.url = url; 12998 this.element = element; 12999 this.img = new Image(); 13000} 13001 13002// inherit LoadingImage prototype 13003Background.prototype = Object.create( LoadingImage.prototype ); 13004 13005Background.prototype.check = function() { 13006 this.img.addEventListener( 'load', this ); 13007 this.img.addEventListener( 'error', this ); 13008 this.img.src = this.url; 13009 // check if image is already complete 13010 var isComplete = this.getIsImageComplete(); 13011 if ( isComplete ) { 13012 this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); 13013 this.unbindEvents(); 13014 } 13015}; 13016 13017Background.prototype.unbindEvents = function() { 13018 this.img.removeEventListener( 'load', this ); 13019 this.img.removeEventListener( 'error', this ); 13020}; 13021 13022Background.prototype.confirm = function( isLoaded, message ) { 13023 this.isLoaded = isLoaded; 13024 this.emitEvent( 'progress', [ this, this.element, message ] ); 13025}; 13026 13027// -------------------------- jQuery -------------------------- // 13028 13029ImagesLoaded.makeJQueryPlugin = function( jQuery ) { 13030 jQuery = jQuery || window.jQuery; 13031 if ( !jQuery ) { 13032 return; 13033 } 13034 // set local variable 13035 $ = jQuery; 13036 // $().imagesLoaded() 13037 $.fn.imagesLoaded = function( options, callback ) { 13038 var instance = new ImagesLoaded( this, options, callback ); 13039 return instance.jqDeferred.promise( $(this) ); 13040 }; 13041}; 13042// try making plugin 13043ImagesLoaded.makeJQueryPlugin(); 13044 13045// -------------------------- -------------------------- // 13046 13047return ImagesLoaded; 13048 13049}); 13050 13051/*! 13052 * Flickity imagesLoaded v2.0.0 13053 * enables imagesLoaded option for Flickity 13054 */ 13055 13056/*jshint browser: true, strict: true, undef: true, unused: true */ 13057 13058( function( window, factory ) { 13059 // universal module definition 13060 /*jshint strict: false */ /*globals define, module, require */ 13061 if ( typeof define == 'function' && define.amd ) { 13062 // AMD 13063 define( [ 13064 'flickity/js/index', 13065 'imagesloaded/imagesloaded' 13066 ], function( Flickity, imagesLoaded ) { 13067 return factory( window, Flickity, imagesLoaded ); 13068 }); 13069 } else if ( typeof module == 'object' && module.exports ) { 13070 // CommonJS 13071 module.exports = factory( 13072 window, 13073 require('flickity'), 13074 require('imagesloaded') 13075 ); 13076 } else { 13077 // browser global 13078 window.Flickity = factory( 13079 window, 13080 window.Flickity, 13081 window.imagesLoaded 13082 ); 13083 } 13084 13085}( window, function factory( window, Flickity, imagesLoaded ) { 13086'use strict'; 13087 13088Flickity.createMethods.push('_createImagesLoaded'); 13089 13090var proto = Flickity.prototype; 13091 13092proto._createImagesLoaded = function() { 13093 this.on( 'activate', this.imagesLoaded ); 13094}; 13095 13096proto.imagesLoaded = function() { 13097 if ( !this.options.imagesLoaded ) { 13098 return; 13099 } 13100 var _this = this; 13101 function onImagesLoadedProgress( instance, image ) { 13102 var cell = _this.getParentCell( image.img ); 13103 _this.cellSizeChange( cell && cell.element ); 13104 if ( !_this.options.freeScroll ) { 13105 _this.positionSliderAtSelected(); 13106 } 13107 } 13108 imagesLoaded( this.slider ).on( 'progress', onImagesLoadedProgress ); 13109}; 13110 13111return Flickity; 13112 13113})); 13114 13115/*� *� * /modules/nsMain-bundle/nsg-module-user/assets/js/getScripts.js� *�*/var getScripts; 13116var getSearchResults; 13117var topThreeSearchResults; 13118var thisProductGroupID; 13119 13120$(function() { 13121 (function( $, getScripts, undefined ){ 13122 var obj = getScripts; 13123 obj.settings = { 13124 }; 13125 var s = obj.settings; 13126 obj.error = function( e ){ throw e.message; } 13127 obj.init = function( settings ){ 13128 if( typeof settings !== null && typeof settings === "object" && Object.keys(settings).length ){ 13129 for( var key in settings ){ 13130 if( key in s ){ 13131 s[key] = settings[key]; 13132 } 13133 } 13134 } 13135 obj.load(); 13136 }; 13137 obj.bindUI = function(){ 13138 try{ 13139 }catch(e){ 13140 obj.error 13141 } 13142 }; 13143 obj.load = function(){ 13144 13145 var path = window.location.pathname; 13146 path = path.substring(0,3); 13147 var now = new Date(); 13148 13149 if( !( 'scripts' in sessionStorage ) ){ 13150 var so = { 13151 h: { 13152 data: '', 13153 created: new Date() - 6001 13154 }, 13155 r: { 13156 data: '', 13157 created: new Date() - 6001 13158 }, 13159 o: { 13160 data: '', 13161 created: new Date() - 6001 13162 }, 13163 p: { 13164 data: '', 13165 created: new Date() - 6001 13166 } 13167 }; 13168 sessionStorage.scripts = JSON.stringify(so); 13169 } 13170 13171 var sso = JSON.parse( sessionStorage.scripts ); 13172 13173 if( ( path.match(/\/m\//g)!==null && path.match(/\/m\//g).length > 0) || (path.match(/\/c\//g)!==null && path.match(/\/c\//g).length > 0) || (path.match(/\/s\//g)!==null && path.match(/\/s\//g).length > 0) || (path.match(/\/search\//g)!==null && path.match(/\/search\//g).length > 0) ){ 13174 var t = 'results'; 13175 }else if( path.match(/\/p\//g)!=null && path.match(/\/p\//g).length > 0 ){ 13176 var t = 'product'; 13177 }else if ( path.match(/\/checkout\/thankyou/g)!==null && path.match(/\/checkout\/thankyou/g).length ){ 13178 var t = 'order'; 13179 }else { 13180 var t = 'home'; 13181 } 13182 if( ( t === 'home' && ((sso.h.created - now / 1000) > 60) ) || ( t === 'results' && ((sso.r.created - now / 1000) > 60) ) || ( t === 'order' && ((sso.o.created - now / 1000) > 60) ) || ( t === 'product' && ((sso.p.created - now / 1000) > 60) ) ){ 13183 $.ajax({
13184 url: '/user/data', 13185 cache: true, 13186 data: { type: t }, 13187 complete: function( response, status ){ 13188 switch( t ){ 13189 case 'results': 13190 getSearchResults(); 13191 sso.r.data = response.responseText; 13192 sso.r.created = new Date(); 13193 break; 13194 case 'order': 13195 sso.o.data = response.responseText; 13196 sso.o.created = new Date(); 13197 break; 13198 case 'product': 13199 getProductGroupID(); 13200 sso.p.data = response.responseText; 13201 sso.p.created = new Date(); 13202 default: 13203 sso.h.data = response.responseText; 13204 sso.h.created = new Date(); 13205 break; 13206 } 13207 sessionStorage.scripts = JSON.stringify(sso); 13208 loadPageScripts( response.responseText ); 13209 }, 13210 type: 'GET' 13211 }); 13212 }else { 13213 switch( t ){ 13214 case 'results': 13215 getSearchResults(); 13216 loadPageScripts( $.trim(sso.r.data) ); 13217 break; 13218 case 'product': 13219 getProductGroupID(); 13220 loadPageScripts( $.trim(sso.p.data) ); 13221 break; 13222 case 'order': 13223 loadPageScripts( $.trim(sso.o.data) ); 13224 break; 13225 default: 13226 loadPageScripts( $.trim(sso.h.data) ); 13227 break; 13228 } 13229 } 13230 } 13231 var loadPageScripts = function( scripts ){ 13232 $('#criteoScript').remove(); 13233 $('body').append( scripts ); 13234 } 13235 var getProductGroupID = function(){ 13236 thisProductGroupID = $('#product-group-id').data('group-id'); 13237 }; 13238 var getSearchResults = function(){ 13239 topThreeSearchResults = new Array(); 13240 $('.search-product').each(function(e){ 13241 $this = $(this); 13242 var thisGroupID = $this.data('product-group-id'); 13243 if( topThreeSearchResults.length <= 2 ){ 13244 topThreeSearchResults.push( thisGroupID ); 13245 } 13246 }); 13247 } 13248 }(jQuery, window.getScripts = window.getScripts || {}, {})); 13249 getScripts.init(); 13250});/*� *� * /modules/outlandusa/assets/js/outlandusa-module.js� *�*/$(function() { 13251 if(typeof $().flickity === 'function'){ 13252 /* Flickity */ 13253 var $banners = $('.bannerSlider .carousel').flickity({ 13254 cellAlign: 'center', 13255 contain: true, 13256 wrapAround: true, 13257 lazyLoad: 2, 13258 autoPlay: 5000, 13259 pauseAutoPlayOnHover: true, 13260 imagesLoaded: true, 13261 pageDots: false, 13262 adaptiveHeight: true 13263 }); 13264 13265 $banners.css( {visibility: 'visible'} ); 13266 13267 var $brands = $('.brandSlider .carousel').flickity({ 13268 cellAlign: 'center', 13269 contain: true, 13270 wrapAround: true, 13271 lazyLoad: 2, 13272 autoPlay: false, 13273 imagesLoaded: true, 13274 groupCells: '100%', 13275 pageDots: false 13276 }); 13277 13278 $brands.css( {visibility: 'visible'} ); 13279 } 13280 13281 if(typeof $().isotope === 'function'){ 13282 /* Isotope */ 13283 $('.grid').isotope({ 13284 percentPosition: true, 13285 itemSelector: '.grid-item', 13286 layoutMode: 'fitRows' 13287 }); 13288 13289 /* Relayout Grid after Each Image loads */ 13290 $('.grid').imagesLoaded().progress(function(){ 13291 $('.grid').isotope('layout'); 13292 }); 13293 } 13294 13295 /* 13296 $('.carousel').imagesLoaded().progress(function(){ 13297 $('.carousel').flickity('reposition'); 13298 }); 13299 */ 13300 13301});
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.