1(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/amdefine/amdefine.js":[function(require,module,exports){ 2(function (process,__filename){ 3/** vim: et:ts=4:sw=4:sts=4 4 * @license amdefine 1.0.1 Copyright (c) 2011-2016, The Dojo Foundation All Rights Reserved. 5 * Available via the MIT or new BSD license. 6 * see: http://github.com/jrburke/amdefine for details 7 */ 8 9/*jslint node: true */ 10/*global module, process */ 11'use strict'; 12 13/** 14 * Creates a define for node. 15 * @param {Object} module the "module" object that is defined by Node for the 16 * current module. 17 * @param {Function} [requireFn]. Node's require function for the current module. 18 * It only needs to be passed in Node versions before 0.5, when module.require 19 * did not exist. 20 * @returns {Function} a define function that is usable for the current node 21 * module. 22 */ 23function amdefine(module, requireFn) { 24 'use strict'; 25 var defineCache = {}, 26 loaderCache = {}, 27 alreadyCalled = false, 28 path = require('path'), 29 makeRequire, stringRequire; 30 31 /** 32 * Trims the . and .. from an array of path segments. 33 * It will keep a leading path segment if a .. will become 34 * the first path segment, to help with module name lookups, 35 * which act like paths, but can be remapped. But the end result, 36 * all paths that use this function should look normalized. 37 * NOTE: this method MODIFIES the input array. 38 * @param {Array} ary the array of path segments. 39 */ 40 function trimDots(ary) { 41 var i, part; 42 for (i = 0; ary[i]; i+= 1) { 43 part = ary[i]; 44 if (part === '.') { 45 ary.splice(i, 1); 46 i -= 1; 47 } else if (part === '..') { 48 if (i === 1 && (ary[2] === '..' || ary[0] === '..')) { 49 //End of the line. Keep at least one non-dot 50 //path segment at the front so it can be mapped 51 //correctly to disk. Otherwise, there is likely 52 //no path mapping for a path starting with '..'. 53 //This can still fail, but catches the most reasonable 54 //uses of .. 55 break; 56 } else if (i > 0) { 57 ary.splice(i - 1, 2); 58 i -= 2; 59 } 60 } 61 } 62 } 63 64 function normalize(name, baseName) { 65 var baseParts; 66 67 //Adjust any relative paths. 68 if (name && name.charAt(0) === '.') { 69 //If have a base name, try to normalize against it, 70 //otherwise, assume it is a top-level require that will 71 //be relative to baseUrl in the end. 72 if (baseName) { 73 baseParts = baseName.split('/'); 74 baseParts = baseParts.slice(0, baseParts.length - 1); 75 baseParts = baseParts.concat(name.split('/')); 76 trimDots(baseParts); 77 name = baseParts.join('/'); 78 } 79 } 80 81 return name; 82 } 83 84 /** 85 * Create the normalize() function passed to a loader plugin's 86 * normalize method. 87 */ 88 function makeNormalize(relName) { 89 return function (name) { 90 return normalize(name, relName); 91 }; 92 } 93 94 function makeLoad(id) { 95 function load(value) { 96 loaderCache[id] = value; 97 } 98 99 load.fromText = function (id, text) { 100 //This one is difficult because the text can/probably uses 101 //define, and any relative paths and requires should be relative 102 //to that id was it would be found on disk. But this would require 103 //bootstrapping a module/require fairly deeply from node core. 104 //Not sure how best to go about that yet. 105 throw new Error('amdefine does not implement load.fromText'); 106 }; 107 108 return load; 109 } 110 111 makeRequire = function (systemRequire, exports, module, relId) { 112 function amdRequire(deps, callback) { 113 if (typeof deps === 'string') { 114 //Synchronous, single module require('') 115 return stringRequire(systemRequire, exports, module, deps, relId); 116 } else { 117 //Array of dependencies with a callback. 118 119 //Convert the dependencies to modules. 120 deps = deps.map(function (depName) { 121 return stringRequire(systemRequire, exports, module, depName, relId); 122 }); 123 124 //Wait for next tick to call back the require call. 125 if (callback) { 126 process.nextTick(function () { 127 callback.apply(null, deps); 128 }); 129 } 130 } 131 } 132 133 amdRequire.toUrl = function (filePath) { 134 if (filePath.indexOf('.') === 0) { 135 return normalize(filePath, path.dirname(module.filename)); 136 } else { 137 return filePath; 138 } 139 }; 140 141 return amdRequire; 142 }; 143 144 //Favor explicit value, passed in if the module wants to support Node 0.4.
145 requireFn = requireFn || function req() { 146 return module.require.apply(module, arguments); 147 }; 148 149 function runFactory(id, deps, factory) { 150 var r, e, m, result; 151 152 if (id) { 153 e = loaderCache[id] = {}; 154 m = { 155 id: id, 156 uri: __filename, 157 exports: e 158 }; 159 r = makeRequire(requireFn, e, m, id); 160 } else { 161 //Only support one define call per file 162 if (alreadyCalled) { 163 throw new Error('amdefine with no module ID cannot be called more than once per file.'); 164 } 165 alreadyCalled = true; 166 167 //Use the real variables from node 168 //Use module.exports for exports, since 169 //the exports in here is amdefine exports. 170 e = module.exports; 171 m = module; 172 r = makeRequire(requireFn, e, m, module.id); 173 } 174 175 //If there are dependencies, they are strings, so need 176 //to convert them to dependency values. 177 if (deps) { 178 deps = deps.map(function (depName) { 179 return r(depName); 180 }); 181 } 182 183 //Call the factory with the right dependencies. 184 if (typeof factory === 'function') { 185 result = factory.apply(m.exports, deps); 186 } else { 187 result = factory; 188 } 189 190 if (result !== undefined) { 191 m.exports = result; 192 if (id) { 193 loaderCache[id] = m.exports; 194 } 195 } 196 } 197 198 stringRequire = function (systemRequire, exports, module, id, relId) { 199 //Split the ID by a ! so that 200 var index = id.indexOf('!'), 201 originalId = id, 202 prefix, plugin; 203 204 if (index === -1) { 205 id = normalize(id, relId); 206 207 //Straight module lookup. If it is one of the special dependencies, 208 //deal with it, otherwise, delegate to node. 209 if (id === 'require') { 210 return makeRequire(systemRequire, exports, module, relId); 211 } else if (id === 'exports') { 212 return exports; 213 } else if (id === 'module') { 214 return module; 215 } else if (loaderCache.hasOwnProperty(id)) { 216 return loaderCache[id]; 217 } else if (defineCache[id]) { 218 runFactory.apply(null, defineCache[id]); 219 return loaderCache[id]; 220 } else { 221 if(systemRequire) { 222 return systemRequire(originalId); 223 } else { 224 throw new Error('No module with ID: ' + id); 225 } 226 } 227 } else { 228 //There is a plugin in play. 229 prefix = id.substring(0, index); 230 id = id.substring(index + 1, id.length); 231 232 plugin = stringRequire(systemRequire, exports, module, prefix, relId); 233 234 if (plugin.normalize) { 235 id = plugin.normalize(id, makeNormalize(relId)); 236 } else { 237 //Normalize the ID normally. 238 id = normalize(id, relId); 239 } 240 241 if (loaderCache[id]) { 242 return loaderCache[id]; 243 } else { 244 plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {}); 245 246 return loaderCache[id]; 247 } 248 } 249 }; 250 251 //Create a define function specific to the module asking for amdefine. 252 function define(id, deps, factory) { 253 if (Array.isArray(id)) { 254 factory = deps; 255 deps = id; 256 id = undefined; 257 } else if (typeof id !== 'string') { 258 factory = id; 259 id = deps = undefined; 260 } 261 262 if (deps && !Array.isArray(deps)) { 263 factory = deps; 264 deps = undefined; 265 } 266 267 if (!deps) { 268 deps = ['require', 'exports', 'module']; 269 } 270 271 //Set up properties for this module. If an ID, then use 272 //internal cache. If no ID, then use the external variables 273 //for this node module. 274 if (id) { 275 //Put the module in deep freeze until there is a 276 //require call for it. 277 defineCache[id] = [id, deps, factory]; 278 } else { 279 runFactory(id, deps, factory); 280 } 281 } 282 283 //define.require, which has access to all the values in the 284 //cache. Useful for AMD modules that all have IDs in the file, 285 //but need to finally export a value to node based on one of those 286 //IDs. 287 define.require = function (id) { 288 if (loaderCache[id]) { 289 return loaderCache[id]; 290 } 291 292 if (defineCache[id]) { 293 runFactory.apply(null, defineCache[id]); 294 return loaderCache[id]; 295 } 296 }; 297 298 define.amd = {}; 299 300 return define; 301} 302 303module.exports = amdefine; 304 305}).call(this,require('_process'),"/node_modules/amdefine/amdefine.js") 306},{"_process":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/process/browser.js","path":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/path-browserify/index.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/browserify/lib/_empty.js":[function(require,module,exports){ 307 308},{}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/foundation-sites/dist/foundation.js":[function(require,module,exports){ 309!function ($) { 310 311 "use strict"; 312 313 var FOUNDATION_VERSION = '6.2.4'; 314 315 // Global Foundation object 316 // This is attached to the window, or used as a module for AMD/Browserify 317 var Foundation = { 318 version: FOUNDATION_VERSION, 319 320 /** 321 * Stores initialized plugins. 322 */ 323 _plugins: {}, 324 325 /** 326 * Stores generated unique ids for plugin instances 327 */ 328 _uuids: [], 329 330 /**
331 * Returns a boolean for RTL support 332 */ 333 rtl: function () { 334 return $('html').attr('dir') === 'rtl'; 335 }, 336 /** 337 * Defines a Foundation plugin, adding it to the `Foundation` namespace and the list of plugins to initialize when reflowing. 338 * @param {Object} plugin - The constructor of the plugin. 339 */ 340 plugin: function (plugin, name) { 341 // Object key to use when adding to global Foundation object 342 // Examples: Foundation.Reveal, Foundation.OffCanvas 343 var className = name || functionName(plugin); 344 // Object key to use when storing the plugin, also used to create the identifying data attribute for the plugin 345 // Examples: data-reveal, data-off-canvas 346 var attrName = hyphenate(className); 347 348 // Add to the Foundation object and the plugins list (for reflowing) 349 this._plugins[attrName] = this[className] = plugin; 350 }, 351 /** 352 * @function 353 * Populates the _uuids array with pointers to each individual plugin instance. 354 * Adds the `zfPlugin` data-attribute to programmatically created plugins to allow use of $(selector).foundation(method) calls. 355 * Also fires the initialization event for each plugin, consolidating repetitive code. 356 * @param {Object} plugin - an instance of a plugin, usually `this` in context. 357 * @param {String} name - the name of the plugin, passed as a camelCased string. 358 * @fires Plugin#init 359 */ 360 registerPlugin: function (plugin, name) { 361 var pluginName = name ? hyphenate(name) : functionName(plugin.constructor).toLowerCase(); 362 plugin.uuid = this.GetYoDigits(6, pluginName); 363 364 if (!plugin.$element.attr('data-' + pluginName)) { 365 plugin.$element.attr('data-' + pluginName, plugin.uuid); 366 } 367 if (!plugin.$element.data('zfPlugin')) { 368 plugin.$element.data('zfPlugin', plugin); 369 } 370 /** 371 * Fires when the plugin has initialized. 372 * @event Plugin#init 373 */ 374 plugin.$element.trigger('init.zf.' + pluginName); 375 376 this._uuids.push(plugin.uuid); 377 378 return; 379 }, 380 /** 381 * @function 382 * Removes the plugins uuid from the _uuids array. 383 * Removes the zfPlugin data attribute, as well as the data-plugin-name attribute. 384 * Also fires the destroyed event for the plugin, consolidating repetitive code. 385 * @param {Object} plugin - an instance of a plugin, usually `this` in context. 386 * @fires Plugin#destroyed 387 */ 388 unregisterPlugin: function (plugin) { 389 var pluginName = hyphenate(functionName(plugin.$element.data('zfPlugin').constructor)); 390 391 this._uuids.splice(this._uuids.indexOf(plugin.uuid), 1); 392 plugin.$element.removeAttr('data-' + pluginName).removeData('zfPlugin') 393 /** 394 * Fires when the plugin has been destroyed. 395 * @event Plugin#destroyed 396 */ 397 .trigger('destroyed.zf.' + pluginName); 398 for (var prop in plugin) { 399 plugin[prop] = null; //clean up script to prep for garbage collection. 400 } 401 return; 402 }, 403 404 /** 405 * @function 406 * Causes one or more active plugins to re-initialize, resetting event listeners, recalculating positions, etc. 407 * @param {String} plugins - optional string of an individual plugin key, attained by calling `$(element).data('pluginName')`, or string of a plugin class i.e. `'dropdown'` 408 * @default If no argument is passed, reflow all currently active plugins. 409 */ 410 reInit: function (plugins) { 411 var isJQ = plugins instanceof $; 412 try { 413 if (isJQ) { 414 plugins.each(function () { 415 $(this).data('zfPlugin')._init(); 416 }); 417 } else { 418 var type = typeof plugins, 419 _this = this, 420 fns = { 421 'object': function (plgs) { 422 plgs.forEach(function (p) { 423 p = hyphenate(p); 424 $('[data-' + p + ']').foundation('_init'); 425 }); 426 }, 427 'string': function () { 428 plugins = hyphenate(plugins); 429 $('[data-' + plugins + ']').foundation('_init'); 430 }, 431 'undefined': function () { 432 this['object'](Object.keys(_this._plugins)); 433 } 434 }; 435 fns[type](plugins); 436 } 437 } catch (err) { 438 console.error(err); 439 } finally { 440 return plugins; 441 } 442 }, 443 444 /** 445 * returns a random base-36 uid with namespacing 446 * @function 447 * @param {Number} length - number of random base-36 digits desired. Increase for more random strings. 448 * @param {String} namespace - name of plugin to be incorporated in uid, optional. 449 * @default {String} '' - if no plugin name is provided, nothing is appended to the uid. 450 * @returns {String} - unique id 451 */ 452 GetYoDigits: function (length, namespace) { 453 length = length || 6; 454 return Math.round(Math.pow(36, length + 1) - Math.random() * Math.pow(36, length)).toString(36).slice(1) + (namespace ? '-' + namespace : ''); 455 }, 456 /** 457 * Initialize plugins on any elements within `elem` (and `elem` itself) that aren't already initialized. 458 * @param {Object}
458 elem - jQuery object containing the element to check inside. Also checks the element itself, unless it's the `document` object. 459 * @param {String|Array} plugins - A list of plugins to initialize. Leave this out to initialize everything. 460 */ 461 reflow: function (elem, plugins) { 462 463 // If plugins is undefined, just grab everything 464 if (typeof plugins === 'undefined') { 465 plugins = Object.keys(this._plugins); 466 } 467 // If plugins is a string, convert it to an array with one item 468 else if (typeof plugins === 'string') { 469 plugins = [plugins]; 470 } 471 472 var _this = this; 473 474 // Iterate through each plugin 475 $.each(plugins, function (i, name) { 476 // Get the current plugin 477 var plugin = _this._plugins[name]; 478 479 // Localize the search to all elements inside elem, as well as elem itself, unless elem === document 480 var $elem = $(elem).find('[data-' + name + ']').addBack('[data-' + name + ']'); 481 482 // For each plugin found, initialize it 483 $elem.each(function () { 484 var $el = $(this), 485 opts = {}; 486 // Don't double-dip on plugins 487 if ($el.data('zfPlugin')) { 488 console.warn("Tried to initialize " + name + " on an element that already has a Foundation plugin."); 489 return; 490 } 491 492 if ($el.attr('data-options')) { 493 var thing = $el.attr('data-options').split(';').forEach(function (e, i) { 494 var opt = e.split(':').map(function (el) { 495 return el.trim(); 496 }); 497 if (opt[0]) opts[opt[0]] = parseValue(opt[1]); 498 }); 499 } 500 try { 501 $el.data('zfPlugin', new plugin($(this), opts)); 502 } catch (er) { 503 console.error(er); 504 } finally { 505 return; 506 } 507 }); 508 }); 509 }, 510 getFnName: functionName, 511 transitionend: function ($elem) { 512 var transitions = { 513 'transition': 'transitionend', 514 'WebkitTransition': 'webkitTransitionEnd', 515 'MozTransition': 'transitionend', 516 'OTransition': 'otransitionend' 517 }; 518 var elem = document.createElement('div'), 519 end; 520 521 for (var t in transitions) { 522 if (typeof elem.style[t] !== 'undefined') { 523 end = transitions[t]; 524 } 525 } 526 if (end) { 527 return end; 528 } else { 529 end = setTimeout(function () { 530 $elem.triggerHandler('transitionend', [$elem]); 531 }, 1); 532 return 'transitionend'; 533 } 534 } 535 }; 536 537 Foundation.util = { 538 /** 539 * Function for applying a debounce effect to a function call. 540 * @function 541 * @param {Function} func - Function to be called at end of timeout. 542 * @param {Number} delay - Time in ms to delay the call of `func`. 543 * @returns function 544 */ 545 throttle: function (func, delay) { 546 var timer = null; 547 548 return function () { 549 var context = this, 550 args = arguments; 551 552 if (timer === null) { 553 timer = setTimeout(function () { 554 func.apply(context, args); 555 timer = null; 556 }, delay); 557 } 558 }; 559 } 560 }; 561 562 // TODO: consider not making this a jQuery function 563 // TODO: need way to reflow vs. re-initialize 564 /** 565 * The Foundation jQuery method. 566 * @param {String|Array} method - An action to perform on the current jQuery object. 567 */ 568 var foundation = function (method) { 569 var type = typeof method, 570 $meta = $('meta.foundation-mq'), 571 $noJS = $('.no-js'); 572 573 if (!$meta.length) { 574 $('<meta class="foundation-mq">').appendTo(document.head); 575 } 576 if ($noJS.length) { 577 $noJS.removeClass('no-js'); 578 } 579 580 if (type === 'undefined') { 581 //needs to initialize the Foundation object, or an individual plugin. 582 Foundation.MediaQuery._init(); 583 Foundation.reflow(this); 584 } else if (type === 'string') { 585 //an individual method to invoke on a plugin or group of plugins 586 var args = Array.prototype.slice.call(arguments, 1); //collect all the arguments, if necessary 587 var plugClass = this.data('zfPlugin'); //determine the class of plugin 588 589 if (plugClass !== undefined && plugClass[method] !== undefined) { 590 //make sure both the class and method exist 591 if (this.length === 1) { 592 //if there's only one, call it directly.
593 plugClass[method].apply(plugClass, args); 594 } else { 595 this.each(function (i, el) { 596 //otherwise loop through the jQuery collection and invoke the method on each 597 plugClass[method].apply($(el).data('zfPlugin'), args); 598 }); 599 } 600 } else { 601 //error for no class or no method 602 throw new ReferenceError("We're sorry, '" + method + "' is not an available method for " + (plugClass ? functionName(plugClass) : 'this element') + '.'); 603 } 604 } else { 605 //error for invalid argument type 606 throw new TypeError('We\'re sorry, ' + type + ' is not a valid parameter. You must use a string representing the method you wish to invoke.'); 607 } 608 return this; 609 }; 610 611 window.Foundation = Foundation; 612 $.fn.foundation = foundation; 613 614 // Polyfill for requestAnimationFrame 615 (function () { 616 if (!Date.now || !window.Date.now) window.Date.now = Date.now = function () { 617 return new Date().getTime(); 618 }; 619 620 var vendors = ['webkit', 'moz']; 621 for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) { 622 var vp = vendors[i]; 623 window.requestAnimationFrame = window[vp + 'RequestAnimationFrame']; 624 window.cancelAnimationFrame = window[vp + 'CancelAnimationFrame'] || window[vp + 'CancelRequestAnimationFrame']; 625 } 626 if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) || !window.requestAnimationFrame || !window.cancelAnimationFrame) { 627 var lastTime = 0; 628 window.requestAnimationFrame = function (callback) { 629 var now = Date.now(); 630 var nextTime = Math.max(lastTime + 16, now); 631 return setTimeout(function () { 632 callback(lastTime = nextTime); 633 }, nextTime - now); 634 }; 635 window.cancelAnimationFrame = clearTimeout; 636 } 637 /** 638 * Polyfill for performance.now, required by rAF 639 */ 640 if (!window.performance || !window.performance.now) { 641 window.performance = { 642 start: Date.now(), 643 now: function () { 644 return Date.now() - this.start; 645 } 646 }; 647 } 648 })(); 649 if (!Function.prototype.bind) { 650 Function.prototype.bind = function (oThis) { 651 if (typeof this !== 'function') { 652 // closest thing possible to the ECMAScript 5 653 // internal IsCallable function 654 throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); 655 } 656 657 var aArgs = Array.prototype.slice.call(arguments, 1), 658 fToBind = this, 659 fNOP = function () {}, 660 fBound = function () { 661 return fToBind.apply(this instanceof fNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); 662 }; 663 664 if (this.prototype) { 665 // native functions don't have a prototype 666 fNOP.prototype = this.prototype; 667 } 668 fBound.prototype = new fNOP(); 669 670 return fBound; 671 }; 672 } 673 // Polyfill to get the name of a function in IE9 674 function functionName(fn) { 675 if (Function.prototype.name === undefined) { 676 var funcNameRegex = /function\s([^(]{1,})\(/; 677 var results = funcNameRegex.exec(fn.toString()); 678 return results && results.length > 1 ? results[1].trim() : ""; 679 } else if (fn.prototype === undefined) { 680 return fn.constructor.name; 681 } else { 682 return fn.prototype.constructor.name; 683 } 684 } 685 function parseValue(str) { 686 if (/true/.test(str)) return true;else if (/false/.test(str)) return false;else if (!isNaN(str * 1)) return parseFloat(str); 687 return str; 688 } 689 // Convert PascalCase to kebab-case 690 // Thank you: http://stackoverflow.com/a/8955580 691 function hyphenate(str) { 692 return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); 693 } 694}(jQuery); 695'use strict'; 696 697!function ($) { 698 699 Foundation.Box = { 700 ImNotTouchingYou: ImNotTouchingYou, 701 GetDimensions: GetDimensions, 702 GetOffsets: GetOffsets 703 }; 704 705 /** 706 * Compares the dimensions of an element to a container and determines collision events with container. 707 * @function 708 * @param {jQuery} element - jQuery object to test for collisions. 709 * @param {jQuery}
709 parent - jQuery object to use as bounding container. 710 * @param {Boolean} lrOnly - set to true to check left and right values only. 711 * @param {Boolean} tbOnly - set to true to check top and bottom values only. 712 * @default if no parent object passed, detects collisions with `window`. 713 * @returns {Boolean} - true if collision free, false if a collision in any direction. 714 */ 715 function ImNotTouchingYou(element, parent, lrOnly, tbOnly) { 716 var eleDims = GetDimensions(element), 717 top, 718 bottom, 719 left, 720 right; 721 722 if (parent) { 723 var parDims = GetDimensions(parent); 724 725 bottom = eleDims.offset.top + eleDims.height <= parDims.height + parDims.offset.top; 726 top = eleDims.offset.top >= parDims.offset.top; 727 left = eleDims.offset.left >= parDims.offset.left; 728 right = eleDims.offset.left + eleDims.width <= parDims.width + parDims.offset.left; 729 } else { 730 bottom = eleDims.offset.top + eleDims.height <= eleDims.windowDims.height + eleDims.windowDims.offset.top; 731 top = eleDims.offset.top >= eleDims.windowDims.offset.top; 732 left = eleDims.offset.left >= eleDims.windowDims.offset.left; 733 right = eleDims.offset.left + eleDims.width <= eleDims.windowDims.width; 734 } 735 736 var allDirs = [bottom, top, left, right]; 737 738 if (lrOnly) { 739 return left === right === true; 740 } 741 742 if (tbOnly) { 743 return top === bottom === true; 744 } 745 746 return allDirs.indexOf(false) === -1; 747 }; 748 749 /** 750 * Uses native methods to return an object of dimension values. 751 * @function 752 * @param {jQuery || HTML} element - jQuery object or DOM element for which to get the dimensions. Can be any element other that document or window. 753 * @returns {Object} - nested object of integer pixel values 754 * TODO - if element is window, return only those values. 755 */ 756 function GetDimensions(elem, test) { 757 elem = elem.length ? elem[0] : elem; 758 759 if (elem === window || elem === document) { 760 throw new Error("I'm sorry, Dave. I'm afraid I can't do that."); 761 } 762 763 var rect = elem.getBoundingClientRect(), 764 parRect = elem.parentNode.getBoundingClientRect(), 765 winRect = document.body.getBoundingClientRect(), 766 winY = window.pageYOffset, 767 winX = window.pageXOffset; 768 769 return { 770 width: rect.width, 771 height: rect.height, 772 offset: { 773 top: rect.top + winY, 774 left: rect.left + winX 775 }, 776 parentDims: { 777 width: parRect.width, 778 height: parRect.height, 779 offset: { 780 top: parRect.top + winY, 781 left: parRect.left + winX 782 } 783 }, 784 windowDims: { 785 width: winRect.width, 786 height: winRect.height, 787 offset: { 788 top: winY, 789 left: winX 790 } 791 } 792 }; 793 } 794 795 /** 796 * Returns an object of top and left integer pixel values for dynamically rendered elements, 797 * such as: Tooltip, Reveal, and Dropdown 798 * @function 799 * @param {jQuery} element - jQuery object for the element being positioned. 800 * @param {jQuery} anchor - jQuery object for the element's anchor point. 801 * @param {String} position - a string relating to the desired position of the element, relative to it's anchor 802 * @param {Number} vOffset - integer pixel value of desired vertical separation between anchor and element. 803 * @param {Number} hOffset - integer pixel value of desired horizontal separation between anchor and element. 804 * @param {Boolean} isOverflow - if a collision event is detected, sets to true to default the element to full width - any desired offset. 805 * TODO alter/rewrite to work with `em` values as well/instead of pixels 806 */ 807 function GetOffsets(element, anchor, position, vOffset, hOffset, isOverflow) { 808 var $eleDims = GetDimensions(element), 809 $anchorDims = anchor ? GetDimensions(anchor) : null; 810 811 switch (position) { 812 case 'top': 813 return { 814 left: Foundation.rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width : $anchorDims.offset.left, 815 top: $anchorDims.offset.top - ($eleDims.height + vOffset) 816 }; 817 break; 818 case 'left': 819 return { 820 left: $anchorDims.offset.left - ($eleDims.width + hOffset), 821 top: $anchorDims.offset.top 822 }; 823 break; 824 case 'right': 825 return { 826 left: $anchorDims.offset.left + $anchorDims.width + hOffset, 827 top: $anchorDims.offset.top 828 }; 829 break; 830 case 'center top': 831 return { 832 left: $anchorDims.offset.left + $anchorDims.width / 2 - $eleDims.width / 2,
833 top: $anchorDims.offset.top - ($eleDims.height + vOffset) 834 }; 835 break; 836 case 'center bottom': 837 return { 838 left: isOverflow ? hOffset : $anchorDims.offset.left + $anchorDims.width / 2 - $eleDims.width / 2, 839 top: $anchorDims.offset.top + $anchorDims.height + vOffset 840 }; 841 break; 842 case 'center left': 843 return { 844 left: $anchorDims.offset.left - ($eleDims.width + hOffset), 845 top: $anchorDims.offset.top + $anchorDims.height / 2 - $eleDims.height / 2 846 }; 847 break; 848 case 'center right': 849 return { 850 left: $anchorDims.offset.left + $anchorDims.width + hOffset + 1, 851 top: $anchorDims.offset.top + $anchorDims.height / 2 - $eleDims.height / 2 852 }; 853 break; 854 case 'center': 855 return { 856 left: $eleDims.windowDims.offset.left + $eleDims.windowDims.width / 2 - $eleDims.width / 2, 857 top: $eleDims.windowDims.offset.top + $eleDims.windowDims.height / 2 - $eleDims.height / 2 858 }; 859 break; 860 case 'reveal': 861 return { 862 left: ($eleDims.windowDims.width - $eleDims.width) / 2, 863 top: $eleDims.windowDims.offset.top + vOffset 864 }; 865 case 'reveal full': 866 return { 867 left: $eleDims.windowDims.offset.left, 868 top: $eleDims.windowDims.offset.top 869 }; 870 break; 871 case 'left bottom': 872 return { 873 left: $anchorDims.offset.left, 874 top: $anchorDims.offset.top + $anchorDims.height 875 }; 876 break; 877 case 'right bottom': 878 return { 879 left: $anchorDims.offset.left + $anchorDims.width + hOffset - $eleDims.width, 880 top: $anchorDims.offset.top + $anchorDims.height 881 }; 882 break; 883 default: 884 return { 885 left: Foundation.rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width : $anchorDims.offset.left + hOffset, 886 top: $anchorDims.offset.top + $anchorDims.height + vOffset 887 }; 888 } 889 } 890}(jQuery); 891/******************************************* 892 * * 893 * This util was created by Marius Olbertz * 894 * Please thank Marius on GitHub /owlbertz * 895 * or the web http://www.mariusolbertz.de/ * 896 * * 897 ******************************************/ 898 899'use strict'; 900 901!function ($) { 902 903 var keyCodes = { 904 9: 'TAB', 905 13: 'ENTER', 906 27: 'ESCAPE', 907 32: 'SPACE', 908 37: 'ARROW_LEFT', 909 38: 'ARROW_UP', 910 39: 'ARROW_RIGHT', 911 40: 'ARROW_DOWN' 912 }; 913 914 var commands = {}; 915 916 var Keyboard = { 917 keys: getKeyCodes(keyCodes), 918 919 /** 920 * Parses the (keyboard) event and returns a String that represents its key 921 * Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE 922 * @param {Event} event - the event generated by the event handler 923 * @return String key - String that represents the key pressed 924 */ 925 parseKey: function (event) { 926 var key = keyCodes[event.which || event.keyCode] || String.fromCharCode(event.which).toUpperCase(); 927 if (event.shiftKey) key = 'SHIFT_' + key; 928 if (event.ctrlKey) key = 'CTRL_' + key; 929 if (event.altKey) key = 'ALT_' + key; 930 return key; 931 }, 932 933 934 /** 935 * Handles the given (keyboard) event 936 * @param {Event} event - the event generated by the event handler 937 * @param {String} component - Foundation component's name, e.g. Slider or Reveal 938 * @param {Objects} functions - collection of functions that are to be executed 939 */ 940 handleKey: function (event, component, functions) { 941 var commandList = commands[component], 942 keyCode = this.parseKey(event), 943 cmds, 944 command, 945 fn; 946 947 if (!commandList) return console.warn('Component not defined!'); 948 949 if (typeof commandList.ltr === 'undefined') { 950 // this component does not differentiate between ltr and rtl 951 cmds = commandList; // use plain list 952 } else { 953 // merge ltr and rtl: if document is rtl, rtl overwrites ltr and vice versa 954 if (Foundation.rtl()) cmds = $.extend({}, commandList.ltr, commandList.rtl);
954else cmds = $.extend({}, commandList.rtl, commandList.ltr); 955 } 956 command = cmds[keyCode]; 957 958 fn = functions[command]; 959 if (fn && typeof fn === 'function') { 960 // execute function if exists 961 var returnValue = fn.apply(); 962 if (functions.handled || typeof functions.handled === 'function') { 963 // execute function when event was handled 964 functions.handled(returnValue); 965 } 966 } else { 967 if (functions.unhandled || typeof functions.unhandled === 'function') { 968 // execute function when event was not handled 969 functions.unhandled(); 970 } 971 } 972 }, 973 974 975 /** 976 * Finds all focusable elements within the given `$element` 977 * @param {jQuery} $element - jQuery object to search within 978 * @return {jQuery} $focusable - all focusable elements within `$element` 979 */ 980 findFocusable: function ($element) { 981 return $element.find('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]').filter(function () { 982 if (!$(this).is(':visible') || $(this).attr('tabindex') < 0) { 983 return false; 984 } //only have visible elements and those that have a tabindex greater or equal 0 985 return true; 986 }); 987 }, 988 989 990 /** 991 * Returns the component name name 992 * @param {Object} component - Foundation component, e.g. Slider or Reveal 993 * @return String componentName 994 */ 995 996 register: function (componentName, cmds) { 997 commands[componentName] = cmds; 998 } 999 }; 1000 1001 /* 1002 * Constants for easier comparing. 1003 * Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE 1004 */ 1005 function getKeyCodes(kcs) { 1006 var k = {}; 1007 for (var kc in kcs) { 1008 k[kcs[kc]] = kcs[kc]; 1009 }return k; 1010 } 1011 1012 Foundation.Keyboard = Keyboard; 1013}(jQuery); 1014'use strict'; 1015 1016!function ($) { 1017 1018 // Default set of media queries 1019 var defaultQueries = { 1020 'default': 'only screen', 1021 landscape: 'only screen and (orientation: landscape)', 1022 portrait: 'only screen and (orientation: portrait)', 1023 retina: 'only screen and (-webkit-min-device-pixel-ratio: 2),' + 'only screen and (min--moz-device-pixel-ratio: 2),' + 'only screen and (-o-min-device-pixel-ratio: 2/1),' + 'only screen and (min-device-pixel-ratio: 2),' + 'only screen and (min-resolution: 192dpi),' + 'only screen and (min-resolution: 2dppx)' 1024 }; 1025 1026 var MediaQuery = { 1027 queries: [], 1028 1029 current: '', 1030 1031 /** 1032 * Initializes the media query helper, by extracting the breakpoint list from the CSS and activating the breakpoint watcher. 1033 * @function 1034 * @private 1035 */ 1036 _init: function () { 1037 var self = this; 1038 var extractedStyles = $('.foundation-mq').css('font-family'); 1039 var namedQueries; 1040 1041 namedQueries = parseStyleToObject(extractedStyles); 1042 1043 for (var key in namedQueries) { 1044 if (namedQueries.hasOwnProperty(key)) { 1045 self.queries.push({ 1046 name: key, 1047 value: 'only screen and (min-width: ' + namedQueries[key] + ')' 1048 }); 1049 } 1050 } 1051 1052 this.current = this._getCurrentSize(); 1053 1054 this._watcher(); 1055 }, 1056 1057 1058 /** 1059 * Checks if the screen is at least as wide as a breakpoint. 1060 * @function 1061 * @param {String} size - Name of the breakpoint to check. 1062 * @returns {Boolean} `true` if the breakpoint matches, `false` if it's smaller. 1063 */ 1064 atLeast: function (size) { 1065 var query = this.get(size); 1066 1067 if (query) { 1068 return window.matchMedia(query).matches; 1069 } 1070 1071 return false; 1072 }, 1073 1074 1075 /** 1076 * Gets the media query of a breakpoint. 1077 * @function 1078 * @param {String} size - Name of the breakpoint to get. 1079 * @returns {String|null} - The media query of the breakpoint, or `null` if the breakpoint doesn't exist. 1080 */ 1081 get: function (size) { 1082 for (var i in this.queries) { 1083 if (this.queries.hasOwnProperty(i)) { 1084 var query = this.queries[i]; 1085 if (size === query.name) return query.value; 1086 } 1087 } 1088 1089 return null; 1090 }, 1091 1092 1093 /** 1094 * Gets the current breakpoint name by testing every breakpoint and returning the last one to match (the biggest one). 1095 * @function 1096 * @private 1097 * @returns {String} Name of the current breakpoint. 1098 */ 1099 _getCurrentSize: function () { 1100 var matched; 1101 1102 for (var i = 0; i < this.queries.length; i++) { 1103 var query = this.queries[i]; 1104 1105 if (window.matchMedia(query.value).matches) { 1106 matched = query; 1107 } 1108 } 1109 1110 if (typeof matched === 'object') { 1111 return matched.name; 1112 } else { 1113 return matched; 1114 } 1115 }, 1116 1117 1118 /** 1119 * Activates the breakpoint watcher, which fires an event on the window whenever the breakpoint changes. 1120 * @function 1121 * @private 1122 */ 1123 _watcher: function () { 1124 var _this = this; 1125 1126 $(window).on('resize.zf.mediaquery', function () { 1127 var newSize = _this._getCurrentSize(), 1128 currentSize = _this.current; 1129 1130 if (newSize !== currentSize) { 1131 // Change the current media query 1132 _this.current = newSize; 1133 1134 // Broadcast the media query change on the window 1135 $(window).trigger('changed.zf.mediaquery', [newSize, currentSize]); 1136 } 1137 }); 1138 } 1139 }; 1140 1141 Foundation.MediaQuery = MediaQuery; 1142 1143 // matchMedia() polyfill - Test a CSS media type/query in JS. 1144 // Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license 1145 window.matchMedia || (window.matchMedia = function () { 1146 'use strict'; 1147 1148 // For browsers that support matchMedium api such as IE 9 and webkit 1149 1150 var styleMedia = window.styleMedia || window.media; 1151 1152 // For those that don't support matchMedium 1153 if (!styleMedia) { 1154 var style = document.createElement('style'), 1155 script = document.getElementsByTagName('script')[0], 1156 info = null; 1157 1158 style.type = 'text/css'; 1159 style.id = 'matchmediajs-test'; 1160 1161 script && script.parentNode && script.parentNode.insertBefore(style, script); 1162 1163 // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers 1164 info = 'getComputedStyle' in window && window.getComputedStyle(style, null) || style.currentStyle; 1165 1166 styleMedia = { 1167 matchMedium: function (media) { 1168 var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; 1169 1170 // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers 1171 if (style.styleSheet) { 1172 style.styleSheet.cssText = text; 1173 } else { 1174 style.textContent = text; 1175 } 1176 1177 // Test if media query is true or false 1178 return info.width === '1px'; 1179 } 1180 }; 1181 } 1182 1183 return function (media) { 1184 return { 1185 matches: styleMedia.matchMedium(media || 'all'), 1186 media: media || 'all' 1187 }; 1188 }; 1189 }()); 1190 1191 // Thank you: https://github.com/sindresorhus/query-string 1192 function parseStyleToObject(str) { 1193 var styleObject = {}; 1194 1195 if (typeof str !== 'string') { 1196 return styleObject; 1197 } 1198 1199 str = str.trim().slice(1, -1);
1199 // browsers re-quote string style values 1200 1201 if (!str) { 1202 return styleObject; 1203 } 1204 1205 styleObject = str.split('&').reduce(function (ret, param) { 1206 var parts = param.replace(/\+/g, ' ').split('='); 1207 var key = parts[0]; 1208 var val = parts[1]; 1209 key = decodeURIComponent(key); 1210 1211 // missing `=` should be `null`: 1212 // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters 1213 val = val === undefined ? null : decodeURIComponent(val); 1214 1215 if (!ret.hasOwnProperty(key)) { 1216 ret[key] = val; 1217 } else if (Array.isArray(ret[key])) { 1218 ret[key].push(val); 1219 } else { 1220 ret[key] = [ret[key], val]; 1221 } 1222 return ret; 1223 }, {}); 1224 1225 return styleObject; 1226 } 1227 1228 Foundation.MediaQuery = MediaQuery; 1229}(jQuery); 1230'use strict'; 1231 1232!function ($) { 1233 1234 /** 1235 * Motion module. 1236 * @module foundation.motion 1237 */ 1238 1239 var initClasses = ['mui-enter', 'mui-leave']; 1240 var activeClasses = ['mui-enter-active', 'mui-leave-active']; 1241 1242 var Motion = { 1243 animateIn: function (element, animation, cb) { 1244 animate(true, element, animation, cb); 1245 }, 1246 1247 animateOut: function (element, animation, cb) { 1248 animate(false, element, animation, cb); 1249 } 1250 }; 1251 1252 function Move(duration, elem, fn) { 1253 var anim, 1254 prog, 1255 start = null; 1256 // console.log('called'); 1257 1258 function move(ts) { 1259 if (!start) start = window.performance.now(); 1260 // console.log(start, ts); 1261 prog = ts - start; 1262 fn.apply(elem); 1263 1264 if (prog < duration) { 1265 anim = window.requestAnimationFrame(move, elem); 1266 } else { 1267 window.cancelAnimationFrame(anim); 1268 elem.trigger('finished.zf.animate', [elem]).triggerHandler('finished.zf.animate', [elem]); 1269 } 1270 } 1271 anim = window.requestAnimationFrame(move); 1272 } 1273 1274 /** 1275 * Animates an element in or out using a CSS transition class. 1276 * @function 1277 * @private 1278 * @param {Boolean} isIn - Defines if the animation is in or out. 1279 * @param {Object} element - jQuery or HTML object to animate. 1280 * @param {String} animation - CSS class to use. 1281 * @param {Function} cb - Callback to run when animation is finished. 1282 */ 1283 function animate(isIn, element, animation, cb) { 1284 element = $(element).eq(0); 1285 1286 if (!element.length) return; 1287 1288 var initClass = isIn ? initClasses[0] : initClasses[1]; 1289 var activeClass = isIn ? activeClasses[0] : activeClasses[1]; 1290 1291 // Set up the animation 1292 reset(); 1293 1294 element.addClass(animation).css('transition', 'none'); 1295 1296 requestAnimationFrame(function () { 1297 element.addClass(initClass); 1298 if (isIn) element.show(); 1299 }); 1300 1301 // Start the animation 1302 requestAnimationFrame(function () { 1303 element[0].offsetWidth; 1304 element.css('transition', '').addClass(activeClass); 1305 }); 1306 1307 // Clean up the animation when it finishes 1308 element.one(Foundation.transitionend(element), finish); 1309 1310 // Hides the element (for out animations), resets the element, and runs a callback 1311 function finish() { 1312 if (!isIn) element.hide(); 1313 reset(); 1314 if (cb) cb.apply(element); 1315 } 1316 1317 // Resets transitions and removes motion-specific classes 1318 function reset() { 1319 element[0].style.transitionDuration = 0; 1320 element.removeClass(initClass + ' ' + activeClass + ' ' + animation); 1321 } 1322 } 1323 1324 Foundation.Move = Move; 1325 Foundation.Motion = Motion; 1326}(jQuery); 1327'use strict'; 1328 1329!function ($) { 1330 1331 var Nest = { 1332 Feather: function (menu) { 1333 var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'zf'; 1334 1335 menu.attr('role', 'menubar'); 1336 1337 var items = menu.find('li').attr({ 'role': 'menuitem' }), 1338 subMenuClass = 'is-' + type + '-submenu', 1339 subItemClass = subMenuClass + '-item', 1340 hasSubClass = 'is-' + type + '-submenu-parent'; 1341 1342 menu.find('a:first').attr('tabindex', 0); 1343 1344 items.each(function () { 1345 var $item = $(this), 1346 $sub = $item.children('ul'); 1347 1348 if ($sub.length) { 1349 $item.addClass(hasSubClass).attr({ 1350 'aria-haspopup': true, 1351 'aria-expanded': false, 1352 'aria-label': $item.children('a:first').text() 1353 }); 1354 1355 $sub.addClass('submenu ' + subMenuClass).attr({ 1356 'data-submenu': '', 1357 'aria-hidden': true, 1358 'role': 'menu' 1359 }); 1360 } 1361 1362 if ($item.parent('[data-submenu]').length) { 1363 $item.addClass('is-submenu-item ' + subItemClass); 1364 } 1365 }); 1366 1367 return; 1368 }, 1369 Burn: function (menu, type) { 1370 var items = menu.find('li').removeAttr('tabindex'), 1371 subMenuClass = 'is-' + type + '-submenu', 1372 subItemClass = subMenuClass + '-item', 1373 hasSubClass = 'is-' + type + '-submenu-parent'; 1374 1375 menu.find('>li, .menu, .menu > li').removeClass(subMenuClass + ' ' + subItemClass + ' ' + hasSubClass + ' is-submenu-item submenu is-active').removeAttr('data-submenu').css('display', ''); 1376 1377 // console.log( menu.find('.' + subMenuClass + ', .' + subItemClass + ', .has-submenu, .is-submenu-item, .submenu, [data-submenu]') 1378 // .removeClass(subMenuClass + ' ' + subItemClass + ' has-submenu is-submenu-item submenu') 1379 // .removeAttr('data-submenu')); 1380 // items.each(function(){ 1381 // var $item = $(this), 1382 // $sub = $item.children('ul'); 1383 // if($item.parent('[data-submenu]').length){ 1384 // $item.removeClass('is-submenu-item ' + subItemClass); 1385 // } 1386 // if($sub.length){ 1387 // $item.removeClass('has-submenu'); 1388 // $sub.removeClass('submenu ' + subMenuClass).removeAttr('data-submenu'); 1389 // } 1390 // }); 1391 } 1392 }; 1393 1394 Foundation.Nest = Nest; 1395}(jQuery); 1396'use strict'; 1397 1398!function ($) { 1399 1400 function Timer(elem, options, cb) { 1401 var _this = this, 1402 duration = options.duration, 1403 //options is an object for easily adding features later. 1404 nameSpace = Object.keys(elem.data())[0] || 'timer', 1405 remain = -1, 1406 start, 1407 timer; 1408 1409 this.isPaused = false;
1410 1411 this.restart = function () { 1412 remain = -1; 1413 clearTimeout(timer); 1414 this.start(); 1415 }; 1416 1417 this.start = function () { 1418 this.isPaused = false; 1419 // if(!elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things. 1420 clearTimeout(timer); 1421 remain = remain <= 0 ? duration : remain; 1422 elem.data('paused', false); 1423 start = Date.now(); 1424 timer = setTimeout(function () { 1425 if (options.infinite) { 1426 _this.restart(); //rerun the timer. 1427 } 1428 if (cb && typeof cb === 'function') { 1429 cb(); 1430 } 1431 }, remain); 1432 elem.trigger('timerstart.zf.' + nameSpace); 1433 }; 1434 1435 this.pause = function () { 1436 this.isPaused = true; 1437 //if(elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things. 1438 clearTimeout(timer); 1439 elem.data('paused', true); 1440 var end = Date.now(); 1441 remain = remain - (end - start); 1442 elem.trigger('timerpaused.zf.' + nameSpace); 1443 }; 1444 } 1445 1446 /** 1447 * Runs a callback function when images are fully loaded. 1448 * @param {Object} images - Image(s) to check if loaded. 1449 * @param {Func} callback - Function to execute when image is fully loaded. 1450 */ 1451 function onImagesLoaded(images, callback) { 1452 var self = this, 1453 unloaded = images.length; 1454 1455 if (unloaded === 0) { 1456 callback(); 1457 } 1458 1459 images.each(function () { 1460 if (this.complete) { 1461 singleImageLoaded(); 1462 } else if (typeof this.naturalWidth !== 'undefined' && this.naturalWidth > 0) { 1463 singleImageLoaded(); 1464 } else { 1465 $(this).one('load', function () { 1466 singleImageLoaded(); 1467 }); 1468 } 1469 }); 1470 1471 function singleImageLoaded() { 1472 unloaded--; 1473 if (unloaded === 0) { 1474 callback(); 1475 } 1476 } 1477 } 1478 1479 Foundation.Timer = Timer; 1480 Foundation.onImagesLoaded = onImagesLoaded; 1481}(jQuery); 1482//************************************************** 1483//**Work inspired by multiple jquery swipe plugins** 1484//**Done by Yohai Ararat *************************** 1485//************************************************** 1486(function ($) { 1487 1488 $.spotSwipe = { 1489 version: '1.0.0', 1490 enabled: 'ontouchstart' in document.documentElement, 1491 preventDefault: false, 1492 moveThreshold: 75, 1493 timeThreshold: 200 1494 }; 1495 1496 var startPosX, 1497 startPosY, 1498 startTime, 1499 elapsedTime, 1500 isMoving = false; 1501 1502 function onTouchEnd() { 1503 // alert(this); 1504 this.removeEventListener('touchmove', onTouchMove); 1505 this.removeEventListener('touchend', onTouchEnd); 1506 isMoving = false; 1507 } 1508 1509 function onTouchMove(e) { 1510 if ($.spotSwipe.preventDefault) { 1511 e.preventDefault(); 1512 } 1513 if (isMoving) { 1514 var x = e.touches[0].pageX; 1515 var y = e.touches[0].pageY; 1516 var dx = startPosX - x; 1517 var dy = startPosY - y; 1518 var dir; 1519 elapsedTime = new Date().getTime() - startTime; 1520 if (Math.abs(dx) >= $.spotSwipe.moveThreshold && elapsedTime <= $.spotSwipe.timeThreshold) { 1521 dir = dx > 0 ? 'left' : 'right'; 1522 } 1523 // else if(Math.abs(dy) >= $.spotSwipe.moveThreshold && elapsedTime <= $.spotSwipe.timeThreshold) { 1524 // dir = dy > 0 ? 'down' : 'up'; 1525 // } 1526 if (dir) { 1527 e.preventDefault(); 1528 onTouchEnd.call(this); 1529 $(this).trigger('swipe', dir).trigger('swipe' + dir); 1530 } 1531 } 1532 } 1533 1534 function onTouchStart(e) { 1535 if (e.touches.length == 1) { 1536 startPosX = e.touches[0].pageX; 1537 startPosY = e.touches[0].pageY; 1538 isMoving = true; 1539 startTime = new Date().getTime(); 1540 this.addEventListener('touchmove', onTouchMove, false); 1541 this.addEventListener('touchend', onTouchEnd, false); 1542 } 1543 } 1544 1545 function init() { 1546 this.addEventListener && this.addEventListener('touchstart', onTouchStart, false); 1547 } 1548 1549 function teardown() { 1550 this.removeEventListener('touchstart', onTouchStart); 1551 } 1552 1553 $.event.special.swipe = { setup: init }; 1554 1555 $.each(['left', 'up', 'down', 'right'], function () { 1556 $.event.special['swipe' + this] = { setup: function () { 1557 $(this).on('swipe', $.noop); 1558 } }; 1559 }); 1560})(jQuery); 1561/**************************************************** 1562 * Method for adding psuedo drag events to elements * 1563 ***************************************************/ 1564!function ($) { 1565 $.fn.addTouch = function () { 1566 this.each(function (i, el) { 1567 $(el).bind('touchstart touchmove touchend touchcancel', function () { 1568 //we pass the original event object because the jQuery event 1569 //object is normalized to w3c specs and does not provide the TouchList 1570 handleTouch(event); 1571 }); 1572 }); 1573 1574 var handleTouch = function (event) { 1575 var touches = event.changedTouches, 1576 first = touches[0], 1577 eventTypes = { 1578 touchstart: 'mousedown', 1579 touchmove: 'mousemove', 1580 touchend: 'mouseup' 1581 }, 1582 type = eventTypes[event.type], 1583 simulatedEvent; 1584 1585 if ('MouseEvent' in window && typeof window.MouseEvent === 'function') { 1586 simulatedEvent = new window.MouseEvent(type, { 1587 'bubbles': true, 1588 'cancelable': true, 1589 'screenX': first.screenX, 1590 'screenY': first.screenY, 1591 'clientX': first.clientX, 1592 'clientY': first.clientY 1593 }); 1594 } else { 1595 simulatedEvent = document.createEvent('MouseEvent'); 1596 simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0 /*left*/, null); 1597 } 1598 first.target.dispatchEvent(simulatedEvent); 1599 }; 1600 }; 1601}(jQuery); 1602 1603//********************************** 1604//**From the jQuery Mobile Library** 1605//**need to recreate functionality**
1606//**and try to improve if possible** 1607//********************************** 1608 1609/* Removing the jQuery function **** 1610************************************ 1611 1612(function( $, window, undefined ) { 1613 1614 var $document = $( document ), 1615 // supportTouch = $.mobile.support.touch, 1616 touchStartEvent = 'touchstart'//supportTouch ? "touchstart" : "mousedown", 1617 touchStopEvent = 'touchend'//supportTouch ? "touchend" : "mouseup", 1618 touchMoveEvent = 'touchmove'//supportTouch ? "touchmove" : "mousemove"; 1619 1620 // setup new event shortcuts 1621 $.each( ( "touchstart touchmove touchend " + 1622 "swipe swipeleft swiperight" ).split( " " ), function( i, name ) { 1623 1624 $.fn[ name ] = function( fn ) { 1625 return fn ? this.bind( name, fn ) : this.trigger( name ); 1626 }; 1627 1628 // jQuery < 1.8 1629 if ( $.attrFn ) { 1630 $.attrFn[ name ] = true; 1631 } 1632 }); 1633 1634 function triggerCustomEvent( obj, eventType, event, bubble ) { 1635 var originalType = event.type; 1636 event.type = eventType; 1637 if ( bubble ) { 1638 $.event.trigger( event, undefined, obj ); 1639 } else { 1640 $.event.dispatch.call( obj, event ); 1641 } 1642 event.type = originalType; 1643 } 1644 1645 // also handles taphold 1646 1647 // Also handles swipeleft, swiperight 1648 $.event.special.swipe = { 1649 1650 // More than this horizontal displacement, and we will suppress scrolling. 1651 scrollSupressionThreshold: 30, 1652 1653 // More time than this, and it isn't a swipe. 1654 durationThreshold: 1000, 1655 1656 // Swipe horizontal displacement must be more than this. 1657 horizontalDistanceThreshold: window.devicePixelRatio >= 2 ? 15 : 30, 1658 1659 // Swipe vertical displacement must be less than this. 1660 verticalDistanceThreshold: window.devicePixelRatio >= 2 ? 15 : 30, 1661 1662 getLocation: function ( event ) { 1663 var winPageX = window.pageXOffset, 1664 winPageY = window.pageYOffset, 1665 x = event.clientX, 1666 y = event.clientY; 1667 1668 if ( event.pageY === 0 && Math.floor( y ) > Math.floor( event.pageY ) || 1669 event.pageX === 0 && Math.floor( x ) > Math.floor( event.pageX ) ) { 1670 1671 // iOS4 clientX/clientY have the value that should have been 1672 // in pageX/pageY. While pageX/page/ have the value 0 1673 x = x - winPageX; 1674 y = y - winPageY; 1675 } else if ( y < ( event.pageY - winPageY) || x < ( event.pageX - winPageX ) ) { 1676 1677 // Some Android browsers have totally bogus values for clientX/Y 1678 // when scrolling/zooming a page. Detectable since clientX/clientY 1679 // should never be smaller than pageX/pageY minus page scroll 1680 x = event.pageX - winPageX; 1681 y = event.pageY - winPageY; 1682 } 1683 1684 return { 1685 x: x, 1686 y: y 1687 }; 1688 }, 1689 1690 start: function( event ) { 1691 var data = event.originalEvent.touches ? 1692 event.originalEvent.touches[ 0 ] : event, 1693 location = $.event.special.swipe.getLocation( data ); 1694 return { 1695 time: ( new Date() ).getTime(), 1696 coords: [ location.x, location.y ], 1697 origin: $( event.target ) 1698 }; 1699 }, 1700 1701 stop: function( event ) { 1702 var data = event.originalEvent.touches ? 1703 event.originalEvent.touches[ 0 ] : event, 1704 location = $.event.special.swipe.getLocation( data ); 1705 return { 1706 time: ( new Date() ).getTime(), 1707 coords: [ location.x, location.y ] 1708 }; 1709 }, 1710 1711 handleSwipe: function( start, stop, thisObject, origTarget ) { 1712 if ( stop.time - start.time < $.event.special.swipe.durationThreshold && 1713 Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.horizontalDistanceThreshold && 1714 Math.abs( start.coords[ 1 ] - stop.coords[ 1 ] ) < $.event.special.swipe.verticalDistanceThreshold ) { 1715 var direction = start.coords[0] > stop.coords[ 0 ] ? "swipeleft" : "swiperight"; 1716 1717 triggerCustomEvent( thisObject, "swipe", $.Event( "swipe", { target: origTarget, swipestart: start, swipestop: stop }), true ); 1718 triggerCustomEvent( thisObject, direction,$.Event( direction, { target: origTarget, swipestart: start, swipestop: stop } ), true ); 1719 return true; 1720 } 1721 return false; 1722 1723 }, 1724 1725 // This serves as a flag to ensure that at most one swipe event event is 1726 // in work at any given time 1727 eventInProgress: false, 1728 1729 setup: function() { 1730 var events, 1731 thisObject = this, 1732 $this = $( thisObject ), 1733 context = {}; 1734 1735 // Retrieve the events data for this element and add the swipe context 1736 events = $.data( this, "mobile-events" ); 1737 if ( !events ) { 1738 events = { length: 0 }; 1739 $.data( this, "mobile-events", events ); 1740 } 1741 events.length++; 1742 events.swipe = context; 1743 1744 context.start = function( event ) { 1745 1746 // Bail if we're already working on a swipe event 1747 if ( $.event.special.swipe.eventInProgress ) { 1748 return; 1749 } 1750 $.event.special.swipe.eventInProgress = true; 1751 1752 var stop, 1753 start = $.event.special.swipe.start( event ), 1754 origTarget = event.target, 1755 emitted = false;
1756 1757 context.move = function( event ) { 1758 if ( !start || event.isDefaultPrevented() ) { 1759 return; 1760 } 1761 1762 stop = $.event.special.swipe.stop( event ); 1763 if ( !emitted ) { 1764 emitted = $.event.special.swipe.handleSwipe( start, stop, thisObject, origTarget ); 1765 if ( emitted ) { 1766 1767 // Reset the context to make way for the next swipe event 1768 $.event.special.swipe.eventInProgress = false; 1769 } 1770 } 1771 // prevent scrolling 1772 if ( Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.scrollSupressionThreshold ) { 1773 event.preventDefault(); 1774 } 1775 }; 1776 1777 context.stop = function() { 1778 emitted = true; 1779 1780 // Reset the context to make way for the next swipe event 1781 $.event.special.swipe.eventInProgress = false; 1782 $document.off( touchMoveEvent, context.move ); 1783 context.move = null; 1784 }; 1785 1786 $document.on( touchMoveEvent, context.move ) 1787 .one( touchStopEvent, context.stop ); 1788 }; 1789 $this.on( touchStartEvent, context.start ); 1790 }, 1791 1792 teardown: function() { 1793 var events, context; 1794 1795 events = $.data( this, "mobile-events" ); 1796 if ( events ) { 1797 context = events.swipe; 1798 delete events.swipe; 1799 events.length--; 1800 if ( events.length === 0 ) { 1801 $.removeData( this, "mobile-events" ); 1802 } 1803 } 1804 1805 if ( context ) { 1806 if ( context.start ) { 1807 $( this ).off( touchStartEvent, context.start ); 1808 } 1809 if ( context.move ) { 1810 $document.off( touchMoveEvent, context.move ); 1811 } 1812 if ( context.stop ) { 1813 $document.off( touchStopEvent, context.stop ); 1814 } 1815 } 1816 } 1817 }; 1818 $.each({ 1819 swipeleft: "swipe.left", 1820 swiperight: "swipe.right" 1821 }, function( event, sourceEvent ) { 1822 1823 $.event.special[ event ] = { 1824 setup: function() { 1825 $( this ).bind( sourceEvent, $.noop ); 1826 }, 1827 teardown: function() { 1828 $( this ).unbind( sourceEvent ); 1829 } 1830 }; 1831 }); 1832})( jQuery, this ); 1833*/ 1834'use strict'; 1835 1836!function ($) { 1837 1838 var MutationObserver = function () { 1839 var prefixes = ['WebKit', 'Moz', 'O', 'Ms', '']; 1840 for (var i = 0; i < prefixes.length; i++) { 1841 if (prefixes[i] + 'MutationObserver' in window) { 1842 return window[prefixes[i] + 'MutationObserver']; 1843 } 1844 } 1845 return false; 1846 }(); 1847 1848 var triggers = function (el, type) { 1849 el.data(type).split(' ').forEach(function (id) { 1850 $('#' + id)[type === 'close' ? 'trigger' : 'triggerHandler'](type + '.zf.trigger', [el]); 1851 }); 1852 }; 1853 // Elements with [data-open] will reveal a plugin that supports it when clicked. 1854 $(document).on('click.zf.trigger', '[data-open]', function () { 1855 triggers($(this), 'open'); 1856 }); 1857 1858 // Elements with [data-close] will close a plugin that supports it when clicked. 1859 // If used without a value on [data-close], the event will bubble, allowing it to close a parent component. 1860 $(document).on('click.zf.trigger', '[data-close]', function () { 1861 var id = $(this).data('close'); 1862 if (id) { 1863 triggers($(this), 'close'); 1864 } else { 1865 $(this).trigger('close.zf.trigger'); 1866 } 1867 }); 1868 1869 // Elements with [data-toggle] will toggle a plugin that supports it when clicked. 1870 $(document).on('click.zf.trigger', '[data-toggle]', function () { 1871 triggers($(this), 'toggle'); 1872 }); 1873 1874 // Elements with [data-closable] will respond to close.zf.trigger events. 1875 $(document).on('close.zf.trigger', '[data-closable]', function (e) { 1876 e.stopPropagation(); 1877 var animation = $(this).data('closable'); 1878 1879 if (animation !== '') { 1880 Foundation.Motion.animateOut($(this), animation, function () { 1881 $(this).trigger('closed.zf'); 1882 }); 1883 } else { 1884 $(this).fadeOut().trigger('closed.zf'); 1885 } 1886 }); 1887 1888 $(document).on('focus.zf.trigger blur.zf.trigger', '[data-toggle-focus]', function () { 1889 var id = $(this).data('toggle-focus'); 1890 $('#' + id).triggerHandler('toggle.zf.trigger', [$(this)]); 1891 }); 1892 1893 /** 1894 * Fires once after all other scripts have loaded 1895 * @function 1896 * @private 1897 */ 1898 $(window).on('load', function () { 1899 checkListeners(); 1900 }); 1901 1902 function checkListeners() { 1903 eventsListener(); 1904 resizeListener(); 1905 scrollListener(); 1906 closemeListener(); 1907 } 1908 1909 //******** only fires this function once on load, if there's something to watch ******** 1910 function closemeListener(pluginName) { 1911 var yetiBoxes = $('[data-yeti-box]'), 1912 plugNames = ['dropdown', 'tooltip', 'reveal']; 1913 1914 if (pluginName) { 1915 if (typeof pluginName === 'string') { 1916 plugNames.push(pluginName); 1917 } else if (typeof pluginName === 'object' && typeof pluginName[0] === 'string') { 1918 plugNames.concat(pluginName); 1919 } else { 1920 console.error('Plugin names must be strings'); 1921 } 1922 } 1923 if (yetiBoxes.length) { 1924 var listeners = plugNames.map(function (name) { 1925 return 'closeme.zf.' + name; 1926 }).join(' '); 1927 1928 $(window).off(listeners).on(listeners, function (e, pluginId) { 1929 var plugin = e.namespace.split('.')[0]; 1930 var plugins = $('[data-' + plugin + ']').not('[data-yeti-box="' + pluginId + '"]'); 1931 1932 plugins.each(function () { 1933 var _this = $(this); 1934 1935 _this.triggerHandler('close.zf.trigger', [_this]); 1936 }); 1937 }); 1938 } 1939 } 1940 1941 function resizeListener(debounce) { 1942 var timer = void 0, 1943 $nodes = $('[data-resize]'); 1944 if ($nodes.length) { 1945 $(window).off('resize.zf.trigger').on('resize.zf.trigger', function (e) { 1946 if (timer) { 1947 clearTimeout(timer); 1948 } 1949 1950 timer = setTimeout(function () { 1951 1952 if (!MutationObserver) { 1953 //fallback for IE 9 1954 $nodes.each(function () { 1955 $(this).triggerHandler('resizeme.zf.trigger'); 1956 }); 1957 } 1958 //trigger all listening elements and signal a resize event 1959 $nodes.attr('data-events', "resize"); 1960 }, debounce || 10); //default time to emit resize event 1961 }); 1962 } 1963 } 1964 1965 function scrollListener(debounce) { 1966 var timer = void 0, 1967 $nodes = $('[data-scroll]'); 1968 if ($nodes.length) { 1969 $(window).off('scroll.zf.trigger').on('scroll.zf.trigger', function (e) { 1970 if (timer) { 1971 clearTimeout(timer); 1972 } 1973 1974 timer = setTimeout(function () { 1975 1976 if (!MutationObserver) { 1977 //fallback for IE 9 1978 $nodes.each(function () { 1979 $(this).triggerHandler('scrollme.zf.trigger'); 1980 }); 1981 } 1982 //trigger all listening elements and signal a scroll event 1983 $nodes.attr('data-events', "scroll"); 1984 }, debounce || 10); //default time to emit scroll event 1985 }); 1986 } 1987 } 1988 1989 function eventsListener() { 1990 if (!MutationObserver) { 1991 return false;
1992 } 1993 var nodes = document.querySelectorAll('[data-resize], [data-scroll], [data-mutate]'); 1994 1995 //element callback 1996 var listeningElementsMutation = function (mutationRecordsList) { 1997 var $target = $(mutationRecordsList[0].target); 1998 //trigger the event handler for the element depending on type 1999 switch ($target.attr("data-events")) { 2000 2001 case "resize": 2002 $target.triggerHandler('resizeme.zf.trigger', [$target]); 2003 break; 2004 2005 case "scroll": 2006 $target.triggerHandler('scrollme.zf.trigger', [$target, window.pageYOffset]); 2007 break; 2008 2009 // case "mutate" : 2010 // console.log('mutate', $target); 2011 // $target.triggerHandler('mutate.zf.trigger'); 2012 // 2013 // //make sure we don't get stuck in an infinite loop from sloppy codeing 2014 // if ($target.index('[data-mutate]') == $("[data-mutate]").length-1) { 2015 // domMutationObserver(); 2016 // } 2017 // break; 2018 2019 default: 2020 return false; 2021 //nothing 2022 } 2023 }; 2024 2025 if (nodes.length) { 2026 //for each element that needs to listen for resizing, scrolling, (or coming soon mutation) add a single observer 2027 for (var i = 0; i <= nodes.length - 1; i++) { 2028 var elementObserver = new MutationObserver(listeningElementsMutation); 2029 elementObserver.observe(nodes[i], { attributes: true, childList: false, characterData: false, subtree: false, attributeFilter: ["data-events"] }); 2030 } 2031 } 2032 } 2033 2034 // ------------------------------------ 2035 2036 // [PH] 2037 // Foundation.CheckWatchers = checkWatchers; 2038 Foundation.IHearYou = checkListeners; 2039 // Foundation.ISeeYou = scrollListener; 2040 // Foundation.IFeelYou = closemeListener; 2041}(jQuery); 2042 2043// function domMutationObserver(debounce) { 2044// // !!! This is coming soon and needs more work; not active !!! // 2045// var timer, 2046// nodes = document.querySelectorAll('[data-mutate]'); 2047// // 2048// if (nodes.length) { 2049// // var MutationObserver = (function () { 2050// // var prefixes = ['WebKit', 'Moz', 'O', 'Ms', '']; 2051// // for (var i=0; i < prefixes.length; i++) { 2052// // if (prefixes[i] + 'MutationObserver' in window) { 2053// // return window[prefixes[i] + 'MutationObserver']; 2054// // } 2055// // } 2056// // return false; 2057// // }()); 2058// 2059// 2060// //for the body, we need to listen for all changes effecting the style and class attributes 2061// var bodyObserver = new MutationObserver(bodyMutation); 2062// bodyObserver.observe(document.body, { attributes: true, childList: true, characterData: false, subtree:true, attributeFilter:["style", "class"]}); 2063// 2064// 2065// //body callback 2066// function bodyMutation(mutate) { 2067// //trigger all listening elements and signal a mutation event 2068// if (timer) { clearTimeout(timer); } 2069// 2070// timer = setTimeout(function() { 2071// bodyObserver.disconnect(); 2072// $('[data-mutate]').attr('data-events',"mutate"); 2073// }, debounce || 150); 2074// } 2075// } 2076// } 2077'use strict'; 2078 2079var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 2080 2081function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2082 2083!function ($) { 2084 2085 /** 2086 * Abide module. 2087 * @module foundation.abide 2088 */ 2089 2090 var Abide = function () { 2091 /** 2092 * Creates a new instance of Abide. 2093 * @class 2094 * @fires Abide#init 2095 * @param {Object} element - jQuery object to add the trigger to. 2096 * @param {Object} options - Overrides to the default plugin settings. 2097 */ 2098 function Abide(element) { 2099 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 2100 2101 _classCallCheck(this, Abide); 2102 2103 this.$element = element; 2104 this.options = $.extend({}, Abide.defaults, this.$element.data(), options); 2105 2106 this._init(); 2107 2108 Foundation.registerPlugin(this, 'Abide'); 2109 } 2110 2111 /** 2112 * Initializes the Abide plugin and calls functions to get Abide functioning on load. 2113 * @private 2114 */ 2115 2116 2117 _createClass(Abide, [{ 2118 key: '_init', 2119 value: function _init() { 2120 this.$inputs = this.$element.find('input, textarea, select'); 2121 2122 this._events(); 2123 } 2124 2125 /** 2126 * Initializes events for Abide. 2127 * @private 2128 */ 2129 2130 }, {
vendor: 4,229 bytes, lines 2131-2274
2131 key: '_events', 2132 value: function _events() { 2133 var _this2 = this; 2134 2135 this.$element.off('.abide').on('reset.zf.abide', function () { 2136 _this2.resetForm(); 2137 }).on('submit.zf.abide', function () { 2138 return _this2.validateForm(); 2139 }); 2140 2141 if (this.options.validateOn === 'fieldChange') { 2142 this.$inputs.off('change.zf.abide').on('change.zf.abide', function (e) { 2143 _this2.validateInput($(e.target)); 2144 }); 2145 } 2146 2147 if (this.options.liveValidate) { 2148 this.$inputs.off('input.zf.abide').on('input.zf.abide', function (e) { 2149 _this2.validateInput($(e.target)); 2150 }); 2151 } 2152 } 2153 2154 /** 2155 * Calls necessary functions to update Abide upon DOM change 2156 * @private 2157 */ 2158 2159 }, { 2160 key: '_reflow', 2161 value: function _reflow() { 2162 this._init(); 2163 } 2164 2165 /** 2166 * Checks whether or not a form element has the required attribute and if it's checked or not 2167 * @param {Object} element - jQuery object to check for required attribute 2168 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 2169 */ 2170 2171 }, { 2172 key: 'requiredCheck', 2173 value: function requiredCheck($el) { 2174 if (!$el.attr('required')) return true; 2175 2176 var isGood = true; 2177 2178 switch ($el[0].type) { 2179 case 'checkbox': 2180 isGood = $el[0].checked; 2181 break; 2182 2183 case 'select': 2184 case 'select-one': 2185 case 'select-multiple': 2186 var opt = $el.find('option:selected'); 2187 if (!opt.length || !opt.val()) isGood = false; 2188 break; 2189 2190 default: 2191 if (!$el.val() || !$el.val().length) isGood = false; 2192 } 2193 2194 return isGood; 2195 } 2196 2197 /** 2198 * Based on $el, get the first element with selector in this order: 2199 * 1. The element's direct sibling('s). 2200 * 3. The element's parent's children. 2201 * 2202 * This allows for multiple form errors per input, though if none are found, no form errors will be shown. 2203 * 2204 * @param {Object} $el - jQuery object to use as reference to find the form error selector. 2205 * @returns {Object} jQuery object with the selector. 2206 */ 2207 2208 }, { 2209 key: 'findFormError', 2210 value: function findFormError($el) { 2211 var $error = $el.siblings(this.options.formErrorSelector); 2212 2213 if (!$error.length) { 2214 $error = $el.parent().find(this.options.formErrorSelector); 2215 } 2216 2217 return $error; 2218 } 2219 2220 /** 2221 * Get the first element in this order: 2222 * 2. The <label> with the attribute `[for="someInputId"]` 2223 * 3. The `.closest()` <label> 2224 * 2225 * @param {Object} $el - jQuery object to check for required attribute 2226 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 2227 */ 2228 2229 }, { 2230 key: 'findLabel', 2231 value: function findLabel($el) { 2232 var id = $el[0].id; 2233 var $label = this.$element.find('label[for="' + id + '"]'); 2234 2235 if (!$label.length) { 2236 return $el.closest('label'); 2237 } 2238 2239 return $label; 2240 } 2241 2242 /** 2243 * Get the set of labels associated with a set of radio els in this order 2244 * 2. The <label> with the attribute `[for="someInputId"]` 2245 * 3. The `.closest()` <label> 2246 * 2247 * @param {Object} $el - jQuery object to check for required attribute 2248 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 2249 */ 2250 2251 }, { 2252 key: 'findRadioLabels', 2253 value: function findRadioLabels($els) { 2254 var _this3 = this; 2255 2256 var labels = $els.map(function (i, el) { 2257 var id = el.id; 2258 var $label = _this3.$element.find('label[for="' + id + '"]'); 2259 2260 if (!$label.length) { 2261 $label = $(el).closest('label'); 2262 } 2263 return $label[0]; 2264 }); 2265 2266 return $(labels); 2267 } 2268 2269 /** 2270 * Adds the CSS error class as specified by the Abide settings to the label, input, and the form 2271 * @param {Object} $el - jQuery object to add the class to 2272 */ 2273 2274 }, {
2275 key: 'addErrorClasses', 2276 value: function addErrorClasses($el) { 2277 var $label = this.findLabel($el); 2278 var $formError = this.findFormError($el); 2279 2280 if ($label.length) { 2281 $label.addClass(this.options.labelErrorClass); 2282 } 2283 2284 if ($formError.length) { 2285 $formError.addClass(this.options.formErrorClass); 2286 } 2287 2288 $el.addClass(this.options.inputErrorClass).attr('data-invalid', ''); 2289 } 2290 2291 /** 2292 * Remove CSS error classes etc from an entire radio button group 2293 * @param {String} groupName - A string that specifies the name of a radio button group 2294 * 2295 */ 2296 2297 }, { 2298 key: 'removeRadioErrorClasses', 2299 value: function removeRadioErrorClasses(groupName) { 2300 var $els = this.$element.find(':radio[name="' + groupName + '"]'); 2301 var $labels = this.findRadioLabels($els); 2302 var $formErrors = this.findFormError($els); 2303 2304 if ($labels.length) { 2305 $labels.removeClass(this.options.labelErrorClass); 2306 } 2307 2308 if ($formErrors.length) { 2309 $formErrors.removeClass(this.options.formErrorClass); 2310 } 2311 2312 $els.removeClass(this.options.inputErrorClass).removeAttr('data-invalid'); 2313 } 2314 2315 /** 2316 * Removes CSS error class as specified by the Abide settings from the label, input, and the form 2317 * @param {Object} $el - jQuery object to remove the class from 2318 */ 2319 2320 }, { 2321 key: 'removeErrorClasses', 2322 value: function removeErrorClasses($el) { 2323 // radios need to clear all of the els 2324 if ($el[0].type == 'radio') { 2325 return this.removeRadioErrorClasses($el.attr('name')); 2326 } 2327 2328 var $label = this.findLabel($el); 2329 var $formError = this.findFormError($el); 2330 2331 if ($label.length) { 2332 $label.removeClass(this.options.labelErrorClass); 2333 } 2334 2335 if ($formError.length) { 2336 $formError.removeClass(this.options.formErrorClass); 2337 } 2338 2339 $el.removeClass(this.options.inputErrorClass).removeAttr('data-invalid'); 2340 } 2341 2342 /** 2343 * Goes through a form to find inputs and proceeds to validate them in ways specific to their type 2344 * @fires Abide#invalid 2345 * @fires Abide#valid 2346 * @param {Object} element - jQuery object to validate, should be an HTML input 2347 * @returns {Boolean} goodToGo - If the input is valid or not. 2348 */ 2349 2350 }, { 2351 key: 'validateInput', 2352 value: function validateInput($el) { 2353 var clearRequire = this.requiredCheck($el), 2354 validated = false, 2355 customValidator = true, 2356 validator = $el.attr('data-validator'), 2357 equalTo = true; 2358 2359 // don't validate ignored inputs or hidden inputs 2360 if ($el.is('[data-abide-ignore]') || $el.is('[type="hidden"]')) { 2361 return true; 2362 } 2363 2364 switch ($el[0].type) { 2365 case 'radio': 2366 validated = this.validateRadio($el.attr('name')); 2367 break; 2368 2369 case 'checkbox': 2370 validated = clearRequire; 2371 break; 2372 2373 case 'select': 2374 case 'select-one': 2375 case 'select-multiple': 2376 validated = clearRequire; 2377 break; 2378 2379 default: 2380 validated = this.validateText($el); 2381 } 2382 2383 if (validator) { 2384 customValidator = this.matchValidation($el, validator, $el.attr('required')); 2385 } 2386 2387 if ($el.attr('data-equalto')) { 2388 equalTo = this.options.validators.equalTo($el); 2389 } 2390 2391 var goodToGo = [clearRequire, validated, customValidator, equalTo].indexOf(false) === -1; 2392 var message = (goodToGo ? 'valid' : 'invalid') + '.zf.abide'; 2393 2394 this[goodToGo ? 'removeErrorClasses' : 'addErrorClasses']($el); 2395 2396 /** 2397 * Fires when the input is done checking for validation. Event trigger is either `valid.zf.abide` or `invalid.zf.abide` 2398 * Trigger includes the DOM element of the input. 2399 * @event Abide#valid 2400 * @event Abide#invalid 2401 */ 2402 $el.trigger(message, [$el]); 2403 2404 return goodToGo; 2405 } 2406 2407 /**
2408 * Goes through a form and if there are any invalid inputs, it will display the form error element 2409 * @returns {Boolean} noError - true if no errors were detected... 2410 * @fires Abide#formvalid 2411 * @fires Abide#forminvalid 2412 */ 2413 2414 }, { 2415 key: 'validateForm', 2416 value: function validateForm() { 2417 var acc = []; 2418 var _this = this; 2419 2420 this.$inputs.each(function () { 2421 acc.push(_this.validateInput($(this))); 2422 }); 2423 2424 var noError = acc.indexOf(false) === -1; 2425 2426 this.$element.find('[data-abide-error]').css('display', noError ? 'none' : 'block'); 2427 2428 /** 2429 * Fires when the form is finished validating. Event trigger is either `formvalid.zf.abide` or `forminvalid.zf.abide`. 2430 * Trigger includes the element of the form. 2431 * @event Abide#formvalid 2432 * @event Abide#forminvalid 2433 */ 2434 this.$element.trigger((noError ? 'formvalid' : 'forminvalid') + '.zf.abide', [this.$element]); 2435 2436 return noError; 2437 } 2438 2439 /** 2440 * Determines whether or a not a text input is valid based on the pattern specified in the attribute. If no matching pattern is found, returns true. 2441 * @param {Object} $el - jQuery object to validate, should be a text input HTML element 2442 * @param {String} pattern - string value of one of the RegEx patterns in Abide.options.patterns 2443 * @returns {Boolean} Boolean value depends on whether or not the input value matches the pattern specified 2444 */ 2445 2446 }, { 2447 key: 'validateText', 2448 value: function validateText($el, pattern) { 2449 // A pattern can be passed to this function, or it will be infered from the input's "pattern" attribute, or it's "type" attribute 2450 pattern = pattern || $el.attr('pattern') || $el.attr('type'); 2451 var inputText = $el.val(); 2452 var valid = false; 2453 2454 if (inputText.length) { 2455 // If the pattern attribute on the element is in Abide's list of patterns, then test that regexp 2456 if (this.options.patterns.hasOwnProperty(pattern)) { 2457 valid = this.options.patterns[pattern].test(inputText); 2458 } 2459 // If the pattern name isn't also the type attribute of the field, then test it as a regexp 2460 else if (pattern !== $el.attr('type')) { 2461 valid = new RegExp(pattern).test(inputText); 2462 } else { 2463 valid = true; 2464 } 2465 } 2466 // An empty field is valid if it's not required 2467 else if (!$el.prop('required')) { 2468 valid = true; 2469 } 2470 2471 return valid; 2472 } 2473 2474 /** 2475 * Determines whether or a not a radio input is valid based on whether or not it is required and selected. Although the function targets a single `<input>`, it validates by checking the `required` and `checked` properties of all radio buttons in its group. 2476 * @param {String} groupName - A string that specifies the name of a radio button group 2477 * @returns {Boolean} Boolean value depends on whether or not at least one radio input has been selected (if it's required) 2478 */ 2479 2480 }, { 2481 key: 'validateRadio', 2482 value: function validateRadio(groupName) { 2483 // If at least one radio in the group has the `required` attribute, the group is considered required 2484 // Per W3C spec, all radio buttons in a group should have `required`, but we're being nice 2485 var $group = this.$element.find(':radio[name="' + groupName + '"]'); 2486 var valid = false, 2487 required = false; 2488 2489 // For the group to be required, at least one radio needs to be required 2490 $group.each(function (i, e) { 2491 if ($(e).attr('required')) { 2492 required = true; 2493 } 2494 }); 2495 if (!required) valid = true; 2496 2497 if (!valid) { 2498 // For the group to be valid, at least one radio needs to be checked 2499 $group.each(function (i, e) { 2500 if ($(e).prop('checked')) { 2501 valid = true; 2502 } 2503 }); 2504 }; 2505 2506 return valid; 2507 } 2508 2509 /** 2510 * Determines if a selected input passes a custom validation function. Multiple validations can be used, if passed to the element with `data-validator="foo bar baz"` in a space separated listed. 2511 * @param {Object} $el - jQuery input element. 2512 * @param {String} validators - a string of function names matching functions in the Abide.options.validators object. 2513 * @param {Boolean} required - self explanatory? 2514 * @returns {Boolean} - true if validations passed. 2515 */ 2516 2517 }, {
2518 key: 'matchValidation', 2519 value: function matchValidation($el, validators, required) { 2520 var _this4 = this; 2521 2522 required = required ? true : false; 2523 2524 var clear = validators.split(' ').map(function (v) { 2525 return _this4.options.validators[v]($el, required, $el.parent()); 2526 }); 2527 return clear.indexOf(false) === -1; 2528 } 2529 2530 /** 2531 * Resets form inputs and styles 2532 * @fires Abide#formreset 2533 */ 2534 2535 }, { 2536 key: 'resetForm', 2537 value: function resetForm() { 2538 var $form = this.$element, 2539 opts = this.options; 2540 2541 $('.' + opts.labelErrorClass, $form).not('small').removeClass(opts.labelErrorClass); 2542 $('.' + opts.inputErrorClass, $form).not('small').removeClass(opts.inputErrorClass); 2543 $(opts.formErrorSelector + '.' + opts.formErrorClass).removeClass(opts.formErrorClass); 2544 $form.find('[data-abide-error]').css('display', 'none'); 2545 $(':input', $form).not(':button, :submit, :reset, :hidden, :radio, :checkbox, [data-abide-ignore]').val('').removeAttr('data-invalid'); 2546 $(':input:radio', $form).not('[data-abide-ignore]').prop('checked', false).removeAttr('data-invalid'); 2547 $(':input:checkbox', $form).not('[data-abide-ignore]').prop('checked', false).removeAttr('data-invalid'); 2548 /** 2549 * Fires when the form has been reset. 2550 * @event Abide#formreset 2551 */ 2552 $form.trigger('formreset.zf.abide', [$form]); 2553 } 2554 2555 /** 2556 * Destroys an instance of Abide. 2557 * Removes error styles and classes from elements, without resetting their values. 2558 */ 2559 2560 }, { 2561 key: 'destroy', 2562 value: function destroy() { 2563 var _this = this; 2564 this.$element.off('.abide').find('[data-abide-error]').css('display', 'none'); 2565 2566 this.$inputs.off('.abide').each(function () { 2567 _this.removeErrorClasses($(this)); 2568 }); 2569 2570 Foundation.unregisterPlugin(this); 2571 } 2572 }]); 2573 2574 return Abide; 2575 }(); 2576 2577 /** 2578 * Default settings for plugin 2579 */ 2580 2581 2582 Abide.defaults = { 2583 /** 2584 * The default event to validate inputs. Checkboxes and radios validate immediately. 2585 * Remove or change this value for manual validation. 2586 * @option 2587 * @example 'fieldChange' 2588 */ 2589 validateOn: 'fieldChange', 2590 2591 /** 2592 * Class to be applied to input labels on failed validation. 2593 * @option 2594 * @example 'is-invalid-label' 2595 */ 2596 labelErrorClass: 'is-invalid-label', 2597 2598 /** 2599 * Class to be applied to inputs on failed validation. 2600 * @option 2601 * @example 'is-invalid-input' 2602 */ 2603 inputErrorClass: 'is-invalid-input', 2604 2605 /** 2606 * Class selector to use to target Form Errors for show/hide. 2607 * @option 2608 * @example '.form-error' 2609 */ 2610 formErrorSelector: '.form-error', 2611 2612 /** 2613 * Class added to Form Errors on failed validation. 2614 * @option 2615 * @example 'is-visible' 2616 */ 2617 formErrorClass: 'is-visible', 2618 2619 /** 2620 * Set to true to validate text inputs on any value change. 2621 * @option 2622 * @example false 2623 */ 2624 liveValidate: false, 2625 2626 patterns: { 2627 alpha: /^[a-zA-Z]+$/, 2628 alpha_numeric: /^[a-zA-Z0-9]+$/, 2629 integer: /^[-+]?\d+$/, 2630 number: /^[-+]?\d*(?:[\.\,]\d+)?$/, 2631 2632 // amex, visa, diners 2633 card: /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/, 2634 cvv: /^([0-9]){3,4}$/, 2635 2636 // http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address 2637 email: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/,
2638 2639 url: /^(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/, 2640 // abc.de 2641 domain: /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,8}$/, 2642 2643 datetime: /^([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))$/, 2644 // YYYY-MM-DD 2645 date: /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))$/, 2646 // HH:MM:SS 2647 time: /^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/, 2648 dateISO: /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/, 2649 // MM/DD/YYYY 2650 month_day_year: /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/, 2651 // DD/MM/YYYY 2652 day_month_year: /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/, 2653 2654 // #FFF or #FFFFFF 2655 color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/ 2656 }, 2657 2658 /** 2659 * Optional validation functions to be used. `equalTo` being the only default included function. 2660 * Functions should return only a boolean if the input is valid or not. Functions are given the following arguments: 2661 * el : The jQuery element to validate. 2662 * required : Boolean value of the required attribute be present or not. 2663 * parent : The direct parent of the input. 2664 * @option 2665 */ 2666 validators: { 2667 equalTo: function (el, required, parent) { 2668 return $('#' + el.attr('data-equalto')).val() === el.val(); 2669 } 2670 } 2671 }; 2672 2673 // Window exports 2674 Foundation.plugin(Abide, 'Abide'); 2675}(jQuery); 2676'use strict'; 2677 2678var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 2679 2680function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2681 2682!function ($) { 2683 2684 /** 2685 * Accordion module. 2686 * @module foundation.accordion 2687 * @requires foundation.util.keyboard 2688 * @requires foundation.util.motion 2689 */ 2690 2691 var Accordion = function () { 2692 /** 2693 * Creates a new instance of an accordion. 2694 * @class 2695 * @fires Accordion#init 2696 * @param {jQuery} element - jQuery object to make into an accordion. 2697 * @param {Object} options - a plain object with settings to override the default options. 2698 */ 2699 function Accordion(element, options) { 2700 _classCallCheck(this, Accordion); 2701 2702 this.$element = element; 2703 this.options = $.extend({}, Accordion.defaults, this.$element.data(), options); 2704 2705 this._init(); 2706 2707 Foundation.registerPlugin(this, 'Accordion'); 2708 Foundation.Keyboard.register('Accordion', { 2709 'ENTER': 'toggle', 2710 'SPACE': 'toggle', 2711 'ARROW_DOWN': 'next', 2712 'ARROW_UP': 'previous' 2713 }); 2714 } 2715 2716 /** 2717 * Initializes the accordion by animating the preset active pane(s). 2718 * @private 2719 */ 2720 2721 2722 _createClass(Accordion, [{ 2723 key: '_init', 2724 value: function _init() { 2725 this.$element.attr('role', 'tablist'); 2726 this.$tabs = this.$element.children('li, [data-accordion-item]'); 2727 2728 this.$tabs.each(function (idx, el) { 2729 var $el = $(el), 2730 $content = $el.children('[data-tab-content]'), 2731 id = $content[0].id || Foundation.GetYoDigits(6, 'accordion'), 2732 linkId = el.id || id + '-label'; 2733 2734 $el.find('a:first').attr({ 2735 'aria-controls': id, 2736 'role': 'tab', 2737 'id': linkId, 2738 'aria-expanded': false, 2739 'aria-selected': false 2740 }); 2741 2742 $content.attr({ 'role': 'tabpanel', 'aria-labelledby': linkId, 'aria-hidden': true, 'id': id }); 2743 }); 2744 var $initActive = this.$element.find('.is-active').children('[data-tab-content]'); 2745 if ($initActive.length) { 2746 this.down($initActive, true); 2747 } 2748 this._events(); 2749 } 2750 2751 /** 2752 * Adds event handlers for items within the accordion. 2753 * @private 2754 */ 2755 2756 }, {
2757 key: '_events', 2758 value: function _events() { 2759 var _this = this; 2760 2761 this.$tabs.each(function () { 2762 var $elem = $(this); 2763 var $tabContent = $elem.children('[data-tab-content]'); 2764 if ($tabContent.length) { 2765 $elem.children('a').off('click.zf.accordion keydown.zf.accordion').on('click.zf.accordion', function (e) { 2766 e.preventDefault(); 2767 _this.toggle($tabContent); 2768 }).on('keydown.zf.accordion', function (e) { 2769 Foundation.Keyboard.handleKey(e, 'Accordion', { 2770 toggle: function () { 2771 _this.toggle($tabContent); 2772 }, 2773 next: function () { 2774 var $a = $elem.next().find('a').focus(); 2775 if (!_this.options.multiExpand) { 2776 $a.trigger('click.zf.accordion'); 2777 } 2778 }, 2779 previous: function () { 2780 var $a = $elem.prev().find('a').focus(); 2781 if (!_this.options.multiExpand) { 2782 $a.trigger('click.zf.accordion'); 2783 } 2784 }, 2785 handled: function () { 2786 e.preventDefault(); 2787 e.stopPropagation(); 2788 } 2789 }); 2790 }); 2791 } 2792 }); 2793 } 2794 2795 /** 2796 * Toggles the selected content pane's open/close state. 2797 * @param {jQuery} $target - jQuery object of the pane to toggle (`.accordion-content`). 2798 * @function 2799 */ 2800 2801 }, { 2802 key: 'toggle', 2803 value: function toggle($target) { 2804 if ($target.parent().hasClass('is-active')) { 2805 this.up($target); 2806 } else { 2807 this.down($target); 2808 } 2809 } 2810 2811 /** 2812 * Opens the accordion tab defined by `$target`. 2813 * @param {jQuery} $target - Accordion pane to open (`.accordion-content`). 2814 * @param {Boolean} firstTime - flag to determine if reflow should happen. 2815 * @fires Accordion#down 2816 * @function 2817 */ 2818 2819 }, { 2820 key: 'down', 2821 value: function down($target, firstTime) { 2822 var _this2 = this; 2823 2824 $target.attr('aria-hidden', false).parent('[data-tab-content]').addBack().parent().addClass('is-active'); 2825 2826 if (!this.options.multiExpand && !firstTime) { 2827 var $currentActive = this.$element.children('.is-active').children('[data-tab-content]'); 2828 if ($currentActive.length) { 2829 this.up($currentActive.not($target)); 2830 } 2831 } 2832 2833 $target.slideDown(this.options.slideSpeed, function () { 2834 /** 2835 * Fires when the tab is done opening. 2836 * @event Accordion#down 2837 */ 2838 _this2.$element.trigger('down.zf.accordion', [$target]); 2839 }); 2840 2841 $('#' + $target.attr('aria-labelledby')).attr({ 2842 'aria-expanded': true, 2843 'aria-selected': true 2844 }); 2845 } 2846 2847 /** 2848 * Closes the tab defined by `$target`. 2849 * @param {jQuery} $target - Accordion tab to close (`.accordion-content`). 2850 * @fires Accordion#up 2851 * @function 2852 */ 2853 2854 }, { 2855 key: 'up', 2856 value: function up($target) { 2857 var $aunts = $target.parent().siblings(), 2858 _this = this; 2859 2860 if (!this.options.allowAllClosed && !$aunts.hasClass('is-active') || !$target.parent().hasClass('is-active')) { 2861 return; 2862 } 2863 2864 // Foundation.Move(this.options.slideSpeed, $target, function(){ 2865 $target.slideUp(_this.options.slideSpeed, function () { 2866 /** 2867 * Fires when the tab is done collapsing up. 2868 * @event Accordion#up 2869 */ 2870 _this.$element.trigger('up.zf.accordion', [$target]); 2871 }); 2872 // }); 2873 2874 $target.attr('aria-hidden', true).parent().removeClass('is-active'); 2875 2876 $('#' + $target.attr('aria-labelledby')).attr({ 2877 'aria-expanded': false, 2878 'aria-selected': false 2879 }); 2880 } 2881 2882 /** 2883 * Destroys an instance of an accordion. 2884 * @fires Accordion#destroyed 2885 * @function 2886 */ 2887 2888 }, {
2889 key: 'destroy', 2890 value: function destroy() { 2891 this.$element.find('[data-tab-content]').stop(true).slideUp(0).css('display', ''); 2892 this.$element.find('a').off('.zf.accordion'); 2893 2894 Foundation.unregisterPlugin(this); 2895 } 2896 }]); 2897 2898 return Accordion; 2899 }(); 2900 2901 Accordion.defaults = { 2902 /** 2903 * Amount of time to animate the opening of an accordion pane. 2904 * @option 2905 * @example 250 2906 */ 2907 slideSpeed: 250, 2908 /** 2909 * Allow the accordion to have multiple open panes. 2910 * @option 2911 * @example false 2912 */ 2913 multiExpand: false, 2914 /** 2915 * Allow the accordion to close all panes. 2916 * @option 2917 * @example false 2918 */ 2919 allowAllClosed: false 2920 }; 2921 2922 // Window exports 2923 Foundation.plugin(Accordion, 'Accordion'); 2924}(jQuery); 2925'use strict'; 2926 2927var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 2928 2929function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2930 2931!function ($) { 2932 2933 /** 2934 * AccordionMenu module. 2935 * @module foundation.accordionMenu 2936 * @requires foundation.util.keyboard 2937 * @requires foundation.util.motion 2938 * @requires foundation.util.nest 2939 */ 2940 2941 var AccordionMenu = function () { 2942 /** 2943 * Creates a new instance of an accordion menu. 2944 * @class 2945 * @fires AccordionMenu#init 2946 * @param {jQuery} element - jQuery object to make into an accordion menu. 2947 * @param {Object} options - Overrides to the default plugin settings. 2948 */ 2949 function AccordionMenu(element, options) { 2950 _classCallCheck(this, AccordionMenu); 2951 2952 this.$element = element; 2953 this.options = $.extend({}, AccordionMenu.defaults, this.$element.data(), options); 2954 2955 Foundation.Nest.Feather(this.$element, 'accordion'); 2956 2957 this._init(); 2958 2959 Foundation.registerPlugin(this, 'AccordionMenu'); 2960 Foundation.Keyboard.register('AccordionMenu', { 2961 'ENTER': 'toggle', 2962 'SPACE': 'toggle', 2963 'ARROW_RIGHT': 'open', 2964 'ARROW_UP': 'up', 2965 'ARROW_DOWN': 'down', 2966 'ARROW_LEFT': 'close', 2967 'ESCAPE': 'closeAll' 2968 }); 2969 } 2970 2971 /** 2972 * Initializes the accordion menu by hiding all nested menus. 2973 * @private 2974 */ 2975 2976 2977 _createClass(AccordionMenu, [{ 2978 key: '_init', 2979 value: function _init() { 2980 this.$element.find('[data-submenu]').not('.is-active').slideUp(0); //.find('a').css('padding-left', '1rem'); 2981 this.$element.attr({ 2982 'role': 'menu', 2983 'aria-multiselectable': this.options.multiOpen 2984 }); 2985 2986 this.$menuLinks = this.$element.find('.is-accordion-submenu-parent'); 2987 this.$menuLinks.each(function () { 2988 var linkId = this.id || Foundation.GetYoDigits(6, 'acc-menu-link'), 2989 $elem = $(this), 2990 $sub = $elem.children('[data-submenu]'), 2991 subId = $sub[0].id || Foundation.GetYoDigits(6, 'acc-menu'), 2992 isActive = $sub.hasClass('is-active'); 2993 $elem.attr({ 2994 'aria-controls': subId, 2995 'aria-expanded': isActive, 2996 'role': 'menuitem', 2997 'id': linkId 2998 }); 2999 $sub.attr({ 3000 'aria-labelledby': linkId, 3001 'aria-hidden': !isActive, 3002 'role': 'menu', 3003 'id': subId 3004 }); 3005 }); 3006 var initPanes = this.$element.find('.is-active'); 3007 if (initPanes.length) { 3008 var _this = this; 3009 initPanes.each(function () { 3010 _this.down($(this)); 3011 }); 3012 } 3013 this._events(); 3014 } 3015 3016 /** 3017 * Adds event handlers for items within the menu. 3018 * @private 3019 */ 3020 3021 }, {
3022 key: '_events', 3023 value: function _events() { 3024 var _this = this; 3025 3026 this.$element.find('li').each(function () { 3027 var $submenu = $(this).children('[data-submenu]'); 3028 3029 if ($submenu.length) { 3030 $(this).children('a').off('click.zf.accordionMenu').on('click.zf.accordionMenu', function (e) { 3031 e.preventDefault(); 3032 3033 _this.toggle($submenu); 3034 }); 3035 } 3036 }).on('keydown.zf.accordionmenu', function (e) { 3037 var $element = $(this), 3038 $elements = $element.parent('ul').children('li'), 3039 $prevElement, 3040 $nextElement, 3041 $target = $element.children('[data-submenu]'); 3042 3043 $elements.each(function (i) { 3044 if ($(this).is($element)) { 3045 $prevElement = $elements.eq(Math.max(0, i - 1)).find('a').first(); 3046 $nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1)).find('a').first(); 3047 3048 if ($(this).children('[data-submenu]:visible').length) { 3049 // has open sub menu 3050 $nextElement = $element.find('li:first-child').find('a').first(); 3051 } 3052 if ($(this).is(':first-child')) { 3053 // is first element of sub menu 3054 $prevElement = $element.parents('li').first().find('a').first(); 3055 } else if ($prevElement.parents('li').first().children('[data-submenu]:visible').length) { 3056 // if previous element has open sub menu 3057 $prevElement = $prevElement.parents('li').find('li:last-child').find('a').first(); 3058 } 3059 if ($(this).is(':last-child')) { 3060 // is last element of sub menu 3061 $nextElement = $element.parents('li').first().next('li').find('a').first(); 3062 } 3063 3064 return; 3065 } 3066 }); 3067 3068 Foundation.Keyboard.handleKey(e, 'AccordionMenu', { 3069 open: function () { 3070 if ($target.is(':hidden')) { 3071 _this.down($target); 3072 $target.find('li').first().find('a').first().focus(); 3073 } 3074 }, 3075 close: function () { 3076 if ($target.length && !$target.is(':hidden')) { 3077 // close active sub of this item 3078 _this.up($target); 3079 } else if ($element.parent('[data-submenu]').length) { 3080 // close currently open sub 3081 _this.up($element.parent('[data-submenu]')); 3082 $element.parents('li').first().find('a').first().focus(); 3083 } 3084 }, 3085 up: function () { 3086 $prevElement.focus(); 3087 return true; 3088 }, 3089 down: function () { 3090 $nextElement.focus(); 3091 return true; 3092 }, 3093 toggle: function () { 3094 if ($element.children('[data-submenu]').length) { 3095 _this.toggle($element.children('[data-submenu]')); 3096 } 3097 }, 3098 closeAll: function () { 3099 _this.hideAll(); 3100 }, 3101 handled: function (preventDefault) { 3102 if (preventDefault) { 3103 e.preventDefault(); 3104 } 3105 e.stopImmediatePropagation(); 3106 } 3107 }); 3108 }); //.attr('tabindex', 0); 3109 } 3110 3111 /** 3112 * Closes all panes of the menu. 3113 * @function 3114 */ 3115 3116 }, { 3117 key: 'hideAll', 3118 value: function hideAll() { 3119 this.$element.find('[data-submenu]').slideUp(this.options.slideSpeed); 3120 } 3121 3122 /** 3123 * Toggles the open/close state of a submenu. 3124 * @function 3125 * @param {jQuery} $target - the submenu to toggle 3126 */ 3127 3128 }, { 3129 key: 'toggle', 3130 value: function toggle($target) { 3131 if (!$target.is(':animated')) { 3132 if (!$target.is(':hidden')) { 3133 this.up($target); 3134 } else { 3135 this.down($target); 3136 } 3137 } 3138 } 3139 3140 /** 3141 * Opens the sub-menu defined by `$target`. 3142 * @param {jQuery} $target - Sub-menu to open. 3143 * @fires AccordionMenu#down 3144 */ 3145 3146 }, {
3147 key: 'down', 3148 value: function down($target) { 3149 var _this = this; 3150 3151 if (!this.options.multiOpen) { 3152 this.up(this.$element.find('.is-active').not($target.parentsUntil(this.$element).add($target))); 3153 } 3154 3155 $target.addClass('is-active').attr({ 'aria-hidden': false }).parent('.is-accordion-submenu-parent').attr({ 'aria-expanded': true }); 3156 3157 //Foundation.Move(this.options.slideSpeed, $target, function() { 3158 $target.slideDown(_this.options.slideSpeed, function () { 3159 /** 3160 * Fires when the menu is done opening. 3161 * @event AccordionMenu#down 3162 */ 3163 _this.$element.trigger('down.zf.accordionMenu', [$target]); 3164 }); 3165 //}); 3166 } 3167 3168 /** 3169 * Closes the sub-menu defined by `$target`. All sub-menus inside the target will be closed as well. 3170 * @param {jQuery} $target - Sub-menu to close. 3171 * @fires AccordionMenu#up 3172 */ 3173 3174 }, { 3175 key: 'up', 3176 value: function up($target) { 3177 var _this = this; 3178 //Foundation.Move(this.options.slideSpeed, $target, function(){ 3179 $target.slideUp(_this.options.slideSpeed, function () { 3180 /** 3181 * Fires when the menu is done collapsing up. 3182 * @event AccordionMenu#up 3183 */ 3184 _this.$element.trigger('up.zf.accordionMenu', [$target]); 3185 }); 3186 //}); 3187 3188 var $menus = $target.find('[data-submenu]').slideUp(0).addBack().attr('aria-hidden', true); 3189 3190 $menus.parent('.is-accordion-submenu-parent').attr('aria-expanded', false); 3191 } 3192 3193 /** 3194 * Destroys an instance of accordion menu. 3195 * @fires AccordionMenu#destroyed 3196 */ 3197 3198 }, { 3199 key: 'destroy', 3200 value: function destroy() { 3201 this.$element.find('[data-submenu]').slideDown(0).css('display', ''); 3202 this.$element.find('a').off('click.zf.accordionMenu'); 3203 3204 Foundation.Nest.Burn(this.$element, 'accordion'); 3205 Foundation.unregisterPlugin(this); 3206 } 3207 }]); 3208 3209 return AccordionMenu; 3210 }(); 3211 3212 AccordionMenu.defaults = { 3213 /** 3214 * Amount of time to animate the opening of a submenu in ms. 3215 * @option 3216 * @example 250 3217 */ 3218 slideSpeed: 250, 3219 /** 3220 * Allow the menu to have multiple open panes. 3221 * @option 3222 * @example true 3223 */ 3224 multiOpen: true 3225 }; 3226 3227 // Window exports 3228 Foundation.plugin(AccordionMenu, 'AccordionMenu'); 3229}(jQuery); 3230'use strict'; 3231 3232var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 3233 3234function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 3235 3236!function ($) { 3237 3238 /** 3239 * Drilldown module. 3240 * @module foundation.drilldown 3241 * @requires foundation.util.keyboard 3242 * @requires foundation.util.motion 3243 * @requires foundation.util.nest 3244 */ 3245 3246 var Drilldown = function () { 3247 /** 3248 * Creates a new instance of a drilldown menu. 3249 * @class 3250 * @param {jQuery} element - jQuery object to make into an accordion menu. 3251 * @param {Object} options - Overrides to the default plugin settings. 3252 */ 3253 function Drilldown(element, options) { 3254 _classCallCheck(this, Drilldown); 3255 3256 this.$element = element; 3257 this.options = $.extend({}, Drilldown.defaults, this.$element.data(), options); 3258 3259 Foundation.Nest.Feather(this.$element, 'drilldown'); 3260 3261 this._init(); 3262 3263 Foundation.registerPlugin(this, 'Drilldown'); 3264 Foundation.Keyboard.register('Drilldown', { 3265 'ENTER': 'open', 3266 'SPACE': 'open',
vendor: 6,857 bytes, lines 3267-3465
3267 'ARROW_RIGHT': 'next', 3268 'ARROW_UP': 'up', 3269 'ARROW_DOWN': 'down', 3270 'ARROW_LEFT': 'previous', 3271 'ESCAPE': 'close', 3272 'TAB': 'down', 3273 'SHIFT_TAB': 'up' 3274 }); 3275 } 3276 3277 /** 3278 * Initializes the drilldown by creating jQuery collections of elements 3279 * @private 3280 */ 3281 3282 3283 _createClass(Drilldown, [{ 3284 key: '_init', 3285 value: function _init() { 3286 this.$submenuAnchors = this.$element.find('li.is-drilldown-submenu-parent').children('a'); 3287 this.$submenus = this.$submenuAnchors.parent('li').children('[data-submenu]'); 3288 this.$menuItems = this.$element.find('li').not('.js-drilldown-back').attr('role', 'menuitem').find('a'); 3289 3290 this._prepareMenu(); 3291 3292 this._keyboardEvents(); 3293 } 3294 3295 /** 3296 * prepares drilldown menu by setting attributes to links and elements 3297 * sets a min height to prevent content jumping 3298 * wraps the element if not already wrapped 3299 * @private 3300 * @function 3301 */ 3302 3303 }, { 3304 key: '_prepareMenu', 3305 value: function _prepareMenu() { 3306 var _this = this; 3307 // if(!this.options.holdOpen){ 3308 // this._menuLinkEvents(); 3309 // } 3310 this.$submenuAnchors.each(function () { 3311 var $link = $(this); 3312 var $sub = $link.parent(); 3313 if (_this.options.parentLink) { 3314 $link.clone().prependTo($sub.children('[data-submenu]')).wrap('<li class="is-submenu-parent-item is-submenu-item is-drilldown-submenu-item" role="menu-item"></li>'); 3315 } 3316 $link.data('savedHref', $link.attr('href')).removeAttr('href').attr('tabindex', 0); 3317 $link.children('[data-submenu]').attr({ 3318 'aria-hidden': true, 3319 'tabindex': 0, 3320 'role': 'menu' 3321 }); 3322 _this._events($link); 3323 }); 3324 this.$submenus.each(function () { 3325 var $menu = $(this), 3326 $back = $menu.find('.js-drilldown-back'); 3327 if (!$back.length) { 3328 $menu.prepend(_this.options.backButton); 3329 } 3330 _this._back($menu); 3331 }); 3332 if (!this.$element.parent().hasClass('is-drilldown')) { 3333 this.$wrapper = $(this.options.wrapper).addClass('is-drilldown'); 3334 this.$wrapper = this.$element.wrap(this.$wrapper).parent().css(this._getMaxDims()); 3335 } 3336 } 3337 3338 /** 3339 * Adds event handlers to elements in the menu. 3340 * @function 3341 * @private 3342 * @param {jQuery} $elem - the current menu item to add handlers to. 3343 */ 3344 3345 }, { 3346 key: '_events', 3347 value: function _events($elem) { 3348 var _this = this; 3349 3350 $elem.off('click.zf.drilldown').on('click.zf.drilldown', function (e) { 3351 if ($(e.target).parentsUntil('ul', 'li').hasClass('is-drilldown-submenu-parent')) { 3352 e.stopImmediatePropagation(); 3353 e.preventDefault(); 3354 } 3355 3356 // if(e.target !== e.currentTarget.firstElementChild){ 3357 // return false; 3358 // } 3359 _this._show($elem.parent('li')); 3360 3361 if (_this.options.closeOnClick) { 3362 var $body = $('body'); 3363 $body.off('.zf.drilldown').on('click.zf.drilldown', function (e) { 3364 if (e.target === _this.$element[0] || $.contains(_this.$element[0], e.target)) { 3365 return; 3366 } 3367 e.preventDefault(); 3368 _this._hideAll(); 3369 $body.off('.zf.drilldown'); 3370 }); 3371 } 3372 }); 3373 } 3374 3375 /** 3376 * Adds keydown event listener to `li`'s in the menu. 3377 * @private 3378 */ 3379 3380 }, { 3381 key: '_keyboardEvents', 3382 value: function _keyboardEvents() { 3383 var _this = this; 3384 3385 this.$menuItems.add(this.$element.find('.js-drilldown-back > a')).on('keydown.zf.drilldown', function (e) { 3386 3387 var $element = $(this), 3388 $elements = $element.parent('li').parent('ul').children('li').children('a'), 3389 $prevElement, 3390 $nextElement; 3391 3392 $elements.each(function (i) { 3393 if ($(this).is($element)) { 3394 $prevElement = $elements.eq(Math.max(0, i - 1)); 3395 $nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1)); 3396 return; 3397 } 3398 }); 3399 3400 Foundation.Keyboard.handleKey(e, 'Drilldown', { 3401 next: function () { 3402 if ($element.is(_this.$submenuAnchors)) { 3403 _this._show($element.parent('li')); 3404 $element.parent('li').one(Foundation.transitionend($element), function () { 3405 $element.parent('li').find('ul li a').filter(_this.$menuItems).first().focus(); 3406 }); 3407 return true; 3408 } 3409 }, 3410 previous: function () { 3411 _this._hide($element.parent('li').parent('ul')); 3412 $element.parent('li').parent('ul').one(Foundation.transitionend($element), function () { 3413 setTimeout(function () { 3414 $element.parent('li').parent('ul').parent('li').children('a').first().focus(); 3415 }, 1); 3416 }); 3417 return true; 3418 }, 3419 up: function () { 3420 $prevElement.focus(); 3421 return true; 3422 }, 3423 down: function () { 3424 $nextElement.focus(); 3425 return true; 3426 }, 3427 close: function () { 3428 _this._back(); 3429 //_this.$menuItems.first().focus(); // focus to first element 3430 }, 3431 open: function () { 3432 if (!$element.is(_this.$menuItems)) { 3433 // not menu item means back button 3434 _this._hide($element.parent('li').parent('ul')); 3435 $element.parent('li').parent('ul').one(Foundation.transitionend($element), function () { 3436 setTimeout(function () { 3437 $element.parent('li').parent('ul').parent('li').children('a').first().focus(); 3438 }, 1); 3439 }); 3440 return true; 3441 } else if ($element.is(_this.$submenuAnchors)) { 3442 _this._show($element.parent('li')); 3443 $element.parent('li').one(Foundation.transitionend($element), function () { 3444 $element.parent('li').find('ul li a').filter(_this.$menuItems).first().focus(); 3445 }); 3446 return true; 3447 } 3448 }, 3449 handled: function (preventDefault) { 3450 if (preventDefault) { 3451 e.preventDefault(); 3452 } 3453 e.stopImmediatePropagation(); 3454 } 3455 }); 3456 }); // end keyboardAccess 3457 } 3458 3459 /** 3460 * Closes all open elements, and returns to root menu. 3461 * @function 3462 * @fires Drilldown#closed 3463 */ 3464 3465 }, {
3466 key: '_hideAll', 3467 value: function _hideAll() { 3468 var $elem = this.$element.find('.is-drilldown-submenu.is-active').addClass('is-closing'); 3469 $elem.one(Foundation.transitionend($elem), function (e) { 3470 $elem.removeClass('is-active is-closing'); 3471 }); 3472 /** 3473 * Fires when the menu is fully closed. 3474 * @event Drilldown#closed 3475 */ 3476 this.$element.trigger('closed.zf.drilldown'); 3477 } 3478 3479 /** 3480 * Adds event listener for each `back` button, and closes open menus. 3481 * @function 3482 * @fires Drilldown#back 3483 * @param {jQuery} $elem - the current sub-menu to add `back` event. 3484 */ 3485 3486 }, { 3487 key: '_back', 3488 value: function _back($elem) { 3489 var _this = this; 3490 $elem.off('click.zf.drilldown'); 3491 $elem.children('.js-drilldown-back').on('click.zf.drilldown', function (e) { 3492 e.stopImmediatePropagation(); 3493 // console.log('mouseup on back'); 3494 _this._hide($elem); 3495 3496 // If there is a parent submenu, call show 3497 var parentSubMenu = $elem.parent('li').parent('ul').parent('li'); 3498 if (parentSubMenu.length) { 3499 _this._show(parentSubMenu); 3500 } 3501 }); 3502 } 3503 3504 /** 3505 * Adds event listener to menu items w/o submenus to close open menus on click. 3506 * @function 3507 * @private 3508 */ 3509 3510 }, { 3511 key: '_menuLinkEvents', 3512 value: function _menuLinkEvents() { 3513 var _this = this; 3514 this.$menuItems.not('.is-drilldown-submenu-parent').off('click.zf.drilldown').on('click.zf.drilldown', function (e) { 3515 // e.stopImmediatePropagation(); 3516 setTimeout(function () { 3517 _this._hideAll(); 3518 }, 0); 3519 }); 3520 } 3521 3522 /** 3523 * Opens a submenu. 3524 * @function 3525 * @fires Drilldown#open 3526 * @param {jQuery} $elem - the current element with a submenu to open, i.e. the `li` tag. 3527 */ 3528 3529 }, { 3530 key: '_show', 3531 value: function _show($elem) { 3532 $elem.attr('aria-expanded', true); 3533 $elem.children('[data-submenu]').addClass('is-active').attr('aria-hidden', false); 3534 /** 3535 * Fires when the submenu has opened. 3536 * @event Drilldown#open 3537 */ 3538 this.$element.trigger('open.zf.drilldown', [$elem]); 3539 } 3540 }, { 3541 key: '_hide', 3542 3543 3544 /** 3545 * Hides a submenu 3546 * @function 3547 * @fires Drilldown#hide 3548 * @param {jQuery} $elem - the current sub-menu to hide, i.e. the `ul` tag. 3549 */ 3550 value: function _hide($elem) { 3551 var _this = this; 3552 $elem.parent('li').attr('aria-expanded', false); 3553 $elem.attr('aria-hidden', true).addClass('is-closing').one(Foundation.transitionend($elem), function () { 3554 $elem.removeClass('is-active is-closing'); 3555 $elem.blur(); 3556 }); 3557 /** 3558 * Fires when the submenu has closed. 3559 * @event Drilldown#hide 3560 */ 3561 $elem.trigger('hide.zf.drilldown', [$elem]); 3562 } 3563 3564 /** 3565 * Iterates through the nested menus to calculate the min-height, and max-width for the menu. 3566 * Prevents content jumping. 3567 * @function 3568 * @private 3569 */ 3570 3571 }, { 3572 key: '_getMaxDims', 3573 value: function _getMaxDims() { 3574 var biggest = 0; 3575 var result = {}; 3576 3577 this.$submenus.add(this.$element).each(function (i, elem) { 3578 var height = elem.getBoundingClientRect().height; 3579 if (height > biggest) biggest = height; 3580 }); 3581 3582 result['min-height'] = biggest + 'px'; 3583 result['max-width'] = this.$element[0].getBoundingClientRect().width + 'px'; 3584 3585 return result; 3586 } 3587 3588 /** 3589 * Destroys the Drilldown Menu 3590 * @function 3591 */ 3592 3593 }, { 3594 key: 'destroy', 3595 value: function destroy() { 3596 this._hideAll(); 3597 Foundation.Nest.Burn(this.$element, 'drilldown'); 3598 this.$element.unwrap().find('.js-drilldown-back, .is-submenu-parent-item').remove().end().find('.is-active, .is-closing, .is-drilldown-submenu').removeClass('is-active is-closing is-drilldown-submenu').end().find('[data-submenu]').removeAttr('aria-hidden tabindex role'); 3599 this.$submenuAnchors.each(function () { 3600 $(this).off('.zf.drilldown'); 3601 }); 3602 this.$element.find('a').each(function () { 3603 var $link = $(this); 3604 $link.removeAttr('tabindex'); 3605 if ($link.data('savedHref')) { 3606 $link.attr('href', $link.data('savedHref')).removeData('savedHref'); 3607 } else { 3608 return; 3609 } 3610 }); 3611 Foundation.unregisterPlugin(this); 3612 } 3613 }]); 3614 3615 return Drilldown; 3616 }(); 3617 3618 Drilldown.defaults = { 3619 /** 3620 * Markup used for JS generated back button. Prepended to submenu lists and deleted on `destroy` method, 'js-drilldown-back' class required. Remove the backslash (`\`) if copy and pasting. 3621 * @option 3622 * @example '<\li><\a>Back<\/a><\/li>' 3623 */ 3624 backButton: '<li class="js-drilldown-back"><a tabindex="0">Back</a></li>', 3625 /** 3626 * Markup used to wrap drilldown menu. Use a class name for independent styling; the JS applied class: `is-drilldown` is required. Remove the backslash (`\`) if copy and pasting. 3627 * @option 3628 * @example '<\div class="is-drilldown"><\/div>' 3629 */ 3630 wrapper: '<div></div>', 3631 /** 3632 * Adds the parent link to the submenu. 3633 * @option 3634 * @example false 3635 */ 3636 parentLink: false, 3637 /** 3638 * Allow the menu to return to root list on body click. 3639 * @option 3640 * @example false 3641 */ 3642 closeOnClick: false 3643 // holdOpen: false 3644 }; 3645 3646 // Window exports 3647 Foundation.plugin(Drilldown, 'Drilldown'); 3648}(jQuery); 3649'use strict'; 3650 3651var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 3652 3653function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 3654 3655!function ($) { 3656 3657 /** 3658 * Dropdown module. 3659 * @module foundation.dropdown 3660 * @requires foundation.util.keyboard 3661 * @requires foundation.util.box 3662 * @requires foundation.util.triggers 3663 */ 3664 3665 var Dropdown = function () { 3666 /** 3667 * Creates a new instance of a dropdown. 3668 * @class 3669 * @param {jQuery} element - jQuery object to make into a dropdown. 3670 * Object should be of the dropdown panel, rather than
3670its anchor. 3671 * @param {Object} options - Overrides to the default plugin settings. 3672 */ 3673 function Dropdown(element, options) { 3674 _classCallCheck(this, Dropdown); 3675 3676 this.$element = element; 3677 this.options = $.extend({}, Dropdown.defaults, this.$element.data(), options); 3678 this._init(); 3679 3680 Foundation.registerPlugin(this, 'Dropdown'); 3681 Foundation.Keyboard.register('Dropdown', { 3682 'ENTER': 'open', 3683 'SPACE': 'open', 3684 'ESCAPE': 'close', 3685 'TAB': 'tab_forward', 3686 'SHIFT_TAB': 'tab_backward' 3687 }); 3688 } 3689 3690 /** 3691 * Initializes the plugin by setting/checking options and attributes, adding helper variables, and saving the anchor. 3692 * @function 3693 * @private 3694 */ 3695 3696 3697 _createClass(Dropdown, [{ 3698 key: '_init', 3699 value: function _init() { 3700 var $id = this.$element.attr('id'); 3701 3702 this.$anchor = $('[data-toggle="' + $id + '"]').length ? $('[data-toggle="' + $id + '"]') : $('[data-open="' + $id + '"]'); 3703 this.$anchor.attr({ 3704 'aria-controls': $id, 3705 'data-is-focus': false, 3706 'data-yeti-box': $id, 3707 'aria-haspopup': true, 3708 'aria-expanded': false 3709 3710 }); 3711 3712 this.options.positionClass = this.getPositionClass(); 3713 this.counter = 4; 3714 this.usedPositions = []; 3715 this.$element.attr({ 3716 'aria-hidden': 'true', 3717 'data-yeti-box': $id, 3718 'data-resize': $id, 3719 'aria-labelledby': this.$anchor[0].id || Foundation.GetYoDigits(6, 'dd-anchor') 3720 }); 3721 this._events(); 3722 } 3723 3724 /** 3725 * Helper function to determine current orientation of dropdown pane. 3726 * @function 3727 * @returns {String} position - string value of a position class. 3728 */ 3729 3730 }, { 3731 key: 'getPositionClass', 3732 value: function getPositionClass() { 3733 var verticalPosition = this.$element[0].className.match(/(top|left|right|bottom)/g); 3734 verticalPosition = verticalPosition ? verticalPosition[0] : ''; 3735 var horizontalPosition = /float-(\S+)/.exec(this.$anchor[0].className); 3736 horizontalPosition = horizontalPosition ? horizontalPosition[1] : ''; 3737 var position = horizontalPosition ? horizontalPosition + ' ' + verticalPosition : verticalPosition; 3738 3739 return position; 3740 } 3741 3742 /** 3743 * Adjusts the dropdown panes orientation by adding/removing positioning classes. 3744 * @function 3745 * @private 3746 * @param {String} position - position class to remove. 3747 */ 3748 3749 }, { 3750 key: '_reposition', 3751 value: function _reposition(position) { 3752 this.usedPositions.push(position ? position : 'bottom'); 3753 //default, try switching to opposite side 3754 if (!position && this.usedPositions.indexOf('top') < 0) { 3755 this.$element.addClass('top'); 3756 } else if (position === 'top' && this.usedPositions.indexOf('bottom') < 0) { 3757 this.$element.removeClass(position); 3758 } else if (position === 'left' && this.usedPositions.indexOf('right') < 0) { 3759 this.$element.removeClass(position).addClass('right'); 3760 } else if (position === 'right' && this.usedPositions.indexOf('left') < 0) { 3761 this.$element.removeClass(position).addClass('left'); 3762 } 3763 3764 //if default change didn't work, try bottom or left first 3765 else if (!position && this.usedPositions.indexOf('top') > -1 && this.usedPositions.indexOf('left') < 0) { 3766 this.$element.addClass('left'); 3767 } else if (position === 'top' && this.usedPositions.indexOf('bottom') > -1 && this.usedPositions.indexOf('left') < 0) { 3768 this.$element.removeClass(position).addClass('left'); 3769 } else if (position === 'left' && this.usedPositions.indexOf('right') > -1 && this.usedPositions.indexOf('bottom') < 0) { 3770 this.$element.removeClass(position); 3771 } else if (position === 'right' && this.usedPositions.indexOf('left') > -1 && this.usedPositions.indexOf('bottom') < 0) { 3772 this.$element.removeClass(position); 3773 } 3774 //if nothing cleared, set to bottom 3775 else { 3776 this.$element.removeClass(position); 3777 } 3778 this.classChanged = true; 3779 this.counter--; 3780 } 3781 3782 /** 3783 * Sets the position and orientation of the dropdown pane, checks for c
3783ollisions. 3784 * Recursively calls itself if a collision is detected, with a new position class. 3785 * @function 3786 * @private 3787 */ 3788 3789 }, { 3790 key: '_setPosition', 3791 value: function _setPosition() { 3792 if (this.$anchor.attr('aria-expanded') === 'false') { 3793 return false; 3794 } 3795 var position = this.getPositionClass(), 3796 $eleDims = Foundation.Box.GetDimensions(this.$element), 3797 $anchorDims = Foundation.Box.GetDimensions(this.$anchor), 3798 _this = this, 3799 direction = position === 'left' ? 'left' : position === 'right' ? 'left' : 'top', 3800 param = direction === 'top' ? 'height' : 'width', 3801 offset = param === 'height' ? this.options.vOffset : this.options.hOffset; 3802 3803 if ($eleDims.width >= $eleDims.windowDims.width || !this.counter && !Foundation.Box.ImNotTouchingYou(this.$element)) { 3804 this.$element.offset(Foundation.Box.GetOffsets(this.$element, this.$anchor, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({ 3805 'width': $eleDims.windowDims.width - this.options.hOffset * 2, 3806 'height': 'auto' 3807 }); 3808 this.classChanged = true; 3809 return false; 3810 } 3811 3812 this.$element.offset(Foundation.Box.GetOffsets(this.$element, this.$anchor, position, this.options.vOffset, this.options.hOffset)); 3813 3814 while (!Foundation.Box.ImNotTouchingYou(this.$element, false, true) && this.counter) { 3815 this._reposition(position); 3816 this._setPosition(); 3817 } 3818 } 3819 3820 /** 3821 * Adds event listeners to the element utilizing the triggers utility library. 3822 * @function 3823 * @private 3824 */ 3825 3826 }, { 3827 key: '_events', 3828 value: function _events() { 3829 var _this = this; 3830 this.$element.on({ 3831 'open.zf.trigger': this.open.bind(this), 3832 'close.zf.trigger': this.close.bind(this), 3833 'toggle.zf.trigger': this.toggle.bind(this), 3834 'resizeme.zf.trigger': this._setPosition.bind(this) 3835 }); 3836 3837 if (this.options.hover) { 3838 this.$anchor.off('mouseenter.zf.dropdown mouseleave.zf.dropdown').on('mouseenter.zf.dropdown', function () { 3839 if ($('body[data-whatinput="mouse"]').is('*')) { 3840 clearTimeout(_this.timeout); 3841 _this.timeout = setTimeout(function () { 3842 _this.open(); 3843 _this.$anchor.data('hover', true); 3844 }, _this.options.hoverDelay); 3845 } 3846 }).on('mouseleave.zf.dropdown', function () { 3847 clearTimeout(_this.timeout); 3848 _this.timeout = setTimeout(function () { 3849 _this.close(); 3850 _this.$anchor.data('hover', false); 3851 }, _this.options.hoverDelay); 3852 }); 3853 if (this.options.hoverPane) { 3854 this.$element.off('mouseenter.zf.dropdown mouseleave.zf.dropdown').on('mouseenter.zf.dropdown', function () { 3855 clearTimeout(_this.timeout); 3856 }).on('mouseleave.zf.dropdown', function () { 3857 clearTimeout(_this.timeout); 3858 _this.timeout = setTimeout(function () { 3859 _this.close(); 3860 _this.$anchor.data('hover', false); 3861 }, _this.options.hoverDelay); 3862 }); 3863 } 3864 } 3865 this.$anchor.add(this.$element).on('keydown.zf.dropdown', function (e) { 3866 3867 var $target = $(this), 3868 visibleFocusableElements = Foundation.Keyboard.findFocusable(_this.$element); 3869 3870 Foundation.Keyboard.handleKey(e, 'Dropdown', { 3871 tab_forward: function () { 3872 if (_this.$element.find(':focus').is(visibleFocusableElements.eq(-1))) { 3873 // left modal downwards, setting focus to first element 3874 if (_this.options.trapFocus) { 3875 // if focus shall be trapped 3876 visibleFocusableElements.eq(0).focus(); 3877 e.preventDefault(); 3878 } else { 3879 // if focus is not trapped, close dropdown on focus out 3880 _this.close(); 3881 } 3882 } 3883 }, 3884 tab_backward: function () { 3885 if (_this.$element.find(':focus').is(visibleFocusableElements.eq(0)) || _this.$element.is(':focus')) { 3886 // left modal upwards, setting focus to last element 3887 if (_this.options.trapFocus) { 3888 // if focus shall be trapped 3889 visibleFocusableElements.eq(-1).focus(); 3890 e.preventDefault(); 3891 } else { 3892 // if focus is not trapped, close dropdown on focus out 3893 _this.close(); 3894 } 3895 } 3896 }, 3897 open: function () { 3898 if ($target.is(_this.$anchor)) { 3899 _this.open(); 3900 _this.$element.attr('tabindex', -1).focus(); 3901 e.preventDefault(); 3902 } 3903 }, 3904 close: function () { 3905 _this.close(); 3906 _this.$anchor.focus(); 3907 } 3908 }); 3909 }); 3910 } 3911 3912 /** 3913 * Adds an event handler to the body to close any dropdowns on a click. 3914 * @function 3915 * @private 3916 */ 3917 3918 }, {
3919 key: '_addBodyHandler', 3920 value: function _addBodyHandler() { 3921 var $body = $(document.body).not(this.$element), 3922 _this = this; 3923 $body.off('click.zf.dropdown').on('click.zf.dropdown', function (e) { 3924 if (_this.$anchor.is(e.target) || _this.$anchor.find(e.target).length) { 3925 return; 3926 } 3927 if (_this.$element.find(e.target).length) { 3928 return; 3929 } 3930 _this.close(); 3931 $body.off('click.zf.dropdown'); 3932 }); 3933 } 3934 3935 /** 3936 * Opens the dropdown pane, and fires a bubbling event to close other dropdowns. 3937 * @function 3938 * @fires Dropdown#closeme 3939 * @fires Dropdown#show 3940 */ 3941 3942 }, { 3943 key: 'open', 3944 value: function open() { 3945 // var _this = this; 3946 /** 3947 * Fires to close other open dropdowns 3948 * @event Dropdown#closeme 3949 */ 3950 this.$element.trigger('closeme.zf.dropdown', this.$element.attr('id')); 3951 this.$anchor.addClass('hover').attr({ 'aria-expanded': true }); 3952 // this.$element/*.show()*/; 3953 this._setPosition(); 3954 this.$element.addClass('is-open').attr({ 'aria-hidden': false }); 3955 3956 if (this.options.autoFocus) { 3957 var $focusable = Foundation.Keyboard.findFocusable(this.$element); 3958 if ($focusable.length) { 3959 $focusable.eq(0).focus(); 3960 } 3961 } 3962 3963 if (this.options.closeOnClick) { 3964 this._addBodyHandler(); 3965 } 3966 3967 /** 3968 * Fires once the dropdown is visible. 3969 * @event Dropdown#show 3970 */ 3971 this.$element.trigger('show.zf.dropdown', [this.$element]); 3972 } 3973 3974 /** 3975 * Closes the open dropdown pane. 3976 * @function 3977 * @fires Dropdown#hide 3978 */ 3979 3980 }, { 3981 key: 'close', 3982 value: function close() { 3983 if (!this.$element.hasClass('is-open')) { 3984 return false; 3985 } 3986 this.$element.removeClass('is-open').attr({ 'aria-hidden': true }); 3987 3988 this.$anchor.removeClass('hover').attr('aria-expanded', false); 3989 3990 if (this.classChanged) { 3991 var curPositionClass = this.getPositionClass(); 3992 if (curPositionClass) { 3993 this.$element.removeClass(curPositionClass); 3994 } 3995 this.$element.addClass(this.options.positionClass) 3996 /*.hide()*/.css({ height: '', width: '' }); 3997 this.classChanged = false; 3998 this.counter = 4; 3999 this.usedPositions.length = 0; 4000 } 4001 this.$element.trigger('hide.zf.dropdown', [this.$element]); 4002 } 4003 4004 /** 4005 * Toggles the dropdown pane's visibility. 4006 * @function 4007 */ 4008 4009 }, { 4010 key: 'toggle', 4011 value: function toggle() { 4012 if (this.$element.hasClass('is-open')) { 4013 if (this.$anchor.data('hover')) return; 4014 this.close(); 4015 } else { 4016 this.open(); 4017 } 4018 } 4019 4020 /** 4021 * Destroys the dropdown. 4022 * @function 4023 */ 4024 4025 }, { 4026 key: 'destroy', 4027 value: function destroy() { 4028 this.$element.off('.zf.trigger').hide(); 4029 this.$anchor.off('.zf.dropdown'); 4030 4031 Foundation.unregisterPlugin(this); 4032 } 4033 }]); 4034 4035 return Dropdown; 4036 }(); 4037 4038 Dropdown.defaults = { 4039 /** 4040 * Amount of time to delay opening a submenu on hover event. 4041 * @option 4042 * @example 250 4043 */ 4044 hoverDelay: 250, 4045 /** 4046 * Allow submenus to open on hover events 4047 * @option 4048 * @example false 4049 */ 4050 hover: false, 4051 /** 4052 * Don't close dropdown when hovering over dropdown pane 4053 * @option 4054 * @example true 4055 */ 4056 hoverPane: false, 4057 /** 4058 * Number of pixels between the dropdown pane and the triggering element on open. 4059 * @option 4060 * @example 1 4061 */ 4062 vOffset: 1, 4063 /** 4064 * Number of pixels between the dropdown pane and the triggering element on open. 4065 * @option 4066 * @example 1 4067 */ 4068 hOffset: 1, 4069 /** 4070 * Class applied to adjust open position. JS will test and fill this in. 4071 * @option 4072 * @example 'top' 4073 */ 4074 positionClass: '', 4075 /** 4076 * Allow the plugin to trap focus to the dropdown pane if opened with keyboard commands. 4077 * @option 4078 * @example false 4079 */ 4080 trapFocus: false, 4081 /** 4082 * Allow the plugin to set focus to the first focusable element within the pane, regardless of method of opening. 4083 * @option 4084 * @example true 4085 */ 4086 autoFocus: false, 4087 /** 4088 * Allows a click on the body to close the dropdown. 4089 * @option 4090 * @example false 4091 */ 4092 closeOnClick: false 4093 }; 4094 4095 // Window exports 4096 Foundation.plugin(Dropdown, 'Dropdown'); 4097}(jQuery); 4098'use strict'; 4099 4100var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4101 4102function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4103 4104!function ($) { 4105 4106 /** 4107 * DropdownMenu module. 4108 * @module foundation.dropdown-menu 4109 * @requires foundation.util.keyboard 4110 * @requires foundation.util.box 4111 * @requires foundation.util.nest 4112 */ 4113 4114 var DropdownMenu = function () { 4115 /** 4116 * Creates a new instance of DropdownMenu. 4117 * @class 4118 * @fires DropdownMenu#init 4119 * @param {jQuery} element - jQuery object to make into a dropdown menu. 4120 * @param {Object} options - Overrides to the default plugin settings. 4121 */ 4122 function DropdownMenu(element, options) { 4123 _classCallCheck(this, DropdownMenu); 4124 4125 this.$element = element; 4126 this.options = $.extend({}, DropdownMenu.defaults, this.$element.data(), options); 4127 4128 Foundation.Nest.Feather(this.$element, 'dropdown'); 4129 this._init(); 4130 4131 Foundation.registerPlugin(this, 'DropdownMenu'); 4132 Foundation.Keyboard.register('DropdownMenu', { 4133 'ENTER': 'open', 4134 'SPACE': 'open',
4135 'ARROW_RIGHT': 'next', 4136 'ARROW_UP': 'up', 4137 'ARROW_DOWN': 'down', 4138 'ARROW_LEFT': 'previous', 4139 'ESCAPE': 'close' 4140 }); 4141 } 4142 4143 /** 4144 * Initializes the plugin, and calls _prepareMenu 4145 * @private 4146 * @function 4147 */ 4148 4149 4150 _createClass(DropdownMenu, [{ 4151 key: '_init', 4152 value: function _init() { 4153 var subs = this.$element.find('li.is-dropdown-submenu-parent'); 4154 this.$element.children('.is-dropdown-submenu-parent').children('.is-dropdown-submenu').addClass('first-sub'); 4155 4156 this.$menuItems = this.$element.find('[role="menuitem"]'); 4157 this.$tabs = this.$element.children('[role="menuitem"]'); 4158 this.$tabs.find('ul.is-dropdown-submenu').addClass(this.options.verticalClass); 4159 4160 if (this.$element.hasClass(this.options.rightClass) || this.options.alignment === 'right' || Foundation.rtl() || this.$element.parents('.top-bar-right').is('*')) { 4161 this.options.alignment = 'right'; 4162 subs.addClass('opens-left'); 4163 } else { 4164 subs.addClass('opens-right'); 4165 } 4166 this.changed = false; 4167 this._events(); 4168 } 4169 }, { 4170 key: '_isVertical', 4171 value: function _isVertical() { 4172 return this.$tabs.css('display') === 'block'; 4173 } 4174 4175 /** 4176 * Adds event listeners to elements within the menu 4177 * @private 4178 * @function 4179 */ 4180 4181 }, { 4182 key: '_events', 4183 value: function _events() { 4184 var _this = this, 4185 hasTouch = 'ontouchstart' in window || typeof window.ontouchstart !== 'undefined', 4186 parClass = 'is-dropdown-submenu-parent'; 4187 4188 // used for onClick and in the keyboard handlers 4189 var handleClickFn = function (e) { 4190 var $elem = $(e.target).parentsUntil('ul', '.' + parClass), 4191 hasSub = $elem.hasClass(parClass), 4192 hasClicked = $elem.attr('data-is-click') === 'true', 4193 $sub = $elem.children('.is-dropdown-submenu'); 4194 4195 if (hasSub) { 4196 if (hasClicked) { 4197 if (!_this.options.closeOnClick || !_this.options.clickOpen && !hasTouch || _this.options.forceFollow && hasTouch) { 4198 return; 4199 } else { 4200 e.stopImmediatePropagation(); 4201 e.preventDefault(); 4202 _this._hide($elem); 4203 } 4204 } else { 4205 e.preventDefault(); 4206 e.stopImmediatePropagation(); 4207 _this._show($sub); 4208 $elem.add($elem.parentsUntil(_this.$element, '.' + parClass)).attr('data-is-click', true); 4209 } 4210 } else { 4211 if (_this.options.closeOnClickInside) { 4212 _this._hide($elem); 4213 } 4214 return; 4215 } 4216 }; 4217 4218 if (this.options.clickOpen || hasTouch) { 4219 this.$menuItems.on('click.zf.dropdownmenu touchstart.zf.dropdownmenu', handleClickFn); 4220 } 4221 4222 if (!this.options.disableHover) { 4223 this.$menuItems.on('mouseenter.zf.dropdownmenu', function (e) { 4224 var $elem = $(this), 4225 hasSub = $elem.hasClass(parClass); 4226 4227 if (hasSub) { 4228 clearTimeout(_this.delay); 4229 _this.delay = setTimeout(function () { 4230 _this._show($elem.children('.is-dropdown-submenu')); 4231 }, _this.options.hoverDelay); 4232 } 4233 }).on('mouseleave.zf.dropdownmenu', function (e) { 4234 var $elem = $(this), 4235 hasSub = $elem.hasClass(parClass); 4236 if (hasSub && _this.options.autoclose) { 4237 if ($elem.attr('data-is-click') === 'true' && _this.options.clickOpen) { 4238 return false; 4239 } 4240 4241 clearTimeout(_this.delay); 4242 _this.delay = setTimeout(function () { 4243 _this._hide($elem); 4244 }, _this.options.closingTime); 4245 } 4246 }); 4247 } 4248 this.$menuItems.on('keydown.zf.dropdownmenu', function (e) { 4249 var $element = $(e.target).parentsUntil('ul', '[role="menuitem"]'), 4250 isTab = _this.$tabs.index($element) > -1, 4251 $elements = isTab ? _this.$tabs : $element.siblings('li').add($element), 4252 $prevElement, 4253 $nextElement; 4254 4255 $elements.each(function (i) { 4256 if ($(this).is($element)) { 4257 $prevElement = $elements.eq(i - 1); 4258 $nextElement = $elements.eq(i + 1); 4259 return; 4260 } 4261 }); 4262 4263 var nextSibling = function () { 4264 if (!$element.is(':last-child')) { 4265 $nextElement.children('a:first').focus(); 4266 e.preventDefault(); 4267 } 4268 }, 4269 prevSibling = function () { 4270 $prevElement.children('a:first').focus(); 4271 e.preventDefault(); 4272 }, 4273 openSub = function () {
4274 var $sub = $element.children('ul.is-dropdown-submenu'); 4275 if ($sub.length) { 4276 _this._show($sub); 4277 $element.find('li > a:first').focus(); 4278 e.preventDefault(); 4279 } else { 4280 return; 4281 } 4282 }, 4283 closeSub = function () { 4284 //if ($element.is(':first-child')) { 4285 var close = $element.parent('ul').parent('li'); 4286 close.children('a:first').focus(); 4287 _this._hide(close); 4288 e.preventDefault(); 4289 //} 4290 }; 4291 var functions = { 4292 open: openSub, 4293 close: function () { 4294 _this._hide(_this.$element); 4295 _this.$menuItems.find('a:first').focus(); // focus to first element 4296 e.preventDefault(); 4297 }, 4298 handled: function () { 4299 e.stopImmediatePropagation(); 4300 } 4301 }; 4302 4303 if (isTab) { 4304 if (_this._isVertical()) { 4305 // vertical menu 4306 if (Foundation.rtl()) { 4307 // right aligned 4308 $.extend(functions, { 4309 down: nextSibling, 4310 up: prevSibling, 4311 next: closeSub, 4312 previous: openSub 4313 }); 4314 } else { 4315 // left aligned 4316 $.extend(functions, { 4317 down: nextSibling, 4318 up: prevSibling, 4319 next: openSub, 4320 previous: closeSub 4321 }); 4322 } 4323 } else { 4324 // horizontal menu 4325 if (Foundation.rtl()) { 4326 // right aligned 4327 $.extend(functions, { 4328 next: prevSibling, 4329 previous: nextSibling, 4330 down: openSub, 4331 up: closeSub 4332 }); 4333 } else { 4334 // left aligned 4335 $.extend(functions, { 4336 next: nextSibling, 4337 previous: prevSibling, 4338 down: openSub, 4339 up: closeSub 4340 }); 4341 } 4342 } 4343 } else { 4344 // not tabs -> one sub 4345 if (Foundation.rtl()) { 4346 // right aligned 4347 $.extend(functions, { 4348 next: closeSub, 4349 previous: openSub, 4350 down: nextSibling, 4351 up: prevSibling 4352 }); 4353 } else { 4354 // left aligned 4355 $.extend(functions, { 4356 next: openSub, 4357 previous: closeSub, 4358 down: nextSibling, 4359 up: prevSibling 4360 }); 4361 } 4362 } 4363 Foundation.Keyboard.handleKey(e, 'DropdownMenu', functions); 4364 }); 4365 } 4366 4367 /** 4368 * Adds an event handler to the body to close any dropdowns on a click. 4369 * @function 4370 * @private 4371 */ 4372 4373 }, { 4374 key: '_addBodyHandler', 4375 value: function _addBodyHandler() { 4376 var $body = $(document.body), 4377 _this = this; 4378 $body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu').on('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu', function (e) { 4379 var $link = _this.$element.find(e.target); 4380 if ($link.length) { 4381 return; 4382 } 4383 4384 _this._hide(); 4385 $body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu'); 4386 }); 4387 } 4388 4389 /** 4390 * Opens a dropdown pane, and checks for collisions first. 4391 * @param {jQuery} $sub - ul element that is a submenu to show 4392 * @function 4393 * @private 4394 * @fires DropdownMenu#show 4395 */ 4396 4397 }, { 4398 key: '_show', 4399 value: function _show($sub) { 4400 var idx = this.$tabs.index(this.$tabs.filter(function (i, el) { 4401 return $(el).find($sub).length > 0; 4402 })); 4403 var $sibs = $sub.parent('li.is-dropdown-submenu-parent').siblings('li.is-dropdown-submenu-parent'); 4404 this._hide($sibs, idx); 4405 $sub.css('visibility', 'hidden').addClass('js-dropdown-active').attr({ 'aria-hidden': false }).parent('li.is-dropdown-submenu-parent').addClass('is-active').attr({ 'aria-expanded': true }); 4406 var clear = Foundation.Box.ImNotTouchingYou($sub, null, true); 4407 if (!clear) { 4408 var oldClass = this.options.alignment === 'left' ? '-right' : '-left', 4409 $parentLi = $sub.parent('.is-dropdown-submenu-parent'); 4410 $parentLi.removeClass('opens' + oldClass).addClass('opens-' + this.options.alignment); 4411 clear = Foundation.Box.ImNotTouchingYou($sub, null, true); 4412 if (!clear) { 4413 $parentLi.removeClass('opens-' + this.options.alignment).addClass('opens-inner'); 4414 } 4415 this.changed = true; 4416 } 4417 $sub.css('visibility', ''); 4418 if (this.options.closeOnClick) { 4419 this._addBodyHandler(); 4420 } 4421 /** 4422 * Fires when the new dropdown pane is visible. 4423 * @event DropdownMenu#show 4424 */ 4425 this.$element.trigger('show.zf.dropdownmenu', [$sub]); 4426 } 4427 4428 /** 4429 * Hides a single, currently open dropdown pane, if passed a parameter, otherwise, hides everything. 4430 * @function 4431 * @param {jQuery} $elem - element with a submenu to hide 4432 * @param {Number} idx - index of the $tabs collection to hide 4433 * @private 4434 */ 4435 4436 }, {
4437 key: '_hide', 4438 value: function _hide($elem, idx) { 4439 var $toClose; 4440 if ($elem && $elem.length) { 4441 $toClose = $elem; 4442 } else if (idx !== undefined) { 4443 $toClose = this.$tabs.not(function (i, el) { 4444 return i === idx; 4445 }); 4446 } else { 4447 $toClose = this.$element; 4448 } 4449 var somethingToClose = $toClose.hasClass('is-active') || $toClose.find('.is-active').length > 0; 4450 4451 if (somethingToClose) { 4452 $toClose.find('li.is-active').add($toClose).attr({ 4453 'aria-expanded': false, 4454 'data-is-click': false 4455 }).removeClass('is-active'); 4456 4457 $toClose.find('ul.js-dropdown-active').attr({ 4458 'aria-hidden': true 4459 }).removeClass('js-dropdown-active'); 4460 4461 if (this.changed || $toClose.find('opens-inner').length) { 4462 var oldClass = this.options.alignment === 'left' ? 'right' : 'left'; 4463 $toClose.find('li.is-dropdown-submenu-parent').add($toClose).removeClass('opens-inner opens-' + this.options.alignment).addClass('opens-' + oldClass); 4464 this.changed = false; 4465 } 4466 /** 4467 * Fires when the open menus are closed. 4468 * @event DropdownMenu#hide 4469 */ 4470 this.$element.trigger('hide.zf.dropdownmenu', [$toClose]); 4471 } 4472 } 4473 4474 /** 4475 * Destroys the plugin. 4476 * @function 4477 */ 4478 4479 }, { 4480 key: 'destroy', 4481 value: function destroy() { 4482 this.$menuItems.off('.zf.dropdownmenu').removeAttr('data-is-click').removeClass('is-right-arrow is-left-arrow is-down-arrow opens-right opens-left opens-inner'); 4483 $(document.body).off('.zf.dropdownmenu'); 4484 Foundation.Nest.Burn(this.$element, 'dropdown'); 4485 Foundation.unregisterPlugin(this); 4486 } 4487 }]); 4488 4489 return DropdownMenu; 4490 }(); 4491 4492 /** 4493 * Default settings for plugin 4494 */ 4495 4496 4497 DropdownMenu.defaults = { 4498 /** 4499 * Disallows hover events from opening submenus 4500 * @option 4501 * @example false 4502 */ 4503 disableHover: false, 4504 /** 4505 * Allow a submenu to automatically close on a mouseleave event, if not clicked open. 4506 * @option 4507 * @example true 4508 */ 4509 autoclose: true, 4510 /** 4511 * Amount of time to delay opening a submenu on hover event. 4512 * @option 4513 * @example 50 4514 */ 4515 hoverDelay: 50, 4516 /** 4517 * Allow a submenu to open/remain open on parent click event. Allows cursor to move away from menu. 4518 * @option 4519 * @example true 4520 */ 4521 clickOpen: false, 4522 /** 4523 * Amount of time to delay closing a submenu on a mouseleave event. 4524 * @option 4525 * @example 500 4526 */ 4527 4528 closingTime: 500, 4529 /** 4530 * Position of the menu relative to what direction the submenus should open. Handled by JS. 4531 * @option 4532 * @example 'left' 4533 */ 4534 alignment: 'left', 4535 /** 4536 * Allow clicks on the body to close any open submenus. 4537 * @option 4538 * @example true 4539 */ 4540 closeOnClick: true, 4541 /** 4542 * Allow clicks on leaf anchor links to close any open submenus. 4543 * @option 4544 * @example true 4545 */ 4546 closeOnClickInside: true, 4547 /** 4548 * Class applied to vertical oriented menus, Foundation default is `vertical`. Update this if using your own class. 4549 * @option 4550 * @example 'vertical' 4551 */ 4552 verticalClass: 'vertical', 4553 /** 4554 * Class applied to right-side oriented menus, Foundation default is `align-right`. Update this if using your own class. 4555 * @option 4556 * @example 'align-right' 4557 */ 4558 rightClass: 'align-right', 4559 /** 4560 * Boolean to force overide the clicking of links to perform default action, on second touch event for mobile. 4561 * @option 4562 * @example false 4563 */ 4564 forceFollow: true 4565 }; 4566 4567 // Window exports 4568 Foundation.plugin(DropdownMenu, 'DropdownMenu'); 4569}(jQuery); 4570'use strict'; 4571 4572var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4573 4574function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4575 4576!function ($) { 4577 4578 /** 4579 * Equalizer module. 4580 * @module foundation.equalizer 4581 * @requires foundation.util.mediaQuery 4582 * @requires foundation.util.timerAndImageLoader if equalizer contains images 4583 */ 4584 4585 var Equalizer = function () { 4586 /** 4587 * Creates a new instance of Equalizer. 4588 * @class 4589 * @fires Equalizer#init 4590 * @param {Object} element - jQuery object to add the trigger to. 4591 * @param {Object} options - Overrides to the default plugin settings. 4592 */ 4593 function Equalizer(element, options) { 4594 _classCallCheck(this, Equalizer); 4595 4596 this.$element = element; 4597 this.options = $.extend({}, Equalizer.defaults, this.$element.data(), options); 4598 4599 this._init(); 4600 4601 Foundation.registerPlugin(this, 'Equalizer'); 4602 } 4603 4604 /** 4605 * Initializes the Equalizer plugin and calls functions to get equalizer functioning on load. 4606 * @private 4607 */ 4608 4609 4610 _createClass(Equalizer, [{ 4611 key: '_init', 4612 value: function _init() { 4613 var eqId = this.$element.attr('data-equalizer') || ''; 4614 var $watched = this.$element.find('[data-equalizer-watch="' + eqId + '"]'); 4615 4616 this.$watched = $watched.length ? $watched : this.$element.find('[data-equalizer-watch]'); 4617 this.$element.attr('data-resize', eqId || Foundation.GetYoDigits(6, 'eq')); 4618 4619 this.hasNested = this.$element.find('[data-equalizer]').length > 0; 4620 this.isNested = this.$element.parentsUntil(document.body, '[data-equalizer]').length > 0; 4621 this.isOn = false;
vendor: 4,716 bytes, lines 4622-4789
4622 this._bindHandler = { 4623 onResizeMeBound: this._onResizeMe.bind(this), 4624 onPostEqualizedBound: this._onPostEqualized.bind(this) 4625 }; 4626 4627 var imgs = this.$element.find('img'); 4628 var tooSmall; 4629 if (this.options.equalizeOn) { 4630 tooSmall = this._checkMQ(); 4631 $(window).on('changed.zf.mediaquery', this._checkMQ.bind(this)); 4632 } else { 4633 this._events(); 4634 } 4635 if (tooSmall !== undefined && tooSmall === false || tooSmall === undefined) { 4636 if (imgs.length) { 4637 Foundation.onImagesLoaded(imgs, this._reflow.bind(this)); 4638 } else { 4639 this._reflow(); 4640 } 4641 } 4642 } 4643 4644 /** 4645 * Removes event listeners if the breakpoint is too small. 4646 * @private 4647 */ 4648 4649 }, { 4650 key: '_pauseEvents', 4651 value: function _pauseEvents() { 4652 this.isOn = false; 4653 this.$element.off({ 4654 '.zf.equalizer': this._bindHandler.onPostEqualizedBound, 4655 'resizeme.zf.trigger': this._bindHandler.onResizeMeBound 4656 }); 4657 } 4658 4659 /** 4660 * function to handle $elements resizeme.zf.trigger, with bound this on _bindHandler.onResizeMeBound 4661 * @private 4662 */ 4663 4664 }, { 4665 key: '_onResizeMe', 4666 value: function _onResizeMe(e) { 4667 this._reflow(); 4668 } 4669 4670 /** 4671 * function to handle $elements postequalized.zf.equalizer, with bound this on _bindHandler.onPostEqualizedBound 4672 * @private 4673 */ 4674 4675 }, { 4676 key: '_onPostEqualized', 4677 value: function _onPostEqualized(e) { 4678 if (e.target !== this.$element[0]) { 4679 this._reflow(); 4680 } 4681 } 4682 4683 /** 4684 * Initializes events for Equalizer. 4685 * @private 4686 */ 4687 4688 }, { 4689 key: '_events', 4690 value: function _events() { 4691 var _this = this; 4692 this._pauseEvents(); 4693 if (this.hasNested) { 4694 this.$element.on('postequalized.zf.equalizer', this._bindHandler.onPostEqualizedBound); 4695 } else { 4696 this.$element.on('resizeme.zf.trigger', this._bindHandler.onResizeMeBound); 4697 } 4698 this.isOn = true; 4699 } 4700 4701 /** 4702 * Checks the current breakpoint to the minimum required size. 4703 * @private 4704 */ 4705 4706 }, { 4707 key: '_checkMQ', 4708 value: function _checkMQ() { 4709 var tooSmall = !Foundation.MediaQuery.atLeast(this.options.equalizeOn); 4710 if (tooSmall) { 4711 if (this.isOn) { 4712 this._pauseEvents(); 4713 this.$watched.css('height', 'auto'); 4714 } 4715 } else { 4716 if (!this.isOn) { 4717 this._events(); 4718 } 4719 } 4720 return tooSmall; 4721 } 4722 4723 /** 4724 * A noop version for the plugin 4725 * @private 4726 */ 4727 4728 }, { 4729 key: '_killswitch', 4730 value: function _killswitch() { 4731 return; 4732 } 4733 4734 /** 4735 * Calls necessary functions to update Equalizer upon DOM change 4736 * @private 4737 */ 4738 4739 }, { 4740 key: '_reflow', 4741 value: function _reflow() { 4742 if (!this.options.equalizeOnStack) { 4743 if (this._isStacked()) { 4744 this.$watched.css('height', 'auto'); 4745 return false; 4746 } 4747 } 4748 if (this.options.equalizeByRow) { 4749 this.getHeightsByRow(this.applyHeightByRow.bind(this)); 4750 } else { 4751 this.getHeights(this.applyHeight.bind(this)); 4752 } 4753 } 4754 4755 /** 4756 * Manually determines if the first 2 elements are *NOT* stacked. 4757 * @private 4758 */ 4759 4760 }, { 4761 key: '_isStacked', 4762 value: function _isStacked() { 4763 return this.$watched[0].getBoundingClientRect().top !== this.$watched[1].getBoundingClientRect().top; 4764 } 4765 4766 /** 4767 * Finds the outer heights of children contained within an Equalizer parent and returns them in an array 4768 * @param {Function} cb - A non-optional callback to return the heights array to. 4769 * @returns {Array} heights - An array of heights of children within Equalizer container 4770 */ 4771 4772 }, { 4773 key: 'getHeights', 4774 value: function getHeights(cb) { 4775 var heights = []; 4776 for (var i = 0, len = this.$watched.length; i < len; i++) { 4777 this.$watched[i].style.height = 'auto'; 4778 heights.push(this.$watched[i].offsetHeight); 4779 } 4780 cb(heights); 4781 } 4782 4783 /** 4784 * Finds the outer heights of children contained within an Equalizer parent and returns them in an array 4785 * @param {Function} cb - A non-optional callback to return the heights array to. 4786 * @returns {Array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child 4787 */ 4788 4789 }, {
4790 key: 'getHeightsByRow', 4791 value: function getHeightsByRow(cb) { 4792 var lastElTopOffset = this.$watched.length ? this.$watched.first().offset().top : 0, 4793 groups = [], 4794 group = 0; 4795 //group by Row 4796 groups[group] = []; 4797 for (var i = 0, len = this.$watched.length; i < len; i++) { 4798 this.$watched[i].style.height = 'auto'; 4799 //maybe could use this.$watched[i].offsetTop 4800 var elOffsetTop = $(this.$watched[i]).offset().top; 4801 if (elOffsetTop != lastElTopOffset) { 4802 group++; 4803 groups[group] = []; 4804 lastElTopOffset = elOffsetTop; 4805 } 4806 groups[group].push([this.$watched[i], this.$watched[i].offsetHeight]); 4807 } 4808 4809 for (var j = 0, ln = groups.length; j < ln; j++) { 4810 var heights = $(groups[j]).map(function () { 4811 return this[1]; 4812 }).get(); 4813 var max = Math.max.apply(null, heights); 4814 groups[j].push(max); 4815 } 4816 cb(groups); 4817 } 4818 4819 /** 4820 * Changes the CSS height property of each child in an Equalizer parent to match the tallest 4821 * @param {array} heights - An array of heights of children within Equalizer container 4822 * @fires Equalizer#preequalized 4823 * @fires Equalizer#postequalized 4824 */ 4825 4826 }, { 4827 key: 'applyHeight', 4828 value: function applyHeight(heights) { 4829 var max = Math.max.apply(null, heights); 4830 /** 4831 * Fires before the heights are applied 4832 * @event Equalizer#preequalized 4833 */ 4834 this.$element.trigger('preequalized.zf.equalizer'); 4835 4836 this.$watched.css('height', max); 4837 4838 /** 4839 * Fires when the heights have been applied 4840 * @event Equalizer#postequalized 4841 */ 4842 this.$element.trigger('postequalized.zf.equalizer'); 4843 } 4844 4845 /** 4846 * Changes the CSS height property of each child in an Equalizer parent to match the tallest by row 4847 * @param {array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child 4848 * @fires Equalizer#preequalized 4849 * @fires Equalizer#preequalizedRow 4850 * @fires Equalizer#postequalizedRow 4851 * @fires Equalizer#postequalized 4852 */ 4853 4854 }, { 4855 key: 'applyHeightByRow', 4856 value: function applyHeightByRow(groups) { 4857 /** 4858 * Fires before the heights are applied 4859 */ 4860 this.$element.trigger('preequalized.zf.equalizer'); 4861 for (var i = 0, len = groups.length; i < len; i++) { 4862 var groupsILength = groups[i].length, 4863 max = groups[i][groupsILength - 1]; 4864 if (groupsILength <= 2) { 4865 $(groups[i][0][0]).css({ 'height': 'auto' }); 4866 continue; 4867 } 4868 /** 4869 * Fires before the heights per row are applied 4870 * @event Equalizer#preequalizedRow 4871 */ 4872 this.$element.trigger('preequalizedrow.zf.equalizer'); 4873 for (var j = 0, lenJ = groupsILength - 1; j < lenJ; j++) { 4874 $(groups[i][j][0]).css({ 'height': max }); 4875 } 4876 /** 4877 * Fires when the heights per row have been applied 4878 * @event Equalizer#postequalizedRow 4879 */ 4880 this.$element.trigger('postequalizedrow.zf.equalizer'); 4881 } 4882 /** 4883 * Fires when the heights have been applied 4884 */ 4885 this.$element.trigger('postequalized.zf.equalizer'); 4886 } 4887 4888 /** 4889 * Destroys an instance of Equalizer. 4890 * @function 4891 */ 4892 4893 }, { 4894 key: 'destroy', 4895 value: function destroy() { 4896 this._pauseEvents(); 4897 this.$watched.css('height', 'auto'); 4898 4899 Foundation.unregisterPlugin(this); 4900 } 4901 }]); 4902 4903 return Equalizer; 4904 }(); 4905 4906 /** 4907 * Default settings for plugin 4908 */ 4909 4910 4911 Equalizer.defaults = { 4912 /** 4913 * Enable height equalization when stacked on smaller screens. 4914 * @option 4915 * @example true 4916 */ 4917 equalizeOnStack: false, 4918 /** 4919 * Enable height equalization row by row. 4920 * @option 4921 * @example false 4922 */ 4923 equalizeByRow: false, 4924 /** 4925 * String representing the minimum breakpoint size the plugin should equalize heights on. 4926 * @option 4927 * @example 'medium' 4928 */ 4929 equalizeOn: '' 4930 }; 4931 4932 // Window exports 4933 Foundation.plugin(Equalizer, 'Equalizer'); 4934}(jQuery); 4935'use strict'; 4936 4937var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4938 4939function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4940 4941!function ($) { 4942 4943 /** 4944 * Interchange module. 4945 * @module foundation.interchange 4946 * @requires foundation.util.mediaQuery 4947 * @requires foundation.util.timerAndImageLoader 4948 */ 4949 4950 var Interchange = function () { 4951 /** 4952 * Creates a new instance of Interchange. 4953 * @class 4954 * @fires Interchange#init 4955 * @param {Object} element - jQuery object to add the trigger to. 4956 * @param {Object} options - Overrides to the default plugin settings. 4957 */ 4958 function Interchange(element, options) { 4959 _classCallCheck(this, Interchange); 4960 4961 this.$element = element; 4962 this.options = $.extend({}, Interchange.defaults, options); 4963 this.rules = []; 4964 this.currentPath = ''; 4965 4966 this._init(); 4967 this._events(); 4968 4969 Foundation.registerPlugin(this, 'Interchange'); 4970 } 4971 4972 /** 4973 * Initializes the Interchange plugin and calls functions to get interchange functioning on load. 4974 * @function 4975 * @private 4976 */ 4977 4978 4979 _createClass(Interchange, [{ 4980 key: '_init', 4981 value: function _init() { 4982 this._addBreakpoints(); 4983 this._generateRules(); 4984 this._reflow(); 4985 } 4986 4987 /** 4988 * Initializes events for Interchange. 4989 * @function 4990 * @private 4991 */ 4992 4993 }, {
4994 key: '_events', 4995 value: function _events() { 4996 $(window).on('resize.zf.interchange', Foundation.util.throttle(this._reflow.bind(this), 50)); 4997 } 4998 4999 /** 5000 * Calls necessary functions to update Interchange upon DOM change 5001 * @function 5002 * @private 5003 */ 5004 5005 }, { 5006 key: '_reflow', 5007 value: function _reflow() { 5008 var match; 5009 5010 // Iterate through each rule, but only save the last match 5011 for (var i in this.rules) { 5012 if (this.rules.hasOwnProperty(i)) { 5013 var rule = this.rules[i]; 5014 5015 if (window.matchMedia(rule.query).matches) { 5016 match = rule; 5017 } 5018 } 5019 } 5020 5021 if (match) { 5022 this.replace(match.path); 5023 } 5024 } 5025 5026 /** 5027 * Gets the Foundation breakpoints and adds them to the Interchange.SPECIAL_QUERIES object. 5028 * @function 5029 * @private 5030 */ 5031 5032 }, { 5033 key: '_addBreakpoints', 5034 value: function _addBreakpoints() { 5035 for (var i in Foundation.MediaQuery.queries) { 5036 if (Foundation.MediaQuery.queries.hasOwnProperty(i)) { 5037 var query = Foundation.MediaQuery.queries[i]; 5038 Interchange.SPECIAL_QUERIES[query.name] = query.value; 5039 } 5040 } 5041 } 5042 5043 /** 5044 * Checks the Interchange element for the provided media query + content pairings 5045 * @function 5046 * @private 5047 * @param {Object} element - jQuery object that is an Interchange instance 5048 * @returns {Array} scenarios - Array of objects that have 'mq' and 'path' keys with corresponding keys 5049 */ 5050 5051 }, { 5052 key: '_generateRules', 5053 value: function _generateRules(element) { 5054 var rulesList = []; 5055 var rules; 5056 5057 if (this.options.rules) { 5058 rules = this.options.rules; 5059 } else { 5060 rules = this.$element.data('interchange').match(/\[.*?\]/g); 5061 } 5062 5063 for (var i in rules) { 5064 if (rules.hasOwnProperty(i)) { 5065 var rule = rules[i].slice(1, -1).split(', '); 5066 var path = rule.slice(0, -1).join(''); 5067 var query = rule[rule.length - 1]; 5068 5069 if (Interchange.SPECIAL_QUERIES[query]) { 5070 query = Interchange.SPECIAL_QUERIES[query]; 5071 } 5072 5073 rulesList.push({ 5074 path: path, 5075 query: query 5076 }); 5077 } 5078 } 5079 5080 this.rules = rulesList; 5081 } 5082 5083 /** 5084 * Update the `src` property of an image, or change the HTML of a container, to the specified path. 5085 * @function 5086 * @param {String} path - Path to the image or HTML partial. 5087 * @fires Interchange#replaced 5088 */ 5089 5090 }, { 5091 key: 'replace', 5092 value: function replace(path) { 5093 if (this.currentPath === path) return; 5094 5095 var _this = this, 5096 trigger = 'replaced.zf.interchange'; 5097 5098 // Replacing images 5099 if (this.$element[0].nodeName === 'IMG') { 5100 this.$element.attr('src', path).on('load', function () { 5101 _this.currentPath = path; 5102 }).trigger(trigger); 5103 } 5104 // Replacing background images 5105 else if (path.match(/\.(gif|jpg|jpeg|png|svg|tiff)([?#].*)?/i)) { 5106 this.$element.css({ 'background-image': 'url(' + path + ')' }).trigger(trigger); 5107 } 5108 // Replacing HTML 5109 else { 5110 $.get(path, function (response) { 5111 _this.$element.html(response).trigger(trigger); 5112 $(response).foundation(); 5113 _this.currentPath = path; 5114 }); 5115 } 5116 5117 /** 5118 * Fires when content in an Interchange element is done being loaded. 5119 * @event Interchange#replaced 5120 */ 5121 // this.$element.trigger('replaced.zf.interchange'); 5122 } 5123 5124 /** 5125 * Destroys an instance of interchange. 5126 * @function 5127 */ 5128 5129 }, { 5130 key: 'destroy', 5131 value: function destroy() { 5132 //TODO this. 5133 } 5134 }]); 5135 5136 return Interchange; 5137 }(); 5138 5139 /** 5140 * Default settings for plugin 5141 */ 5142 5143 5144 Interchange.defaults = { 5145 /** 5146 * Rules to be applied to Interchange elements. Set with the `data-interchange` array notation. 5147 * @option 5148 */ 5149 rules: null 5150 }; 5151 5152 Interchange.SPECIAL_QUERIES = { 5153 'landscape': 'screen and (orientation: landscape)', 5154 'portrait': 'screen and (orientation: portrait)', 5155 'retina': 'only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx)' 5156 }; 5157 5158 // Window exports 5159 Foundation.plugin(Interchange, 'Interchange'); 5160}(jQuery); 5161'use strict'; 5162 5163var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 5164 5165function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 5166 5167!function ($) { 5168 5169 /** 5170 * Magellan module. 5171 * @module foundation.magellan 5172 */ 5173 5174 var Magellan = function () { 5175 /** 5176 * Creates a new instance of Magellan. 5177 * @class 5178 * @fires Magellan#init 5179 * @param {Object} element - jQuery object to add the trigger to. 5180 * @param {Object} options - Overrides to the default plugin settings. 5181 */ 5182 function Magellan(element, options) { 5183 _classCallCheck(this, Magellan); 5184 5185 this.$element = element; 5186 this.options = $.extend({}, Magellan.defaults, this.$element.data(), options); 5187 5188 this._init(); 5189 5190 Foundation.registerPlugin(this, 'Magellan'); 5191 } 5192 5193 /** 5194 * Initializes the Magellan plugin and calls functions to get equalizer functioning on load. 5195 * @private 5196 */ 5197 5198 5199 _createClass(Magellan, [{ 5200 key: '_init', 5201 value: function _init() { 5202 var id = this.$element[0].id || Foundation.GetYoDigits(6, 'magellan'); 5203 var _this = this; 5204 this.$targets = $('[data-magellan-target]'); 5205 this.$links = this.$element.find('a'); 5206 this.$element.attr({ 5207 'data-resize': id, 5208 'data-scroll': id, 5209 'id': id 5210 }); 5211 this.$active = $(); 5212 this.scrollPos = parseInt(window.pageYOffset, 10); 5213 5214 this._events(); 5215 } 5216 5217 /** 5218 * Calculates an array of pixel values that are the demarcation lines between locations on the page. 5219 * Can be invoked if new elements are added or the size of a location changes. 5220 * @function 5221 */ 5222 5223 }, {
5224 key: 'calcPoints', 5225 value: function calcPoints() { 5226 var _this = this, 5227 body = document.body, 5228 html = document.documentElement; 5229 5230 this.points = []; 5231 this.winHeight = Math.round(Math.max(window.innerHeight, html.clientHeight)); 5232 this.docHeight = Math.round(Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight)); 5233 5234 this.$targets.each(function () { 5235 var $tar = $(this), 5236 pt = Math.round($tar.offset().top - _this.options.threshold); 5237 $tar.targetPoint = pt; 5238 _this.points.push(pt); 5239 }); 5240 } 5241 5242 /** 5243 * Initializes events for Magellan. 5244 * @private 5245 */ 5246 5247 }, { 5248 key: '_events', 5249 value: function _events() { 5250 var _this = this, 5251 $body = $('html, body'), 5252 opts = { 5253 duration: _this.options.animationDuration, 5254 easing: _this.options.animationEasing 5255 }; 5256 $(window).one('load', function () { 5257 if (_this.options.deepLinking) { 5258 if (location.hash) { 5259 _this.scrollToLoc(location.hash); 5260 } 5261 } 5262 _this.calcPoints(); 5263 _this._updateActive(); 5264 }); 5265 5266 this.$element.on({ 5267 'resizeme.zf.trigger': this.reflow.bind(this), 5268 'scrollme.zf.trigger': this._updateActive.bind(this) 5269 }).on('click.zf.magellan', 'a[href^="#"]', function (e) { 5270 e.preventDefault(); 5271 var arrival = this.getAttribute('href'); 5272 _this.scrollToLoc(arrival); 5273 }); 5274 } 5275 5276 /** 5277 * Function to scroll to a given location on the page. 5278 * @param {String} loc - a properly formatted jQuery id selector. Example: '#foo' 5279 * @function 5280 */ 5281 5282 }, { 5283 key: 'scrollToLoc', 5284 value: function scrollToLoc(loc) { 5285 // Do nothing if target does not exist to prevent errors 5286 if (!$(loc).length) { 5287 return false; 5288 } 5289 var scrollPos = Math.round($(loc).offset().top - this.options.threshold / 2 - this.options.barOffset); 5290 5291 $('html, body').stop(true).animate({ scrollTop: scrollPos }, this.options.animationDuration, this.options.animationEasing); 5292 } 5293 5294 /** 5295 * Calls necessary functions to update Magellan upon DOM change 5296 * @function 5297 */ 5298 5299 }, { 5300 key: 'reflow', 5301 value: function reflow() { 5302 this.calcPoints(); 5303 this._updateActive(); 5304 } 5305 5306 /** 5307 * Updates the visibility of an active location link, and updates the url hash for the page, if deepLinking enabled. 5308 * @private 5309 * @function 5310 * @fires Magellan#update 5311 */ 5312 5313 }, { 5314 key: '_updateActive', 5315 value: function _updateActive() /*evt, elem, scrollPos*/{ 5316 var winPos = /*scrollPos ||*/parseInt(window.pageYOffset, 10), 5317 curIdx; 5318 5319 if (winPos + this.winHeight === this.docHeight) { 5320 curIdx = this.points.length - 1; 5321 } else if (winPos < this.points[0]) { 5322 curIdx = 0; 5323 } else { 5324 var isDown = this.scrollPos < winPos, 5325 _this = this, 5326 curVisible = this.points.filter(function (p, i) { 5327 return isDown ? p - _this.options.barOffset <= winPos : p - _this.options.barOffset - _this.options.threshold <= winPos; 5328 }); 5329 curIdx = curVisible.length ? curVisible.length - 1 : 0; 5330 } 5331 5332 this.$active.removeClass(this.options.activeClass); 5333 this.$active = this.$links.filter('[href="#' + this.$targets.eq(curIdx).data('magellan-target') + '"]').addClass(this.options.activeClass); 5334 5335 if (this.options.deepLinking) { 5336 var hash = this.$active[0].getAttribute('href'); 5337 if (window.history.pushState) { 5338 window.history.pushState(null, null, hash); 5339 } else { 5340 window.location.hash = hash; 5341 } 5342 } 5343 5344 this.scrollPos = winPos; 5345 /** 5346 * Fires when magellan is finished updating to the new active element. 5347 * @event Magellan#update 5348 */ 5349 this.$element.trigger('update.zf.magellan', [this.$active]); 5350 } 5351 5352 /** 5353 * Destroys an instance of Magellan and resets the url of the window. 5354 * @function 5355 */ 5356 5357 }, {
5358 key: 'destroy', 5359 value: function destroy() { 5360 this.$element.off('.zf.trigger .zf.magellan').find('.' + this.options.activeClass).removeClass(this.options.activeClass); 5361 5362 if (this.options.deepLinking) { 5363 var hash = this.$active[0].getAttribute('href'); 5364 window.location.hash.replace(hash, ''); 5365 } 5366 5367 Foundation.unregisterPlugin(this); 5368 } 5369 }]); 5370 5371 return Magellan; 5372 }(); 5373 5374 /** 5375 * Default settings for plugin 5376 */ 5377 5378 5379 Magellan.defaults = { 5380 /** 5381 * Amount of time, in ms, the animated scrolling should take between locations. 5382 * @option 5383 * @example 500 5384 */ 5385 animationDuration: 500, 5386 /** 5387 * Animation style to use when scrolling between locations. 5388 * @option 5389 * @example 'ease-in-out' 5390 */ 5391 animationEasing: 'linear', 5392 /** 5393 * Number of pixels to use as a marker for location changes. 5394 * @option 5395 * @example 50 5396 */ 5397 threshold: 50, 5398 /** 5399 * Class applied to the active locations link on the magellan container. 5400 * @option 5401 * @example 'active' 5402 */ 5403 activeClass: 'active', 5404 /** 5405 * Allows the script to manipulate the url of the current page, and if supported, alter the history. 5406 * @option 5407 * @example true 5408 */ 5409 deepLinking: false, 5410 /** 5411 * Number of pixels to offset the scroll of the page on item click if using a sticky nav bar. 5412 * @option 5413 * @example 25 5414 */ 5415 barOffset: 0 5416 }; 5417 5418 // Window exports 5419 Foundation.plugin(Magellan, 'Magellan'); 5420}(jQuery); 5421'use strict'; 5422 5423var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 5424 5425function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 5426 5427!function ($) { 5428 5429 /** 5430 * OffCanvas module. 5431 * @module foundation.offcanvas 5432 * @requires foundation.util.mediaQuery 5433 * @requires foundation.util.triggers 5434 * @requires foundation.util.motion 5435 */ 5436 5437 var OffCanvas = function () { 5438 /** 5439 * Creates a new instance of an off-canvas wrapper. 5440 * @class 5441 * @fires OffCanvas#init 5442 * @param {Object} element - jQuery object to initialize. 5443 * @param {Object} options - Overrides to the default plugin settings. 5444 */ 5445 function OffCanvas(element, options) { 5446 _classCallCheck(this, OffCanvas); 5447 5448 this.$element = element; 5449 this.options = $.extend({}, OffCanvas.defaults, this.$element.data(), options); 5450 this.$lastTrigger = $(); 5451 this.$triggers = $(); 5452 5453 this._init(); 5454 this._events(); 5455 5456 Foundation.registerPlugin(this, 'OffCanvas'); 5457 Foundation.Keyboard.register('OffCanvas', { 5458 'ESCAPE': 'close' 5459 }); 5460 } 5461 5462 /** 5463 * Initializes the off-canvas wrapper by adding the exit overlay (if needed). 5464 * @function 5465 * @private 5466 */ 5467 5468 5469 _createClass(OffCanvas, [{ 5470 key: '_init', 5471 value: function _init() { 5472 var id = this.$element.attr('id'); 5473 5474 this.$element.attr('aria-hidden', 'true'); 5475 5476 // Find triggers that affect this element and add aria-expanded to them 5477 this.$triggers = $(document).find('[data-open="' + id + '"], [data-close="' + id + '"], [data-toggle="' + id + '"]').attr('aria-expanded', 'false').attr('aria-controls', id); 5478 5479 // Add a close trigger over the body if necessary 5480 if (this.options.closeOnClick) { 5481 if ($('.js-off-canvas-exit').length) { 5482 this.$exiter = $('.js-off-canvas-exit'); 5483 } else { 5484 var exiter = document.createElement('div'); 5485 exiter.setAttribute('class', 'js-off-canvas-exit'); 5486 $('[data-off-canvas-content]').append(exiter); 5487 5488 this.$exiter = $(exiter); 5489 } 5490 } 5491 5492 this.options.isRevealed = this.options.isRevealed || new RegExp(this.options.revealClass, 'g').test(this.$element[0].className); 5493 5494 if (this.options.isRevealed) { 5495 this.options.revealOn = this.options.revealOn || this.$element[0].className.match(/(reveal-for-medium|reveal-for-large)/g)[0].split('-')[2]; 5496 this._setMQChecker(); 5497 } 5498 if (!this.options.transitionTime) { 5499 this.options.transitionTime = parseFloat(window.getComputedStyle($('[data-off-canvas-wrapper]')[0]).transitionDuration) * 1000; 5500 } 5501 } 5502 5503 /** 5504 * Adds event handlers to the off-canvas wrapper and the exit overlay. 5505 * @function 5506 * @private 5507 */ 5508 5509 }, {
5510 key: '_events', 5511 value: function _events() { 5512 this.$element.off('.zf.trigger .zf.offcanvas').on({ 5513 'open.zf.trigger': this.open.bind(this), 5514 'close.zf.trigger': this.close.bind(this), 5515 'toggle.zf.trigger': this.toggle.bind(this), 5516 'keydown.zf.offcanvas': this._handleKeyboard.bind(this) 5517 }); 5518 5519 if (this.options.closeOnClick && this.$exiter.length) { 5520 this.$exiter.on({ 'click.zf.offcanvas': this.close.bind(this) }); 5521 } 5522 } 5523 5524 /** 5525 * Applies event listener for elements that will reveal at certain breakpoints. 5526 * @private 5527 */ 5528 5529 }, { 5530 key: '_setMQChecker', 5531 value: function _setMQChecker() { 5532 var _this = this; 5533 5534 $(window).on('changed.zf.mediaquery', function () { 5535 if (Foundation.MediaQuery.atLeast(_this.options.revealOn)) { 5536 _this.reveal(true); 5537 } else { 5538 _this.reveal(false); 5539 } 5540 }).one('load.zf.offcanvas', function () { 5541 if (Foundation.MediaQuery.atLeast(_this.options.revealOn)) { 5542 _this.reveal(true); 5543 } 5544 }); 5545 } 5546 5547 /** 5548 * Handles the revealing/hiding the off-canvas at breakpoints, not the same as open. 5549 * @param {Boolean} isRevealed - true if element should be revealed. 5550 * @function 5551 */ 5552 5553 }, { 5554 key: 'reveal', 5555 value: function reveal(isRevealed) { 5556 var $closer = this.$element.find('[data-close]'); 5557 if (isRevealed) { 5558 this.close(); 5559 this.isRevealed = true; 5560 // if (!this.options.forceTop) { 5561 // var scrollPos = parseInt(window.pageYOffset); 5562 // this.$element[0].style.transform = 'translate(0,' + scrollPos + 'px)'; 5563 // } 5564 // if (this.options.isSticky) { this._stick(); } 5565 this.$element.off('open.zf.trigger toggle.zf.trigger'); 5566 if ($closer.length) { 5567 $closer.hide(); 5568 } 5569 } else { 5570 this.isRevealed = false; 5571 // if (this.options.isSticky || !this.options.forceTop) { 5572 // this.$element[0].style.transform = ''; 5573 // $(window).off('scroll.zf.offcanvas'); 5574 // } 5575 this.$element.on({ 5576 'open.zf.trigger': this.open.bind(this), 5577 'toggle.zf.trigger': this.toggle.bind(this) 5578 }); 5579 if ($closer.length) { 5580 $closer.show(); 5581 } 5582 } 5583 } 5584 5585 /** 5586 * Opens the off-canvas menu. 5587 * @function 5588 * @param {Object} event - Event object passed from listener. 5589 * @param {jQuery} trigger - element that triggered the off-canvas to open. 5590 * @fires OffCanvas#opened 5591 */ 5592 5593 }, { 5594 key: 'open', 5595 value: function open(event, trigger) { 5596 if (this.$element.hasClass('is-open') || this.isRevealed) { 5597 return; 5598 } 5599 var _this = this, 5600 $body = $(document.body); 5601 5602 if (this.options.forceTop) { 5603 $('body').scrollTop(0); 5604 } 5605 // window.pageYOffset = 0; 5606 5607 // if (!this.options.forceTop) { 5608 // var scrollPos = parseInt(window.pageYOffset); 5609 // this.$element[0].style.transform = 'translate(0,' + scrollPos + 'px)'; 5610 // if (this.$exiter.length) { 5611 // this.$exiter[0].style.transform = 'translate(0,' + scrollPos + 'px)'; 5612 // } 5613 // } 5614 /** 5615 * Fires when the off-canvas menu opens. 5616 * @event OffCanvas#opened 5617 */ 5618 5619 var $wrapper = $('[data-off-canvas-wrapper]'); 5620 $wrapper.addClass('is-off-canvas-open is-open-' + _this.options.position); 5621 5622 _this.$element.addClass('is-open'); 5623 5624 // if (_this.options.isSticky) { 5625 // _this._stick(); 5626 // } 5627 5628 this.$triggers.attr('aria-expanded', 'true'); 5629 this.$element.attr('aria-hidden', 'false').trigger('opened.zf.offcanvas'); 5630 5631 if (this.options.closeOnClick) { 5632 this.$exiter.addClass('is-visible'); 5633 } 5634 5635 if (trigger) { 5636 this.$lastTrigger = trigger; 5637 } 5638 5639 if (this.options.autoFocus) { 5640 $wrapper.one(Foundation.transitionend($wrapper), function () { 5641 if (_this.$element.hasClass('is-open')) { 5642 // handle double clicks 5643 _this.$element.attr('tabindex', '-1'); 5644 _this.$element.focus(); 5645 } 5646 }); 5647 } 5648 5649 if (this.options.trapFocus) { 5650 $wrapper.one(Foundation.transitionend($wrapper), function () { 5651 if (_this.$element.hasClass('is-open')) { 5652 // handle double clicks 5653 _this.$element.attr('tabindex', '-1'); 5654 _this.trapFocus(); 5655 } 5656 }); 5657 } 5658 } 5659 5660 /** 5661 * Traps focus within the offcanvas on open. 5662 * @private 5663 */ 5664 5665 }, {
5666 key: '_trapFocus', 5667 value: function _trapFocus() { 5668 var focusable = Foundation.Keyboard.findFocusable(this.$element), 5669 first = focusable.eq(0), 5670 last = focusable.eq(-1); 5671 5672 focusable.off('.zf.offcanvas').on('keydown.zf.offcanvas', function (e) { 5673 var key = Foundation.Keyboard.parseKey(e); 5674 if (key === 'TAB' && e.target === last[0]) { 5675 e.preventDefault(); 5676 first.focus(); 5677 } 5678 if (key === 'SHIFT_TAB' && e.target === first[0]) { 5679 e.preventDefault(); 5680 last.focus(); 5681 } 5682 }); 5683 } 5684 5685 /** 5686 * Allows the offcanvas to appear sticky utilizing translate properties. 5687 * @private 5688 */ 5689 // OffCanvas.prototype._stick = function() { 5690 // var elStyle = this.$element[0].style; 5691 // 5692 // if (this.options.closeOnClick) { 5693 // var exitStyle = this.$exiter[0].style; 5694 // } 5695 // 5696 // $(window).on('scroll.zf.offcanvas', function(e) { 5697 // console.log(e); 5698 // var pageY = window.pageYOffset; 5699 // elStyle.transform = 'translate(0,' + pageY + 'px)'; 5700 // if (exitStyle !== undefined) { exitStyle.transform = 'translate(0,' + pageY + 'px)'; } 5701 // }); 5702 // // this.$element.trigger('stuck.zf.offcanvas'); 5703 // }; 5704 /** 5705 * Closes the off-canvas menu. 5706 * @function 5707 * @param {Function} cb - optional cb to fire after closure. 5708 * @fires OffCanvas#closed 5709 */ 5710 5711 }, { 5712 key: 'close', 5713 value: function close(cb) { 5714 if (!this.$element.hasClass('is-open') || this.isRevealed) { 5715 return; 5716 } 5717 5718 var _this = this; 5719 5720 // Foundation.Move(this.options.transitionTime, this.$element, function() { 5721 $('[data-off-canvas-wrapper]').removeClass('is-off-canvas-open is-open-' + _this.options.position); 5722 _this.$element.removeClass('is-open'); 5723 // Foundation._reflow(); 5724 // }); 5725 this.$element.attr('aria-hidden', 'true') 5726 /** 5727 * Fires when the off-canvas menu opens. 5728 * @event OffCanvas#closed 5729 */ 5730 .trigger('closed.zf.offcanvas'); 5731 // if (_this.options.isSticky || !_this.options.forceTop) { 5732 // setTimeout(function() { 5733 // _this.$element[0].style.transform = ''; 5734 // $(window).off('scroll.zf.offcanvas'); 5735 // }, this.options.transitionTime); 5736 // } 5737 if (this.options.closeOnClick) { 5738 this.$exiter.removeClass('is-visible'); 5739 } 5740 5741 this.$triggers.attr('aria-expanded', 'false'); 5742 if (this.options.trapFocus) { 5743 $('[data-off-canvas-content]').removeAttr('tabindex'); 5744 } 5745 } 5746 5747 /** 5748 * Toggles the off-canvas menu open or closed. 5749 * @function 5750 * @param {Object} event - Event object passed from listener. 5751 * @param {jQuery} trigger - element that triggered the off-canvas to open. 5752 */ 5753 5754 }, { 5755 key: 'toggle', 5756 value: function toggle(event, trigger) { 5757 if (this.$element.hasClass('is-open')) { 5758 this.close(event, trigger); 5759 } else { 5760 this.open(event, trigger); 5761 } 5762 } 5763 5764 /** 5765 * Handles keyboard input when detected. When the escape key is pressed, the off-canvas menu closes, and focus is restored to the element that opened the menu. 5766 * @function 5767 * @private 5768 */ 5769 5770 }, { 5771 key: '_handleKeyboard', 5772 value: function _handleKeyboard(e) { 5773 var _this2 = this; 5774 5775 Foundation.Keyboard.handleKey(e, 'OffCanvas', { 5776 close: function () { 5777 _this2.close(); 5778 _this2.$lastTrigger.focus(); 5779 return true; 5780 }, 5781 handled: function () { 5782 e.stopPropagation(); 5783 e.preventDefault(); 5784 } 5785 }); 5786 } 5787 5788 /** 5789 * Destroys the offcanvas plugin. 5790 * @function 5791 */ 5792 5793 }, { 5794 key: 'destroy', 5795 value: function destroy() { 5796 this.close(); 5797 this.$element.off('.zf.trigger .zf.offcanvas'); 5798 this.$exiter.off('.zf.offcanvas'); 5799 5800 Foundation.unregisterPlugin(this); 5801 } 5802 }]); 5803 5804 return OffCanvas; 5805 }(); 5806 5807 OffCanvas.defaults = { 5808 /** 5809 * Allow the user to click outside of the menu to close it. 5810 * @option 5811 * @example true 5812 */ 5813 closeOnClick: true, 5814 5815 /** 5816 * Amount of time in ms the open and close transition requires. If none selected, pulls from body style. 5817 * @option 5818 * @example 500 5819 */ 5820 transitionTime: 0, 5821 5822 /** 5823 * Direction the offcanvas opens from. Determines class applied to body. 5824 * @option 5825 * @example left 5826 */ 5827 position: 'left', 5828 5829 /** 5830 * Force the page to scroll to top on open. 5831 * @option 5832 * @example true 5833 */ 5834 forceTop: true, 5835 5836 /** 5837 * Allow the offcanvas to remain open for certain breakpoints. 5838 * @option 5839 * @example false 5840 */ 5841 isRevealed: false, 5842 5843 /** 5844 * Breakpoint at which to reveal. JS will use a RegExp to target standard classes, if changing classnames, pass your class with the `revealClass` option. 5845 * @option 5846 * @example reveal-for-large 5847 */ 5848 revealOn: null, 5849 5850 /** 5851 * Force focus to the offcanvas on open. If true, will focus the opening trigger on close. Set
5851s tabindex of [data-off-canvas-content] to -1 for accessibility purposes. 5852 * @option 5853 * @example true 5854 */ 5855 autoFocus: true, 5856 5857 /** 5858 * Class used to force an offcanvas to remain open. Foundation defaults for this are `reveal-for-large` & `reveal-for-medium`. 5859 * @option 5860 * TODO improve the regex testing for this. 5861 * @example reveal-for-large 5862 */ 5863 revealClass: 'reveal-for-', 5864 5865 /** 5866 * Triggers optional focus trapping when opening an offcanvas. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes. 5867 * @option 5868 * @example true 5869 */ 5870 trapFocus: false 5871 }; 5872 5873 // Window exports 5874 Foundation.plugin(OffCanvas, 'OffCanvas'); 5875}(jQuery); 5876'use strict'; 5877 5878var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 5879 5880function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 5881 5882!function ($) { 5883 5884 /** 5885 * Orbit module. 5886 * @module foundation.orbit 5887 * @requires foundation.util.keyboard 5888 * @requires foundation.util.motion 5889 * @requires foundation.util.timerAndImageLoader 5890 * @requires foundation.util.touch 5891 */ 5892 5893 var Orbit = function () { 5894 /** 5895 * Creates a new instance of an orbit carousel. 5896 * @class 5897 * @param {jQuery} element - jQuery object to make into an Orbit Carousel. 5898 * @param {Object} options - Overrides to the default plugin settings. 5899 */ 5900 function Orbit(element, options) { 5901 _classCallCheck(this, Orbit); 5902 5903 this.$element = element; 5904 this.options = $.extend({}, Orbit.defaults, this.$element.data(), options); 5905 5906 this._init(); 5907 5908 Foundation.registerPlugin(this, 'Orbit'); 5909 Foundation.Keyboard.register('Orbit', { 5910 'ltr': { 5911 'ARROW_RIGHT': 'next', 5912 'ARROW_LEFT': 'previous' 5913 }, 5914 'rtl': { 5915 'ARROW_LEFT': 'next', 5916 'ARROW_RIGHT': 'previous' 5917 } 5918 }); 5919 } 5920 5921 /** 5922 * Initializes the plugin by creating jQuery collections, setting attributes, and starting the animation. 5923 * @function 5924 * @private 5925 */ 5926 5927 5928 _createClass(Orbit, [{ 5929 key: '_init', 5930 value: function _init() { 5931 this.$wrapper = this.$element.find('.' + this.options.containerClass); 5932 this.$slides = this.$element.find('.' + this.options.slideClass); 5933 var $images = this.$element.find('img'), 5934 initActive = this.$slides.filter('.is-active'); 5935 5936 if (!initActive.length) { 5937 this.$slides.eq(0).addClass('is-active'); 5938 } 5939 5940 if (!this.options.useMUI) { 5941 this.$slides.addClass('no-motionui'); 5942 } 5943 5944 if ($images.length) { 5945 Foundation.onImagesLoaded($images, this._prepareForOrbit.bind(this)); 5946 } else { 5947 this._prepareForOrbit(); //hehe 5948 } 5949 5950 if (this.options.bullets) { 5951 this._loadBullets(); 5952 } 5953 5954 this._events(); 5955 5956 if (this.options.autoPlay && this.$slides.length > 1) { 5957 this.geoSync(); 5958 } 5959 5960 if (this.options.accessible) { 5961 // allow wrapper to be focusable to enable arrow navigation 5962 this.$wrapper.attr('tabindex', 0); 5963 } 5964 } 5965 5966 /** 5967 * Creates a jQuery collection of bullets, if they are being used. 5968 * @function 5969 * @private 5970 */ 5971 5972 }, { 5973 key: '_loadBullets', 5974 value: function _loadBullets() { 5975 this.$bullets = this.$element.find('.' + this.options.boxOfBullets).find('button'); 5976 } 5977 5978 /** 5979 * Sets a `timer` object on the orbit, and starts the counter for the next slide. 5980 * @function 5981 */ 5982 5983 }, {
5984 key: 'geoSync', 5985 value: function geoSync() { 5986 var _this = this; 5987 this.timer = new Foundation.Timer(this.$element, { 5988 duration: this.options.timerDelay, 5989 infinite: false 5990 }, function () { 5991 _this.changeSlide(true); 5992 }); 5993 this.timer.start(); 5994 } 5995 5996 /** 5997 * Sets wrapper and slide heights for the orbit. 5998 * @function 5999 * @private 6000 */ 6001 6002 }, { 6003 key: '_prepareForOrbit', 6004 value: function _prepareForOrbit() { 6005 var _this = this; 6006 this._setWrapperHeight(function (max) { 6007 _this._setSlideHeight(max); 6008 }); 6009 } 6010 6011 /** 6012 * Calulates the height of each slide in the collection, and uses the tallest one for the wrapper height. 6013 * @function 6014 * @private 6015 * @param {Function} cb - a callback function to fire when complete. 6016 */ 6017 6018 }, { 6019 key: '_setWrapperHeight', 6020 value: function _setWrapperHeight(cb) { 6021 //rewrite this to `for` loop 6022 var max = 0, 6023 temp, 6024 counter = 0; 6025 6026 this.$slides.each(function () { 6027 temp = this.getBoundingClientRect().height; 6028 $(this).attr('data-slide', counter); 6029 6030 if (counter) { 6031 //if not the first slide, set css position and display property 6032 $(this).css({ 'position': 'relative', 'display': 'none' }); 6033 } 6034 max = temp > max ? temp : max; 6035 counter++; 6036 }); 6037 6038 if (counter === this.$slides.length) { 6039 this.$wrapper.css({ 'height': max }); //only change the wrapper height property once. 6040 cb(max); //fire callback with max height dimension. 6041 } 6042 } 6043 6044 /** 6045 * Sets the max-height of each slide. 6046 * @function 6047 * @private 6048 */ 6049 6050 }, { 6051 key: '_setSlideHeight', 6052 value: function _setSlideHeight(height) { 6053 this.$slides.each(function () { 6054 $(this).css('max-height', height); 6055 }); 6056 } 6057 6058 /** 6059 * Adds event listeners to basically everything within the element. 6060 * @function 6061 * @private 6062 */ 6063 6064 }, { 6065 key: '_events', 6066 value: function _events() { 6067 var _this = this; 6068 6069 //*************************************** 6070 //**Now using custom event - thanks to:** 6071 //** Yohai Ararat of Toronto ** 6072 //*************************************** 6073 if (this.$slides.length > 1) { 6074 6075 if (this.options.swipe) { 6076 this.$slides.off('swipeleft.zf.orbit swiperight.zf.orbit').on('swipeleft.zf.orbit', function (e) { 6077 e.preventDefault(); 6078 _this.changeSlide(true); 6079 }).on('swiperight.zf.orbit', function (e) { 6080 e.preventDefault(); 6081 _this.changeSlide(false); 6082 }); 6083 } 6084 //*************************************** 6085 6086 if (this.options.autoPlay) { 6087 this.$slides.on('click.zf.orbit', function () { 6088 _this.$element.data('clickedOn', _this.$element.data('clickedOn') ? false : true); 6089 _this.timer[_this.$element.data('clickedOn') ? 'pause' : 'start'](); 6090 }); 6091 6092 if (this.options.pauseOnHover) { 6093 this.$element.on('mouseenter.zf.orbit', function () { 6094 _this.timer.pause(); 6095 }).on('mouseleave.zf.orbit', function () { 6096 if (!_this.$element.data('clickedOn')) { 6097 _this.timer.start(); 6098 } 6099 }); 6100 } 6101 } 6102 6103 if (this.options.navButtons) { 6104 var $controls = this.$element.find('.' + this.options.nextClass + ', .' + this.options.prevClass); 6105 $controls.attr('tabindex', 0) 6106 //also need to handle enter/return and spacebar key presses 6107 .on('click.zf.orbit touchend.zf.orbit', function (e) { 6108 e.preventDefault(); 6109 _this.changeSlide($(this).hasClass(_this.options.nextClass)); 6110 }); 6111 } 6112 6113 if (this.options.bullets) { 6114 this.$bullets.on('click.zf.orbit touchend.zf.orbit', function () { 6115 if (/is-active/g.test(this.className)) { 6116 return false;
6117 } //if this is active, kick out of function. 6118 var idx = $(this).data('slide'), 6119 ltr = idx > _this.$slides.filter('.is-active').data('slide'), 6120 $slide = _this.$slides.eq(idx); 6121 6122 _this.changeSlide(ltr, $slide, idx); 6123 }); 6124 } 6125 6126 if (this.options.accessible) { 6127 this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function (e) { 6128 // handle keyboard event with keyboard util 6129 Foundation.Keyboard.handleKey(e, 'Orbit', { 6130 next: function () { 6131 _this.changeSlide(true); 6132 }, 6133 previous: function () { 6134 _this.changeSlide(false); 6135 }, 6136 handled: function () { 6137 // if bullet is focused, make sure focus moves 6138 if ($(e.target).is(_this.$bullets)) { 6139 _this.$bullets.filter('.is-active').focus(); 6140 } 6141 } 6142 }); 6143 }); 6144 } 6145 } 6146 } 6147 6148 /** 6149 * Changes the current slide to a new one. 6150 * @function 6151 * @param {Boolean} isLTR - flag if the slide should move left to right. 6152 * @param {jQuery} chosenSlide - the jQuery element of the slide to show next, if one is selected. 6153 * @param {Number} idx - the index of the new slide in its collection, if one chosen. 6154 * @fires Orbit#slidechange 6155 */ 6156 6157 }, { 6158 key: 'changeSlide', 6159 value: function changeSlide(isLTR, chosenSlide, idx) { 6160 var $curSlide = this.$slides.filter('.is-active').eq(0); 6161 6162 if (/mui/g.test($curSlide[0].className)) { 6163 return false; 6164 } //if the slide is currently animating, kick out of the function 6165 6166 var $firstSlide = this.$slides.first(), 6167 $lastSlide = this.$slides.last(), 6168 dirIn = isLTR ? 'Right' : 'Left', 6169 dirOut = isLTR ? 'Left' : 'Right', 6170 _this = this, 6171 $newSlide; 6172 6173 if (!chosenSlide) { 6174 //most of the time, this will be auto played or clicked from the navButtons. 6175 $newSlide = isLTR ? //if wrapping enabled, check to see if there is a `next` or `prev` sibling, if not, select the first or last slide to fill in. if wrapping not enabled, attempt to select `next` or `prev`, if there's nothing there, the function will kick out on next step. CRAZY NESTED TERNARIES!!!!! 6176 this.options.infiniteWrap ? $curSlide.next('.' + this.options.slideClass).length ? $curSlide.next('.' + this.options.slideClass) : $firstSlide : $curSlide.next('.' + this.options.slideClass) : //pick next slide if moving left to right 6177 this.options.infiniteWrap ? $curSlide.prev('.' + this.options.slideClass).length ? $curSlide.prev('.' + this.options.slideClass) : $lastSlide : $curSlide.prev('.' + this.options.slideClass); //pick prev slide if moving right to left 6178 } else { 6179 $newSlide = chosenSlide; 6180 } 6181 6182 if ($newSlide.length) { 6183 /** 6184 * Triggers before the next slide starts animating in and only if a next slide has been found. 6185 * @event Orbit#beforeslidechange 6186 */ 6187 this.$element.trigger('beforeslidechange.zf.orbit', [$curSlide, $newSlide]); 6188 6189 if (this.options.bullets) { 6190 idx = idx || this.$slides.index($newSlide); //grab index to update bullets 6191 this._updateBullets(idx); 6192 } 6193 6194 if (this.options.useMUI) { 6195 Foundation.Motion.animateIn($newSlide.addClass('is-active').css({ 'position': 'absolute', 'top': 0 }), this.options['animInFrom' + dirIn], function () { 6196 $newSlide.css({ 'position': 'relative', 'display': 'block' }).attr('aria-live', 'polite'); 6197 }); 6198 6199 Foundation.Motion.animateOut($curSlide.removeClass('is-active'), this.options['animOutTo' + dirOut], function () { 6200 $curSlide.removeAttr('aria-live'); 6201 if (_this.options.autoPlay && !_this.timer.isPaused) { 6202 _this.timer.restart(); 6203 } 6204 //do stuff? 6205 }); 6206 } else { 6207 $curSlide.removeClass('is-active is-in').removeAttr('aria-live').hide(); 6208 $newSlide.addClass('is-active is-in').attr('aria-live', 'polite').show(); 6209 if (this.options.autoPlay && !this.timer.isPaused) { 6210 this.timer.restart(); 6211 } 6212 } 6213 /** 6214 * Triggers when the slide has finished animating in. 6215 * @event Orbit#slidechange 6216 */
6217 this.$element.trigger('slidechange.zf.orbit', [$newSlide]); 6218 } 6219 } 6220 6221 /** 6222 * Updates the active state of the bullets, if displayed. 6223 * @function 6224 * @private 6225 * @param {Number} idx - the index of the current slide. 6226 */ 6227 6228 }, { 6229 key: '_updateBullets', 6230 value: function _updateBullets(idx) { 6231 var $oldBullet = this.$element.find('.' + this.options.boxOfBullets).find('.is-active').removeClass('is-active').blur(), 6232 span = $oldBullet.find('span:last').detach(), 6233 $newBullet = this.$bullets.eq(idx).addClass('is-active').append(span); 6234 } 6235 6236 /** 6237 * Destroys the carousel and hides the element. 6238 * @function 6239 */ 6240 6241 }, { 6242 key: 'destroy', 6243 value: function destroy() { 6244 this.$element.off('.zf.orbit').find('*').off('.zf.orbit').end().hide(); 6245 Foundation.unregisterPlugin(this); 6246 } 6247 }]); 6248 6249 return Orbit; 6250 }(); 6251 6252 Orbit.defaults = { 6253 /** 6254 * Tells the JS to look for and loadBullets. 6255 * @option 6256 * @example true 6257 */ 6258 bullets: true, 6259 /** 6260 * Tells the JS to apply event listeners to nav buttons 6261 * @option 6262 * @example true 6263 */ 6264 navButtons: true, 6265 /** 6266 * motion-ui animation class to apply 6267 * @option 6268 * @example 'slide-in-right' 6269 */ 6270 animInFromRight: 'slide-in-right', 6271 /** 6272 * motion-ui animation class to apply 6273 * @option 6274 * @example 'slide-out-right' 6275 */ 6276 animOutToRight: 'slide-out-right', 6277 /** 6278 * motion-ui animation class to apply 6279 * @option 6280 * @example 'slide-in-left' 6281 * 6282 */ 6283 animInFromLeft: 'slide-in-left', 6284 /** 6285 * motion-ui animation class to apply 6286 * @option 6287 * @example 'slide-out-left' 6288 */ 6289 animOutToLeft: 'slide-out-left', 6290 /** 6291 * Allows Orbit to automatically animate on page load. 6292 * @option 6293 * @example true 6294 */ 6295 autoPlay: true, 6296 /** 6297 * Amount of time, in ms, between slide transitions 6298 * @option 6299 * @example 5000 6300 */ 6301 timerDelay: 5000, 6302 /** 6303 * Allows Orbit to infinitely loop through the slides 6304 * @option 6305 * @example true 6306 */ 6307 infiniteWrap: true, 6308 /** 6309 * Allows the Orbit slides to bind to swipe events for mobile, requires an additional util library 6310 * @option 6311 * @example true 6312 */ 6313 swipe: true, 6314 /** 6315 * Allows the timing function to pause animation on hover. 6316 * @option 6317 * @example true 6318 */ 6319 pauseOnHover: true, 6320 /** 6321 * Allows Orbit to bind keyboard events to the slider, to animate frames with arrow keys 6322 * @option 6323 * @example true 6324 */ 6325 accessible: true, 6326 /** 6327 * Class applied to the container of Orbit 6328 * @option 6329 * @example 'orbit-container' 6330 */ 6331 containerClass: 'orbit-container', 6332 /** 6333 * Class applied to individual slides. 6334 * @option 6335 * @example 'orbit-slide' 6336 */ 6337 slideClass: 'orbit-slide', 6338 /** 6339 * Class applied to the bullet container. You're welcome. 6340 * @option 6341 * @example 'orbit-bullets' 6342 */ 6343 boxOfBullets: 'orbit-bullets', 6344 /** 6345 * Class applied to the `next` navigation button. 6346 * @option 6347 * @example 'orbit-next' 6348 */ 6349 nextClass: 'orbit-next', 6350 /** 6351 * Class applied to the `previous` navigation button. 6352 * @option 6353 * @example 'orbit-previous' 6354 */ 6355 prevClass: 'orbit-previous', 6356 /** 6357 * Boolean to flag the js to use motion ui classes or not. Default to true for backwards compatability. 6358 * @option 6359 * @example true 6360 */ 6361 useMUI: true 6362 }; 6363 6364 // Window exports 6365 Foundation.plugin(Orbit, 'Orbit'); 6366}(jQuery); 6367'use strict'; 6368 6369var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 6370 6371function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6372 6373!function ($) { 6374 6375 /** 6376 * ResponsiveMenu module. 6377 * @module foundation.responsiveMenu 6378 * @requires foundation.util.triggers 6379 * @requires foundation.util.mediaQuery 6380 * @requires foundation.util.accordionMenu 6381 * @requires foundation.util.drilldown 6382 * @requires foundation.util.dropdown-menu 6383 */ 6384 6385 var ResponsiveMenu = function () { 6386 /** 6387 * Creates a new instance of a responsive menu. 6388 * @class 6389 * @fires ResponsiveMenu#init 6390 * @param {jQuery} element - jQuery object to make into a dropdown menu. 6391 * @param {Object} options - Overrides to the default plugin settings. 6392 */ 6393 function ResponsiveMenu(element, options) { 6394 _classCallCheck(this, ResponsiveMenu); 6395 6396 this.$element = $(element); 6397 this.rules = this.$element.data('responsive-menu'); 6398 this.currentMq = null; 6399 this.currentPlugin = null; 6400 6401 this._init(); 6402 this._events(); 6403 6404 Foundation.registerPlugin(this, 'ResponsiveMenu'); 6405 } 6406 6407 /** 6408 * Initializes the Menu by parsing the classes from the 'data-ResponsiveMenu' attribute on the element. 6409 * @function 6410 * @private 6411 */ 6412 6413 6414 _createClass(ResponsiveMenu, [{ 6415 key: '_init', 6416 value: function _init() { 6417 // The first time an Interchange plugin is initialized, this.rules is converted from a string of "classes" to an object of rules 6418 if (typeof this.rules === 'string') { 6419 var rulesTree = {}; 6420 6421 // Parse rules from "classes" pulled from data attribute 6422 var rules = this.rules.split(' '); 6423 6424 // Iterate through every rule found 6425 for (var i = 0; i < rules.length; i++) { 6426 var rule = rules[i].split('-'); 6427 var ruleSize = rule.length > 1 ? rule[0] : 'small'; 6428 var rulePlugin = rule.length > 1 ? rule[1] : rule[0]; 6429 6430 if (MenuPlugins[rulePlugin] !== null) { 6431 rulesTree[ruleSize] = MenuPlugins[rulePlugin]; 6432 } 6433 } 6434 6435 this.rules = rulesTree; 6436 } 6437 6438 if (!$.isEmptyObject(this.rules)) { 6439 this._checkMediaQueries(); 6440 } 6441 } 6442 6443 /** 6444 * Initializes events for the Menu. 6445 * @function 6446 * @private 6447 */ 6448 6449 }, {
6450 key: '_events', 6451 value: function _events() { 6452 var _this = this; 6453 6454 $(window).on('changed.zf.mediaquery', function () { 6455 _this._checkMediaQueries(); 6456 }); 6457 // $(window).on('resize.zf.ResponsiveMenu', function() { 6458 // _this._checkMediaQueries(); 6459 // }); 6460 } 6461 6462 /** 6463 * Checks the current screen width against available media queries. If the media query has changed, and the plugin needed has changed, the plugins will swap out. 6464 * @function 6465 * @private 6466 */ 6467 6468 }, { 6469 key: '_checkMediaQueries', 6470 value: function _checkMediaQueries() { 6471 var matchedMq, 6472 _this = this; 6473 // Iterate through each rule and find the last matching rule 6474 $.each(this.rules, function (key) { 6475 if (Foundation.MediaQuery.atLeast(key)) { 6476 matchedMq = key; 6477 } 6478 }); 6479 6480 // No match? No dice 6481 if (!matchedMq) return; 6482 6483 // Plugin already initialized? We good 6484 if (this.currentPlugin instanceof this.rules[matchedMq].plugin) return; 6485 6486 // Remove existing plugin-specific CSS classes 6487 $.each(MenuPlugins, function (key, value) { 6488 _this.$element.removeClass(value.cssClass); 6489 }); 6490 6491 // Add the CSS class for the new plugin 6492 this.$element.addClass(this.rules[matchedMq].cssClass); 6493 6494 // Create an instance of the new plugin 6495 if (this.currentPlugin) this.currentPlugin.destroy(); 6496 this.currentPlugin = new this.rules[matchedMq].plugin(this.$element, {}); 6497 } 6498 6499 /** 6500 * Destroys the instance of the current plugin on this element, as well as the window resize handler that switches the plugins out. 6501 * @function 6502 */ 6503 6504 }, { 6505 key: 'destroy', 6506 value: function destroy() { 6507 this.currentPlugin.destroy(); 6508 $(window).off('.zf.ResponsiveMenu'); 6509 Foundation.unregisterPlugin(this); 6510 } 6511 }]); 6512 6513 return ResponsiveMenu; 6514 }(); 6515 6516 ResponsiveMenu.defaults = {}; 6517 6518 // The plugin matches the plugin classes with these plugin instances. 6519 var MenuPlugins = { 6520 dropdown: { 6521 cssClass: 'dropdown', 6522 plugin: Foundation._plugins['dropdown-menu'] || null 6523 }, 6524 drilldown: { 6525 cssClass: 'drilldown', 6526 plugin: Foundation._plugins['drilldown'] || null 6527 }, 6528 accordion: { 6529 cssClass: 'accordion-menu', 6530 plugin: Foundation._plugins['accordion-menu'] || null 6531 } 6532 }; 6533 6534 // Window exports 6535 Foundation.plugin(ResponsiveMenu, 'ResponsiveMenu'); 6536}(jQuery); 6537'use strict'; 6538 6539var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 6540 6541function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6542 6543!function ($) { 6544 6545 /** 6546 * ResponsiveToggle module. 6547 * @module foundation.responsiveToggle 6548 * @requires foundation.util.mediaQuery 6549 */ 6550 6551 var ResponsiveToggle = function () { 6552 /** 6553 * Creates a new instance of Tab Bar. 6554 * @class 6555 * @fires ResponsiveToggle#init 6556 * @param {jQuery} element - jQuery object to attach tab bar functionality to. 6557 * @param {Object} options - Overrides to the default plugin settings. 6558 */ 6559 function ResponsiveToggle(element, options) { 6560 _classCallCheck(this, ResponsiveToggle); 6561 6562 this.$element = $(element); 6563 this.options = $.extend({}, ResponsiveToggle.defaults, this.$element.data(), options); 6564 6565 this._init(); 6566 this._events(); 6567 6568 Foundation.registerPlugin(this, 'ResponsiveToggle'); 6569 } 6570 6571 /** 6572 * Initializes the tab bar by finding the target element, toggling element, and running update(). 6573 * @function 6574 * @private 6575 */ 6576 6577 6578 _createClass(ResponsiveToggle, [{ 6579 key: '_init', 6580 value: function _init() { 6581 var targetID = this.$element.data('responsive-toggle'); 6582 if (!targetID) { 6583 console.error('Your tab bar needs an ID of a Menu as the value of data-tab-bar.'); 6584 } 6585 6586 this.$targetMenu = $('#' + targetID); 6587 this.$toggler = this.$element.find('[data-toggle]'); 6588 6589 this._update(); 6590 } 6591 6592 /** 6593 * Adds necessary event handlers for the tab bar to work. 6594 * @function 6595 * @private 6596 */ 6597 6598 }, {
6599 key: '_events', 6600 value: function _events() { 6601 var _this = this; 6602 6603 this._updateMqHandler = this._update.bind(this); 6604 6605 $(window).on('changed.zf.mediaquery', this._updateMqHandler); 6606 6607 this.$toggler.on('click.zf.responsiveToggle', this.toggleMenu.bind(this)); 6608 } 6609 6610 /** 6611 * Checks the current media query to determine if the tab bar should be visible or hidden. 6612 * @function 6613 * @private 6614 */ 6615 6616 }, { 6617 key: '_update', 6618 value: function _update() { 6619 // Mobile 6620 if (!Foundation.MediaQuery.atLeast(this.options.hideFor)) { 6621 this.$element.show(); 6622 this.$targetMenu.hide(); 6623 } 6624 6625 // Desktop 6626 else { 6627 this.$element.hide(); 6628 this.$targetMenu.show(); 6629 } 6630 } 6631 6632 /** 6633 * Toggles the element attached to the tab bar. The toggle only happens if the screen is small enough to allow it. 6634 * @function 6635 * @fires ResponsiveToggle#toggled 6636 */ 6637 6638 }, { 6639 key: 'toggleMenu', 6640 value: function toggleMenu() { 6641 if (!Foundation.MediaQuery.atLeast(this.options.hideFor)) { 6642 this.$targetMenu.toggle(0); 6643 6644 /** 6645 * Fires when the element attached to the tab bar toggles. 6646 * @event ResponsiveToggle#toggled 6647 */ 6648 this.$element.trigger('toggled.zf.responsiveToggle'); 6649 } 6650 } 6651 }, { 6652 key: 'destroy', 6653 value: function destroy() { 6654 this.$element.off('.zf.responsiveToggle'); 6655 this.$toggler.off('.zf.responsiveToggle'); 6656 6657 $(window).off('changed.zf.mediaquery', this._updateMqHandler); 6658 6659 Foundation.unregisterPlugin(this); 6660 } 6661 }]); 6662 6663 return ResponsiveToggle; 6664 }(); 6665 6666 ResponsiveToggle.defaults = { 6667 /** 6668 * The breakpoint after which the menu is always shown, and the tab bar is hidden. 6669 * @option 6670 * @example 'medium' 6671 */ 6672 hideFor: 'medium' 6673 }; 6674 6675 // Window exports 6676 Foundation.plugin(ResponsiveToggle, 'ResponsiveToggle'); 6677}(jQuery); 6678'use strict'; 6679 6680var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 6681 6682function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6683 6684!function ($) { 6685 6686 /** 6687 * Reveal module. 6688 * @module foundation.reveal 6689 * @requires foundation.util.keyboard 6690 * @requires foundation.util.box 6691 * @requires foundation.util.triggers 6692 * @requires foundation.util.mediaQuery 6693 * @requires foundation.util.motion if using animations 6694 */ 6695 6696 var Reveal = function () { 6697 /** 6698 * Creates a new instance of Reveal. 6699 * @class 6700 * @param {jQuery} element - jQuery object to use for the modal. 6701 * @param {Object} options - optional parameters. 6702 */ 6703 function Reveal(element, options) { 6704 _classCallCheck(this, Reveal); 6705 6706 this.$element = element; 6707 this.options = $.extend({}, Reveal.defaults, this.$element.data(), options); 6708 this._init(); 6709 6710 Foundation.registerPlugin(this, 'Reveal'); 6711 Foundation.Keyboard.register('Reveal', { 6712 'ENTER': 'open', 6713 'SPACE': 'open', 6714 'ESCAPE': 'close', 6715 'TAB': 'tab_forward', 6716 'SHIFT_TAB': 'tab_backward' 6717 }); 6718 } 6719 6720 /** 6721 * Initializes the modal by adding the overlay and close buttons, (if selected). 6722 * @private 6723 */ 6724 6725 6726 _createClass(Reveal, [{ 6727 key: '_init', 6728 value: function _init() { 6729 this.id = this.$element.attr('id'); 6730 this.isActive = false; 6731 this.cached = { mq: Foundation.MediaQuery.current }; 6732 this.isMobile = mobileSniff(); 6733 6734 this.$anchor = $('[data-open="' + this.id + '"]').length ? $('[data-open="' + this.id + '"]') : $('[data-toggle="' + this.id + '"]'); 6735 this.$anchor.attr({ 6736 'aria-controls': this.id, 6737 'aria-haspopup': true, 6738 'tabindex': 0 6739 }); 6740 6741 if (this.options.fullScreen || this.$element.hasClass('full')) { 6742 this.options.fullScreen = true;
6743 this.options.overlay = false; 6744 } 6745 if (this.options.overlay && !this.$overlay) { 6746 this.$overlay = this._makeOverlay(this.id); 6747 } 6748 6749 this.$element.attr({ 6750 'role': 'dialog', 6751 'aria-hidden': true, 6752 'data-yeti-box': this.id, 6753 'data-resize': this.id 6754 }); 6755 6756 if (this.$overlay) { 6757 this.$element.detach().appendTo(this.$overlay); 6758 } else { 6759 this.$element.detach().appendTo($('body')); 6760 this.$element.addClass('without-overlay'); 6761 } 6762 this._events(); 6763 if (this.options.deepLink && window.location.hash === '#' + this.id) { 6764 $(window).one('load.zf.reveal', this.open.bind(this)); 6765 } 6766 } 6767 6768 /** 6769 * Creates an overlay div to display behind the modal. 6770 * @private 6771 */ 6772 6773 }, { 6774 key: '_makeOverlay', 6775 value: function _makeOverlay(id) { 6776 var $overlay = $('<div></div>').addClass('reveal-overlay').appendTo('body'); 6777 return $overlay; 6778 } 6779 6780 /** 6781 * Updates position of modal 6782 * TODO: Figure out if we actually need to cache these values or if it doesn't matter 6783 * @private 6784 */ 6785 6786 }, { 6787 key: '_updatePosition', 6788 value: function _updatePosition() { 6789 var width = this.$element.outerWidth(); 6790 var outerWidth = $(window).width(); 6791 var height = this.$element.outerHeight(); 6792 var outerHeight = $(window).height(); 6793 var left, top; 6794 if (this.options.hOffset === 'auto') { 6795 left = parseInt((outerWidth - width) / 2, 10); 6796 } else { 6797 left = parseInt(this.options.hOffset, 10); 6798 } 6799 if (this.options.vOffset === 'auto') { 6800 if (height > outerHeight) { 6801 top = parseInt(Math.min(100, outerHeight / 10), 10); 6802 } else { 6803 top = parseInt((outerHeight - height) / 4, 10); 6804 } 6805 } else { 6806 top = parseInt(this.options.vOffset, 10); 6807 } 6808 this.$element.css({ top: top + 'px' }); 6809 // only worry about left if we don't have an overlay or we havea horizontal offset, 6810 // otherwise we're perfectly in the middle 6811 if (!this.$overlay || this.options.hOffset !== 'auto') { 6812 this.$element.css({ left: left + 'px' }); 6813 this.$element.css({ margin: '0px' }); 6814 } 6815 } 6816 6817 /** 6818 * Adds event handlers for the modal. 6819 * @private 6820 */ 6821 6822 }, { 6823 key: '_events', 6824 value: function _events() { 6825 var _this2 = this; 6826 6827 var _this = this; 6828 6829 this.$element.on({ 6830 'open.zf.trigger': this.open.bind(this), 6831 'close.zf.trigger': function (event, $element) { 6832 if (event.target === _this.$element[0] || $(event.target).parents('[data-closable]')[0] === $element) { 6833 // only close reveal when it's explicitly called 6834 return _this2.close.apply(_this2); 6835 } 6836 }, 6837 'toggle.zf.trigger': this.toggle.bind(this), 6838 'resizeme.zf.trigger': function () { 6839 _this._updatePosition(); 6840 } 6841 }); 6842 6843 if (this.$anchor.length) { 6844 this.$anchor.on('keydown.zf.reveal', function (e) { 6845 if (e.which === 13 || e.which === 32) { 6846 e.stopPropagation(); 6847 e.preventDefault(); 6848 _this.open(); 6849 } 6850 }); 6851 } 6852 6853 if (this.options.closeOnClick && this.options.overlay) { 6854 this.$overlay.off('.zf.reveal').on('click.zf.reveal', function (e) { 6855 if (e.target === _this.$element[0] || $.contains(_this.$element[0], e.target) || !$.contains(document, e.target)) { 6856 return; 6857 } 6858 _this.close(); 6859 }); 6860 } 6861 if (this.options.deepLink) { 6862 $(window).on('popstate.zf.reveal:' + this.id, this._handleState.bind(this)); 6863 } 6864 } 6865 6866 /** 6867 * Handles modal methods on back/forward button clicks or any other event that triggers popstate. 6868 * @private 6869 */ 6870 6871 }, { 6872 key: '_handleState', 6873 value: function _handleState(e) { 6874 if (window.location.hash === '#' + this.id && !this.isActive) { 6875 this.open(); 6876 } else { 6877 this.close(); 6878 } 6879 } 6880 6881 /** 6882 * Opens the modal controlled by `this.$anchor`, and closes all others by default. 6883 * @function 6884 * @fires Reveal#closeme 6885 * @fires Reveal#open 6886 */ 6887 6888 }, {
6889 key: 'open', 6890 value: function open() { 6891 var _this3 = this; 6892 6893 if (this.options.deepLink) { 6894 var hash = '#' + this.id; 6895 6896 if (window.history.pushState) { 6897 window.history.pushState(null, null, hash); 6898 } else { 6899 window.location.hash = hash; 6900 } 6901 } 6902 6903 this.isActive = true; 6904 6905 // Make elements invisible, but remove display: none so we can get size and positioning 6906 this.$element.css({ 'visibility': 'hidden' }).show().scrollTop(0); 6907 if (this.options.overlay) { 6908 this.$overlay.css({ 'visibility': 'hidden' }).show(); 6909 } 6910 6911 this._updatePosition(); 6912 6913 this.$element.hide().css({ 'visibility': '' }); 6914 6915 if (this.$overlay) { 6916 this.$overlay.css({ 'visibility': '' }).hide(); 6917 if (this.$element.hasClass('fast')) { 6918 this.$overlay.addClass('fast'); 6919 } else if (this.$element.hasClass('slow')) { 6920 this.$overlay.addClass('slow'); 6921 } 6922 } 6923 6924 if (!this.options.multipleOpened) { 6925 /** 6926 * Fires immediately before the modal opens. 6927 * Closes any other modals that are currently open 6928 * @event Reveal#closeme 6929 */ 6930 this.$element.trigger('closeme.zf.reveal', this.id); 6931 } 6932 // Motion UI method of reveal 6933 if (this.options.animationIn) { 6934 var _this; 6935 6936 (function () { 6937 var afterAnimationFocus = function () { 6938 _this.$element.attr({ 6939 'aria-hidden': false, 6940 'tabindex': -1 6941 }).focus(); 6942 }; 6943 6944 _this = _this3; 6945 6946 if (_this3.options.overlay) { 6947 Foundation.Motion.animateIn(_this3.$overlay, 'fade-in'); 6948 } 6949 Foundation.Motion.animateIn(_this3.$element, _this3.options.animationIn, function () { 6950 _this3.focusableElements = Foundation.Keyboard.findFocusable(_this3.$element); 6951 afterAnimationFocus(); 6952 }); 6953 })(); 6954 } 6955 // jQuery method of reveal 6956 else { 6957 if (this.options.overlay) { 6958 this.$overlay.show(0); 6959 } 6960 this.$element.show(this.options.showDelay); 6961 } 6962 6963 // handle accessibility 6964 this.$element.attr({ 6965 'aria-hidden': false, 6966 'tabindex': -1 6967 }).focus(); 6968 6969 /** 6970 * Fires when the modal has successfully opened. 6971 * @event Reveal#open 6972 */ 6973 this.$element.trigger('open.zf.reveal'); 6974 6975 if (this.isMobile) { 6976 this.originalScrollPos = window.pageYOffset; 6977 $('html, body').addClass('is-reveal-open'); 6978 } else { 6979 $('body').addClass('is-reveal-open'); 6980 } 6981 6982 setTimeout(function () { 6983 _this3._extraHandlers(); 6984 }, 0); 6985 } 6986 6987 /** 6988 * Adds extra event handlers for the body and window if necessary. 6989 * @private 6990 */ 6991 6992 }, { 6993 key: '_extraHandlers', 6994 value: function _extraHandlers() { 6995 var _this = this; 6996 this.focusableElements = Foundation.Keyboard.findFocusable(this.$element); 6997 6998 if (!this.options.overlay && this.options.closeOnClick && !this.options.fullScreen) { 6999 $('body').on('click.zf.reveal', function (e) { 7000 if (e.target === _this.$element[0] || $.contains(_this.$element[0], e.target) || !$.contains(document, e.target)) { 7001 return; 7002 } 7003 _this.close(); 7004 }); 7005 } 7006 7007 if (this.options.closeOnEsc) { 7008 $(window).on('keydown.zf.reveal', function (e) { 7009 Foundation.Keyboard.handleKey(e, 'Reveal', { 7010 close: function () { 7011 if (_this.options.closeOnEsc) { 7012 _this.close(); 7013 _this.$anchor.focus(); 7014 } 7015 } 7016 }); 7017 }); 7018 } 7019 7020 // lock focus within modal while tabbing 7021 this.$element.on('keydown.zf.reveal', function (e) { 7022 var $target = $(this); 7023 // handle keyboard event with keyboard util 7024 Foundation.Keyboard.handleKey(e, 'Reveal', { 7025 tab_forward: function () { 7026 _this.focusableElements = Foundation.Keyboard.findFocusable(_this.$element); 7027 if (_this.$element.find(':focus').is(_this.focusableElements.eq(-1))) { 7028 // left modal downwards, setting focus to first element 7029 _this.focusableElements.eq(0).focus(); 7030 return true; 7031 } 7032 if (_this.focusableElements.length === 0) { 7033 // no focusable elements inside the modal at all, prevent tabbing in general 7034 return true; 7035 } 7036 }, 7037 tab_backward: function () { 7038 _this.focusableElements = Foundation.Keyboard.findFocusable(_this.$element); 7039 if (_this.$element.find(':focus').is(_this.focusableElements.eq(0)) || _this.$element.is(':focus')) { 7040 // left modal upwards, setting focus to last element 7041 _this.focusableElements.eq(-1).focus(); 7042 return true; 7043 } 7044 if (_this.focusableElements.length === 0) { 7045 // no focusable elements inside the modal at all, prevent tabbing in general 7046 return true; 7047 } 7048 }, 7049 open: function () { 7050 if (_this.$element.find(':focus').is(_this.$element.find('[data-close]'))) { 7051 setTimeout(function () { 7052 // set focus back to anchor if close button has been activated 7053 _this.$anchor.focus(); 7054 }, 1); 7055 } else if ($target.is(_this.focusableElements)) { 7056 // dont't trigger if acual element has focus (i.e. inputs, links, ...) 7057 _this.open(); 7058 } 7059 }, 7060 close: function () { 7061 if (_this.options.closeOnEsc) { 7062 _this.close(); 7063 _this.$anchor.focus(); 7064 } 7065 }, 7066 handled: function (preventDefault) { 7067 if (preventDefault) { 7068 e.preventDefault(); 7069 } 7070 } 7071 }); 7072 }); 7073 } 7074 7075 /** 7076 * Closes the modal. 7077 * @function 7078 * @fires Reveal#closed 7079 */ 7080 7081 }, {
7082 key: 'close', 7083 value: function close() { 7084 if (!this.isActive || !this.$element.is(':visible')) { 7085 return false; 7086 } 7087 var _this = this; 7088 7089 // Motion UI method of hiding 7090 if (this.options.animationOut) { 7091 if (this.options.overlay) { 7092 Foundation.Motion.animateOut(this.$overlay, 'fade-out', finishUp); 7093 } else { 7094 finishUp(); 7095 } 7096 7097 Foundation.Motion.animateOut(this.$element, this.options.animationOut); 7098 } 7099 // jQuery method of hiding 7100 else { 7101 if (this.options.overlay) { 7102 this.$overlay.hide(0, finishUp); 7103 } else { 7104 finishUp(); 7105 } 7106 7107 this.$element.hide(this.options.hideDelay); 7108 } 7109 7110 // Conditionals to remove extra event listeners added on open 7111 if (this.options.closeOnEsc) { 7112 $(window).off('keydown.zf.reveal'); 7113 } 7114 7115 if (!this.options.overlay && this.options.closeOnClick) { 7116 $('body').off('click.zf.reveal'); 7117 } 7118 7119 this.$element.off('keydown.zf.reveal'); 7120 7121 function finishUp() { 7122 if (_this.isMobile) { 7123 $('html, body').removeClass('is-reveal-open'); 7124 if (_this.originalScrollPos) { 7125 $('body').scrollTop(_this.originalScrollPos); 7126 _this.originalScrollPos = null; 7127 } 7128 } else { 7129 $('body').removeClass('is-reveal-open'); 7130 } 7131 7132 _this.$element.attr('aria-hidden', true); 7133 7134 /** 7135 * Fires when the modal is done closing. 7136 * @event Reveal#closed 7137 */ 7138 _this.$element.trigger('closed.zf.reveal'); 7139 } 7140 7141 /** 7142 * Resets the modal content 7143 * This prevents a running video to keep going in the background 7144 */ 7145 if (this.options.resetOnClose) { 7146 this.$element.html(this.$element.html()); 7147 } 7148 7149 this.isActive = false; 7150 if (_this.options.deepLink) { 7151 if (window.history.replaceState) { 7152 window.history.replaceState("", document.title, window.location.pathname); 7153 } else { 7154 window.location.hash = ''; 7155 } 7156 } 7157 } 7158 7159 /** 7160 * Toggles the open/closed state of a modal. 7161 * @function 7162 */ 7163 7164 }, { 7165 key: 'toggle', 7166 value: function toggle() { 7167 if (this.isActive) { 7168 this.close(); 7169 } else { 7170 this.open(); 7171 } 7172 } 7173 }, { 7174 key: 'destroy', 7175 7176 7177 /** 7178 * Destroys an instance of a modal. 7179 * @function 7180 */ 7181 value: function destroy() { 7182 if (this.options.overlay) { 7183 this.$element.appendTo($('body')); // move $element outside of $overlay to prevent error unregisterPlugin() 7184 this.$overlay.hide().off().remove(); 7185 } 7186 this.$element.hide().off(); 7187 this.$anchor.off('.zf'); 7188 $(window).off('.zf.reveal:' + this.id); 7189 7190 Foundation.unregisterPlugin(this); 7191 } 7192 }]); 7193 7194 return Reveal; 7195 }(); 7196 7197 Reveal.defaults = { 7198 /** 7199 * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide. 7200 * @option 7201 * @example 'slide-in-left' 7202 */ 7203 animationIn: '', 7204 /** 7205 * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide. 7206 * @option 7207 * @example 'slide-out-right' 7208 */ 7209 animationOut: '', 7210 /** 7211 * Time, in ms, to delay the opening of a modal after a click if no animation used. 7212 * @option 7213 * @example 10 7214 */ 7215 showDelay: 0, 7216 /** 7217 * Time, in ms, to delay the closing of a modal after a click if no animation used. 7218 * @option 7219 * @example 10 7220 */ 7221 hideDelay: 0, 7222 /** 7223 * Allows a click on the body/overlay to close the modal. 7224 * @option 7225 * @example true 7226 */ 7227 closeOnClick: true, 7228 /** 7229 * Allows the modal to close if the user presses the `ESCAPE` key. 7230 * @option 7231 * @example true 7232 */ 7233 closeOnEsc: true, 7234 /** 7235 * If true, allows multiple modals to be displayed at once. 7236 * @option 7237 * @example false 7238 */ 7239 multipleOpened: false, 7240 /** 7241 * Distance, in pixels, the modal should push down from the top of the screen. 7242 * @option 7243 * @example auto 7244 */ 7245 vOffset: 'auto', 7246 /** 7247 * Distance, in pixels, the modal should push in from the side of the screen. 7248 * @option 7249 * @example auto 7250 */ 7251 hOffset: 'auto', 7252 /** 7253 * Allows the modal to be fullscreen, completely blocking out the rest of the view. JS checks for this as well. 7254 * @option 7255 * @example false 7256 */ 7257 fullScreen: false, 7258 /** 7259 * Percentage of screen height the modal should push up from the bottom of the view. 7260 * @option 7261 * @example 10 7262 */ 7263 btmOffsetPct: 10, 7264 /** 7265 * Allows the modal to generate an overlay div, which will cover the view when modal opens. 7266 * @option 7267 * @example true 7268 */ 7269 overlay: true, 7270 /** 7271 * Allows the modal to remove and reinject markup on close. Should be true if using video elements w/o using provider's api, otherwise, videos will continue to play in the background. 7272 * @option 7273 * @example false 7274 */ 7275 resetOnClose: false, 7276 /** 7277 * Allows the modal to alter the url on open/close, and allows the use of the `back` button to close modals. ALSO, allows a modal to auto-maniacally open on page load IF the hash === the modal'
7277s user-set id. 7278 * @option 7279 * @example false 7280 */ 7281 deepLink: false 7282 }; 7283 7284 // Window exports 7285 Foundation.plugin(Reveal, 'Reveal'); 7286 7287 function iPhoneSniff() { 7288 return (/iP(ad|hone|od).*OS/.test(window.navigator.userAgent) 7289 ); 7290 } 7291 7292 function androidSniff() { 7293 return (/Android/.test(window.navigator.userAgent) 7294 ); 7295 } 7296 7297 function mobileSniff() { 7298 return iPhoneSniff() || androidSniff(); 7299 } 7300}(jQuery); 7301'use strict'; 7302 7303var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 7304 7305function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7306 7307!function ($) { 7308 7309 /** 7310 * Slider module. 7311 * @module foundation.slider 7312 * @requires foundation.util.motion 7313 * @requires foundation.util.triggers 7314 * @requires foundation.util.keyboard 7315 * @requires foundation.util.touch 7316 */ 7317 7318 var Slider = function () { 7319 /** 7320 * Creates a new instance of a drilldown menu. 7321 * @class 7322 * @param {jQuery} element - jQuery object to make into an accordion menu. 7323 * @param {Object} options - Overrides to the default plugin settings. 7324 */ 7325 function Slider(element, options) { 7326 _classCallCheck(this, Slider); 7327 7328 this.$element = element; 7329 this.options = $.extend({}, Slider.defaults, this.$element.data(), options); 7330 7331 this._init(); 7332 7333 Foundation.registerPlugin(this, 'Slider'); 7334 Foundation.Keyboard.register('Slider', { 7335 'ltr': { 7336 'ARROW_RIGHT': 'increase', 7337 'ARROW_UP': 'increase', 7338 'ARROW_DOWN': 'decrease', 7339 'ARROW_LEFT': 'decrease', 7340 'SHIFT_ARROW_RIGHT': 'increase_fast', 7341 'SHIFT_ARROW_UP': 'increase_fast', 7342 'SHIFT_ARROW_DOWN': 'decrease_fast', 7343 'SHIFT_ARROW_LEFT': 'decrease_fast' 7344 }, 7345 'rtl': { 7346 'ARROW_LEFT': 'increase', 7347 'ARROW_RIGHT': 'decrease', 7348 'SHIFT_ARROW_LEFT': 'increase_fast', 7349 'SHIFT_ARROW_RIGHT': 'decrease_fast' 7350 } 7351 }); 7352 } 7353 7354 /** 7355 * Initilizes the plugin by reading/setting attributes, creating collections and setting the initial position of the handle(s). 7356 * @function 7357 * @private 7358 */ 7359 7360 7361 _createClass(Slider, [{ 7362 key: '_init', 7363 value: function _init() { 7364 this.inputs = this.$element.find('input'); 7365 this.handles = this.$element.find('[data-slider-handle]'); 7366 7367 this.$handle = this.handles.eq(0); 7368 this.$input = this.inputs.length ? this.inputs.eq(0) : $('#' + this.$handle.attr('aria-controls')); 7369 this.$fill = this.$element.find('[data-slider-fill]').css(this.options.vertical ? 'height' : 'width', 0); 7370 7371 var isDbl = false, 7372 _this = this; 7373 if (this.options.disabled || this.$element.hasClass(this.options.disabledClass)) { 7374 this.options.disabled = true; 7375 this.$element.addClass(this.options.disabledClass); 7376 } 7377 if (!this.inputs.length) { 7378 this.inputs = $().add(this.$input); 7379 this.options.binding = true; 7380 } 7381 this._setInitAttr(0); 7382 this._events(this.$handle); 7383 7384 if (this.handles[1]) { 7385 this.options.doubleSided = true; 7386 this.$handle2 = this.handles.eq(1); 7387 this.$input2 = this.inputs.length > 1 ? this.inputs.eq(1) : $('#' + this.$handle2.attr('aria-controls')); 7388 7389 if (!this.inputs[1]) { 7390 this.inputs = this.inputs.add(this.$input2); 7391 } 7392 isDbl = true; 7393 7394 this._setHandlePos(this.$handle, this.options.initialStart, true, function () { 7395 7396 _this._setHandlePos(_this.$handle2, _this.options.initialEnd, true); 7397 }); 7398 // this.$handle.triggerHandler('click.zf.slider'); 7399 this._setInitAttr(1); 7400 this._events(this.$handle2); 7401 } 7402 7403 if (!isDbl) { 7404 this._setHandlePos(this.$handle, this.options.initialStart, true); 7405 } 7406 } 7407 7408 /** 7409 * Sets the position of the selected handle and fill bar. 7410 * @function 7411 * @private 7412 * @param {jQuery} $hndl - the selected handle to move. 7413 * @param {Number} location - floating point between the start and end values of the slider bar. 7414 * @param {Function} cb - callback function to fire on completion. 7415 * @fires Slider#moved 7416 * @fires Slider#changed 7417 */ 7418 7419 }, {
7420 key: '_setHandlePos', 7421 value: function _setHandlePos($hndl, location, noInvert, cb) { 7422 // don't move if the slider has been disabled since its initialization 7423 if (this.$element.hasClass(this.options.disabledClass)) { 7424 return; 7425 } 7426 //might need to alter that slightly for bars that will have odd number selections. 7427 location = parseFloat(location); //on input change events, convert string to number...grumble. 7428 7429 // prevent slider from running out of bounds, if value exceeds the limits set through options, override the value to min/max 7430 if (location < this.options.start) { 7431 location = this.options.start; 7432 } else if (location > this.options.end) { 7433 location = this.options.end; 7434 } 7435 7436 var isDbl = this.options.doubleSided; 7437 7438 if (isDbl) { 7439 //this block is to prevent 2 handles from crossing eachother. Could/should be improved. 7440 if (this.handles.index($hndl) === 0) { 7441 var h2Val = parseFloat(this.$handle2.attr('aria-valuenow')); 7442 location = location >= h2Val ? h2Val - this.options.step : location; 7443 } else { 7444 var h1Val = parseFloat(this.$handle.attr('aria-valuenow')); 7445 location = location <= h1Val ? h1Val + this.options.step : location; 7446 } 7447 } 7448 7449 //this is for single-handled vertical sliders, it adjusts the value to account for the slider being "upside-down" 7450 //for click and drag events, it's weird due to the scale(-1, 1) css property 7451 if (this.options.vertical && !noInvert) { 7452 location = this.options.end - location; 7453 } 7454 7455 var _this = this, 7456 vert = this.options.vertical, 7457 hOrW = vert ? 'height' : 'width', 7458 lOrT = vert ? 'top' : 'left', 7459 handleDim = $hndl[0].getBoundingClientRect()[hOrW], 7460 elemDim = this.$element[0].getBoundingClientRect()[hOrW], 7461 7462 //percentage of bar min/max value based on click or drag point 7463 pctOfBar = percent(location - this.options.start, this.options.end - this.options.start).toFixed(2), 7464 7465 //number of actual pixels to shift the handle, based on the percentage obtained above 7466 pxToMove = (elemDim - handleDim) * pctOfBar, 7467 7468 //percentage of bar to shift the handle 7469 movement = (percent(pxToMove, elemDim) * 100).toFixed(this.options.decimal); 7470 //fixing the decimal value for the location number, is passed to other methods as a fixed floating-point value 7471 location = parseFloat(location.toFixed(this.options.decimal)); 7472 // declare empty object for css adjustments, only used with 2 handled-sliders 7473 var css = {}; 7474 7475 this._setValues($hndl, location); 7476 7477 // TODO update to calculate based on values set to respective inputs?? 7478 if (isDbl) { 7479 var isLeftHndl = this.handles.index($hndl) === 0, 7480 7481 //empty variable, will be used for min-height/width for fill bar 7482 dim, 7483 7484 //percentage w/h of the handle compared to the slider bar 7485 handlePct = ~~(percent(handleDim, elemDim) * 100); 7486 //if left handle, the math is slightly different than if it's the right handle, and the left/top property needs to be changed for the fill bar 7487 if (isLeftHndl) { 7488 //left or top percentage value to apply to the fill bar. 7489 css[lOrT] = movement + '%'; 7490 //calculate the new min-height/width for the fill bar. 7491 dim = parseFloat(this.$handle2[0].style[lOrT]) - movement + handlePct; 7492 //this callback is necessary to prevent errors and allow the proper placement and initialization of a 2-handled slider 7493 //plus, it means we don't care if 'dim' isNaN on init, it won't be in the future. 7494 if (cb && typeof cb === 'function') { 7495 cb(); 7496 } //this is only needed for the initialization of 2 handled sliders 7497 } else { 7498 //just caching the value of the left/bottom handle's left/top property 7499 var handlePos = parseFloat(this.$handle[0].style[lOrT]); 7500 //calculate the new min-height/width for the fill bar. Use isNaN to prevent false positives for numbers <= 0 7501 //based on the percentage of movement of the handle being manipulated, less the opposing handle's left/top position, plus the percentage w/h of the handle itself 7502 dim = movement - (isNaN(handlePos) ? this.options.initialStart / ((this.options.end - this.options.start) / 100) : handlePos) + handlePct; 7503 } 7504 // assign the min-height/width to our css object 7505 css['min-' + hOrW] = dim + '%'; 7506 } 7507 7508 this.$element.one('finished.zf.animate', function () { 7509 /** 7510 * Fires when the handle is done moving. 7511 * @event Slider#moved 7512 */ 7513 _this.$element.trigger('moved.zf.slider', [$hndl]); 7514 }); 7515 7516 //because we don't know exactly how the handle will be moved, check the amount of time it should take to move. 7517 var moveTime = this.$element.data('dragging') ? 1000 / 60 : this.options.moveTime; 7518 7519 Foundation.Move(moveTime, $hndl, function () { 7520 //adjusting the left/top property of the handle, based on the percentage c
7520alculated above 7521 $hndl.css(lOrT, movement + '%'); 7522 7523 if (!_this.options.doubleSided) { 7524 //if single-handled, a simple method to expand the fill bar 7525 _this.$fill.css(hOrW, pctOfBar * 100 + '%'); 7526 } else { 7527 //otherwise, use the css object we created above 7528 _this.$fill.css(css); 7529 } 7530 }); 7531 7532 /** 7533 * Fires when the value has not been change for a given time. 7534 * @event Slider#changed 7535 */ 7536 clearTimeout(_this.timeout); 7537 _this.timeout = setTimeout(function () { 7538 _this.$element.trigger('changed.zf.slider', [$hndl]); 7539 }, _this.options.changedDelay); 7540 } 7541 7542 /** 7543 * Sets the initial attribute for the slider element. 7544 * @function 7545 * @private 7546 * @param {Number} idx - index of the current handle/input to use. 7547 */ 7548 7549 }, { 7550 key: '_setInitAttr', 7551 value: function _setInitAttr(idx) { 7552 var id = this.inputs.eq(idx).attr('id') || Foundation.GetYoDigits(6, 'slider'); 7553 this.inputs.eq(idx).attr({ 7554 'id': id, 7555 'max': this.options.end, 7556 'min': this.options.start, 7557 'step': this.options.step 7558 }); 7559 this.handles.eq(idx).attr({ 7560 'role': 'slider', 7561 'aria-controls': id, 7562 'aria-valuemax': this.options.end, 7563 'aria-valuemin': this.options.start, 7564 'aria-valuenow': idx === 0 ? this.options.initialStart : this.options.initialEnd, 7565 'aria-orientation': this.options.vertical ? 'vertical' : 'horizontal', 7566 'tabindex': 0 7567 }); 7568 } 7569 7570 /** 7571 * Sets the input and `aria-valuenow` values for the slider element. 7572 * @function 7573 * @private 7574 * @param {jQuery} $handle - the currently selected handle. 7575 * @param {Number} val - floating point of the new value. 7576 */ 7577 7578 }, { 7579 key: '_setValues', 7580 value: function _setValues($handle, val) { 7581 var idx = this.options.doubleSided ? this.handles.index($handle) : 0; 7582 this.inputs.eq(idx).val(val); 7583 $handle.attr('aria-valuenow', val); 7584 } 7585 7586 /** 7587 * Handles events on the slider element. 7588 * Calculates the new location of the current handle. 7589 * If there are two handles and the bar was clicked, it determines which handle to move. 7590 * @function 7591 * @private 7592 * @param {Object} e - the `event` object passed from the listener. 7593 * @param {jQuery} $handle - the current handle to calculate for, if selected. 7594 * @param {Number} val - floating point number for the new value of the slider. 7595 * TODO clean this up, there's a lot of repeated code between this and the _setHandlePos fn. 7596 */ 7597 7598 }, { 7599 key: '_handleEvent', 7600 value: function _handleEvent(e, $handle, val) { 7601 var value, hasVal; 7602 if (!val) { 7603 //click or drag events 7604 e.preventDefault(); 7605 var _this = this, 7606 vertical = this.options.vertical, 7607 param = vertical ? 'height' : 'width', 7608 direction = vertical ? 'top' : 'left', 7609 eventOffset = vertical ? e.pageY : e.pageX, 7610 halfOfHandle = this.$handle[0].getBoundingClientRect()[param] / 2, 7611 barDim = this.$element[0].getBoundingClientRect()[param], 7612 windowScroll = vertical ? $(window).scrollTop() : $(window).scrollLeft(); 7613 7614 var elemOffset = this.$element.offset()[direction]; 7615 7616 // touch events emulated by the touch util give position relative to screen, add window.scroll to event coordinates... 7617 // best way to guess this is simulated is if clientY == pageY 7618 if (e.clientY === e.pageY) { 7619 eventOffset = eventOffset + windowScroll; 7620 } 7621 var eventFromBar = eventOffset - elemOffset; 7622 var barXY; 7623 if (eventFromBar < 0) { 7624 barXY = 0; 7625 } else if (eventFromBar > barDim) { 7626 barXY = barDim; 7627 } else { 7628 barXY = eventFromBar; 7629 }
7630 var offsetPct = percent(barXY, barDim); 7631 7632 value = (this.options.end - this.options.start) * offsetPct + this.options.start; 7633 7634 // turn everything around for RTL, yay math! 7635 if (Foundation.rtl() && !this.options.vertical) { 7636 value = this.options.end - value; 7637 } 7638 7639 value = _this._adjustValue(null, value); 7640 //boolean flag for the setHandlePos fn, specifically for vertical sliders 7641 hasVal = false; 7642 7643 if (!$handle) { 7644 //figure out which handle it is, pass it to the next function. 7645 var firstHndlPos = absPosition(this.$handle, direction, barXY, param), 7646 secndHndlPos = absPosition(this.$handle2, direction, barXY, param); 7647 $handle = firstHndlPos <= secndHndlPos ? this.$handle : this.$handle2; 7648 } 7649 } else { 7650 //change event on input 7651 value = this._adjustValue(null, val); 7652 hasVal = true; 7653 } 7654 7655 this._setHandlePos($handle, value, hasVal); 7656 } 7657 7658 /** 7659 * Adjustes value for handle in regard to step value. returns adjusted value 7660 * @function 7661 * @private 7662 * @param {jQuery} $handle - the selected handle. 7663 * @param {Number} value - value to adjust. used if $handle is falsy 7664 */ 7665 7666 }, { 7667 key: '_adjustValue', 7668 value: function _adjustValue($handle, value) { 7669 var val, 7670 step = this.options.step, 7671 div = parseFloat(step / 2), 7672 left, 7673 prev_val, 7674 next_val; 7675 if (!!$handle) { 7676 val = parseFloat($handle.attr('aria-valuenow')); 7677 } else { 7678 val = value; 7679 } 7680 left = val % step; 7681 prev_val = val - left; 7682 next_val = prev_val + step; 7683 if (left === 0) { 7684 return val; 7685 } 7686 val = val >= prev_val + div ? next_val : prev_val; 7687 return val; 7688 } 7689 7690 /** 7691 * Adds event listeners to the slider elements. 7692 * @function 7693 * @private 7694 * @param {jQuery} $handle - the current handle to apply listeners to. 7695 */ 7696 7697 }, { 7698 key: '_events', 7699 value: function _events($handle) { 7700 var _this = this, 7701 curHandle, 7702 timer; 7703 7704 this.inputs.off('change.zf.slider').on('change.zf.slider', function (e) { 7705 var idx = _this.inputs.index($(this)); 7706 _this._handleEvent(e, _this.handles.eq(idx), $(this).val()); 7707 }); 7708 7709 if (this.options.clickSelect) { 7710 this.$element.off('click.zf.slider').on('click.zf.slider', function (e) { 7711 if (_this.$element.data('dragging')) { 7712 return false; 7713 } 7714 7715 if (!$(e.target).is('[data-slider-handle]')) { 7716 if (_this.options.doubleSided) { 7717 _this._handleEvent(e); 7718 } else { 7719 _this._handleEvent(e, _this.$handle); 7720 } 7721 } 7722 }); 7723 } 7724 7725 if (this.options.draggable) { 7726 this.handles.addTouch(); 7727 7728 var $body = $('body'); 7729 $handle.off('mousedown.zf.slider').on('mousedown.zf.slider', function (e) { 7730 $handle.addClass('is-dragging'); 7731 _this.$fill.addClass('is-dragging'); // 7732 _this.$element.data('dragging', true); 7733 7734 curHandle = $(e.currentTarget); 7735 7736 $body.on('mousemove.zf.slider', function (e) { 7737 e.preventDefault(); 7738 _this._handleEvent(e, curHandle); 7739 }).on('mouseup.zf.slider', function (e) { 7740 _this._handleEvent(e, curHandle); 7741 7742 $handle.removeClass('is-dragging'); 7743 _this.$fill.removeClass('is-dragging'); 7744 _this.$element.data('dragging', false); 7745 7746 $body.off('mousemove.zf.slider mouseup.zf.slider'); 7747 }); 7748 }) 7749 // prevent events triggered by touch 7750 .on('selectstart.zf.slider touchmove.zf.slider', function (e) { 7751 e.preventDefault(); 7752 }); 7753 } 7754 7755 $handle.off('keydown.zf.slider').on('keydown.zf.slider', function (e) { 7756 var _$handle = $(this), 7757 idx = _this.options.doubleSided ? _this.handles.index(_$handle) : 0, 7758 oldValue = parseFloat(_this.inputs.eq(idx).val()), 7759 newValue; 7760 7761 // handle keyboard event with keyboard util 7762 Foundation.Keyboard.handleKey(e, 'Slider', { 7763 decrease: function () { 7764 newValue = oldValue - _this.options.step; 7765 }, 7766 increase: function () { 7767 newValue = oldValue + _this.options.step; 7768 }, 7769 decrease_fast: function () { 7770 newValue = oldValue - _this.options.step * 10; 7771 }, 7772 increase_fast: function () { 7773 newValue = oldValue + _this.options.step * 10; 7774 }, 7775 handled: function () { 7776 // only set handle pos when event was handled specially 7777 e.preventDefault(); 7778 _this._setHandlePos(_$handle, newValue, true); 7779 } 7780 }); 7781 /*if (newValue) { // if pressed key has special function, update value 7782 e.preventDefault(); 7783 _this._setHandlePos(_$handle, newValue); 7784 }*/ 7785 }); 7786 } 7787 7788 /** 7789 * Destroys the slider plugin. 7790 */ 7791 7792 }, {
7793 key: 'destroy', 7794 value: function destroy() { 7795 this.handles.off('.zf.slider'); 7796 this.inputs.off('.zf.slider'); 7797 this.$element.off('.zf.slider'); 7798 7799 Foundation.unregisterPlugin(this); 7800 } 7801 }]); 7802 7803 return Slider; 7804 }(); 7805 7806 Slider.defaults = { 7807 /** 7808 * Minimum value for the slider scale. 7809 * @option 7810 * @example 0 7811 */ 7812 start: 0, 7813 /** 7814 * Maximum value for the slider scale. 7815 * @option 7816 * @example 100 7817 */ 7818 end: 100, 7819 /** 7820 * Minimum value change per change event. 7821 * @option 7822 * @example 1 7823 */ 7824 step: 1, 7825 /** 7826 * Value at which the handle/input *(left handle/first input)* should be set to on initialization. 7827 * @option 7828 * @example 0 7829 */ 7830 initialStart: 0, 7831 /** 7832 * Value at which the right handle/second input should be set to on initialization. 7833 * @option 7834 * @example 100 7835 */ 7836 initialEnd: 100, 7837 /** 7838 * Allows the input to be located outside the container and visible. Set to by the JS 7839 * @option 7840 * @example false 7841 */ 7842 binding: false, 7843 /** 7844 * Allows the user to click/tap on the slider bar to select a value. 7845 * @option 7846 * @example true 7847 */ 7848 clickSelect: true, 7849 /** 7850 * Set to true and use the `vertical` class to change alignment to vertical. 7851 * @option 7852 * @example false 7853 */ 7854 vertical: false, 7855 /** 7856 * Allows the user to drag the slider handle(s) to select a value. 7857 * @option 7858 * @example true 7859 */ 7860 draggable: true, 7861 /** 7862 * Disables the slider and prevents event listeners from being applied. Double checked by JS with `disabledClass`. 7863 * @option 7864 * @example false 7865 */ 7866 disabled: false, 7867 /** 7868 * Allows the use of two handles. Double checked by the JS. Changes some logic handling. 7869 * @option 7870 * @example false 7871 */ 7872 doubleSided: false, 7873 /** 7874 * Potential future feature. 7875 */ 7876 // steps: 100, 7877 /** 7878 * Number of decimal places the plugin should go to for floating point precision. 7879 * @option 7880 * @example 2 7881 */ 7882 decimal: 2, 7883 /** 7884 * Time delay for dragged elements. 7885 */ 7886 // dragDelay: 0, 7887 /** 7888 * Time, in ms, to animate the movement of a slider handle if user clicks/taps on the bar. Needs to be manually set if updating the transition time in the Sass settings. 7889 * @option 7890 * @example 200 7891 */ 7892 moveTime: 200, //update this if changing the transition time in the sass 7893 /** 7894 * Class applied to disabled sliders. 7895 * @option 7896 * @example 'disabled' 7897 */ 7898 disabledClass: 'disabled', 7899 /** 7900 * Will invert the default layout for a vertical<span data-tooltip title="who would do this???"> </span>slider. 7901 * @option 7902 * @example false 7903 */ 7904 invertVertical: false, 7905 /** 7906 * Milliseconds before the `changed.zf-slider` event is triggered after value change. 7907 * @option 7908 * @example 500 7909 */ 7910 changedDelay: 500 7911 }; 7912 7913 function percent(frac, num) { 7914 return frac / num; 7915 } 7916 function absPosition($handle, dir, clickPos, param) { 7917 return Math.abs($handle.position()[dir] + $handle[param]() / 2 - clickPos); 7918 } 7919 7920 // Window exports 7921 Foundation.plugin(Slider, 'Slider'); 7922}(jQuery); 7923 7924//*********this is in case we go to static, absolute positions instead of dynamic positioning******** 7925// this.setSteps(function() { 7926// _this._events(); 7927// var initStart = _this.options.positions[_this.options.initialStart - 1] || null; 7928// var initEnd = _this.options.initialEnd ? _this.options.position[_this.options.initialEnd - 1] : null; 7929// if (initStart || initEnd) { 7930// _this._handleEvent(initStart, initEnd); 7931// } 7932// }); 7933 7934//***********the other part of absolute positions************* 7935// Slider.prototype.setSteps = function(cb) { 7936// var posChange = this.$element.outerWidth() / this.options.steps; 7937// var counter = 0 7938// while(counter < this.options.steps) { 7939// if (counter) { 7940// this.options.positions.push(this.options.positions[counter - 1] + posChange); 7941// } else { 7942// this.options.positions.push(posChange); 7943// } 7944// counter++; 7945// } 7946// cb(); 7947// }; 7948'use strict'; 7949 7950var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 7951 7952function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7953 7954!function ($) { 7955 7956 /** 7957 * Sticky module. 7958 * @module foundation.sticky 7959 * @requires foundation.util.triggers 7960 * @requires foundation.util.mediaQuery 7961 */ 7962 7963 var Sticky = function () { 7964 /** 7965 * Creates a new instance of a sticky thing. 7966 * @class 7967 * @param {jQuery} element - jQuery object to make sticky. 7968 * @param {Object} options - options object passed when creating the element programmatically. 7969 */ 7970 function Sticky(element, options) { 7971 _classCallCheck(this, Sticky); 7972 7973 this.$element = element; 7974 this.options = $.extend({}, Sticky.defaults, this.$element.data(), options); 7975 7976 this._init(); 7977 7978 Foundation.registerPlugin(this, 'Sticky'); 7979 } 7980 7981 /** 7982 * Initializes the sticky element by adding classes, getting/setting dimensions, breakpoints and attributes 7983 * @function 7984 * @private 7985 */ 7986 7987 7988 _createClass(Sticky, [{ 7989 key: '_init', 7990 value: function _init() { 7991 var $parent = this.$element.parent('[data-sticky-container]'), 7992 id = this.$element[0].id || Foundation.GetYoDigits(6, 'sticky'), 7993 _this = this; 7994 7995 if (!$parent.length) { 7996 this.wasWrapped = true; 7997 } 7998 this.$container = $parent.length ? $parent : $(this.options.container).wrapInner(this.$element); 7999 this.$container.addClass(this.options.containerClass); 8000 8001 this.$element.addClass(this.options.stickyClass).attr({ 'data-resize': id }); 8002 8003 this.scrollCount = this.options.checkEvery; 8004 this.isStuck = false;
vendor: 4,109 bytes, lines 8005-8126
8005 $(window).one('load.zf.sticky', function () { 8006 //We calculate the container height to have correct values for anchor points offset calculation. 8007 _this.containerHeight = _this.$element.css("display") == "none" ? 0 : _this.$element[0].getBoundingClientRect().height; 8008 _this.$container.css('height', _this.containerHeight); 8009 _this.elemHeight = _this.containerHeight; 8010 if (_this.options.anchor !== '') { 8011 _this.$anchor = $('#' + _this.options.anchor); 8012 } else { 8013 _this._parsePoints(); 8014 } 8015 8016 _this._setSizes(function () { 8017 _this._calc(false); 8018 }); 8019 _this._events(id.split('-').reverse().join('-')); 8020 }); 8021 } 8022 8023 /** 8024 * If using multiple elements as anchors, calculates the top and bottom pixel values the sticky thing should stick and unstick on. 8025 * @function 8026 * @private 8027 */ 8028 8029 }, { 8030 key: '_parsePoints', 8031 value: function _parsePoints() { 8032 var top = this.options.topAnchor == "" ? 1 : this.options.topAnchor, 8033 btm = this.options.btmAnchor == "" ? document.documentElement.scrollHeight : this.options.btmAnchor, 8034 pts = [top, btm], 8035 breaks = {}; 8036 for (var i = 0, len = pts.length; i < len && pts[i]; i++) { 8037 var pt; 8038 if (typeof pts[i] === 'number') { 8039 pt = pts[i]; 8040 } else { 8041 var place = pts[i].split(':'), 8042 anchor = $('#' + place[0]); 8043 8044 pt = anchor.offset().top; 8045 if (place[1] && place[1].toLowerCase() === 'bottom') { 8046 pt += anchor[0].getBoundingClientRect().height; 8047 } 8048 } 8049 breaks[i] = pt; 8050 } 8051 8052 this.points = breaks; 8053 return; 8054 } 8055 8056 /** 8057 * Adds event handlers for the scrolling element. 8058 * @private 8059 * @param {String} id - psuedo-random id for unique scroll event listener. 8060 */ 8061 8062 }, { 8063 key: '_events', 8064 value: function _events(id) { 8065 var _this = this, 8066 scrollListener = this.scrollListener = 'scroll.zf.' + id; 8067 if (this.isOn) { 8068 return; 8069 } 8070 if (this.canStick) { 8071 this.isOn = true; 8072 $(window).off(scrollListener).on(scrollListener, function (e) { 8073 if (_this.scrollCount === 0) { 8074 _this.scrollCount = _this.options.checkEvery; 8075 _this._setSizes(function () { 8076 _this._calc(false, window.pageYOffset); 8077 }); 8078 } else { 8079 _this.scrollCount--; 8080 _this._calc(false, window.pageYOffset); 8081 } 8082 }); 8083 } 8084 8085 this.$element.off('resizeme.zf.trigger').on('resizeme.zf.trigger', function (e, el) { 8086 _this._setSizes(function () { 8087 _this._calc(false); 8088 if (_this.canStick) { 8089 if (!_this.isOn) { 8090 _this._events(id); 8091 } 8092 } else if (_this.isOn) { 8093 _this._pauseListeners(scrollListener); 8094 } 8095 }); 8096 }); 8097 } 8098 8099 /** 8100 * Removes event handlers for scroll and change events on anchor. 8101 * @fires Sticky#pause 8102 * @param {String} scrollListener - unique, namespaced scroll listener attached to `window` 8103 */ 8104 8105 }, { 8106 key: '_pauseListeners', 8107 value: function _pauseListeners(scrollListener) { 8108 this.isOn = false; 8109 $(window).off(scrollListener); 8110 8111 /** 8112 * Fires when the plugin is paused due to resize event shrinking the view. 8113 * @event Sticky#pause 8114 * @private 8115 */ 8116 this.$element.trigger('pause.zf.sticky'); 8117 } 8118 8119 /** 8120 * Called on every `scroll` event and on `_init` 8121 * fires functions based on booleans and cached values 8122 * @param {Boolean} checkSizes - true if plugin should recalculate sizes and breakpoints. 8123 * @param {Number} scroll - current scroll position passed from scroll event cb function. If not passed, defaults to `window.pageYOffset`. 8124 */ 8125 8126 }, {
8127 key: '_calc', 8128 value: function _calc(checkSizes, scroll) { 8129 if (checkSizes) { 8130 this._setSizes(); 8131 } 8132 8133 if (!this.canStick) { 8134 if (this.isStuck) { 8135 this._removeSticky(true); 8136 } 8137 return false; 8138 } 8139 8140 if (!scroll) { 8141 scroll = window.pageYOffset; 8142 } 8143 8144 if (scroll >= this.topPoint) { 8145 if (scroll <= this.bottomPoint) { 8146 if (!this.isStuck) { 8147 this._setSticky(); 8148 } 8149 } else { 8150 if (this.isStuck) { 8151 this._removeSticky(false); 8152 } 8153 } 8154 } else { 8155 if (this.isStuck) { 8156 this._removeSticky(true); 8157 } 8158 } 8159 } 8160 8161 /** 8162 * Causes the $element to become stuck. 8163 * Adds `position: fixed;`, and helper classes. 8164 * @fires Sticky#stuckto 8165 * @function 8166 * @private 8167 */ 8168 8169 }, { 8170 key: '_setSticky', 8171 value: function _setSticky() { 8172 var _this = this, 8173 stickTo = this.options.stickTo, 8174 mrgn = stickTo === 'top' ? 'marginTop' : 'marginBottom', 8175 notStuckTo = stickTo === 'top' ? 'bottom' : 'top', 8176 css = {}; 8177 8178 css[mrgn] = this.options[mrgn] + 'em'; 8179 css[stickTo] = 0; 8180 css[notStuckTo] = 'auto'; 8181 css['left'] = this.$container.offset().left + parseInt(window.getComputedStyle(this.$container[0])["padding-left"], 10); 8182 this.isStuck = true; 8183 this.$element.removeClass('is-anchored is-at-' + notStuckTo).addClass('is-stuck is-at-' + stickTo).css(css) 8184 /** 8185 * Fires when the $element has become `position: fixed;` 8186 * Namespaced to `top` or `bottom`, e.g. `sticky.zf.stuckto:top` 8187 * @event Sticky#stuckto 8188 */ 8189 .trigger('sticky.zf.stuckto:' + stickTo); 8190 this.$element.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function () { 8191 _this._setSizes(); 8192 }); 8193 } 8194 8195 /** 8196 * Causes the $element to become unstuck. 8197 * Removes `position: fixed;`, and helper classes. 8198 * Adds other helper classes. 8199 * @param {Boolean} isTop - tells the function if the $element should anchor to the top or bottom of its $anchor element. 8200 * @fires Sticky#unstuckfrom 8201 * @private 8202 */ 8203 8204 }, { 8205 key: '_removeSticky', 8206 value: function _removeSticky(isTop) { 8207 var stickTo = this.options.stickTo, 8208 stickToTop = stickTo === 'top', 8209 css = {}, 8210 anchorPt = (this.points ? this.points[1] - this.points[0] : this.anchorHeight) - this.elemHeight, 8211 mrgn = stickToTop ? 'marginTop' : 'marginBottom', 8212 notStuckTo = stickToTop ? 'bottom' : 'top', 8213 topOrBottom = isTop ? 'top' : 'bottom'; 8214 8215 css[mrgn] = 0; 8216 8217 css['bottom'] = 'auto'; 8218 if (isTop) { 8219 css['top'] = 0; 8220 } else { 8221 css['top'] = anchorPt; 8222 } 8223 8224 css['left'] = ''; 8225 this.isStuck = false; 8226 this.$element.removeClass('is-stuck is-at-' + stickTo).addClass('is-anchored is-at-' + topOrBottom).css(css) 8227 /** 8228 * Fires when the $element has become anchored. 8229 * Namespaced to `top` or `bottom`, e.g. `sticky.zf.unstuckfrom:bottom` 8230 * @event Sticky#unstuckfrom 8231 */ 8232 .trigger('sticky.zf.unstuckfrom:' + topOrBottom); 8233 } 8234 8235 /** 8236 * Sets the $element and $container sizes for plugin. 8237 * Calls `_setBreakPoints`. 8238 * @param {Function} cb - optional callback function to fire on completion of `_setBreakPoints`. 8239 * @private 8240 */ 8241 8242 }, { 8243 key: '_setSizes', 8244 value: function _setSizes(cb) { 8245 this.canStick = Foundation.MediaQuery.atLeast(this.options.stickyOn); 8246 if (!this.canStick) { 8247 if (cb && typeof cb === 'function') { 8248 cb(); 8249 } 8250 } 8251 var _this = this, 8252 newElemWidth = this.$container[0].getBoundingClientRect().width, 8253 comp = window.getComputedStyle(this.$container[0]), 8254 pdng = parseInt(comp['padding-right'], 10); 8255 8256 if (this.$anchor && this.$anchor.length) { 8257 this.anchorHeight = this.$anchor[0].getBoundingClientRect().height; 8258 } else { 8259 this._parsePoints(); 8260 } 8261 8262 this.$element.css({ 8263 'max-width': newElemWidth - pdng + 'px' 8264 }); 8265 8266 var newContainerHeight = this.$element[0].getBoundingClientRect().height || this.containerHeight; 8267 if (this.$element.css("display") == "none") { 8268 newContainerHeight = 0; 8269 } 8270 this.containerHeight = newContainerHeight; 8271 this.$container.css({ 8272 height: newContainerHeight 8273 }); 8274 this.elemHeight = newContainerHeight; 8275 8276 if (this.isStuck) {
8277 this.$element.css({ "left": this.$container.offset().left + parseInt(comp['padding-left'], 10) }); 8278 } else { 8279 if (this.$element.hasClass('is-at-bottom')) { 8280 var anchorPt = (this.points ? this.points[1] - this.$container.offset().top : this.anchorHeight) - this.elemHeight; 8281 this.$element.css('top', anchorPt); 8282 } 8283 } 8284 8285 this._setBreakPoints(newContainerHeight, function () { 8286 if (cb && typeof cb === 'function') { 8287 cb(); 8288 } 8289 }); 8290 } 8291 8292 /** 8293 * Sets the upper and lower breakpoints for the element to become sticky/unsticky. 8294 * @param {Number} elemHeight - px value for sticky.$element height, calculated by `_setSizes`. 8295 * @param {Function} cb - optional callback function to be called on completion. 8296 * @private 8297 */ 8298 8299 }, { 8300 key: '_setBreakPoints', 8301 value: function _setBreakPoints(elemHeight, cb) { 8302 if (!this.canStick) { 8303 if (cb && typeof cb === 'function') { 8304 cb(); 8305 } else { 8306 return false; 8307 } 8308 } 8309 var mTop = emCalc(this.options.marginTop), 8310 mBtm = emCalc(this.options.marginBottom), 8311 topPoint = this.points ? this.points[0] : this.$anchor.offset().top, 8312 bottomPoint = this.points ? this.points[1] : topPoint + this.anchorHeight, 8313 8314 // topPoint = this.$anchor.offset().top || this.points[0], 8315 // bottomPoint = topPoint + this.anchorHeight || this.points[1], 8316 winHeight = window.innerHeight; 8317 8318 if (this.options.stickTo === 'top') { 8319 topPoint -= mTop; 8320 bottomPoint -= elemHeight + mTop; 8321 } else if (this.options.stickTo === 'bottom') { 8322 topPoint -= winHeight - (elemHeight + mBtm); 8323 bottomPoint -= winHeight - mBtm; 8324 } else { 8325 //this would be the stickTo: both option... tricky 8326 } 8327 8328 this.topPoint = topPoint; 8329 this.bottomPoint = bottomPoint; 8330 8331 if (cb && typeof cb === 'function') { 8332 cb(); 8333 } 8334 } 8335 8336 /** 8337 * Destroys the current sticky element. 8338 * Resets the element to the top position first. 8339 * Removes event listeners, JS-added css properties and classes, and unwraps the $element if the JS added the $container. 8340 * @function 8341 */ 8342 8343 }, { 8344 key: 'destroy', 8345 value: function destroy() { 8346 this._removeSticky(true); 8347 8348 this.$element.removeClass(this.options.stickyClass + ' is-anchored is-at-top').css({ 8349 height: '', 8350 top: '', 8351 bottom: '', 8352 'max-width': '' 8353 }).off('resizeme.zf.trigger'); 8354 if (this.$anchor && this.$anchor.length) { 8355 this.$anchor.off('change.zf.sticky'); 8356 } 8357 $(window).off(this.scrollListener); 8358 8359 if (this.wasWrapped) { 8360 this.$element.unwrap(); 8361 } else { 8362 this.$container.removeClass(this.options.containerClass).css({ 8363 height: '' 8364 }); 8365 } 8366 Foundation.unregisterPlugin(this); 8367 } 8368 }]); 8369 8370 return Sticky; 8371 }(); 8372 8373 Sticky.defaults = { 8374 /** 8375 * Customizable container template. Add your own classes for styling and sizing. 8376 * @option 8377 * @example '<div data-sticky-container class="small-6 columns"></div>' 8378 */ 8379 container: '<div data-sticky-container></div>', 8380 /** 8381 * Location in the view the element sticks to. 8382 * @option 8383 * @example 'top' 8384 */ 8385 stickTo: 'top', 8386 /** 8387 * If anchored to a single element, the id of that element. 8388 * @option 8389 * @example 'exampleId' 8390 */ 8391 anchor: '', 8392 /** 8393 * If using more than one element as anchor points, the id of the top anchor. 8394 * @option 8395 * @example 'exampleId:top' 8396 */ 8397 topAnchor: '', 8398 /** 8399 * If using more than one element as anchor points, the id of the bottom anchor. 8400 * @option 8401 * @example 'exampleId:bottom' 8402 */ 8403 btmAnchor: '', 8404 /** 8405 * Margin, in `em`'s to apply to the top of the element when it becomes sticky. 8406 * @option 8407 * @example 1 8408 */ 8409 marginTop: 1, 8410 /** 8411 * Margin, in `em`'s to apply to the bottom of the element when it becomes sticky. 8412 * @option 8413 * @example 1 8414 */ 8415 marginBottom: 1, 8416 /** 8417 * Breakpoint string that is the minimum screen size an element should become sticky. 8418 * @option 8419 * @example 'medium' 8420 */ 8421 stickyOn: 'medium', 8422 /** 8423 * Class applied to sticky element, and removed on destruction. Foundation defaults to `sticky`. 8424 * @option 8425 * @example 'sticky' 8426 */ 8427 stickyClass: 'sticky', 8428 /** 8429 * Class applied to sticky container. Foundation defaults to `sticky-container`. 8430 * @option 8431 * @example 'sticky-container' 8432 */ 8433 containerClass: 'sticky-container', 8434 /** 8435 * Number of scroll events between the plugin's recalculating sticky points. Setting it to `0` will cause it to recalc every scroll event, setting it to `-1` will prevent recalc on scroll. 8436 * @option 8437 * @example 50 8438 */ 8439 checkEvery: -1 8440 }; 8441 8442 /** 8443 * Helper function to calculate em values 8444 * @param Number {em} - number of em's to calculate into pixels 8445 */ 8446 function emCalc(em) { 8447 return parseInt(window.getComputedStyle(document.body, null).fontSize, 10) * em; 8448 } 8449 8450 // Window exports 8451 Foundation.plugin(Sticky, 'Sticky'); 8452}(jQuery); 8453'use strict'; 8454 8455var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8456 8457function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8458 8459!function ($) { 8460 8461 /** 8462 * Tabs module. 8463 * @module foundation.tabs 8464 * @requires foundation.util.keyboard 8465 * @requires foundation.util.timerAndImageLoader if tabs contain images 8466 */ 8467 8468 var Tabs = function () { 8469 /** 8470 * Creates a new instance of tabs. 8471 * @class 8472 * @fires Tabs#init 8473 * @param {jQuery} element - jQuery object to make into tabs. 8474 * @param {Object} options - Overrides to the default plugin settings. 8475 */ 8476 function Tabs(element, options) { 8477 _classCallCheck(this, Tabs); 8478 8479 this.$element = element; 8480 this.options = $.extend({}, Tabs.defaults, this.$element.data(), options); 8481 8482 this._init(); 8483 Foundation.registerPlugin(this, 'Tabs'); 8484 Foundation.Keyboard.register('Tabs', { 8485 'ENTER': 'open', 8486 'SPACE': 'open',
8487 'ARROW_RIGHT': 'next', 8488 'ARROW_UP': 'previous', 8489 'ARROW_DOWN': 'next', 8490 'ARROW_LEFT': 'previous' 8491 // 'TAB': 'next', 8492 // 'SHIFT_TAB': 'previous' 8493 }); 8494 } 8495 8496 /** 8497 * Initializes the tabs by showing and focusing (if autoFocus=true) the preset active tab. 8498 * @private 8499 */ 8500 8501 8502 _createClass(Tabs, [{ 8503 key: '_init', 8504 value: function _init() { 8505 var _this = this; 8506 8507 this.$tabTitles = this.$element.find('.' + this.options.linkClass); 8508 this.$tabContent = $('[data-tabs-content="' + this.$element[0].id + '"]'); 8509 8510 this.$tabTitles.each(function () { 8511 var $elem = $(this), 8512 $link = $elem.find('a'), 8513 isActive = $elem.hasClass('is-active'), 8514 hash = $link[0].hash.slice(1), 8515 linkId = $link[0].id ? $link[0].id : hash + '-label', 8516 $tabContent = $('#' + hash); 8517 8518 $elem.attr({ 'role': 'presentation' }); 8519 8520 $link.attr({ 8521 'role': 'tab', 8522 'aria-controls': hash, 8523 'aria-selected': isActive, 8524 'id': linkId 8525 }); 8526 8527 $tabContent.attr({ 8528 'role': 'tabpanel', 8529 'aria-hidden': !isActive, 8530 'aria-labelledby': linkId 8531 }); 8532 8533 if (isActive && _this.options.autoFocus) { 8534 $link.focus(); 8535 } 8536 }); 8537 8538 if (this.options.matchHeight) { 8539 var $images = this.$tabContent.find('img'); 8540 8541 if ($images.length) { 8542 Foundation.onImagesLoaded($images, this._setHeight.bind(this)); 8543 } else { 8544 this._setHeight(); 8545 } 8546 } 8547 8548 this._events(); 8549 } 8550 8551 /** 8552 * Adds event handlers for items within the tabs. 8553 * @private 8554 */ 8555 8556 }, { 8557 key: '_events', 8558 value: function _events() { 8559 this._addKeyHandler(); 8560 this._addClickHandler(); 8561 this._setHeightMqHandler = null; 8562 8563 if (this.options.matchHeight) { 8564 this._setHeightMqHandler = this._setHeight.bind(this); 8565 8566 $(window).on('changed.zf.mediaquery', this._setHeightMqHandler); 8567 } 8568 } 8569 8570 /** 8571 * Adds click handlers for items within the tabs. 8572 * @private 8573 */ 8574 8575 }, { 8576 key: '_addClickHandler', 8577 value: function _addClickHandler() { 8578 var _this = this; 8579 8580 this.$element.off('click.zf.tabs').on('click.zf.tabs', '.' + this.options.linkClass, function (e) { 8581 e.preventDefault(); 8582 e.stopPropagation(); 8583 if ($(this).hasClass('is-active')) { 8584 return; 8585 } 8586 _this._handleTabChange($(this)); 8587 }); 8588 } 8589 8590 /** 8591 * Adds keyboard event handlers for items within the tabs. 8592 * @private 8593 */ 8594 8595 }, { 8596 key: '_addKeyHandler', 8597 value: function _addKeyHandler() { 8598 var _this = this; 8599 var $firstTab = _this.$element.find('li:first-of-type'); 8600 var $lastTab = _this.$element.find('li:last-of-type'); 8601 8602 this.$tabTitles.off('keydown.zf.tabs').on('keydown.zf.tabs', function (e) { 8603 if (e.which === 9) return; 8604 8605 var $element = $(this), 8606 $elements = $element.parent('ul').children('li'), 8607 $prevElement, 8608 $nextElement; 8609 8610 $elements.each(function (i) { 8611 if ($(this).is($element)) { 8612 if (_this.options.wrapOnKeys) { 8613 $prevElement = i === 0 ? $elements.last() : $elements.eq(i - 1); 8614 $nextElement = i === $elements.length - 1 ? $elements.first() : $elements.eq(i + 1); 8615 } else { 8616 $prevElement = $elements.eq(Math.max(0, i - 1)); 8617 $nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1)); 8618 } 8619 return; 8620 } 8621 }); 8622 8623 // handle keyboard event with keyboard util 8624 Foundation.Keyboard.handleKey(e, 'Tabs', { 8625 open: function () { 8626 $element.find('[role="tab"]').focus(); 8627 _this._handleTabChange($element); 8628 }, 8629 previous: function () { 8630 $prevElement.find('[role="tab"]').focus(); 8631 _this._handleTabChange($prevElement); 8632 }, 8633 next: function () { 8634 $nextElement.find('[role="tab"]').focus(); 8635 _this._handleTabChange($nextElement); 8636 }, 8637 handled: function () { 8638 e.stopPropagation(); 8639 e.preventDefault(); 8640 } 8641 }); 8642 }); 8643 } 8644 8645 /** 8646 * Opens the tab `$targetContent` defined by `$target`. 8647 * @param {jQuery} $target - Tab to open. 8648 * @fires Tabs#change 8649 * @function 8650 */ 8651 8652 }, {
8653 key: '_handleTabChange', 8654 value: function _handleTabChange($target) { 8655 var $tabLink = $target.find('[role="tab"]'), 8656 hash = $tabLink[0].hash, 8657 $targetContent = this.$tabContent.find(hash), 8658 $oldTab = this.$element.find('.' + this.options.linkClass + '.is-active').removeClass('is-active').find('[role="tab"]').attr({ 'aria-selected': 'false' }); 8659 8660 $('#' + $oldTab.attr('aria-controls')).removeClass('is-active').attr({ 'aria-hidden': 'true' }); 8661 8662 $target.addClass('is-active'); 8663 8664 $tabLink.attr({ 'aria-selected': 'true' }); 8665 8666 $targetContent.addClass('is-active').attr({ 'aria-hidden': 'false' }); 8667 8668 /** 8669 * Fires when the plugin has successfully changed tabs. 8670 * @event Tabs#change 8671 */ 8672 this.$element.trigger('change.zf.tabs', [$target]); 8673 } 8674 8675 /** 8676 * Public method for selecting a content pane to display. 8677 * @param {jQuery | String} elem - jQuery object or string of the id of the pane to display. 8678 * @function 8679 */ 8680 8681 }, { 8682 key: 'selectTab', 8683 value: function selectTab(elem) { 8684 var idStr; 8685 8686 if (typeof elem === 'object') { 8687 idStr = elem[0].id; 8688 } else { 8689 idStr = elem; 8690 } 8691 8692 if (idStr.indexOf('#') < 0) { 8693 idStr = '#' + idStr; 8694 } 8695 8696 var $target = this.$tabTitles.find('[href="' + idStr + '"]').parent('.' + this.options.linkClass); 8697 8698 this._handleTabChange($target); 8699 } 8700 }, { 8701 key: '_setHeight', 8702 8703 /** 8704 * Sets the height of each panel to the height of the tallest panel. 8705 * If enabled in options, gets called on media query change. 8706 * If loading content via external source, can be called directly or with _reflow. 8707 * @function 8708 * @private 8709 */ 8710 value: function _setHeight() { 8711 var max = 0; 8712 this.$tabContent.find('.' + this.options.panelClass).css('height', '').each(function () { 8713 var panel = $(this), 8714 isActive = panel.hasClass('is-active'); 8715 8716 if (!isActive) { 8717 panel.css({ 'visibility': 'hidden', 'display': 'block' }); 8718 } 8719 8720 var temp = this.getBoundingClientRect().height; 8721 8722 if (!isActive) { 8723 panel.css({ 8724 'visibility': '', 8725 'display': '' 8726 }); 8727 } 8728 8729 max = temp > max ? temp : max; 8730 }).css('height', max + 'px'); 8731 } 8732 8733 /** 8734 * Destroys an instance of an tabs. 8735 * @fires Tabs#destroyed 8736 */ 8737 8738 }, { 8739 key: 'destroy', 8740 value: function destroy() { 8741 this.$element.find('.' + this.options.linkClass).off('.zf.tabs').hide().end().find('.' + this.options.panelClass).hide(); 8742 8743 if (this.options.matchHeight) { 8744 if (this._setHeightMqHandler != null) { 8745 $(window).off('changed.zf.mediaquery', this._setHeightMqHandler); 8746 } 8747 } 8748 8749 Foundation.unregisterPlugin(this); 8750 } 8751 }]); 8752 8753 return Tabs; 8754 }(); 8755 8756 Tabs.defaults = { 8757 /** 8758 * Allows the window to scroll to content of active pane on load if set to true. 8759 * @option 8760 * @example false 8761 */ 8762 autoFocus: false, 8763 8764 /** 8765 * Allows keyboard input to 'wrap' around the tab links. 8766 * @option 8767 * @example true 8768 */ 8769 wrapOnKeys: true, 8770 8771 /** 8772 * Allows the tab content panes to match heights if set to true. 8773 * @option 8774 * @example false 8775 */ 8776 matchHeight: false, 8777 8778 /** 8779 * Class applied to `li`'s in tab link list. 8780 * @option 8781 * @example 'tabs-title' 8782 */ 8783 linkClass: 'tabs-title', 8784 8785 /** 8786 * Class applied to the content containers. 8787 * @option 8788 * @example 'tabs-panel' 8789 */ 8790 panelClass: 'tabs-panel' 8791 }; 8792 8793 function checkClass($elem) { 8794 return $elem.hasClass('is-active'); 8795 } 8796 8797 // Window exports 8798 Foundation.plugin(Tabs, 'Tabs'); 8799}(jQuery); 8800'use strict'; 8801 8802var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8803 8804function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8805 8806!function ($) { 8807 8808 /** 8809 * Toggler module. 8810 * @module foundation.toggler 8811 * @requires foundation.util.motion 8812 * @requires foundation.util.triggers 8813 */ 8814 8815 var Toggler = function () { 8816 /** 8817 * Creates a new instance of Toggler. 8818 * @class 8819 * @fires Toggler#init 8820 * @param {Object} element - jQuery object to add the trigger to. 8821 * @param {Object} options - Overrides to the default plugin settings. 8822 */ 8823 function Toggler(element, options) { 8824 _classCallCheck(this, Toggler); 8825 8826 this.$element = element; 8827 this.options = $.extend({}, Toggler.defaults, element.data(), options); 8828 this.className = ''; 8829 8830 this._init(); 8831 this._events(); 8832 8833 Foundation.registerPlugin(this, 'Toggler'); 8834 } 8835 8836 /** 8837 * Initializes the Toggler plugin by parsing the toggle class from data-toggler, or animation classes from data-animate. 8838 * @function 8839 * @private 8840 */ 8841 8842 8843 _createClass(Toggler, [{ 8844 key: '_init', 8845 value: function _init() { 8846 var input; 8847 // Parse animation classes if they were set 8848 if (this.options.animate) { 8849 input = this.options.animate.split(' '); 8850 8851 this.animationIn = input[0]; 8852 this.animationOut = input[1] || null; 8853 } 8854 // Otherwise, parse toggle class 8855 else { 8856 input = this.$element.data('toggler'); 8857 // Allow for a . at the beginning of the string 8858 this.className = input[0] === '.' ? input.slice(1) : input; 8859 } 8860 8861 // Add ARIA attributes to triggers 8862 var id = this.$element[0].id; 8863 $('[data-open="' + id + '"], [data-close="' + id + '"], [data-toggle="' + id + '"]').attr('aria-controls', id); 8864 // If the target is hidden, add aria-hidden 8865 this.$element.attr('aria-expanded', this.$element.is(':hidden') ? false : true); 8866 } 8867 8868 /** 8869 * Initializes events for the toggle trigger. 8870 * @function 8871 * @private 8872 */ 8873 8874 }, {
8875 key: '_events', 8876 value: function _events() { 8877 this.$element.off('toggle.zf.trigger').on('toggle.zf.trigger', this.toggle.bind(this)); 8878 } 8879 8880 /** 8881 * Toggles the target class on the target element. An event is fired from the original trigger depending on if the resultant state was "on" or "off". 8882 * @function 8883 * @fires Toggler#on 8884 * @fires Toggler#off 8885 */ 8886 8887 }, { 8888 key: 'toggle', 8889 value: function toggle() { 8890 this[this.options.animate ? '_toggleAnimate' : '_toggleClass'](); 8891 } 8892 }, { 8893 key: '_toggleClass', 8894 value: function _toggleClass() { 8895 this.$element.toggleClass(this.className); 8896 8897 var isOn = this.$element.hasClass(this.className); 8898 if (isOn) { 8899 /** 8900 * Fires if the target element has the class after a toggle. 8901 * @event Toggler#on 8902 */ 8903 this.$element.trigger('on.zf.toggler'); 8904 } else { 8905 /** 8906 * Fires if the target element does not have the class after a toggle. 8907 * @event Toggler#off 8908 */ 8909 this.$element.trigger('off.zf.toggler'); 8910 } 8911 8912 this._updateARIA(isOn); 8913 } 8914 }, { 8915 key: '_toggleAnimate', 8916 value: function _toggleAnimate() { 8917 var _this = this; 8918 8919 if (this.$element.is(':hidden')) { 8920 Foundation.Motion.animateIn(this.$element, this.animationIn, function () { 8921 _this._updateARIA(true); 8922 this.trigger('on.zf.toggler'); 8923 }); 8924 } else { 8925 Foundation.Motion.animateOut(this.$element, this.animationOut, function () { 8926 _this._updateARIA(false); 8927 this.trigger('off.zf.toggler'); 8928 }); 8929 } 8930 } 8931 }, { 8932 key: '_updateARIA', 8933 value: function _updateARIA(isOn) { 8934 this.$element.attr('aria-expanded', isOn ? true : false); 8935 } 8936 8937 /** 8938 * Destroys the instance of Toggler on the element. 8939 * @function 8940 */ 8941 8942 }, { 8943 key: 'destroy', 8944 value: function destroy() { 8945 this.$element.off('.zf.toggler'); 8946 Foundation.unregisterPlugin(this); 8947 } 8948 }]); 8949 8950 return Toggler; 8951 }(); 8952 8953 Toggler.defaults = { 8954 /** 8955 * Tells the plugin if the element should animated when toggled. 8956 * @option 8957 * @example false 8958 */ 8959 animate: false 8960 }; 8961 8962 // Window exports 8963 Foundation.plugin(Toggler, 'Toggler'); 8964}(jQuery); 8965'use strict'; 8966 8967var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8968 8969function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8970 8971!function ($) { 8972 8973 /** 8974 * Tooltip module. 8975 * @module foundation.tooltip 8976 * @requires foundation.util.box 8977 * @requires foundation.util.mediaQuery 8978 * @requires foundation.util.triggers 8979 */ 8980 8981 var Tooltip = function () { 8982 /** 8983 * Creates a new instance of a Tooltip. 8984 * @class 8985 * @fires Tooltip#init 8986 * @param {jQuery} element - jQuery object to attach a tooltip to. 8987 * @param {Object} options - object to extend the default configuration. 8988 */ 8989 function Tooltip(element, options) { 8990 _classCallCheck(this, Tooltip); 8991 8992 this.$element = element; 8993 this.options = $.extend({}, Tooltip.defaults, this.$element.data(), options); 8994 8995 this.isActive = false; 8996 this.isClick = false; 8997 this._init(); 8998 8999 Foundation.registerPlugin(this, 'Tooltip'); 9000 } 9001 9002 /** 9003 * Initializes the tooltip by setting the creating the tip element, adding it's text, setting private variables and setting attributes on the anch
9003or. 9004 * @private 9005 */ 9006 9007 9008 _createClass(Tooltip, [{ 9009 key: '_init', 9010 value: function _init() { 9011 var elemId = this.$element.attr('aria-describedby') || Foundation.GetYoDigits(6, 'tooltip'); 9012 9013 this.options.positionClass = this.options.positionClass || this._getPositionClass(this.$element); 9014 this.options.tipText = this.options.tipText || this.$element.attr('title'); 9015 this.template = this.options.template ? $(this.options.template) : this._buildTemplate(elemId); 9016 9017 this.template.appendTo(document.body).text(this.options.tipText).hide(); 9018 9019 this.$element.attr({ 9020 'title': '', 9021 'aria-describedby': elemId, 9022 'data-yeti-box': elemId, 9023 'data-toggle': elemId, 9024 'data-resize': elemId 9025 }).addClass(this.options.triggerClass); 9026 9027 //helper variables to track movement on collisions 9028 this.usedPositions = []; 9029 this.counter = 4; 9030 this.classChanged = false; 9031 9032 this._events(); 9033 } 9034 9035 /** 9036 * Grabs the current positioning class, if present, and returns the value or an empty string. 9037 * @private 9038 */ 9039 9040 }, { 9041 key: '_getPositionClass', 9042 value: function _getPositionClass(element) { 9043 if (!element) { 9044 return ''; 9045 } 9046 // var position = element.attr('class').match(/top|left|right/g); 9047 var position = element[0].className.match(/\b(top|left|right)\b/g); 9048 position = position ? position[0] : ''; 9049 return position; 9050 } 9051 }, { 9052 key: '_buildTemplate', 9053 9054 /** 9055 * builds the tooltip element, adds attributes, and returns the template. 9056 * @private 9057 */ 9058 value: function _buildTemplate(id) { 9059 var templateClasses = (this.options.tooltipClass + ' ' + this.options.positionClass + ' ' + this.options.templateClasses).trim(); 9060 var $template = $('<div></div>').addClass(templateClasses).attr({ 9061 'role': 'tooltip', 9062 'aria-hidden': true, 9063 'data-is-active': false, 9064 'data-is-focus': false, 9065 'id': id 9066 }); 9067 return $template; 9068 } 9069 9070 /** 9071 * Function that gets called if a collision event is detected. 9072 * @param {String} position - positioning class to try 9073 * @private 9074 */ 9075 9076 }, { 9077 key: '_reposition', 9078 value: function _reposition(position) { 9079 this.usedPositions.push(position ? position : 'bottom'); 9080 9081 //default, try switching to opposite side 9082 if (!position && this.usedPositions.indexOf('top') < 0) { 9083 this.template.addClass('top'); 9084 } else if (position === 'top' && this.usedPositions.indexOf('bottom') < 0) { 9085 this.template.removeClass(position); 9086 } else if (position === 'left' && this.usedPositions.indexOf('right') < 0) { 9087 this.template.removeClass(position).addClass('right'); 9088 } else if (position === 'right' && this.usedPositions.indexOf('left') < 0) { 9089 this.template.removeClass(position).addClass('left'); 9090 } 9091 9092 //if default change didn't work, try bottom or left first 9093 else if (!position && this.usedPositions.indexOf('top') > -1 && this.usedPositions.indexOf('left') < 0) { 9094 this.template.addClass('left'); 9095 } else if (position === 'top' && this.usedPositions.indexOf('bottom') > -1 && this.usedPositions.indexOf('left') < 0) { 9096 this.template.removeClass(position).addClass('left'); 9097 } else if (position === 'left' && this.usedPositions.indexOf('right') > -1 && this.usedPositions.indexOf('bottom') < 0) { 9098 this.template.removeClass(position); 9099 } else if (position === 'right' && this.usedPositions.indexOf('left') > -1 && this.usedPositions.indexOf('bottom') < 0) { 9100 this.template.removeClass(position); 9101 } 9102 //if nothing cleared, set to bottom 9103 else { 9104 this.template.removeClass(position); 9105 } 9106 this.classChanged = true; 9107 this.counter--; 9108 } 9109 9110 /** 9111 * sets the position class of an element and recursively calls itself until there are no more possible positions to attempt, or the tooltip element is no longer colliding. 9112 * if the tooltip is larger than the screen width, default to full width - any user selected margin 9113 * @private 9114 */ 9115 9116 }, {
9117 key: '_setPosition', 9118 value: function _setPosition() { 9119 var position = this._getPositionClass(this.template), 9120 $tipDims = Foundation.Box.GetDimensions(this.template), 9121 $anchorDims = Foundation.Box.GetDimensions(this.$element), 9122 direction = position === 'left' ? 'left' : position === 'right' ? 'left' : 'top', 9123 param = direction === 'top' ? 'height' : 'width', 9124 offset = param === 'height' ? this.options.vOffset : this.options.hOffset, 9125 _this = this; 9126 9127 if ($tipDims.width >= $tipDims.windowDims.width || !this.counter && !Foundation.Box.ImNotTouchingYou(this.template)) { 9128 this.template.offset(Foundation.Box.GetOffsets(this.template, this.$element, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({ 9129 // this.$element.offset(Foundation.GetOffsets(this.template, this.$element, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({ 9130 'width': $anchorDims.windowDims.width - this.options.hOffset * 2, 9131 'height': 'auto' 9132 }); 9133 return false; 9134 } 9135 9136 this.template.offset(Foundation.Box.GetOffsets(this.template, this.$element, 'center ' + (position || 'bottom'), this.options.vOffset, this.options.hOffset)); 9137 9138 while (!Foundation.Box.ImNotTouchingYou(this.template) && this.counter) { 9139 this._reposition(position); 9140 this._setPosition(); 9141 } 9142 } 9143 9144 /** 9145 * reveals the tooltip, and fires an event to close any other open tooltips on the page 9146 * @fires Tooltip#closeme 9147 * @fires Tooltip#show 9148 * @function 9149 */ 9150 9151 }, { 9152 key: 'show', 9153 value: function show() { 9154 if (this.options.showOn !== 'all' && !Foundation.MediaQuery.atLeast(this.options.showOn)) { 9155 // console.error('The screen is too small to display this tooltip'); 9156 return false; 9157 } 9158 9159 var _this = this; 9160 this.template.css('visibility', 'hidden').show(); 9161 this._setPosition(); 9162 9163 /** 9164 * Fires to close all other open tooltips on the page 9165 * @event Closeme#tooltip 9166 */ 9167 this.$element.trigger('closeme.zf.tooltip', this.template.attr('id')); 9168 9169 this.template.attr({ 9170 'data-is-active': true, 9171 'aria-hidden': false 9172 }); 9173 _this.isActive = true; 9174 // console.log(this.template); 9175 this.template.stop().hide().css('visibility', '').fadeIn(this.options.fadeInDuration, function () { 9176 //maybe do stuff? 9177 }); 9178 /** 9179 * Fires when the tooltip is shown 9180 * @event Tooltip#show 9181 */ 9182 this.$element.trigger('show.zf.tooltip'); 9183 } 9184 9185 /** 9186 * Hides the current tooltip, and resets the positioning class if it was changed due to collision 9187 * @fires Tooltip#hide 9188 * @function 9189 */ 9190 9191 }, { 9192 key: 'hide', 9193 value: function hide() { 9194 // console.log('hiding', this.$element.data('yeti-box')); 9195 var _this = this; 9196 this.template.stop().attr({ 9197 'aria-hidden': true, 9198 'data-is-active': false 9199 }).fadeOut(this.options.fadeOutDuration, function () { 9200 _this.isActive = false; 9201 _this.isClick = false; 9202 if (_this.classChanged) { 9203 _this.template.removeClass(_this._getPositionClass(_this.template)).addClass(_this.options.positionClass); 9204 9205 _this.usedPositions = []; 9206 _this.counter = 4; 9207 _this.classChanged = false; 9208 } 9209 }); 9210 /** 9211 * fires when the tooltip is hidden 9212 * @event Tooltip#hide 9213 */ 9214 this.$element.trigger('hide.zf.tooltip'); 9215 } 9216 9217 /** 9218 * adds event listeners for the tooltip and its anchor
9219 * TODO combine some of the listeners like focus and mouseenter, etc. 9220 * @private 9221 */ 9222 9223 }, { 9224 key: '_events', 9225 value: function _events() { 9226 var _this = this; 9227 var $template = this.template; 9228 var isFocus = false; 9229 9230 if (!this.options.disableHover) { 9231 9232 this.$element.on('mouseenter.zf.tooltip', function (e) { 9233 if (!_this.isActive) { 9234 _this.timeout = setTimeout(function () { 9235 _this.show(); 9236 }, _this.options.hoverDelay); 9237 } 9238 }).on('mouseleave.zf.tooltip', function (e) { 9239 clearTimeout(_this.timeout); 9240 if (!isFocus || _this.isClick && !_this.options.clickOpen) { 9241 _this.hide(); 9242 } 9243 }); 9244 } 9245 9246 if (this.options.clickOpen) { 9247 this.$element.on('mousedown.zf.tooltip', function (e) { 9248 e.stopImmediatePropagation(); 9249 if (_this.isClick) { 9250 //_this.hide(); 9251 // _this.isClick = false; 9252 } else { 9253 _this.isClick = true; 9254 if ((_this.options.disableHover || !_this.$element.attr('tabindex')) && !_this.isActive) { 9255 _this.show(); 9256 } 9257 } 9258 }); 9259 } else { 9260 this.$element.on('mousedown.zf.tooltip', function (e) { 9261 e.stopImmediatePropagation(); 9262 _this.isClick = true; 9263 }); 9264 } 9265 9266 if (!this.options.disableForTouch) { 9267 this.$element.on('tap.zf.tooltip touchend.zf.tooltip', function (e) { 9268 _this.isActive ? _this.hide() : _this.show(); 9269 }); 9270 } 9271 9272 this.$element.on({ 9273 // 'toggle.zf.trigger': this.toggle.bind(this), 9274 // 'close.zf.trigger': this.hide.bind(this) 9275 'close.zf.trigger': this.hide.bind(this) 9276 }); 9277 9278 this.$element.on('focus.zf.tooltip', function (e) { 9279 isFocus = true; 9280 if (_this.isClick) { 9281 // If we're not showing open on clicks, we need to pretend a click-launched focus isn't 9282 // a real focus, otherwise on hover and come back we get bad behavior 9283 if (!_this.options.clickOpen) { 9284 isFocus = false; 9285 } 9286 return false; 9287 } else { 9288 _this.show(); 9289 } 9290 }).on('focusout.zf.tooltip', function (e) { 9291 isFocus = false; 9292 _this.isClick = false; 9293 _this.hide(); 9294 }).on('resizeme.zf.trigger', function () { 9295 if (_this.isActive) { 9296 _this._setPosition(); 9297 } 9298 }); 9299 } 9300 9301 /** 9302 * adds a toggle method, in addition to the static show() & hide() functions 9303 * @function 9304 */ 9305 9306 }, { 9307 key: 'toggle', 9308 value: function toggle() { 9309 if (this.isActive) { 9310 this.hide(); 9311 } else { 9312 this.show(); 9313 } 9314 } 9315 9316 /** 9317 * Destroys an instance of tooltip, removes template element from the view. 9318 * @function 9319 */ 9320 9321 }, { 9322 key: 'destroy', 9323 value: function destroy() { 9324 this.$element.attr('title', this.template.text()).off('.zf.trigger .zf.tootip') 9325 // .removeClass('has-tip') 9326 .removeAttr('aria-describedby').removeAttr('data-yeti-box').removeAttr('data-toggle').removeAttr('data-resize'); 9327 9328 this.template.remove(); 9329 9330 Foundation.unregisterPlugin(this); 9331 } 9332 }]); 9333 9334 return Tooltip; 9335 }(); 9336 9337 Tooltip.defaults = { 9338 disableForTouch: false, 9339 /** 9340 * Time, in ms, before a tooltip should open on hover. 9341 * @option 9342 * @example 200 9343 */ 9344 hoverDelay: 200, 9345 /** 9346 * Time, in ms, a tooltip should take to fade into view. 9347 * @option 9348 * @example 150 9349 */ 9350 fadeInDuration: 150, 9351 /** 9352 * Time, in ms, a tooltip should take to fade out of view. 9353 * @option 9354 * @example 150 9355 */ 9356 fadeOutDuration: 150, 9357 /** 9358 * Disables hover events from opening the tooltip if set to true 9359 * @option 9360 * @example false 9361 */ 9362 disableHover: false, 9363 /** 9364 * Optional addtional classes to apply to the tooltip template on init. 9365 * @option
9366 * @example 'my-cool-tip-class' 9367 */ 9368 templateClasses: '', 9369 /** 9370 * Non-optional class added to tooltip templates. Foundation default is 'tooltip'. 9371 * @option 9372 * @example 'tooltip' 9373 */ 9374 tooltipClass: 'tooltip', 9375 /** 9376 * Class applied to the tooltip anchor element. 9377 * @option 9378 * @example 'has-tip' 9379 */ 9380 triggerClass: 'has-tip', 9381 /** 9382 * Minimum breakpoint size at which to open the tooltip. 9383 * @option 9384 * @example 'small' 9385 */ 9386 showOn: 'small', 9387 /** 9388 * Custom template to be used to generate markup for tooltip. 9389 * @option 9390 * @example '<div class="tooltip"></div>' 9391 */ 9392 template: '', 9393 /** 9394 * Text displayed in the tooltip template on open. 9395 * @option 9396 * @example 'Some cool space fact here.' 9397 */ 9398 tipText: '', 9399 touchCloseText: 'Tap to close.', 9400 /** 9401 * Allows the tooltip to remain open if triggered with a click or touch event. 9402 * @option 9403 * @example true 9404 */ 9405 clickOpen: true, 9406 /** 9407 * Additional positioning classes, set by the JS 9408 * @option 9409 * @example 'top' 9410 */ 9411 positionClass: '', 9412 /** 9413 * Distance, in pixels, the template should push away from the anch
9413or on the Y axis. 9414 * @option 9415 * @example 10 9416 */ 9417 vOffset: 10, 9418 /** 9419 * Distance, in pixels, the template should push away from the anchor on the X axis, if aligned to a side. 9420 * @option 9421 * @example 12 9422 */ 9423 hOffset: 12 9424 }; 9425 9426 /** 9427 * TODO utilize resize event trigger 9428 */ 9429 9430 // Window exports 9431 Foundation.plugin(Tooltip, 'Tooltip'); 9432}(jQuery); 9433},{}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars.js":[function(require,module,exports){ 9434'use strict'; 9435 9436exports.__esModule = true; 9437// istanbul ignore next 9438 9439function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 9440 9441var _handlebarsRuntime = require('./handlebars.runtime'); 9442 9443var _handlebarsRuntime2 = _interopRequireDefault(_handlebarsRuntime); 9444 9445// Compiler imports 9446 9447var _handlebarsCompilerAst = require('./handlebars/compiler/ast'); 9448 9449var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst); 9450 9451var _handlebarsCompilerBase = require('./handlebars/compiler/base'); 9452 9453var _handlebarsCompilerCompiler = require('./handlebars/compiler/compiler'); 9454 9455var _handlebarsCompilerJavascriptCompiler = require('./handlebars/compiler/javascript-compiler'); 9456 9457var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler); 9458 9459var _handlebarsCompilerVisitor = require('./handlebars/compiler/visitor'); 9460 9461var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor); 9462 9463var _handlebarsNoConflict = require('./handlebars/no-conflict'); 9464 9465var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 9466 9467var _create = _handlebarsRuntime2['default'].create; 9468function create() { 9469 var hb = _create(); 9470 9471 hb.compile = function (input, options) { 9472 return _handlebarsCompilerCompiler.compile(input, options, hb); 9473 }; 9474 hb.precompile = function (input, options) { 9475 return _handlebarsCompilerCompiler.precompile(input, options, hb); 9476 }; 9477 9478 hb.AST = _handlebarsCompilerAst2['default']; 9479 hb.Compiler = _handlebarsCompilerCompiler.Compiler; 9480 hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default']; 9481 hb.Parser = _handlebarsCompilerBase.parser; 9482 hb.parse = _handlebarsCompilerBase.parse; 9483 9484 return hb; 9485} 9486 9487var inst = create(); 9488inst.create = create; 9489 9490_handlebarsNoConflict2['default'](inst); 9491 9492inst.Visitor = _handlebarsCompilerVisitor2['default']; 9493 9494inst['default'] = inst; 9495 9496exports['default'] = inst; 9497module.exports = exports['default']; 9498 9499 9500},{"./handlebars.runtime":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars.runtime.js","./handlebars/compiler/ast":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/ast.js","./handlebars/compiler/base":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/base.js","./handlebars/compiler/compiler":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js","./handlebars/compiler/javascript-compiler":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js","./handlebars/compiler/visitor":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/visitor.js","./handlebars/no-conflict":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/no-conflict.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars.runtime.js":[function(require,module,exports){ 9501'use strict'; 9502 9503exports.__esModule = true; 9504// istanbul ignore next 9505 9506function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 9507 9508// istanbul ignore next 9509 9510function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } 9511 9512var _handlebarsBase = require('./handlebars/base'); 9513 9514var base = _interopRequireWildcard(_handlebarsBase); 9515 9516// Each of these augment the Handlebars object. No need to setup here. 9517// (This is done to easily share code between commonjs and browse envs) 9518 9519var _handlebarsSafeString = require('./handlebars/safe-string'); 9520 9521var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); 9522 9523var _handlebarsException = require('./handlebars/exception'); 9524 9525var _handlebarsException2 = _interopRequireDefault(_handlebarsException); 9526 9527var _handlebarsUtils = require('./handlebars/utils'); 9528 9529var Utils = _interopRequireWildcard(_handlebarsUtils); 9530 9531var _handlebarsRuntime = require('./handlebars/runtime'); 9532 9533var runtime = _interopRequireWildcard(_handlebarsRuntime); 9534 9535var _handlebarsNoConflict = require('./handlebars/no-conflict'); 9536 9537var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 9538 9539// For compatibility and usage outside of module systems, make the Handlebars object a namespace 9540function create() { 9541 var hb = new base.HandlebarsEnvironment(); 9542 9543 Utils.extend(hb, base); 9544 hb.SafeString = _handlebarsSafeString2['default']; 9545 hb.Exception = _handlebarsException2['default']; 9546 hb.Utils = Utils; 9547 hb.escapeExpression = Utils.escapeExpression; 9548 9549 hb.VM = runtime; 9550 hb.template = function (spec) { 9551 return runtime.template(spec, hb); 9552 }; 9553 9554 return hb; 9555} 9556 9557var inst = create(); 9558inst.create = create; 9559 9560_handlebarsNoConflict2['default'](inst); 9561 9562inst['default'] = inst; 9563 9564exports['default'] = inst; 9565module.exports = exports['default']; 9566 9567 9568},{"./handlebars/base":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/base.js","./handlebars/exception":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/exception.js","./handlebars/no-conflict":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/no-conflict.js","./handlebars/runtime":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/runtime.js","./handlebars/safe-string":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/safe-string.js","./handlebars/utils":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/utils.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/base.js":[function(require,module,exports){ 9569'use strict'; 9570 9571exports.__esModule = true; 9572exports.HandlebarsEnvironment = HandlebarsEnvironment; 9573// istanbul ignore next 9574 9575function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 9576 9577var _utils = require('./utils'); 9578 9579var _exception = require('./exception'); 9580 9581var _exception2 = _interopRequireDefault(_exception); 9582 9583var _helpers = require('./helpers'); 9584 9585var _decorators = require('./decorators'); 9586 9587var _logger = require('./logger'); 9588 9589var _logger2 = _interopRequireDefault(_logger); 9590 9591var VERSION = '4.0.11'; 9592exports.VERSION = VERSION; 9593var COMPILER_REVISION = 7; 9594 9595exports.COMPILER_REVISION = COMPILER_REVISION; 9596var REVISION_CHANGES = { 9597 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 9598 2: '== 1.0.0-rc.3', 9599 3: '== 1.0.0-rc.4', 9600 4: '== 1.x.x', 9601 5: '== 2.0.0-alpha.x', 9602 6: '>
9602= 2.0.0-beta.1', 9603 7: '>= 4.0.0' 9604}; 9605 9606exports.REVISION_CHANGES = REVISION_CHANGES; 9607var objectType = '[object Object]'; 9608 9609function HandlebarsEnvironment(helpers, partials, decorators) { 9610 this.helpers = helpers || {}; 9611 this.partials = partials || {}; 9612 this.decorators = decorators || {}; 9613 9614 _helpers.registerDefaultHelpers(this); 9615 _decorators.registerDefaultDecorators(this); 9616} 9617 9618HandlebarsEnvironment.prototype = { 9619 constructor: HandlebarsEnvironment, 9620 9621 logger: _logger2['default'], 9622 log: _logger2['default'].log, 9623 9624 registerHelper: function registerHelper(name, fn) { 9625 if (_utils.toString.call(name) === objectType) { 9626 if (fn) { 9627 throw new _exception2['default']('Arg not supported with multiple helpers'); 9628 } 9629 _utils.extend(this.helpers, name); 9630 } else { 9631 this.helpers[name] = fn; 9632 } 9633 }, 9634 unregisterHelper: function unregisterHelper(name) { 9635 delete this.helpers[name]; 9636 }, 9637 9638 registerPartial: function registerPartial(name, partial) { 9639 if (_utils.toString.call(name) === objectType) { 9640 _utils.extend(this.partials, name); 9641 } else { 9642 if (typeof partial === 'undefined') { 9643 throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); 9644 } 9645 this.partials[name] = partial; 9646 } 9647 }, 9648 unregisterPartial: function unregisterPartial(name) { 9649 delete this.partials[name]; 9650 }, 9651 9652 registerDecorator: function registerDecorator(name, fn) { 9653 if (_utils.toString.call(name) === objectType) { 9654 if (fn) { 9655 throw new _exception2['default']('Arg not supported with multiple decorators'); 9656 } 9657 _utils.extend(this.decorators, name); 9658 } else { 9659 this.decorators[name] = fn; 9660 } 9661 }, 9662 unregisterDecorator: function unregisterDecorator(name) { 9663 delete this.decorators[name]; 9664 } 9665}; 9666 9667var log = _logger2['default'].log; 9668 9669exports.log = log; 9670exports.createFrame = _utils.createFrame; 9671exports.logger = _logger2['default']; 9672 9673 9674},{"./decorators":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/decorators.js","./exception":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/exception.js","./helpers":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers.js","./logger":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/logger.js","./utils":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/utils.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/ast.js":[function(require,module,exports){ 9675'use strict'; 9676 9677exports.__esModule = true; 9678var AST = { 9679 // Public API used to evaluate derived attributes regarding AST nodes 9680 helpers: { 9681 // a mustache is definitely a helper if: 9682 // * it is an eligible helper, and 9683 // * it has at least one parameter or hash segment 9684 helperExpression: function helperExpression(node) { 9685 return node.type === 'SubExpression' || (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && !!(node.params && node.params.length || node.hash); 9686 }, 9687 9688 scopedId: function scopedId(path) { 9689 return (/^\.|this\b/.test(path.original) 9690 ); 9691 }, 9692 9693 // an ID is simple if it only has one part, and that part is not 9694 // `..` or `this`. 9695 simpleId: function simpleId(path) { 9696 return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth; 9697 } 9698 } 9699}; 9700 9701// Must be exported as an object rather than the root of the module as the jison lexer 9702// must modify the object to operate properly. 9703exports['default'] = AST; 9704module.exports = exports['default']; 9705 9706 9707},{}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/base.js":[function(require,module,exports){ 9708'use strict'; 9709 9710exports.__esModule = true; 9711exports.parse = parse; 9712// istanbul ignore next 9713 9714function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } 9715 9716// istanbul ignore next 9717 9718function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 9719 9720var _parser = require('./parser'); 9721 9722var _parser2 = _interopRequireDefault(_parser); 9723 9724var _whitespaceControl = require('./whitespace-control'); 9725 9726var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl); 9727 9728var _helpers = require('./helpers'); 9729 9730var Helpers = _interopRequireWildcard(_helpers); 9731 9732var _utils = require('../utils'); 9733 9734exports.parser = _parser2['default']; 9735 9736var yy = {}; 9737_utils.extend(yy, Helpers); 9738 9739function parse(input, options) { 9740 // Just return if an already-compiled AST was passed in. 9741 if (input.type === 'Program') { 9742 return input; 9743 } 9744 9745 _parser2['default'].yy = yy; 9746 9747 // Altering the shared object here, but this is ok as parser is a sync operation 9748 yy.locInfo = function (locInfo) { 9749 return new yy.SourceLocation(options && options.srcName, locInfo); 9750 }; 9751 9752 var strip = new _whitespaceControl2['default'](options); 9753 return strip.accept(_parser2['default'].parse(input)); 9754} 9755 9756 9757},{"../utils":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/utils.js","./helpers":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/helpers.js","./parser":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js","./whitespace-control":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/whitespace-control.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/code-gen.js":[function(require,module,exports){ 9758/* global define */ 9759'use strict'; 9760 9761exports.__esModule = true; 9762 9763var _utils = require('../utils'); 9764 9765var SourceNode = undefined; 9766 9767try { 9768 /* istanbul ignore next */ 9769 if (typeof define !== 'function' || !define.amd) { 9770 // We don't support this in AMD environments. For these environments, we asusme that 9771 // they are running on the browser and thus have no need for the source-map library. 9772 var SourceMap = require('source-map'); 9773 SourceNode = SourceMap.SourceNode;
vendor: 5,157 bytes, lines 9774-9963
9774 } 9775} catch (err) {} 9776/* NOP */ 9777 9778/* istanbul ignore if: tested but not covered in istanbul due to dist build */ 9779if (!SourceNode) { 9780 SourceNode = function (line, column, srcFile, chunks) { 9781 this.src = ''; 9782 if (chunks) { 9783 this.add(chunks); 9784 } 9785 }; 9786 /* istanbul ignore next */ 9787 SourceNode.prototype = { 9788 add: function add(chunks) { 9789 if (_utils.isArray(chunks)) { 9790 chunks = chunks.join(''); 9791 } 9792 this.src += chunks; 9793 }, 9794 prepend: function prepend(chunks) { 9795 if (_utils.isArray(chunks)) { 9796 chunks = chunks.join(''); 9797 } 9798 this.src = chunks + this.src; 9799 }, 9800 toStringWithSourceMap: function toStringWithSourceMap() { 9801 return { code: this.toString() }; 9802 }, 9803 toString: function toString() { 9804 return this.src; 9805 } 9806 }; 9807} 9808 9809function castChunk(chunk, codeGen, loc) { 9810 if (_utils.isArray(chunk)) { 9811 var ret = []; 9812 9813 for (var i = 0, len = chunk.length; i < len; i++) { 9814 ret.push(codeGen.wrap(chunk[i], loc)); 9815 } 9816 return ret; 9817 } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { 9818 // Handle primitives that the SourceNode will throw up on 9819 return chunk + ''; 9820 } 9821 return chunk; 9822} 9823 9824function CodeGen(srcFile) { 9825 this.srcFile = srcFile; 9826 this.source = []; 9827} 9828 9829CodeGen.prototype = { 9830 isEmpty: function isEmpty() { 9831 return !this.source.length; 9832 }, 9833 prepend: function prepend(source, loc) { 9834 this.source.unshift(this.wrap(source, loc)); 9835 }, 9836 push: function push(source, loc) { 9837 this.source.push(this.wrap(source, loc)); 9838 }, 9839 9840 merge: function merge() { 9841 var source = this.empty(); 9842 this.each(function (line) { 9843 source.add([' ', line, '\n']); 9844 }); 9845 return source; 9846 }, 9847 9848 each: function each(iter) { 9849 for (var i = 0, len = this.source.length; i < len; i++) { 9850 iter(this.source[i]); 9851 } 9852 }, 9853 9854 empty: function empty() { 9855 var loc = this.currentLocation || { start: {} }; 9856 return new SourceNode(loc.start.line, loc.start.column, this.srcFile); 9857 }, 9858 wrap: function wrap(chunk) { 9859 var loc = arguments.length <= 1 || arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1]; 9860 9861 if (chunk instanceof SourceNode) { 9862 return chunk; 9863 } 9864 9865 chunk = castChunk(chunk, this, loc); 9866 9867 return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); 9868 }, 9869 9870 functionCall: function functionCall(fn, type, params) { 9871 params = this.generateList(params); 9872 return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); 9873 }, 9874 9875 quotedString: function quotedString(str) { 9876 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 9877 .replace(/\u2029/g, '\\u2029') + '"'; 9878 }, 9879 9880 objectLiteral: function objectLiteral(obj) { 9881 var pairs = []; 9882 9883 for (var key in obj) { 9884 if (obj.hasOwnProperty(key)) { 9885 var value = castChunk(obj[key], this); 9886 if (value !== 'undefined') { 9887 pairs.push([this.quotedString(key), ':', value]); 9888 } 9889 } 9890 } 9891 9892 var ret = this.generateList(pairs); 9893 ret.prepend('{'); 9894 ret.add('}'); 9895 return ret; 9896 }, 9897 9898 generateList: function generateList(entries) { 9899 var ret = this.empty(); 9900 9901 for (var i = 0, len = entries.length; i < len; i++) { 9902 if (i) { 9903 ret.add(','); 9904 } 9905 9906 ret.add(castChunk(entries[i], this)); 9907 } 9908 9909 return ret; 9910 }, 9911 9912 generateArray: function generateArray(entries) { 9913 var ret = this.generateList(entries); 9914 ret.prepend('['); 9915 ret.add(']'); 9916 9917 return ret; 9918 } 9919}; 9920 9921exports['default'] = CodeGen; 9922module.exports = exports['default']; 9923 9924 9925},{"../utils":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/utils.js","source-map":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js":[function(require,module,exports){ 9926/* eslint-disable new-cap */ 9927 9928'use strict'; 9929 9930exports.__esModule = true; 9931exports.Compiler = Compiler; 9932exports.precompile = precompile; 9933exports.compile = compile; 9934// istanbul ignore next 9935 9936function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 9937 9938var _exception = require('../exception'); 9939 9940var _exception2 = _interopRequireDefault(_exception); 9941 9942var _utils = require('../utils'); 9943 9944var _ast = require('./ast'); 9945 9946var _ast2 = _interopRequireDefault(_ast); 9947 9948var slice = [].slice; 9949 9950function Compiler() {} 9951 9952// the foundHelper register will disambiguate helper lookup from finding a 9953// function in a context. This is necessary for mustache compatibility, which 9954// requires that context functions in blocks are evaluated by blockHelperMissing, 9955// and then proceed as if the resulting value was provided to blockHelperMissing. 9956 9957Compiler.prototype = { 9958 compiler: Compiler, 9959 9960 equals: function equals(other) { 9961 var len = this.opcodes.length; 9962 if (other.opcodes.length !== len) { 9963 return false;
9964 } 9965 9966 for (var i = 0; i < len; i++) { 9967 var opcode = this.opcodes[i], 9968 otherOpcode = other.opcodes[i]; 9969 if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) { 9970 return false; 9971 } 9972 } 9973 9974 // We know that length is the same between the two arrays because they are directly tied 9975 // to the opcode behavior above. 9976 len = this.children.length; 9977 for (var i = 0; i < len; i++) { 9978 if (!this.children[i].equals(other.children[i])) { 9979 return false; 9980 } 9981 } 9982 9983 return true; 9984 }, 9985 9986 guid: 0, 9987 9988 compile: function compile(program, options) { 9989 this.sourceNode = []; 9990 this.opcodes = []; 9991 this.children = []; 9992 this.options = options; 9993 this.stringParams = options.stringParams; 9994 this.trackIds = options.trackIds; 9995 9996 options.blockParams = options.blockParams || []; 9997 9998 // These changes will propagate to the other compiler components 9999 var knownHelpers = options.knownHelpers; 10000 options.knownHelpers = { 10001 'helperMissing': true, 10002 'blockHelperMissing': true, 10003 'each': true, 10004 'if': true, 10005 'unless': true, 10006 'with': true, 10007 'log': true, 10008 'lookup': true 10009 }; 10010 if (knownHelpers) { 10011 for (var _name in knownHelpers) { 10012 /* istanbul ignore else */ 10013 if (_name in knownHelpers) { 10014 this.options.knownHelpers[_name] = knownHelpers[_name]; 10015 } 10016 } 10017 }
vendor: 7,549 bytes, lines 10017-10283
10017 10018 10019 return this.accept(program); 10020 }, 10021 10022 compileProgram: function compileProgram(program) { 10023 var childCompiler = new this.compiler(), 10024 // eslint-disable-line new-cap 10025 result = childCompiler.compile(program, this.options), 10026 guid = this.guid++; 10027 10028 this.usePartial = this.usePartial || result.usePartial; 10029 10030 this.children[guid] = result; 10031 this.useDepths = this.useDepths || result.useDepths; 10032 10033 return guid; 10034 }, 10035 10036 accept: function accept(node) { 10037 /* istanbul ignore next: Sanity code */ 10038 if (!this[node.type]) { 10039 throw new _exception2['default']('Unknown type: ' + node.type, node); 10040 } 10041 10042 this.sourceNode.unshift(node); 10043 var ret = this[node.type](node); 10044 this.sourceNode.shift(); 10045 return ret; 10046 }, 10047 10048 Program: function Program(program) { 10049 this.options.blockParams.unshift(program.blockParams); 10050 10051 var body = program.body, 10052 bodyLength = body.length; 10053 for (var i = 0; i < bodyLength; i++) { 10054 this.accept(body[i]); 10055 } 10056 10057 this.options.blockParams.shift(); 10058 10059 this.isSimple = bodyLength === 1; 10060 this.blockParams = program.blockParams ? program.blockParams.length : 0; 10061 10062 return this; 10063 }, 10064 10065 BlockStatement: function BlockStatement(block) { 10066 transformLiteralToPath(block); 10067 10068 var program = block.program, 10069 inverse = block.inverse; 10070 10071 program = program && this.compileProgram(program); 10072 inverse = inverse && this.compileProgram(inverse); 10073 10074 var type = this.classifySexpr(block); 10075 10076 if (type === 'helper') { 10077 this.helperSexpr(block, program, inverse); 10078 } else if (type === 'simple') { 10079 this.simpleSexpr(block); 10080 10081 // now that the simple mustache is resolved, we need to 10082 // evaluate it by executing `blockHelperMissing` 10083 this.opcode('pushProgram', program); 10084 this.opcode('pushProgram', inverse); 10085 this.opcode('emptyHash'); 10086 this.opcode('blockValue', block.path.original); 10087 } else { 10088 this.ambiguousSexpr(block, program, inverse); 10089 10090 // now that the simple mustache is resolved, we need to 10091 // evaluate it by executing `blockHelperMissing` 10092 this.opcode('pushProgram', program); 10093 this.opcode('pushProgram', inverse); 10094 this.opcode('emptyHash'); 10095 this.opcode('ambiguousBlockValue'); 10096 } 10097 10098 this.opcode('append'); 10099 }, 10100 10101 DecoratorBlock: function DecoratorBlock(decorator) { 10102 var program = decorator.program && this.compileProgram(decorator.program); 10103 var params = this.setupFullMustacheParams(decorator, program, undefined), 10104 path = decorator.path; 10105 10106 this.useDecorators = true; 10107 this.opcode('registerDecorator', params.length, path.original); 10108 }, 10109 10110 PartialStatement: function PartialStatement(partial) { 10111 this.usePartial = true; 10112 10113 var program = partial.program; 10114 if (program) { 10115 program = this.compileProgram(partial.program); 10116 } 10117 10118 var params = partial.params; 10119 if (params.length > 1) { 10120 throw new _exception2['default']('Unsupported number of partial arguments: ' + params.length, partial); 10121 } else if (!params.length) { 10122 if (this.options.explicitPartialContext) { 10123 this.opcode('pushLiteral', 'undefined'); 10124 } else { 10125 params.push({ type: 'PathExpression', parts: [], depth: 0 }); 10126 } 10127 } 10128 10129 var partialName = partial.name.original, 10130 isDynamic = partial.name.type === 'SubExpression'; 10131 if (isDynamic) { 10132 this.accept(partial.name); 10133 } 10134 10135 this.setupFullMustacheParams(partial, program, undefined, true); 10136 10137 var indent = partial.indent || ''; 10138 if (this.options.preventIndent && indent) { 10139 this.opcode('appendContent', indent); 10140 indent = ''; 10141 } 10142 10143 this.opcode('invokePartial', isDynamic, partialName, indent); 10144 this.opcode('append'); 10145 }, 10146 PartialBlockStatement: function PartialBlockStatement(partialBlock) { 10147 this.PartialStatement(partialBlock); 10148 }, 10149 10150 MustacheStatement: function MustacheStatement(mustache) { 10151 this.SubExpression(mustache); 10152 10153 if (mustache.escaped && !this.options.noEscape) { 10154 this.opcode('appendEscaped'); 10155 } else { 10156 this.opcode('append'); 10157 } 10158 }, 10159 Decorator: function Decorator(decorator) { 10160 this.DecoratorBlock(decorator); 10161 }, 10162 10163 ContentStatement: function ContentStatement(content) { 10164 if (content.value) { 10165 this.opcode('appendContent', content.value); 10166 } 10167 }, 10168 10169 CommentStatement: function CommentStatement() {}, 10170 10171 SubExpression: function SubExpression(sexpr) { 10172 transformLiteralToPath(sexpr); 10173 var type = this.classifySexpr(sexpr); 10174 10175 if (type === 'simple') { 10176 this.simpleSexpr(sexpr); 10177 } else if (type === 'helper') { 10178 this.helperSexpr(sexpr); 10179 } else { 10180 this.ambiguousSexpr(sexpr); 10181 } 10182 }, 10183 ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) { 10184 var path = sexpr.path, 10185 name = path.parts[0], 10186 isBlock = program != null || inverse != null; 10187 10188 this.opcode('getContext', path.depth); 10189 10190 this.opcode('pushProgram', program); 10191 this.opcode('pushProgram', inverse); 10192 10193 path.strict = true; 10194 this.accept(path); 10195 10196 this.opcode('invokeAmbiguous', name, isBlock); 10197 }, 10198 10199 simpleSexpr: function simpleSexpr(sexpr) { 10200 var path = sexpr.path; 10201 path.strict = true; 10202 this.accept(path); 10203 this.opcode('resolvePossibleLambda'); 10204 }, 10205 10206 helperSexpr: function helperSexpr(sexpr, program, inverse) { 10207 var params = this.setupFullMustacheParams(sexpr, program, inverse), 10208 path = sexpr.path, 10209 name = path.parts[0]; 10210 10211 if (this.options.knownHelpers[name]) { 10212 this.opcode('invokeKnownHelper', params.length, name); 10213 } else if (this.options.knownHelpersOnly) { 10214 throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr); 10215 } else { 10216 path.strict = true; 10217 path.falsy = true; 10218 10219 this.accept(path); 10220 this.opcode('invokeHelper', params.length, path.original, _ast2['default'].helpers.simpleId(path)); 10221 } 10222 }, 10223 10224 PathExpression: function PathExpression(path) { 10225 this.addDepth(path.depth); 10226 this.opcode('getContext', path.depth); 10227 10228 var name = path.parts[0], 10229 scoped = _ast2['default'].helpers.scopedId(path), 10230 blockParamId = !path.depth && !scoped && this.blockParamIndex(name); 10231 10232 if (blockParamId) { 10233 this.opcode('lookupBlockParam', blockParamId, path.parts); 10234 } else if (!name) { 10235 // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` 10236 this.opcode('pushContext'); 10237 } else if (path.data) { 10238 this.options.data = true; 10239 this.opcode('lookupData', path.depth, path.parts, path.strict); 10240 } else { 10241 this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped); 10242 } 10243 }, 10244 10245 StringLiteral: function StringLiteral(string) { 10246 this.opcode('pushString', string.value); 10247 }, 10248 10249 NumberLiteral: function NumberLiteral(number) { 10250 this.opcode('pushLiteral', number.value); 10251 }, 10252 10253 BooleanLiteral: function BooleanLiteral(bool) { 10254 this.opcode('pushLiteral', bool.value); 10255 }, 10256 10257 UndefinedLiteral: function UndefinedLiteral() { 10258 this.opcode('pushLiteral', 'undefined'); 10259 }, 10260 10261 NullLiteral: function NullLiteral() { 10262 this.opcode('pushLiteral', 'null'); 10263 }, 10264 10265 Hash: function Hash(hash) { 10266 var pairs = hash.pairs, 10267 i = 0, 10268 l = pairs.length; 10269 10270 this.opcode('pushHash'); 10271 10272 for (; i < l; i++) { 10273 this.pushParam(pairs[i].value); 10274 } 10275 while (i--) { 10276 this.opcode('assignToHash', pairs[i].key); 10277 } 10278 this.opcode('popHash'); 10279 }, 10280 10281 // HELPERS 10282 opcode: function opcode(name) { 10283 this.opcodes.push({
vendor: 5,258 bytes, lines 10283-10458
10283 opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc }); 10284 }, 10285 10286 addDepth: function addDepth(depth) { 10287 if (!depth) { 10288 return; 10289 } 10290 10291 this.useDepths = true; 10292 }, 10293 10294 classifySexpr: function classifySexpr(sexpr) { 10295 var isSimple = _ast2['default'].helpers.simpleId(sexpr.path); 10296 10297 var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]); 10298 10299 // a mustache is an eligible helper if: 10300 // * its id is simple (a single part, not `this` or `..`) 10301 var isHelper = !isBlockParam && _ast2['default'].helpers.helperExpression(sexpr); 10302 10303 // if a mustache is an eligible helper but not a definite 10304 // helper, it is ambiguous, and will be resolved in a later 10305 // pass or at runtime. 10306 var isEligible = !isBlockParam && (isHelper || isSimple); 10307 10308 // if ambiguous, we can possibly resolve the ambiguity now 10309 // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. 10310 if (isEligible && !isHelper) { 10311 var _name2 = sexpr.path.parts[0], 10312 options = this.options; 10313 10314 if (options.knownHelpers[_name2]) { 10315 isHelper = true; 10316 } else if (options.knownHelpersOnly) { 10317 isEligible = false; 10318 } 10319 } 10320 10321 if (isHelper) { 10322 return 'helper'; 10323 } else if (isEligible) { 10324 return 'ambiguous'; 10325 } else { 10326 return 'simple'; 10327 } 10328 }, 10329 10330 pushParams: function pushParams(params) { 10331 for (var i = 0, l = params.length; i < l; i++) { 10332 this.pushParam(params[i]); 10333 } 10334 }, 10335 10336 pushParam: function pushParam(val) { 10337 var value = val.value != null ? val.value : val.original || ''; 10338 10339 if (this.stringParams) { 10340 if (value.replace) { 10341 value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.'); 10342 } 10343 10344 if (val.depth) { 10345 this.addDepth(val.depth); 10346 } 10347 this.opcode('getContext', val.depth || 0); 10348 this.opcode('pushStringParam', value, val.type); 10349 10350 if (val.type === 'SubExpression') { 10351 // SubExpressions get evaluated and passed in 10352 // in string params mode. 10353 this.accept(val); 10354 } 10355 } else { 10356 if (this.trackIds) { 10357 var blockParamIndex = undefined; 10358 if (val.parts && !_ast2['default'].helpers.scopedId(val) && !val.depth) { 10359 blockParamIndex = this.blockParamIndex(val.parts[0]); 10360 } 10361 if (blockParamIndex) { 10362 var blockParamChild = val.parts.slice(1).join('.'); 10363 this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild); 10364 } else { 10365 value = val.original || value; 10366 if (value.replace) { 10367 value = value.replace(/^this(?:\.|$)/, '').replace(/^\.\//, '').replace(/^\.$/, ''); 10368 } 10369 10370 this.opcode('pushId', val.type, value); 10371 } 10372 } 10373 this.accept(val); 10374 } 10375 }, 10376 10377 setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) { 10378 var params = sexpr.params; 10379 this.pushParams(params); 10380 10381 this.opcode('pushProgram', program); 10382 this.opcode('pushProgram', inverse); 10383 10384 if (sexpr.hash) { 10385 this.accept(sexpr.hash); 10386 } else { 10387 this.opcode('emptyHash', omitEmpty); 10388 } 10389 10390 return params; 10391 }, 10392 10393 blockParamIndex: function blockParamIndex(name) { 10394 for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) { 10395 var blockParams = this.options.blockParams[depth], 10396 param = blockParams && _utils.indexOf(blockParams, name); 10397 if (blockParams && param >= 0) { 10398 return [depth, param]; 10399 } 10400 } 10401 } 10402}; 10403 10404function precompile(input, options, env) { 10405 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 10406 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input); 10407 } 10408 10409 options = options || {}; 10410 if (!('data' in options)) { 10411 options.data = true; 10412 } 10413 if (options.compat) { 10414 options.useDepths = true; 10415 } 10416 10417 var ast = env.parse(input, options), 10418 environment = new env.Compiler().compile(ast, options); 10419 return new env.JavaScriptCompiler().compile(environment, options); 10420} 10421 10422function compile(input, options, env) { 10423 if (options === undefined) options = {}; 10424 10425 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 10426 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input); 10427 } 10428 10429 options = _utils.extend({}, options); 10430 if (!('data' in options)) { 10431 options.data = true; 10432 } 10433 if (options.compat) { 10434 options.useDepths = true; 10435 } 10436 10437 var compiled = undefined; 10438 10439 function compileInput() { 10440 var ast = env.parse(input, options), 10441 environment = new env.Compiler().compile(ast, options), 10442 templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); 10443 return env.template(templateSpec); 10444 } 10445 10446 // Template is only compiled on first use and cached after that point. 10447 function ret(context, execOptions) { 10448 if (!compiled) { 10449 compiled = compileInput(); 10450 } 10451 return compiled.call(this, context, execOptions); 10452 } 10453 ret._setup = function (setupOptions) { 10454 if (!compiled) { 10455 compiled = compileInput(); 10456 } 10457 return compiled._setup(setupOptions); 10458 };
vendor: 5,055 bytes, lines 10459-10646
10459 ret._child = function (i, data, blockParams, depths) { 10460 if (!compiled) { 10461 compiled = compileInput(); 10462 } 10463 return compiled._child(i, data, blockParams, depths); 10464 }; 10465 return ret; 10466} 10467 10468function argEquals(a, b) { 10469 if (a === b) { 10470 return true; 10471 } 10472 10473 if (_utils.isArray(a) && _utils.isArray(b) && a.length === b.length) { 10474 for (var i = 0; i < a.length; i++) { 10475 if (!argEquals(a[i], b[i])) { 10476 return false; 10477 } 10478 } 10479 return true; 10480 } 10481} 10482 10483function transformLiteralToPath(sexpr) { 10484 if (!sexpr.path.parts) { 10485 var literal = sexpr.path; 10486 // Casting to string here to make false and 0 literal values play nicely with the rest 10487 // of the system. 10488 sexpr.path = { 10489 type: 'PathExpression', 10490 data: false, 10491 depth: 0, 10492 parts: [literal.original + ''], 10493 original: literal.original + '', 10494 loc: literal.loc 10495 }; 10496 } 10497} 10498 10499 10500},{"../exception":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/exception.js","../utils":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/utils.js","./ast":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/ast.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/helpers.js":[function(require,module,exports){ 10501'use strict'; 10502 10503exports.__esModule = true; 10504exports.SourceLocation = SourceLocation; 10505exports.id = id; 10506exports.stripFlags = stripFlags; 10507exports.stripComment = stripComment; 10508exports.preparePath = preparePath; 10509exports.prepareMustache = prepareMustache; 10510exports.prepareRawBlock = prepareRawBlock; 10511exports.prepareBlock = prepareBlock; 10512exports.prepareProgram = prepareProgram; 10513exports.preparePartialBlock = preparePartialBlock; 10514// istanbul ignore next 10515 10516function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 10517 10518var _exception = require('../exception'); 10519 10520var _exception2 = _interopRequireDefault(_exception); 10521 10522function validateClose(open, close) { 10523 close = close.path ? close.path.original : close; 10524 10525 if (open.path.original !== close) { 10526 var errorNode = { loc: open.path.loc }; 10527 10528 throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode); 10529 } 10530} 10531 10532function SourceLocation(source, locInfo) { 10533 this.source = source; 10534 this.start = { 10535 line: locInfo.first_line, 10536 column: locInfo.first_column 10537 }; 10538 this.end = { 10539 line: locInfo.last_line, 10540 column: locInfo.last_column 10541 }; 10542} 10543 10544function id(token) { 10545 if (/^\[.*\]$/.test(token)) { 10546 return token.substr(1, token.length - 2); 10547 } else { 10548 return token; 10549 } 10550} 10551 10552function stripFlags(open, close) { 10553 return { 10554 open: open.charAt(2) === '~', 10555 close: close.charAt(close.length - 3) === '~' 10556 }; 10557} 10558 10559function stripComment(comment) { 10560 return comment.replace(/^\{\{~?\!-?-?/, '').replace(/-?-?~?\}\}$/, ''); 10561} 10562 10563function preparePath(data, parts, loc) { 10564 loc = this.locInfo(loc); 10565 10566 var original = data ? '@' : '', 10567 dig = [], 10568 depth = 0, 10569 depthString = ''; 10570 10571 for (var i = 0, l = parts.length; i < l; i++) { 10572 var part = parts[i].part, 10573 10574 // If we have [] syntax then we do not treat path references as operators, 10575 // i.e. foo.[this] resolves to approximately context.foo['this'] 10576 isLiteral = parts[i].original !== part; 10577 original += (parts[i].separator || '') + part; 10578 10579 if (!isLiteral && (part === '..' || part === '.' || part === 'this')) { 10580 if (dig.length > 0) { 10581 throw new _exception2['default']('Invalid path: ' + original, { loc: loc }); 10582 } else if (part === '..') { 10583 depth++; 10584 depthString += '../'; 10585 } 10586 } else { 10587 dig.push(part); 10588 } 10589 } 10590 10591 return { 10592 type: 'PathExpression', 10593 data: data, 10594 depth: depth, 10595 parts: dig, 10596 original: original, 10597 loc: loc 10598 }; 10599} 10600 10601function prepareMustache(path, params, hash, open, strip, locInfo) { 10602 // Must use charAt to support IE pre-10 10603 var escapeFlag = open.charAt(3) || open.charAt(2), 10604 escaped = escapeFlag !== '{' && escapeFlag !== '&'; 10605 10606 var decorator = /\*/.test(open); 10607 return { 10608 type: decorator ? 'Decorator' : 'MustacheStatement', 10609 path: path, 10610 params: params, 10611 hash: hash, 10612 escaped: escaped, 10613 strip: strip, 10614 loc: this.locInfo(locInfo) 10615 }; 10616} 10617 10618function prepareRawBlock(openRawBlock, contents, close, locInfo) { 10619 validateClose(openRawBlock, close); 10620 10621 locInfo = this.locInfo(locInfo); 10622 var program = { 10623 type: 'Program', 10624 body: contents, 10625 strip: {}, 10626 loc: locInfo 10627 }; 10628 10629 return { 10630 type: 'BlockStatement', 10631 path: openRawBlock.path, 10632 params: openRawBlock.params, 10633 hash: openRawBlock.hash, 10634 program: program, 10635 openStrip: {}, 10636 inverseStrip: {}, 10637 closeStrip: {}, 10638 loc: locInfo 10639 }; 10640} 10641 10642function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { 10643 if (close && close.path) { 10644 validateClose(openBlock, close); 10645 } 10646
10647 var decorator = /\*/.test(openBlock.open); 10648 10649 program.blockParams = openBlock.blockParams; 10650 10651 var inverse = undefined, 10652 inverseStrip = undefined; 10653 10654 if (inverseAndProgram) { 10655 if (decorator) { 10656 throw new _exception2['default']('Unexpected inverse block on decorator', inverseAndProgram); 10657 } 10658 10659 if (inverseAndProgram.chain) { 10660 inverseAndProgram.program.body[0].closeStrip = close.strip; 10661 } 10662 10663 inverseStrip = inverseAndProgram.strip; 10664 inverse = inverseAndProgram.program; 10665 } 10666 10667 if (inverted) { 10668 inverted = inverse; 10669 inverse = program; 10670 program = inverted; 10671 } 10672 10673 return { 10674 type: decorator ? 'DecoratorBlock' : 'BlockStatement', 10675 path: openBlock.path, 10676 params: openBlock.params, 10677 hash: openBlock.hash, 10678 program: program, 10679 inverse: inverse, 10680 openStrip: openBlock.strip, 10681 inverseStrip: inverseStrip, 10682 closeStrip: close && close.strip, 10683 loc: this.locInfo(locInfo) 10684 }; 10685} 10686 10687function prepareProgram(statements, loc) { 10688 if (!loc && statements.length) { 10689 var firstLoc = statements[0].loc, 10690 lastLoc = statements[statements.length - 1].loc; 10691 10692 /* istanbul ignore else */ 10693 if (firstLoc && lastLoc) { 10694 loc = { 10695 source: firstLoc.source, 10696 start: { 10697 line: firstLoc.start.line, 10698 column: firstLoc.start.column 10699 }, 10700 end: { 10701 line: lastLoc.end.line, 10702 column: lastLoc.end.column 10703 } 10704 }; 10705 } 10706 } 10707 10708 return { 10709 type: 'Program', 10710 body: statements, 10711 strip: {}, 10712 loc: loc 10713 }; 10714} 10715 10716function preparePartialBlock(open, program, close, locInfo) { 10717 validateClose(open, close); 10718 10719 return { 10720 type: 'PartialBlockStatement', 10721 name: open.path, 10722 params: open.params, 10723 hash: open.hash, 10724 program: program, 10725 openStrip: open.strip, 10726 closeStrip: close && close.strip, 10727 loc: this.locInfo(locInfo) 10728 }; 10729} 10730 10731 10732},{"../exception":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/exception.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js":[function(require,module,exports){ 10733'use strict'; 10734 10735exports.__esModule = true; 10736// istanbul ignore next 10737 10738function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 10739 10740var _base = require('../base'); 10741 10742var _exception = require('../exception'); 10743 10744var _exception2 = _interopRequireDefault(_exception); 10745 10746var _utils = require('../utils'); 10747 10748var _codeGen = require('./code-gen'); 10749 10750var _codeGen2 = _interopRequireDefault(_codeGen); 10751 10752function Literal(value) { 10753 this.value = value; 10754} 10755 10756function JavaScriptCompiler() {} 10757 10758JavaScriptCompiler.prototype = { 10759 // PUBLIC API: You can override these methods in a subclass to provide 10760 // alternative compiled forms for name lookup and buffering semantics 10761 nameLookup: function nameLookup(parent, name /* , type*/) { 10762 if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { 10763 return [parent, '.', name]; 10764 } else { 10765 return [parent, '[', JSON.stringify(name), ']']; 10766 } 10767 }, 10768 depthedLookup: function depthedLookup(name) { 10769 return [this.aliasable('container.lookup'), '(depths, "', name, '")']; 10770 }, 10771 10772 compilerInfo: function compilerInfo() { 10773 var revision = _base.COMPILER_REVISION, 10774 versions = _base.REVISION_CHANGES[revision]; 10775 return [revision, versions]; 10776 }, 10777 10778 appendToBuffer: function appendToBuffer(source, location, explicit) { 10779 // Force a source as this simplifies the merge logic. 10780 if (!_utils.isArray(source)) { 10781 source = [source]; 10782 } 10783 source = this.source.wrap(source, location); 10784 10785 if (this.environment.isSimple) { 10786 return ['return ', source, ';']; 10787 } else if (explicit) { 10788 // This is a case where the buffer operation occurs as a child of another 10789 // construct, generally braces. We have to explicitly output these buffer 10790 // operations to ensure that the emitted code goes in the correct location. 10791 return ['buffer += ', source, ';']; 10792 } else { 10793 source.appendToBuffer = true; 10794 return source; 10795 } 10796 }, 10797 10798 initializeBuffer: function initializeBuffer() { 10799 return this.quotedString(''); 10800 }, 10801 // END PUBLIC API 10802 10803 compile: function compile(environment, options, context, asObject) { 10804 this.environment = environment; 10805 this.options = options; 10806 this.stringParams = this.options.stringParams; 10807 this.trackIds = this.options.trackIds;
vendor: 9,250 bytes, lines 10808-11116
10808 this.precompile = !asObject; 10809 10810 this.name = this.environment.name; 10811 this.isChild = !!context; 10812 this.context = context || { 10813 decorators: [], 10814 programs: [], 10815 environments: [] 10816 }; 10817 10818 this.preamble(); 10819 10820 this.stackSlot = 0; 10821 this.stackVars = []; 10822 this.aliases = {}; 10823 this.registers = { list: [] }; 10824 this.hashes = []; 10825 this.compileStack = []; 10826 this.inlineStack = []; 10827 this.blockParams = []; 10828 10829 this.compileChildren(environment, options); 10830 10831 this.useDepths = this.useDepths || environment.useDepths || environment.useDecorators || this.options.compat; 10832 this.useBlockParams = this.useBlockParams || environment.useBlockParams; 10833 10834 var opcodes = environment.opcodes, 10835 opcode = undefined, 10836 firstLoc = undefined, 10837 i = undefined, 10838 l = undefined; 10839 10840 for (i = 0, l = opcodes.length; i < l; i++) { 10841 opcode = opcodes[i]; 10842 10843 this.source.currentLocation = opcode.loc; 10844 firstLoc = firstLoc || opcode.loc; 10845 this[opcode.opcode].apply(this, opcode.args); 10846 } 10847 10848 // Flush any trailing content that might be pending. 10849 this.source.currentLocation = firstLoc; 10850 this.pushSource(''); 10851 10852 /* istanbul ignore next */ 10853 if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { 10854 throw new _exception2['default']('Compile completed with content left on stack'); 10855 } 10856 10857 if (!this.decorators.isEmpty()) { 10858 this.useDecorators = true; 10859 10860 this.decorators.prepend('var decorators = container.decorators;\n'); 10861 this.decorators.push('return fn;'); 10862 10863 if (asObject) { 10864 this.decorators = Function.apply(this, ['fn', 'props', 'container', 'depth0', 'data', 'blockParams', 'depths', this.decorators.merge()]); 10865 } else { 10866 this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths) {\n'); 10867 this.decorators.push('}\n'); 10868 this.decorators = this.decorators.merge(); 10869 } 10870 } else { 10871 this.decorators = undefined; 10872 } 10873 10874 var fn = this.createFunctionContext(asObject); 10875 if (!this.isChild) { 10876 var ret = { 10877 compiler: this.compilerInfo(), 10878 main: fn 10879 }; 10880 10881 if (this.decorators) { 10882 ret.main_d = this.decorators; // eslint-disable-line camelcase 10883 ret.useDecorators = true; 10884 } 10885 10886 var _context = this.context; 10887 var programs = _context.programs; 10888 var decorators = _context.decorators; 10889 10890 for (i = 0, l = programs.length; i < l; i++) { 10891 if (programs[i]) { 10892 ret[i] = programs[i]; 10893 if (decorators[i]) { 10894 ret[i + '_d'] = decorators[i]; 10895 ret.useDecorators = true; 10896 } 10897 } 10898 } 10899 10900 if (this.environment.usePartial) { 10901 ret.usePartial = true; 10902 } 10903 if (this.options.data) { 10904 ret.useData = true; 10905 } 10906 if (this.useDepths) { 10907 ret.useDepths = true; 10908 } 10909 if (this.useBlockParams) { 10910 ret.useBlockParams = true; 10911 } 10912 if (this.options.compat) { 10913 ret.compat = true; 10914 } 10915 10916 if (!asObject) { 10917 ret.compiler = JSON.stringify(ret.compiler); 10918 10919 this.source.currentLocation = { start: { line: 1, column: 0 } }; 10920 ret = this.objectLiteral(ret); 10921 10922 if (options.srcName) { 10923 ret = ret.toStringWithSourceMap({ file: options.destName }); 10924 ret.map = ret.map && ret.map.toString(); 10925 } else { 10926 ret = ret.toString(); 10927 } 10928 } else { 10929 ret.compilerOptions = this.options; 10930 } 10931 10932 return ret; 10933 } else { 10934 return fn; 10935 } 10936 }, 10937 10938 preamble: function preamble() { 10939 // track the last context pushed into place to allow skipping the 10940 // getContext opcode when it would be a noop 10941 this.lastContext = 0; 10942 this.source = new _codeGen2['default'](this.options.srcName); 10943 this.decorators = new _codeGen2['default'](this.options.srcName); 10944 }, 10945 10946 createFunctionContext: function createFunctionContext(asObject) { 10947 var varDeclarations = ''; 10948 10949 var locals = this.stackVars.concat(this.registers.list); 10950 if (locals.length > 0) { 10951 varDeclarations += ', ' + locals.join(', '); 10952 } 10953 10954 // Generate minimizer alias mappings 10955 // 10956 // When using true SourceNodes, this will update all references to the given alias 10957 // as the source nodes are reused in situ. For the non-source node compilation mode, 10958 // aliases will not be used, but this case is already being run on the client and 10959 // we aren't concern about minimizing the template size. 10960 var aliasCount = 0; 10961 for (var alias in this.aliases) { 10962 // eslint-disable-line guard-for-in 10963 var node = this.aliases[alias]; 10964 10965 if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) { 10966 varDeclarations += ', alias' + ++aliasCount + '=' + alias; 10967 node.children[0] = 'alias' + aliasCount; 10968 } 10969 } 10970 10971 var params = ['container', 'depth0', 'helpers', 'partials', 'data']; 10972 10973 if (this.useBlockParams || this.useDepths) { 10974 params.push('blockParams'); 10975 } 10976 if (this.useDepths) { 10977 params.push('depths'); 10978 } 10979 10980 // Perform a second pass over the output to merge content when possible 10981 var source = this.mergeSource(varDeclarations); 10982 10983 if (asObject) { 10984 params.push(source); 10985 10986 return Function.apply(this, params); 10987 } else { 10988 return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); 10989 } 10990 }, 10991 mergeSource: function mergeSource(varDeclarations) { 10992 var isSimple = this.environment.isSimple, 10993 appendOnly = !this.forceBuffer, 10994 appendFirst = undefined, 10995 sourceSeen = undefined, 10996 bufferStart = undefined, 10997 bufferEnd = undefined; 10998 this.source.each(function (line) { 10999 if (line.appendToBuffer) { 11000 if (bufferStart) { 11001 line.prepend(' + '); 11002 } else { 11003 bufferStart = line; 11004 } 11005 bufferEnd = line; 11006 } else { 11007 if (bufferStart) { 11008 if (!sourceSeen) { 11009 appendFirst = true; 11010 } else { 11011 bufferStart.prepend('buffer += '); 11012 } 11013 bufferEnd.add(';'); 11014 bufferStart = bufferEnd = undefined; 11015 } 11016 11017 sourceSeen = true; 11018 if (!isSimple) { 11019 appendOnly = false; 11020 } 11021 } 11022 }); 11023 11024 if (appendOnly) { 11025 if (bufferStart) { 11026 bufferStart.prepend('return '); 11027 bufferEnd.add(';'); 11028 } else if (!sourceSeen) { 11029 this.source.push('return "";'); 11030 } 11031 } else { 11032 varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer()); 11033 11034 if (bufferStart) { 11035 bufferStart.prepend('return buffer + '); 11036 bufferEnd.add(';'); 11037 } else { 11038 this.source.push('return buffer;'); 11039 } 11040 } 11041 11042 if (varDeclarations) { 11043 this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); 11044 } 11045 11046 return this.source.merge(); 11047 }, 11048 11049 // [blockValue] 11050 // 11051 // On stack, before: hash, inverse, program, value 11052 // On stack, after: return value of blockHelperMissing 11053 // 11054 // The purpose of this opcode is to take a block of the form 11055 // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and 11056 // replace it on the stack with the result of properly 11057 // invoking blockHelperMissing. 11058 blockValue: function blockValue(name) { 11059 var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), 11060 params = [this.contextName(0)]; 11061 this.setupHelperArgs(name, 0, params); 11062 11063 var blockName = this.popStack(); 11064 params.splice(1, 0, blockName); 11065 11066 this.push(this.source.functionCall(blockHelperMissing, 'call', params)); 11067 }, 11068 11069 // [ambiguousBlockValue] 11070 // 11071 // On stack, before: hash, inverse, program, value 11072 // Compiler value, before: lastHelper=value of last found helper, if any 11073 // On stack, after, if no lastHelper: same as [blockValue] 11074 // On stack, after, if lastHelper: value 11075 ambiguousBlockValue: function ambiguousBlockValue() { 11076 // We're being a bit cheeky and reusing the options value from the prior exec 11077 var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), 11078 params = [this.contextName(0)]; 11079 this.setupHelperArgs('', 0, params, true); 11080 11081 this.flushInline(); 11082 11083 var current = this.topStack(); 11084 params.splice(1, 0, current); 11085 11086 this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']); 11087 }, 11088 11089 // [appendContent] 11090 // 11091 // On stack, before: ... 11092 // On stack, after: ... 11093 // 11094 // Appends the string value of `content` to the current buffer 11095 appendContent: function appendContent(content) { 11096 if (this.pendingContent) { 11097 content = this.pendingContent + content; 11098 } else { 11099 this.pendingLocation = this.source.currentLocation; 11100 } 11101 11102 this.pendingContent = content; 11103 }, 11104 11105 // [append] 11106 // 11107 // On stack, before: value, ... 11108 // On stack, after: ... 11109 // 11110 // Coerces `value` to a String and appends it to the current buffer. 11111 // 11112 // If `value` is truthy, or 0, it is coerced into a string and appended 11113 // Otherwise, the empty string is appended 11114 append: function append() { 11115 if (this.isInline()) { 11116 this.replaceStack(function (current) {
vendor: 5,642 bytes, lines 11117-11309
11117 return [' != null ? ', current, ' : ""']; 11118 }); 11119 11120 this.pushSource(this.appendToBuffer(this.popStack())); 11121 } else { 11122 var local = this.popStack(); 11123 this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); 11124 if (this.environment.isSimple) { 11125 this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']); 11126 } 11127 } 11128 }, 11129 11130 // [appendEscaped] 11131 // 11132 // On stack, before: value, ... 11133 // On stack, after: ... 11134 // 11135 // Escape `value` and append it to the buffer 11136 appendEscaped: function appendEscaped() { 11137 this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'), '(', this.popStack(), ')'])); 11138 }, 11139 11140 // [getContext] 11141 // 11142 // On stack, before: ... 11143 // On stack, after: ... 11144 // Compiler value, after: lastContext=depth 11145 // 11146 // Set the value of the `lastContext` compiler value to the depth 11147 getContext: function getContext(depth) { 11148 this.lastContext = depth; 11149 }, 11150 11151 // [pushContext] 11152 // 11153 // On stack, before: ... 11154 // On stack, after: currentContext, ... 11155 // 11156 // Pushes the value of the current context onto the stack. 11157 pushContext: function pushContext() { 11158 this.pushStackLiteral(this.contextName(this.lastContext)); 11159 }, 11160 11161 // [lookupOnContext] 11162 // 11163 // On stack, before: ... 11164 // On stack, after: currentContext[name], ... 11165 // 11166 // Looks up the value of `name` on the current context and pushes 11167 // it onto the stack. 11168 lookupOnContext: function lookupOnContext(parts, falsy, strict, scoped) { 11169 var i = 0; 11170 11171 if (!scoped && this.options.compat && !this.lastContext) { 11172 // The depthed query is expected to handle the undefined logic for the root level that 11173 // is implemented below, so we evaluate that directly in compat mode 11174 this.push(this.depthedLookup(parts[i++])); 11175 } else { 11176 this.pushContext(); 11177 } 11178 11179 this.resolvePath('context', parts, i, falsy, strict); 11180 }, 11181 11182 // [lookupBlockParam] 11183 // 11184 // On stack, before: ... 11185 // On stack, after: blockParam[name], ... 11186 // 11187 // Looks up the value of `parts` on the given block param and pushes 11188 // it onto the stack. 11189 lookupBlockParam: function lookupBlockParam(blockParamId, parts) { 11190 this.useBlockParams = true; 11191 11192 this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); 11193 this.resolvePath('context', parts, 1); 11194 }, 11195 11196 // [lookupData] 11197 // 11198 // On stack, before: ... 11199 // On stack, after: data, ... 11200 // 11201 // Push the data lookup operator 11202 lookupData: function lookupData(depth, parts, strict) { 11203 if (!depth) { 11204 this.pushStackLiteral('data'); 11205 } else { 11206 this.pushStackLiteral('container.data(data, ' + depth + ')'); 11207 } 11208 11209 this.resolvePath('data', parts, 0, true, strict); 11210 }, 11211 11212 resolvePath: function resolvePath(type, parts, i, falsy, strict) { 11213 // istanbul ignore next 11214 11215 var _this = this; 11216 11217 if (this.options.strict || this.options.assumeObjects) { 11218 this.push(strictLookup(this.options.strict && strict, this, parts, type)); 11219 return; 11220 } 11221 11222 var len = parts.length; 11223 for (; i < len; i++) { 11224 /* eslint-disable no-loop-func */ 11225 this.replaceStack(function (current) { 11226 var lookup = _this.nameLookup(current, parts[i], type); 11227 // We want to ensure that zero and false are handled properly if the context (falsy flag) 11228 // needs to have the special handling for these values. 11229 if (!falsy) { 11230 return [' != null ? ', lookup, ' : ', current]; 11231 } else { 11232 // Otherwise we can use generic falsy handling 11233 return [' && ', lookup]; 11234 } 11235 }); 11236 /* eslint-enable no-loop-func */ 11237 } 11238 }, 11239 11240 // [resolvePossibleLambda] 11241 // 11242 // On stack, before: value, ... 11243 // On stack, after: resolved value, ... 11244 // 11245 // If the `value` is a lambda, replace it on the stack by 11246 // the return value of the lambda 11247 resolvePossibleLambda: function resolvePossibleLambda() { 11248 this.push([this.aliasable('container.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); 11249 }, 11250 11251 // [pushStringParam] 11252 // 11253 // On stack, before: ... 11254 // On stack, after: string, currentContext, ... 11255 // 11256 // This opcode is designed for use in string mode, which 11257 // provides the string value of a parameter along with its 11258 // depth rather than resolving it immediately. 11259 pushStringParam: function pushStringParam(string, type) { 11260 this.pushContext(); 11261 this.pushString(type); 11262 11263 // If it's a subexpression, the string result 11264 // will be pushed after this opcode. 11265 if (type !== 'SubExpression') { 11266 if (typeof string === 'string') { 11267 this.pushString(string); 11268 } else { 11269 this.pushStackLiteral(string); 11270 } 11271 } 11272 }, 11273 11274 emptyHash: function emptyHash(omitEmpty) { 11275 if (this.trackIds) { 11276 this.push('{}'); // hashIds 11277 } 11278 if (this.stringParams) { 11279 this.push('{}'); // hashContexts 11280 this.push('{}'); // hashTypes 11281 } 11282 this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); 11283 }, 11284 pushHash: function pushHash() { 11285 if (this.hash) { 11286 this.hashes.push(this.hash); 11287 } 11288 this.hash = { values: [], types: [], contexts: [], ids: [] }; 11289 }, 11290 popHash: function popHash() { 11291 var hash = this.hash; 11292 this.hash = this.hashes.pop(); 11293 11294 if (this.trackIds) { 11295 this.push(this.objectLiteral(hash.ids)); 11296 } 11297 if (this.stringParams) { 11298 this.push(this.objectLiteral(hash.contexts)); 11299 this.push(this.objectLiteral(hash.types)); 11300 } 11301 11302 this.push(this.objectLiteral(hash.values)); 11303 }, 11304 11305 // [pushString] 11306 // 11307 // On stack, before: ... 11308 // On stack, after: quotedString(string), ... 11309 //
vendor: 6,731 bytes, lines 11310-11523
11310 // Push a quoted version of `string` onto the stack 11311 pushString: function pushString(string) { 11312 this.pushStackLiteral(this.quotedString(string)); 11313 }, 11314 11315 // [pushLiteral] 11316 // 11317 // On stack, before: ... 11318 // On stack, after: value, ... 11319 // 11320 // Pushes a value onto the stack. This operation prevents 11321 // the compiler from creating a temporary variable to hold 11322 // it. 11323 pushLiteral: function pushLiteral(value) { 11324 this.pushStackLiteral(value); 11325 }, 11326 11327 // [pushProgram] 11328 // 11329 // On stack, before: ... 11330 // On stack, after: program(guid), ... 11331 // 11332 // Push a program expression onto the stack. This takes 11333 // a compile-time guid and converts it into a runtime-accessible 11334 // expression. 11335 pushProgram: function pushProgram(guid) { 11336 if (guid != null) { 11337 this.pushStackLiteral(this.programExpression(guid)); 11338 } else { 11339 this.pushStackLiteral(null); 11340 } 11341 }, 11342 11343 // [registerDecorator] 11344 // 11345 // On stack, before: hash, program, params..., ... 11346 // On stack, after: ... 11347 // 11348 // Pops off the decorator's parameters, invokes the decorator, 11349 // and inserts the decorator into the decorators list. 11350 registerDecorator: function registerDecorator(paramSize, name) { 11351 var foundDecorator = this.nameLookup('decorators', name, 'decorator'), 11352 options = this.setupHelperArgs(name, paramSize); 11353 11354 this.decorators.push(['fn = ', this.decorators.functionCall(foundDecorator, '', ['fn', 'props', 'container', options]), ' || fn;']); 11355 }, 11356 11357 // [invokeHelper] 11358 // 11359 // On stack, before: hash, inverse, program, params..., ... 11360 // On stack, after: result of helper invocation 11361 // 11362 // Pops off the helper's parameters, invokes the helper, 11363 // and pushes the helper's return value onto the stack. 11364 // 11365 // If the helper is not found, `helperMissing` is called. 11366 invokeHelper: function invokeHelper(paramSize, name, isSimple) { 11367 var nonHelper = this.popStack(), 11368 helper = this.setupHelper(paramSize, name), 11369 simple = isSimple ? [helper.name, ' || '] : ''; 11370 11371 var lookup = ['('].concat(simple, nonHelper); 11372 if (!this.options.strict) { 11373 lookup.push(' || ', this.aliasable('helpers.helperMissing')); 11374 } 11375 lookup.push(')'); 11376 11377 this.push(this.source.functionCall(lookup, 'call', helper.callParams)); 11378 }, 11379 11380 // [invokeKnownHelper] 11381 // 11382 // On stack, before: hash, inverse, program, params..., ... 11383 // On stack, after: result of helper invocation 11384 // 11385 // This operation is used when the helper is known to exist, 11386 // so a `helperMissing` fallback is not required. 11387 invokeKnownHelper: function invokeKnownHelper(paramSize, name) { 11388 var helper = this.setupHelper(paramSize, name); 11389 this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); 11390 }, 11391 11392 // [invokeAmbiguous] 11393 // 11394 // On stack, before: hash, inverse, program, params..., ... 11395 // On stack, after: result of disambiguation 11396 // 11397 // This operation is used when an expression like `{{foo}}` 11398 // is provided, but we don't know at compile-time whether it 11399 // is a helper or a path. 11400 // 11401 // This operation emits more code than the other options, 11402 // and can be avoided by passing the `knownHelpers` and 11403 // `knownHelpersOnly` flags at compile-time. 11404 invokeAmbiguous: function invokeAmbiguous(name, helperCall) { 11405 this.useRegister('helper'); 11406 11407 var nonHelper = this.popStack(); 11408 11409 this.emptyHash(); 11410 var helper = this.setupHelper(0, name, helperCall); 11411 11412 var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); 11413 11414 var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; 11415 if (!this.options.strict) { 11416 lookup[0] = '(helper = '; 11417 lookup.push(' != null ? helper : ', this.aliasable('helpers.helperMissing')); 11418 } 11419 11420 this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']); 11421 }, 11422 11423 // [invokePartial] 11424 // 11425 // On stack, before: context, ... 11426 // On stack after: result of partial invocation 11427 // 11428 // This operation pops off a context, invokes a partial with that context, 11429 // and pushes the result of the invocation back. 11430 invokePartial: function invokePartial(isDynamic, name, indent) { 11431 var params = [], 11432 options = this.setupParams(name, 1, params); 11433 11434 if (isDynamic) { 11435 name = this.popStack(); 11436 delete options.name; 11437 } 11438 11439 if (indent) { 11440 options.indent = JSON.stringify(indent); 11441 } 11442 options.helpers = 'helpers'; 11443 options.partials = 'partials'; 11444 options.decorators = 'container.decorators'; 11445 11446 if (!isDynamic) { 11447 params.unshift(this.nameLookup('partials', name, 'partial')); 11448 } else { 11449 params.unshift(name); 11450 } 11451 11452 if (this.options.compat) { 11453 options.depths = 'depths'; 11454 } 11455 options = this.objectLiteral(options); 11456 params.push(options); 11457 11458 this.push(this.source.functionCall('container.invokePartial', '', params)); 11459 }, 11460 11461 // [assignToHash] 11462 // 11463 // On stack, before: value, ..., hash, ... 11464 // On stack, after: ..., hash, ... 11465 // 11466 // Pops a value off the stack and assigns it to the current hash 11467 assignToHash: function assignToHash(key) { 11468 var value = this.popStack(), 11469 context = undefined, 11470 type = undefined, 11471 id = undefined; 11472 11473 if (this.trackIds) { 11474 id = this.popStack(); 11475 } 11476 if (this.stringParams) { 11477 type = this.popStack(); 11478 context = this.popStack(); 11479 } 11480 11481 var hash = this.hash; 11482 if (context) { 11483 hash.contexts[key] = context; 11484 } 11485 if (type) { 11486 hash.types[key] = type; 11487 } 11488 if (id) { 11489 hash.ids[key] = id; 11490 } 11491 hash.values[key] = value; 11492 }, 11493 11494 pushId: function pushId(type, name, child) { 11495 if (type === 'BlockParam') { 11496 this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : '')); 11497 } else if (type === 'PathExpression') { 11498 this.pushString(name); 11499 } else if (type === 'SubExpression') { 11500 this.pushStackLiteral('true'); 11501 } else { 11502 this.pushStackLiteral('null'); 11503 } 11504 }, 11505 11506 // HELPERS 11507 11508 compiler: JavaScriptCompiler, 11509 11510 compileChildren: function compileChildren(environment, options) { 11511 var children = environment.children, 11512 child = undefined, 11513 compiler = undefined; 11514 11515 for (var i = 0, l = children.length; i < l; i++) { 11516 child = children[i]; 11517 compiler = new this.compiler(); // eslint-disable-line new-cap 11518 11519 var existing = this.matchExistingProgram(child); 11520 11521 if (existing == null) { 11522 this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children 11523 var index = this.context.programs.length
vendor: 7,938 bytes, lines 11523-11811
11523; 11524 child.index = index; 11525 child.name = 'program' + index; 11526 this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); 11527 this.context.decorators[index] = compiler.decorators; 11528 this.context.environments[index] = child; 11529 11530 this.useDepths = this.useDepths || compiler.useDepths; 11531 this.useBlockParams = this.useBlockParams || compiler.useBlockParams; 11532 child.useDepths = this.useDepths; 11533 child.useBlockParams = this.useBlockParams; 11534 } else { 11535 child.index = existing.index; 11536 child.name = 'program' + existing.index; 11537 11538 this.useDepths = this.useDepths || existing.useDepths; 11539 this.useBlockParams = this.useBlockParams || existing.useBlockParams; 11540 } 11541 } 11542 }, 11543 matchExistingProgram: function matchExistingProgram(child) { 11544 for (var i = 0, len = this.context.environments.length; i < len; i++) { 11545 var environment = this.context.environments[i]; 11546 if (environment && environment.equals(child)) { 11547 return environment; 11548 } 11549 } 11550 }, 11551 11552 programExpression: function programExpression(guid) { 11553 var child = this.environment.children[guid], 11554 programParams = [child.index, 'data', child.blockParams]; 11555 11556 if (this.useBlockParams || this.useDepths) { 11557 programParams.push('blockParams'); 11558 } 11559 if (this.useDepths) { 11560 programParams.push('depths'); 11561 } 11562 11563 return 'container.program(' + programParams.join(', ') + ')'; 11564 }, 11565 11566 useRegister: function useRegister(name) { 11567 if (!this.registers[name]) { 11568 this.registers[name] = true; 11569 this.registers.list.push(name); 11570 } 11571 }, 11572 11573 push: function push(expr) { 11574 if (!(expr instanceof Literal)) { 11575 expr = this.source.wrap(expr); 11576 } 11577 11578 this.inlineStack.push(expr); 11579 return expr; 11580 }, 11581 11582 pushStackLiteral: function pushStackLiteral(item) { 11583 this.push(new Literal(item)); 11584 }, 11585 11586 pushSource: function pushSource(source) { 11587 if (this.pendingContent) { 11588 this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation)); 11589 this.pendingContent = undefined; 11590 } 11591 11592 if (source) { 11593 this.source.push(source); 11594 } 11595 }, 11596 11597 replaceStack: function replaceStack(callback) { 11598 var prefix = ['('], 11599 stack = undefined, 11600 createdStack = undefined, 11601 usedLiteral = undefined; 11602 11603 /* istanbul ignore next */ 11604 if (!this.isInline()) { 11605 throw new _exception2['default']('replaceStack on non-inline'); 11606 } 11607 11608 // We want to merge the inline statement into the replacement statement via ',' 11609 var top = this.popStack(true); 11610 11611 if (top instanceof Literal) { 11612 // Literals do not need to be inlined 11613 stack = [top.value]; 11614 prefix = ['(', stack]; 11615 usedLiteral = true; 11616 } else { 11617 // Get or create the current stack name for use by the inline 11618 createdStack = true; 11619 var _name = this.incrStack(); 11620 11621 prefix = ['((', this.push(_name), ' = ', top, ')']; 11622 stack = this.topStack(); 11623 } 11624 11625 var item = callback.call(this, stack); 11626 11627 if (!usedLiteral) { 11628 this.popStack(); 11629 } 11630 if (createdStack) { 11631 this.stackSlot--; 11632 } 11633 this.push(prefix.concat(item, ')')); 11634 }, 11635 11636 incrStack: function incrStack() { 11637 this.stackSlot++; 11638 if (this.stackSlot > this.stackVars.length) { 11639 this.stackVars.push('stack' + this.stackSlot); 11640 } 11641 return this.topStackName(); 11642 }, 11643 topStackName: function topStackName() { 11644 return 'stack' + this.stackSlot; 11645 }, 11646 flushInline: function flushInline() { 11647 var inlineStack = this.inlineStack; 11648 this.inlineStack = []; 11649 for (var i = 0, len = inlineStack.length; i < len; i++) { 11650 var entry = inlineStack[i]; 11651 /* istanbul ignore if */ 11652 if (entry instanceof Literal) { 11653 this.compileStack.push(entry); 11654 } else { 11655 var stack = this.incrStack(); 11656 this.pushSource([stack, ' = ', entry, ';']); 11657 this.compileStack.push(stack); 11658 } 11659 } 11660 }, 11661 isInline: function isInline() { 11662 return this.inlineStack.length; 11663 }, 11664 11665 popStack: function popStack(wrapped) { 11666 var inline = this.isInline(), 11667 item = (inline ? this.inlineStack : this.compileStack).pop(); 11668 11669 if (!wrapped && item instanceof Literal) { 11670 return item.value; 11671 } else { 11672 if (!inline) { 11673 /* istanbul ignore next */ 11674 if (!this.stackSlot) { 11675 throw new _exception2['default']('Invalid stack pop'); 11676 } 11677 this.stackSlot--; 11678 } 11679 return item; 11680 } 11681 }, 11682 11683 topStack: function topStack() { 11684 var stack = this.isInline() ? this.inlineStack : this.compileStack, 11685 item = stack[stack.length - 1]; 11686 11687 /* istanbul ignore if */ 11688 if (item instanceof Literal) { 11689 return item.value; 11690 } else { 11691 return item; 11692 } 11693 }, 11694 11695 contextName: function contextName(context) { 11696 if (this.useDepths && context) { 11697 return 'depths[' + context + ']'; 11698 } else { 11699 return 'depth' + context; 11700 } 11701 }, 11702 11703 quotedString: function quotedString(str) { 11704 return this.source.quotedString(str); 11705 }, 11706 11707 objectLiteral: function objectLiteral(obj) { 11708 return this.source.objectLiteral(obj); 11709 }, 11710 11711 aliasable: function aliasable(name) { 11712 var ret = this.aliases[name]; 11713 if (ret) { 11714 ret.referenceCount++; 11715 return ret; 11716 } 11717 11718 ret = this.aliases[name] = this.source.wrap(name); 11719 ret.aliasable = true; 11720 ret.referenceCount = 1; 11721 11722 return ret; 11723 }, 11724 11725 setupHelper: function setupHelper(paramSize, name, blockHelper) { 11726 var params = [], 11727 paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); 11728 var foundHelper = this.nameLookup('helpers', name, 'helper'), 11729 callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : (container.nullContext || {})'); 11730 11731 return { 11732 params: params, 11733 paramsInit: paramsInit, 11734 name: foundHelper, 11735 callParams: [callContext].concat(params) 11736 }; 11737 }, 11738 11739 setupParams: function setupParams(helper, paramSize, params) { 11740 var options = {}, 11741 contexts = [], 11742 types = [], 11743 ids = [], 11744 objectArgs = !params, 11745 param = undefined; 11746 11747 if (objectArgs) { 11748 params = []; 11749 } 11750 11751 options.name = this.quotedString(helper); 11752 options.hash = this.popStack(); 11753 11754 if (this.trackIds) { 11755 options.hashIds = this.popStack(); 11756 } 11757 if (this.stringParams) { 11758 options.hashTypes = this.popStack(); 11759 options.hashContexts = this.popStack(); 11760 } 11761 11762 var inverse = this.popStack(), 11763 program = this.popStack(); 11764 11765 // Avoid setting fn and inverse if neither are set. This allows 11766 // helpers to do a check for `if (options.fn)` 11767 if (program || inverse) { 11768 options.fn = program || 'container.noop'; 11769 options.inverse = inverse || 'container.noop'; 11770 } 11771 11772 // The parameters go on to the stack in order (making sure that they are evaluated in order) 11773 // so we need to pop them off the stack in reverse order 11774 var i = paramSize; 11775 while (i--) { 11776 param = this.popStack(); 11777 params[i] = param; 11778 11779 if (this.trackIds) { 11780 ids[i] = this.popStack(); 11781 } 11782 if (this.stringParams) { 11783 types[i] = this.popStack(); 11784 contexts[i] = this.popStack(); 11785 } 11786 } 11787 11788 if (objectArgs) { 11789 options.args = this.source.generateArray(params); 11790 } 11791 11792 if (this.trackIds) { 11793 options.ids = this.source.generateArray(ids); 11794 } 11795 if (this.stringParams) { 11796 options.types = this.source.generateArray(types); 11797 options.contexts = this.source.generateArray(contexts); 11798 } 11799 11800 if (this.options.data) { 11801 options.data = 'data'; 11802 } 11803 if (this.useBlockParams) { 11804 options.blockParams = 'blockParams'; 11805 } 11806 return options; 11807 }, 11808 11809 setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) { 11810 var options = this.setupParams(helper, paramSize, params); 11811 options
vendor: 986 bytes, lines 11811-11834
11811 = this.objectLiteral(options); 11812 if (useRegister) { 11813 this.useRegister('options'); 11814 params.push('options'); 11815 return ['options=', options]; 11816 } else if (params) { 11817 params.push(options); 11818 return ''; 11819 } else { 11820 return options; 11821 } 11822 } 11823}; 11824 11825(function () { 11826 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(' '); 11827 11828 var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; 11829 11830 for (var i = 0, l = reservedWords.length; i < l; i++) { 11831 compilerWords[reservedWords[i]] = true; 11832 } 11833})(); 11834
11835JavaScriptCompiler.isValidJavaScriptVariableName = function (name) { 11836 return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); 11837}; 11838 11839function strictLookup(requireTerminal, compiler, parts, type) { 11840 var stack = compiler.popStack(), 11841 i = 0, 11842 len = parts.length; 11843 if (requireTerminal) { 11844 len--; 11845 } 11846 11847 for (; i < len; i++) { 11848 stack = compiler.nameLookup(stack, parts[i], type); 11849 } 11850 11851 if (requireTerminal) { 11852 return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')']; 11853 } else { 11854 return stack; 11855 } 11856} 11857 11858exports['default'] = JavaScriptCompiler; 11859module.exports = exports['default']; 11860 11861 11862},{"../base":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/base.js","../exception":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/exception.js","../utils":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/utils.js","./code-gen":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/code-gen.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js":[function(require,module,exports){ 11863// File ignored in coverage tests via setting in .istanbul.yml 11864/* Jison generated parser */ 11865"use strict"; 11866 11867exports.__esModule = true; 11868var handlebars = (function () { 11869 var parser = { trace: function trace() {}, 11870 yy: {}, 11871 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 }, 11872 terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "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" }, 11873 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,
vendor: 25,117 bytes, lines 11873-12128
118731], [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]], 11874 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$ 11875 /**/) { 11876 11877 var $0 = $$.length - 1; 11878 switch (yystate) { 11879 case 1: 11880 return $$[$0 - 1]; 11881 break; 11882 case 2: 11883 this.$ = yy.prepareProgram($$[$0]); 11884 break; 11885 case 3: 11886 this.$ = $$[$0]; 11887 break; 11888 case 4: 11889 this.$ = $$[$0]; 11890 break; 11891 case 5: 11892 this.$ = $$[$0]; 11893 break; 11894 case 6: 11895 this.$ = $$[$0]; 11896 break; 11897 case 7: 11898 this.$ = $$[$0]; 11899 break; 11900 case 8: 11901 this.$ = $$[$0]; 11902 break; 11903 case 9: 11904 this.$ = { 11905 type: 'CommentStatement', 11906 value: yy.stripComment($$[$0]), 11907 strip: yy.stripFlags($$[$0], $$[$0]), 11908 loc: yy.locInfo(this._$) 11909 }; 11910 11911 break; 11912 case 10: 11913 this.$ = { 11914 type: 'ContentStatement', 11915 original: $$[$0], 11916 value: $$[$0], 11917 loc: yy.locInfo(this._$) 11918 }; 11919 11920 break; 11921 case 11: 11922 this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 11923 break; 11924 case 12: 11925 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] }; 11926 break; 11927 case 13: 11928 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$); 11929 break; 11930 case 14: 11931 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$); 11932 break; 11933 case 15: 11934 this.$ = { open: $$[$0 - 5], path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 11935 break; 11936 case 16: 11937 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 11938 break; 11939 case 17: 11940 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 11941 break; 11942 case 18: 11943 this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] }; 11944 break; 11945 case 19: 11946 var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$), 11947 program = yy.prepareProgram([inverse], $$[$0 - 1].loc); 11948 program.chained = true; 11949 11950 this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true }; 11951 11952 break; 11953 case 20: 11954 this.$ = $$[$0]; 11955 break; 11956 case 21: 11957 this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) }; 11958 break; 11959 case 22: 11960 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 11961 break; 11962 case 23: 11963 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 11964 break; 11965 case 24: 11966 this.$ = { 11967 type: 'PartialStatement', 11968 name: $$[$0 - 3], 11969 params: $$[$0 - 2], 11970 hash: $$[$0 - 1], 11971 indent: '', 11972 strip: yy.stripFlags($$[$0 - 4], $$[$0]), 11973 loc: yy.locInfo(this._$) 11974 }; 11975 11976 break; 11977 case 25: 11978 this.$ = yy.preparePartialBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 11979 break; 11980 case 26: 11981 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 4], $$[$0]) }; 11982 break; 11983 case 27: 11984 this.$ = $$[$0]; 11985 break; 11986 case 28: 11987 this.$ = $$[$0]; 11988 break; 11989 case 29: 11990 this.$ = { 11991 type: 'SubExpression', 11992 path: $$[$0 - 3], 11993 params: $$[$0 - 2], 11994 hash: $$[$0 - 1], 11995 loc: yy.locInfo(this._$) 11996 }; 11997 11998 break; 11999 case 30: 12000 this.$ = { type: 'Hash', pairs: $$[$0], loc: yy.locInfo(this._$) }; 12001 break; 12002 case 31: 12003 this.$ = { type: 'HashPair', key: yy.id($$[$0 - 2]), value: $$[$0], loc: yy.locInfo(this._$) }; 12004 break; 12005 case 32: 12006 this.$ = yy.id($$[$0 - 1]); 12007 break; 12008 case 33: 12009 this.$ = $$[$0]; 12010 break; 12011 case 34: 12012 this.$ = $$[$0]; 12013 break; 12014 case 35: 12015 this.$ = { type: 'StringLiteral', value: $$[$0], original: $$[$0], loc: yy.locInfo(this._$) }; 12016 break; 12017 case 36: 12018 this.$ = { type: 'NumberLiteral', value: Number($$[$0]), original: Number($$[$0]), loc: yy.locInfo(this._$) }; 12019 break; 12020 case 37: 12021 this.$ = { type: 'BooleanLiteral', value: $$[$0] === 'true', original: $$[$0] === 'true', loc: yy.locInfo(this._$) }; 12022 break; 12023 case 38: 12024 this.$ = { type: 'UndefinedLiteral', original: undefined, value: undefined, loc: yy.locInfo(this._$) }; 12025 break; 12026 case 39: 12027 this.$ = { type: 'NullLiteral', original: null, value: null, loc: yy.locInfo(this._$) }; 12028 break; 12029 case 40: 12030 this.$ = $$[$0]; 12031 break; 12032 case 41: 12033 this.$ = $$[$0]; 12034 break; 12035 case 42: 12036 this.$ = yy.preparePath(true, $$[$0], this._$); 12037 break; 12038 case 43: 12039 this.$ = yy.preparePath(false, $$[$0], this._$); 12040 break; 12041 case 44: 12042 $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2]; 12043 break; 12044 case 45: 12045 this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }]; 12046 break; 12047 case 46: 12048 this.$ = []; 12049 break; 12050 case 47: 12051 $$[$0 - 1].push($$[$0]); 12052 break; 12053 case 48: 12054 this.$ = [$$[$0]]; 12055 break; 12056 case 49: 12057 $$[$0 - 1].push($$[$0]); 12058 break; 12059 case 50: 12060 this.$ = []; 12061 break; 12062 case 51: 12063 $$[$0 - 1].push($$[$0]); 12064 break; 12065 case 58: 12066 this.$ = []; 12067 break; 12068 case 59: 12069 $$[$0 - 1].push($$[$0]); 12070 break; 12071 case 64: 12072 this.$ = []; 12073 break; 12074 case 65: 12075 $$[$0 - 1].push($$[$0]); 12076 break; 12077 case 70: 12078 this.$ = []; 12079 break; 12080 case 71: 12081 $$[$0 - 1].push($$[$0]); 12082 break; 12083 case 78: 12084 this.$ = []; 12085 break; 12086 case 79: 12087 $$[$0 - 1].push($$[$0]); 12088 break; 12089 case 82: 12090 this.$ = []; 12091 break; 12092 case 83: 12093 $$[$0 - 1].push($$[$0]); 12094 break; 12095 case 86: 12096 this.$ = []; 12097 break; 12098 case 87: 12099 $$[$0 - 1].push($$[$0]); 12100 break; 12101 case 90: 12102 this.$ = []; 12103 break; 12104 case 91: 12105 $$[$0 - 1].push($$[$0]); 12106 break; 12107 case 94: 12108 this.$ = []; 12109 break; 12110 case 95: 12111 $$[$0 - 1].push($$[$0]); 12112 break; 12113 case 98: 12114 this.$ = [$$[$0]]; 12115 break; 12116 case 99: 12117 $$[$0 - 1].push($$[$0]); 12118 break; 12119 case 100: 12120 this.$ = [$$[$0]]; 12121 break; 12122 case 101: 12123 $$[$0 - 1].push($$[$0]); 12124 break; 12125 } 12126 }, 12127 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] }], 12128 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
12128], 120: [2, 63], 123: [2, 69], 124: [2, 12], 136: [2, 75], 137
vendor: 13,145 bytes, lines 12128-12412
12128: [2, 32] }, 12129 parseError: function parseError(str, hash) { 12130 throw new Error(str); 12131 }, 12132 parse: function parse(input) { 12133 var self = this, 12134 stack = [0], 12135 vstack = [null], 12136 lstack = [], 12137 table = this.table, 12138 yytext = "", 12139 yylineno = 0, 12140 yyleng = 0, 12141 recovering = 0, 12142 TERROR = 2, 12143 EOF = 1; 12144 this.lexer.setInput(input); 12145 this.lexer.yy = this.yy; 12146 this.yy.lexer = this.lexer; 12147 this.yy.parser = this; 12148 if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {}; 12149 var yyloc = this.lexer.yylloc; 12150 lstack.push(yyloc); 12151 var ranges = this.lexer.options && this.lexer.options.ranges; 12152 if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError; 12153 function popStack(n) { 12154 stack.length = stack.length - 2 * n; 12155 vstack.length = vstack.length - n; 12156 lstack.length = lstack.length - n; 12157 } 12158 function lex() { 12159 var token; 12160 token = self.lexer.lex() || 1; 12161 if (typeof token !== "number") { 12162 token = self.symbols_[token] || token; 12163 } 12164 return token; 12165 } 12166 var symbol, 12167 preErrorSymbol, 12168 state, 12169 action, 12170 a, 12171 r, 12172 yyval = {}, 12173 p, 12174 len, 12175 newState, 12176 expected; 12177 while (true) { 12178 state = stack[stack.length - 1]; 12179 if (this.defaultActions[state]) { 12180 action = this.defaultActions[state]; 12181 } else { 12182 if (symbol === null || typeof symbol == "undefined") { 12183 symbol = lex(); 12184 } 12185 action = table[state] && table[state][symbol]; 12186 } 12187 if (typeof action === "undefined" || !action.length || !action[0]) { 12188 var errStr = ""; 12189 if (!recovering) { 12190 expected = []; 12191 for (p in table[state]) if (this.terminals_[p] && p > 2) { 12192 expected.push("'" + this.terminals_[p] + "'"); 12193 } 12194 if (this.lexer.showPosition) { 12195 errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; 12196 } else { 12197 errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); 12198 } 12199 this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected }); 12200 } 12201 } 12202 if (action[0] instanceof Array && action.length > 1) { 12203 throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); 12204 } 12205 switch (action[0]) { 12206 case 1: 12207 stack.push(symbol); 12208 vstack.push(this.lexer.yytext); 12209 lstack.push(this.lexer.yylloc); 12210 stack.push(action[1]); 12211 symbol = null; 12212 if (!preErrorSymbol) { 12213 yyleng = this.lexer.yyleng; 12214 yytext = this.lexer.yytext; 12215 yylineno = this.lexer.yylineno; 12216 yyloc = this.lexer.yylloc; 12217 if (recovering > 0) recovering--; 12218 } else { 12219 symbol = preErrorSymbol; 12220 preErrorSymbol = null; 12221 } 12222 break; 12223 case 2: 12224 len = this.productions_[action[1]][1]; 12225 yyval.$ = vstack[vstack.length - len]; 12226 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 }; 12227 if (ranges) { 12228 yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; 12229 } 12230 r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); 12231 if (typeof r !== "undefined") { 12232 return r; 12233 } 12234 if (len) { 12235 stack = stack.slice(0, -1 * len * 2); 12236 vstack = vstack.slice(0, -1 * len); 12237 lstack = lstack.slice(0, -1 * len); 12238 } 12239 stack.push(this.productions_[action[1]][0]); 12240 vstack.push(yyval.$); 12241 lstack.push(yyval._$); 12242 newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; 12243 stack.push(newState); 12244 break; 12245 case 3: 12246 return true; 12247 } 12248 } 12249 return true; 12250 } 12251 }; 12252 /* Jison generated lexer */ 12253 var lexer = (function () { 12254 var lexer = { EOF: 1, 12255 parseError: function parseError(str, hash) { 12256 if (this.yy.parser) { 12257 this.yy.parser.parseError(str, hash); 12258 } else { 12259 throw new Error(str); 12260 } 12261 }, 12262 setInput: function setInput(input) { 12263 this._input = input; 12264 this._more = this._less = this.done = false; 12265 this.yylineno = this.yyleng = 0; 12266 this.yytext = this.matched = this.match = ''; 12267 this.conditionStack = ['INITIAL']; 12268 this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; 12269 if (this.options.ranges) this.yylloc.range = [0, 0]; 12270 this.offset = 0; 12271 return this; 12272 }, 12273 input: function input() { 12274 var ch = this._input[0]; 12275 this.yytext += ch; 12276 this.yyleng++; 12277 this.offset++; 12278 this.match += ch; 12279 this.matched += ch; 12280 var lines = ch.match(/(?:\r\n?|\n).*/g); 12281 if (lines) { 12282 this.yylineno++; 12283 this.yylloc.last_line++; 12284 } else { 12285 this.yylloc.last_column++; 12286 } 12287 if (this.options.ranges) this.yylloc.range[1]++; 12288 12289 this._input = this._input.slice(1); 12290 return ch; 12291 }, 12292 unput: function unput(ch) { 12293 var len = ch.length; 12294 var lines = ch.split(/(?:\r\n?|\n)/g); 12295 12296 this._input = ch + this._input; 12297 this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); 12298 //this.yyleng -= len; 12299 this.offset -= len; 12300 var oldLines = this.match.split(/(?:\r\n?|\n)/g); 12301 this.match = this.match.substr(0, this.match.length - 1); 12302 this.matched = this.matched.substr(0, this.matched.length - 1); 12303 12304 if (lines.length - 1) this.yylineno -= lines.length - 1; 12305 var r = this.yylloc.range; 12306 12307 this.yylloc = { first_line: this.yylloc.first_line, 12308 last_line: this.yylineno + 1, 12309 first_column: this.yylloc.first_column, 12310 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 12311 }; 12312 12313 if (this.options.ranges) { 12314 this.yylloc.range = [r[0], r[0] + this.yyleng - len]; 12315 } 12316 return this; 12317 }, 12318 more: function more() { 12319 this._more = true; 12320 return this; 12321 }, 12322 less: function less(n) { 12323 this.unput(this.match.slice(n)); 12324 }, 12325 pastInput: function pastInput() { 12326 var past = this.matched.substr(0, this.matched.length - this.match.length); 12327 return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); 12328 }, 12329 upcomingInput: function upcomingInput() { 12330 var next = this.match; 12331 if (next.length < 20) { 12332 next += this._input.substr(0, 20 - next.length); 12333 } 12334 return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); 12335 }, 12336 showPosition: function showPosition() { 12337 var pre = this.pastInput(); 12338 var c = new Array(pre.length + 1).join("-"); 12339 return pre + this.upcomingInput() + "\n" + c + "^"; 12340 }, 12341 next: function next() { 12342 if (this.done) { 12343 return this.EOF; 12344 } 12345 if (!this._input) this.done = true; 12346 12347 var token, match, tempMatch, index, col, lines; 12348 if (!this._more) { 12349 this.yytext = ''; 12350 this.match = ''; 12351 } 12352 var rules = this._currentRules(); 12353 for (var i = 0; i < rules.length; i++) { 12354 tempMatch = this._input.match(this.rules[rules[i]]); 12355 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { 12356 match = tempMatch; 12357 index = i; 12358 if (!this.options.flex) break; 12359 } 12360 } 12361 if (match) { 12362 lines = match[0].match(/(?:\r\n?|\n).*/g); 12363 if (lines) this.yylineno += lines.length; 12364 this.yylloc = { first_line: this.yylloc.last_line, 12365 last_line: this.yylineno + 1, 12366 first_column: this.yylloc.last_column, 12367 last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; 12368 this.yytext += match[0]; 12369 this.match += match[0]; 12370 this.matches = match; 12371 this.yyleng = this.yytext.length; 12372 if (this.options.ranges) { 12373 this.yylloc.range = [this.offset, this.offset += this.yyleng]; 12374 } 12375 this._more = false; 12376 this._input = this._input.slice(match[0].length); 12377 this.matched += match[0]; 12378 token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]); 12379 if (this.done && this._input) this.done = false; 12380 if (token) return token;else return; 12381 } 12382 if (this._input === "") { 12383 return this.EOF; 12384 } else { 12385 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); 12386 } 12387 }, 12388 lex: function lex() { 12389 var r = this.next(); 12390 if (typeof r !== 'undefined') { 12391 return r; 12392 } else { 12393 return this.lex(); 12394 } 12395 }, 12396 begin: function begin(condition) { 12397 this.conditionStack.push(condition); 12398 }, 12399 popState: function popState() { 12400 return this.conditionStack.pop(); 12401 }, 12402 _currentRules: function _currentRules() { 12403 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; 12404 }, 12405 topState: function topState() { 12406 return this.conditionStack[this.conditionStack.length - 2]; 12407 }, 12408 pushState: function begin(condition) { 12409 this.begin(condition); 12410 } }; 12411 lexer.options = {}; 12412 lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START
vendor: 6,975 bytes, lines 12412-12592
12412 12413 /**/) { 12414 12415 function strip(start, end) { 12416 return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng - end); 12417 } 12418 12419 var YYSTATE = YY_START; 12420 switch ($avoiding_name_collisions) { 12421 case 0: 12422 if (yy_.yytext.slice(-2) === "\\\\") { 12423 strip(0, 1); 12424 this.begin("mu"); 12425 } else if (yy_.yytext.slice(-1) === "\\") { 12426 strip(0, 1); 12427 this.begin("emu"); 12428 } else { 12429 this.begin("mu"); 12430 } 12431 if (yy_.yytext) return 15; 12432 12433 break; 12434 case 1: 12435 return 15; 12436 break; 12437 case 2: 12438 this.popState(); 12439 return 15; 12440 12441 break; 12442 case 3: 12443 this.begin('raw');return 15; 12444 break; 12445 case 4: 12446 this.popState(); 12447 // Should be using `this.topState()` below, but it currently 12448 // returns the second top instead of the first top. Opened an 12449 // issue about it at https://github.com/zaach/jison/issues/291 12450 if (this.conditionStack[this.conditionStack.length - 1] === 'raw') { 12451 return 15; 12452 } else { 12453 yy_.yytext = yy_.yytext.substr(5, yy_.yyleng - 9); 12454 return 'END_RAW_BLOCK'; 12455 } 12456 12457 break; 12458 case 5: 12459 return 15; 12460 break; 12461 case 6: 12462 this.popState(); 12463 return 14; 12464 12465 break; 12466 case 7: 12467 return 65; 12468 break; 12469 case 8: 12470 return 68; 12471 break; 12472 case 9: 12473 return 19; 12474 break; 12475 case 10: 12476 this.popState(); 12477 this.begin('raw'); 12478 return 23; 12479 12480 break; 12481 case 11: 12482 return 55; 12483 break; 12484 case 12: 12485 return 60; 12486 break; 12487 case 13: 12488 return 29; 12489 break; 12490 case 14: 12491 return 47; 12492 break; 12493 case 15: 12494 this.popState();return 44; 12495 break; 12496 case 16: 12497 this.popState();return 44; 12498 break; 12499 case 17: 12500 return 34; 12501 break; 12502 case 18: 12503 return 39; 12504 break; 12505 case 19: 12506 return 51; 12507 break; 12508 case 20: 12509 return 48; 12510 break; 12511 case 21: 12512 this.unput(yy_.yytext); 12513 this.popState(); 12514 this.begin('com'); 12515 12516 break; 12517 case 22: 12518 this.popState(); 12519 return 14; 12520 12521 break; 12522 case 23: 12523 return 48; 12524 break; 12525 case 24: 12526 return 73; 12527 break; 12528 case 25: 12529 return 72; 12530 break; 12531 case 26: 12532 return 72; 12533 break; 12534 case 27: 12535 return 87; 12536 break; 12537 case 28: 12538 // ignore whitespace 12539 break; 12540 case 29: 12541 this.popState();return 54; 12542 break; 12543 case 30: 12544 this.popState();return 33; 12545 break; 12546 case 31: 12547 yy_.yytext = strip(1, 2).replace(/\\"/g, '"');return 80; 12548 break; 12549 case 32: 12550 yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 80; 12551 break; 12552 case 33: 12553 return 85; 12554 break; 12555 case 34: 12556 return 82; 12557 break; 12558 case 35: 12559 return 82; 12560 break; 12561 case 36: 12562 return 83; 12563 break; 12564 case 37: 12565 return 84; 12566 break; 12567 case 38: 12568 return 81; 12569 break; 12570 case 39: 12571 return 75; 12572 break; 12573 case 40: 12574 return 77; 12575 break; 12576 case 41: 12577 return 72; 12578 break; 12579 case 42: 12580 yy_.yytext = yy_.yytext.replace(/\\([\\\]])/g, '$1');return 72; 12581 break; 12582 case 43: 12583 return 'INVALID'; 12584 break; 12585 case 44: 12586 return 5; 12587 break; 12588 } 12589 }; 12590 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\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/]; 12591 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 } }; 12592 return lexer;
vendor: 4,601 bytes, lines 12593-12774
12593 })(); 12594 parser.lexer = lexer; 12595 function Parser() { 12596 this.yy = {}; 12597 }Parser.prototype = parser;parser.Parser = Parser; 12598 return new Parser(); 12599})();exports["default"] = handlebars; 12600module.exports = exports["default"]; 12601 12602 12603},{}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/printer.js":[function(require,module,exports){ 12604/* eslint-disable new-cap */ 12605'use strict'; 12606 12607exports.__esModule = true; 12608exports.print = print; 12609exports.PrintVisitor = PrintVisitor; 12610// istanbul ignore next 12611 12612function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 12613 12614var _visitor = require('./visitor'); 12615 12616var _visitor2 = _interopRequireDefault(_visitor); 12617 12618function print(ast) { 12619 return new PrintVisitor().accept(ast); 12620} 12621 12622function PrintVisitor() { 12623 this.padding = 0; 12624} 12625 12626PrintVisitor.prototype = new _visitor2['default'](); 12627 12628PrintVisitor.prototype.pad = function (string) { 12629 var out = ''; 12630 12631 for (var i = 0, l = this.padding; i < l; i++) { 12632 out += ' '; 12633 } 12634 12635 out += string + '\n'; 12636 return out; 12637}; 12638 12639PrintVisitor.prototype.Program = function (program) { 12640 var out = '', 12641 body = program.body, 12642 i = undefined, 12643 l = undefined; 12644 12645 if (program.blockParams) { 12646 var blockParams = 'BLOCK PARAMS: ['; 12647 for (i = 0, l = program.blockParams.length; i < l; i++) { 12648 blockParams += ' ' + program.blockParams[i]; 12649 } 12650 blockParams += ' ]'; 12651 out += this.pad(blockParams); 12652 } 12653 12654 for (i = 0, l = body.length; i < l; i++) { 12655 out += this.accept(body[i]); 12656 } 12657 12658 this.padding--; 12659 12660 return out; 12661}; 12662 12663PrintVisitor.prototype.MustacheStatement = function (mustache) { 12664 return this.pad('{{ ' + this.SubExpression(mustache) + ' }}'); 12665}; 12666PrintVisitor.prototype.Decorator = function (mustache) { 12667 return this.pad('{{ DIRECTIVE ' + this.SubExpression(mustache) + ' }}'); 12668}; 12669 12670PrintVisitor.prototype.BlockStatement = PrintVisitor.prototype.DecoratorBlock = function (block) { 12671 var out = ''; 12672 12673 out += this.pad((block.type === 'DecoratorBlock' ? 'DIRECTIVE ' : '') + 'BLOCK:'); 12674 this.padding++; 12675 out += this.pad(this.SubExpression(block)); 12676 if (block.program) { 12677 out += this.pad('PROGRAM:'); 12678 this.padding++; 12679 out += this.accept(block.program); 12680 this.padding--; 12681 } 12682 if (block.inverse) { 12683 if (block.program) { 12684 this.padding++; 12685 } 12686 out += this.pad('{{^}}'); 12687 this.padding++; 12688 out += this.accept(block.inverse); 12689 this.padding--; 12690 if (block.program) { 12691 this.padding--; 12692 } 12693 } 12694 this.padding--; 12695 12696 return out; 12697}; 12698 12699PrintVisitor.prototype.PartialStatement = function (partial) { 12700 var content = 'PARTIAL:' + partial.name.original; 12701 if (partial.params[0]) { 12702 content += ' ' + this.accept(partial.params[0]); 12703 } 12704 if (partial.hash) { 12705 content += ' ' + this.accept(partial.hash); 12706 } 12707 return this.pad('{{> ' + content + ' }}'); 12708}; 12709PrintVisitor.prototype.PartialBlockStatement = function (partial) { 12710 var content = 'PARTIAL BLOCK:' + partial.name.original; 12711 if (partial.params[0]) { 12712 content += ' ' + this.accept(partial.params[0]); 12713 } 12714 if (partial.hash) { 12715 content += ' ' + this.accept(partial.hash); 12716 } 12717 12718 content += ' ' + this.pad('PROGRAM:'); 12719 this.padding++; 12720 content += this.accept(partial.program); 12721 this.padding--; 12722 12723 return this.pad('{{> ' + content + ' }}'); 12724}; 12725 12726PrintVisitor.prototype.ContentStatement = function (content) { 12727 return this.pad("CONTENT[ '" + content.value + "' ]"); 12728}; 12729 12730PrintVisitor.prototype.CommentStatement = function (comment) { 12731 return this.pad("{{! '" + comment.value + "' }}"); 12732}; 12733 12734PrintVisitor.prototype.SubExpression = function (sexpr) { 12735 var params = sexpr.params, 12736 paramStrings = [], 12737 hash = undefined; 12738 12739 for (var i = 0, l = params.length; i < l; i++) { 12740 paramStrings.push(this.accept(params[i])); 12741 } 12742 12743 params = '[' + paramStrings.join(', ') + ']'; 12744 12745 hash = sexpr.hash ? ' ' + this.accept(sexpr.hash) : ''; 12746 12747 return this.accept(sexpr.path) + ' ' + params + hash; 12748}; 12749 12750PrintVisitor.prototype.PathExpression = function (id) { 12751 var path = id.parts.join('/'); 12752 return (id.data ? '@' : '') + 'PATH:' + path; 12753}; 12754 12755PrintVisitor.prototype.StringLiteral = function (string) { 12756 return '"' + string.value + '"'; 12757}; 12758 12759PrintVisitor.prototype.NumberLiteral = function (number) { 12760 return 'NUMBER{' + number.value + '}'; 12761}; 12762 12763PrintVisitor.prototype.BooleanLiteral = function (bool) { 12764 return 'BOOLEAN{' + bool.value + '}'; 12765}; 12766 12767PrintVisitor.prototype.UndefinedLiteral = function () { 12768 return 'UNDEFINED'; 12769}; 12770 12771PrintVisitor.prototype.NullLiteral = function () { 12772 return 'NULL'; 12773}; 12774
vendor: 5,350 bytes, lines 12775-12954
12775PrintVisitor.prototype.Hash = function (hash) { 12776 var pairs = hash.pairs, 12777 joinedPairs = []; 12778 12779 for (var i = 0, l = pairs.length; i < l; i++) { 12780 joinedPairs.push(this.accept(pairs[i])); 12781 } 12782 12783 return 'HASH{' + joinedPairs.join(', ') + '}'; 12784}; 12785PrintVisitor.prototype.HashPair = function (pair) { 12786 return pair.key + '=' + this.accept(pair.value); 12787}; 12788/* eslint-enable new-cap */ 12789 12790 12791},{"./visitor":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/visitor.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/visitor.js":[function(require,module,exports){ 12792'use strict'; 12793 12794exports.__esModule = true; 12795// istanbul ignore next 12796 12797function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 12798 12799var _exception = require('../exception'); 12800 12801var _exception2 = _interopRequireDefault(_exception); 12802 12803function Visitor() { 12804 this.parents = []; 12805} 12806 12807Visitor.prototype = { 12808 constructor: Visitor, 12809 mutating: false, 12810 12811 // Visits a given value. If mutating, will replace the value if necessary. 12812 acceptKey: function acceptKey(node, name) { 12813 var value = this.accept(node[name]); 12814 if (this.mutating) { 12815 // Hacky sanity check: This may have a few false positives for type for the helper 12816 // methods but will generally do the right thing without a lot of overhead. 12817 if (value && !Visitor.prototype[value.type]) { 12818 throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); 12819 } 12820 node[name] = value; 12821 } 12822 }, 12823 12824 // Performs an accept operation with added sanity check to ensure 12825 // required keys are not removed. 12826 acceptRequired: function acceptRequired(node, name) { 12827 this.acceptKey(node, name); 12828 12829 if (!node[name]) { 12830 throw new _exception2['default'](node.type + ' requires ' + name); 12831 } 12832 }, 12833 12834 // Traverses a given array. If mutating, empty respnses will be removed 12835 // for child elements. 12836 acceptArray: function acceptArray(array) { 12837 for (var i = 0, l = array.length; i < l; i++) { 12838 this.acceptKey(array, i); 12839 12840 if (!array[i]) { 12841 array.splice(i, 1); 12842 i--; 12843 l--; 12844 } 12845 } 12846 }, 12847 12848 accept: function accept(object) { 12849 if (!object) { 12850 return; 12851 } 12852 12853 /* istanbul ignore next: Sanity code */ 12854 if (!this[object.type]) { 12855 throw new _exception2['default']('Unknown type: ' + object.type, object); 12856 } 12857 12858 if (this.current) { 12859 this.parents.unshift(this.current); 12860 } 12861 this.current = object; 12862 12863 var ret = this[object.type](object); 12864 12865 this.current = this.parents.shift(); 12866 12867 if (!this.mutating || ret) { 12868 return ret; 12869 } else if (ret !== false) { 12870 return object; 12871 } 12872 }, 12873 12874 Program: function Program(program) { 12875 this.acceptArray(program.body); 12876 }, 12877 12878 MustacheStatement: visitSubExpression, 12879 Decorator: visitSubExpression, 12880 12881 BlockStatement: visitBlock, 12882 DecoratorBlock: visitBlock, 12883 12884 PartialStatement: visitPartial, 12885 PartialBlockStatement: function PartialBlockStatement(partial) { 12886 visitPartial.call(this, partial); 12887 12888 this.acceptKey(partial, 'program'); 12889 }, 12890 12891 ContentStatement: function ContentStatement() /* content */{}, 12892 CommentStatement: function CommentStatement() /* comment */{}, 12893 12894 SubExpression: visitSubExpression, 12895 12896 PathExpression: function PathExpression() /* path */{}, 12897 12898 StringLiteral: function StringLiteral() /* string */{}, 12899 NumberLiteral: function NumberLiteral() /* number */{}, 12900 BooleanLiteral: function BooleanLiteral() /* bool */{}, 12901 UndefinedLiteral: function UndefinedLiteral() /* literal */{}, 12902 NullLiteral: function NullLiteral() /* literal */{}, 12903 12904 Hash: function Hash(hash) { 12905 this.acceptArray(hash.pairs); 12906 }, 12907 HashPair: function HashPair(pair) { 12908 this.acceptRequired(pair, 'value'); 12909 } 12910}; 12911 12912function visitSubExpression(mustache) { 12913 this.acceptRequired(mustache, 'path'); 12914 this.acceptArray(mustache.params); 12915 this.acceptKey(mustache, 'hash'); 12916} 12917function visitBlock(block) { 12918 visitSubExpression.call(this, block); 12919 12920 this.acceptKey(block, 'program'); 12921 this.acceptKey(block, 'inverse'); 12922} 12923function visitPartial(partial) { 12924 this.acceptRequired(partial, 'name'); 12925 this.acceptArray(partial.params); 12926 this.acceptKey(partial, 'hash'); 12927} 12928 12929exports['default'] = Visitor; 12930module.exports = exports['default']; 12931 12932 12933},{"../exception":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/exception.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/whitespace-control.js":[function(require,module,exports){ 12934'use strict'; 12935 12936exports.__esModule = true; 12937// istanbul ignore next 12938 12939function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 12940 12941var _visitor = require('./visitor'); 12942 12943var _visitor2 = _interopRequireDefault(_visitor); 12944 12945function WhitespaceControl() { 12946 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; 12947 12948 this.options = options; 12949} 12950WhitespaceControl.prototype = new _visitor2['default'](); 12951 12952WhitespaceControl.prototype.Program = function (program) { 12953 var doStandalone = !this.options.ignoreStandalone; 12954
vendor: 15,600 bytes, lines 12955-13421
12955 var isRoot = !this.isRootSeen; 12956 this.isRootSeen = true; 12957 12958 var body = program.body; 12959 for (var i = 0, l = body.length; i < l; i++) { 12960 var current = body[i], 12961 strip = this.accept(current); 12962 12963 if (!strip) { 12964 continue; 12965 } 12966 12967 var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), 12968 _isNextWhitespace = isNextWhitespace(body, i, isRoot), 12969 openStandalone = strip.openStandalone && _isPrevWhitespace, 12970 closeStandalone = strip.closeStandalone && _isNextWhitespace, 12971 inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; 12972 12973 if (strip.close) { 12974 omitRight(body, i, true); 12975 } 12976 if (strip.open) { 12977 omitLeft(body, i, true); 12978 } 12979 12980 if (doStandalone && inlineStandalone) { 12981 omitRight(body, i); 12982 12983 if (omitLeft(body, i)) { 12984 // If we are on a standalone node, save the indent info for partials 12985 if (current.type === 'PartialStatement') { 12986 // Pull out the whitespace from the final line 12987 current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1]; 12988 } 12989 } 12990 } 12991 if (doStandalone && openStandalone) { 12992 omitRight((current.program || current.inverse).body); 12993 12994 // Strip out the previous content node if it's whitespace only 12995 omitLeft(body, i); 12996 } 12997 if (doStandalone && closeStandalone) { 12998 // Always strip the next node 12999 omitRight(body, i); 13000 13001 omitLeft((current.inverse || current.program).body); 13002 } 13003 } 13004 13005 return program; 13006}; 13007 13008WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) { 13009 this.accept(block.program); 13010 this.accept(block.inverse); 13011 13012 // Find the inverse program that is involed with whitespace stripping. 13013 var program = block.program || block.inverse, 13014 inverse = block.program && block.inverse, 13015 firstInverse = inverse, 13016 lastInverse = inverse; 13017 13018 if (inverse && inverse.chained) { 13019 firstInverse = inverse.body[0].program; 13020 13021 // Walk the inverse chain to find the last inverse that is actually in the chain. 13022 while (lastInverse.chained) { 13023 lastInverse = lastInverse.body[lastInverse.body.length - 1].program; 13024 } 13025 } 13026 13027 var strip = { 13028 open: block.openStrip.open, 13029 close: block.closeStrip.close, 13030 13031 // Determine the standalone candiacy. Basically flag our content as being possibly standalone 13032 // so our parent can determine if we actually are standalone 13033 openStandalone: isNextWhitespace(program.body), 13034 closeStandalone: isPrevWhitespace((firstInverse || program).body) 13035 }; 13036 13037 if (block.openStrip.close) { 13038 omitRight(program.body, null, true); 13039 } 13040 13041 if (inverse) { 13042 var inverseStrip = block.inverseStrip; 13043 13044 if (inverseStrip.open) { 13045 omitLeft(program.body, null, true); 13046 } 13047 13048 if (inverseStrip.close) { 13049 omitRight(firstInverse.body, null, true); 13050 } 13051 if (block.closeStrip.open) { 13052 omitLeft(lastInverse.body, null, true); 13053 } 13054 13055 // Find standalone else statments 13056 if (!this.options.ignoreStandalone && isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) { 13057 omitLeft(program.body); 13058 omitRight(firstInverse.body); 13059 } 13060 } else if (block.closeStrip.open) { 13061 omitLeft(program.body, null, true); 13062 } 13063 13064 return strip; 13065}; 13066 13067WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function (mustache) { 13068 return mustache.strip; 13069}; 13070 13071WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) { 13072 /* istanbul ignore next */ 13073 var strip = node.strip || {}; 13074 return { 13075 inlineStandalone: true, 13076 open: strip.open, 13077 close: strip.close 13078 }; 13079}; 13080 13081function isPrevWhitespace(body, i, isRoot) { 13082 if (i === undefined) { 13083 i = body.length; 13084 } 13085 13086 // Nodes that end with newlines are considered whitespace (but are special 13087 // cased for strip operations) 13088 var prev = body[i - 1], 13089 sibling = body[i - 2]; 13090 if (!prev) { 13091 return isRoot; 13092 } 13093 13094 if (prev.type === 'ContentStatement') { 13095 return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original); 13096 } 13097} 13098function isNextWhitespace(body, i, isRoot) { 13099 if (i === undefined) { 13100 i = -1; 13101 } 13102 13103 var next = body[i + 1], 13104 sibling = body[i + 2]; 13105 if (!next) { 13106 return isRoot; 13107 } 13108 13109 if (next.type === 'ContentStatement') { 13110 return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original); 13111 } 13112} 13113 13114// Marks the node to the right of the position as omitted. 13115// I.e. {{foo}}' ' will mark the ' ' node as omitted. 13116// 13117// If i is undefined, then the first child will be marked as such. 13118// 13119// If mulitple is truthy then all whitespace will be stripped out until non-whitespace 13120// content is met. 13121function omitRight(body, i, multiple) { 13122 var current = body[i == null ? 0 : i + 1]; 13123 if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) { 13124 return; 13125 } 13126 13127 var original = current.value; 13128 current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, ''); 13129 current.rightStripped = current.value !== original; 13130} 13131 13132// Marks the node to the left of the position as omitted. 13133// I.e. ' '{{foo}} will mark the ' ' node as omitted. 13134// 13135// If i is undefined then the last child will be marked as such. 13136// 13137// If mulitple is truthy then all whitespace will be stripped out until non-whitespace 13138// content is met. 13139function omitLeft(body, i, multiple) { 13140 var current = body[i == null ? body.length - 1 : i - 1]; 13141 if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) { 13142 return; 13143 } 13144 13145 // We omit the last node if it's whitespace only and not preceeded by a non-content node. 13146 var original = current.value; 13147 current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, ''); 13148 current.leftStripped = current.value !== original; 13149 return current.leftStripped; 13150} 13151 13152exports['default'] = WhitespaceControl; 13153module.exports = exports['default']; 13154 13155 13156},{"./visitor":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/visitor.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/decorators.js":[function(require,module,exports){ 13157'use strict'; 13158 13159exports.__esModule = true; 13160exports.registerDefaultDecorators = registerDefaultDecorators; 13161// istanbul ignore next 13162 13163function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 13164 13165var _decoratorsInline = require('./decorators/inline'); 13166 13167var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); 13168 13169function registerDefaultDecorators(instance) { 13170 _decoratorsInline2['default'](instance); 13171} 13172 13173 13174},{"./decorators/inline":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/decorators/inline.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/decorators/inline.js":[function(require,module,exports){ 13175'use strict'; 13176 13177exports.__esModule = true; 13178 13179var _utils = require('../utils'); 13180 13181exports['default'] = function (instance) { 13182 instance.registerDecorator('inline', function (fn, props, container, options) { 13183 var ret = fn; 13184 if (!props.partials) { 13185 props.partials = {}; 13186 ret = function (context, options) { 13187 // Create a new partials stack frame prior to exec. 13188 var original = container.partials; 13189 container.partials = _utils.extend({}, original, props.partials); 13190 var ret = fn(context, options); 13191 container.partials = original; 13192 return ret; 13193 }; 13194 } 13195 13196 props.partials[options.args[0]] = options.fn; 13197 13198 return ret; 13199 }); 13200}; 13201 13202module.exports = exports['default']; 13203 13204 13205},{"../utils":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/utils.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/exception.js":[function(require,module,exports){ 13206'use strict'; 13207 13208exports.__esModule = true; 13209 13210var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; 13211 13212function Exception(message, node) { 13213 var loc = node && node.loc, 13214 line = undefined, 13215 column = undefined; 13216 if (loc) { 13217 line = loc.start.line; 13218 column = loc.start.column; 13219 13220 message += ' - ' + line + ':' + column; 13221 } 13222 13223 var tmp = Error.prototype.constructor.call(this, message); 13224 13225 // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. 13226 for (var idx = 0; idx < errorProps.length; idx++) { 13227 this[errorProps[idx]] = tmp[errorProps[idx]]; 13228 } 13229 13230 /* istanbul ignore else */ 13231 if (Error.captureStackTrace) { 13232 Error.captureStackTrace(this, Exception); 13233 } 13234 13235 try { 13236 if (loc) { 13237 this.lineNumber = line; 13238 13239 // Work around issue under safari where we can't directly set the column value 13240 /* istanbul ignore next */ 13241 if (Object.defineProperty) { 13242 Object.defineProperty(this, 'column', { 13243 value: column, 13244 enumerable: true 13245 }); 13246 } else { 13247 this.column = column; 13248 } 13249 } 13250 } catch (nop) { 13251 /* Ignore if the browser is very particular */ 13252 } 13253} 13254 13255Exception.prototype = new Error(); 13256 13257exports['default'] = Exception; 13258module.exports = exports['default']; 13259 13260 13261},{}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers.js":[function(require,module,exports){ 13262'use strict'; 13263 13264exports.__esModule = true; 13265exports.registerDefaultHelpers = registerDefaultHelpers; 13266// istanbul ignore next 13267 13268function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 13269 13270var _helpersBlockHelperMissing = require('./helpers/block-helper-missing'); 13271 13272var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); 13273 13274var _helpersEach = require('./helpers/each'); 13275 13276var _helpersEach2 = _interopRequireDefault(_helpersEach); 13277 13278var _helpersHelperMissing = require('./helpers/helper-missing'); 13279 13280var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); 13281 13282var _helpersIf = require('./helpers/if'); 13283 13284var _helpersIf2 = _interopRequireDefault(_helpersIf); 13285 13286var _helpersLog = require('./helpers/log'); 13287 13288var _helpersLog2 = _interopRequireDefault(_helpersLog); 13289 13290var _helpersLookup = require('./helpers/lookup'); 13291 13292var _helpersLookup2 = _interopRequireDefault(_helpersLookup); 13293 13294var _helpersWith = require('./helpers/with'); 13295 13296var _helpersWith2 = _interopRequireDefault(_helpersWith); 13297 13298function registerDefaultHelpers(instance) { 13299 _helpersBlockHelperMissing2['default'](instance); 13300 _helpersEach2['default'](instance); 13301 _helpersHelperMissing2['default'](instance); 13302 _helpersIf2['default'](instance); 13303 _helpersLog2['default'](instance); 13304 _helpersLookup2['default'](instance); 13305 _helpersWith2['default'](instance); 13306} 13307 13308 13309},{"./helpers/block-helper-missing":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers/block-helper-missing.js","./helpers/each":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js","./helpers/helper-missing":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js","./helpers/if":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers/if.js","./helpers/log":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers/log.js","./helpers/lookup":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers/lookup.js","./helpers/with":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers/with.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers/block-helper-missing.js":[function(require,module,exports){ 13310'use strict'; 13311 13312exports.__esModule = true; 13313 13314var _utils = require('../utils'); 13315 13316exports['default'] = function (instance) { 13317 instance.registerHelper('blockHelperMissing', function (context, options) { 13318 var inverse = options.inverse, 13319 fn = options.fn; 13320 13321 if (context === true) { 13322 return fn(this); 13323 } else if (context === false || context == null) { 13324 return inverse(this); 13325 } else if (_utils.isArray(context)) { 13326 if (context.length > 0) { 13327 if (options.ids) { 13328 options.ids = [options.name]; 13329 } 13330 13331 return instance.helpers.each(context, options); 13332 } else { 13333 return inverse(this); 13334 } 13335 } else { 13336 if (options.data && options.ids) { 13337 var data = _utils.createFrame(options.data); 13338 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); 13339 options = { data: data }; 13340 } 13341 13342 return fn(context, options); 13343 } 13344 }); 13345}; 13346 13347module.exports = exports['default']; 13348 13349 13350},{"../utils":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/utils.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js":[function(require,module,exports){ 13351'use strict'; 13352 13353exports.__esModule = true; 13354// istanbul ignore next 13355 13356function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 13357 13358var _utils = require('../utils'); 13359 13360var _exception = require('../exception'); 13361 13362var _exception2 = _interopRequireDefault(_exception); 13363 13364exports['default'] = function (instance) { 13365 instance.registerHelper('each', function (context, options) { 13366 if (!options) { 13367 throw new _exception2['default']('Must pass iterator to #each'); 13368 } 13369 13370 var fn = options.fn, 13371 inverse = options.inverse, 13372 i = 0, 13373 ret = '', 13374 data = undefined, 13375 contextPath = undefined; 13376 13377 if (options.data && options.ids) { 13378 contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; 13379 } 13380 13381 if (_utils.isFunction(context)) { 13382 context = context.call(this); 13383 } 13384 13385 if (options.data) { 13386 data = _utils.createFrame(options.data); 13387 } 13388 13389 function execIteration(field, index, last) { 13390 if (data) { 13391 data.key = field; 13392 data.index = index; 13393 data.first = index === 0; 13394 data.last = !!last; 13395 13396 if (contextPath) { 13397 data.contextPath = contextPath + field; 13398 } 13399 } 13400 13401 ret = ret + fn(context[field], { 13402 data: data, 13403 blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) 13404 }); 13405 } 13406 13407 if (context && typeof context === 'object') { 13408 if (_utils.isArray(context)) { 13409 for (var j = context.length; i < j; i++) { 13410 if (i in context) { 13411 execIteration(i, i, i === context.length - 1); 13412 } 13413 } 13414 } else { 13415 var priorKey = undefined; 13416 13417 for (var key in context) { 13418 if (context.hasOwnProperty(key)) { 13419 // We're running the iterations one step out of sync so we can detect 13420 // the last iteration without have to scan the object twice and create 13421 // an itermediate keys array.
13422 if (priorKey !== undefined) { 13423 execIteration(priorKey, i - 1); 13424 } 13425 priorKey = key; 13426 i++; 13427 } 13428 } 13429 if (priorKey !== undefined) { 13430 execIteration(priorKey, i - 1, true); 13431 } 13432 } 13433 } 13434 13435 if (i === 0) { 13436 ret = inverse(this); 13437 } 13438 13439 return ret; 13440 }); 13441}; 13442 13443module.exports = exports['default']; 13444 13445 13446},{"../exception":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/exception.js","../utils":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/utils.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js":[function(require,module,exports){ 13447'use strict'; 13448 13449exports.__esModule = true; 13450// istanbul ignore next 13451 13452function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 13453 13454var _exception = require('../exception'); 13455 13456var _exception2 = _interopRequireDefault(_exception); 13457 13458exports['default'] = function (instance) { 13459 instance.registerHelper('helperMissing', function () /* [args, ]options */{ 13460 if (arguments.length === 1) { 13461 // A missing field in a {{foo}} construct. 13462 return undefined; 13463 } else { 13464 // Someone is actually trying to call something, blow up. 13465 throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); 13466 } 13467 }); 13468}; 13469 13470module.exports = exports['default']; 13471 13472 13473},{"../exception":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/exception.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers/if.js":[function(require,module,exports){ 13474'use strict'; 13475 13476exports.__esModule = true; 13477 13478var _utils = require('../utils'); 13479 13480exports['default'] = function (instance) { 13481 instance.registerHelper('if', function (conditional, options) { 13482 if (_utils.isFunction(conditional)) { 13483 conditional = conditional.call(this); 13484 } 13485 13486 // Default behavior is to render the positive path if the value is truthy and not empty. 13487 // The `includeZero` option may be set to treat the condtional as purely not empty based on the 13488 // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. 13489 if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { 13490 return options.inverse(this); 13491 } else { 13492 return options.fn(this); 13493 } 13494 }); 13495 13496 instance.registerHelper('unless', function (conditional, options) { 13497 return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); 13498 }); 13499}; 13500 13501module.exports = exports['default']; 13502 13503 13504},{"../utils":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/utils.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers/log.js":[function(require,module,exports){ 13505'use strict'; 13506 13507exports.__esModule = true; 13508 13509exports['default'] = function (instance) { 13510 instance.registerHelper('log', function () /* message, options */{ 13511 var args = [undefined], 13512 options = arguments[arguments.length - 1]; 13513 for (var i = 0; i < arguments.length - 1; i++) { 13514 args.push(arguments[i]); 13515 } 13516 13517 var level = 1; 13518 if (options.hash.level != null) { 13519 level = options.hash.level; 13520 } else if (options.data && options.data.level != null) { 13521 level = options.data.level; 13522 } 13523 args[0] = level; 13524 13525 instance.log.apply(instance, args); 13526 }); 13527}; 13528 13529module.exports = exports['default']; 13530 13531 13532},{}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers/lookup.js":[function(require,module,exports){ 13533'use strict'; 13534 13535exports.__esModule = true; 13536 13537exports['default'] = function (instance) { 13538 instance.registerHelper('lookup', function (obj, field) { 13539 return obj && obj[field]; 13540 }); 13541}; 13542 13543module.exports = exports['default']; 13544 13545 13546},{}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/helpers/with.js":[function(require,module,exports){ 13547'use strict'; 13548 13549exports.__esModule = true; 13550 13551var _utils = require('../utils'); 13552 13553exports['default'] = function (instance) { 13554 instance.registerHelper('with', function (context, options) { 13555 if (_utils.isFunction(context)) { 13556 context = context.call(this); 13557 } 13558 13559 var fn = options.fn; 13560 13561 if (!_utils.isEmpty(context)) { 13562 var data = options.data; 13563 if (options.data && options.ids) { 13564 data = _utils.createFrame(options.data); 13565 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); 13566 } 13567 13568 return fn(context, { 13569 data: data, 13570 blockParams: _utils.blockParams([context], [data && data.contextPath]) 13571 }); 13572 } else { 13573 return options.inverse(this); 13574 } 13575 }); 13576}; 13577 13578module.exports = exports['default']; 13579 13580 13581},{"../utils":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/utils.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/logger.js":[function(require,module,exports){ 13582'use strict'; 13583 13584exports.__esModule = true; 13585 13586var _utils = require('./utils'); 13587 13588var logger = { 13589 methodMap: ['debug', 'info', 'warn', 'error'], 13590 level: 'info', 13591 13592 // Maps a given level value to the `methodMap` indexes above. 13593 lookupLevel: function lookupLevel(level) { 13594 if (typeof level === 'string') { 13595 var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); 13596 if (levelMap >= 0) { 13597 level = levelMap; 13598 } else { 13599 level = parseInt(level, 10); 13600 } 13601 } 13602 13603 return level; 13604 }, 13605 13606 // Can be overridden in the host environment 13607 log: function log(level) { 13608 level = logger.lookupLevel(level); 13609 13610 if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { 13611 var method = logger.methodMap[level]; 13612 if (!console[method]) { 13613 // eslint-disable-line no-console 13614 method = 'log'; 13615 } 13616 13617 for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 13618 message[_key - 1] = arguments[_key]; 13619 } 13620 13621 console[method].apply(console, message); // eslint-disable-line no-console 13622 } 13623 } 13624}; 13625 13626exports['default'] = logger; 13627module.exports = exports['default']; 13628 13629 13630},{"./utils":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/utils.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/no-conflict.js":[function(require,module,exports){ 13631(function (global){ 13632/* global window */ 13633'use strict'; 13634 13635exports.__esModule = true; 13636 13637exports['default'] = function (Handlebars) { 13638 /* istanbul ignore next */ 13639 var root = typeof global !== 'undefined' ? global : window, 13640 $Handlebars = root.Handlebars; 13641 /* istanbul ignore next */ 13642 Handlebars.noConflict = function () { 13643 if (root.Handlebars === Handlebars) { 13644 root.Handlebars = $Handlebars; 13645 } 13646 return Handlebars; 13647 }; 13648}; 13649 13650module.exports = exports['default']; 13651 13652 13653}
vendor: 13,352 bytes, lines 13653-14042
13653).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 13654},{}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/runtime.js":[function(require,module,exports){ 13655'use strict'; 13656 13657exports.__esModule = true; 13658exports.checkRevision = checkRevision; 13659exports.template = template; 13660exports.wrapProgram = wrapProgram; 13661exports.resolvePartial = resolvePartial; 13662exports.invokePartial = invokePartial; 13663exports.noop = noop; 13664// istanbul ignore next 13665 13666function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 13667 13668// istanbul ignore next 13669 13670function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } 13671 13672var _utils = require('./utils'); 13673 13674var Utils = _interopRequireWildcard(_utils); 13675 13676var _exception = require('./exception'); 13677 13678var _exception2 = _interopRequireDefault(_exception); 13679 13680var _base = require('./base'); 13681 13682function checkRevision(compilerInfo) { 13683 var compilerRevision = compilerInfo && compilerInfo[0] || 1, 13684 currentRevision = _base.COMPILER_REVISION; 13685 13686 if (compilerRevision !== currentRevision) { 13687 if (compilerRevision < currentRevision) { 13688 var runtimeVersions = _base.REVISION_CHANGES[currentRevision], 13689 compilerVersions = _base.REVISION_CHANGES[compilerRevision]; 13690 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 + ').'); 13691 } else { 13692 // Use the embedded version info since the runtime doesn't know about this revision yet 13693 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] + ').'); 13694 } 13695 } 13696} 13697 13698function template(templateSpec, env) { 13699 /* istanbul ignore next */ 13700 if (!env) { 13701 throw new _exception2['default']('No environment passed to template'); 13702 } 13703 if (!templateSpec || !templateSpec.main) { 13704 throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); 13705 } 13706 13707 templateSpec.main.decorator = templateSpec.main_d; 13708 13709 // Note: Using env.VM references rather than local var references throughout this section to allow 13710 // for external users to override these as psuedo-supported APIs. 13711 env.VM.checkRevision(templateSpec.compiler); 13712 13713 function invokePartialWrapper(partial, context, options) { 13714 if (options.hash) { 13715 context = Utils.extend({}, context, options.hash); 13716 if (options.ids) { 13717 options.ids[0] = true; 13718 } 13719 } 13720 13721 partial = env.VM.resolvePartial.call(this, partial, context, options); 13722 var result = env.VM.invokePartial.call(this, partial, context, options); 13723 13724 if (result == null && env.compile) { 13725 options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); 13726 result = options.partials[options.name](context, options); 13727 } 13728 if (result != null) { 13729 if (options.indent) { 13730 var lines = result.split('\n'); 13731 for (var i = 0, l = lines.length; i < l; i++) { 13732 if (!lines[i] && i + 1 === l) { 13733 break; 13734 } 13735 13736 lines[i] = options.indent + lines[i]; 13737 } 13738 result = lines.join('\n'); 13739 } 13740 return result; 13741 } else { 13742 throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); 13743 } 13744 } 13745 13746 // Just add water 13747 var container = { 13748 strict: function strict(obj, name) { 13749 if (!(name in obj)) { 13750 throw new _exception2['default']('"' + name + '" not defined in ' + obj); 13751 } 13752 return obj[name]; 13753 }, 13754 lookup: function lookup(depths, name) { 13755 var len = depths.length; 13756 for (var i = 0; i < len; i++) { 13757 if (depths[i] && depths[i][name] != null) { 13758 return depths[i][name]; 13759 } 13760 } 13761 }, 13762 lambda: function lambda(current, context) { 13763 return typeof current === 'function' ? current.call(context) : current; 13764 }, 13765 13766 escapeExpression: Utils.escapeExpression, 13767 invokePartial: invokePartialWrapper, 13768 13769 fn: function fn(i) { 13770 var ret = templateSpec[i]; 13771 ret.decorator = templateSpec[i + '_d']; 13772 return ret; 13773 }, 13774 13775 programs: [], 13776 program: function program(i, data, declaredBlockParams, blockParams, depths) { 13777 var programWrapper = this.programs[i], 13778 fn = this.fn(i); 13779 if (data || depths || blockParams || declaredBlockParams) { 13780 programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); 13781 } else if (!programWrapper) { 13782 programWrapper = this.programs[i] = wrapProgram(this, i, fn); 13783 } 13784 return programWrapper; 13785 }, 13786 13787 data: function data(value, depth) { 13788 while (value && depth--) { 13789 value = value._parent; 13790 } 13791 return value; 13792 }, 13793 merge: function merge(param, common) { 13794 var obj = param || common; 13795 13796 if (param && common && param !== common) { 13797 obj = Utils.extend({}, common, param); 13798 } 13799 13800 return obj; 13801 }, 13802 // An empty object to use as replacement for null-contexts 13803 nullContext: Object.seal({}), 13804 13805 noop: env.VM.noop, 13806 compilerInfo: templateSpec.compiler 13807 }; 13808 13809 function ret(context) { 13810 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 13811 13812 var data = options.data; 13813 13814 ret._setup(options); 13815 if (!options.partial && templateSpec.useData) { 13816 data = initData(context, data); 13817 } 13818 var depths = undefined, 13819 blockParams = templateSpec.useBlockParams ? [] : undefined; 13820 if (templateSpec.useDepths) { 13821 if (options.depths) { 13822 depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths; 13823 } else { 13824 depths = [context]; 13825 } 13826 } 13827 13828 function main(context /*, options*/) { 13829 return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); 13830 } 13831 main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); 13832 return main(context, options); 13833 } 13834 ret.isTop = true; 13835 13836 ret._setup = function (options) { 13837 if (!options.partial) { 13838 container.helpers = container.merge(options.helpers, env.helpers); 13839 13840 if (templateSpec.usePartial) { 13841 container.partials = container.merge(options.partials, env.partials); 13842 } 13843 if (templateSpec.usePartial || templateSpec.useDecorators) { 13844 container.decorators = container.merge(options.decorators, env.decorators); 13845 } 13846 } else { 13847 container.helpers = options.helpers; 13848 container.partials = options.partials; 13849 container.decorators = options.decorators; 13850 } 13851 }; 13852 13853 ret._child = function (i, data, blockParams, depths) { 13854 if (templateSpec.useBlockParams && !blockParams) { 13855 throw new _exception2['default']('must pass block params'); 13856 } 13857 if (templateSpec.useDepths && !depths) { 13858 throw new _exception2['default']('must pass parent depths'); 13859 } 13860 13861 return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); 13862 }; 13863 return ret; 13864} 13865 13866function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { 13867 function prog(context) { 13868 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 13869 13870 var currentDepths = depths; 13871 if (depths && context != depths[0] && !(context === container.nullContext && depths[0] === null)) { 13872 currentDepths = [context].concat(depths); 13873 } 13874 13875 return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); 13876 } 13877 13878 prog = executeDecorators(fn, prog, container, depths, data, blockParams); 13879 13880 prog.program = i; 13881 prog.depth = depths ? depths.length : 0; 13882 prog.blockParams = declaredBlockParams || 0; 13883 return prog; 13884} 13885 13886function resolvePartial(partial, context, options) { 13887 if (!partial) { 13888 if (options.name === '@partial-block') { 13889 partial = options.data['partial-block']; 13890 } else { 13891 partial = options.partials[options.name]; 13892 } 13893 } else if (!partial.call && !options.name) { 13894 // This is a dynamic partial that returned a string 13895 options.name = partial; 13896 partial = options.partials[partial]; 13897 } 13898 return partial; 13899} 13900 13901function invokePartial(partial, context, options) { 13902 // Use the current closure context to save the partial-block if this partial 13903 var currentPartialBlock = options.data && options.data['partial-block']; 13904 options.partial = true; 13905 if (options.ids) { 13906 options.data.contextPath = options.ids[0] || options.data.contextPath; 13907 } 13908 13909 var partialBlock = undefined; 13910 if (options.fn && options.fn !== noop) { 13911 (function () { 13912 options.data = _base.createFrame(options.data); 13913 // Wrapper function to get access to currentPartialBlock from the closure 13914 var fn = options.fn; 13915 partialBlock = options.data['partial-block'] = function partialBlockWrapper(context) { 13916 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 13917 13918 // Restore the partial-block from the closure for the execution of the block 13919 // i.e. the part inside the block of the partial call. 13920 options.data = _base.createFrame(options.data); 13921 options.data['partial-block'] = currentPartialBlock; 13922 return fn(context, options); 13923 }; 13924 if (fn.partials) { 13925 options.partials = Utils.extend({}, options.partials, fn.partials); 13926 } 13927 })(); 13928 } 13929 13930 if (partial === undefined && partialBlock) { 13931 partial = partialBlock; 13932 } 13933 13934 if (partial === undefined) { 13935 throw new _exception2['default']('The partial ' + options.name + ' could not be found'); 13936 } else if (partial instanceof Function) { 13937 return partial(context, options); 13938 } 13939} 13940 13941function noop() { 13942 return ''; 13943} 13944 13945function initData(context, data) { 13946 if (!data || !('root' in data)) { 13947 data = data ? _base.createFrame(data) : {}; 13948 data.root = context; 13949 } 13950 return data; 13951} 13952 13953function executeDecorators(fn, prog, container, depths, data, blockParams) { 13954 if (fn.decorator) { 13955 var props = {}; 13956 prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); 13957 Utils.extend(prog, props); 13958 } 13959 return prog; 13960} 13961 13962 13963},{"./base":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/base.js","./exception":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/exception.js","./utils":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/utils.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/safe-string.js":[function(require,module,exports){ 13964// Build out our basic SafeString type 13965'use strict'; 13966 13967exports.__esModule = true; 13968function SafeString(string) { 13969 this.string = string; 13970} 13971 13972SafeString.prototype.toString = SafeString.prototype.toHTML = function () { 13973 return '' + this.string; 13974}; 13975 13976exports['default'] = SafeString; 13977module.exports = exports['default']; 13978 13979 13980},{}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/utils.js":[function(require,module,exports){ 13981'use strict'; 13982 13983exports.__esModule = true; 13984exports.extend = extend; 13985exports.indexOf = indexOf; 13986exports.escapeExpression = escapeExpression; 13987exports.isEmpty = isEmpty; 13988exports.createFrame = createFrame; 13989exports.blockParams = blockParams; 13990exports.appendContextPath = appendContextPath; 13991var escape = { 13992 '&': '&', 13993 '<': '<', 13994 '>': '>', 13995 '"': '"', 13996 "'": ''', 13997 '`': '`', 13998 '=': '=' 13999}; 14000 14001var badChars = /[&<>"'`=]/g, 14002 possible = /[&<>"'`=]/; 14003 14004function escapeChar(chr) { 14005 return escape[chr]; 14006} 14007 14008function extend(obj /* , ...source */) { 14009 for (var i = 1; i < arguments.length; i++) { 14010 for (var key in arguments[i]) { 14011 if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { 14012 obj[key] = arguments[i][key]; 14013 } 14014 } 14015 } 14016 14017 return obj; 14018} 14019 14020var toString = Object.prototype.toString; 14021 14022exports.toString = toString; 14023// Sourced from lodash 14024// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt 14025/* eslint-disable func-style */ 14026var isFunction = function isFunction(value) { 14027 return typeof value === 'function'; 14028}; 14029// fallback for older versions of Chrome and Safari 14030/* istanbul ignore next */ 14031if (isFunction(/x/)) { 14032 exports.isFunction = isFunction = function (value) { 14033 return typeof value === 'function' && toString.call(value) === '[object Function]'; 14034 }; 14035} 14036exports.isFunction = isFunction; 14037 14038/* eslint-enable func-style */ 14039 14040/* istanbul ignore next */ 14041var isArray = Array.isArray || function (value) { 14042 return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;
14043}; 14044 14045exports.isArray = isArray; 14046// Older IE versions do not directly support indexOf so we must implement our own, sadly. 14047 14048function indexOf(array, value) { 14049 for (var i = 0, len = array.length; i < len; i++) { 14050 if (array[i] === value) { 14051 return i; 14052 } 14053 } 14054 return -1; 14055} 14056 14057function escapeExpression(string) { 14058 if (typeof string !== 'string') { 14059 // don't escape SafeStrings, since they're already safe 14060 if (string && string.toHTML) { 14061 return string.toHTML(); 14062 } else if (string == null) { 14063 return ''; 14064 } else if (!string) { 14065 return string + ''; 14066 } 14067 14068 // Force a string conversion as this will be done by the append regardless and 14069 // the regex test will do this transparently behind the scenes, causing issues if 14070 // an object's to string has escaped characters in it. 14071 string = '' + string; 14072 } 14073 14074 if (!possible.test(string)) { 14075 return string; 14076 } 14077 return string.replace(badChars, escapeChar); 14078} 14079 14080function isEmpty(value) { 14081 if (!value && value !== 0) { 14082 return true; 14083 } else if (isArray(value) && value.length === 0) { 14084 return true; 14085 } else { 14086 return false; 14087 } 14088} 14089 14090function createFrame(object) { 14091 var frame = extend({}, object); 14092 frame._parent = object; 14093 return frame; 14094} 14095 14096function blockParams(params, ids) { 14097 params.path = ids; 14098 return params; 14099} 14100 14101function appendContextPath(contextPath, id) { 14102 return (contextPath ? contextPath + '.' : '') + id; 14103} 14104 14105 14106},{}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/lib/index.js":[function(require,module,exports){ 14107// USAGE: 14108// var handlebars = require('handlebars'); 14109/* eslint-disable no-var */ 14110 14111// var local = handlebars.create(); 14112 14113var handlebars = require('../dist/cjs/handlebars')['default']; 14114 14115var printer = require('../dist/cjs/handlebars/compiler/printer'); 14116handlebars.PrintVisitor = printer.PrintVisitor; 14117handlebars.print = printer.print; 14118 14119module.exports = handlebars; 14120 14121// Publish a Node.js require() handler for .handlebars and .hbs files 14122function extension(module, filename) { 14123 var fs = require('fs'); 14124 var templateString = fs.readFileSync(filename, 'utf8'); 14125 module.exports = handlebars.compile(templateString); 14126} 14127/* istanbul ignore else */ 14128if (typeof require !== 'undefined' && require.extensions) { 14129 require.extensions['.handlebars'] = extension; 14130 require.extensions['.hbs'] = extension; 14131} 14132 14133},{"../dist/cjs/handlebars":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars.js","../dist/cjs/handlebars/compiler/printer":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/dist/cjs/handlebars/compiler/printer.js","fs":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/browserify/lib/_empty.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/jquery/dist/jquery.js":[function(require,module,exports){ 14134/*! 14135 * jQuery JavaScript Library v2.2.4 14136 * http://jquery.com/ 14137 * 14138 * Includes Sizzle.js 14139 * http://sizzlejs.com/ 14140 * 14141 * Copyright jQuery Foundation and other contributors 14142 * Released under the MIT license 14143 * http://jquery.org/license 14144 * 14145 * Date: 2016-05-20T17:23Z 14146 */ 14147 14148(function( global, factory ) { 14149 14150 if ( typeof module === "object" && typeof module.exports === "object" ) { 14151 // For CommonJS and CommonJS-like environments where a proper `window` 14152 // is present, execute the factory and get jQuery. 14153 // For environments that do not have a `window` with a `document` 14154 // (such as Node.js), expose a factory as module.exports. 14155 // This accentuates the need for the creation of a real `window`. 14156 // e.g. var jQuery = require("jquery")(window); 14157 // See ticket #14549 for more info. 14158 module.exports = global.document ? 14159 factory( global, true ) : 14160 function( w ) { 14161 if ( !w.document ) { 14162 throw new Error( "jQuery requires a window with a document" ); 14163 } 14164 return factory( w ); 14165 }; 14166 } else { 14167 factory( global ); 14168 } 14169 14170// Pass this if window is not defined yet 14171}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 14172 14173// Support: Firefox 18+ 14174// Can't be in strict mode, several libs including ASP.NET trace 14175// the stack via arguments.caller.callee and Firefox dies if 14176// you try to trace through "use strict" call chains. (#13335) 14177//"use strict"; 14178var arr = []; 14179 14180var document = window.document; 14181 14182var slice = arr.slice; 14183 14184var concat = arr.concat; 14185 14186var push = arr.push; 14187 14188var indexOf = arr.indexOf; 14189 14190var class2type = {}; 14191 14192var toString = class2type.toString; 14193 14194var hasOwn = class2type.hasOwnProperty; 14195 14196var support = {}; 14197 14198 14199 14200var 14201 version = "2.2.4", 14202 14203 // Define a local copy of jQuery 14204 jQuery = function( selector, context ) { 14205 14206 // The jQuery object is actually just the init constructor 'enhanced' 14207 // Need init if jQuery is called (just allow error to be thrown if not included) 14208 return new jQuery.fn.init( selector, context ); 14209 }, 14210 14211 // Support: Android<4.1 14212 // Make sure we trim BOM and NBSP 14213 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, 14214 14215 // Matches dashed string for camelizing 14216 rmsPrefix = /^-ms-/, 14217 rdashAlpha = /-([\da-z])/gi, 14218 14219 // Used by jQuery.camelCase as callback to replace() 14220 fcamelCase = function( all, letter ) { 14221 return letter.toUpperCase(); 14222 }; 14223 14224jQuery.fn = jQuery.prototype = { 14225 14226 // The current version of jQuery being used 14227 jquery: version, 14228 14229 constructor: jQuery, 14230 14231 // Start with an empty selector 14232 selector: "", 14233 14234 // The default length of a jQuery object is 0 14235 length: 0, 14236 14237 toArray: function() { 14238 return slice.call( this ); 14239 }, 14240 14241 // Get the Nth element in the matched element set OR 14242 // Get the whole matched element set as a clean array 14243 get: function( num ) { 14244 return num != null ? 14245 14246 // Return just the one element from the set 14247 ( num < 0 ? this[ num + this.length ] : this[ num ] ) : 14248 14249 // Return all the elements in a clean array 14250 slice.call( this ); 14251 }, 14252 14253 // Take an array of elements and push it onto the stack 14254 // (returning the new matched element set) 14255 pushStack: function( elems ) { 14256 14257 // Build a new jQuery matched element set 14258 var ret = jQuery.merge( this.constructor(), elems ); 14259 14260 // Add the old object onto the stack (as a reference)
14261 ret.prevObject = this; 14262 ret.context = this.context; 14263 14264 // Return the newly-formed element set 14265 return ret; 14266 }, 14267 14268 // Execute a callback for every element in the matched set. 14269 each: function( callback ) { 14270 return jQuery.each( this, callback ); 14271 }, 14272 14273 map: function( callback ) { 14274 return this.pushStack( jQuery.map( this, function( elem, i ) { 14275 return callback.call( elem, i, elem ); 14276 } ) ); 14277 }, 14278 14279 slice: function() { 14280 return this.pushStack( slice.apply( this, arguments ) ); 14281 }, 14282 14283 first: function() { 14284 return this.eq( 0 ); 14285 }, 14286 14287 last: function() { 14288 return this.eq( -1 ); 14289 }, 14290 14291 eq: function( i ) { 14292 var len = this.length, 14293 j = +i + ( i < 0 ? len : 0 ); 14294 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 14295 }, 14296 14297 end: function() { 14298 return this.prevObject || this.constructor(); 14299 }, 14300 14301 // For internal use only. 14302 // Behaves like an Array's method, not like a jQuery method. 14303 push: push, 14304 sort: arr.sort, 14305 splice: arr.splice 14306}; 14307 14308jQuery.extend = jQuery.fn.extend = function() { 14309 var options, name, src, copy, copyIsArray, clone, 14310 target = arguments[ 0 ] || {}, 14311 i = 1, 14312 length = arguments.length, 14313 deep = false; 14314 14315 // Handle a deep copy situation 14316 if ( typeof target === "boolean" ) { 14317 deep = target; 14318 14319 // Skip the boolean and the target 14320 target = arguments[ i ] || {}; 14321 i++; 14322 } 14323 14324 // Handle case when target is a string or something (possible in deep copy) 14325 if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { 14326 target = {}; 14327 } 14328 14329 // Extend jQuery itself if only one argument is passed 14330 if ( i === length ) { 14331 target = this; 14332 i--; 14333 } 14334 14335 for ( ; i < length; i++ ) { 14336 14337 // Only deal with non-null/undefined values 14338 if ( ( options = arguments[ i ] ) != null ) { 14339 14340 // Extend the base object 14341 for ( name in options ) { 14342 src = target[ name ]; 14343 copy = options[ name ]; 14344 14345 // Prevent never-ending loop 14346 if ( target === copy ) { 14347 continue; 14348 } 14349 14350 // Recurse if we're merging plain objects or arrays 14351 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 14352 ( copyIsArray = jQuery.isArray( copy ) ) ) ) { 14353 14354 if ( copyIsArray ) { 14355 copyIsArray = false; 14356 clone = src && jQuery.isArray( src ) ? src : []; 14357 14358 } else { 14359 clone = src && jQuery.isPlainObject( src ) ? src : {}; 14360 } 14361 14362 // Never move original objects, clone them 14363 target[ name ] = jQuery.extend( deep, clone, copy ); 14364 14365 // Don't bring in undefined values 14366 } else if ( copy !== undefined ) { 14367 target[ name ] = copy; 14368 } 14369 } 14370 } 14371 } 14372 14373 // Return the modified object 14374 return target; 14375}; 14376 14377jQuery.extend( { 14378 14379 // Unique for each copy of jQuery on the page 14380 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 14381 14382 // Assume jQuery is ready without the ready module 14383 isReady: true, 14384 14385 error: function( msg ) { 14386 throw new Error( msg ); 14387 }, 14388 14389 noop: function() {}, 14390 14391 isFunction: function( obj ) { 14392 return jQuery.type( obj ) === "function"; 14393 }, 14394 14395 isArray: Array.isArray, 14396 14397 isWindow: function( obj ) { 14398 return obj != null && obj === obj.window; 14399 }, 14400 14401 isNumeric: function( obj ) { 14402 14403 // parseFloat NaNs numeric-cast false positives (null|true|false|"") 14404 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 14405 // subtraction forces infinities to NaN 14406 // adding 1 corrects loss of precision from parseFloat (#15100) 14407 var realStringObj = obj && obj.toString(); 14408 return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0; 14409 }, 14410 14411 isPlainObject: function( obj ) { 14412 var key; 14413 14414 // Not plain objects: 14415 // - Any object or value whose internal [[Class]] property is not "[object Object]" 14416 // - DOM nodes 14417 // - window 14418 if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { 14419 return false; 14420 } 14421 14422 // Not own constructor property must be Object 14423 if ( obj.constructor && 14424 !hasOwn.call( obj, "constructor" ) && 14425 !hasOwn.call( obj.constructor.prototype || {}, "isPrototypeOf" ) ) { 14426 return false; 14427 } 14428 14429 // Own properties are enumerated firstly, so to speed up, 14430 // if last one is own, then all properties are own 14431 for ( key in obj ) {} 14432 14433 return key === undefined || hasOwn.call( obj, key ); 14434 }, 14435 14436 isEmptyObject: function( obj ) { 14437 var name; 14438 for ( name in obj ) { 14439 return false;
14440 } 14441 return true; 14442 }, 14443 14444 type: function( obj ) { 14445 if ( obj == null ) { 14446 return obj + ""; 14447 } 14448 14449 // Support: Android<4.0, iOS<6 (functionish RegExp) 14450 return typeof obj === "object" || typeof obj === "function" ? 14451 class2type[ toString.call( obj ) ] || "object" : 14452 typeof obj; 14453 }, 14454 14455 // Evaluates a script in a global context 14456 globalEval: function( code ) { 14457 var script, 14458 indirect = eval; 14459 14460 code = jQuery.trim( code ); 14461 14462 if ( code ) { 14463 14464 // If the code includes a valid, prologue position 14465 // strict mode pragma, execute code by injecting a 14466 // script tag into the document. 14467 if ( code.indexOf( "use strict" ) === 1 ) { 14468 script = document.createElement( "script" ); 14469 script.text = code; 14470 document.head.appendChild( script ).parentNode.removeChild( script ); 14471 } else { 14472 14473 // Otherwise, avoid the DOM node creation, insertion 14474 // and removal by using an indirect global eval 14475 14476 indirect( code ); 14477 } 14478 } 14479 }, 14480 14481 // Convert dashed to camelCase; used by the css and data modules 14482 // Support: IE9-11+ 14483 // Microsoft forgot to hump their vendor prefix (#9572) 14484 camelCase: function( string ) { 14485 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 14486 }, 14487
vendor: 30,705 bytes, lines 14488-15597
14488 nodeName: function( elem, name ) { 14489 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 14490 }, 14491 14492 each: function( obj, callback ) { 14493 var length, i = 0; 14494 14495 if ( isArrayLike( obj ) ) { 14496 length = obj.length; 14497 for ( ; i < length; i++ ) { 14498 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 14499 break; 14500 } 14501 } 14502 } else { 14503 for ( i in obj ) { 14504 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 14505 break; 14506 } 14507 } 14508 } 14509 14510 return obj; 14511 }, 14512 14513 // Support: Android<4.1 14514 trim: function( text ) { 14515 return text == null ? 14516 "" : 14517 ( text + "" ).replace( rtrim, "" ); 14518 }, 14519 14520 // results is for internal usage only 14521 makeArray: function( arr, results ) { 14522 var ret = results || []; 14523 14524 if ( arr != null ) { 14525 if ( isArrayLike( Object( arr ) ) ) { 14526 jQuery.merge( ret, 14527 typeof arr === "string" ? 14528 [ arr ] : arr 14529 ); 14530 } else { 14531 push.call( ret, arr ); 14532 } 14533 } 14534 14535 return ret; 14536 }, 14537 14538 inArray: function( elem, arr, i ) { 14539 return arr == null ? -1 : indexOf.call( arr, elem, i ); 14540 }, 14541 14542 merge: function( first, second ) { 14543 var len = +second.length, 14544 j = 0, 14545 i = first.length; 14546 14547 for ( ; j < len; j++ ) { 14548 first[ i++ ] = second[ j ]; 14549 } 14550 14551 first.length = i; 14552 14553 return first; 14554 }, 14555 14556 grep: function( elems, callback, invert ) { 14557 var callbackInverse, 14558 matches = [], 14559 i = 0, 14560 length = elems.length, 14561 callbackExpect = !invert; 14562 14563 // Go through the array, only saving the items 14564 // that pass the validator function 14565 for ( ; i < length; i++ ) { 14566 callbackInverse = !callback( elems[ i ], i ); 14567 if ( callbackInverse !== callbackExpect ) { 14568 matches.push( elems[ i ] ); 14569 } 14570 } 14571 14572 return matches; 14573 }, 14574 14575 // arg is for internal usage only 14576 map: function( elems, callback, arg ) { 14577 var length, value, 14578 i = 0, 14579 ret = []; 14580 14581 // Go through the array, translating each of the items to their new values 14582 if ( isArrayLike( elems ) ) { 14583 length = elems.length; 14584 for ( ; i < length; i++ ) { 14585 value = callback( elems[ i ], i, arg ); 14586 14587 if ( value != null ) { 14588 ret.push( value ); 14589 } 14590 } 14591 14592 // Go through every key on the object, 14593 } else { 14594 for ( i in elems ) { 14595 value = callback( elems[ i ], i, arg ); 14596 14597 if ( value != null ) { 14598 ret.push( value ); 14599 } 14600 } 14601 } 14602 14603 // Flatten any nested arrays 14604 return concat.apply( [], ret ); 14605 }, 14606 14607 // A global GUID counter for objects 14608 guid: 1, 14609 14610 // Bind a function to a context, optionally partially applying any 14611 // arguments. 14612 proxy: function( fn, context ) { 14613 var tmp, args, proxy; 14614 14615 if ( typeof context === "string" ) { 14616 tmp = fn[ context ]; 14617 context = fn; 14618 fn = tmp; 14619 } 14620 14621 // Quick check to determine if target is callable, in the spec 14622 // this throws a TypeError, but we will just return undefined. 14623 if ( !jQuery.isFunction( fn ) ) { 14624 return undefined; 14625 } 14626 14627 // Simulated bind 14628 args = slice.call( arguments, 2 ); 14629 proxy = function() { 14630 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 14631 }; 14632 14633 // Set the guid of unique handler to the same of original handler, so it can be removed 14634 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 14635 14636 return proxy; 14637 }, 14638 14639 now: Date.now, 14640 14641 // jQuery.support is not used in Core but other projects attach their 14642 // properties to it so it needs to exist. 14643 support: support 14644} ); 14645 14646// JSHint would error on this code due to the Symbol not being defined in ES5. 14647// Defining this global in .jshintrc would create a danger of using the global 14648// unguarded in another place, it seems safer to just disable JSHint for these 14649// three lines. 14650/* jshint ignore: start */ 14651if ( typeof Symbol === "function" ) { 14652 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 14653} 14654/* jshint ignore: end */ 14655 14656// Populate the class2type map 14657jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 14658function( i, name ) { 14659 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 14660} ); 14661 14662function isArrayLike( obj ) { 14663 14664 // Support: iOS 8.2 (not reproducible in simulator) 14665 // `in` check used to prevent JIT error (gh-2145) 14666 // hasOwn isn't used here due to false negatives 14667 // regarding Nodelist length in IE 14668 var length = !!obj && "length" in obj && obj.length, 14669 type = jQuery.type( obj ); 14670 14671 if ( type === "function" || jQuery.isWindow( obj ) ) { 14672 return false; 14673 } 14674 14675 return type === "array" || length === 0 || 14676 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 14677} 14678var Sizzle = 14679/*! 14680 * Sizzle CSS Selector Engine v2.2.1 14681 * http://sizzlejs.com/ 14682 * 14683 * Copyright jQuery Foundation and other contributors 14684 * Released under the MIT license 14685 * http://jquery.org/license 14686 * 14687 * Date: 2015-10-17 14688 */ 14689(function( window ) { 14690 14691var i, 14692 support, 14693 Expr, 14694 getText, 14695 isXML, 14696 tokenize, 14697 compile, 14698 select, 14699 outermostContext, 14700 sortInput, 14701 hasDuplicate, 14702 14703 // Local document vars 14704 setDocument, 14705 document, 14706 docElem, 14707 documentIsHTML, 14708 rbuggyQSA, 14709 rbuggyMatches, 14710 matches, 14711 contains, 14712 14713 // Instance-specific data 14714 expando = "sizzle" + 1 * new Date(), 14715 preferredDoc = window.document, 14716 dirruns = 0, 14717 done = 0, 14718 classCache = createCache(), 14719 tokenCache = createCache(), 14720 compilerCache = createCache(), 14721 sortOrder = function( a, b ) { 14722 if ( a === b ) { 14723 hasDuplicate = true; 14724 } 14725 return 0; 14726 }, 14727 14728 // General-purpose constants 14729 MAX_NEGATIVE = 1 << 31, 14730 14731 // Instance methods 14732 hasOwn = ({}).hasOwnProperty, 14733 arr = [], 14734 pop = arr.pop, 14735 push_native = arr.push, 14736 push = arr.push, 14737 slice = arr.slice, 14738 // Use a stripped-down indexOf as it's faster than native 14739 // http://jsperf.com/thor-indexof-vs-for/5 14740 indexOf = function( list, elem ) { 14741 var i = 0, 14742 len = list.length; 14743 for ( ; i < len; i++ ) { 14744 if ( list[i] === elem ) { 14745 return i; 14746 } 14747 } 14748 return -1; 14749 }, 14750 14751 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", 14752 14753 // Regular expressions 14754 14755 // http://www.w3.org/TR/css3-selectors/#whitespace 14756 whitespace = "[\\x20\\t\\r\\n\\f]", 14757 14758 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier 14759 identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", 14760 14761 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 14762 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 14763 // Operator (capture 2) 14764 "*([*^$|!~]?=)" + whitespace + 14765 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 14766 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + 14767 "*\\]", 14768 14769 pseudos = ":(" + identifier + ")(?:\\((" + 14770 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 14771 // 1. quoted (capture 3; capture 4 or capture 5) 14772 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 14773 // 2. simple (capture 6) 14774 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 14775 // 3. anything else (capture 2) 14776 ".*" + 14777 ")\\)|)", 14778 14779 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 14780 rwhitespace = new RegExp( whitespace + "+", "g" ), 14781 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), 14782 14783 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 14784 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), 14785 14786 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), 14787 14788 rpseudo = new RegExp( pseudos ), 14789 ridentifier = new RegExp( "^" + identifier + "$" ), 14790 14791 matchExpr = { 14792 "ID": new RegExp( "^#(" + identifier + ")" ), 14793 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 14794 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 14795 "ATTR": new RegExp( "^" + attributes ), 14796 "PSEUDO": new RegExp( "^" + pseudos ), 14797 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + 14798 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + 14799 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 14800 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 14801 // For use in libraries implementing .is() 14802 // We use this for POS matching in `select` 14803 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + 14804 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 14805 }, 14806 14807 rinputs = /^(?:input|select|textarea|button)$/i, 14808 rheader = /^h\d$/i, 14809 14810 rnative = /^[^{]+\{\s*\[native \w/, 14811 14812 // Easily-parseable/retrievable ID or TAG or CLASS selectors 14813 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 14814 14815 rsibling = /[+~]/, 14816 rescape = /'|\\/g, 14817 14818 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 14819 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), 14820 funescape = function( _, escaped, escapedWhitespace ) { 14821 var high = "0x" + escaped - 0x10000; 14822 // NaN means non-codepoint 14823 // Support: Firefox<24 14824 // Workaround erroneous numeric interpretation of +"0x" 14825 return high !== high || escapedWhitespace ? 14826 escaped : 14827 high < 0 ? 14828 // BMP codepoint 14829 String.fromCharCode( high + 0x10000 ) : 14830 // Supplemental Plane codepoint (surrogate pair) 14831 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 14832 }, 14833 14834 // Used for iframes 14835 // See setDocument() 14836 // Removing the function wrapper causes a "Permission Denied" 14837 // error in IE 14838 unloadHandler = function() { 14839 setDocument(); 14840 }; 14841 14842// Optimize for push.apply( _, NodeList ) 14843try { 14844 push.apply( 14845 (arr = slice.call( preferredDoc.childNodes )), 14846 preferredDoc.childNodes 14847 ); 14848 // Support: Android<4.0 14849 // Detect silently failing push.apply 14850 arr[ preferredDoc.childNodes.length ].nodeType; 14851} catch ( e ) { 14852 push = { apply: arr.length ? 14853 14854 // Leverage slice if possible 14855 function( target, els ) { 14856 push_native.apply( target, slice.call(els) ); 14857 } : 14858 14859 // Support: IE<9 14860 // Otherwise append directly 14861 function( target, els ) { 14862 var j = target.length, 14863 i = 0; 14864 // Can't trust NodeList.length 14865 while ( (target[j++] = els[i++]) ) {} 14866 target.length = j - 1; 14867 } 14868 }; 14869} 14870 14871function Sizzle( selector, context, results, seed ) { 14872 var m, i, elem, nid, nidselect, match, groups, newSelector, 14873 newContext = context && context.ownerDocument, 14874 14875 // nodeType defaults to 9, since context defaults to document 14876 nodeType = context ? context.nodeType : 9; 14877 14878 results = results || []; 14879 14880 // Return early from calls with invalid selector or context 14881 if ( typeof selector !== "string" || !selector || 14882 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 14883 14884 return results; 14885 } 14886 14887 // Try to shortcut find operations (as opposed to filters) in HTML documents 14888 if ( !seed ) { 14889 14890 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { 14891 setDocument( context ); 14892 } 14893 context = context || document; 14894 14895 if ( documentIsHTML ) { 14896 14897 // If the selector is sufficiently simple, try using a "get*By*" DOM method 14898 // (excepting DocumentFragment context, where the methods don't exist) 14899 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { 14900 14901 // ID selector 14902 if ( (m = match[1]) ) { 14903 14904 // Document context 14905 if ( nodeType === 9 ) { 14906 if ( (elem = context.getElementById( m )) ) { 14907 14908 // Support: IE, Opera, Webkit 14909 // TODO: identify versions 14910 // getElementById can match elements by name instead of ID 14911 if ( elem.id === m ) { 14912 results.push( elem ); 14913 return results; 14914 } 14915 } else { 14916 return results; 14917 } 14918 14919 // Element context 14920 } else { 14921 14922 // Support: IE, Opera, Webkit 14923 // TODO: identify versions 14924 // getElementById can match elements by name instead of ID 14925 if ( newContext && (elem = newContext.getElementById( m )) && 14926 contains( context, elem ) && 14927 elem.id === m ) { 14928 14929 results.push( elem ); 14930 return results; 14931 } 14932 } 14933 14934 // Type selector 14935 } else if ( match[2] ) { 14936 push.apply( results, context.getElementsByTagName( selector ) ); 14937 return results; 14938 14939 // Class selector 14940 } else if ( (m = match[3]) && support.getElementsByClassName && 14941 context.getElementsByClassName ) { 14942 14943 push.apply( results, context.getElementsByClassName( m ) ); 14944 return results; 14945 } 14946 } 14947 14948 // Take advantage of querySelectorAll 14949 if ( support.qsa && 14950 !compilerCache[ selector + " " ] && 14951 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { 14952 14953 if ( nodeType !== 1 ) { 14954 newContext = context; 14955 newSelector = selector; 14956 14957 // qSA looks outside Element context, which is not what we want 14958 // Thanks to Andrew Dupont for this workaround technique 14959 // Support: IE <=8 14960 // Exclude object elements 14961 } else if ( context.nodeName.toLowerCase() !== "object" ) { 14962 14963 // Capture the context ID, setting it first if necessary 14964 if ( (nid = context.getAttribute( "id" )) ) { 14965 nid = nid.replace( rescape, "\\$&" ); 14966 } else { 14967 context.setAttribute( "id", (nid = expando) ); 14968 } 14969 14970 // Prefix every selector in the list 14971 groups = tokenize( selector ); 14972 i = groups.length; 14973 nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']"; 14974 while ( i-- ) { 14975 groups[i] = nidselect + " " + toSelector( groups[i] ); 14976 } 14977 newSelector = groups.join( "," ); 14978 14979 // Expand context for sibling selectors 14980 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 14981 context; 14982 } 14983 14984 if ( newSelector ) { 14985 try { 14986 push.apply( results, 14987 newContext.querySelectorAll( newSelector ) 14988 ); 14989 return results; 14990 } catch ( qsaError ) { 14991 } finally { 14992 if ( nid === expando ) { 14993 context.removeAttribute( "id" ); 14994 } 14995 } 14996 } 14997 } 14998 } 14999 } 15000 15001 // All others 15002 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 15003} 15004 15005/** 15006 * Create key-value caches of limited size 15007 * @returns {function(string, object)} Returns the Object data after storing it on itself with 15008 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 15009 * deleting the oldest entry 15010 */ 15011function createCache() { 15012 var keys = []; 15013 15014 function cache( key, value ) { 15015 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 15016 if ( keys.push( key + " " ) > Expr.cacheLength ) { 15017 // Only keep the most recent entries 15018 delete cache[ keys.shift() ]; 15019 } 15020 return (cache[ key + " " ] = value); 15021 } 15022 return cache; 15023} 15024 15025/** 15026 * Mark a function for special use by Sizzle 15027 * @param {Function} fn The function to mark 15028 */ 15029function markFunction( fn ) { 15030 fn[ expando ] = true; 15031 return fn; 15032} 15033 15034/** 15035 * Support testing using an element 15036 * @param {Function} fn Passed the created div and expects a boolean result 15037 */ 15038function assert( fn ) { 15039 var div = document.createElement("div"); 15040 15041 try { 15042 return !!fn( div ); 15043 } catch (e) { 15044 return false; 15045 } finally { 15046 // Remove from its parent by default 15047 if ( div.parentNode ) { 15048 div.parentNode.removeChild( div ); 15049 } 15050 // release memory in IE 15051 div = null; 15052 } 15053} 15054 15055/** 15056 * Adds the same handler for all of the specified attrs 15057 * @param {String} attrs Pipe-separated list of attributes 15058 * @param {Function} handler The method that will be applied 15059 */ 15060function addHandle( attrs, handler ) { 15061 var arr = attrs.split("|"), 15062 i = arr.length; 15063 15064 while ( i-- ) { 15065 Expr.attrHandle[ arr[i] ] = handler; 15066 } 15067} 15068 15069/** 15070 * Checks document order of two siblings 15071 * @param {Element} a 15072 * @param {Element} b 15073 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 15074 */ 15075function siblingCheck( a, b ) { 15076 var cur = b && a, 15077 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 15078 ( ~b.sourceIndex || MAX_NEGATIVE ) - 15079 ( ~a.sourceIndex || MAX_NEGATIVE ); 15080 15081 // Use IE sourceIndex if available on both nodes 15082 if ( diff ) { 15083 return diff; 15084 } 15085 15086 // Check if b follows a 15087 if ( cur ) { 15088 while ( (cur = cur.nextSibling) ) { 15089 if ( cur === b ) { 15090 return -1; 15091 } 15092 } 15093 } 15094 15095 return a ? 1 : -1; 15096} 15097 15098/** 15099 * Returns a function to use in pseudos for input types 15100 * @param {String} type 15101 */ 15102function createInputPseudo( type ) { 15103 return function( elem ) { 15104 var name = elem.nodeName.toLowerCase(); 15105 return name === "input" && elem.type === type; 15106 }; 15107} 15108 15109/** 15110 * Returns a function to use in pseudos for buttons 15111 * @param {String} type 15112 */ 15113function createButtonPseudo( type ) { 15114 return function( elem ) { 15115 var name = elem.nodeName.toLowerCase(); 15116 return (name === "input" || name === "button") && elem.type === type; 15117 }; 15118} 15119 15120/** 15121 * Returns a function to use in pseudos for positionals 15122 * @param {Function} fn 15123 */ 15124function createPositionalPseudo( fn ) { 15125 return markFunction(function( argument ) { 15126 argument = +argument; 15127 return markFunction(function( seed, matches ) { 15128 var j, 15129 matchIndexes = fn( [], seed.length, argument ), 15130 i = matchIndexes.length; 15131 15132 // Match elements found at the specified indexes 15133 while ( i-- ) { 15134 if ( seed[ (j = matchIndexes[i]) ] ) { 15135 seed[j] = !(matches[j] = seed[j]); 15136 } 15137 } 15138 }); 15139 }); 15140} 15141 15142/** 15143 * Checks a node for validity as a Sizzle context 15144 * @param {Element|Object=} context 15145 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 15146 */ 15147function testContext( context ) { 15148 return context && typeof context.getElementsByTagName !== "undefined" && context; 15149} 15150 15151// Expose support vars for convenience 15152support = Sizzle.support = {}; 15153 15154/** 15155 * Detects XML nodes 15156 * @param {Element|Object} elem An element or a document 15157 * @returns {Boolean} True iff elem is a non-HTML XML node 15158 */ 15159isXML = Sizzle.isXML = function( elem ) { 15160 // documentElement is verified for cases where it doesn't yet exist 15161 // (such as loading iframes in IE - #4833) 15162 var documentElement = elem && (elem.ownerDocument || elem).documentElement; 15163 return documentElement ? documentElement.nodeName !== "HTML" : false; 15164}; 15165 15166/** 15167 * Sets document-related variables once based on the current document 15168 * @param {Element|Object} [doc] An element or document object to use to set the document 15169 * @returns {Object} Returns the current document 15170 */ 15171setDocument = Sizzle.setDocument = function( node ) { 15172 var hasCompare, parent, 15173 doc = node ? node.ownerDocument || node : preferredDoc; 15174 15175 // Return early if doc is invalid or already selected 15176 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { 15177 return document; 15178 } 15179 15180 // Update global variables 15181 document = doc; 15182 docElem = document.documentElement; 15183 documentIsHTML = !isXML( document ); 15184 15185 // Support: IE 9-11, Edge 15186 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 15187 if ( (parent = document.defaultView) && parent.top !== parent ) { 15188 // Support: IE 11 15189 if ( parent.addEventListener ) { 15190 parent.addEventListener( "unload", unloadHandler, false ); 15191 15192 // Support: IE 9 - 10 only 15193 } else if ( parent.attachEvent ) { 15194 parent.attachEvent( "onunload", unloadHandler ); 15195 } 15196 } 15197 15198 /* Attributes 15199 ---------------------------------------------------------------------- */ 15200 15201 // Support: IE<8 15202 // Verify that getAttribute really returns attributes and not properties 15203 // (excepting IE8 booleans) 15204 support.attributes = assert(function( div ) { 15205 div.className = "i"; 15206 return !div.getAttribute("className"); 15207 }); 15208 15209 /* getElement(s)By* 15210 ---------------------------------------------------------------------- */ 15211 15212 // Check if getElementsByTagName("*") returns only elements 15213 support.getElementsByTagName = assert(function( div ) { 15214 div.appendChild( document.createComment("") ); 15215 return !div.getElementsByTagName("*").length; 15216 }); 15217 15218 // Support: IE<9 15219 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 15220 15221 // Support: IE<10 15222 // Check if getElementById returns elements by name 15223 // The broken getElementById methods don't pick up programatically-set names, 15224 // so use a roundabout getElementsByName test 15225 support.getById = assert(function( div ) { 15226 docElem.appendChild( div ).id = expando; 15227 return !document.getElementsByName || !document.getElementsByName( expando ).length; 15228 }); 15229 15230 // ID find and filter 15231 if ( support.getById ) { 15232 Expr.find["ID"] = function( id, context ) { 15233 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 15234 var m = context.getElementById( id ); 15235 return m ? [ m ] : []; 15236 } 15237 }; 15238 Expr.filter["ID"] = function( id ) { 15239 var attrId = id.replace( runescape, funescape ); 15240 return function( elem ) { 15241 return elem.getAttribute("id") === attrId; 15242 }; 15243 }; 15244 } else { 15245 // Support: IE6/7 15246 // getElementById is not reliable as a find shortcut 15247 delete Expr.find["ID"]; 15248 15249 Expr.filter["ID"] = function( id ) { 15250 var attrId = id.replace( runescape, funescape ); 15251 return function( elem ) { 15252 var node = typeof elem.getAttributeNode !== "undefined" && 15253 elem.getAttributeNode("id"); 15254 return node && node.value === attrId; 15255 }; 15256 }; 15257 } 15258 15259 // Tag 15260 Expr.find["TAG"] = support.getElementsByTagName ? 15261 function( tag, context ) { 15262 if ( typeof context.getElementsByTagName !== "undefined" ) { 15263 return context.getElementsByTagName( tag ); 15264 15265 // DocumentFragment nodes don't have gEBTN 15266 } else if ( support.qsa ) { 15267 return context.querySelectorAll( tag ); 15268 } 15269 } : 15270 15271 function( tag, context ) { 15272 var elem, 15273 tmp = [], 15274 i = 0, 15275 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 15276 results = context.getElementsByTagName( tag ); 15277 15278 // Filter out possible comments 15279 if ( tag === "*" ) { 15280 while ( (elem = results[i++]) ) { 15281 if ( elem.nodeType === 1 ) { 15282 tmp.push( elem ); 15283 } 15284 } 15285 15286 return tmp; 15287 } 15288 return results; 15289 }; 15290 15291 // Class 15292 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { 15293 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 15294 return context.getElementsByClassName( className ); 15295 } 15296 }; 15297 15298 /* QSA/matchesSelector 15299 ---------------------------------------------------------------------- */ 15300 15301 // QSA and matchesSelector support 15302 15303 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 15304 rbuggyMatches = []; 15305 15306 // qSa(:focus) reports false when true (Chrome 21) 15307 // We allow this because of a bug in IE8/9 that throws an error 15308 // whenever `document.activeElement` is accessed on an iframe 15309 // So, we allow :focus to pass through QSA all the time to avoid the IE error 15310 // See http://bugs.jquery.com/ticket/13378 15311 rbuggyQSA = []; 15312 15313 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { 15314 // Build QSA regex 15315 // Regex strategy adopted from Diego Perini 15316 assert(function( div ) { 15317 // Select is set to empty string on purpose 15318 // This is to test IE's treatment of not explicitly 15319 // setting a boolean content attribute, 15320 // since its presence should be enough 15321 // http://bugs.jquery.com/ticket/12359 15322 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" + 15323 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 15324 "<option selected=''></option></select>"; 15325 15326 // Support: IE8, Opera 11-12.16 15327 // Nothing should be selected when empty strings follow ^= or $= or *= 15328 // The test attribute must be unknown in Opera but "safe" for WinRT 15329 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 15330 if ( div.querySelectorAll("[msallowcapture^='']").length ) { 15331 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 15332 } 15333 15334 // Support: IE8 15335 // Boolean attributes and "value" are not treated correctly 15336 if ( !div.querySelectorAll("[selected]").length ) { 15337 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 15338 } 15339 15340 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 15341 if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 15342 rbuggyQSA.push("~="); 15343 } 15344 15345 // Webkit/Opera - :checked should return selected option elements 15346 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 15347 // IE8 throws error here and will not see later tests 15348 if ( !div.querySelectorAll(":checked").length ) { 15349 rbuggyQSA.push(":checked"); 15350 } 15351 15352 // Support: Safari 8+, iOS 8+ 15353 // https://bugs.webkit.org/show_bug.cgi?id=136851 15354 // In-page `selector#id sibing-combinator selector` fails 15355 if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { 15356 rbuggyQSA.push(".#.+[+~]"); 15357 } 15358 }); 15359 15360 assert(function( div ) { 15361 // Support: Windows 8 Native Apps 15362 // The type and name attributes are restricted during .innerHTML assignment 15363 var input = document.createElement("input"); 15364 input.setAttribute( "type", "hidden" ); 15365 div.appendChild( input ).setAttribute( "name", "D" ); 15366 15367 // Support: IE8 15368 // Enforce case-sensitivity of name attribute 15369 if ( div.querySelectorAll("[name=d]").length ) { 15370 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 15371 } 15372 15373 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 15374 // IE8 throws error here and will not see later tests 15375 if ( !div.querySelectorAll(":enabled").length ) { 15376 rbuggyQSA.push( ":enabled", ":disabled" ); 15377 } 15378 15379 // Opera 10-11 does not throw on post-comma invalid pseudos 15380 div.querySelectorAll("*,:x"); 15381 rbuggyQSA.push(",.*:"); 15382 }); 15383 } 15384 15385 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || 15386 docElem.webkitMatchesSelector || 15387 docElem.mozMatchesSelector || 15388 docElem.oMatchesSelector || 15389 docElem.msMatchesSelector) )) ) { 15390 15391 assert(function( div ) { 15392 // Check to see if it's possible to do matchesSelector 15393 // on a disconnected node (IE 9) 15394 support.disconnectedMatch = matches.call( div, "div" ); 15395 15396 // This should fail with an exception 15397 // Gecko does not error, returns false instead 15398 matches.call( div, "[s!='']:x" ); 15399 rbuggyMatches.push( "!=", pseudos ); 15400 }); 15401 } 15402 15403 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); 15404 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); 15405 15406 /* Contains 15407 ---------------------------------------------------------------------- */ 15408 hasCompare = rnative.test( docElem.compareDocumentPosition ); 15409 15410 // Element contains another 15411 // Purposefully self-exclusive 15412 // As in, an element does not contain itself 15413 contains = hasCompare || rnative.test( docElem.contains ) ? 15414 function( a, b ) { 15415 var adown = a.nodeType === 9 ? a.documentElement : a, 15416 bup = b && b.parentNode; 15417 return a === bup || !!( bup && bup.nodeType === 1 && ( 15418 adown.contains ? 15419 adown.contains( bup ) : 15420 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 15421 )); 15422 } : 15423 function( a, b ) { 15424 if ( b ) { 15425 while ( (b = b.parentNode) ) { 15426 if ( b === a ) { 15427 return true; 15428 } 15429 } 15430 } 15431 return false; 15432 }; 15433 15434 /* Sorting 15435 ---------------------------------------------------------------------- */ 15436 15437 // Document order sorting 15438 sortOrder = hasCompare ? 15439 function( a, b ) { 15440 15441 // Flag for duplicate removal 15442 if ( a === b ) { 15443 hasDuplicate = true; 15444 return 0; 15445 } 15446 15447 // Sort on method existence if only one input has compareDocumentPosition 15448 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 15449 if ( compare ) { 15450 return compare; 15451 } 15452 15453 // Calculate position if both inputs belong to the same document 15454 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? 15455 a.compareDocumentPosition( b ) : 15456 15457 // Otherwise we know they are disconnected 15458 1; 15459 15460 // Disconnected nodes 15461 if ( compare & 1 || 15462 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { 15463 15464 // Choose the first element that is related to our preferred document 15465 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { 15466 return -1; 15467 } 15468 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { 15469 return 1; 15470 } 15471 15472 // Maintain original order 15473 return sortInput ? 15474 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 15475 0; 15476 } 15477 15478 return compare & 4 ? -1 : 1; 15479 } : 15480 function( a, b ) { 15481 // Exit early if the nodes are identical 15482 if ( a === b ) { 15483 hasDuplicate = true; 15484 return 0; 15485 } 15486 15487 var cur, 15488 i = 0, 15489 aup = a.parentNode, 15490 bup = b.parentNode, 15491 ap = [ a ], 15492 bp = [ b ]; 15493 15494 // Parentless nodes are either documents or disconnected 15495 if ( !aup || !bup ) { 15496 return a === document ? -1 : 15497 b === document ? 1 : 15498 aup ? -1 : 15499 bup ? 1 : 15500 sortInput ? 15501 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 15502 0; 15503 15504 // If the nodes are siblings, we can do a quick check 15505 } else if ( aup === bup ) { 15506 return siblingCheck( a, b ); 15507 } 15508 15509 // Otherwise we need full lists of their ancestors for comparison 15510 cur = a; 15511 while ( (cur = cur.parentNode) ) { 15512 ap.unshift( cur ); 15513 } 15514 cur = b; 15515 while ( (cur = cur.parentNode) ) { 15516 bp.unshift( cur ); 15517 } 15518 15519 // Walk down the tree looking for a discrepancy 15520 while ( ap[i] === bp[i] ) { 15521 i++; 15522 } 15523 15524 return i ? 15525 // Do a sibling check if the nodes have a common ancestor 15526 siblingCheck( ap[i], bp[i] ) : 15527 15528 // Otherwise nodes in our document sort first 15529 ap[i] === preferredDoc ? -1 : 15530 bp[i] === preferredDoc ? 1 : 15531 0; 15532 }; 15533 15534 return document; 15535}; 15536 15537Sizzle.matches = function( expr, elements ) { 15538 return Sizzle( expr, null, null, elements ); 15539}; 15540 15541Sizzle.matchesSelector = function( elem, expr ) { 15542 // Set document vars if needed 15543 if ( ( elem.ownerDocument || elem ) !== document ) { 15544 setDocument( elem ); 15545 } 15546 15547 // Make sure that attribute selectors are quoted 15548 expr = expr.replace( rattributeQuotes, "='$1']" ); 15549 15550 if ( support.matchesSelector && documentIsHTML && 15551 !compilerCache[ expr + " " ] && 15552 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 15553 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 15554 15555 try { 15556 var ret = matches.call( elem, expr ); 15557 15558 // IE 9's matchesSelector returns false on disconnected nodes 15559 if ( ret || support.disconnectedMatch || 15560 // As well, disconnected nodes are said to be in a document 15561 // fragment in IE 9 15562 elem.document && elem.document.nodeType !== 11 ) { 15563 return ret; 15564 } 15565 } catch (e) {} 15566 } 15567 15568 return Sizzle( expr, document, null, [ elem ] ).length > 0; 15569}; 15570 15571Sizzle.contains = function( context, elem ) { 15572 // Set document vars if needed 15573 if ( ( context.ownerDocument || context ) !== document ) { 15574 setDocument( context ); 15575 } 15576 return contains( context, elem ); 15577}; 15578 15579Sizzle.attr = function( elem, name ) { 15580 // Set document vars if needed 15581 if ( ( elem.ownerDocument || elem ) !== document ) { 15582 setDocument( elem ); 15583 } 15584 15585 var fn = Expr.attrHandle[ name.toLowerCase() ], 15586 // Don't get fooled by Object.prototype properties (jQuery #13807) 15587 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 15588 fn( elem, name, !documentIsHTML ) : 15589 undefined; 15590 15591 return val !== undefined ? 15592 val : 15593 support.attributes || !documentIsHTML ? 15594 elem.getAttribute( name ) : 15595 (val = elem.getAttributeNode(name)) && val.specified ? 15596 val.value : 15597 null
vendor: 13,569 bytes, lines 15597-16067
15597; 15598}; 15599 15600Sizzle.error = function( msg ) { 15601 throw new Error( "Syntax error, unrecognized expression: " + msg ); 15602}; 15603 15604/** 15605 * Document sorting and removing duplicates 15606 * @param {ArrayLike} results 15607 */ 15608Sizzle.uniqueSort = function( results ) { 15609 var elem, 15610 duplicates = [], 15611 j = 0, 15612 i = 0; 15613 15614 // Unless we *know* we can detect duplicates, assume their presence 15615 hasDuplicate = !support.detectDuplicates; 15616 sortInput = !support.sortStable && results.slice( 0 ); 15617 results.sort( sortOrder ); 15618 15619 if ( hasDuplicate ) { 15620 while ( (elem = results[i++]) ) { 15621 if ( elem === results[ i ] ) { 15622 j = duplicates.push( i ); 15623 } 15624 } 15625 while ( j-- ) { 15626 results.splice( duplicates[ j ], 1 ); 15627 } 15628 } 15629 15630 // Clear input after sorting to release objects 15631 // See https://github.com/jquery/sizzle/pull/225 15632 sortInput = null; 15633 15634 return results; 15635}; 15636 15637/** 15638 * Utility function for retrieving the text value of an array of DOM nodes 15639 * @param {Array|Element} elem 15640 */ 15641getText = Sizzle.getText = function( elem ) { 15642 var node, 15643 ret = "", 15644 i = 0, 15645 nodeType = elem.nodeType; 15646 15647 if ( !nodeType ) { 15648 // If no nodeType, this is expected to be an array 15649 while ( (node = elem[i++]) ) { 15650 // Do not traverse comment nodes 15651 ret += getText( node ); 15652 } 15653 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 15654 // Use textContent for elements 15655 // innerText usage removed for consistency of new lines (jQuery #11153) 15656 if ( typeof elem.textContent === "string" ) { 15657 return elem.textContent; 15658 } else { 15659 // Traverse its children 15660 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 15661 ret += getText( elem ); 15662 } 15663 } 15664 } else if ( nodeType === 3 || nodeType === 4 ) { 15665 return elem.nodeValue; 15666 } 15667 // Do not include comment or processing instruction nodes 15668 15669 return ret; 15670}; 15671 15672Expr = Sizzle.selectors = { 15673 15674 // Can be adjusted by the user 15675 cacheLength: 50, 15676 15677 createPseudo: markFunction, 15678 15679 match: matchExpr, 15680 15681 attrHandle: {}, 15682 15683 find: {}, 15684 15685 relative: { 15686 ">": { dir: "parentNode", first: true }, 15687 " ": { dir: "parentNode" }, 15688 "+": { dir: "previousSibling", first: true }, 15689 "~": { dir: "previousSibling" } 15690 }, 15691 15692 preFilter: { 15693 "ATTR": function( match ) { 15694 match[1] = match[1].replace( runescape, funescape ); 15695 15696 // Move the given value to match[3] whether quoted or unquoted 15697 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); 15698 15699 if ( match[2] === "~=" ) { 15700 match[3] = " " + match[3] + " "; 15701 } 15702 15703 return match.slice( 0, 4 ); 15704 }, 15705 15706 "CHILD": function( match ) { 15707 /* matches from matchExpr["CHILD"] 15708 1 type (only|nth|...) 15709 2 what (child|of-type) 15710 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 15711 4 xn-component of xn+y argument ([+-]?\d*n|) 15712 5 sign of xn-component 15713 6 x of xn-component 15714 7 sign of y-component 15715 8 y of y-component 15716 */ 15717 match[1] = match[1].toLowerCase(); 15718 15719 if ( match[1].slice( 0, 3 ) === "nth" ) { 15720 // nth-* requires argument 15721 if ( !match[3] ) { 15722 Sizzle.error( match[0] ); 15723 } 15724 15725 // numeric x and y parameters for Expr.filter.CHILD 15726 // remember that false/true cast respectively to 0/1 15727 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); 15728 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); 15729 15730 // other types prohibit arguments 15731 } else if ( match[3] ) { 15732 Sizzle.error( match[0] ); 15733 } 15734 15735 return match; 15736 }, 15737 15738 "PSEUDO": function( match ) { 15739 var excess, 15740 unquoted = !match[6] && match[2]; 15741 15742 if ( matchExpr["CHILD"].test( match[0] ) ) { 15743 return null; 15744 } 15745 15746 // Accept quoted arguments as-is 15747 if ( match[3] ) { 15748 match[2] = match[4] || match[5] || ""; 15749 15750 // Strip excess characters from unquoted arguments 15751 } else if ( unquoted && rpseudo.test( unquoted ) && 15752 // Get excess from tokenize (recursively) 15753 (excess = tokenize( unquoted, true )) && 15754 // advance to the next closing parenthesis 15755 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { 15756 15757 // excess is a negative index 15758 match[0] = match[0].slice( 0, excess ); 15759 match[2] = unquoted.slice( 0, excess ); 15760 } 15761 15762 // Return only captures needed by the pseudo filter method (type and argument) 15763 return match.slice( 0, 3 ); 15764 } 15765 }, 15766 15767 filter: { 15768 15769 "TAG": function( nodeNameSelector ) { 15770 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 15771 return nodeNameSelector === "*" ? 15772 function() { return true; } : 15773 function( elem ) { 15774 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 15775 }; 15776 }, 15777 15778 "CLASS": function( className ) { 15779 var pattern = classCache[ className + " " ]; 15780 15781 return pattern || 15782 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && 15783 classCache( className, function( elem ) { 15784 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); 15785 }); 15786 }, 15787 15788 "ATTR": function( name, operator, check ) { 15789 return function( elem ) { 15790 var result = Sizzle.attr( elem, name ); 15791 15792 if ( result == null ) { 15793 return operator === "!="; 15794 } 15795 if ( !operator ) { 15796 return true; 15797 } 15798 15799 result += ""; 15800 15801 return operator === "=" ? result === check : 15802 operator === "!=" ? result !== check : 15803 operator === "^=" ? check && result.indexOf( check ) === 0 : 15804 operator === "*=" ? check && result.indexOf( check ) > -1 : 15805 operator === "$=" ? check && result.slice( -check.length ) === check : 15806 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 15807 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 15808 false; 15809 }; 15810 }, 15811 15812 "CHILD": function( type, what, argument, first, last ) { 15813 var simple = type.slice( 0, 3 ) !== "nth", 15814 forward = type.slice( -4 ) !== "last", 15815 ofType = what === "of-type"; 15816 15817 return first === 1 && last === 0 ? 15818 15819 // Shortcut for :nth-*(n) 15820 function( elem ) { 15821 return !!elem.parentNode; 15822 } : 15823 15824 function( elem, context, xml ) { 15825 var cache, uniqueCache, outerCache, node, nodeIndex, start, 15826 dir = simple !== forward ? "nextSibling" : "previousSibling", 15827 parent = elem.parentNode, 15828 name = ofType && elem.nodeName.toLowerCase(), 15829 useCache = !xml && !ofType, 15830 diff = false; 15831 15832 if ( parent ) { 15833 15834 // :(first|last|only)-(child|of-type) 15835 if ( simple ) { 15836 while ( dir ) { 15837 node = elem; 15838 while ( (node = node[ dir ]) ) { 15839 if ( ofType ? 15840 node.nodeName.toLowerCase() === name : 15841 node.nodeType === 1 ) { 15842 15843 return false; 15844 } 15845 } 15846 // Reverse direction for :only-* (if we haven't yet done so) 15847 start = dir = type === "only" && !start && "nextSibling"; 15848 } 15849 return true; 15850 } 15851 15852 start = [ forward ? parent.firstChild : parent.lastChild ]; 15853 15854 // non-xml :nth-child(...) stores cache data on `parent` 15855 if ( forward && useCache ) { 15856 15857 // Seek `elem` from a previously-cached index 15858 15859 // ...in a gzip-friendly way 15860 node = parent; 15861 outerCache = node[ expando ] || (node[ expando ] = {}); 15862 15863 // Support: IE <9 only 15864 // Defend against cloned attroperties (jQuery gh-1709) 15865 uniqueCache = outerCache[ node.uniqueID ] || 15866 (outerCache[ node.uniqueID ] = {}); 15867 15868 cache = uniqueCache[ type ] || []; 15869 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 15870 diff = nodeIndex && cache[ 2 ]; 15871 node = nodeIndex && parent.childNodes[ nodeIndex ]; 15872 15873 while ( (node = ++nodeIndex && node && node[ dir ] || 15874 15875 // Fallback to seeking `elem` from the start 15876 (diff = nodeIndex = 0) || start.pop()) ) { 15877 15878 // When found, cache indexes on `parent` and break 15879 if ( node.nodeType === 1 && ++diff && node === elem ) { 15880 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 15881 break; 15882 } 15883 } 15884 15885 } else { 15886 // Use previously-cached element index if available 15887 if ( useCache ) { 15888 // ...in a gzip-friendly way 15889 node = elem; 15890 outerCache = node[ expando ] || (node[ expando ] = {}); 15891 15892 // Support: IE <9 only 15893 // Defend against cloned attroperties (jQuery gh-1709) 15894 uniqueCache = outerCache[ node.uniqueID ] || 15895 (outerCache[ node.uniqueID ] = {}); 15896 15897 cache = uniqueCache[ type ] || []; 15898 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 15899 diff = nodeIndex; 15900 } 15901 15902 // xml :nth-child(...) 15903 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 15904 if ( diff === false ) { 15905 // Use the same loop as above to seek `elem` from the start 15906 while ( (node = ++nodeIndex && node && node[ dir ] || 15907 (diff = nodeIndex = 0) || start.pop()) ) { 15908 15909 if ( ( ofType ? 15910 node.nodeName.toLowerCase() === name : 15911 node.nodeType === 1 ) && 15912 ++diff ) { 15913 15914 // Cache the index of each encountered element 15915 if ( useCache ) { 15916 outerCache = node[ expando ] || (node[ expando ] = {}); 15917 15918 // Support: IE <9 only 15919 // Defend against cloned attroperties (jQuery gh-1709) 15920 uniqueCache = outerCache[ node.uniqueID ] || 15921 (outerCache[ node.uniqueID ] = {}); 15922 15923 uniqueCache[ type ] = [ dirruns, diff ]; 15924 } 15925 15926 if ( node === elem ) { 15927 break; 15928 } 15929 } 15930 } 15931 } 15932 } 15933 15934 // Incorporate the offset, then check against cycle size 15935 diff -= last; 15936 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 15937 } 15938 }; 15939 }, 15940 15941 "PSEUDO": function( pseudo, argument ) { 15942 // pseudo-class names are case-insensitive 15943 // http://www.w3.org/TR/selectors/#pseudo-classes 15944 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 15945 // Remember that setFilters inherits from pseudos 15946 var args, 15947 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 15948 Sizzle.error( "unsupported pseudo: " + pseudo ); 15949 15950 // The user may use createPseudo to indicate that 15951 // arguments are needed to create the filter function 15952 // just as Sizzle does 15953 if ( fn[ expando ] ) { 15954 return fn( argument ); 15955 } 15956 15957 // But maintain support for old signatures 15958 if ( fn.length > 1 ) { 15959 args = [ pseudo, pseudo, "", argument ]; 15960 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 15961 markFunction(function( seed, matches ) { 15962 var idx, 15963 matched = fn( seed, argument ), 15964 i = matched.length; 15965 while ( i-- ) { 15966 idx = indexOf( seed, matched[i] ); 15967 seed[ idx ] = !( matches[ idx ] = matched[i] ); 15968 } 15969 }) : 15970 function( elem ) { 15971 return fn( elem, 0, args ); 15972 }; 15973 } 15974 15975 return fn; 15976 } 15977 }, 15978 15979 pseudos: { 15980 // Potentially complex pseudos 15981 "not": markFunction(function( selector ) { 15982 // Trim the selector passed to compile 15983 // to avoid treating leading and trailing 15984 // spaces as combinators 15985 var input = [], 15986 results = [], 15987 matcher = compile( selector.replace( rtrim, "$1" ) ); 15988 15989 return matcher[ expando ] ? 15990 markFunction(function( seed, matches, context, xml ) { 15991 var elem, 15992 unmatched = matcher( seed, null, xml, [] ), 15993 i = seed.length; 15994 15995 // Match elements unmatched by `matcher` 15996 while ( i-- ) { 15997 if ( (elem = unmatched[i]) ) { 15998 seed[i] = !(matches[i] = elem); 15999 } 16000 } 16001 }) : 16002 function( elem, context, xml ) { 16003 input[0] = elem; 16004 matcher( input, null, xml, results ); 16005 // Don't keep the element (issue #299) 16006 input[0] = null; 16007 return !results.pop(); 16008 }; 16009 }), 16010 16011 "has": markFunction(function( selector ) { 16012 return function( elem ) { 16013 return Sizzle( selector, elem ).length > 0; 16014 }; 16015 }), 16016 16017 "contains": markFunction(function( text ) { 16018 text = text.replace( runescape, funescape ); 16019 return function( elem ) { 16020 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; 16021 }; 16022 }), 16023 16024 // "Whether an element is represented by a :lang() selector 16025 // is based solely on the element's language value 16026 // being equal to the identifier C, 16027 // or beginning with the identifier C immediately followed by "-". 16028 // The matching of C against the element's language value is performed case-insensitively. 16029 // The identifier C does not have to be a valid language name." 16030 // http://www.w3.org/TR/selectors/#lang-pseudo 16031 "lang": markFunction( function( lang ) { 16032 // lang value must be a valid identifier 16033 if ( !ridentifier.test(lang || "") ) { 16034 Sizzle.error( "unsupported lang: " + lang ); 16035 } 16036 lang = lang.replace( runescape, funescape ).toLowerCase(); 16037 return function( elem ) { 16038 var elemLang; 16039 do { 16040 if ( (elemLang = documentIsHTML ? 16041 elem.lang : 16042 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { 16043 16044 elemLang = elemLang.toLowerCase(); 16045 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 16046 } 16047 } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); 16048 return false; 16049 }; 16050 }), 16051 16052 // Miscellaneous 16053 "target": function( elem ) { 16054 var hash = window.location && window.location.hash; 16055 return hash && hash.slice( 1 ) === elem.id; 16056 }, 16057 16058 "root": function( elem ) { 16059 return elem === docElem; 16060 }, 16061 16062 "focus": function( elem ) { 16063 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); 16064 }, 16065 16066 // Boolean properties 16067 "enabled":
vendor: 6,738 bytes, lines 16067-16318
16067function( elem ) { 16068 return elem.disabled === false; 16069 }, 16070 16071 "disabled": function( elem ) { 16072 return elem.disabled === true; 16073 }, 16074 16075 "checked": function( elem ) { 16076 // In CSS3, :checked should return both checked and selected elements 16077 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 16078 var nodeName = elem.nodeName.toLowerCase(); 16079 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); 16080 }, 16081 16082 "selected": function( elem ) { 16083 // Accessing this property makes selected-by-default 16084 // options in Safari work properly 16085 if ( elem.parentNode ) { 16086 elem.parentNode.selectedIndex; 16087 } 16088 16089 return elem.selected === true; 16090 }, 16091 16092 // Contents 16093 "empty": function( elem ) { 16094 // http://www.w3.org/TR/selectors/#empty-pseudo 16095 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 16096 // but not by others (comment: 8; processing instruction: 7; etc.) 16097 // nodeType < 6 works because attributes (2) do not appear as children 16098 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 16099 if ( elem.nodeType < 6 ) { 16100 return false; 16101 } 16102 } 16103 return true; 16104 }, 16105 16106 "parent": function( elem ) { 16107 return !Expr.pseudos["empty"]( elem ); 16108 }, 16109 16110 // Element/input types 16111 "header": function( elem ) { 16112 return rheader.test( elem.nodeName ); 16113 }, 16114 16115 "input": function( elem ) { 16116 return rinputs.test( elem.nodeName ); 16117 }, 16118 16119 "button": function( elem ) { 16120 var name = elem.nodeName.toLowerCase(); 16121 return name === "input" && elem.type === "button" || name === "button"; 16122 }, 16123 16124 "text": function( elem ) { 16125 var attr; 16126 return elem.nodeName.toLowerCase() === "input" && 16127 elem.type === "text" && 16128 16129 // Support: IE<8 16130 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 16131 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); 16132 }, 16133 16134 // Position-in-collection 16135 "first": createPositionalPseudo(function() { 16136 return [ 0 ]; 16137 }), 16138 16139 "last": createPositionalPseudo(function( matchIndexes, length ) { 16140 return [ length - 1 ]; 16141 }), 16142 16143 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { 16144 return [ argument < 0 ? argument + length : argument ]; 16145 }), 16146 16147 "even": createPositionalPseudo(function( matchIndexes, length ) { 16148 var i = 0; 16149 for ( ; i < length; i += 2 ) { 16150 matchIndexes.push( i ); 16151 } 16152 return matchIndexes; 16153 }), 16154 16155 "odd": createPositionalPseudo(function( matchIndexes, length ) { 16156 var i = 1; 16157 for ( ; i < length; i += 2 ) { 16158 matchIndexes.push( i ); 16159 } 16160 return matchIndexes; 16161 }), 16162 16163 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { 16164 var i = argument < 0 ? argument + length : argument; 16165 for ( ; --i >= 0; ) { 16166 matchIndexes.push( i ); 16167 } 16168 return matchIndexes; 16169 }), 16170 16171 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { 16172 var i = argument < 0 ? argument + length : argument; 16173 for ( ; ++i < length; ) { 16174 matchIndexes.push( i ); 16175 } 16176 return matchIndexes; 16177 }) 16178 } 16179}; 16180 16181Expr.pseudos["nth"] = Expr.pseudos["eq"]; 16182 16183// Add button/input type pseudos 16184for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 16185 Expr.pseudos[ i ] = createInputPseudo( i ); 16186} 16187for ( i in { submit: true, reset: true } ) { 16188 Expr.pseudos[ i ] = createButtonPseudo( i ); 16189} 16190 16191// Easy API for creating new setFilters 16192function setFilters() {} 16193setFilters.prototype = Expr.filters = Expr.pseudos; 16194Expr.setFilters = new setFilters(); 16195 16196tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 16197 var matched, match, tokens, type, 16198 soFar, groups, preFilters, 16199 cached = tokenCache[ selector + " " ]; 16200 16201 if ( cached ) { 16202 return parseOnly ? 0 : cached.slice( 0 ); 16203 } 16204 16205 soFar = selector; 16206 groups = []; 16207 preFilters = Expr.preFilter; 16208 16209 while ( soFar ) { 16210 16211 // Comma and first run 16212 if ( !matched || (match = rcomma.exec( soFar )) ) { 16213 if ( match ) { 16214 // Don't consume trailing commas as valid 16215 soFar = soFar.slice( match[0].length ) || soFar; 16216 } 16217 groups.push( (tokens = []) ); 16218 } 16219 16220 matched = false; 16221 16222 // Combinators 16223 if ( (match = rcombinators.exec( soFar )) ) { 16224 matched = match.shift(); 16225 tokens.push({ 16226 value: matched, 16227 // Cast descendant combinators to space 16228 type: match[0].replace( rtrim, " " ) 16229 }); 16230 soFar = soFar.slice( matched.length ); 16231 } 16232 16233 // Filters 16234 for ( type in Expr.filter ) { 16235 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || 16236 (match = preFilters[ type ]( match ))) ) { 16237 matched = match.shift(); 16238 tokens.push({ 16239 value: matched, 16240 type: type, 16241 matches: match 16242 }); 16243 soFar = soFar.slice( matched.length ); 16244 } 16245 } 16246 16247 if ( !matched ) { 16248 break; 16249 } 16250 } 16251 16252 // Return the length of the invalid excess 16253 // if we're just parsing 16254 // Otherwise, throw an error or return tokens 16255 return parseOnly ? 16256 soFar.length : 16257 soFar ? 16258 Sizzle.error( selector ) : 16259 // Cache the tokens 16260 tokenCache( selector, groups ).slice( 0 ); 16261}; 16262 16263function toSelector( tokens ) { 16264 var i = 0, 16265 len = tokens.length, 16266 selector = ""; 16267 for ( ; i < len; i++ ) { 16268 selector += tokens[i].value; 16269 } 16270 return selector; 16271} 16272 16273function addCombinator( matcher, combinator, base ) { 16274 var dir = combinator.dir, 16275 checkNonElements = base && dir === "parentNode", 16276 doneName = done++; 16277 16278 return combinator.first ? 16279 // Check against closest ancestor/preceding element 16280 function( elem, context, xml ) { 16281 while ( (elem = elem[ dir ]) ) { 16282 if ( elem.nodeType === 1 || checkNonElements ) { 16283 return matcher( elem, context, xml ); 16284 } 16285 } 16286 } : 16287 16288 // Check against all ancestor/preceding elements 16289 function( elem, context, xml ) { 16290 var oldCache, uniqueCache, outerCache, 16291 newCache = [ dirruns, doneName ]; 16292 16293 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 16294 if ( xml ) { 16295 while ( (elem = elem[ dir ]) ) { 16296 if ( elem.nodeType === 1 || checkNonElements ) { 16297 if ( matcher( elem, context, xml ) ) { 16298 return true; 16299 } 16300 } 16301 } 16302 } else { 16303 while ( (elem = elem[ dir ]) ) { 16304 if ( elem.nodeType === 1 || checkNonElements ) { 16305 outerCache = elem[ expando ] || (elem[ expando ] = {}); 16306 16307 // Support: IE <9 only 16308 // Defend against cloned attroperties (jQuery gh-1709) 16309 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); 16310 16311 if ( (oldCache = uniqueCache[ dir ]) && 16312 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 16313 16314 // Assign to newCache so results back-propagate to previous elements 16315 return (newCache[ 2 ] = oldCache[ 2 ]); 16316 } else { 16317 // Reuse newcache so results back-propagate to previous elements 16318 uniqueCache[ dir
vendor: 12,959 bytes, lines 16318-16761
16318 ] = newCache; 16319 16320 // A match means we're done; a fail means we have to keep checking 16321 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { 16322 return true; 16323 } 16324 } 16325 } 16326 } 16327 } 16328 }; 16329} 16330 16331function elementMatcher( matchers ) { 16332 return matchers.length > 1 ? 16333 function( elem, context, xml ) { 16334 var i = matchers.length; 16335 while ( i-- ) { 16336 if ( !matchers[i]( elem, context, xml ) ) { 16337 return false; 16338 } 16339 } 16340 return true; 16341 } : 16342 matchers[0]; 16343} 16344 16345function multipleContexts( selector, contexts, results ) { 16346 var i = 0, 16347 len = contexts.length; 16348 for ( ; i < len; i++ ) { 16349 Sizzle( selector, contexts[i], results ); 16350 } 16351 return results; 16352} 16353 16354function condense( unmatched, map, filter, context, xml ) { 16355 var elem, 16356 newUnmatched = [], 16357 i = 0, 16358 len = unmatched.length, 16359 mapped = map != null; 16360 16361 for ( ; i < len; i++ ) { 16362 if ( (elem = unmatched[i]) ) { 16363 if ( !filter || filter( elem, context, xml ) ) { 16364 newUnmatched.push( elem ); 16365 if ( mapped ) { 16366 map.push( i ); 16367 } 16368 } 16369 } 16370 } 16371 16372 return newUnmatched; 16373} 16374 16375function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 16376 if ( postFilter && !postFilter[ expando ] ) { 16377 postFilter = setMatcher( postFilter ); 16378 } 16379 if ( postFinder && !postFinder[ expando ] ) { 16380 postFinder = setMatcher( postFinder, postSelector ); 16381 } 16382 return markFunction(function( seed, results, context, xml ) { 16383 var temp, i, elem, 16384 preMap = [], 16385 postMap = [], 16386 preexisting = results.length, 16387 16388 // Get initial elements from seed or context 16389 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), 16390 16391 // Prefilter to get matcher input, preserving a map for seed-results synchronization 16392 matcherIn = preFilter && ( seed || !selector ) ? 16393 condense( elems, preMap, preFilter, context, xml ) : 16394 elems, 16395 16396 matcherOut = matcher ? 16397 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 16398 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 16399 16400 // ...intermediate processing is necessary 16401 [] : 16402 16403 // ...otherwise use results directly 16404 results : 16405 matcherIn; 16406 16407 // Find primary matches 16408 if ( matcher ) { 16409 matcher( matcherIn, matcherOut, context, xml ); 16410 } 16411 16412 // Apply postFilter 16413 if ( postFilter ) { 16414 temp = condense( matcherOut, postMap ); 16415 postFilter( temp, [], context, xml ); 16416 16417 // Un-match failing elements by moving them back to matcherIn 16418 i = temp.length; 16419 while ( i-- ) { 16420 if ( (elem = temp[i]) ) { 16421 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); 16422 } 16423 } 16424 } 16425 16426 if ( seed ) { 16427 if ( postFinder || preFilter ) { 16428 if ( postFinder ) { 16429 // Get the final matcherOut by condensing this intermediate into postFinder contexts 16430 temp = []; 16431 i = matcherOut.length; 16432 while ( i-- ) { 16433 if ( (elem = matcherOut[i]) ) { 16434 // Restore matcherIn since elem is not yet a final match 16435 temp.push( (matcherIn[i] = elem) ); 16436 } 16437 } 16438 postFinder( null, (matcherOut = []), temp, xml ); 16439 } 16440 16441 // Move matched elements from seed to results to keep them synchronized 16442 i = matcherOut.length; 16443 while ( i-- ) { 16444 if ( (elem = matcherOut[i]) && 16445 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { 16446 16447 seed[temp] = !(results[temp] = elem); 16448 } 16449 } 16450 } 16451 16452 // Add elements to results, through postFinder if defined 16453 } else { 16454 matcherOut = condense( 16455 matcherOut === results ? 16456 matcherOut.splice( preexisting, matcherOut.length ) : 16457 matcherOut 16458 ); 16459 if ( postFinder ) { 16460 postFinder( null, results, matcherOut, xml ); 16461 } else { 16462 push.apply( results, matcherOut ); 16463 } 16464 } 16465 }); 16466} 16467 16468function matcherFromTokens( tokens ) { 16469 var checkContext, matcher, j, 16470 len = tokens.length, 16471 leadingRelative = Expr.relative[ tokens[0].type ], 16472 implicitRelative = leadingRelative || Expr.relative[" "], 16473 i = leadingRelative ? 1 : 0, 16474 16475 // The foundational matcher ensures that elements are reachable from top-level context(s) 16476 matchContext = addCombinator( function( elem ) { 16477 return elem === checkContext; 16478 }, implicitRelative, true ), 16479 matchAnyContext = addCombinator( function( elem ) { 16480 return indexOf( checkContext, elem ) > -1; 16481 }, implicitRelative, true ), 16482 matchers = [ function( elem, context, xml ) { 16483 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 16484 (checkContext = context).nodeType ? 16485 matchContext( elem, context, xml ) : 16486 matchAnyContext( elem, context, xml ) ); 16487 // Avoid hanging onto element (issue #299) 16488 checkContext = null; 16489 return ret; 16490 } ]; 16491 16492 for ( ; i < len; i++ ) { 16493 if ( (matcher = Expr.relative[ tokens[i].type ]) ) { 16494 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; 16495 } else { 16496 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); 16497 16498 // Return special upon seeing a positional matcher 16499 if ( matcher[ expando ] ) { 16500 // Find the next relative operator (if any) for proper handling 16501 j = ++i; 16502 for ( ; j < len; j++ ) { 16503 if ( Expr.relative[ tokens[j].type ] ) { 16504 break; 16505 } 16506 } 16507 return setMatcher( 16508 i > 1 && elementMatcher( matchers ), 16509 i > 1 && toSelector( 16510 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 16511 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) 16512 ).replace( rtrim, "$1" ), 16513 matcher, 16514 i < j && matcherFromTokens( tokens.slice( i, j ) ), 16515 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), 16516 j < len && toSelector( tokens ) 16517 ); 16518 } 16519 matchers.push( matcher ); 16520 } 16521 } 16522 16523 return elementMatcher( matchers ); 16524} 16525 16526function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 16527 var bySet = setMatchers.length > 0, 16528 byElement = elementMatchers.length > 0, 16529 superMatcher = function( seed, context, xml, results, outermost ) { 16530 var elem, j, matcher, 16531 matchedCount = 0, 16532 i = "0", 16533 unmatched = seed && [], 16534 setMatched = [], 16535 contextBackup = outermostContext, 16536 // We must always have either seed elements or outermost context 16537 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), 16538 // Use integer dirruns iff this is the outermost matcher 16539 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), 16540 len = elems.length; 16541 16542 if ( outermost ) { 16543 outermostContext = context === document || context || outermost; 16544 } 16545 16546 // Add elements passing elementMatchers directly to results 16547 // Support: IE<9, Safari 16548 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 16549 for ( ; i !== len && (elem = elems[i]) != null; i++ ) { 16550 if ( byElement && elem ) { 16551 j = 0; 16552 if ( !context && elem.ownerDocument !== document ) { 16553 setDocument( elem ); 16554 xml = !documentIsHTML; 16555 } 16556 while ( (matcher = elementMatchers[j++]) ) { 16557 if ( matcher( elem, context || document, xml) ) { 16558 results.push( elem ); 16559 break; 16560 } 16561 } 16562 if ( outermost ) { 16563 dirruns = dirrunsUnique; 16564 } 16565 } 16566 16567 // Track unmatched elements for set filters 16568 if ( bySet ) { 16569 // They will have gone through all possible matchers 16570 if ( (elem = !matcher && elem) ) { 16571 matchedCount--; 16572 } 16573 16574 // Lengthen the array for every element, matched or not 16575 if ( seed ) { 16576 unmatched.push( elem ); 16577 } 16578 } 16579 } 16580 16581 // `i` is now the count of elements visited above, and adding it to `matchedCount` 16582 // makes the latter nonnegative. 16583 matchedCount += i; 16584 16585 // Apply set filters to unmatched elements 16586 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 16587 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 16588 // no element matchers and no seed. 16589 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 16590 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 16591 // numerically zero. 16592 if ( bySet && i !== matchedCount ) { 16593 j = 0; 16594 while ( (matcher = setMatchers[j++]) ) { 16595 matcher( unmatched, setMatched, context, xml ); 16596 } 16597 16598 if ( seed ) { 16599 // Reintegrate element matches to eliminate the need for sorting 16600 if ( matchedCount > 0 ) { 16601 while ( i-- ) { 16602 if ( !(unmatched[i] || setMatched[i]) ) { 16603 setMatched[i] = pop.call( results ); 16604 } 16605 } 16606 } 16607 16608 // Discard index placeholder values to get only actual matches 16609 setMatched = condense( setMatched ); 16610 } 16611 16612 // Add matches to results 16613 push.apply( results, setMatched ); 16614 16615 // Seedless set matches succeeding multiple successful matchers stipulate sorting 16616 if ( outermost && !seed && setMatched.length > 0 && 16617 ( matchedCount + setMatchers.length ) > 1 ) { 16618 16619 Sizzle.uniqueSort( results ); 16620 } 16621 } 16622 16623 // Override manipulation of globals by nested matchers 16624 if ( outermost ) { 16625 dirruns = dirrunsUnique; 16626 outermostContext = contextBackup; 16627 } 16628 16629 return unmatched; 16630 }; 16631 16632 return bySet ? 16633 markFunction( superMatcher ) : 16634 superMatcher; 16635} 16636 16637compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 16638 var i, 16639 setMatchers = [], 16640 elementMatchers = [], 16641 cached = compilerCache[ selector + " " ]; 16642 16643 if ( !cached ) { 16644 // Generate a function of recursive functions that can be used to check each element 16645 if ( !match ) { 16646 match = tokenize( selector ); 16647 } 16648 i = match.length; 16649 while ( i-- ) { 16650 cached = matcherFromTokens( match[i] ); 16651 if ( cached[ expando ] ) { 16652 setMatchers.push( cached ); 16653 } else { 16654 elementMatchers.push( cached ); 16655 } 16656 } 16657 16658 // Cache the compiled function 16659 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 16660 16661 // Save selector and tokenization 16662 cached.selector = selector; 16663 } 16664 return cached; 16665}; 16666 16667/** 16668 * A low-level selection function that works with Sizzle's compiled 16669 * selector functions 16670 * @param {String|Function} selector A selector or a pre-compiled 16671 * selector function built with Sizzle.compile 16672 * @param {Element} context 16673 * @param {Array} [results] 16674 * @param {Array} [seed] A set of elements to match against 16675 */ 16676select = Sizzle.select = function( selector, context, results, seed ) { 16677 var i, tokens, token, type, find, 16678 compiled = typeof selector === "function" && selector, 16679 match = !seed && tokenize( (selector = compiled.selector || selector) ); 16680 16681 results = results || []; 16682 16683 // Try to minimize operations if there is only one selector in the list and no seed 16684 // (the latter of which guarantees us context) 16685 if ( match.length === 1 ) { 16686 16687 // Reduce context if the leading compound selector is an ID 16688 tokens = match[0] = match[0].slice( 0 ); 16689 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && 16690 support.getById && context.nodeType === 9 && documentIsHTML && 16691 Expr.relative[ tokens[1].type ] ) { 16692 16693 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; 16694 if ( !context ) { 16695 return results; 16696 16697 // Precompiled matchers will still verify ancestry, so step up a level 16698 } else if ( compiled ) { 16699 context = context.parentNode; 16700 } 16701 16702 selector = selector.slice( tokens.shift().value.length ); 16703 } 16704 16705 // Fetch a seed set for right-to-left matching 16706 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; 16707 while ( i-- ) { 16708 token = tokens[i]; 16709 16710 // Abort if we hit a combinator 16711 if ( Expr.relative[ (type = token.type) ] ) { 16712 break; 16713 } 16714 if ( (find = Expr.find[ type ]) ) { 16715 // Search, expanding context for leading sibling combinators 16716 if ( (seed = find( 16717 token.matches[0].replace( runescape, funescape ), 16718 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context 16719 )) ) { 16720 16721 // If seed is empty or no tokens remain, we can return early 16722 tokens.splice( i, 1 ); 16723 selector = seed.length && toSelector( tokens ); 16724 if ( !selector ) { 16725 push.apply( results, seed ); 16726 return results; 16727 } 16728 16729 break; 16730 } 16731 } 16732 } 16733 } 16734 16735 // Compile and execute a filtering function if one is not provided 16736 // Provide `match` to avoid retokenization if we modified the selector above 16737 ( compiled || compile( selector, match ) )( 16738 seed, 16739 context, 16740 !documentIsHTML, 16741 results, 16742 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 16743 ); 16744 return results; 16745}; 16746 16747// One-time assignments 16748 16749// Sort stability 16750support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; 16751 16752// Support: Chrome 14-35+ 16753// Always assume duplicates if they aren't passed to the comparison function 16754support.detectDuplicates = !!hasDuplicate; 16755 16756// Initialize against the default document 16757setDocument(); 16758 16759// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 16760// Detached nodes confoundingly follow *each other* 16761support.sortDetached = assert(function(
vendor: 3,544 bytes, lines 16761-16914
16761div1 ) { 16762 // Should return 1, but returns 4 (following) 16763 return div1.compareDocumentPosition( document.createElement("div") ) & 1; 16764}); 16765 16766// Support: IE<8 16767// Prevent attribute/property "interpolation" 16768// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 16769if ( !assert(function( div ) { 16770 div.innerHTML = "<a href='#'></a>"; 16771 return div.firstChild.getAttribute("href") === "#" ; 16772}) ) { 16773 addHandle( "type|href|height|width", function( elem, name, isXML ) { 16774 if ( !isXML ) { 16775 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 16776 } 16777 }); 16778} 16779 16780// Support: IE<9 16781// Use defaultValue in place of getAttribute("value") 16782if ( !support.attributes || !assert(function( div ) { 16783 div.innerHTML = "<input/>"; 16784 div.firstChild.setAttribute( "value", "" ); 16785 return div.firstChild.getAttribute( "value" ) === ""; 16786}) ) { 16787 addHandle( "value", function( elem, name, isXML ) { 16788 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 16789 return elem.defaultValue; 16790 } 16791 }); 16792} 16793 16794// Support: IE<9 16795// Use getAttributeNode to fetch booleans when getAttribute lies 16796if ( !assert(function( div ) { 16797 return div.getAttribute("disabled") == null; 16798}) ) { 16799 addHandle( booleans, function( elem, name, isXML ) { 16800 var val; 16801 if ( !isXML ) { 16802 return elem[ name ] === true ? name.toLowerCase() : 16803 (val = elem.getAttributeNode( name )) && val.specified ? 16804 val.value : 16805 null; 16806 } 16807 }); 16808} 16809 16810return Sizzle; 16811 16812})( window ); 16813 16814 16815 16816jQuery.find = Sizzle; 16817jQuery.expr = Sizzle.selectors; 16818jQuery.expr[ ":" ] = jQuery.expr.pseudos; 16819jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 16820jQuery.text = Sizzle.getText; 16821jQuery.isXMLDoc = Sizzle.isXML; 16822jQuery.contains = Sizzle.contains; 16823 16824 16825 16826var dir = function( elem, dir, until ) { 16827 var matched = [], 16828 truncate = until !== undefined; 16829 16830 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 16831 if ( elem.nodeType === 1 ) { 16832 if ( truncate && jQuery( elem ).is( until ) ) { 16833 break; 16834 } 16835 matched.push( elem ); 16836 } 16837 } 16838 return matched; 16839}; 16840 16841 16842var siblings = function( n, elem ) { 16843 var matched = []; 16844 16845 for ( ; n; n = n.nextSibling ) { 16846 if ( n.nodeType === 1 && n !== elem ) { 16847 matched.push( n ); 16848 } 16849 } 16850 16851 return matched; 16852}; 16853 16854 16855var rneedsContext = jQuery.expr.match.needsContext; 16856 16857var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ ); 16858 16859 16860 16861var risSimple = /^.[^:#\[\.,]*$/; 16862 16863// Implement the identical functionality for filter and not 16864function winnow( elements, qualifier, not ) { 16865 if ( jQuery.isFunction( qualifier ) ) { 16866 return jQuery.grep( elements, function( elem, i ) { 16867 /* jshint -W018 */ 16868 return !!qualifier.call( elem, i, elem ) !== not; 16869 } ); 16870 16871 } 16872 16873 if ( qualifier.nodeType ) { 16874 return jQuery.grep( elements, function( elem ) { 16875 return ( elem === qualifier ) !== not; 16876 } ); 16877 16878 } 16879 16880 if ( typeof qualifier === "string" ) { 16881 if ( risSimple.test( qualifier ) ) { 16882 return jQuery.filter( qualifier, elements, not ); 16883 } 16884 16885 qualifier = jQuery.filter( qualifier, elements ); 16886 } 16887 16888 return jQuery.grep( elements, function( elem ) { 16889 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 16890 } ); 16891} 16892 16893jQuery.filter = function( expr, elems, not ) { 16894 var elem = elems[ 0 ]; 16895 16896 if ( not ) { 16897 expr = ":not(" + expr + ")"; 16898 } 16899 16900 return elems.length === 1 && elem.nodeType === 1 ? 16901 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : 16902 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 16903 return elem.nodeType === 1; 16904 } ) ); 16905}; 16906 16907jQuery.fn.extend( { 16908 find: function( selector ) { 16909 var i, 16910 len = this.length, 16911 ret = [], 16912 self = this; 16913 16914 if ( typeof selector !== "string" ) {
16915 return this.pushStack( jQuery( selector ).filter( function() { 16916 for ( i = 0; i < len; i++ ) { 16917 if ( jQuery.contains( self[ i ], this ) ) { 16918 return true; 16919 } 16920 } 16921 } ) ); 16922 } 16923 16924 for ( i = 0; i < len; i++ ) { 16925 jQuery.find( selector, self[ i ], ret ); 16926 } 16927 16928 // Needed because $( selector, context ) becomes $( context ).find( selector ) 16929 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); 16930 ret.selector = this.selector ? this.selector + " " + selector : selector; 16931 return ret; 16932 }, 16933 filter: function( selector ) { 16934 return this.pushStack( winnow( this, selector || [], false ) ); 16935 }, 16936 not: function( selector ) { 16937 return this.pushStack( winnow( this, selector || [], true ) ); 16938 }, 16939 is: function( selector ) { 16940 return !!winnow( 16941 this, 16942 16943 // If this is a positional/relative selector, check membership in the returned set 16944 // so $("p:first").is("p:last") won't return true for a doc with two "p". 16945 typeof selector === "string" && rneedsContext.test( selector ) ? 16946 jQuery( selector ) : 16947 selector || [], 16948 false 16949 ).length; 16950 } 16951} ); 16952 16953 16954// Initialize a jQuery object 16955 16956 16957// A central reference to the root jQuery(document) 16958var rootjQuery, 16959 16960 // A simple way to check for HTML strings 16961 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 16962 // Strict HTML recognition (#11290: must start with <) 16963 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, 16964 16965 init = jQuery.fn.init = function( selector, context, root ) { 16966 var match, elem; 16967 16968 // HANDLE: $(""), $(null), $(undefined), $(false) 16969 if ( !selector ) { 16970 return this; 16971 } 16972 16973 // Method init() accepts an alternate rootjQuery 16974 // so migrate can support jQuery.sub (gh-2101) 16975 root = root || rootjQuery; 16976 16977 // Handle HTML strings 16978 if ( typeof selector === "string" ) { 16979 if ( selector[ 0 ] === "<" && 16980 selector[ selector.length - 1 ] === ">" && 16981 selector.length >= 3 ) { 16982 16983 // Assume that strings that start and end with <> are HTML and skip the regex check 16984 match = [ null, selector, null ]; 16985 16986 } else { 16987 match = rquickExpr.exec( selector ); 16988 } 16989 16990 // Match html or make sure no context is specified for #id 16991 if ( match && ( match[ 1 ] || !context ) ) { 16992 16993 // HANDLE: $(html) -> $(array) 16994 if ( match[ 1 ] ) { 16995 context = context instanceof jQuery ? context[ 0 ] : context; 16996 16997 // Option to run scripts is true for back-compat 16998 // Intentionally let the error be thrown if parseHTML is not present 16999 jQuery.merge( this, jQuery.parseHTML( 17000 match[ 1 ], 17001 context && context.nodeType ? context.ownerDocument || context : document, 17002 true 17003 ) ); 17004 17005 // HANDLE: $(html, props) 17006 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 17007 for ( match in context ) { 17008 17009 // Properties of context are called as methods if possible 17010 if ( jQuery.isFunction( this[ match ] ) ) { 17011 this[ match ]( context[ match ] ); 17012 17013 // ...and otherwise set as attributes 17014 } else { 17015 this.attr( match, context[ match ] ); 17016 } 17017 } 17018 } 17019 17020 return this; 17021 17022 // HANDLE: $(#id) 17023 } else { 17024 elem = document.getElementById( match[ 2 ] ); 17025 17026 // Support: Blackberry 4.6 17027 // gEBID returns nodes no longer in the document (#6963) 17028 if ( elem && elem.parentNode ) { 17029 17030 // Inject the element directly into the jQuery object 17031 this.length = 1; 17032 this[ 0 ] = elem; 17033 } 17034 17035 this.context = document; 17036 this.selector = selector; 17037 return this; 17038 } 17039 17040 // HANDLE: $(expr, $(...)) 17041 } else if ( !context || context.jquery ) { 17042 return ( context || root ).find( selector ); 17043 17044 // HANDLE: $(expr, context) 17045 // (which is just equivalent to: $(context).find(expr) 17046 } else { 17047 return this.constructor( context ).find( selector ); 17048 } 17049 17050 // HANDLE: $(DOMElement) 17051 } else if ( selector.nodeType ) { 17052 this.context = this[ 0 ] = selector; 17053 this.length = 1; 17054 return this; 17055 17056 // HANDLE: $(function) 17057 // Shortcut for document ready 17058 } else if ( jQuery.isFunction( selector ) ) { 17059 return root.ready !== undefined ? 17060 root.ready( selector ) : 17061 17062 // Execute immediately if ready is not present 17063 selector( jQuery ); 17064 } 17065 17066 if ( selector.selector !== undefined ) { 17067 this.selector = selector.selector; 17068 this.context = selector.context; 17069 } 17070 17071 return jQuery.makeArray( selector, this ); 17072 }; 17073 17074// Give the init function the jQuery prototype for later instantiation 17075init.prototype = jQuery.fn; 17076 17077// Initialize central reference 17078rootjQuery = jQuery( document ); 17079 17080 17081var rparentsprev = /^(?:parents|prev(?:Until|All))/, 17082 17083 // Methods guaranteed to produce a unique set when starting from a unique set 17084 guaranteedUnique = { 17085 children: true, 17086 contents: true, 17087 next: true, 17088 prev: true 17089 }; 17090 17091jQuery.fn.extend( { 17092 has: function( target ) { 17093 var targets = jQuery( target, this ), 17094 l = targets.length; 17095 17096 return this.filter( function() { 17097 var i = 0; 17098 for ( ; i < l; i++ ) { 17099 if ( jQuery.contains( this, targets[ i ] ) ) { 17100 return true; 17101 } 17102 } 17103 } ); 17104 }, 17105 17106 closest: function( selectors, context ) { 17107 var cur, 17108 i = 0, 17109 l = this.length, 17110 matched = [], 17111 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
vendor: 5,466 bytes, lines 17112-17325
17112 jQuery( selectors, context || this.context ) : 17113 0; 17114 17115 for ( ; i < l; i++ ) { 17116 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 17117 17118 // Always skip document fragments 17119 if ( cur.nodeType < 11 && ( pos ? 17120 pos.index( cur ) > -1 : 17121 17122 // Don't pass non-elements to Sizzle 17123 cur.nodeType === 1 && 17124 jQuery.find.matchesSelector( cur, selectors ) ) ) { 17125 17126 matched.push( cur ); 17127 break; 17128 } 17129 } 17130 } 17131 17132 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 17133 }, 17134 17135 // Determine the position of an element within the set 17136 index: function( elem ) { 17137 17138 // No argument, return index in parent 17139 if ( !elem ) { 17140 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 17141 } 17142 17143 // Index in selector 17144 if ( typeof elem === "string" ) { 17145 return indexOf.call( jQuery( elem ), this[ 0 ] ); 17146 } 17147 17148 // Locate the position of the desired element 17149 return indexOf.call( this, 17150 17151 // If it receives a jQuery object, the first element is used 17152 elem.jquery ? elem[ 0 ] : elem 17153 ); 17154 }, 17155 17156 add: function( selector, context ) { 17157 return this.pushStack( 17158 jQuery.uniqueSort( 17159 jQuery.merge( this.get(), jQuery( selector, context ) ) 17160 ) 17161 ); 17162 }, 17163 17164 addBack: function( selector ) { 17165 return this.add( selector == null ? 17166 this.prevObject : this.prevObject.filter( selector ) 17167 ); 17168 } 17169} ); 17170 17171function sibling( cur, dir ) { 17172 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 17173 return cur; 17174} 17175 17176jQuery.each( { 17177 parent: function( elem ) { 17178 var parent = elem.parentNode; 17179 return parent && parent.nodeType !== 11 ? parent : null; 17180 }, 17181 parents: function( elem ) { 17182 return dir( elem, "parentNode" ); 17183 }, 17184 parentsUntil: function( elem, i, until ) { 17185 return dir( elem, "parentNode", until ); 17186 }, 17187 next: function( elem ) { 17188 return sibling( elem, "nextSibling" ); 17189 }, 17190 prev: function( elem ) { 17191 return sibling( elem, "previousSibling" ); 17192 }, 17193 nextAll: function( elem ) { 17194 return dir( elem, "nextSibling" ); 17195 }, 17196 prevAll: function( elem ) { 17197 return dir( elem, "previousSibling" ); 17198 }, 17199 nextUntil: function( elem, i, until ) { 17200 return dir( elem, "nextSibling", until ); 17201 }, 17202 prevUntil: function( elem, i, until ) { 17203 return dir( elem, "previousSibling", until ); 17204 }, 17205 siblings: function( elem ) { 17206 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 17207 }, 17208 children: function( elem ) { 17209 return siblings( elem.firstChild ); 17210 }, 17211 contents: function( elem ) { 17212 return elem.contentDocument || jQuery.merge( [], elem.childNodes ); 17213 } 17214}, function( name, fn ) { 17215 jQuery.fn[ name ] = function( until, selector ) { 17216 var matched = jQuery.map( this, fn, until ); 17217 17218 if ( name.slice( -5 ) !== "Until" ) { 17219 selector = until; 17220 } 17221 17222 if ( selector && typeof selector === "string" ) { 17223 matched = jQuery.filter( selector, matched ); 17224 } 17225 17226 if ( this.length > 1 ) { 17227 17228 // Remove duplicates 17229 if ( !guaranteedUnique[ name ] ) { 17230 jQuery.uniqueSort( matched ); 17231 } 17232 17233 // Reverse order for parents* and prev-derivatives 17234 if ( rparentsprev.test( name ) ) { 17235 matched.reverse(); 17236 } 17237 } 17238 17239 return this.pushStack( matched ); 17240 }; 17241} ); 17242var rnotwhite = ( /\S+/g ); 17243 17244 17245 17246// Convert String-formatted options into Object-formatted ones 17247function createOptions( options ) { 17248 var object = {}; 17249 jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { 17250 object[ flag ] = true; 17251 } ); 17252 return object; 17253} 17254 17255/* 17256 * Create a callback list using the following parameters: 17257 * 17258 * options: an optional list of space-separated options that will change how 17259 * the callback list behaves or a more traditional option object 17260 * 17261 * By default a callback list will act like an event callback list and can be 17262 * "fired" multiple times. 17263 * 17264 * Possible options: 17265 * 17266 * once: will ensure the callback list can only be fired once (like a Deferred) 17267 * 17268 * memory: will keep track of previous values and will call any callback added 17269 * after the list has been fired right away with the latest "memorized" 17270 * values (like a Deferred) 17271 * 17272 * unique: will ensure a callback can only be added once (no duplicate in the list) 17273 * 17274 * stopOnFalse: interrupt callings when a callback returns false 17275 * 17276 */ 17277jQuery.Callbacks = function( options ) { 17278 17279 // Convert options from String-formatted to Object-formatted if needed 17280 // (we check in cache first) 17281 options = typeof options === "string" ? 17282 createOptions( options ) : 17283 jQuery.extend( {}, options ); 17284 17285 var // Flag to know if list is currently firing 17286 firing, 17287 17288 // Last fire value for non-forgettable lists 17289 memory, 17290 17291 // Flag to know if list was already fired 17292 fired, 17293 17294 // Flag to prevent firing 17295 locked, 17296 17297 // Actual callback list 17298 list = [], 17299 17300 // Queue of execution data for repeatable lists 17301 queue = [], 17302 17303 // Index of currently firing callback (modified by add/remove as needed) 17304 firingIndex = -1, 17305 17306 // Fire callbacks 17307 fire = function() { 17308 17309 // Enforce single-firing 17310 locked = options.once; 17311 17312 // Execute callbacks for all pending executions, 17313 // respecting firingIndex overrides and runtime changes 17314 fired = firing = true; 17315 for ( ; queue.length; firingIndex = -1 ) { 17316 memory = queue.shift(); 17317 while ( ++firingIndex < list.length ) { 17318 17319 // Run callback and check for early termination 17320 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 17321 options.stopOnFalse ) { 17322 17323 // Jump to end and forget the data so .add doesn't re-fire 17324 firingIndex = list.length; 17325 memory = false;
17326 } 17327 } 17328 } 17329 17330 // Forget the data if we're done with it 17331 if ( !options.memory ) { 17332 memory = false; 17333 } 17334 17335 firing = false; 17336 17337 // Clean up if we're done firing for good 17338 if ( locked ) { 17339 17340 // Keep an empty list if we have data for future add calls 17341 if ( memory ) { 17342 list = []; 17343 17344 // Otherwise, this object is spent 17345 } else { 17346 list = ""; 17347 } 17348 } 17349 }, 17350 17351 // Actual Callbacks object 17352 self = { 17353 17354 // Add a callback or a collection of callbacks to the list 17355 add: function() { 17356 if ( list ) { 17357 17358 // If we have memory from a past run, we should fire after adding 17359 if ( memory && !firing ) { 17360 firingIndex = list.length - 1; 17361 queue.push( memory ); 17362 } 17363 17364 ( function add( args ) { 17365 jQuery.each( args, function( _, arg ) { 17366 if ( jQuery.isFunction( arg ) ) { 17367 if ( !options.unique || !self.has( arg ) ) { 17368 list.push( arg ); 17369 } 17370 } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { 17371 17372 // Inspect recursively 17373 add( arg ); 17374 } 17375 } ); 17376 } )( arguments ); 17377 17378 if ( memory && !firing ) { 17379 fire(); 17380 } 17381 } 17382 return this; 17383 }, 17384 17385 // Remove a callback from the list 17386 remove: function() { 17387 jQuery.each( arguments, function( _, arg ) { 17388 var index; 17389 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 17390 list.splice( index, 1 ); 17391 17392 // Handle firing indexes 17393 if ( index <= firingIndex ) { 17394 firingIndex--; 17395 } 17396 } 17397 } ); 17398 return this; 17399 }, 17400 17401 // Check if a given callback is in the list. 17402 // If no argument is given, return whether or not list has callbacks attached. 17403 has: function( fn ) { 17404 return fn ? 17405 jQuery.inArray( fn, list ) > -1 : 17406 list.length > 0; 17407 }, 17408 17409 // Remove all callbacks from the list 17410 empty: function() { 17411 if ( list ) { 17412 list = []; 17413 } 17414 return this; 17415 }, 17416 17417 // Disable .fire and .add 17418 // Abort any current/pending executions 17419 // Clear all callbacks and values 17420 disable: function() { 17421 locked = queue = []; 17422 list = memory = ""; 17423 return this; 17424 }, 17425 disabled: function() { 17426 return !list; 17427 }, 17428 17429 // Disable .fire 17430 // Also disable .add unless we have memory (since it would have no effect) 17431 // Abort any pending executions 17432 lock: function() { 17433 locked = queue = []; 17434 if ( !memory ) { 17435 list = memory = ""; 17436 } 17437 return this; 17438 }, 17439 locked: function() { 17440 return !!locked; 17441 }, 17442 17443 // Call all callbacks with the given context and arguments 17444 fireWith: function( context, args ) { 17445 if ( !locked ) { 17446 args = args || []; 17447 args = [ context, args.slice ? args.slice() : args ]; 17448 queue.push( args ); 17449 if ( !firing ) { 17450 fire(); 17451 } 17452 } 17453 return this; 17454 }, 17455 17456 // Call all the callbacks with the given arguments 17457 fire: function() { 17458 self.fireWith( this, arguments ); 17459 return this; 17460 }, 17461 17462 // To know if the callbacks have already been called at least once 17463 fired: function() { 17464 return !!fired; 17465 } 17466 }; 17467 17468 return self; 17469}; 17470 17471 17472jQuery.extend( { 17473 17474 Deferred: function( func ) { 17475 var tuples = [ 17476 17477 // action, add listener, listener list, final state 17478 [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ], 17479 [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ], 17480 [ "notify", "progress", jQuery.Callbacks( "memory" ) ] 17481 ], 17482 state = "pending", 17483 promise = { 17484 state: function() { 17485 return state; 17486 }, 17487 always: function() { 17488 deferred.done( arguments ).fail( arguments ); 17489 return this; 17490 }, 17491 then: function( /* fnDone, fnFail, fnProgress */ ) { 17492 var fns = arguments; 17493 return jQuery.Deferred( function( newDefer ) { 17494 jQuery.each( tuples, function( i, tuple ) { 17495 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; 17496 17497 // deferred[ done | fail | progress ] for forwarding actions to newDefer 17498 deferred[ tuple[ 1 ] ]( function() { 17499 var returned = fn && fn.apply( this, arguments ); 17500 if ( returned && jQuery.isFunction( returned.promise ) ) { 17501 returned.promise() 17502 .progress( newDefer.notify ) 17503 .done( newDefer.resolve ) 17504 .fail( newDefer.reject ); 17505 } else { 17506 newDefer[ tuple[ 0 ] + "With" ]( 17507 this === promise ? newDefer.promise() : this, 17508 fn ? [ returned ] : arguments 17509 ); 17510 } 17511 } ); 17512 } ); 17513 fns = null; 17514 } ).promise(); 17515 }, 17516 17517 // Get a promise for this deferred 17518 // If obj is provided, the promise aspect is added to the object 17519 promise: function( obj ) { 17520 return obj != null ? jQuery.extend( obj, promise ) : promise; 17521 } 17522 }, 17523 deferred = {}; 17524 17525 // Keep pipe for back-compat 17526 promise.pipe = promise.then; 17527 17528 // Add list-specific methods 17529 jQuery.each( tuples, function( i, tuple ) { 17530 var list = tuple[ 2 ], 17531 stateString = tuple[ 3 ]; 17532 17533 // promise[ done | fail | progress ] = list.add 17534 promise[ tuple[ 1 ] ] = list.add; 17535 17536 // Handle state 17537 if ( stateString ) { 17538 list.add( function() { 17539 17540 // state = [ resolved | rejected ] 17541 state = stateString; 17542 17543 // [ reject_list | resolve_list ].disable; progress_list.lock 17544 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); 17545 } 17546 17547 // deferred[ resolve | reject | notify ] 17548 deferred[ tuple[ 0 ] ] = function() { 17549 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments ); 17550 return this; 17551 }; 17552 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 17553 } ); 17554 17555 // Make the deferred a promise 17556 promise.promise( deferred ); 17557 17558 // Call given func if any 17559 if ( func ) { 17560 func.call( deferred, deferred ); 17561 } 17562 17563 // All done! 17564 return deferred; 17565 }, 17566 17567 // Deferred helper 17568 when: function( subordinate /* , ..., subordinateN */ ) { 17569 var i = 0, 17570 resolveValues = slice.call( arguments ), 17571 length = resolveValues.length, 17572 17573 // the count of uncompleted subordinates 17574 remaining = length !== 1 || 17575 ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, 17576 17577 // the master Deferred. 17578 // If resolveValues consist of only a single Deferred, just use that. 17579 deferred = remaining === 1 ? subordinate : jQuery.Deferred(), 17580 17581 // Update function for both resolve and progress values 17582 updateFunc = function( i, contexts, values ) { 17583 return function( value ) { 17584 contexts[ i ] = this; 17585 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 17586 if ( values === progressValues ) { 17587 deferred.notifyWith( contexts, values ); 17588 } else if ( !( --remaining ) ) { 17589 deferred.resolveWith( contexts, values ); 17590 } 17591 }; 17592 }, 17593 17594 progressValues, progressContexts, resolveContexts; 17595 17596 // Add listeners to Deferred subordinates; treat others as resolved 17597 if ( length > 1 ) { 17598 progressValues = new Array( length ); 17599 progressContexts = new Array( length ); 17600 resolveContexts = new Array( length ); 17601 for ( ; i < length; i++ ) { 17602 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { 17603 resolveValues[ i ].promise() 17604 .progress( updateFunc( i, progressContexts, progressValues ) ) 17605 .done( updateFunc( i, resolveContexts, resolveValues ) ) 17606 .fail( deferred.reject ); 17607 } else { 17608 --remaining; 17609 } 17610 } 17611 } 17612 17613 // If we're not waiting on anything, resolve the master 17614 if ( !remaining ) {
17615 deferred.resolveWith( resolveContexts, resolveValues ); 17616 } 17617 17618 return deferred.promise(); 17619 } 17620} ); 17621 17622 17623// The deferred used on DOM ready 17624var readyList; 17625 17626jQuery.fn.ready = function( fn ) { 17627 17628 // Add the callback 17629 jQuery.ready.promise().done( fn ); 17630 17631 return this; 17632}; 17633 17634jQuery.extend( { 17635 17636 // Is the DOM ready to be used? Set to true once it occurs. 17637 isReady: false, 17638 17639 // A counter to track how many items to wait for before 17640 // the ready event fires. See #6781 17641 readyWait: 1, 17642 17643 // Hold (or release) the ready event 17644 holdReady: function( hold ) { 17645 if ( hold ) { 17646 jQuery.readyWait++; 17647 } else { 17648 jQuery.ready( true ); 17649 } 17650 }, 17651 17652 // Handle when the DOM is ready 17653 ready: function( wait ) { 17654 17655 // Abort if there are pending holds or we're already ready 17656 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 17657 return; 17658 } 17659 17660 // Remember that the DOM is ready 17661 jQuery.isReady = true; 17662 17663 // If a normal DOM Ready event fired, decrement, and wait if need be 17664 if ( wait !== true && --jQuery.readyWait > 0 ) { 17665 return; 17666 } 17667 17668 // If there are functions bound, to execute 17669 readyList.resolveWith( document, [ jQuery ] ); 17670 17671 // Trigger any bound ready events 17672 if ( jQuery.fn.triggerHandler ) { 17673 jQuery( document ).triggerHandler( "ready" ); 17674 jQuery( document ).off( "ready" ); 17675 } 17676 } 17677} ); 17678 17679/** 17680 * The ready event handler and self cleanup method 17681 */ 17682function completed() { 17683 document.removeEventListener( "DOMContentLoaded", completed ); 17684 window.removeEventListener( "load", completed ); 17685 jQuery.ready(); 17686} 17687 17688jQuery.ready.promise = function( obj ) { 17689 if ( !readyList ) { 17690 17691 readyList = jQuery.Deferred(); 17692 17693 // Catch cases where $(document).ready() is called 17694 // after the browser event has already occurred.
17695 // Support: IE9-10 only 17696 // Older IE sometimes signals "interactive" too soon 17697 if ( document.readyState === "complete" || 17698 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 17699 17700 // Handle it asynchronously to allow scripts the opportunity to delay ready 17701 window.setTimeout( jQuery.ready ); 17702 17703 } else { 17704 17705 // Use the handy event callback 17706 document.addEventListener( "DOMContentLoaded", completed ); 17707 17708 // A fallback to window.onload, that will always work 17709 window.addEventListener( "load", completed ); 17710 } 17711 } 17712 return readyList.promise( obj ); 17713}; 17714 17715// Kick off the DOM ready check even if the user does not 17716jQuery.ready.promise(); 17717 17718 17719 17720 17721// Multifunctional method to get and set values of a collection 17722// The value/s can optionally be executed if it's a function 17723var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 17724 var i = 0, 17725 len = elems.length, 17726 bulk = key == null; 17727 17728 // Sets many values 17729 if ( jQuery.type( key ) === "object" ) { 17730 chainable = true; 17731 for ( i in key ) { 17732 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 17733 } 17734 17735 // Sets one value 17736 } else if ( value !== undefined ) { 17737 chainable = true; 17738 17739 if ( !jQuery.isFunction( value ) ) { 17740 raw = true; 17741 } 17742 17743 if ( bulk ) { 17744 17745 // Bulk operations run against the entire set 17746 if ( raw ) { 17747 fn.call( elems, value ); 17748 fn = null; 17749 17750 // ...except when executing function values 17751 } else { 17752 bulk = fn; 17753 fn = function( elem, key, value ) { 17754 return bulk.call( jQuery( elem ), value ); 17755 }; 17756 } 17757 } 17758 17759 if ( fn ) { 17760 for ( ; i < len; i++ ) { 17761 fn( 17762 elems[ i ], key, raw ? 17763 value : 17764 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 17765 ); 17766 } 17767 } 17768 } 17769 17770 return chainable ? 17771 elems : 17772 17773 // Gets 17774 bulk ? 17775 fn.call( elems ) : 17776 len ? fn( elems[ 0 ], key ) : emptyGet; 17777}; 17778var acceptData = function( owner ) { 17779 17780 // Accepts only: 17781 // - Node 17782 // - Node.ELEMENT_NODE 17783 // - Node.DOCUMENT_NODE 17784 // - Object 17785 // - Any 17786 /* jshint -W018 */ 17787 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 17788}; 17789 17790 17791 17792 17793function Data() { 17794 this.expando = jQuery.expando + Data.uid++; 17795} 17796 17797Data.uid = 1; 17798 17799Data.prototype = { 17800 17801 register: function( owner, initial ) { 17802 var value = initial || {}; 17803 17804 // If it is a node unlikely to be stringify-ed or looped over 17805 // use plain assignment 17806 if ( owner.nodeType ) { 17807 owner[ this.expando ] = value; 17808 17809 // Otherwise secure it in a non-enumerable, non-writable property 17810 // configurability must be true to allow the property to be 17811 // deleted with the delete operator 17812 } else { 17813 Object.defineProperty( owner, this.expando, { 17814 value: value, 17815 writable: true, 17816 configurable: true 17817 } ); 17818 } 17819 return owner[ this.expando ]; 17820 }, 17821 cache: function( owner ) { 17822 17823 // We can accept data for non-element nodes in modern browsers, 17824 // but we should not, see #8335. 17825 // Always return an empty object. 17826 if ( !acceptData( owner ) ) { 17827 return {}; 17828 } 17829 17830 // Check if the owner object already has a cache 17831 var value = owner[ this.expando ]; 17832 17833 // If not, create one 17834 if ( !value ) { 17835 value = {}; 17836 17837 // We can accept data for non-element nodes in modern browsers, 17838 // but we should not, see #8335. 17839 // Always return an empty object. 17840 if ( acceptData( owner ) ) { 17841 17842 // If it is a node unlikely to be stringify-ed or looped over 17843 // use plain assignment 17844 if ( owner.nodeType ) { 17845 owner[ this.expando ] = value; 17846 17847 // Otherwise secure it in a non-enumerable property 17848 // configurable must be true to allow the property to be 17849 // deleted when data is removed 17850 } else { 17851 Object.defineProperty( owner, this.expando, { 17852 value: value, 17853 configurable: true 17854 } ); 17855 } 17856 } 17857 } 17858 17859 return value; 17860 }, 17861 set: function( owner, data, value ) { 17862 var prop, 17863 cache = this.cache( owner ); 17864 17865 // Handle: [ owner, key, value ] args 17866 if ( typeof data === "string" ) { 17867 cache[ data ] = value; 17868 17869 // Handle: [ owner, { properties } ] args 17870 } else { 17871 17872 // Copy the properties one-by-one to the cache object 17873 for ( prop in data ) { 17874 cache[ prop ] = data[ prop ]; 17875 } 17876 } 17877 return cache; 17878 }, 17879 get: function( owner, key ) { 17880 return key === undefined ? 17881 this.cache( owner ) : 17882 owner[ this.expando ] && owner[ this.expando ][ key ]; 17883 }, 17884 access: function( owner, key, value ) { 17885 var stored; 17886 17887 // In cases where either: 17888 // 17889 // 1. No key was specified
17890 // 2. A string key was specified, but no value provided 17891 // 17892 // Take the "read" path and allow the get method to determine 17893 // which value to return, respectively either: 17894 // 17895 // 1. The entire cache object 17896 // 2. The data stored at the key 17897 // 17898 if ( key === undefined || 17899 ( ( key && typeof key === "string" ) && value === undefined ) ) { 17900 17901 stored = this.get( owner, key ); 17902 17903 return stored !== undefined ? 17904 stored : this.get( owner, jQuery.camelCase( key ) ); 17905 } 17906 17907 // When the key is not a string, or both a key and value 17908 // are specified, set or extend (existing objects) with either: 17909 // 17910 // 1. An object of properties 17911 // 2. A key and value 17912 // 17913 this.set( owner, key, value ); 17914 17915 // Since the "set" path can have two possible entry points 17916 // return the expected data based on which path was taken[*] 17917 return value !== undefined ? value : key; 17918 }, 17919 remove: function( owner, key ) { 17920 var i, name, camel, 17921 cache = owner[ this.expando ]; 17922 17923 if ( cache === undefined ) { 17924 return; 17925 } 17926 17927 if ( key === undefined ) { 17928 this.register( owner ); 17929 17930 } else { 17931 17932 // Support array or space separated string of keys 17933 if ( jQuery.isArray( key ) ) { 17934 17935 // If "name" is an array of keys... 17936 // When data is initially created, via ("key", "val") signature, 17937 // keys will be converted to camelCase. 17938 // Since there is no way to tell _how_ a key was added, remove 17939 // both plain key and camelCase key. #12786 17940 // This will only penalize the array argument path. 17941 name = key.concat( key.map( jQuery.camelCase ) ); 17942 } else { 17943 camel = jQuery.camelCase( key ); 17944 17945 // Try the string as a key before any manipulation 17946 if ( key in cache ) { 17947 name = [ key, camel ]; 17948 } else { 17949 17950 // If a key with the spaces exists, use it. 17951 // Otherwise, create an array by matching non-whitespace 17952 name = camel; 17953 name = name in cache ? 17954 [ name ] : ( name.match( rnotwhite ) || [] ); 17955 } 17956 } 17957 17958 i = name.length; 17959 17960 while ( i-- ) { 17961 delete cache[ name[ i ] ]; 17962 } 17963 } 17964 17965 // Remove the expando if there's no more data 17966 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 17967 17968 // Support: Chrome <= 35-45+ 17969 // Webkit & Blink performance suffers when deleting properties 17970 // from DOM nodes, so set to undefined instead 17971 // https://code.google.com/p/chromium/issues/detail?id=378607 17972 if ( owner.nodeType ) { 17973 owner[ this.expando ] = undefined; 17974 } else { 17975 delete owner[ this.expando ]; 17976 } 17977 } 17978 }, 17979 hasData: function( owner ) { 17980 var cache = owner[ this.expando ]; 17981 return cache !== undefined && !jQuery.isEmptyObject( cache ); 17982 } 17983}; 17984var dataPriv = new Data(); 17985 17986var dataUser = new Data(); 17987 17988 17989 17990// Implementation Summary 17991// 17992// 1. Enforce API surface and semantic compatibility with 1.9.x branch 17993// 2. Improve the module's maintainability by reducing the storage 17994// paths to a single mechanism. 17995// 3. Use the same single mechanism to support "private" and "user" data. 17996// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 17997// 5. Avoid exposing implementation details on user objects (eg. expando properties) 17998// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 17999 18000var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 18001 rmultiDash = /[A-Z]/g; 18002 18003function dataAttr( elem, key, data ) { 18004 var name; 18005 18006 // If nothing was found internally, try to fetch any 18007 // data from the HTML5 data-* attribute 18008 if ( data === undefined && elem.nodeType === 1 ) { 18009 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 18010 data = elem.getAttribute( name ); 18011 18012 if ( typeof data === "string" ) { 18013 try { 18014 data = data === "true" ? true : 18015 data === "false" ? false : 18016 data === "null" ? null : 18017 18018 // Only convert to a number if it doesn't change the string 18019 +data + "" === data ? +data : 18020 rbrace.test( data ) ? jQuery.parseJSON( data ) : 18021 data; 18022 } catch ( e ) {} 18023 18024 // Make sure we set the data so it isn't changed later 18025 dataUser.set( elem, key, data ); 18026 } else { 18027 data = undefined; 18028 } 18029 } 18030 return data; 18031} 18032 18033jQuery.extend( { 18034 hasData: function( elem ) { 18035 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 18036 }, 18037 18038 data: function( elem, name, data ) { 18039 return dataUser.access( elem, name, data ); 18040 }, 18041 18042 removeData: function( elem, name ) { 18043 dataUser.remove( elem, name ); 18044 }, 18045 18046 // TODO: Now that all calls to _data and _removeData have been replaced 18047 // with direct calls to dataPriv methods, these can be deprecated. 18048 _data: function( elem, name, data ) { 18049 return dataPriv.access( elem, name, data ); 18050 }, 18051 18052 _removeData: function( elem, name ) { 18053 dataPriv.remove( elem, name ); 18054 } 18055} ); 18056 18057jQuery.fn.extend( { 18058 data: function( key, value ) { 18059 var i, name, data, 18060 elem = this[ 0 ], 18061 attrs = elem && elem.attributes; 18062 18063 // Gets all values 18064 if ( key === undefined ) { 18065 if ( this.length ) { 18066 data = dataUser.get( elem ); 18067 18068 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 18069 i = attrs.length; 18070 while ( i-- ) { 18071
18072 // Support: IE11+ 18073 // The attrs elements can be null (#14894) 18074 if ( attrs[ i ] ) { 18075 name = attrs[ i ].name; 18076 if ( name.indexOf( "data-" ) === 0 ) { 18077 name = jQuery.camelCase( name.slice( 5 ) ); 18078 dataAttr( elem, name, data[ name ] ); 18079 } 18080 } 18081 } 18082 dataPriv.set( elem, "hasDataAttrs", true ); 18083 } 18084 } 18085 18086 return data; 18087 } 18088 18089 // Sets multiple values 18090 if ( typeof key === "object" ) { 18091 return this.each( function() { 18092 dataUser.set( this, key ); 18093 } ); 18094 } 18095 18096 return access( this, function( value ) { 18097 var data, camelKey; 18098 18099 // The calling jQuery object (element matches) is not empty 18100 // (and therefore has an element appears at this[ 0 ]) and the 18101 // `value` parameter was not undefined. An empty jQuery object 18102 // will result in `undefined` for elem = this[ 0 ] which will 18103 // throw an exception if an attempt to read a data cache is made. 18104 if ( elem && value === undefined ) { 18105 18106 // Attempt to get data from the cache 18107 // with the key as-is 18108 data = dataUser.get( elem, key ) || 18109 18110 // Try to find dashed key if it exists (gh-2779) 18111 // This is for 2.2.x only 18112 dataUser.get( elem, key.replace( rmultiDash, "-$&" ).toLowerCase() ); 18113 18114 if ( data !== undefined ) { 18115 return data; 18116 } 18117 18118 camelKey = jQuery.camelCase( key ); 18119 18120 // Attempt to get data from the cache 18121 // with the key camelized 18122 data = dataUser.get( elem, camelKey ); 18123 if ( data !== undefined ) { 18124 return data; 18125 } 18126 18127 // Attempt to "discover" the data in 18128 // HTML5 custom data-* attrs 18129 data = dataAttr( elem, camelKey, undefined ); 18130 if ( data !== undefined ) { 18131 return data; 18132 } 18133 18134 // We tried really hard, but the data doesn't exist. 18135 return; 18136 } 18137 18138 // Set the data... 18139 camelKey = jQuery.camelCase( key ); 18140 this.each( function() { 18141 18142 // First, attempt to store a copy or reference of any 18143 // data that might've been store with a camelCased key. 18144 var data = dataUser.get( this, camelKey ); 18145 18146 // For HTML5 data-* attribute interop, we have to 18147 // store property names with dashes in a camelCase form. 18148 // This might not apply to all properties...* 18149 dataUser.set( this, camelKey, value ); 18150 18151 // *... In the case of properties that might _actually_ 18152 // have dashes, we need to also store a copy of that 18153 // unchanged property. 18154 if ( key.indexOf( "-" ) > -1 && data !== undefined ) { 18155 dataUser.set( this, key, value ); 18156 } 18157 } ); 18158 }, null, value, arguments.length > 1, null, true ); 18159 }, 18160 18161 removeData: function( key ) { 18162 return this.each( function() { 18163 dataUser.remove( this, key ); 18164 } ); 18165 } 18166} ); 18167 18168 18169jQuery.extend( { 18170 queue: function( elem, type, data ) { 18171 var queue; 18172 18173 if ( elem ) { 18174 type = ( type || "fx" ) + "queue"; 18175 queue = dataPriv.get( elem, type ); 18176 18177 // Speed up dequeue by getting out quickly if this is just a lookup 18178 if ( data ) { 18179 if ( !queue || jQuery.isArray( data ) ) { 18180 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 18181 } else { 18182 queue.push( data ); 18183 } 18184 } 18185 return queue || []; 18186 } 18187 }, 18188 18189 dequeue: function( elem, type ) { 18190 type = type || "fx"; 18191 18192 var queue = jQuery.queue( elem, type ), 18193 startLength = queue.length, 18194 fn = queue.shift(), 18195 hooks = jQuery._queueHooks( elem, type ), 18196 next = function() { 18197 jQuery.dequeue( elem, type ); 18198 }; 18199 18200 // If the fx queue is dequeued, always remove the progress sentinel 18201 if ( fn === "inprogress" ) { 18202 fn = queue.shift(); 18203 startLength--; 18204 } 18205 18206 if ( fn ) { 18207 18208 // Add a progress sentinel to prevent the fx queue from being 18209 // automatically dequeued 18210 if ( type === "fx" ) { 18211 queue.unshift( "inprogress" ); 18212 } 18213 18214 // Clear up the last queue stop function 18215 delete hooks.stop; 18216 fn.call( elem, next, hooks ); 18217 } 18218 18219 if ( !startLength && hooks ) { 18220 hooks.empty.fire(); 18221 } 18222 }, 18223 18224 // Not public - generate a queueHooks object, or return the current one 18225 _queueHooks: function( elem, type ) { 18226 var key = type + "queueHooks"; 18227 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 18228 empty: jQuery.Callbacks( "once memory" ).add( function() {
vendor: 17,961 bytes, lines 18229-18900
18229 dataPriv.remove( elem, [ type + "queue", key ] ); 18230 } ) 18231 } ); 18232 } 18233} ); 18234 18235jQuery.fn.extend( { 18236 queue: function( type, data ) { 18237 var setter = 2; 18238 18239 if ( typeof type !== "string" ) { 18240 data = type; 18241 type = "fx"; 18242 setter--; 18243 } 18244 18245 if ( arguments.length < setter ) { 18246 return jQuery.queue( this[ 0 ], type ); 18247 } 18248 18249 return data === undefined ? 18250 this : 18251 this.each( function() { 18252 var queue = jQuery.queue( this, type, data ); 18253 18254 // Ensure a hooks for this queue 18255 jQuery._queueHooks( this, type ); 18256 18257 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 18258 jQuery.dequeue( this, type ); 18259 } 18260 } ); 18261 }, 18262 dequeue: function( type ) { 18263 return this.each( function() { 18264 jQuery.dequeue( this, type ); 18265 } ); 18266 }, 18267 clearQueue: function( type ) { 18268 return this.queue( type || "fx", [] ); 18269 }, 18270 18271 // Get a promise resolved when queues of a certain type 18272 // are emptied (fx is the type by default) 18273 promise: function( type, obj ) { 18274 var tmp, 18275 count = 1, 18276 defer = jQuery.Deferred(), 18277 elements = this, 18278 i = this.length, 18279 resolve = function() { 18280 if ( !( --count ) ) { 18281 defer.resolveWith( elements, [ elements ] ); 18282 } 18283 }; 18284 18285 if ( typeof type !== "string" ) { 18286 obj = type; 18287 type = undefined; 18288 } 18289 type = type || "fx"; 18290 18291 while ( i-- ) { 18292 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 18293 if ( tmp && tmp.empty ) { 18294 count++; 18295 tmp.empty.add( resolve ); 18296 } 18297 } 18298 resolve(); 18299 return defer.promise( obj ); 18300 } 18301} ); 18302var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 18303 18304var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 18305 18306 18307var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 18308 18309var isHidden = function( elem, el ) { 18310 18311 // isHidden might be called from jQuery#filter function; 18312 // in that case, element will be second argument 18313 elem = el || elem; 18314 return jQuery.css( elem, "display" ) === "none" || 18315 !jQuery.contains( elem.ownerDocument, elem ); 18316 }; 18317 18318 18319 18320function adjustCSS( elem, prop, valueParts, tween ) { 18321 var adjusted, 18322 scale = 1, 18323 maxIterations = 20, 18324 currentValue = tween ? 18325 function() { return tween.cur(); } : 18326 function() { return jQuery.css( elem, prop, "" ); }, 18327 initial = currentValue(), 18328 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 18329 18330 // Starting value computation is required for potential unit mismatches 18331 initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 18332 rcssNum.exec( jQuery.css( elem, prop ) ); 18333 18334 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 18335 18336 // Trust units reported by jQuery.css 18337 unit = unit || initialInUnit[ 3 ]; 18338 18339 // Make sure we update the tween properties later on 18340 valueParts = valueParts || []; 18341 18342 // Iteratively approximate from a nonzero starting point 18343 initialInUnit = +initial || 1; 18344 18345 do { 18346 18347 // If previous iteration zeroed out, double until we get *something*. 18348 // Use string for doubling so we don't accidentally see scale as unchanged below 18349 scale = scale || ".5"; 18350 18351 // Adjust and apply 18352 initialInUnit = initialInUnit / scale; 18353 jQuery.style( elem, prop, initialInUnit + unit ); 18354 18355 // Update scale, tolerating zero or NaN from tween.cur() 18356 // Break the loop if scale is unchanged or perfect, or if we've just had enough. 18357 } while ( 18358 scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations 18359 ); 18360 } 18361 18362 if ( valueParts ) { 18363 initialInUnit = +initialInUnit || +initial || 0; 18364 18365 // Apply relative offset (+=/-=) if specified 18366 adjusted = valueParts[ 1 ] ? 18367 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 18368 +valueParts[ 2 ]; 18369 if ( tween ) { 18370 tween.unit = unit; 18371 tween.start = initialInUnit; 18372 tween.end = adjusted; 18373 } 18374 } 18375 return adjusted; 18376} 18377var rcheckableType = ( /^(?:checkbox|radio)$/i ); 18378 18379var rtagName = ( /<([\w:-]+)/ ); 18380 18381var rscriptType = ( /^$|\/(?:java|ecma)script/i ); 18382 18383 18384 18385// We have to close these tags to support XHTML (#13200) 18386var wrapMap = { 18387 18388 // Support: IE9 18389 option: [ 1, "<select multiple='multiple'>", "</select>" ], 18390 18391 // XHTML parsers do not magically insert elements in the 18392 // same way that tag soup parsers do. So we cannot shorten 18393 // this by omitting <tbody> or other required elements. 18394 thead: [ 1, "<table>", "</table>" ], 18395 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 18396 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 18397 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 18398 18399 _default: [ 0, "", "" ] 18400}; 18401 18402// Support: IE9 18403wrapMap.optgroup = wrapMap.option; 18404 18405wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 18406wrapMap.th = wrapMap.td; 18407 18408 18409function getAll( context, tag ) { 18410 18411 // Support: IE9-11+ 18412 // Use typeof to avoid zero-argument method invocation on host objects (#15151) 18413 var ret = typeof context.getElementsByTagName !== "undefined" ? 18414 context.getElementsByTagName( tag || "*" ) : 18415 typeof context.querySelectorAll !== "undefined" ? 18416 context.querySelectorAll( tag || "*" ) : 18417 []; 18418 18419 return tag === undefined || tag && jQuery.nodeName( context, tag ) ? 18420 jQuery.merge( [ context ], ret ) : 18421 ret; 18422} 18423 18424 18425// Mark scripts as having already been evaluated 18426function setGlobalEval( elems, refElements ) { 18427 var i = 0, 18428 l = elems.length; 18429 18430 for ( ; i < l; i++ ) { 18431 dataPriv.set( 18432 elems[ i ], 18433 "globalEval", 18434 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 18435 ); 18436 } 18437} 18438 18439 18440var rhtml = /<|&#?\w+;/; 18441 18442function buildFragment( elems, context, scripts, selection, ignored ) { 18443 var elem, tmp, tag, wrap, contains, j, 18444 fragment = context.createDocumentFragment(), 18445 nodes = [], 18446 i = 0, 18447 l = elems.length; 18448 18449 for ( ; i < l; i++ ) { 18450 elem = elems[ i ]; 18451 18452 if ( elem || elem === 0 ) { 18453 18454 // Add nodes directly 18455 if ( jQuery.type( elem ) === "object" ) { 18456 18457 // Support: Android<4.1, PhantomJS<2 18458 // push.apply(_, arraylike) throws on ancient WebKit 18459 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 18460 18461 // Convert non-html into a text node 18462 } else if ( !rhtml.test( elem ) ) { 18463 nodes.push( context.createTextNode( elem ) ); 18464 18465 // Convert html into DOM nodes 18466 } else { 18467 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 18468 18469 // Deserialize a standard representation 18470 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 18471 wrap = wrapMap[ tag ] || wrapMap._default; 18472 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 18473 18474 // Descend through wrappers to the right content 18475 j = wrap[ 0 ]; 18476 while ( j-- ) { 18477 tmp = tmp.lastChild; 18478 } 18479 18480 // Support: Android<4.1, PhantomJS<2 18481 // push.apply(_, arraylike) throws on ancient WebKit 18482 jQuery.merge( nodes, tmp.childNodes ); 18483 18484 // Remember the top-level container 18485 tmp = fragment.firstChild; 18486 18487 // Ensure the created nodes are orphaned (#12392) 18488 tmp.textContent = ""; 18489 } 18490 } 18491 } 18492 18493 // Remove wrapper from fragment 18494 fragment.textContent = ""; 18495 18496 i = 0; 18497 while ( ( elem = nodes[ i++ ] ) ) { 18498 18499 // Skip elements already in the context collection (trac-4087) 18500 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 18501 if ( ignored ) { 18502 ignored.push( elem ); 18503 } 18504 continue; 18505 } 18506 18507 contains = jQuery.contains( elem.ownerDocument, elem ); 18508 18509 // Append to fragment 18510 tmp = getAll( fragment.appendChild( elem ), "script" ); 18511 18512 // Preserve script evaluation history 18513 if ( contains ) { 18514 setGlobalEval( tmp ); 18515 } 18516 18517 // Capture executables 18518 if ( scripts ) { 18519 j = 0; 18520 while ( ( elem = tmp[ j++ ] ) ) { 18521 if ( rscriptType.test( elem.type || "" ) ) { 18522 scripts.push( elem ); 18523 } 18524 } 18525 } 18526 } 18527 18528 return fragment; 18529} 18530 18531 18532( function() { 18533 var fragment = document.createDocumentFragment(), 18534 div = fragment.appendChild( document.createElement( "div" ) ), 18535 input = document.createElement( "input" ); 18536 18537 // Support: Android 4.0-4.3, Safari<=5.1 18538 // Check state lost if the name is set (#11217) 18539 // Support: Windows Web Apps (WWA) 18540 // `name` and `type` must use .setAttribute for WWA (#14901) 18541 input.setAttribute( "type", "radio" ); 18542 input.setAttribute( "checked", "checked" ); 18543 input.setAttribute( "name", "t" ); 18544 18545 div.appendChild( input ); 18546 18547 // Support: Safari<=5.1, Android<4.2 18548 // Older WebKit doesn't clone checked state correctly in fragments 18549 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 18550 18551 // Support: IE<=11+ 18552 // Make sure textarea (and checkbox) defaultValue is properly cloned 18553 div.innerHTML = "<textarea>x</textarea>"; 18554 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 18555} )(); 18556 18557 18558var 18559 rkeyEvent = /^key/, 18560 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, 18561 rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 18562 18563function returnTrue() { 18564 return true; 18565} 18566 18567function returnFalse() { 18568 return false; 18569} 18570 18571// Support: IE9 18572// See #13393 for more info 18573function safeActiveElement() { 18574 try { 18575 return document.activeElement; 18576 } catch ( err ) { } 18577} 18578 18579function on( elem, types, selector, data, fn, one ) { 18580 var origFn, type; 18581 18582 // Types can be a map of types/handlers 18583 if ( typeof types === "object" ) { 18584 18585 // ( types-Object, selector, data ) 18586 if ( typeof selector !== "string" ) { 18587 18588 // ( types-Object, data ) 18589 data = data || selector; 18590 selector = undefined; 18591 } 18592 for ( type in types ) { 18593 on( elem, type, selector, data, types[ type ], one ); 18594 } 18595 return elem; 18596 } 18597 18598 if ( data == null && fn == null ) { 18599 18600 // ( types, fn ) 18601 fn = selector; 18602 data = selector = undefined; 18603 } else if ( fn == null ) { 18604 if ( typeof selector === "string" ) { 18605 18606 // ( types, selector, fn ) 18607 fn = data; 18608 data = undefined; 18609 } else { 18610 18611 // ( types, data, fn ) 18612 fn = data; 18613 data = selector; 18614 selector = undefined; 18615 } 18616 } 18617 if ( fn === false ) { 18618 fn = returnFalse; 18619 } else if ( !fn ) { 18620 return elem; 18621 } 18622 18623 if ( one === 1 ) { 18624 origFn = fn; 18625 fn = function( event ) { 18626 18627 // Can use an empty set, since event contains the info 18628 jQuery().off( event ); 18629 return origFn.apply( this, arguments ); 18630 }; 18631 18632 // Use same guid so caller can remove using origFn 18633 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 18634 } 18635 return elem.each( function() { 18636 jQuery.event.add( this, types, fn, data, selector ); 18637 } ); 18638} 18639 18640/* 18641 * Helper functions for managing events -- not part of the public interface. 18642 * Props to Dean Edwards' addEvent library for many of the ideas. 18643 */ 18644jQuery.event = { 18645 18646 global: {}, 18647 18648 add: function( elem, types, handler, data, selector ) { 18649 18650 var handleObjIn, eventHandle, tmp, 18651 events, t, handleObj, 18652 special, handlers, type, namespaces, origType, 18653 elemData = dataPriv.get( elem ); 18654 18655 // Don't attach events to noData or text/comment nodes (but allow plain objects) 18656 if ( !elemData ) { 18657 return; 18658 } 18659 18660 // Caller can pass in an object of custom data in lieu of the handler 18661 if ( handler.handler ) { 18662 handleObjIn = handler; 18663 handler = handleObjIn.handler; 18664 selector = handleObjIn.selector; 18665 } 18666 18667 // Make sure that the handler has a unique ID, used to find/remove it later 18668 if ( !handler.guid ) { 18669 handler.guid = jQuery.guid++; 18670 } 18671 18672 // Init the element's event structure and main handler, if this is the first 18673 if ( !( events = elemData.events ) ) { 18674 events = elemData.events = {}; 18675 } 18676 if ( !( eventHandle = elemData.handle ) ) { 18677 eventHandle = elemData.handle = function( e ) { 18678 18679 // Discard the second event of a jQuery.event.trigger() and 18680 // when an event is called after a page has unloaded 18681 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 18682 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 18683 }; 18684 } 18685 18686 // Handle multiple events separated by a space 18687 types = ( types || "" ).match( rnotwhite ) || [ "" ]; 18688 t = types.length; 18689 while ( t-- ) { 18690 tmp = rtypenamespace.exec( types[ t ] ) || []; 18691 type = origType = tmp[ 1 ]; 18692 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 18693 18694 // There *must* be a type, no attaching namespace-only handlers 18695 if ( !type ) { 18696 continue; 18697 } 18698 18699 // If event changes its type, use the special event handlers for the changed type 18700 special = jQuery.event.special[ type ] || {}; 18701 18702 // If selector defined, determine special event api type, otherwise given type 18703 type = ( selector ? special.delegateType : special.bindType ) || type; 18704 18705 // Update special based on newly reset type 18706 special = jQuery.event.special[ type ] || {}; 18707 18708 // handleObj is passed to all event handlers 18709 handleObj = jQuery.extend( { 18710 type: type, 18711 origType: origType, 18712 data: data, 18713 handler: handler, 18714 guid: handler.guid, 18715 selector: selector, 18716 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 18717 namespace: namespaces.join( "." ) 18718 }, handleObjIn ); 18719 18720 // Init the event handler queue if we're the first 18721 if ( !( handlers = events[ type ] ) ) { 18722 handlers = events[ type ] = []; 18723 handlers.delegateCount = 0; 18724 18725 // Only use addEventListener if the special events handler returns false 18726 if ( !special.setup || 18727 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 18728 18729 if ( elem.addEventListener ) { 18730 elem.addEventListener( type, eventHandle ); 18731 } 18732 } 18733 } 18734 18735 if ( special.add ) { 18736 special.add.call( elem, handleObj ); 18737 18738 if ( !handleObj.handler.guid ) { 18739 handleObj.handler.guid = handler.guid; 18740 } 18741 } 18742 18743 // Add to the element's handler list, delegates in front 18744 if ( selector ) { 18745 handlers.splice( handlers.delegateCount++, 0, handleObj ); 18746 } else { 18747 handlers.push( handleObj ); 18748 } 18749 18750 // Keep track of which events have ever been used, for event optimization 18751 jQuery.event.global[ type ] = true; 18752 } 18753 18754 }, 18755 18756 // Detach an event or set of events from an element 18757 remove: function( elem, types, handler, selector, mappedTypes ) { 18758 18759 var j, origCount, tmp, 18760 events, t, handleObj, 18761 special, handlers, type, namespaces, origType, 18762 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 18763 18764 if ( !elemData || !( events = elemData.events ) ) { 18765 return; 18766 } 18767 18768 // Once for each type.namespace in types; type may be omitted 18769 types = ( types || "" ).match( rnotwhite ) || [ "" ]; 18770 t = types.length; 18771 while ( t-- ) { 18772 tmp = rtypenamespace.exec( types[ t ] ) || []; 18773 type = origType = tmp[ 1 ]; 18774 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 18775 18776 // Unbind all events (on this namespace, if provided) for the element 18777 if ( !type ) { 18778 for ( type in events ) { 18779 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 18780 } 18781 continue; 18782 } 18783 18784 special = jQuery.event.special[ type ] || {}; 18785 type = ( selector ? special.delegateType : special.bindType ) || type; 18786 handlers = events[ type ] || []; 18787 tmp = tmp[ 2 ] && 18788 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 18789 18790 // Remove matching events 18791 origCount = j = handlers.length; 18792 while ( j-- ) { 18793 handleObj = handlers[ j ]; 18794 18795 if ( ( mappedTypes || origType === handleObj.origType ) && 18796 ( !handler || handler.guid === handleObj.guid ) && 18797 ( !tmp || tmp.test( handleObj.namespace ) ) && 18798 ( !selector || selector === handleObj.selector || 18799 selector === "**" && handleObj.selector ) ) { 18800 handlers.splice( j, 1 ); 18801 18802 if ( handleObj.selector ) { 18803 handlers.delegateCount--; 18804 } 18805 if ( special.remove ) { 18806 special.remove.call( elem, handleObj ); 18807 } 18808 } 18809 } 18810 18811 // Remove generic event handler if we removed something and no more handlers exist 18812 // (avoids potential for endless recursion during removal of special event handlers) 18813 if ( origCount && !handlers.length ) { 18814 if ( !special.teardown || 18815 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 18816 18817 jQuery.removeEvent( elem, type, elemData.handle ); 18818 } 18819 18820 delete events[ type ]; 18821 } 18822 } 18823 18824 // Remove data and the expando if it's no longer used 18825 if ( jQuery.isEmptyObject( events ) ) { 18826 dataPriv.remove( elem, "handle events" ); 18827 } 18828 }, 18829 18830 dispatch: function( event ) { 18831 18832 // Make a writable jQuery.Event from the native event object 18833 event = jQuery.event.fix( event ); 18834 18835 var i, j, ret, matched, handleObj, 18836 handlerQueue = [], 18837 args = slice.call( arguments ), 18838 handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], 18839 special = jQuery.event.special[ event.type ] || {}; 18840 18841 // Use the fix-ed jQuery.Event rather than the (read-only) native event 18842 args[ 0 ] = event; 18843 event.delegateTarget = this; 18844 18845 // Call the preDispatch hook for the mapped type, and let it bail if desired 18846 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 18847 return; 18848 } 18849 18850 // Determine handlers 18851 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 18852 18853 // Run delegates first; they may want to stop propagation beneath us 18854 i = 0; 18855 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 18856 event.currentTarget = matched.elem; 18857 18858 j = 0; 18859 while ( ( handleObj = matched.handlers[ j++ ] ) && 18860 !event.isImmediatePropagationStopped() ) { 18861 18862 // Triggered event must either 1) have no namespace, or 2) have namespace(s) 18863 // a subset or equal to those in the bound event (both can have no namespace). 18864 if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { 18865 18866 event.handleObj = handleObj; 18867 event.data = handleObj.data; 18868 18869 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 18870 handleObj.handler ).apply( matched.elem, args ); 18871 18872 if ( ret !== undefined ) { 18873 if ( ( event.result = ret ) === false ) { 18874 event.preventDefault(); 18875 event.stopPropagation(); 18876 } 18877 } 18878 } 18879 } 18880 } 18881 18882 // Call the postDispatch hook for the mapped type 18883 if ( special.postDispatch ) { 18884 special.postDispatch.call( this, event ); 18885 } 18886 18887 return event.result; 18888 }, 18889 18890 handlers: function( event, handlers ) { 18891 var i, matches, sel, handleObj, 18892 handlerQueue = [], 18893 delegateCount = handlers.delegateCount, 18894 cur = event.target; 18895 18896 // Support (at least): Chrome, IE9 18897 // Find delegate handlers 18898 // Black-hole SVG <use> instance trees (#13180) 18899 // 18900 // Support: Firefox<=42+
18901 // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343) 18902 if ( delegateCount && cur.nodeType && 18903 ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) { 18904 18905 for ( ; cur !== this; cur = cur.parentNode || this ) { 18906 18907 // Don't check non-elements (#13208) 18908 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 18909 if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) { 18910 matches = []; 18911 for ( i = 0; i < delegateCount; i++ ) { 18912 handleObj = handlers[ i ]; 18913 18914 // Don't conflict with Object.prototype properties (#13203) 18915 sel = handleObj.selector + " "; 18916 18917 if ( matches[ sel ] === undefined ) { 18918 matches[ sel ] = handleObj.needsContext ? 18919 jQuery( sel, this ).index( cur ) > -1 : 18920 jQuery.find( sel, this, null, [ cur ] ).length; 18921 } 18922 if ( matches[ sel ] ) { 18923 matches.push( handleObj ); 18924 } 18925 } 18926 if ( matches.length ) { 18927 handlerQueue.push( { elem: cur, handlers: matches } ); 18928 } 18929 } 18930 } 18931 } 18932 18933 // Add the remaining (directly-bound) handlers 18934 if ( delegateCount < handlers.length ) { 18935 handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } ); 18936 } 18937 18938 return handlerQueue; 18939 }, 18940 18941 // Includes some event props shared by KeyEvent and MouseEvent 18942 props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " + 18943 "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ), 18944 18945 fixHooks: {}, 18946 18947 keyHooks: { 18948 props: "char charCode key keyCode".split( " " ), 18949 filter: function( event, original ) { 18950 18951 // Add which for key events 18952 if ( event.which == null ) { 18953 event.which = original.charCode != null ? original.charCode : original.keyCode; 18954 } 18955 18956 return event; 18957 } 18958 }, 18959 18960 mouseHooks: { 18961 props: ( "button buttons clientX clientY offsetX offsetY pageX pageY " + 18962 "screenX screenY toElement" ).split( " " ), 18963 filter: function( event, original ) { 18964 var eventDoc, doc, body, 18965 button = original.button; 18966 18967 // Calculate pageX/Y if missing and clientX/Y available 18968 if ( event.pageX == null && original.clientX != null ) { 18969 eventDoc = event.target.ownerDocument || document; 18970 doc = eventDoc.documentElement; 18971 body = eventDoc.body; 18972 18973 event.pageX = original.clientX + 18974 ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - 18975 ( doc && doc.clientLeft || body && body.clientLeft || 0 ); 18976 event.pageY = original.clientY + 18977 ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - 18978 ( doc && doc.clientTop || body && body.clientTop || 0 ); 18979 } 18980 18981 // Add which for click: 1 === left; 2 === middle; 3 === right 18982 // Note: button is not normalized, so don't use it 18983 if ( !event.which && button !== undefined ) { 18984 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); 18985 } 18986 18987 return event; 18988 } 18989 }, 18990 18991 fix: function( event ) { 18992 if ( event[ jQuery.expando ] ) { 18993 return event; 18994 } 18995 18996 // Create a writable copy of the event object and normalize some properties 18997 var i, prop, copy, 18998 type = event.type, 18999 originalEvent = event, 19000 fixHook = this.fixHooks[ type ]; 19001 19002 if ( !fixHook ) { 19003 this.fixHooks[ type ] = fixHook = 19004 rmouseEvent.test( type ) ? this.mouseHooks : 19005 rkeyEvent.test( type ) ? this.keyHooks : 19006 {}; 19007 } 19008 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; 19009 19010 event = new jQuery.Event( originalEvent ); 19011 19012 i = copy.length; 19013 while ( i-- ) { 19014 prop = copy[ i ]; 19015 event[ prop ] = originalEvent[ prop ]; 19016 } 19017 19018 // Support: Cordova 2.5 (WebKit) (#13255) 19019 // All events should have a target; Cordova deviceready doesn't 19020 if ( !event.target ) { 19021 event.target = document; 19022 } 19023 19024 // Support: Safari 6.0+, Chrome<28 19025 // Target should not be a text node (#504, #13143) 19026 if ( event.target.nodeType === 3 ) { 19027 event.target = event.target.parentNode; 19028 } 19029 19030 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; 19031 }, 19032 19033 special: { 19034 load: { 19035 19036 // Prevent triggered image.load events from bubbling to window.load 19037 noBubble: true 19038 }, 19039 focus: { 19040 19041 // Fire native event if possible so blur/focus sequence is correct 19042 trigger: function() { 19043 if ( this !== safeActiveElement() && this.focus ) { 19044 this.focus(); 19045 return false;
vendor: 12,508 bytes, lines 19046-19522
19046 } 19047 }, 19048 delegateType: "focusin" 19049 }, 19050 blur: { 19051 trigger: function() { 19052 if ( this === safeActiveElement() && this.blur ) { 19053 this.blur(); 19054 return false; 19055 } 19056 }, 19057 delegateType: "focusout" 19058 }, 19059 click: { 19060 19061 // For checkbox, fire native event so checked state will be right 19062 trigger: function() { 19063 if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { 19064 this.click(); 19065 return false; 19066 } 19067 }, 19068 19069 // For cross-browser consistency, don't fire native .click() on links 19070 _default: function( event ) { 19071 return jQuery.nodeName( event.target, "a" ); 19072 } 19073 }, 19074 19075 beforeunload: { 19076 postDispatch: function( event ) { 19077 19078 // Support: Firefox 20+ 19079 // Firefox doesn't alert if the returnValue field is not set. 19080 if ( event.result !== undefined && event.originalEvent ) { 19081 event.originalEvent.returnValue = event.result; 19082 } 19083 } 19084 } 19085 } 19086}; 19087 19088jQuery.removeEvent = function( elem, type, handle ) { 19089 19090 // This "if" is needed for plain objects 19091 if ( elem.removeEventListener ) { 19092 elem.removeEventListener( type, handle ); 19093 } 19094}; 19095 19096jQuery.Event = function( src, props ) { 19097 19098 // Allow instantiation without the 'new' keyword 19099 if ( !( this instanceof jQuery.Event ) ) { 19100 return new jQuery.Event( src, props ); 19101 } 19102 19103 // Event object 19104 if ( src && src.type ) { 19105 this.originalEvent = src; 19106 this.type = src.type; 19107 19108 // Events bubbling up the document may have been marked as prevented 19109 // by a handler lower down the tree; reflect the correct value. 19110 this.isDefaultPrevented = src.defaultPrevented || 19111 src.defaultPrevented === undefined && 19112 19113 // Support: Android<4.0 19114 src.returnValue === false ? 19115 returnTrue : 19116 returnFalse; 19117 19118 // Event type 19119 } else { 19120 this.type = src; 19121 } 19122 19123 // Put explicitly provided properties onto the event object 19124 if ( props ) { 19125 jQuery.extend( this, props ); 19126 } 19127 19128 // Create a timestamp if incoming event doesn't have one 19129 this.timeStamp = src && src.timeStamp || jQuery.now(); 19130 19131 // Mark it as fixed 19132 this[ jQuery.expando ] = true; 19133}; 19134 19135// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 19136// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 19137jQuery.Event.prototype = { 19138 constructor: jQuery.Event, 19139 isDefaultPrevented: returnFalse, 19140 isPropagationStopped: returnFalse, 19141 isImmediatePropagationStopped: returnFalse, 19142 isSimulated: false, 19143 19144 preventDefault: function() { 19145 var e = this.originalEvent; 19146 19147 this.isDefaultPrevented = returnTrue; 19148 19149 if ( e && !this.isSimulated ) { 19150 e.preventDefault(); 19151 } 19152 }, 19153 stopPropagation: function() { 19154 var e = this.originalEvent; 19155 19156 this.isPropagationStopped = returnTrue; 19157 19158 if ( e && !this.isSimulated ) { 19159 e.stopPropagation(); 19160 } 19161 }, 19162 stopImmediatePropagation: function() { 19163 var e = this.originalEvent; 19164 19165 this.isImmediatePropagationStopped = returnTrue; 19166 19167 if ( e && !this.isSimulated ) { 19168 e.stopImmediatePropagation(); 19169 } 19170 19171 this.stopPropagation(); 19172 } 19173}; 19174 19175// Create mouseenter/leave events using mouseover/out and event-time checks 19176// so that event delegation works in jQuery. 19177// Do the same for pointerenter/pointerleave and pointerover/pointerout 19178// 19179// Support: Safari 7 only 19180// Safari sends mouseenter too often; see: 19181// https://code.google.com/p/chromium/issues/detail?id=470258 19182// for the description of the bug (it existed in older Chrome versions as well). 19183jQuery.each( { 19184 mouseenter: "mouseover", 19185 mouseleave: "mouseout", 19186 pointerenter: "pointerover", 19187 pointerleave: "pointerout" 19188}, function( orig, fix ) { 19189 jQuery.event.special[ orig ] = { 19190 delegateType: fix, 19191 bindType: fix, 19192 19193 handle: function( event ) { 19194 var ret, 19195 target = this, 19196 related = event.relatedTarget, 19197 handleObj = event.handleObj; 19198 19199 // For mouseenter/leave call the handler if related is outside the target. 19200 // NB: No relatedTarget if the mouse left/entered the browser window 19201 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 19202 event.type = handleObj.origType; 19203 ret = handleObj.handler.apply( this, arguments ); 19204 event.type = fix; 19205 } 19206 return ret; 19207 } 19208 }; 19209} ); 19210 19211jQuery.fn.extend( { 19212 on: function( types, selector, data, fn ) { 19213 return on( this, types, selector, data, fn ); 19214 }, 19215 one: function( types, selector, data, fn ) { 19216 return on( this, types, selector, data, fn, 1 ); 19217 }, 19218 off: function( types, selector, fn ) { 19219 var handleObj, type; 19220 if ( types && types.preventDefault && types.handleObj ) { 19221 19222 // ( event ) dispatched jQuery.Event 19223 handleObj = types.handleObj; 19224 jQuery( types.delegateTarget ).off( 19225 handleObj.namespace ? 19226 handleObj.origType + "." + handleObj.namespace : 19227 handleObj.origType, 19228 handleObj.selector, 19229 handleObj.handler 19230 ); 19231 return this; 19232 } 19233 if ( typeof types === "object" ) { 19234 19235 // ( types-object [, selector] ) 19236 for ( type in types ) { 19237 this.off( type, selector, types[ type ] ); 19238 } 19239 return this; 19240 } 19241 if ( selector === false || typeof selector === "function" ) { 19242 19243 // ( types [, fn] ) 19244 fn = selector; 19245 selector = undefined; 19246 } 19247 if ( fn === false ) { 19248 fn = returnFalse; 19249 } 19250 return this.each( function() { 19251 jQuery.event.remove( this, types, fn, selector ); 19252 } ); 19253 } 19254} ); 19255 19256 19257var 19258 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, 19259 19260 // Support: IE 10-11, Edge 10240+ 19261 // In IE/Edge using regex groups here causes severe slowdowns. 19262 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 19263 rnoInnerhtml = /<script|<style|<link/i, 19264 19265 // checked="checked" or checked 19266 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 19267 rscriptTypeMasked = /^true\/(.*)/, 19268 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; 19269 19270// Manipulating tables requires a tbody 19271function manipulationTarget( elem, content ) { 19272 return jQuery.nodeName( elem, "table" ) && 19273 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? 19274 19275 elem.getElementsByTagName( "tbody" )[ 0 ] || 19276 elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) : 19277 elem; 19278} 19279 19280// Replace/restore the type attribute of script elements for safe DOM manipulation 19281function disableScript( elem ) { 19282 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 19283 return elem; 19284} 19285function restoreScript( elem ) { 19286 var match = rscriptTypeMasked.exec( elem.type ); 19287 19288 if ( match ) { 19289 elem.type = match[ 1 ]; 19290 } else { 19291 elem.removeAttribute( "type" ); 19292 } 19293 19294 return elem; 19295} 19296 19297function cloneCopyEvent( src, dest ) { 19298 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; 19299 19300 if ( dest.nodeType !== 1 ) { 19301 return; 19302 } 19303 19304 // 1. Copy private data: events, handlers, etc. 19305 if ( dataPriv.hasData( src ) ) { 19306 pdataOld = dataPriv.access( src ); 19307 pdataCur = dataPriv.set( dest, pdataOld ); 19308 events = pdataOld.events; 19309 19310 if ( events ) { 19311 delete pdataCur.handle; 19312 pdataCur.events = {}; 19313 19314 for ( type in events ) { 19315 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 19316 jQuery.event.add( dest, type, events[ type ][ i ] ); 19317 } 19318 } 19319 } 19320 } 19321 19322 // 2. Copy user data 19323 if ( dataUser.hasData( src ) ) { 19324 udataOld = dataUser.access( src ); 19325 udataCur = jQuery.extend( {}, udataOld ); 19326 19327 dataUser.set( dest, udataCur ); 19328 } 19329} 19330 19331// Fix IE bugs, see support tests 19332function fixInput( src, dest ) { 19333 var nodeName = dest.nodeName.toLowerCase(); 19334 19335 // Fails to persist the checked state of a cloned checkbox or radio button. 19336 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 19337 dest.checked = src.checked; 19338 19339 // Fails to return the selected option to the default selected state when cloning options 19340 } else if ( nodeName === "input" || nodeName === "textarea" ) { 19341 dest.defaultValue = src.defaultValue; 19342 } 19343} 19344 19345function domManip( collection, args, callback, ignored ) { 19346 19347 // Flatten any nested arrays 19348 args = concat.apply( [], args ); 19349 19350 var fragment, first, scripts, hasScripts, node, doc, 19351 i = 0, 19352 l = collection.length, 19353 iNoClone = l - 1, 19354 value = args[ 0 ], 19355 isFunction = jQuery.isFunction( value ); 19356 19357 // We can't cloneNode fragments that contain checked, in WebKit 19358 if ( isFunction || 19359 ( l > 1 && typeof value === "string" && 19360 !support.checkClone && rchecked.test( value ) ) ) { 19361 return collection.each( function( index ) { 19362 var self = collection.eq( index ); 19363 if ( isFunction ) { 19364 args[ 0 ] = value.call( this, index, self.html() ); 19365 } 19366 domManip( self, args, callback, ignored ); 19367 } ); 19368 } 19369 19370 if ( l ) { 19371 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 19372 first = fragment.firstChild; 19373 19374 if ( fragment.childNodes.length === 1 ) { 19375 fragment = first; 19376 } 19377 19378 // Require either new content or an interest in ignored elements to invoke the callback 19379 if ( first || ignored ) { 19380 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 19381 hasScripts = scripts.length; 19382 19383 // Use the original fragment for the last item 19384 // instead of the first because it can end up 19385 // being emptied incorrectly in certain situations (#8070). 19386 for ( ; i < l; i++ ) { 19387 node = fragment; 19388 19389 if ( i !== iNoClone ) { 19390 node = jQuery.clone( node, true, true ); 19391 19392 // Keep references to cloned scripts for later restoration 19393 if ( hasScripts ) { 19394 19395 // Support: Android<4.1, PhantomJS<2 19396 // push.apply(_, arraylike) throws on ancient WebKit 19397 jQuery.merge( scripts, getAll( node, "script" ) ); 19398 } 19399 } 19400 19401 callback.call( collection[ i ], node, i ); 19402 } 19403 19404 if ( hasScripts ) { 19405 doc = scripts[ scripts.length - 1 ].ownerDocument; 19406 19407 // Reenable scripts 19408 jQuery.map( scripts, restoreScript ); 19409 19410 // Evaluate executable scripts on first document insertion 19411 for ( i = 0; i < hasScripts; i++ ) { 19412 node = scripts[ i ]; 19413 if ( rscriptType.test( node.type || "" ) && 19414 !dataPriv.access( node, "globalEval" ) && 19415 jQuery.contains( doc, node ) ) { 19416 19417 if ( node.src ) { 19418 19419 // Optional AJAX dependency, but won't run scripts if not present 19420 if ( jQuery._evalUrl ) { 19421 jQuery._evalUrl( node.src ); 19422 } 19423 } else { 19424 jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); 19425 } 19426 } 19427 } 19428 } 19429 } 19430 } 19431 19432 return collection; 19433} 19434 19435function remove( elem, selector, keepData ) { 19436 var node, 19437 nodes = selector ? jQuery.filter( selector, elem ) : elem, 19438 i = 0; 19439 19440 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 19441 if ( !keepData && node.nodeType === 1 ) { 19442 jQuery.cleanData( getAll( node ) ); 19443 } 19444 19445 if ( node.parentNode ) { 19446 if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { 19447 setGlobalEval( getAll( node, "script" ) ); 19448 } 19449 node.parentNode.removeChild( node ); 19450 } 19451 } 19452 19453 return elem; 19454} 19455 19456jQuery.extend( { 19457 htmlPrefilter: function( html ) { 19458 return html.replace( rxhtmlTag, "<$1></$2>" ); 19459 }, 19460 19461 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 19462 var i, l, srcElements, destElements, 19463 clone = elem.cloneNode( true ), 19464 inPage = jQuery.contains( elem.ownerDocument, elem ); 19465 19466 // Fix IE cloning issues 19467 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 19468 !jQuery.isXMLDoc( elem ) ) { 19469 19470 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 19471 destElements = getAll( clone ); 19472 srcElements = getAll( elem ); 19473 19474 for ( i = 0, l = srcElements.length; i < l; i++ ) { 19475 fixInput( srcElements[ i ], destElements[ i ] ); 19476 } 19477 } 19478 19479 // Copy the events from the original to the clone 19480 if ( dataAndEvents ) { 19481 if ( deepDataAndEvents ) { 19482 srcElements = srcElements || getAll( elem ); 19483 destElements = destElements || getAll( clone ); 19484 19485 for ( i = 0, l = srcElements.length; i < l; i++ ) { 19486 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 19487 } 19488 } else { 19489 cloneCopyEvent( elem, clone ); 19490 } 19491 } 19492 19493 // Preserve script evaluation history 19494 destElements = getAll( clone, "script" ); 19495 if ( destElements.length > 0 ) { 19496 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 19497 } 19498 19499 // Return the cloned set 19500 return clone; 19501 }, 19502 19503 cleanData: function( elems ) { 19504 var data, elem, type, 19505 special = jQuery.event.special, 19506 i = 0; 19507 19508 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 19509 if ( acceptData( elem ) ) { 19510 if ( ( data = elem[ dataPriv.expando ] ) ) { 19511 if ( data.events ) { 19512 for ( type in data.events ) { 19513 if ( special[ type ] ) { 19514 jQuery.event.remove( elem, type ); 19515 19516 // This is a shortcut to avoid jQuery.event.remove's overhead 19517 } else { 19518 jQuery.removeEvent( elem, type, data.handle ); 19519 } 19520 } 19521 } 19522
vendor: 1,186 bytes, lines 19523-19571
19523 // Support: Chrome <= 35-45+ 19524 // Assign undefined instead of using delete, see Data#remove 19525 elem[ dataPriv.expando ] = undefined; 19526 } 19527 if ( elem[ dataUser.expando ] ) { 19528 19529 // Support: Chrome <= 35-45+ 19530 // Assign undefined instead of using delete, see Data#remove 19531 elem[ dataUser.expando ] = undefined; 19532 } 19533 } 19534 } 19535 } 19536} ); 19537 19538jQuery.fn.extend( { 19539 19540 // Keep domManip exposed until 3.0 (gh-2225) 19541 domManip: domManip, 19542 19543 detach: function( selector ) { 19544 return remove( this, selector, true ); 19545 }, 19546 19547 remove: function( selector ) { 19548 return remove( this, selector ); 19549 }, 19550 19551 text: function( value ) { 19552 return access( this, function( value ) { 19553 return value === undefined ? 19554 jQuery.text( this ) : 19555 this.empty().each( function() { 19556 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 19557 this.textContent = value; 19558 } 19559 } ); 19560 }, null, value, arguments.length ); 19561 }, 19562 19563 append: function() { 19564 return domManip( this, arguments, function( elem ) { 19565 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 19566 var target = manipulationTarget( this, elem ); 19567 target.appendChild( elem ); 19568 } 19569 } ); 19570 }, 19571
vendor: 4,383 bytes, lines 19572-19755
19572 prepend: function() { 19573 return domManip( this, arguments, function( elem ) { 19574 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 19575 var target = manipulationTarget( this, elem ); 19576 target.insertBefore( elem, target.firstChild ); 19577 } 19578 } ); 19579 }, 19580 19581 before: function() { 19582 return domManip( this, arguments, function( elem ) { 19583 if ( this.parentNode ) { 19584 this.parentNode.insertBefore( elem, this ); 19585 } 19586 } ); 19587 }, 19588 19589 after: function() { 19590 return domManip( this, arguments, function( elem ) { 19591 if ( this.parentNode ) { 19592 this.parentNode.insertBefore( elem, this.nextSibling ); 19593 } 19594 } ); 19595 }, 19596 19597 empty: function() { 19598 var elem, 19599 i = 0; 19600 19601 for ( ; ( elem = this[ i ] ) != null; i++ ) { 19602 if ( elem.nodeType === 1 ) { 19603 19604 // Prevent memory leaks 19605 jQuery.cleanData( getAll( elem, false ) ); 19606 19607 // Remove any remaining nodes 19608 elem.textContent = ""; 19609 } 19610 } 19611 19612 return this; 19613 }, 19614 19615 clone: function( dataAndEvents, deepDataAndEvents ) { 19616 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 19617 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 19618 19619 return this.map( function() { 19620 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 19621 } ); 19622 }, 19623 19624 html: function( value ) { 19625 return access( this, function( value ) { 19626 var elem = this[ 0 ] || {}, 19627 i = 0, 19628 l = this.length; 19629 19630 if ( value === undefined && elem.nodeType === 1 ) { 19631 return elem.innerHTML; 19632 } 19633 19634 // See if we can take a shortcut and just use innerHTML 19635 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 19636 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 19637 19638 value = jQuery.htmlPrefilter( value ); 19639 19640 try { 19641 for ( ; i < l; i++ ) { 19642 elem = this[ i ] || {}; 19643 19644 // Remove element nodes and prevent memory leaks 19645 if ( elem.nodeType === 1 ) { 19646 jQuery.cleanData( getAll( elem, false ) ); 19647 elem.innerHTML = value; 19648 } 19649 } 19650 19651 elem = 0; 19652 19653 // If using innerHTML throws an exception, use the fallback method 19654 } catch ( e ) {} 19655 } 19656 19657 if ( elem ) { 19658 this.empty().append( value ); 19659 } 19660 }, null, value, arguments.length ); 19661 }, 19662 19663 replaceWith: function() { 19664 var ignored = []; 19665 19666 // Make the changes, replacing each non-ignored context element with the new content 19667 return domManip( this, arguments, function( elem ) { 19668 var parent = this.parentNode; 19669 19670 if ( jQuery.inArray( this, ignored ) < 0 ) { 19671 jQuery.cleanData( getAll( this ) ); 19672 if ( parent ) { 19673 parent.replaceChild( elem, this ); 19674 } 19675 } 19676 19677 // Force callback invocation 19678 }, ignored ); 19679 } 19680} ); 19681 19682jQuery.each( { 19683 appendTo: "append", 19684 prependTo: "prepend", 19685 insertBefore: "before", 19686 insertAfter: "after", 19687 replaceAll: "replaceWith" 19688}, function( name, original ) { 19689 jQuery.fn[ name ] = function( selector ) { 19690 var elems, 19691 ret = [], 19692 insert = jQuery( selector ), 19693 last = insert.length - 1, 19694 i = 0; 19695 19696 for ( ; i <= last; i++ ) { 19697 elems = i === last ? this : this.clone( true ); 19698 jQuery( insert[ i ] )[ original ]( elems ); 19699 19700 // Support: QtWebKit 19701 // .get() because push.apply(_, arraylike) throws 19702 push.apply( ret, elems.get() ); 19703 } 19704 19705 return this.pushStack( ret ); 19706 }; 19707} ); 19708 19709 19710var iframe, 19711 elemdisplay = { 19712 19713 // Support: Firefox 19714 // We have to pre-define these values for FF (#10227) 19715 HTML: "block", 19716 BODY: "block" 19717 }; 19718 19719/** 19720 * Retrieve the actual display of a element 19721 * @param {String} name nodeName of the element 19722 * @param {Object} doc Document object 19723 */ 19724 19725// Called only from within defaultDisplay 19726function actualDisplay( name, doc ) { 19727 var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), 19728 19729 display = jQuery.css( elem[ 0 ], "display" ); 19730 19731 // We don't have any data stored on the element, 19732 // so use "detach" method as fast way to get rid of the element 19733 elem.detach(); 19734 19735 return display; 19736} 19737 19738/** 19739 * Try to determine the default display value of an element 19740 * @param {String} nodeName 19741 */ 19742function defaultDisplay( nodeName ) { 19743 var doc = document, 19744 display = elemdisplay[ nodeName ]; 19745 19746 if ( !display ) { 19747 display = actualDisplay( nodeName, doc ); 19748 19749 // If the simple way fails, read from inside an iframe 19750 if ( display === "none" || !display ) { 19751 19752 // Use the already-created iframe if possible 19753 iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) ) 19754 .appendTo( doc.documentElement ); 19755
19756 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse 19757 doc = iframe[ 0 ].contentDocument; 19758 19759 // Support: IE 19760 doc.write(); 19761 doc.close(); 19762 19763 display = actualDisplay( nodeName, doc ); 19764 iframe.detach(); 19765 } 19766 19767 // Store the correct default display 19768 elemdisplay[ nodeName ] = display; 19769 } 19770 19771 return display; 19772} 19773var rmargin = ( /^margin/ ); 19774 19775var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 19776 19777var getStyles = function( elem ) { 19778 19779 // Support: IE<=11+, Firefox<=30+ (#15098, #14150) 19780 // IE throws on elements created in popups 19781 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 19782 var view = elem.ownerDocument.defaultView; 19783 19784 if ( !view || !view.opener ) { 19785 view = window; 19786 } 19787 19788 return view.getComputedStyle( elem ); 19789 }; 19790 19791var swap = function( elem, options, callback, args ) { 19792 var ret, name, 19793 old = {}; 19794 19795 // Remember the old values, and insert the new ones 19796 for ( name in options ) { 19797 old[ name ] = elem.style[ name ]; 19798 elem.style[ name ] = options[ name ]; 19799 } 19800 19801 ret = callback.apply( elem, args || [] ); 19802 19803 // Revert the old values 19804 for ( name in options ) { 19805 elem.style[ name ] = old[ name ]; 19806 } 19807 19808 return ret; 19809}; 19810 19811 19812var documentElement = document.documentElement; 19813 19814 19815 19816( function() { 19817 var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, 19818 container = document.createElement( "div" ), 19819 div = document.createElement( "div" ); 19820 19821 // Finish early in limited (non-browser) environments 19822 if ( !div.style ) { 19823 return; 19824 } 19825 19826 // Support: IE9-11+ 19827 // Style of cloned element affects source element cloned (#8908) 19828 div.style.backgroundClip = "content-box"; 19829 div.cloneNode( true ).style.backgroundClip = ""; 19830 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 19831 19832 container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + 19833 "padding:0;margin-top:1px;position:absolute"; 19834 container.appendChild( div ); 19835 19836 // Executing both pixelPosition & boxSizingReliable tests require only one layout 19837 // so they're executed at the same time to save the second computation. 19838 function computeStyleTests() { 19839 div.style.cssText = 19840 19841 // Support: Firefox<29, Android 2.3 19842 // Vendor-prefix box-sizing 19843 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;" + 19844 "position:relative;display:block;" + 19845 "margin:auto;border:1px;padding:1px;" + 19846 "top:1%;width:50%"; 19847 div.innerHTML = ""; 19848 documentElement.appendChild( container ); 19849 19850 var divStyle = window.getComputedStyle( div ); 19851 pixelPositionVal = divStyle.top !== "1%"; 19852 reliableMarginLeftVal = divStyle.marginLeft === "2px"; 19853 boxSizingReliableVal = divStyle.width === "4px"; 19854 19855 // Support: Android 4.0 - 4.3 only 19856 // Some styles come back with percentage values, even though they shouldn't 19857 div.style.marginRight = "50%"; 19858 pixelMarginRightVal = divStyle.marginRight === "4px"; 19859 19860 documentElement.removeChild( container ); 19861 } 19862 19863 jQuery.extend( support, { 19864 pixelPosition: function() { 19865 19866 // This test is executed only once but we still do memoizing 19867 // since we can use the boxSizingReliable pre-computing. 19868 // No need to check if the test was already performed, though. 19869 computeStyleTests(); 19870 return pixelPositionVal; 19871 }, 19872 boxSizingReliable: function() { 19873 if ( boxSizingReliableVal == null ) { 19874 computeStyleTests(); 19875 } 19876 return boxSizingReliableVal; 19877 }, 19878 pixelMarginRight: function() { 19879 19880 // Support: Android 4.0-4.3 19881 // We're checking for boxSizingReliableVal here instead of pixelMarginRightVal 19882 // since that compresses better and they're computed together anyway. 19883 if ( boxSizingReliableVal == null ) { 19884 computeStyleTests(); 19885 } 19886 return pixelMarginRightVal; 19887 }, 19888 reliableMarginLeft: function() { 19889 19890 // Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37 19891 if ( boxSizingReliableVal == null ) { 19892 computeStyleTests(); 19893 } 19894 return reliableMarginLeftVal; 19895 }, 19896 reliableMarginRight: function() { 19897 19898 // Support: Android 2.3 19899 // Check if div with explicit width and no margin-right incorrectly 19900 // gets computed margin-right based on width of container. (#3333) 19901 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 19902 // This support function is only executed once so no memoizing is needed. 19903 var ret, 19904 marginDiv = div.appendChild( document.createElement( "div" ) ); 19905 19906 // Reset CSS: box-sizing; display; margin; border; padding 19907 marginDiv.style.cssText = div.style.cssText = 19908
19909 // Support: Android 2.3 19910 // Vendor-prefix box-sizing 19911 "-webkit-box-sizing:content-box;box-sizing:content-box;" + 19912 "display:block;margin:0;border:0;padding:0"; 19913 marginDiv.style.marginRight = marginDiv.style.width = "0"; 19914 div.style.width = "1px"; 19915 documentElement.appendChild( container ); 19916 19917 ret = !parseFloat( window.getComputedStyle( marginDiv ).marginRight ); 19918 19919 documentElement.removeChild( container ); 19920 div.removeChild( marginDiv ); 19921 19922 return ret; 19923 } 19924 } ); 19925} )(); 19926 19927 19928function curCSS( elem, name, computed ) { 19929 var width, minWidth, maxWidth, ret, 19930 style = elem.style; 19931 19932 computed = computed || getStyles( elem ); 19933 ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined; 19934 19935 // Support: Opera 12.1x only 19936 // Fall back to style even without computed 19937 // computed is undefined for elems on document fragments 19938 if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) { 19939 ret = jQuery.style( elem, name ); 19940 } 19941 19942 // Support: IE9 19943 // getPropertyValue is only needed for .css('filter') (#12537) 19944 if ( computed ) { 19945 19946 // A tribute to the "awesome hack by Dean Edwards" 19947 // Android Browser returns percentage for some values, 19948 // but width seems to be reliably pixels. 19949 // This is against the CSSOM draft spec: 19950 // http://dev.w3.org/csswg/cssom/#resolved-values 19951 if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { 19952 19953 // Remember the original values 19954 width = style.width; 19955 minWidth = style.minWidth; 19956 maxWidth = style.maxWidth; 19957 19958 // Put in the new values to get a computed value out 19959 style.minWidth = style.maxWidth = style.width = ret; 19960 ret = computed.width; 19961 19962 // Revert the changed values 19963 style.width = width; 19964 style.minWidth = minWidth; 19965 style.maxWidth = maxWidth; 19966 } 19967 } 19968 19969 return ret !== undefined ? 19970 19971 // Support: IE9-11+ 19972 // IE returns zIndex value as an integer. 19973 ret + "" : 19974 ret; 19975} 19976 19977 19978function addGetHookIf( conditionFn, hookFn ) { 19979 19980 // Define the hook, we'll check on the first run if it's really needed. 19981 return { 19982 get: function() { 19983 if ( conditionFn() ) { 19984 19985 // Hook not needed (or it's not possible to use it due 19986 // to missing dependency), remove it. 19987 delete this.get; 19988 return; 19989 } 19990 19991 // Hook needed; redefine it so that the support test is not executed again. 19992 return ( this.get = hookFn ).apply( this, arguments ); 19993 } 19994 }; 19995} 19996 19997 19998var 19999 20000 // Swappable if display is none or starts with table 20001 // except "table", "table-cell", or "table-caption" 20002 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 20003 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 20004 20005 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 20006 cssNormalTransform = { 20007 letterSpacing: "0", 20008 fontWeight: "400" 20009 }, 20010 20011 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], 20012 emptyStyle = document.createElement( "div" ).style; 20013 20014// Return a css property mapped to a potentially vendor prefixed property 20015function vendorPropName( name ) { 20016 20017 // Shortcut for names that are not vendor prefixed 20018 if ( name in emptyStyle ) { 20019 return name; 20020 } 20021 20022 // Check for vendor prefixed names 20023 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 20024 i = cssPrefixes.length; 20025 20026 while ( i-- ) { 20027 name = cssPrefixes[ i ] + capName; 20028 if ( name in emptyStyle ) { 20029 return name; 20030 } 20031 } 20032} 20033 20034function setPositiveNumber( elem, value, subtract ) { 20035 20036 // Any relative (+/-) values have already been 20037 // normalized at this point 20038 var matches = rcssNum.exec( value ); 20039 return matches ? 20040 20041 // Guard against undefined "subtract", e.g., when used as in cssHooks 20042 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 20043 value; 20044} 20045 20046function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { 20047 var i = extra === ( isBorderBox ? "border" : "content" ) ? 20048 20049 // If we already have the right measurement, avoid augmentation 20050 4 : 20051 20052 // Otherwise initialize for horizontal or vertical properties 20053 name === "width" ? 1 : 0, 20054 20055 val = 0; 20056 20057 for ( ; i < 4; i += 2 ) { 20058 20059 // Both box models exclude margin, so add it if we want it 20060 if ( extra === "margin" ) { 20061 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); 20062 } 20063 20064 if ( isBorderBox ) { 20065 20066 // border-box includes padding, so remove it if we want content 20067 if ( extra === "content" ) { 20068 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 20069 } 20070 20071 // At this point, extra isn't border nor margin, so remove border 20072 if ( extra !== "margin" ) { 20073 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 20074 } 20075 } else { 20076 20077 // At this point, extra isn't content, so add padding 20078 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 20079 20080 // At this point, extra isn't content nor padding, so add border 20081 if ( extra !== "padding" ) { 20082 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 20083 } 20084 } 20085 } 20086 20087 return val; 20088} 20089 20090function getWidthOrHeight( elem, name, extra ) { 20091 20092 // Start with offset property, which is equivalent to the border-box value 20093 var valueIsBorderBox = true, 20094 val = name === "width" ? elem.offsetWidth : elem.offsetHeight, 20095 styles = getStyles( elem ), 20096 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 20097 20098 // Some non-html elements return undefined for offsetWidth, so check for null/undefined 20099 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 20100 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 20101 if ( val <= 0 || val == null ) { 20102 20103 // Fall back to computed then uncomputed css if necessary 20104 val = curCSS( elem, name, styles ); 20105 if ( val < 0 || val == null ) { 20106 val = elem.style[ name ]; 20107 } 20108 20109 // Computed unit is not pixels. Stop here and return. 20110 if ( rnumnonpx.test( val ) ) { 20111 return val; 20112 } 20113 20114 // Check for style in case a browser which returns unreliable values 20115 // for getComputedStyle silently falls back to the reliable elem.style 20116 valueIsBorderBox = isBorderBox && 20117 ( support.boxSizingReliable() || val === elem.style[ name ] ); 20118 20119 // Normalize "", auto, and prepare for extra 20120 val = parseFloat( val ) || 0; 20121 } 20122 20123 // Use the active box-sizing model to add/subtract irrelevant styles 20124 return ( val + 20125 augmentWidthOrHeight( 20126 elem, 20127 name, 20128 extra || ( isBorderBox ? "border" : "content" ), 20129 valueIsBorderBox, 20130 styles 20131 ) 20132 ) + "px"; 20133} 20134 20135function showHide( elements, show ) { 20136 var display, elem, hidden, 20137 values = [], 20138 index = 0, 20139 length = elements.length; 20140 20141 for ( ; index < length; index++ ) { 20142 elem = elements[ index ]; 20143 if ( !elem.style ) { 20144 continue; 20145 } 20146 20147 values[ index ] = dataPriv.get( elem, "olddisplay" ); 20148 display = elem.style.display; 20149 if ( show ) { 20150 20151 // Reset the inline display of this element to learn if it is 20152 // being hidden by cascaded rules or not 20153 if ( !values[ index ] && display === "none" ) { 20154 elem.style.display = ""; 20155 } 20156 20157 // Set elements which have been overridden with display: none 20158 // in a stylesheet to whatever the default browser style is 20159 // for such an element 20160 if ( elem.style.display === "" && isHidden( elem ) ) { 20161 values[ index ] = dataPriv.access( 20162 elem, 20163 "olddisplay", 20164 defaultDisplay( elem.nodeName ) 20165 ); 20166 } 20167 } else { 20168 hidden = isHidden( elem ); 20169 20170 if ( display !== "none" || !hidden ) { 20171 dataPriv.set( 20172 elem, 20173 "olddisplay",
vendor: 7,760 bytes, lines 20174-20478
20174 hidden ? display : jQuery.css( elem, "display" ) 20175 ); 20176 } 20177 } 20178 } 20179 20180 // Set the display of most of the elements in a second loop 20181 // to avoid the constant reflow 20182 for ( index = 0; index < length; index++ ) { 20183 elem = elements[ index ]; 20184 if ( !elem.style ) { 20185 continue; 20186 } 20187 if ( !show || elem.style.display === "none" || elem.style.display === "" ) { 20188 elem.style.display = show ? values[ index ] || "" : "none"; 20189 } 20190 } 20191 20192 return elements; 20193} 20194 20195jQuery.extend( { 20196 20197 // Add in style property hooks for overriding the default 20198 // behavior of getting and setting a style property 20199 cssHooks: { 20200 opacity: { 20201 get: function( elem, computed ) { 20202 if ( computed ) { 20203 20204 // We should always get a number back from opacity 20205 var ret = curCSS( elem, "opacity" ); 20206 return ret === "" ? "1" : ret; 20207 } 20208 } 20209 } 20210 }, 20211 20212 // Don't automatically add "px" to these possibly-unitless properties 20213 cssNumber: { 20214 "animationIterationCount": true, 20215 "columnCount": true, 20216 "fillOpacity": true, 20217 "flexGrow": true, 20218 "flexShrink": true, 20219 "fontWeight": true, 20220 "lineHeight": true, 20221 "opacity": true, 20222 "order": true, 20223 "orphans": true, 20224 "widows": true, 20225 "zIndex": true, 20226 "zoom": true 20227 }, 20228 20229 // Add in properties whose names you wish to fix before 20230 // setting or getting the value 20231 cssProps: { 20232 "float": "cssFloat" 20233 }, 20234 20235 // Get and set the style property on a DOM Node 20236 style: function( elem, name, value, extra ) { 20237 20238 // Don't set styles on text and comment nodes 20239 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 20240 return; 20241 } 20242 20243 // Make sure that we're working with the right name 20244 var ret, type, hooks, 20245 origName = jQuery.camelCase( name ), 20246 style = elem.style; 20247 20248 name = jQuery.cssProps[ origName ] || 20249 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); 20250 20251 // Gets hook for the prefixed version, then unprefixed version 20252 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 20253 20254 // Check if we're setting a value 20255 if ( value !== undefined ) { 20256 type = typeof value; 20257 20258 // Convert "+=" or "-=" to relative numbers (#7345) 20259 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 20260 value = adjustCSS( elem, name, ret ); 20261 20262 // Fixes bug #9237 20263 type = "number"; 20264 } 20265 20266 // Make sure that null and NaN values aren't set (#7116) 20267 if ( value == null || value !== value ) { 20268 return; 20269 } 20270 20271 // If a number was passed in, add the unit (except for certain CSS properties) 20272 if ( type === "number" ) { 20273 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 20274 } 20275 20276 // Support: IE9-11+ 20277 // background-* props affect original clone's values 20278 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 20279 style[ name ] = "inherit"; 20280 } 20281 20282 // If a hook was provided, use that value, otherwise just set the specified value 20283 if ( !hooks || !( "set" in hooks ) || 20284 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 20285 20286 style[ name ] = value; 20287 } 20288 20289 } else { 20290 20291 // If a hook was provided get the non-computed value from there 20292 if ( hooks && "get" in hooks && 20293 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 20294 20295 return ret; 20296 } 20297 20298 // Otherwise just get the value from the style object 20299 return style[ name ]; 20300 } 20301 }, 20302 20303 css: function( elem, name, extra, styles ) { 20304 var val, num, hooks, 20305 origName = jQuery.camelCase( name ); 20306 20307 // Make sure that we're working with the right name 20308 name = jQuery.cssProps[ origName ] || 20309 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); 20310 20311 // Try prefixed name followed by the unprefixed name 20312 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 20313 20314 // If a hook was provided get the computed value from there 20315 if ( hooks && "get" in hooks ) { 20316 val = hooks.get( elem, true, extra ); 20317 } 20318 20319 // Otherwise, if a way to get the computed value exists, use that 20320 if ( val === undefined ) { 20321 val = curCSS( elem, name, styles ); 20322 } 20323 20324 // Convert "normal" to computed value 20325 if ( val === "normal" && name in cssNormalTransform ) { 20326 val = cssNormalTransform[ name ]; 20327 } 20328 20329 // Make numeric if forced or a qualifier was provided and val looks numeric 20330 if ( extra === "" || extra ) { 20331 num = parseFloat( val ); 20332 return extra === true || isFinite( num ) ? num || 0 : val; 20333 } 20334 return val; 20335 } 20336} ); 20337 20338jQuery.each( [ "height", "width" ], function( i, name ) { 20339 jQuery.cssHooks[ name ] = { 20340 get: function( elem, computed, extra ) { 20341 if ( computed ) { 20342 20343 // Certain elements can have dimension info if we invisibly show them 20344 // but it must have a current display style that would benefit 20345 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 20346 elem.offsetWidth === 0 ? 20347 swap( elem, cssShow, function() { 20348 return getWidthOrHeight( elem, name, extra ); 20349 } ) : 20350 getWidthOrHeight( elem, name, extra ); 20351 } 20352 }, 20353 20354 set: function( elem, value, extra ) { 20355 var matches, 20356 styles = extra && getStyles( elem ), 20357 subtract = extra && augmentWidthOrHeight( 20358 elem, 20359 name, 20360 extra, 20361 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 20362 styles 20363 ); 20364 20365 // Convert to pixels if value adjustment is needed 20366 if ( subtract && ( matches = rcssNum.exec( value ) ) && 20367 ( matches[ 3 ] || "px" ) !== "px" ) { 20368 20369 elem.style[ name ] = value; 20370 value = jQuery.css( elem, name ); 20371 } 20372 20373 return setPositiveNumber( elem, value, subtract ); 20374 } 20375 }; 20376} ); 20377 20378jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 20379 function( elem, computed ) { 20380 if ( computed ) { 20381 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 20382 elem.getBoundingClientRect().left - 20383 swap( elem, { marginLeft: 0 }, function() { 20384 return elem.getBoundingClientRect().left; 20385 } ) 20386 ) + "px"; 20387 } 20388 } 20389); 20390 20391// Support: Android 2.3 20392jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, 20393 function( elem, computed ) { 20394 if ( computed ) { 20395 return swap( elem, { "display": "inline-block" }, 20396 curCSS, [ elem, "marginRight" ] ); 20397 } 20398 } 20399); 20400 20401// These hooks are used by animate to expand properties 20402jQuery.each( { 20403 margin: "", 20404 padding: "", 20405 border: "Width" 20406}, function( prefix, suffix ) { 20407 jQuery.cssHooks[ prefix + suffix ] = { 20408 expand: function( value ) { 20409 var i = 0, 20410 expanded = {}, 20411 20412 // Assumes a single number if not a string 20413 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 20414 20415 for ( ; i < 4; i++ ) { 20416 expanded[ prefix + cssExpand[ i ] + suffix ] = 20417 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 20418 } 20419 20420 return expanded; 20421 } 20422 }; 20423 20424 if ( !rmargin.test( prefix ) ) { 20425 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 20426 } 20427} ); 20428 20429jQuery.fn.extend( { 20430 css: function( name, value ) { 20431 return access( this, function( elem, name, value ) { 20432 var styles, len, 20433 map = {}, 20434 i = 0; 20435 20436 if ( jQuery.isArray( name ) ) { 20437 styles = getStyles( elem ); 20438 len = name.length; 20439 20440 for ( ; i < len; i++ ) { 20441 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 20442 } 20443 20444 return map; 20445 } 20446 20447 return value !== undefined ? 20448 jQuery.style( elem, name, value ) : 20449 jQuery.css( elem, name ); 20450 }, name, value, arguments.length > 1 ); 20451 }, 20452 show: function() { 20453 return showHide( this, true ); 20454 }, 20455 hide: function() { 20456 return showHide( this ); 20457 }, 20458 toggle: function( state ) { 20459 if ( typeof state === "boolean" ) { 20460 return state ? this.show() : this.hide(); 20461 } 20462 20463 return this.each( function() { 20464 if ( isHidden( this ) ) { 20465 jQuery( this ).show(); 20466 } else { 20467 jQuery( this ).hide(); 20468 } 20469 } ); 20470 } 20471} ); 20472 20473 20474function Tween( elem, options, prop, end, easing ) { 20475 return new Tween.prototype.init( elem, options, prop, end, easing ); 20476} 20477jQuery.Tween = Tween; 20478
vendor: 5,170 bytes, lines 20479-20678
20479Tween.prototype = { 20480 constructor: Tween, 20481 init: function( elem, options, prop, end, easing, unit ) { 20482 this.elem = elem; 20483 this.prop = prop; 20484 this.easing = easing || jQuery.easing._default; 20485 this.options = options; 20486 this.start = this.now = this.cur(); 20487 this.end = end; 20488 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 20489 }, 20490 cur: function() { 20491 var hooks = Tween.propHooks[ this.prop ]; 20492 20493 return hooks && hooks.get ? 20494 hooks.get( this ) : 20495 Tween.propHooks._default.get( this ); 20496 }, 20497 run: function( percent ) { 20498 var eased, 20499 hooks = Tween.propHooks[ this.prop ]; 20500 20501 if ( this.options.duration ) { 20502 this.pos = eased = jQuery.easing[ this.easing ]( 20503 percent, this.options.duration * percent, 0, 1, this.options.duration 20504 ); 20505 } else { 20506 this.pos = eased = percent; 20507 } 20508 this.now = ( this.end - this.start ) * eased + this.start; 20509 20510 if ( this.options.step ) { 20511 this.options.step.call( this.elem, this.now, this ); 20512 } 20513 20514 if ( hooks && hooks.set ) { 20515 hooks.set( this ); 20516 } else { 20517 Tween.propHooks._default.set( this ); 20518 } 20519 return this; 20520 } 20521}; 20522 20523Tween.prototype.init.prototype = Tween.prototype; 20524 20525Tween.propHooks = { 20526 _default: { 20527 get: function( tween ) { 20528 var result; 20529 20530 // Use a property on the element directly when it is not a DOM element, 20531 // or when there is no matching style property that exists. 20532 if ( tween.elem.nodeType !== 1 || 20533 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 20534 return tween.elem[ tween.prop ]; 20535 } 20536 20537 // Passing an empty string as a 3rd parameter to .css will automatically 20538 // attempt a parseFloat and fallback to a string if the parse fails. 20539 // Simple values such as "10px" are parsed to Float; 20540 // complex values such as "rotate(1rad)" are returned as-is. 20541 result = jQuery.css( tween.elem, tween.prop, "" ); 20542 20543 // Empty strings, null, undefined and "auto" are converted to 0. 20544 return !result || result === "auto" ? 0 : result; 20545 }, 20546 set: function( tween ) { 20547 20548 // Use step hook for back compat. 20549 // Use cssHook if its there. 20550 // Use .style if available and use plain properties where available. 20551 if ( jQuery.fx.step[ tween.prop ] ) { 20552 jQuery.fx.step[ tween.prop ]( tween ); 20553 } else if ( tween.elem.nodeType === 1 && 20554 ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || 20555 jQuery.cssHooks[ tween.prop ] ) ) { 20556 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 20557 } else { 20558 tween.elem[ tween.prop ] = tween.now; 20559 } 20560 } 20561 } 20562}; 20563 20564// Support: IE9 20565// Panic based approach to setting things on disconnected nodes 20566Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 20567 set: function( tween ) { 20568 if ( tween.elem.nodeType && tween.elem.parentNode ) { 20569 tween.elem[ tween.prop ] = tween.now; 20570 } 20571 } 20572}; 20573 20574jQuery.easing = { 20575 linear: function( p ) { 20576 return p; 20577 }, 20578 swing: function( p ) { 20579 return 0.5 - Math.cos( p * Math.PI ) / 2; 20580 }, 20581 _default: "swing" 20582}; 20583 20584jQuery.fx = Tween.prototype.init; 20585 20586// Back Compat <1.8 extension point 20587jQuery.fx.step = {}; 20588 20589 20590 20591 20592var 20593 fxNow, timerId, 20594 rfxtypes = /^(?:toggle|show|hide)$/, 20595 rrun = /queueHooks$/; 20596 20597// Animations created synchronously will run synchronously 20598function createFxNow() { 20599 window.setTimeout( function() { 20600 fxNow = undefined; 20601 } ); 20602 return ( fxNow = jQuery.now() ); 20603} 20604 20605// Generate parameters to create a standard animation 20606function genFx( type, includeWidth ) { 20607 var which, 20608 i = 0, 20609 attrs = { height: type }; 20610 20611 // If we include width, step value is 1 to do all cssExpand values, 20612 // otherwise step value is 2 to skip over Left and Right 20613 includeWidth = includeWidth ? 1 : 0; 20614 for ( ; i < 4 ; i += 2 - includeWidth ) { 20615 which = cssExpand[ i ]; 20616 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 20617 } 20618 20619 if ( includeWidth ) { 20620 attrs.opacity = attrs.width = type; 20621 } 20622 20623 return attrs; 20624} 20625 20626function createTween( value, prop, animation ) { 20627 var tween, 20628 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 20629 index = 0, 20630 length = collection.length; 20631 for ( ; index < length; index++ ) { 20632 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 20633 20634 // We're done with this property 20635 return tween; 20636 } 20637 } 20638} 20639 20640function defaultPrefilter( elem, props, opts ) { 20641 /* jshint validthis: true */ 20642 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, 20643 anim = this, 20644 orig = {}, 20645 style = elem.style, 20646 hidden = elem.nodeType && isHidden( elem ), 20647 dataShow = dataPriv.get( elem, "fxshow" ); 20648 20649 // Handle queue: false promises 20650 if ( !opts.queue ) { 20651 hooks = jQuery._queueHooks( elem, "fx" ); 20652 if ( hooks.unqueued == null ) { 20653 hooks.unqueued = 0; 20654 oldfire = hooks.empty.fire; 20655 hooks.empty.fire = function() { 20656 if ( !hooks.unqueued ) { 20657 oldfire(); 20658 } 20659 }; 20660 } 20661 hooks.unqueued++; 20662 20663 anim.always( function() { 20664 20665 // Ensure the complete handler is called before this completes 20666 anim.always( function() { 20667 hooks.unqueued--; 20668 if ( !jQuery.queue( elem, "fx" ).length ) { 20669 hooks.empty.fire(); 20670 } 20671 } ); 20672 } ); 20673 } 20674 20675 // Height/width overflow pass 20676 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { 20677 20678 // Make sure that nothing sneaks out
20679 // Record all 3 overflow attributes because IE9-10 do not 20680 // change the overflow attribute when overflowX and 20681 // overflowY are set to the same value 20682 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 20683 20684 // Set display property to inline-block for height/width 20685 // animations on inline elements that are having width/height animated 20686 display = jQuery.css( elem, "display" ); 20687 20688 // Test default display if display is currently "none" 20689 checkDisplay = display === "none" ? 20690 dataPriv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; 20691 20692 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { 20693 style.display = "inline-block"; 20694 } 20695 } 20696 20697 if ( opts.overflow ) { 20698 style.overflow = "hidden"; 20699 anim.always( function() { 20700 style.overflow = opts.overflow[ 0 ]; 20701 style.overflowX = opts.overflow[ 1 ]; 20702 style.overflowY = opts.overflow[ 2 ]; 20703 } ); 20704 } 20705 20706 // show/hide pass 20707 for ( prop in props ) { 20708 value = props[ prop ]; 20709 if ( rfxtypes.exec( value ) ) { 20710 delete props[ prop ]; 20711 toggle = toggle || value === "toggle"; 20712 if ( value === ( hidden ? "hide" : "show" ) ) { 20713 20714 // If there is dataShow left over from a stopped hide or show 20715 // and we are going to proceed with show, we should pretend to be hidden 20716 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 20717 hidden = true; 20718 } else { 20719 continue; 20720 } 20721 } 20722 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 20723 20724 // Any non-fx value stops us from restoring the original display value 20725 } else { 20726 display = undefined; 20727 } 20728 } 20729 20730 if ( !jQuery.isEmptyObject( orig ) ) { 20731 if ( dataShow ) { 20732 if ( "hidden" in dataShow ) { 20733 hidden = dataShow.hidden; 20734 } 20735 } else { 20736 dataShow = dataPriv.access( elem, "fxshow", {} ); 20737 } 20738 20739 // Store state if its toggle - enables .stop().toggle() to "reverse" 20740 if ( toggle ) { 20741 dataShow.hidden = !hidden; 20742 } 20743 if ( hidden ) { 20744 jQuery( elem ).show(); 20745 } else { 20746 anim.done( function() { 20747 jQuery( elem ).hide(); 20748 } ); 20749 } 20750 anim.done( function() { 20751 var prop; 20752 20753 dataPriv.remove( elem, "fxshow" ); 20754 for ( prop in orig ) { 20755 jQuery.style( elem, prop, orig[ prop ] ); 20756 } 20757 } ); 20758 for ( prop in orig ) { 20759 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 20760 20761 if ( !( prop in dataShow ) ) { 20762 dataShow[ prop ] = tween.start; 20763 if ( hidden ) { 20764 tween.end = tween.start; 20765 tween.start = prop === "width" || prop === "height" ? 1 : 0; 20766 } 20767 } 20768 } 20769 20770 // If this is a noop like .hide().hide(), restore an overwritten display value 20771 } else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : display ) === "inline" ) { 20772 style.display = display; 20773 } 20774} 20775 20776function propFilter( props, specialEasing ) { 20777 var index, name, easing, value, hooks; 20778 20779 // camelCase, specialEasing and expand cssHook pass 20780 for ( index in props ) { 20781 name = jQuery.camelCase( index ); 20782 easing = specialEasing[ name ]; 20783 value = props[ index ]; 20784 if ( jQuery.isArray( value ) ) { 20785 easing = value[ 1 ]; 20786 value = props[ index ] = value[ 0 ]; 20787 } 20788 20789 if ( index !== name ) { 20790 props[ name ] = value; 20791 delete props[ index ]; 20792 } 20793 20794 hooks = jQuery.cssHooks[ name ]; 20795 if ( hooks && "expand" in hooks ) { 20796 value = hooks.expand( value ); 20797 delete props[ name ]; 20798 20799 // Not quite $.extend, this won't overwrite existing keys. 20800 // Reusing 'index' because we have the correct "name" 20801 for ( index in value ) { 20802 if ( !( index in props ) ) { 20803 props[ index ] = value[ index ]; 20804 specialEasing[ index ] = easing; 20805 } 20806 } 20807 } else { 20808 specialEasing[ name ] = easing; 20809 } 20810 } 20811} 20812 20813function Animation( elem, properties, options ) { 20814 var result, 20815 stopped, 20816 index = 0, 20817 length = Animation.prefilters.length, 20818 deferred = jQuery.Deferred().always( function() { 20819 20820 // Don't match elem in the :animated selector 20821 delete tick.elem; 20822 } ), 20823 tick = function() { 20824 if ( stopped ) { 20825 return false; 20826 } 20827 var currentTime = fxNow || createFxNow(), 20828 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 20829
vendor: 9,405 bytes, lines 20830-21201
20830 // Support: Android 2.3 20831 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 20832 temp = remaining / animation.duration || 0, 20833 percent = 1 - temp, 20834 index = 0, 20835 length = animation.tweens.length; 20836 20837 for ( ; index < length ; index++ ) { 20838 animation.tweens[ index ].run( percent ); 20839 } 20840 20841 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 20842 20843 if ( percent < 1 && length ) { 20844 return remaining; 20845 } else { 20846 deferred.resolveWith( elem, [ animation ] ); 20847 return false; 20848 } 20849 }, 20850 animation = deferred.promise( { 20851 elem: elem, 20852 props: jQuery.extend( {}, properties ), 20853 opts: jQuery.extend( true, { 20854 specialEasing: {}, 20855 easing: jQuery.easing._default 20856 }, options ), 20857 originalProperties: properties, 20858 originalOptions: options, 20859 startTime: fxNow || createFxNow(), 20860 duration: options.duration, 20861 tweens: [], 20862 createTween: function( prop, end ) { 20863 var tween = jQuery.Tween( elem, animation.opts, prop, end, 20864 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 20865 animation.tweens.push( tween ); 20866 return tween; 20867 }, 20868 stop: function( gotoEnd ) { 20869 var index = 0, 20870 20871 // If we are going to the end, we want to run all the tweens 20872 // otherwise we skip this part 20873 length = gotoEnd ? animation.tweens.length : 0; 20874 if ( stopped ) { 20875 return this; 20876 } 20877 stopped = true; 20878 for ( ; index < length ; index++ ) { 20879 animation.tweens[ index ].run( 1 ); 20880 } 20881 20882 // Resolve when we played the last frame; otherwise, reject 20883 if ( gotoEnd ) { 20884 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 20885 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 20886 } else { 20887 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 20888 } 20889 return this; 20890 } 20891 } ), 20892 props = animation.props; 20893 20894 propFilter( props, animation.opts.specialEasing ); 20895 20896 for ( ; index < length ; index++ ) { 20897 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 20898 if ( result ) { 20899 if ( jQuery.isFunction( result.stop ) ) { 20900 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 20901 jQuery.proxy( result.stop, result ); 20902 } 20903 return result; 20904 } 20905 } 20906 20907 jQuery.map( props, createTween, animation ); 20908 20909 if ( jQuery.isFunction( animation.opts.start ) ) { 20910 animation.opts.start.call( elem, animation ); 20911 } 20912 20913 jQuery.fx.timer( 20914 jQuery.extend( tick, { 20915 elem: elem, 20916 anim: animation, 20917 queue: animation.opts.queue 20918 } ) 20919 ); 20920 20921 // attach callbacks from options 20922 return animation.progress( animation.opts.progress ) 20923 .done( animation.opts.done, animation.opts.complete ) 20924 .fail( animation.opts.fail ) 20925 .always( animation.opts.always ); 20926} 20927 20928jQuery.Animation = jQuery.extend( Animation, { 20929 tweeners: { 20930 "*": [ function( prop, value ) { 20931 var tween = this.createTween( prop, value ); 20932 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 20933 return tween; 20934 } ] 20935 }, 20936 20937 tweener: function( props, callback ) { 20938 if ( jQuery.isFunction( props ) ) { 20939 callback = props; 20940 props = [ "*" ]; 20941 } else { 20942 props = props.match( rnotwhite ); 20943 } 20944 20945 var prop, 20946 index = 0, 20947 length = props.length; 20948 20949 for ( ; index < length ; index++ ) { 20950 prop = props[ index ]; 20951 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 20952 Animation.tweeners[ prop ].unshift( callback ); 20953 } 20954 }, 20955 20956 prefilters: [ defaultPrefilter ], 20957 20958 prefilter: function( callback, prepend ) { 20959 if ( prepend ) { 20960 Animation.prefilters.unshift( callback ); 20961 } else { 20962 Animation.prefilters.push( callback ); 20963 } 20964 } 20965} ); 20966 20967jQuery.speed = function( speed, easing, fn ) { 20968 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 20969 complete: fn || !fn && easing || 20970 jQuery.isFunction( speed ) && speed, 20971 duration: speed, 20972 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing 20973 }; 20974 20975 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? 20976 opt.duration : opt.duration in jQuery.fx.speeds ? 20977 jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; 20978 20979 // Normalize opt.queue - true/undefined/null -> "fx" 20980 if ( opt.queue == null || opt.queue === true ) { 20981 opt.queue = "fx"; 20982 } 20983 20984 // Queueing 20985 opt.old = opt.complete; 20986 20987 opt.complete = function() { 20988 if ( jQuery.isFunction( opt.old ) ) { 20989 opt.old.call( this ); 20990 } 20991 20992 if ( opt.queue ) { 20993 jQuery.dequeue( this, opt.queue ); 20994 } 20995 }; 20996 20997 return opt; 20998}; 20999 21000jQuery.fn.extend( { 21001 fadeTo: function( speed, to, easing, callback ) { 21002 21003 // Show any hidden elements after setting opacity to 0 21004 return this.filter( isHidden ).css( "opacity", 0 ).show() 21005 21006 // Animate to the value specified 21007 .end().animate( { opacity: to }, speed, easing, callback ); 21008 }, 21009 animate: function( prop, speed, easing, callback ) { 21010 var empty = jQuery.isEmptyObject( prop ), 21011 optall = jQuery.speed( speed, easing, callback ), 21012 doAnimation = function() { 21013 21014 // Operate on a copy of prop so per-property easing won't be lost 21015 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 21016 21017 // Empty animations, or finishing resolves immediately 21018 if ( empty || dataPriv.get( this, "finish" ) ) { 21019 anim.stop( true ); 21020 } 21021 }; 21022 doAnimation.finish = doAnimation; 21023 21024 return empty || optall.queue === false ? 21025 this.each( doAnimation ) : 21026 this.queue( optall.queue, doAnimation ); 21027 }, 21028 stop: function( type, clearQueue, gotoEnd ) { 21029 var stopQueue = function( hooks ) { 21030 var stop = hooks.stop; 21031 delete hooks.stop; 21032 stop( gotoEnd ); 21033 }; 21034 21035 if ( typeof type !== "string" ) { 21036 gotoEnd = clearQueue; 21037 clearQueue = type; 21038 type = undefined; 21039 } 21040 if ( clearQueue && type !== false ) { 21041 this.queue( type || "fx", [] ); 21042 } 21043 21044 return this.each( function() { 21045 var dequeue = true, 21046 index = type != null && type + "queueHooks", 21047 timers = jQuery.timers, 21048 data = dataPriv.get( this ); 21049 21050 if ( index ) { 21051 if ( data[ index ] && data[ index ].stop ) { 21052 stopQueue( data[ index ] ); 21053 } 21054 } else { 21055 for ( index in data ) { 21056 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 21057 stopQueue( data[ index ] ); 21058 } 21059 } 21060 } 21061 21062 for ( index = timers.length; index--; ) { 21063 if ( timers[ index ].elem === this && 21064 ( type == null || timers[ index ].queue === type ) ) { 21065 21066 timers[ index ].anim.stop( gotoEnd ); 21067 dequeue = false; 21068 timers.splice( index, 1 ); 21069 } 21070 } 21071 21072 // Start the next in the queue if the last step wasn't forced. 21073 // Timers currently will call their complete callbacks, which 21074 // will dequeue but only if they were gotoEnd. 21075 if ( dequeue || !gotoEnd ) { 21076 jQuery.dequeue( this, type ); 21077 } 21078 } ); 21079 }, 21080 finish: function( type ) { 21081 if ( type !== false ) { 21082 type = type || "fx"; 21083 } 21084 return this.each( function() { 21085 var index, 21086 data = dataPriv.get( this ), 21087 queue = data[ type + "queue" ], 21088 hooks = data[ type + "queueHooks" ], 21089 timers = jQuery.timers, 21090 length = queue ? queue.length : 0; 21091 21092 // Enable finishing flag on private data 21093 data.finish = true; 21094 21095 // Empty the queue first 21096 jQuery.queue( this, type, [] ); 21097 21098 if ( hooks && hooks.stop ) { 21099 hooks.stop.call( this, true ); 21100 } 21101 21102 // Look for any active animations, and finish them 21103 for ( index = timers.length; index--; ) { 21104 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 21105 timers[ index ].anim.stop( true ); 21106 timers.splice( index, 1 ); 21107 } 21108 } 21109 21110 // Look for any animations in the old queue and finish them 21111 for ( index = 0; index < length; index++ ) { 21112 if ( queue[ index ] && queue[ index ].finish ) { 21113 queue[ index ].finish.call( this ); 21114 } 21115 } 21116 21117 // Turn off finishing flag 21118 delete data.finish; 21119 } ); 21120 } 21121} ); 21122 21123jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { 21124 var cssFn = jQuery.fn[ name ]; 21125 jQuery.fn[ name ] = function( speed, easing, callback ) { 21126 return speed == null || typeof speed === "boolean" ? 21127 cssFn.apply( this, arguments ) : 21128 this.animate( genFx( name, true ), speed, easing, callback ); 21129 }; 21130} ); 21131 21132// Generate shortcuts for custom animations 21133jQuery.each( { 21134 slideDown: genFx( "show" ), 21135 slideUp: genFx( "hide" ), 21136 slideToggle: genFx( "toggle" ), 21137 fadeIn: { opacity: "show" }, 21138 fadeOut: { opacity: "hide" }, 21139 fadeToggle: { opacity: "toggle" } 21140}, function( name, props ) { 21141 jQuery.fn[ name ] = function( speed, easing, callback ) { 21142 return this.animate( props, speed, easing, callback ); 21143 }; 21144} ); 21145 21146jQuery.timers = []; 21147jQuery.fx.tick = function() { 21148 var timer, 21149 i = 0, 21150 timers = jQuery.timers; 21151 21152 fxNow = jQuery.now(); 21153 21154 for ( ; i < timers.length; i++ ) { 21155 timer = timers[ i ]; 21156 21157 // Checks the timer has not already been removed 21158 if ( !timer() && timers[ i ] === timer ) { 21159 timers.splice( i--, 1 ); 21160 } 21161 } 21162 21163 if ( !timers.length ) { 21164 jQuery.fx.stop(); 21165 } 21166 fxNow = undefined; 21167}; 21168 21169jQuery.fx.timer = function( timer ) { 21170 jQuery.timers.push( timer ); 21171 if ( timer() ) { 21172 jQuery.fx.start(); 21173 } else { 21174 jQuery.timers.pop(); 21175 } 21176}; 21177 21178jQuery.fx.interval = 13; 21179jQuery.fx.start = function() { 21180 if ( !timerId ) { 21181 timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval ); 21182 } 21183}; 21184 21185jQuery.fx.stop = function() { 21186 window.clearInterval( timerId ); 21187 21188 timerId = null; 21189}; 21190 21191jQuery.fx.speeds = { 21192 slow: 600, 21193 fast: 200, 21194 21195 // Default speed 21196 _default: 400 21197}; 21198 21199 21200// Based off of the plugin by Clint Helfers, with permission. 21201// http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
vendor: 20,418 bytes, lines 21202-22046
21202jQuery.fn.delay = function( time, type ) { 21203 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 21204 type = type || "fx"; 21205 21206 return this.queue( type, function( next, hooks ) { 21207 var timeout = window.setTimeout( next, time ); 21208 hooks.stop = function() { 21209 window.clearTimeout( timeout ); 21210 }; 21211 } ); 21212}; 21213 21214 21215( function() { 21216 var input = document.createElement( "input" ), 21217 select = document.createElement( "select" ), 21218 opt = select.appendChild( document.createElement( "option" ) ); 21219 21220 input.type = "checkbox"; 21221 21222 // Support: iOS<=5.1, Android<=4.2+ 21223 // Default value for a checkbox should be "on" 21224 support.checkOn = input.value !== ""; 21225 21226 // Support: IE<=11+ 21227 // Must access selectedIndex to make default options select 21228 support.optSelected = opt.selected; 21229 21230 // Support: Android<=2.3 21231 // Options inside disabled selects are incorrectly marked as disabled 21232 select.disabled = true; 21233 support.optDisabled = !opt.disabled; 21234 21235 // Support: IE<=11+ 21236 // An input loses its value after becoming a radio 21237 input = document.createElement( "input" ); 21238 input.value = "t"; 21239 input.type = "radio"; 21240 support.radioValue = input.value === "t"; 21241} )(); 21242 21243 21244var boolHook, 21245 attrHandle = jQuery.expr.attrHandle; 21246 21247jQuery.fn.extend( { 21248 attr: function( name, value ) { 21249 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 21250 }, 21251 21252 removeAttr: function( name ) { 21253 return this.each( function() { 21254 jQuery.removeAttr( this, name ); 21255 } ); 21256 } 21257} ); 21258 21259jQuery.extend( { 21260 attr: function( elem, name, value ) { 21261 var ret, hooks, 21262 nType = elem.nodeType; 21263 21264 // Don't get/set attributes on text, comment and attribute nodes 21265 if ( nType === 3 || nType === 8 || nType === 2 ) { 21266 return; 21267 } 21268 21269 // Fallback to prop when attributes are not supported 21270 if ( typeof elem.getAttribute === "undefined" ) { 21271 return jQuery.prop( elem, name, value ); 21272 } 21273 21274 // All attributes are lowercase 21275 // Grab necessary hook if one is defined 21276 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 21277 name = name.toLowerCase(); 21278 hooks = jQuery.attrHooks[ name ] || 21279 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 21280 } 21281 21282 if ( value !== undefined ) { 21283 if ( value === null ) { 21284 jQuery.removeAttr( elem, name ); 21285 return; 21286 } 21287 21288 if ( hooks && "set" in hooks && 21289 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 21290 return ret; 21291 } 21292 21293 elem.setAttribute( name, value + "" ); 21294 return value; 21295 } 21296 21297 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 21298 return ret; 21299 } 21300 21301 ret = jQuery.find.attr( elem, name ); 21302 21303 // Non-existent attributes return null, we normalize to undefined 21304 return ret == null ? undefined : ret; 21305 }, 21306 21307 attrHooks: { 21308 type: { 21309 set: function( elem, value ) { 21310 if ( !support.radioValue && value === "radio" && 21311 jQuery.nodeName( elem, "input" ) ) { 21312 var val = elem.value; 21313 elem.setAttribute( "type", value ); 21314 if ( val ) { 21315 elem.value = val; 21316 } 21317 return value; 21318 } 21319 } 21320 } 21321 }, 21322 21323 removeAttr: function( elem, value ) { 21324 var name, propName, 21325 i = 0, 21326 attrNames = value && value.match( rnotwhite ); 21327 21328 if ( attrNames && elem.nodeType === 1 ) { 21329 while ( ( name = attrNames[ i++ ] ) ) { 21330 propName = jQuery.propFix[ name ] || name; 21331 21332 // Boolean attributes get special treatment (#10870) 21333 if ( jQuery.expr.match.bool.test( name ) ) { 21334 21335 // Set corresponding property to false 21336 elem[ propName ] = false; 21337 } 21338 21339 elem.removeAttribute( name ); 21340 } 21341 } 21342 } 21343} ); 21344 21345// Hooks for boolean attributes 21346boolHook = { 21347 set: function( elem, value, name ) { 21348 if ( value === false ) { 21349 21350 // Remove boolean attributes when set to false 21351 jQuery.removeAttr( elem, name ); 21352 } else { 21353 elem.setAttribute( name, name ); 21354 } 21355 return name; 21356 } 21357}; 21358jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { 21359 var getter = attrHandle[ name ] || jQuery.find.attr; 21360 21361 attrHandle[ name ] = function( elem, name, isXML ) { 21362 var ret, handle; 21363 if ( !isXML ) { 21364 21365 // Avoid an infinite loop by temporarily removing this function from the getter 21366 handle = attrHandle[ name ]; 21367 attrHandle[ name ] = ret; 21368 ret = getter( elem, name, isXML ) != null ? 21369 name.toLowerCase() : 21370 null; 21371 attrHandle[ name ] = handle; 21372 } 21373 return ret; 21374 }; 21375} ); 21376 21377 21378 21379 21380var rfocusable = /^(?:input|select|textarea|button)$/i, 21381 rclickable = /^(?:a|area)$/i; 21382 21383jQuery.fn.extend( { 21384 prop: function( name, value ) { 21385 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 21386 }, 21387 21388 removeProp: function( name ) { 21389 return this.each( function() { 21390 delete this[ jQuery.propFix[ name ] || name ]; 21391 } ); 21392 } 21393} ); 21394 21395jQuery.extend( { 21396 prop: function( elem, name, value ) { 21397 var ret, hooks, 21398 nType = elem.nodeType; 21399 21400 // Don't get/set properties on text, comment and attribute nodes 21401 if ( nType === 3 || nType === 8 || nType === 2 ) { 21402 return; 21403 } 21404 21405 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 21406 21407 // Fix name and attach hooks 21408 name = jQuery.propFix[ name ] || name; 21409 hooks = jQuery.propHooks[ name ]; 21410 } 21411 21412 if ( value !== undefined ) { 21413 if ( hooks && "set" in hooks && 21414 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 21415 return ret; 21416 } 21417 21418 return ( elem[ name ] = value ); 21419 } 21420 21421 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 21422 return ret; 21423 } 21424 21425 return elem[ name ]; 21426 }, 21427 21428 propHooks: { 21429 tabIndex: { 21430 get: function( elem ) { 21431 21432 // elem.tabIndex doesn't always return the 21433 // correct value when it hasn't been explicitly set 21434 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 21435 // Use proper attribute retrieval(#12072) 21436 var tabindex = jQuery.find.attr( elem, "tabindex" ); 21437 21438 return tabindex ? 21439 parseInt( tabindex, 10 ) : 21440 rfocusable.test( elem.nodeName ) || 21441 rclickable.test( elem.nodeName ) && elem.href ? 21442 0 : 21443 -1; 21444 } 21445 } 21446 }, 21447 21448 propFix: { 21449 "for": "htmlFor", 21450 "class": "className" 21451 } 21452} ); 21453 21454// Support: IE <=11 only 21455// Accessing the selectedIndex property 21456// forces the browser to respect setting selected 21457// on the option 21458// The getter ensures a default option is selected 21459// when in an optgroup 21460if ( !support.optSelected ) { 21461 jQuery.propHooks.selected = { 21462 get: function( elem ) { 21463 var parent = elem.parentNode; 21464 if ( parent && parent.parentNode ) { 21465 parent.parentNode.selectedIndex; 21466 } 21467 return null; 21468 }, 21469 set: function( elem ) { 21470 var parent = elem.parentNode; 21471 if ( parent ) { 21472 parent.selectedIndex; 21473 21474 if ( parent.parentNode ) { 21475 parent.parentNode.selectedIndex; 21476 } 21477 } 21478 } 21479 }; 21480} 21481 21482jQuery.each( [ 21483 "tabIndex", 21484 "readOnly", 21485 "maxLength", 21486 "cellSpacing", 21487 "cellPadding", 21488 "rowSpan", 21489 "colSpan", 21490 "useMap", 21491 "frameBorder", 21492 "contentEditable" 21493], function() { 21494 jQuery.propFix[ this.toLowerCase() ] = this; 21495} ); 21496 21497 21498 21499 21500var rclass = /[\t\r\n\f]/g; 21501 21502function getClass( elem ) { 21503 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 21504} 21505 21506jQuery.fn.extend( { 21507 addClass: function( value ) { 21508 var classes, elem, cur, curValue, clazz, j, finalValue, 21509 i = 0; 21510 21511 if ( jQuery.isFunction( value ) ) { 21512 return this.each( function( j ) { 21513 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 21514 } ); 21515 } 21516 21517 if ( typeof value === "string" && value ) { 21518 classes = value.match( rnotwhite ) || []; 21519 21520 while ( ( elem = this[ i++ ] ) ) { 21521 curValue = getClass( elem ); 21522 cur = elem.nodeType === 1 && 21523 ( " " + curValue + " " ).replace( rclass, " " ); 21524 21525 if ( cur ) { 21526 j = 0; 21527 while ( ( clazz = classes[ j++ ] ) ) { 21528 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 21529 cur += clazz + " "; 21530 } 21531 } 21532 21533 // Only assign if different to avoid unneeded rendering. 21534 finalValue = jQuery.trim( cur ); 21535 if ( curValue !== finalValue ) { 21536 elem.setAttribute( "class", finalValue ); 21537 } 21538 } 21539 } 21540 } 21541 21542 return this; 21543 }, 21544 21545 removeClass: function( value ) { 21546 var classes, elem, cur, curValue, clazz, j, finalValue, 21547 i = 0; 21548 21549 if ( jQuery.isFunction( value ) ) { 21550 return this.each( function( j ) { 21551 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 21552 } ); 21553 } 21554 21555 if ( !arguments.length ) { 21556 return this.attr( "class", "" ); 21557 } 21558 21559 if ( typeof value === "string" && value ) { 21560 classes = value.match( rnotwhite ) || []; 21561 21562 while ( ( elem = this[ i++ ] ) ) { 21563 curValue = getClass( elem ); 21564 21565 // This expression is here for better compressibility (see addClass) 21566 cur = elem.nodeType === 1 && 21567 ( " " + curValue + " " ).replace( rclass, " " ); 21568 21569 if ( cur ) { 21570 j = 0; 21571 while ( ( clazz = classes[ j++ ] ) ) { 21572 21573 // Remove *all* instances 21574 while ( cur.indexOf( " " + clazz + " " ) > -1 ) { 21575 cur = cur.replace( " " + clazz + " ", " " ); 21576 } 21577 } 21578 21579 // Only assign if different to avoid unneeded rendering. 21580 finalValue = jQuery.trim( cur ); 21581 if ( curValue !== finalValue ) { 21582 elem.setAttribute( "class", finalValue ); 21583 } 21584 } 21585 } 21586 } 21587 21588 return this; 21589 }, 21590 21591 toggleClass: function( value, stateVal ) { 21592 var type = typeof value; 21593 21594 if ( typeof stateVal === "boolean" && type === "string" ) { 21595 return stateVal ? this.addClass( value ) : this.removeClass( value ); 21596 } 21597 21598 if ( jQuery.isFunction( value ) ) { 21599 return this.each( function( i ) { 21600 jQuery( this ).toggleClass( 21601 value.call( this, i, getClass( this ), stateVal ), 21602 stateVal 21603 ); 21604 } ); 21605 } 21606 21607 return this.each( function() { 21608 var className, i, self, classNames; 21609 21610 if ( type === "string" ) { 21611 21612 // Toggle individual class names 21613 i = 0; 21614 self = jQuery( this ); 21615 classNames = value.match( rnotwhite ) || []; 21616 21617 while ( ( className = classNames[ i++ ] ) ) { 21618 21619 // Check each className given, space separated list 21620 if ( self.hasClass( className ) ) { 21621 self.removeClass( className ); 21622 } else { 21623 self.addClass( className ); 21624 } 21625 } 21626 21627 // Toggle whole class name 21628 } else if ( value === undefined || type === "boolean" ) { 21629 className = getClass( this ); 21630 if ( className ) { 21631 21632 // Store className if set 21633 dataPriv.set( this, "__className__", className ); 21634 } 21635 21636 // If the element has a class name or if we're passed `false`, 21637 // then remove the whole classname (if there was one, the above saved it). 21638 // Otherwise bring back whatever was previously saved (if anything), 21639 // falling back to the empty string if nothing was stored. 21640 if ( this.setAttribute ) { 21641 this.setAttribute( "class", 21642 className || value === false ? 21643 "" : 21644 dataPriv.get( this, "__className__" ) || "" 21645 ); 21646 } 21647 } 21648 } ); 21649 }, 21650 21651 hasClass: function( selector ) { 21652 var className, elem, 21653 i = 0; 21654 21655 className = " " + selector + " "; 21656 while ( ( elem = this[ i++ ] ) ) { 21657 if ( elem.nodeType === 1 && 21658 ( " " + getClass( elem ) + " " ).replace( rclass, " " ) 21659 .indexOf( className ) > -1 21660 ) { 21661 return true; 21662 } 21663 } 21664 21665 return false; 21666 } 21667} ); 21668 21669 21670 21671 21672var rreturn = /\r/g, 21673 rspaces = /[\x20\t\r\n\f]+/g; 21674 21675jQuery.fn.extend( { 21676 val: function( value ) { 21677 var hooks, ret, isFunction, 21678 elem = this[ 0 ]; 21679 21680 if ( !arguments.length ) { 21681 if ( elem ) { 21682 hooks = jQuery.valHooks[ elem.type ] || 21683 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 21684 21685 if ( hooks && 21686 "get" in hooks && 21687 ( ret = hooks.get( elem, "value" ) ) !== undefined 21688 ) { 21689 return ret; 21690 } 21691 21692 ret = elem.value; 21693 21694 return typeof ret === "string" ? 21695 21696 // Handle most common string cases 21697 ret.replace( rreturn, "" ) : 21698 21699 // Handle cases where value is null/undef or number 21700 ret == null ? "" : ret; 21701 } 21702 21703 return; 21704 } 21705 21706 isFunction = jQuery.isFunction( value ); 21707 21708 return this.each( function( i ) { 21709 var val; 21710 21711 if ( this.nodeType !== 1 ) { 21712 return; 21713 } 21714 21715 if ( isFunction ) { 21716 val = value.call( this, i, jQuery( this ).val() ); 21717 } else { 21718 val = value; 21719 } 21720 21721 // Treat null/undefined as ""; convert numbers to string 21722 if ( val == null ) { 21723 val = ""; 21724 21725 } else if ( typeof val === "number" ) { 21726 val += ""; 21727 21728 } else if ( jQuery.isArray( val ) ) { 21729 val = jQuery.map( val, function( value ) { 21730 return value == null ? "" : value + ""; 21731 } ); 21732 } 21733 21734 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 21735 21736 // If set returns undefined, fall back to normal setting 21737 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 21738 this.value = val; 21739 } 21740 } ); 21741 } 21742} ); 21743 21744jQuery.extend( { 21745 valHooks: { 21746 option: { 21747 get: function( elem ) { 21748 21749 var val = jQuery.find.attr( elem, "value" ); 21750 return val != null ? 21751 val : 21752 21753 // Support: IE10-11+ 21754 // option.text throws exceptions (#14686, #14858) 21755 // Strip and collapse whitespace 21756 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 21757 jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " ); 21758 } 21759 }, 21760 select: { 21761 get: function( elem ) { 21762 var value, option, 21763 options = elem.options, 21764 index = elem.selectedIndex, 21765 one = elem.type === "select-one" || index < 0, 21766 values = one ? null : [], 21767 max = one ? index + 1 : options.length, 21768 i = index < 0 ? 21769 max : 21770 one ? index : 0; 21771 21772 // Loop through all the selected options 21773 for ( ; i < max; i++ ) { 21774 option = options[ i ]; 21775 21776 // IE8-9 doesn't update selected after form reset (#2551) 21777 if ( ( option.selected || i === index ) && 21778 21779 // Don't return options that are disabled or in a disabled optgroup 21780 ( support.optDisabled ? 21781 !option.disabled : option.getAttribute( "disabled" ) === null ) && 21782 ( !option.parentNode.disabled || 21783 !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { 21784 21785 // Get the specific value for the option 21786 value = jQuery( option ).val(); 21787 21788 // We don't need an array for one selects 21789 if ( one ) { 21790 return value; 21791 } 21792 21793 // Multi-Selects return an array 21794 values.push( value ); 21795 } 21796 } 21797 21798 return values; 21799 }, 21800 21801 set: function( elem, value ) { 21802 var optionSet, option, 21803 options = elem.options, 21804 values = jQuery.makeArray( value ), 21805 i = options.length; 21806 21807 while ( i-- ) { 21808 option = options[ i ]; 21809 if ( option.selected = 21810 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 21811 ) { 21812 optionSet = true; 21813 } 21814 } 21815 21816 // Force browsers to behave consistently when non-matching value is set 21817 if ( !optionSet ) { 21818 elem.selectedIndex = -1; 21819 } 21820 return values; 21821 } 21822 } 21823 } 21824} ); 21825 21826// Radios and checkboxes getter/setter 21827jQuery.each( [ "radio", "checkbox" ], function() { 21828 jQuery.valHooks[ this ] = { 21829 set: function( elem, value ) { 21830 if ( jQuery.isArray( value ) ) { 21831 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 21832 } 21833 } 21834 }; 21835 if ( !support.checkOn ) { 21836 jQuery.valHooks[ this ].get = function( elem ) { 21837 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 21838 }; 21839 } 21840} ); 21841 21842 21843 21844 21845// Return jQuery for attributes-only inclusion 21846 21847 21848var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; 21849 21850jQuery.extend( jQuery.event, { 21851 21852 trigger: function( event, data, elem, onlyHandlers ) { 21853 21854 var i, cur, tmp, bubbleType, ontype, handle, special, 21855 eventPath = [ elem || document ], 21856 type = hasOwn.call( event, "type" ) ? event.type : event, 21857 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 21858 21859 cur = tmp = elem = elem || document; 21860 21861 // Don't do events on text and comment nodes 21862 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 21863 return; 21864 } 21865 21866 // focus/blur morphs to focusin/out; ensure we're not firing them right now 21867 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 21868 return; 21869 } 21870 21871 if ( type.indexOf( "." ) > -1 ) { 21872 21873 // Namespaced trigger; create a regexp to match event type in handle() 21874 namespaces = type.split( "." ); 21875 type = namespaces.shift(); 21876 namespaces.sort(); 21877 } 21878 ontype = type.indexOf( ":" ) < 0 && "on" + type; 21879 21880 // Caller can pass in a jQuery.Event object, Object, or just an event type string 21881 event = event[ jQuery.expando ] ? 21882 event : 21883 new jQuery.Event( type, typeof event === "object" && event ); 21884 21885 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 21886 event.isTrigger = onlyHandlers ? 2 : 3; 21887 event.namespace = namespaces.join( "." ); 21888 event.rnamespace = event.namespace ? 21889 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 21890 null; 21891 21892 // Clean up the event in case it is being reused 21893 event.result = undefined; 21894 if ( !event.target ) { 21895 event.target = elem; 21896 } 21897 21898 // Clone any incoming data and prepend the event, creating the handler arg list 21899 data = data == null ? 21900 [ event ] : 21901 jQuery.makeArray( data, [ event ] ); 21902 21903 // Allow special events to draw outside the lines 21904 special = jQuery.event.special[ type ] || {}; 21905 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 21906 return; 21907 } 21908 21909 // Determine event propagation path in advance, per W3C events spec (#9951) 21910 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 21911 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { 21912 21913 bubbleType = special.delegateType || type; 21914 if ( !rfocusMorph.test( bubbleType + type ) ) { 21915 cur = cur.parentNode; 21916 } 21917 for ( ; cur; cur = cur.parentNode ) { 21918 eventPath.push( cur ); 21919 tmp = cur; 21920 } 21921 21922 // Only add window if we got to document (e.g., not plain obj or detached DOM) 21923 if ( tmp === ( elem.ownerDocument || document ) ) { 21924 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 21925 } 21926 } 21927 21928 // Fire handlers on the event path 21929 i = 0; 21930 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 21931 21932 event.type = i > 1 ? 21933 bubbleType : 21934 special.bindType || type; 21935 21936 // jQuery handler 21937 handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && 21938 dataPriv.get( cur, "handle" ); 21939 if ( handle ) { 21940 handle.apply( cur, data ); 21941 } 21942 21943 // Native handler 21944 handle = ontype && cur[ ontype ]; 21945 if ( handle && handle.apply && acceptData( cur ) ) { 21946 event.result = handle.apply( cur, data ); 21947 if ( event.result === false ) { 21948 event.preventDefault(); 21949 } 21950 } 21951 } 21952 event.type = type; 21953 21954 // If nobody prevented the default action, do it now 21955 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 21956 21957 if ( ( !special._default || 21958 special._default.apply( eventPath.pop(), data ) === false ) && 21959 acceptData( elem ) ) { 21960 21961 // Call a native DOM method on the target with the same name name as the event. 21962 // Don't do default actions on window, that's where global variables be (#6170) 21963 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { 21964 21965 // Don't re-trigger an onFOO event when we call its FOO() method 21966 tmp = elem[ ontype ]; 21967 21968 if ( tmp ) { 21969 elem[ ontype ] = null; 21970 } 21971 21972 // Prevent re-triggering of the same event, since we already bubbled it above 21973 jQuery.event.triggered = type; 21974 elem[ type ](); 21975 jQuery.event.triggered = undefined; 21976 21977 if ( tmp ) { 21978 elem[ ontype ] = tmp; 21979 } 21980 } 21981 } 21982 } 21983 21984 return event.result; 21985 }, 21986 21987 // Piggyback on a donor event to simulate a different one 21988 // Used only for `focus(in | out)` events 21989 simulate: function( type, elem, event ) { 21990 var e = jQuery.extend( 21991 new jQuery.Event(), 21992 event, 21993 { 21994 type: type, 21995 isSimulated: true 21996 } 21997 ); 21998 21999 jQuery.event.trigger( e, null, elem ); 22000 } 22001 22002} ); 22003 22004jQuery.fn.extend( { 22005 22006 trigger: function( type, data ) { 22007 return this.each( function() { 22008 jQuery.event.trigger( type, data, this ); 22009 } ); 22010 }, 22011 triggerHandler: function( type, data ) { 22012 var elem = this[ 0 ]; 22013 if ( elem ) { 22014 return jQuery.event.trigger( type, data, elem, true ); 22015 } 22016 } 22017} ); 22018 22019 22020jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " + 22021 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 22022 "change select submit keydown keypress keyup error contextmenu" ).split( " " ), 22023 function( i, name ) { 22024 22025 // Handle event binding 22026 jQuery.fn[ name ] = function( data, fn ) { 22027 return arguments.length > 0 ? 22028 this.on( name, null, data, fn ) : 22029 this.trigger( name ); 22030 }; 22031} ); 22032 22033jQuery.fn.extend( { 22034 hover: function( fnOver, fnOut ) { 22035 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 22036 } 22037} ); 22038 22039 22040 22041 22042support.focusin = "onfocusin" in window; 22043 22044 22045// Support: Firefox 22046// Firefox doesn't have focus(in | out) events
22047// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 22048// 22049// Support: Chrome, Safari 22050// focus(in | out) events fire after focus & blur events, 22051// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 22052// Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857 22053if ( !support.focusin ) { 22054 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 22055 22056 // Attach a single capturing handler on the document while someone wants focusin/focusout 22057 var handler = function( event ) { 22058 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 22059 }; 22060 22061 jQuery.event.special[ fix ] = { 22062 setup: function() { 22063 var doc = this.ownerDocument || this, 22064 attaches = dataPriv.access( doc, fix ); 22065 22066 if ( !attaches ) { 22067 doc.addEventListener( orig, handler, true ); 22068 } 22069 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); 22070 }, 22071 teardown: function() { 22072 var doc = this.ownerDocument || this, 22073 attaches = dataPriv.access( doc, fix ) - 1; 22074 22075 if ( !attaches ) { 22076 doc.removeEventListener( orig, handler, true ); 22077 dataPriv.remove( doc, fix ); 22078 22079 } else { 22080 dataPriv.access( doc, fix, attaches ); 22081 } 22082 } 22083 }; 22084 } ); 22085} 22086var location = window.location; 22087 22088var nonce = jQuery.now(); 22089 22090var rquery = ( /\?/ ); 22091 22092 22093 22094// Support: Android 2.3 22095// Workaround failure to string-cast null input 22096jQuery.parseJSON = function( data ) { 22097 return JSON.parse( data + "" ); 22098}; 22099 22100 22101// Cross-browser xml parsing 22102jQuery.parseXML = function( data ) { 22103 var xml; 22104 if ( !data || typeof data !== "string" ) { 22105 return null; 22106 } 22107 22108 // Support: IE9 22109 try { 22110 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 22111 } catch ( e ) { 22112 xml = undefined; 22113 } 22114 22115 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { 22116 jQuery.error( "Invalid XML: " + data ); 22117 } 22118 return xml; 22119}; 22120 22121 22122var 22123 rhash = /#.*$/, 22124 rts = /([?&])_=[^&]*/, 22125 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 22126 22127 // #7653, #8125, #8152: local protocol detection 22128 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 22129 rnoContent = /^(?:GET|HEAD)$/, 22130 rprotocol = /^\/\//, 22131 22132 /* Prefilters 22133 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 22134 * 2) These are called: 22135 * - BEFORE asking for a transport 22136 * - AFTER param serialization (s.data is a string if s.processData is true) 22137 * 3) key is the dataType 22138 * 4) the catchall symbol "*" can be used 22139 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 22140 */ 22141 prefilters = {}, 22142 22143 /* Transports bindings 22144 * 1) key is the dataType 22145 * 2) the catchall symbol "*" can be used 22146 * 3) selection will start with transport dataType and THEN go to "*" if needed 22147 */ 22148 transports = {}, 22149 22150 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 22151 allTypes = "*/".concat( "*" ), 22152 22153 // Anchor tag for parsing the document origin 22154 originAnchor = document.createElement( "a" ); 22155 originAnchor.href = location.href; 22156 22157// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 22158function addToPrefiltersOrTransports( structure ) { 22159 22160 // dataTypeExpression is optional and defaults to "*" 22161 return function( dataTypeExpression, func ) { 22162 22163 if ( typeof dataTypeExpression !== "string" ) { 22164 func = dataTypeExpression; 22165 dataTypeExpression = "*"; 22166 } 22167 22168 var dataType, 22169 i = 0, 22170 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; 22171 22172 if ( jQuery.isFunction( func ) ) { 22173 22174 // For each dataType in the dataTypeExpression 22175 while ( ( dataType = dataTypes[ i++ ] ) ) { 22176 22177 // Prepend if requested 22178 if ( dataType[ 0 ] === "+" ) { 22179 dataType = dataType.slice( 1 ) || "*"; 22180 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 22181 22182 // Otherwise append 22183 } else { 22184 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 22185 } 22186 } 22187 } 22188 }; 22189} 22190 22191// Base inspection function for prefilters and transports 22192function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 22193 22194 var inspected = {}, 22195 seekingTransport = ( structure === transports ); 22196 22197 function inspect( dataType ) { 22198 var selected; 22199 inspected[ dataType ] = true; 22200 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 22201 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 22202 if ( typeof dataTypeOrTransport === "string" && 22203 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 22204 22205 options.dataTypes.unshift( dataTypeOrTransport ); 22206 inspect( dataTypeOrTransport ); 22207 return false;
vendor: 5,117 bytes, lines 22208-22418
22208 } else if ( seekingTransport ) { 22209 return !( selected = dataTypeOrTransport ); 22210 } 22211 } ); 22212 return selected; 22213 } 22214 22215 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 22216} 22217 22218// A special extend for ajax options 22219// that takes "flat" options (not to be deep extended) 22220// Fixes #9887 22221function ajaxExtend( target, src ) { 22222 var key, deep, 22223 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 22224 22225 for ( key in src ) { 22226 if ( src[ key ] !== undefined ) { 22227 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 22228 } 22229 } 22230 if ( deep ) { 22231 jQuery.extend( true, target, deep ); 22232 } 22233 22234 return target; 22235} 22236 22237/* Handles responses to an ajax request: 22238 * - finds the right dataType (mediates between content-type and expected dataType) 22239 * - returns the corresponding response 22240 */ 22241function ajaxHandleResponses( s, jqXHR, responses ) { 22242 22243 var ct, type, finalDataType, firstDataType, 22244 contents = s.contents, 22245 dataTypes = s.dataTypes; 22246 22247 // Remove auto dataType and get content-type in the process 22248 while ( dataTypes[ 0 ] === "*" ) { 22249 dataTypes.shift(); 22250 if ( ct === undefined ) { 22251 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 22252 } 22253 } 22254 22255 // Check if we're dealing with a known content-type 22256 if ( ct ) { 22257 for ( type in contents ) { 22258 if ( contents[ type ] && contents[ type ].test( ct ) ) { 22259 dataTypes.unshift( type ); 22260 break; 22261 } 22262 } 22263 } 22264 22265 // Check to see if we have a response for the expected dataType 22266 if ( dataTypes[ 0 ] in responses ) { 22267 finalDataType = dataTypes[ 0 ]; 22268 } else { 22269 22270 // Try convertible dataTypes 22271 for ( type in responses ) { 22272 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 22273 finalDataType = type; 22274 break; 22275 } 22276 if ( !firstDataType ) { 22277 firstDataType = type; 22278 } 22279 } 22280 22281 // Or just use first one 22282 finalDataType = finalDataType || firstDataType; 22283 } 22284 22285 // If we found a dataType 22286 // We add the dataType to the list if needed 22287 // and return the corresponding response 22288 if ( finalDataType ) { 22289 if ( finalDataType !== dataTypes[ 0 ] ) { 22290 dataTypes.unshift( finalDataType ); 22291 } 22292 return responses[ finalDataType ]; 22293 } 22294} 22295 22296/* Chain conversions given the request and the original response 22297 * Also sets the responseXXX fields on the jqXHR instance 22298 */ 22299function ajaxConvert( s, response, jqXHR, isSuccess ) { 22300 var conv2, current, conv, tmp, prev, 22301 converters = {}, 22302 22303 // Work with a copy of dataTypes in case we need to modify it for conversion 22304 dataTypes = s.dataTypes.slice(); 22305 22306 // Create converters map with lowercased keys 22307 if ( dataTypes[ 1 ] ) { 22308 for ( conv in s.converters ) { 22309 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 22310 } 22311 } 22312 22313 current = dataTypes.shift(); 22314 22315 // Convert to each sequential dataType 22316 while ( current ) { 22317 22318 if ( s.responseFields[ current ] ) { 22319 jqXHR[ s.responseFields[ current ] ] = response; 22320 } 22321 22322 // Apply the dataFilter if provided 22323 if ( !prev && isSuccess && s.dataFilter ) { 22324 response = s.dataFilter( response, s.dataType ); 22325 } 22326 22327 prev = current; 22328 current = dataTypes.shift(); 22329 22330 if ( current ) { 22331 22332 // There's only work to do if current dataType is non-auto 22333 if ( current === "*" ) { 22334 22335 current = prev; 22336 22337 // Convert response if prev dataType is non-auto and differs from current 22338 } else if ( prev !== "*" && prev !== current ) { 22339 22340 // Seek a direct converter 22341 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 22342 22343 // If none found, seek a pair 22344 if ( !conv ) { 22345 for ( conv2 in converters ) { 22346 22347 // If conv2 outputs current 22348 tmp = conv2.split( " " ); 22349 if ( tmp[ 1 ] === current ) { 22350 22351 // If prev can be converted to accepted input 22352 conv = converters[ prev + " " + tmp[ 0 ] ] || 22353 converters[ "* " + tmp[ 0 ] ]; 22354 if ( conv ) { 22355 22356 // Condense equivalence converters 22357 if ( conv === true ) { 22358 conv = converters[ conv2 ]; 22359 22360 // Otherwise, insert the intermediate dataType 22361 } else if ( converters[ conv2 ] !== true ) { 22362 current = tmp[ 0 ]; 22363 dataTypes.unshift( tmp[ 1 ] ); 22364 } 22365 break; 22366 } 22367 } 22368 } 22369 } 22370 22371 // Apply converter (if not an equivalence) 22372 if ( conv !== true ) { 22373 22374 // Unless errors are allowed to bubble, catch and return them 22375 if ( conv && s.throws ) { 22376 response = conv( response ); 22377 } else { 22378 try { 22379 response = conv( response ); 22380 } catch ( e ) { 22381 return { 22382 state: "parsererror", 22383 error: conv ? e : "No conversion from " + prev + " to " + current 22384 }; 22385 } 22386 } 22387 } 22388 } 22389 } 22390 } 22391 22392 return { state: "success", data: response }; 22393} 22394 22395jQuery.extend( { 22396 22397 // Counter for holding the number of active queries 22398 active: 0, 22399 22400 // Last-Modified header cache for next request 22401 lastModified: {}, 22402 etag: {}, 22403 22404 ajaxSettings: { 22405 url: location.href, 22406 type: "GET", 22407 isLocal: rlocalProtocol.test( location.protocol ), 22408 global: true, 22409 processData: true, 22410 async: true, 22411 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 22412 /* 22413 timeout: 0, 22414 data: null, 22415 dataType: null, 22416 username: null, 22417 password: null, 22418 cache: null,
22419 throws: false, 22420 traditional: false, 22421 headers: {}, 22422 */ 22423 22424 accepts: { 22425 "*": allTypes, 22426 text: "text/plain", 22427 html: "text/html", 22428 xml: "application/xml, text/xml", 22429 json: "application/json, text/javascript" 22430 }, 22431 22432 contents: { 22433 xml: /\bxml\b/, 22434 html: /\bhtml/, 22435 json: /\bjson\b/ 22436 }, 22437 22438 responseFields: { 22439 xml: "responseXML", 22440 text: "responseText", 22441 json: "responseJSON" 22442 }, 22443 22444 // Data converters 22445 // Keys separate source (or catchall "*") and destination types with a single space 22446 converters: { 22447 22448 // Convert anything to text 22449 "* text": String, 22450 22451 // Text to html (true = no transformation) 22452 "text html": true, 22453 22454 // Evaluate text as a json expression 22455 "text json": jQuery.parseJSON, 22456 22457 // Parse text as xml 22458 "text xml": jQuery.parseXML 22459 }, 22460 22461 // For options that shouldn't be deep extended: 22462 // you can add your own custom options here if 22463 // and when you create one that shouldn't be 22464 // deep extended (see ajaxExtend) 22465 flatOptions: { 22466 url: true, 22467 context: true 22468 } 22469 }, 22470 22471 // Creates a full fledged settings object into target 22472 // with both ajaxSettings and settings fields. 22473 // If target is omitted, writes into ajaxSettings. 22474 ajaxSetup: function( target, settings ) { 22475 return settings ? 22476 22477 // Building a settings object 22478 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 22479 22480 // Extending ajaxSettings 22481 ajaxExtend( jQuery.ajaxSettings, target ); 22482 }, 22483 22484 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 22485 ajaxTransport: addToPrefiltersOrTransports( transports ), 22486 22487 // Main method 22488 ajax: function( url, options ) { 22489 22490 // If url is an object, simulate pre-1.5 signature 22491 if ( typeof url === "object" ) { 22492 options = url; 22493 url = undefined; 22494 } 22495 22496 // Force options to be an object 22497 options = options || {}; 22498 22499 var transport, 22500 22501 // URL without anti-cache param 22502 cacheURL, 22503 22504 // Response headers 22505 responseHeadersString, 22506 responseHeaders, 22507 22508 // timeout handle 22509 timeoutTimer, 22510 22511 // Url cleanup var 22512 urlAnchor, 22513 22514 // To know if global events are to be dispatched 22515 fireGlobals, 22516 22517 // Loop variable 22518 i, 22519 22520 // Create the final options object 22521 s = jQuery.ajaxSetup( {}, options ), 22522 22523 // Callbacks context 22524 callbackContext = s.context || s, 22525 22526 // Context for global events is callbackContext if it is a DOM node or jQuery collection 22527 globalEventContext = s.context && 22528 ( callbackContext.nodeType || callbackContext.jquery ) ? 22529 jQuery( callbackContext ) : 22530 jQuery.event, 22531 22532 // Deferreds 22533 deferred = jQuery.Deferred(), 22534 completeDeferred = jQuery.Callbacks( "once memory" ), 22535 22536 // Status-dependent callbacks 22537 statusCode = s.statusCode || {}, 22538 22539 // Headers (they are sent all at once) 22540 requestHeaders = {}, 22541 requestHeadersNames = {}, 22542 22543 // The jqXHR state 22544 state = 0, 22545 22546 // Default abort message 22547 strAbort = "canceled", 22548 22549 // Fake xhr 22550 jqXHR = { 22551 readyState: 0, 22552 22553 // Builds headers hashtable if needed 22554 getResponseHeader: function( key ) { 22555 var match; 22556 if ( state === 2 ) { 22557 if ( !responseHeaders ) { 22558 responseHeaders = {}; 22559 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 22560 responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; 22561 } 22562 } 22563 match = responseHeaders[ key.toLowerCase() ]; 22564 } 22565 return match == null ? null : match; 22566 }, 22567 22568 // Raw string 22569 getAllResponseHeaders: function() { 22570 return state === 2 ? responseHeadersString : null; 22571 }, 22572 22573 // Caches the header 22574 setRequestHeader: function( name, value ) { 22575 var lname = name.toLowerCase(); 22576 if ( !state ) { 22577 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; 22578 requestHeaders[ name ] = value; 22579 } 22580 return this; 22581 }, 22582 22583 // Overrides response content-type header 22584 overrideMimeType: function( type ) { 22585 if ( !state ) { 22586 s.mimeType = type; 22587 } 22588 return this; 22589 }, 22590 22591 // Status-dependent callbacks 22592 statusCode: function( map ) { 22593 var code; 22594 if ( map ) { 22595 if ( state < 2 ) { 22596 for ( code in map ) { 22597 22598 // Lazy-add the new callback in a way that preserves old ones 22599 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 22600 } 22601 } else { 22602 22603 // Execute the appropriate callbacks 22604 jqXHR.always( map[ jqXHR.status ] ); 22605 } 22606 } 22607 return this; 22608 }, 22609 22610 // Cancel the request 22611 abort: function( statusText ) { 22612 var finalText = statusText || strAbort; 22613 if ( transport ) { 22614 transport.abort( finalText ); 22615 } 22616 done( 0, finalText ); 22617 return this; 22618 } 22619 }; 22620 22621 // Attach deferreds 22622 deferred.promise( jqXHR ).complete = completeDeferred.add; 22623 jqXHR.success = jqXHR.done; 22624 jqXHR.error = jqXHR.fail; 22625 22626 // Remove hash character (#7531: and string promotion) 22627 // Add protocol if not provided (prefilters might expect it) 22628 // Handle falsy url in the settings object (#10093: consistency with old signature) 22629 // We also use the url parameter if available 22630 s.url = ( ( url || s.url || location.href ) + "" ).replace( rhash, "" ) 22631 .replace( rprotocol, location.protocol + "//" ); 22632 22633 // Alias method option to type as per ticket #12004 22634 s.type = options.method || options.type || s.method || s.type; 22635 22636 // Extract dataTypes list 22637 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; 22638 22639 // A cross-domain request is in order when the origin doesn't match the current origin. 22640 if ( s.crossDomain == null ) { 22641 urlAnchor = document.createElement( "a" ); 22642
22643 // Support: IE8-11+ 22644 // IE throws exception if url is malformed, e.g. http://example.com:80x/ 22645 try { 22646 urlAnchor.href = s.url; 22647 22648 // Support: IE8-11+ 22649 // Anchor's host property isn't correctly set when s.url is relative 22650 urlAnchor.href = urlAnchor.href; 22651 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 22652 urlAnchor.protocol + "//" + urlAnchor.host; 22653 } catch ( e ) { 22654 22655 // If there is an error parsing the URL, assume it is crossDomain, 22656 // it can be rejected by the transport if it is invalid 22657 s.crossDomain = true; 22658 } 22659 } 22660 22661 // Convert data if not already a string 22662 if ( s.data && s.processData && typeof s.data !== "string" ) { 22663 s.data = jQuery.param( s.data, s.traditional ); 22664 } 22665 22666 // Apply prefilters 22667 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 22668 22669 // If request was aborted inside a prefilter, stop there 22670 if ( state === 2 ) { 22671 return jqXHR; 22672 } 22673 22674 // We can fire global events as of now if asked to 22675 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 22676 fireGlobals = jQuery.event && s.global; 22677 22678 // Watch for a new set of requests 22679 if ( fireGlobals && jQuery.active++ === 0 ) { 22680 jQuery.event.trigger( "ajaxStart" ); 22681 } 22682 22683 // Uppercase the type 22684 s.type = s.type.toUpperCase(); 22685 22686 // Determine if request has content 22687 s.hasContent = !rnoContent.test( s.type ); 22688 22689 // Save the URL in case we're toying with the If-Modified-Since 22690 // and/or If-None-Match header later on 22691 cacheURL = s.url; 22692 22693 // More options handling for requests with no content 22694 if ( !s.hasContent ) { 22695 22696 // If data is available, append data to url 22697 if ( s.data ) { 22698 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); 22699 22700 // #9682: remove data so that it's not used in an eventual retry 22701 delete s.data; 22702 } 22703 22704 // Add anti-cache in url if needed 22705 if ( s.cache === false ) { 22706 s.url = rts.test( cacheURL ) ? 22707 22708 // If there is already a '_' parameter, set its value 22709 cacheURL.replace( rts, "$1_=" + nonce++ ) : 22710 22711 // Otherwise add one to the end 22712 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++; 22713 } 22714 } 22715 22716 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 22717 if ( s.ifModified ) { 22718 if ( jQuery.lastModified[ cacheURL ] ) { 22719 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 22720 } 22721 if ( jQuery.etag[ cacheURL ] ) { 22722 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 22723 } 22724 } 22725 22726 // Set the correct header, if data is being sent 22727 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 22728 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 22729 } 22730 22731 // Set the Accepts header for the server, depending on the dataType 22732 jqXHR.setRequestHeader( 22733 "Accept", 22734 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 22735 s.accepts[ s.dataTypes[ 0 ] ] + 22736 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 22737 s.accepts[ "*" ] 22738 ); 22739 22740 // Check for headers option 22741 for ( i in s.headers ) { 22742 jqXHR.setRequestHeader( i, s.headers[ i ] ); 22743 } 22744 22745 // Allow custom headers/mimetypes and early abort 22746 if ( s.beforeSend && 22747 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { 22748 22749 // Abort if not done already and return 22750 return jqXHR.abort(); 22751 } 22752 22753 // Aborting is no longer a cancellation 22754 strAbort = "abort"; 22755 22756 // Install callbacks on deferreds 22757 for ( i in { success: 1, error: 1, complete: 1 } ) { 22758 jqXHR[ i ]( s[ i ] ); 22759 } 22760 22761 // Get transport 22762 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 22763 22764 // If no transport, we auto-abort 22765 if ( !transport ) { 22766 done( -1, "No Transport" ); 22767 } else { 22768 jqXHR.readyState = 1; 22769 22770 // Send global event 22771 if ( fireGlobals ) { 22772 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 22773 } 22774 22775 // If request was aborted inside ajaxSend, stop there 22776 if ( state === 2 ) { 22777 return jqXHR; 22778 } 22779 22780 // Timeout 22781 if ( s.async && s.timeout > 0 ) { 22782 timeoutTimer = window.setTimeout( function() { 22783 jqXHR.abort( "timeout" ); 22784 }, s.timeout ); 22785 } 22786 22787 try { 22788 state = 1; 22789 transport.send( requestHeaders, done ); 22790 } catch ( e ) { 22791 22792 // Propagate exception as error if not done 22793 if ( state < 2 ) { 22794 done( -1, e ); 22795 22796 // Simply rethrow otherwise 22797 } else { 22798 throw e; 22799 } 22800 } 22801 } 22802 22803 // Callback for when everything is done 22804 function done( status, nativeStatusText, responses, headers ) { 22805 var isSuccess, success, error, response, modified, 22806 statusText = nativeStatusText; 22807 22808 // Called once 22809 if ( state === 2 ) { 22810 return; 22811 } 22812 22813 // State is "done" now 22814 state = 2; 22815 22816 // Clear timeout if it exists 22817 if ( timeoutTimer ) { 22818 window.clearTimeout( timeoutTimer ); 22819 } 22820 22821 // Dereference transport for early garbage collection 22822 // (no matter how long the jqXHR object will be used) 22823 transport = undefined; 22824 22825 // Cache response headers 22826 responseHeadersString = headers || ""; 22827 22828 // Set readyState 22829 jqXHR.readyState = status > 0 ? 4 : 0; 22830 22831 // Determine if successful 22832 isSuccess = status >= 200 && status < 300 || status === 304; 22833 22834 // Get response data 22835 if ( responses ) { 22836 response = ajaxHandleResponses( s, jqXHR, responses ); 22837 } 22838 22839 // Convert no matter what (that way responseXXX fields are always set) 22840 response = ajaxConvert( s, response, jqXHR, isSuccess ); 22841 22842 // If successful, handle type chaining 22843 if ( isSuccess ) { 22844 22845 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 22846 if ( s.ifModified ) { 22847 modified = jqXHR.getResponseHeader( "Last-Modified" ); 22848 if ( modified ) { 22849 jQuery.lastModified[ cacheURL ] = modified; 22850 } 22851 modified = jqXHR.getResponseHeader( "etag" ); 22852 if ( modified ) { 22853 jQuery.etag[ cacheURL ] = modified; 22854 } 22855 } 22856 22857 // if no content 22858 if ( status === 204 || s.type === "HEAD" ) { 22859 statusText = "nocontent"; 22860 22861 // if not modified 22862 } else if ( status === 304 ) { 22863 statusText = "notmodified"; 22864 22865 // If we have data, let's convert it 22866 } else { 22867 statusText = response.state; 22868 success = response.data; 22869 error = response.error; 22870 isSuccess = !error; 22871 } 22872 } else { 22873 22874 // Extract error from statusText and normalize for non-aborts 22875 error = statusText; 22876 if ( status || !statusText ) { 22877 statusText = "error"; 22878 if ( status < 0 ) { 22879 status = 0; 22880 } 22881 } 22882 } 22883 22884 // Set data for the fake xhr object 22885 jqXHR.status = status; 22886 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 22887 22888 // Success/Error 22889 if ( isSuccess ) { 22890 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 22891 } else { 22892 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 22893 } 22894 22895 // Status-dependent callbacks 22896 jqXHR.statusCode( statusCode ); 22897 statusCode = undefined; 22898 22899 if ( fireGlobals ) { 22900 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 22901 [ jqXHR, s, isSuccess ? success : error ] ); 22902 } 22903 22904 // Complete 22905 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 22906 22907 if ( fireGlobals ) { 22908 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 22909 22910 // Handle the global AJAX counter 22911 if ( !( --jQuery.active ) ) { 22912 jQuery.event.trigger( "ajaxStop" ); 22913 } 22914 } 22915 } 22916 22917 return jqXHR; 22918 }, 22919 22920 getJSON: function( url, data, callback ) { 22921 return jQuery.get( url, data, callback, "json" ); 22922 }, 22923 22924 getScript: function( url, callback ) { 22925 return jQuery.get( url, undefined, callback, "script" ); 22926 } 22927} ); 22928 22929jQuery.each( [ "get", "post" ], function( i, method ) { 22930 jQuery[ method ] = function( url, data, callback, type ) { 22931 22932 // Shift arguments if data argument was omitted 22933 if ( jQuery.isFunction( data ) ) { 22934 type = type || callback; 22935 callback = data; 22936 data = undefined; 22937 } 22938 22939 // The url can be an options object (which then must have .url) 22940 return jQuery.ajax( jQuery.extend( { 22941 url: url, 22942 type: method, 22943 dataType: type, 22944 data: data, 22945 success: callback 22946 }, jQuery.isPlainObject( url ) && url ) ); 22947 }; 22948} ); 22949 22950 22951jQuery._evalUrl = function( url ) { 22952 return jQuery.ajax( { 22953 url: url, 22954 22955 // Make this explicit, since user can override this through ajaxSetup (#11264) 22956 type: "GET", 22957 dataType: "script", 22958 async: false, 22959 global: false, 22960 "throws": true 22961 } ); 22962}; 22963 22964 22965jQuery.fn.extend( { 22966 wrapAll: function( html ) { 22967 var wrap; 22968 22969 if ( jQuery.isFunction( html ) ) { 22970 return this.each( function( i ) { 22971 jQuery( this ).wrapAll( html.call( this, i ) ); 22972 } ); 22973 } 22974 22975 if ( this[ 0 ] ) { 22976 22977 // The elements to wrap the target around 22978 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 22979 22980 if ( this[ 0 ].parentNode ) { 22981 wrap.insertBefore( this[ 0 ] ); 22982 } 22983 22984 wrap.map( function() { 22985 var elem = this; 22986 22987 while ( elem.firstElementChild ) { 22988 elem = elem.firstElementChild; 22989 } 22990 22991 return elem; 22992 } ).append( this ); 22993 } 22994 22995 return this; 22996 }, 22997 22998 wrapInner: function( html ) { 22999 if ( jQuery.isFunction( html ) ) { 23000 return this.each( function( i ) { 23001 jQuery( this ).wrapInner( html.call( this, i ) ); 23002 } ); 23003 } 23004 23005 return this.each( function() { 23006 var self = jQuery( this ), 23007 contents = self.contents(); 23008 23009 if ( contents.length ) { 23010 contents.wrapAll( html ); 23011 23012 } else { 23013 self.append( html ); 23014 } 23015 } ); 23016 }, 23017 23018 wrap: function( html ) { 23019 var isFunction = jQuery.isFunction( html ); 23020 23021 return this.each( function( i ) { 23022 jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); 23023 } ); 23024 }, 23025 23026 unwrap: function() { 23027 return this.parent().each( function() { 23028 if ( !jQuery.nodeName( this, "body" ) ) { 23029 jQuery( this ).replaceWith( this.childNodes ); 23030 } 23031 } ).end(); 23032 } 23033} ); 23034 23035 23036jQuery.expr.filters.hidden = function( elem ) { 23037 return !jQuery.expr.filters.visible( elem ); 23038}; 23039jQuery.expr.filters.visible = function( elem ) { 23040 23041 // Support: Opera <= 12.12 23042 // Opera reports offsetWidths and offsetHeights less than zero on some elements 23043 // Use OR instead of AND as the element is not visible if either is true 23044 // See tickets #10406 and #13132 23045 return elem.offsetWidth > 0 || elem.offsetHeight > 0 || elem.getClientRects().length > 0; 23046}; 23047 23048 23049 23050 23051var r20 = /%20/g, 23052 rbracket = /\[\]$/, 23053 rCRLF = /\r?\n/g, 23054 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 23055 rsubmittable = /^(?:input|select|textarea|keygen)/i; 23056 23057function buildParams( prefix, obj, traditional, add ) { 23058 var name; 23059 23060 if ( jQuery.isArray( obj ) ) { 23061 23062 // Serialize array item. 23063 jQuery.each( obj, function( i, v ) { 23064 if ( traditional || rbracket.test( prefix ) ) { 23065 23066 // Treat each array item as a scalar. 23067 add( prefix, v ); 23068 23069 } else { 23070 23071 // Item is non-scalar (array or object), encode its numeric index. 23072 buildParams( 23073 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 23074 v, 23075 traditional, 23076 add 23077 ); 23078 } 23079 } ); 23080 23081 } else if ( !traditional && jQuery.type( obj ) === "object" ) { 23082 23083 // Serialize object item. 23084 for ( name in obj ) { 23085 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 23086 } 23087 23088 } else { 23089 23090 // Serialize scalar item. 23091 add( prefix, obj ); 23092 } 23093} 23094 23095// Serialize an array of form elements or a set of 23096// key/values into a query string 23097jQuery.param = function( a, traditional ) { 23098 var prefix, 23099 s = [], 23100 add = function( key, value ) { 23101 23102 // If value is a function, invoke it and return its value
23103 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); 23104 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); 23105 }; 23106 23107 // Set traditional to true for jQuery <= 1.3.2 behavior. 23108 if ( traditional === undefined ) { 23109 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; 23110 } 23111 23112 // If an array was passed in, assume that it is an array of form elements. 23113 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 23114 23115 // Serialize the form elements 23116 jQuery.each( a, function() { 23117 add( this.name, this.value ); 23118 } ); 23119 23120 } else { 23121 23122 // If traditional, encode the "old" way (the way 1.3.2 or older 23123 // did it), otherwise encode params recursively. 23124 for ( prefix in a ) { 23125 buildParams( prefix, a[ prefix ], traditional, add ); 23126 } 23127 } 23128 23129 // Return the resulting serialization 23130 return s.join( "&" ).replace( r20, "+" ); 23131}; 23132 23133jQuery.fn.extend( { 23134 serialize: function() { 23135 return jQuery.param( this.serializeArray() ); 23136 }, 23137 serializeArray: function() { 23138 return this.map( function() { 23139 23140 // Can add propHook for "elements" to filter or add form elements 23141 var elements = jQuery.prop( this, "elements" ); 23142 return elements ? jQuery.makeArray( elements ) : this; 23143 } ) 23144 .filter( function() { 23145 var type = this.type; 23146 23147 // Use .is( ":disabled" ) so that fieldset[disabled] works 23148 return this.name && !jQuery( this ).is( ":disabled" ) && 23149 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 23150 ( this.checked || !rcheckableType.test( type ) ); 23151 } ) 23152 .map( function( i, elem ) { 23153 var val = jQuery( this ).val(); 23154 23155 return val == null ? 23156 null : 23157 jQuery.isArray( val ) ? 23158 jQuery.map( val, function( val ) { 23159 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 23160 } ) : 23161 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 23162 } ).get(); 23163 } 23164} ); 23165 23166 23167jQuery.ajaxSettings.xhr = function() { 23168 try { 23169 return new window.XMLHttpRequest(); 23170 } catch ( e ) {} 23171}; 23172 23173var xhrSuccessStatus = { 23174 23175 // File protocol always yields status code 0, assume 200 23176 0: 200, 23177 23178 // Support: IE9 23179 // #1450: sometimes IE returns 1223 when it should be 204 23180 1223: 204 23181 }, 23182 xhrSupported = jQuery.ajaxSettings.xhr(); 23183 23184support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 23185support.ajax = xhrSupported = !!xhrSupported; 23186 23187jQuery.ajaxTransport( function( options ) { 23188 var callback, errorCallback; 23189 23190 // Cross domain only allowed if supported through XMLHttpRequest 23191 if ( support.cors || xhrSupported && !options.crossDomain ) { 23192 return { 23193 send: function( headers, complete ) { 23194 var i, 23195 xhr = options.xhr(); 23196 23197 xhr.open( 23198 options.type, 23199 options.url, 23200 options.async, 23201 options.username, 23202 options.password 23203 ); 23204 23205 // Apply custom fields if provided 23206 if ( options.xhrFields ) { 23207 for ( i in options.xhrFields ) { 23208 xhr[ i ] = options.xhrFields[ i ]; 23209 } 23210 } 23211 23212 // Override mime type if needed 23213 if ( options.mimeType && xhr.overrideMimeType ) { 23214 xhr.overrideMimeType( options.mimeType ); 23215 } 23216 23217 // X-Requested-With header 23218 // For cross-domain requests, seeing as conditions for a preflight are 23219 // akin to a jigsaw puzzle, we simply never set it to be sure. 23220 // (it can always be set on a per-request basis or even using ajaxSetup)
vendor: 5,386 bytes, lines 23221-23434
23221 // For same-domain requests, won't change header if already provided. 23222 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 23223 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 23224 } 23225 23226 // Set headers 23227 for ( i in headers ) { 23228 xhr.setRequestHeader( i, headers[ i ] ); 23229 } 23230 23231 // Callback 23232 callback = function( type ) { 23233 return function() { 23234 if ( callback ) { 23235 callback = errorCallback = xhr.onload = 23236 xhr.onerror = xhr.onabort = xhr.onreadystatechange = null; 23237 23238 if ( type === "abort" ) { 23239 xhr.abort(); 23240 } else if ( type === "error" ) { 23241 23242 // Support: IE9 23243 // On a manual native abort, IE9 throws 23244 // errors on any property access that is not readyState 23245 if ( typeof xhr.status !== "number" ) { 23246 complete( 0, "error" ); 23247 } else { 23248 complete( 23249 23250 // File: protocol always yields status 0; see #8605, #14207 23251 xhr.status, 23252 xhr.statusText 23253 ); 23254 } 23255 } else { 23256 complete( 23257 xhrSuccessStatus[ xhr.status ] || xhr.status, 23258 xhr.statusText, 23259 23260 // Support: IE9 only 23261 // IE9 has no XHR2 but throws on binary (trac-11426) 23262 // For XHR2 non-text, let the caller handle it (gh-2498) 23263 ( xhr.responseType || "text" ) !== "text" || 23264 typeof xhr.responseText !== "string" ? 23265 { binary: xhr.response } : 23266 { text: xhr.responseText }, 23267 xhr.getAllResponseHeaders() 23268 ); 23269 } 23270 } 23271 }; 23272 }; 23273 23274 // Listen to events 23275 xhr.onload = callback(); 23276 errorCallback = xhr.onerror = callback( "error" ); 23277 23278 // Support: IE9 23279 // Use onreadystatechange to replace onabort 23280 // to handle uncaught aborts 23281 if ( xhr.onabort !== undefined ) { 23282 xhr.onabort = errorCallback; 23283 } else { 23284 xhr.onreadystatechange = function() { 23285 23286 // Check readyState before timeout as it changes 23287 if ( xhr.readyState === 4 ) { 23288 23289 // Allow onerror to be called first, 23290 // but that will not handle a native abort 23291 // Also, save errorCallback to a variable 23292 // as xhr.onerror cannot be accessed 23293 window.setTimeout( function() { 23294 if ( callback ) { 23295 errorCallback(); 23296 } 23297 } ); 23298 } 23299 }; 23300 } 23301 23302 // Create the abort callback 23303 callback = callback( "abort" ); 23304 23305 try { 23306 23307 // Do send the request (this may raise an exception) 23308 xhr.send( options.hasContent && options.data || null ); 23309 } catch ( e ) { 23310 23311 // #14683: Only rethrow if this hasn't been notified as an error yet 23312 if ( callback ) { 23313 throw e; 23314 } 23315 } 23316 }, 23317 23318 abort: function() { 23319 if ( callback ) { 23320 callback(); 23321 } 23322 } 23323 }; 23324 } 23325} ); 23326 23327 23328 23329 23330// Install script dataType 23331jQuery.ajaxSetup( { 23332 accepts: { 23333 script: "text/javascript, application/javascript, " + 23334 "application/ecmascript, application/x-ecmascript" 23335 }, 23336 contents: { 23337 script: /\b(?:java|ecma)script\b/ 23338 }, 23339 converters: { 23340 "text script": function( text ) { 23341 jQuery.globalEval( text ); 23342 return text; 23343 } 23344 } 23345} ); 23346 23347// Handle cache's special case and crossDomain 23348jQuery.ajaxPrefilter( "script", function( s ) { 23349 if ( s.cache === undefined ) { 23350 s.cache = false; 23351 } 23352 if ( s.crossDomain ) { 23353 s.type = "GET"; 23354 } 23355} ); 23356 23357// Bind script tag hack transport 23358jQuery.ajaxTransport( "script", function( s ) { 23359 23360 // This transport only deals with cross domain requests 23361 if ( s.crossDomain ) { 23362 var script, callback; 23363 return { 23364 send: function( _, complete ) { 23365 script = jQuery( "<script>" ).prop( { 23366 charset: s.scriptCharset, 23367 src: s.url 23368 } ).on( 23369 "load error", 23370 callback = function( evt ) { 23371 script.remove(); 23372 callback = null; 23373 if ( evt ) { 23374 complete( evt.type === "error" ? 404 : 200, evt.type ); 23375 } 23376 } 23377 ); 23378 23379 // Use native DOM manipulation to avoid our domManip AJAX trickery 23380 document.head.appendChild( script[ 0 ] ); 23381 }, 23382 abort: function() { 23383 if ( callback ) { 23384 callback(); 23385 } 23386 } 23387 }; 23388 } 23389} ); 23390 23391 23392 23393 23394var oldCallbacks = [], 23395 rjsonp = /(=)\?(?=&|$)|\?\?/; 23396 23397// Default jsonp settings 23398jQuery.ajaxSetup( { 23399 jsonp: "callback", 23400 jsonpCallback: function() { 23401 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); 23402 this[ callback ] = true; 23403 return callback; 23404 } 23405} ); 23406 23407// Detect, normalize options and install callbacks for jsonp requests 23408jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 23409 23410 var callbackName, overwritten, responseContainer, 23411 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 23412 "url" : 23413 typeof s.data === "string" && 23414 ( s.contentType || "" ) 23415 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 23416 rjsonp.test( s.data ) && "data" 23417 ); 23418 23419 // Handle iff the expected data type is "jsonp" or we have a parameter to set 23420 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 23421 23422 // Get callback name, remembering preexisting value associated with it 23423 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? 23424 s.jsonpCallback() : 23425 s.jsonpCallback; 23426 23427 // Insert callback into url or form data 23428 if ( jsonProp ) { 23429 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 23430 } else if ( s.jsonp !== false ) { 23431 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 23432 } 23433 23434 // Use data converter to retrieve json after script execution
23435 s.converters[ "script json" ] = function() { 23436 if ( !responseContainer ) { 23437 jQuery.error( callbackName + " was not called" ); 23438 } 23439 return responseContainer[ 0 ]; 23440 }; 23441 23442 // Force json dataType 23443 s.dataTypes[ 0 ] = "json"; 23444 23445 // Install callback 23446 overwritten = window[ callbackName ]; 23447 window[ callbackName ] = function() { 23448 responseContainer = arguments; 23449 }; 23450 23451 // Clean-up function (fires after converters) 23452 jqXHR.always( function() { 23453 23454 // If previous value didn't exist - remove it 23455 if ( overwritten === undefined ) { 23456 jQuery( window ).removeProp( callbackName ); 23457 23458 // Otherwise restore preexisting value 23459 } else { 23460 window[ callbackName ] = overwritten; 23461 } 23462 23463 // Save back as free 23464 if ( s[ callbackName ] ) { 23465 23466 // Make sure that re-using the options doesn't screw things around 23467 s.jsonpCallback = originalSettings.jsonpCallback; 23468 23469 // Save the callback name for future use 23470 oldCallbacks.push( callbackName ); 23471 } 23472 23473 // Call if it was a function and we have a response 23474 if ( responseContainer && jQuery.isFunction( overwritten ) ) { 23475 overwritten( responseContainer[ 0 ] ); 23476 } 23477 23478 responseContainer = overwritten = undefined; 23479 } ); 23480 23481 // Delegate to script 23482 return "script"; 23483 } 23484} ); 23485 23486 23487 23488 23489// Argument "data" should be string of html 23490// context (optional): If specified, the fragment will be created in this context, 23491// defaults to document 23492// keepScripts (optional): If true, will include scripts passed in the html string 23493jQuery.parseHTML = function( data, context, keepScripts ) { 23494 if ( !data || typeof data !== "string" ) { 23495 return null; 23496 } 23497 if ( typeof context === "boolean" ) { 23498 keepScripts = context; 23499 context = false; 23500 } 23501 context = context || document; 23502 23503 var parsed = rsingleTag.exec( data ), 23504 scripts = !keepScripts && []; 23505 23506 // Single tag 23507 if ( parsed ) { 23508 return [ context.createElement( parsed[ 1 ] ) ]; 23509 } 23510 23511 parsed = buildFragment( [ data ], context, scripts ); 23512 23513 if ( scripts && scripts.length ) {
23514 jQuery( scripts ).remove(); 23515 } 23516 23517 return jQuery.merge( [], parsed.childNodes ); 23518}; 23519 23520 23521// Keep a copy of the old load method 23522var _load = jQuery.fn.load; 23523 23524/** 23525 * Load a url into a page 23526 */ 23527jQuery.fn.load = function( url, params, callback ) { 23528 if ( typeof url !== "string" && _load ) { 23529 return _load.apply( this, arguments ); 23530 } 23531 23532 var selector, type, response, 23533 self = this, 23534 off = url.indexOf( " " ); 23535 23536 if ( off > -1 ) { 23537 selector = jQuery.trim( url.slice( off ) ); 23538 url = url.slice( 0, off ); 23539 } 23540 23541 // If it's a function 23542 if ( jQuery.isFunction( params ) ) { 23543 23544 // We assume that it's the callback 23545 callback = params; 23546 params = undefined; 23547 23548 // Otherwise, build a param string 23549 } else if ( params && typeof params === "object" ) { 23550 type = "POST"; 23551 } 23552 23553 // If we have elements to modify, make the request 23554 if ( self.length > 0 ) { 23555 jQuery.ajax( { 23556 url: url, 23557 23558 // If "type" variable is undefined, then "GET" method will be used. 23559 // Make value of this field explicit since 23560 // user can override it through ajaxSetup method 23561 type: type || "GET", 23562 dataType: "html", 23563 data: params 23564 } ).done( function( responseText ) { 23565 23566 // Save response for use in complete callback 23567 response = arguments; 23568 23569 self.html( selector ? 23570 23571 // If a selector was specified, locate the right elements in a dummy div 23572 // Exclude scripts to avoid IE 'Permission Denied' errors 23573 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 23574 23575 // Otherwise use the full result 23576 responseText ); 23577 23578 // If the request succeeds, this function gets "data", "status", "jqXHR" 23579 // but they are ignored because response was set above. 23580 // If it fails, this function gets "jqXHR", "status", "error" 23581 } ).always( callback && function( jqXHR, status ) { 23582 self.each( function() { 23583 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 23584 } ); 23585 } ); 23586 } 23587 23588 return this; 23589}; 23590 23591 23592 23593 23594// Attach a bunch of functions for handling common AJAX events 23595jQuery.each( [ 23596 "ajaxStart", 23597 "ajaxStop", 23598 "ajaxComplete", 23599 "ajaxError", 23600 "ajaxSuccess", 23601 "ajaxSend" 23602], function( i, type ) { 23603 jQuery.fn[ type ] = function( fn ) { 23604 return this.on( type, fn ); 23605 }; 23606} ); 23607 23608 23609 23610 23611jQuery.expr.filters.animated = function( elem ) { 23612 return jQuery.grep( jQuery.timers, function( fn ) { 23613 return elem === fn.elem; 23614 } ).length; 23615}; 23616 23617 23618 23619 23620/** 23621 * Gets a window from an element 23622 */ 23623function getWindow( elem ) { 23624 return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView; 23625} 23626 23627jQuery.offset = { 23628 setOffset: function( elem, options, i ) { 23629 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 23630 position = jQuery.css( elem, "position" ), 23631 curElem = jQuery( elem ), 23632 props = {}; 23633 23634 // Set position first, in-case top/left are set even on static elem 23635 if ( position === "static" ) { 23636 elem.style.position = "relative"; 23637 } 23638 23639 curOffset = curElem.offset(); 23640 curCSSTop = jQuery.css( elem, "top" ); 23641 curCSSLeft = jQuery.css( elem, "left" ); 23642 calculatePosition = ( position === "absolute" || position === "fixed" ) && 23643 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 23644 23645 // Need to be able to calculate position if either 23646 // top or left is auto and position is either absolute or fixed 23647 if ( calculatePosition ) { 23648 curPosition = curElem.position(); 23649 curTop = curPosition.top; 23650 curLeft = curPosition.left; 23651 23652 } else { 23653 curTop = parseFloat( curCSSTop ) || 0; 23654 curLeft = parseFloat( curCSSLeft ) || 0; 23655 } 23656 23657 if ( jQuery.isFunction( options ) ) { 23658 23659 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 23660 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 23661 } 23662 23663 if ( options.top != null ) { 23664 props.top = ( options.top - curOffset.top ) + curTop; 23665 } 23666 if ( options.left != null ) { 23667 props.left = ( options.left - curOffset.left ) + curLeft; 23668 } 23669 23670 if ( "using" in options ) { 23671 options.using.call( elem, props ); 23672 23673 } else { 23674 curElem.css( props ); 23675 } 23676 } 23677}; 23678 23679jQuery.fn.extend( { 23680 offset: function( options ) { 23681 if ( arguments.length ) { 23682 return options === undefined ? 23683 this : 23684 this.each( function( i ) { 23685 jQuery.offset.setOffset( this, options, i ); 23686 } ); 23687 } 23688 23689 var docElem, win, 23690 elem = this[ 0 ], 23691 box = { top: 0, left: 0 }, 23692 doc = elem && elem.ownerDocument; 23693 23694 if ( !doc ) { 23695 return; 23696 } 23697 23698 docElem = doc.documentElement; 23699 23700 // Make sure it's not a disconnected DOM node 23701 if ( !jQuery.contains( docElem, elem ) ) { 23702 return box; 23703 } 23704 23705 box = elem.getBoundingClientRect(); 23706 win = getWindow( doc ); 23707 return { 23708 top: box.top + win.pageYOffset - docElem.clientTop, 23709 left: box.left + win.pageXOffset - docElem.clientLeft 23710 }; 23711 }, 23712 23713 position: function() { 23714 if ( !this[ 0 ] ) { 23715 return; 23716 } 23717 23718 var offsetParent, offset, 23719 elem = this[ 0 ], 23720 parentOffset = { top: 0, left: 0 }; 23721 23722 // Fixed elements are offset from window (parentOffset = {top:0, left
vendor: 6,137 bytes, lines 23722-23908
23722: 0}, 23723 // because it is its only offset parent 23724 if ( jQuery.css( elem, "position" ) === "fixed" ) { 23725 23726 // Assume getBoundingClientRect is there when computed position is fixed 23727 offset = elem.getBoundingClientRect(); 23728 23729 } else { 23730 23731 // Get *real* offsetParent 23732 offsetParent = this.offsetParent(); 23733 23734 // Get correct offsets 23735 offset = this.offset(); 23736 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { 23737 parentOffset = offsetParent.offset(); 23738 } 23739 23740 // Add offsetParent borders 23741 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); 23742 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); 23743 } 23744 23745 // Subtract parent offsets and element margins 23746 return { 23747 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 23748 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 23749 }; 23750 }, 23751 23752 // This method will return documentElement in the following cases: 23753 // 1) For the element inside the iframe without offsetParent, this method will return 23754 // documentElement of the parent window 23755 // 2) For the hidden or detached element 23756 // 3) For body or html element, i.e. in case of the html node - it will return itself 23757 // 23758 // but those exceptions were never presented as a real life use-cases 23759 // and might be considered as more preferable results. 23760 // 23761 // This logic, however, is not guaranteed and can change at any point in the future 23762 offsetParent: function() { 23763 return this.map( function() { 23764 var offsetParent = this.offsetParent; 23765 23766 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 23767 offsetParent = offsetParent.offsetParent; 23768 } 23769 23770 return offsetParent || documentElement; 23771 } ); 23772 } 23773} ); 23774 23775// Create scrollLeft and scrollTop methods 23776jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 23777 var top = "pageYOffset" === prop; 23778 23779 jQuery.fn[ method ] = function( val ) { 23780 return access( this, function( elem, method, val ) { 23781 var win = getWindow( elem ); 23782 23783 if ( val === undefined ) { 23784 return win ? win[ prop ] : elem[ method ]; 23785 } 23786 23787 if ( win ) { 23788 win.scrollTo( 23789 !top ? val : win.pageXOffset, 23790 top ? val : win.pageYOffset 23791 ); 23792 23793 } else { 23794 elem[ method ] = val; 23795 } 23796 }, method, val, arguments.length ); 23797 }; 23798} ); 23799 23800// Support: Safari<7-8+, Chrome<37-44+ 23801// Add the top/left cssHooks using jQuery.fn.position 23802// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 23803// Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280 23804// getComputedStyle returns percent when specified for top/left/bottom/right; 23805// rather than make the css module depend on the offset module, just check for it here 23806jQuery.each( [ "top", "left" ], function( i, prop ) { 23807 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 23808 function( elem, computed ) { 23809 if ( computed ) { 23810 computed = curCSS( elem, prop ); 23811 23812 // If curCSS returns percentage, fallback to offset 23813 return rnumnonpx.test( computed ) ? 23814 jQuery( elem ).position()[ prop ] + "px" : 23815 computed; 23816 } 23817 } 23818 ); 23819} ); 23820 23821 23822// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 23823jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 23824 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, 23825 function( defaultExtra, funcName ) { 23826 23827 // Margin is only for outerHeight, outerWidth 23828 jQuery.fn[ funcName ] = function( margin, value ) { 23829 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 23830 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 23831 23832 return access( this, function( elem, type, value ) { 23833 var doc; 23834 23835 if ( jQuery.isWindow( elem ) ) { 23836 23837 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there 23838 // isn't a whole lot we can do. See pull request at this URL for discussion: 23839 // https://github.com/jquery/jquery/pull/764 23840 return elem.document.documentElement[ "client" + name ]; 23841 } 23842 23843 // Get document width or height 23844 if ( elem.nodeType === 9 ) { 23845 doc = elem.documentElement; 23846 23847 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 23848 // whichever is greatest 23849 return Math.max( 23850 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 23851 elem.body[ "offset" + name ], doc[ "offset" + name ], 23852 doc[ "client" + name ] 23853 ); 23854 } 23855 23856 return value === undefined ? 23857 23858 // Get width or height on the element, requesting but not forcing parseFloat 23859 jQuery.css( elem, type, extra ) : 23860 23861 // Set width or height on the element 23862 jQuery.style( elem, type, value, extra ); 23863 }, type, chainable ? margin : undefined, chainable, null ); 23864 }; 23865 } ); 23866} ); 23867 23868 23869jQuery.fn.extend( { 23870 23871 bind: function( types, data, fn ) { 23872 return this.on( types, null, data, fn ); 23873 }, 23874 unbind: function( types, fn ) { 23875 return this.off( types, null, fn ); 23876 }, 23877 23878 delegate: function( selector, types, data, fn ) { 23879 return this.on( types, selector, data, fn ); 23880 }, 23881 undelegate: function( selector, types, fn ) { 23882 23883 // ( namespace ) or ( selector, types [, fn] ) 23884 return arguments.length === 1 ? 23885 this.off( selector, "**" ) : 23886 this.off( types, selector || "**", fn ); 23887 }, 23888 size: function() { 23889 return this.length; 23890 } 23891} ); 23892 23893jQuery.fn.andSelf = jQuery.fn.addBack; 23894 23895 23896 23897 23898// Register as a named AMD module, since jQuery can be concatenated with other 23899// files that may use define, but not via a proper concatenation script that 23900// understands anonymous AMD modules. A named AMD is safest and most robust 23901// way to register. Lowercase jquery is used because AMD module names are 23902// derived from file names, and jQuery is normally delivered in a lowercase 23903// file name. Do this after creating the global so that if an AMD module wants 23904// to call noConflict to hide this version of jQuery, it will work. 23905 23906// Note that for maximum portability, libraries that are not jQuery should 23907// declare themselves as anonymous modules, and avoid setting a global if an 23908// AMD loader is present. jQuery is a special case. For more information, see
vendor: 10,698 bytes, lines 23909-24268
23909// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 23910 23911if ( typeof define === "function" && define.amd ) { 23912 define( "jquery", [], function() { 23913 return jQuery; 23914 } ); 23915} 23916 23917 23918 23919var 23920 23921 // Map over jQuery in case of overwrite 23922 _jQuery = window.jQuery, 23923 23924 // Map over the $ in case of overwrite 23925 _$ = window.$; 23926 23927jQuery.noConflict = function( deep ) { 23928 if ( window.$ === jQuery ) { 23929 window.$ = _$; 23930 } 23931 23932 if ( deep && window.jQuery === jQuery ) { 23933 window.jQuery = _jQuery; 23934 } 23935 23936 return jQuery; 23937}; 23938 23939// Expose jQuery and $ identifiers, even in AMD 23940// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 23941// and CommonJS for browser emulators (#13566) 23942if ( !noGlobal ) { 23943 window.jQuery = window.$ = jQuery; 23944} 23945 23946return jQuery; 23947})); 23948 23949},{}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/path-browserify/index.js":[function(require,module,exports){ 23950(function (process){ 23951// Copyright Joyent, Inc. and other Node contributors. 23952// 23953// Permission is hereby granted, free of charge, to any person obtaining a 23954// copy of this software and associated documentation files (the 23955// "Software"), to deal in the Software without restriction, including 23956// without limitation the rights to use, copy, modify, merge, publish, 23957// distribute, sublicense, and/or sell copies of the Software, and to permit 23958// persons to whom the Software is furnished to do so, subject to the 23959// following conditions: 23960// 23961// The above copyright notice and this permission notice shall be included 23962// in all copies or substantial portions of the Software. 23963// 23964// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 23965// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23966// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 23967// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 23968// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 23969// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 23970// USE OR OTHER DEALINGS IN THE SOFTWARE. 23971 23972// resolves . and .. elements in a path array with directory names there 23973// must be no slashes, empty elements, or device names (c:\) in the array 23974// (so also no leading and trailing slashes - it does not distinguish 23975// relative and absolute paths) 23976function normalizeArray(parts, allowAboveRoot) { 23977 // if the path tries to go above the root, `up` ends up > 0 23978 var up = 0; 23979 for (var i = parts.length - 1; i >= 0; i--) { 23980 var last = parts[i]; 23981 if (last === '.') { 23982 parts.splice(i, 1); 23983 } else if (last === '..') { 23984 parts.splice(i, 1); 23985 up++; 23986 } else if (up) { 23987 parts.splice(i, 1); 23988 up--; 23989 } 23990 } 23991 23992 // if the path is allowed to go above the root, restore leading ..s 23993 if (allowAboveRoot) { 23994 for (; up--; up) { 23995 parts.unshift('..'); 23996 } 23997 } 23998 23999 return parts; 24000} 24001 24002// Split a filename into [root, dir, basename, ext], unix version 24003// 'root' is just a slash, or nothing. 24004var splitPathRe = 24005 /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; 24006var splitPath = function(filename) { 24007 return splitPathRe.exec(filename).slice(1); 24008}; 24009 24010// path.resolve([from ...], to) 24011// posix version 24012exports.resolve = function() { 24013 var resolvedPath = '', 24014 resolvedAbsolute = false; 24015 24016 for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { 24017 var path = (i >= 0) ? arguments[i] : process.cwd(); 24018 24019 // Skip empty and invalid entries 24020 if (typeof path !== 'string') { 24021 throw new TypeError('Arguments to path.resolve must be strings'); 24022 } else if (!path) { 24023 continue; 24024 } 24025 24026 resolvedPath = path + '/' + resolvedPath; 24027 resolvedAbsolute = path.charAt(0) === '/'; 24028 } 24029 24030 // At this point the path should be resolved to a full absolute path, but 24031 // handle relative paths to be safe (might happen when process.cwd() fails) 24032 24033 // Normalize the path 24034 resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { 24035 return !!p; 24036 }), !resolvedAbsolute).join('/'); 24037 24038 return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; 24039}; 24040 24041// path.normalize(path) 24042// posix version 24043exports.normalize = function(path) { 24044 var isAbsolute = exports.isAbsolute(path), 24045 trailingSlash = substr(path, -1) === '/'; 24046 24047 // Normalize the path 24048 path = normalizeArray(filter(path.split('/'), function(p) { 24049 return !!p; 24050 }), !isAbsolute).join('/'); 24051 24052 if (!path && !isAbsolute) { 24053 path = '.'; 24054 } 24055 if (path && trailingSlash) { 24056 path += '/'; 24057 } 24058 24059 return (isAbsolute ? '/' : '') + path; 24060}; 24061 24062// posix version 24063exports.isAbsolute = function(path) { 24064 return path.charAt(0) === '/'; 24065}; 24066 24067// posix version 24068exports.join = function() { 24069 var paths = Array.prototype.slice.call(arguments, 0); 24070 return exports.normalize(filter(paths, function(p, index) { 24071 if (typeof p !== 'string') { 24072 throw new TypeError('Arguments to path.join must be strings'); 24073 } 24074 return p; 24075 }).join('/')); 24076}; 24077 24078 24079// path.relative(from, to) 24080// posix version 24081exports.relative = function(from, to) { 24082 from = exports.resolve(from).substr(1); 24083 to = exports.resolve(to).substr(1); 24084 24085 function trim(arr) { 24086 var start = 0; 24087 for (; start < arr.length; start++) { 24088 if (arr[start] !== '') break; 24089 } 24090 24091 var end = arr.length - 1; 24092 for (; end >= 0; end--) { 24093 if (arr[end] !== '') break; 24094 } 24095 24096 if (start > end) return []; 24097 return arr.slice(start, end - start + 1); 24098 } 24099 24100 var fromParts = trim(from.split('/')); 24101 var toParts = trim(to.split('/')); 24102 24103 var length = Math.min(fromParts.length, toParts.length); 24104 var samePartsLength = length; 24105 for (var i = 0; i < length; i++) { 24106 if (fromParts[i] !== toParts[i]) { 24107 samePartsLength = i; 24108 break; 24109 } 24110 } 24111 24112 var outputParts = []; 24113 for (var i = samePartsLength; i < fromParts.length; i++) { 24114 outputParts.push('..'); 24115 } 24116 24117 outputParts = outputParts.concat(toParts.slice(samePartsLength)); 24118 24119 return outputParts.join('/'); 24120}; 24121 24122exports.sep = '/'; 24123exports.delimiter = ':'; 24124 24125exports.dirname = function(path) { 24126 var result = splitPath(path), 24127 root = result[0], 24128 dir = result[1]; 24129 24130 if (!root && !dir) { 24131 // No dirname whatsoever 24132 return '.'; 24133 } 24134 24135 if (dir) { 24136 // It has a dirname, strip trailing slash 24137 dir = dir.substr(0, dir.length - 1); 24138 } 24139 24140 return root + dir; 24141}; 24142 24143 24144exports.basename = function(path, ext) { 24145 var f = splitPath(path)[2]; 24146 // TODO: make this comparison case-insensitive on windows? 24147 if (ext && f.substr(-1 * ext.length) === ext) { 24148 f = f.substr(0, f.length - ext.length); 24149 } 24150 return f; 24151}; 24152 24153 24154exports.extname = function(path) { 24155 return splitPath(path)[3]; 24156}; 24157 24158function filter (xs, f) { 24159 if (xs.filter) return xs.filter(f); 24160 var res = []; 24161 for (var i = 0; i < xs.length; i++) { 24162 if (f(xs[i], i, xs)) res.push(xs[i]); 24163 } 24164 return res; 24165} 24166 24167// String.prototype.substr - negative index don't work in IE8 24168var substr = 'ab'.substr(-1) === 'b' 24169 ? function (str, start, len) { return str.substr(start, len) } 24170 : function (str, start, len) { 24171 if (start < 0) start = str.length + start; 24172 return str.substr(start, len); 24173 } 24174; 24175 24176}).call(this,require('_process')) 24177},{"_process":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/process/browser.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/process/browser.js":[function(require,module,exports){ 24178// shim for using process in browser 24179var process = module.exports = {}; 24180 24181// cached from whatever global is present so that test runners that stub it 24182// don't break things. But we need to wrap it in a try catch in case it is 24183// wrapped in strict mode code which doesn't define any globals. It's inside a 24184// function because try/catches deoptimize in certain engines. 24185 24186var cachedSetTimeout; 24187var cachedClearTimeout; 24188 24189function defaultSetTimout() { 24190 throw new Error('setTimeout has not been defined'); 24191} 24192function defaultClearTimeout () { 24193 throw new Error('clearTimeout has not been defined'); 24194} 24195(function () { 24196 try { 24197 if (typeof setTimeout === 'function') { 24198 cachedSetTimeout = setTimeout; 24199 } else { 24200 cachedSetTimeout = defaultSetTimout; 24201 } 24202 } catch (e) { 24203 cachedSetTimeout = defaultSetTimout; 24204 } 24205 try { 24206 if (typeof clearTimeout === 'function') { 24207 cachedClearTimeout = clearTimeout; 24208 } else { 24209 cachedClearTimeout = defaultClearTimeout; 24210 } 24211 } catch (e) { 24212 cachedClearTimeout = defaultClearTimeout; 24213 } 24214} ()) 24215function runTimeout(fun) { 24216 if (cachedSetTimeout === setTimeout) { 24217 //normal enviroments in sane situations 24218 return setTimeout(fun, 0); 24219 } 24220 // if setTimeout wasn't available but was latter defined 24221 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 24222 cachedSetTimeout = setTimeout; 24223 return setTimeout(fun, 0); 24224 } 24225 try { 24226 // when when somebody has screwed with setTimeout but no I.E. maddness 24227 return cachedSetTimeout(fun, 0); 24228 } catch(e){ 24229 try { 24230 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 24231 return cachedSetTimeout.call(null, fun, 0); 24232 } catch(e){ 24233 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error 24234 return cachedSetTimeout.call(this, fun, 0); 24235 } 24236 } 24237 24238 24239} 24240function runClearTimeout(marker) { 24241 if (cachedClearTimeout === clearTimeout) { 24242 //normal enviroments in sane situations 24243 return clearTimeout(marker); 24244 } 24245 // if clearTimeout wasn't available but was latter defined 24246 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 24247 cachedClearTimeout = clearTimeout; 24248 return clearTimeout(marker); 24249 } 24250 try { 24251 // when when somebody has screwed with setTimeout but no I.E. maddness 24252 return cachedClearTimeout(marker); 24253 } catch (e){ 24254 try { 24255 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 24256 return cachedClearTimeout.call(null, marker); 24257 } catch (e){ 24258 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. 24259 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 24260 return cachedClearTimeout.call(this, marker); 24261 } 24262 } 24263 24264 24265 24266} 24267var queue = []; 24268var draining = false;
24269var currentQueue; 24270var queueIndex = -1; 24271 24272function cleanUpNextTick() { 24273 if (!draining || !currentQueue) { 24274 return; 24275 } 24276 draining = false; 24277 if (currentQueue.length) { 24278 queue = currentQueue.concat(queue); 24279 } else { 24280 queueIndex = -1; 24281 } 24282 if (queue.length) { 24283 drainQueue(); 24284 } 24285} 24286 24287function drainQueue() { 24288 if (draining) { 24289 return; 24290 } 24291 var timeout = runTimeout(cleanUpNextTick); 24292 draining = true; 24293 24294 var len = queue.length; 24295 while(len) { 24296 currentQueue = queue; 24297 queue = []; 24298 while (++queueIndex < len) { 24299 if (currentQueue) { 24300 currentQueue[queueIndex].run(); 24301 } 24302 } 24303 queueIndex = -1; 24304 len = queue.length; 24305 } 24306 currentQueue = null; 24307 draining = false; 24308 runClearTimeout(timeout); 24309} 24310 24311process.nextTick = function (fun) { 24312 var args = new Array(arguments.length - 1); 24313 if (arguments.length > 1) { 24314 for (var i = 1; i < arguments.length; i++) { 24315 args[i - 1] = arguments[i]; 24316 } 24317 } 24318 queue.push(new Item(fun, args)); 24319 if (queue.length === 1 && !draining) { 24320 runTimeout(drainQueue); 24321 } 24322}; 24323 24324// v8 likes predictible objects 24325function Item(fun, array) { 24326 this.fun = fun; 24327 this.array = array; 24328} 24329Item.prototype.run = function () { 24330 this.fun.apply(null, this.array); 24331}; 24332process.title = 'browser'; 24333process.browser = true; 24334process.env = {}; 24335process.argv = []; 24336process.version = ''; // empty string to avoid regexp issues 24337process.versions = {}; 24338 24339function noop() {} 24340 24341process.on = noop; 24342process.addListener = noop; 24343process.once = noop; 24344process.off = noop; 24345process.removeListener = noop; 24346process.removeAllListeners = noop; 24347process.emit = noop; 24348process.prependListener = noop; 24349process.prependOnceListener = noop; 24350 24351process.listeners = function (name) { return [] } 24352 24353process.binding = function (name) { 24354 throw new Error('process.binding is not supported'); 24355}; 24356 24357process.cwd = function () { return '/' }; 24358process.chdir = function (dir) { 24359 throw new Error('process.chdir is not supported'); 24360}; 24361process.umask = function() { return 0; }; 24362 24363},{}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map.js":[function(require,module,exports){ 24364/* 24365 * Copyright 2009-2011 Mozilla Foundation and contributors 24366 * Licensed under the New BSD license. See LICENSE.txt or: 24367 * http://opensource.org/licenses/BSD-3-Clause 24368 */ 24369exports.SourceMapGenerator = require('./source-map/source-map-generator').SourceMapGenerator; 24370exports.SourceMapConsumer = require('./source-map/source-map-consumer').SourceMapConsumer; 24371exports.SourceNode = require('./source-map/source-node').SourceNode; 24372 24373},{"./source-map/source-map-consumer":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/source-map-consumer.js","./source-map/source-map-generator":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/source-map-generator.js","./source-map/source-node":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/source-node.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/array-set.js":[function(require,module,exports){ 24374/* -*- Mode: js; js-indent-level: 2; -*- */ 24375/* 24376 * Copyright 2011 Mozilla Foundation and contributors 24377 * Licensed under the New BSD license. See LICENSE or: 24378 * http://opensource.org/licenses/BSD-3-Clause 24379 */ 24380if (typeof define !== 'function') { 24381 var define = require('amdefine')(module, require); 24382} 24383define(function (require, exports, module) { 24384 24385 var util = require('./util'); 24386 24387 /** 24388 * A data structure which is a combination of an array and a set. Adding a new 24389 * member is O(1), testing for membership is O(1), and finding the index of an 24390 * element is O(1). Removing elements from the set is not supported. Only 24391 * strings are supported for membership. 24392 */ 24393 function ArraySet() { 24394 this._array = []; 24395 this._set = {}; 24396 } 24397 24398 /** 24399 * Static method for creating ArraySet instances from an existing array. 24400 */ 24401 ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { 24402 var set = new ArraySet(); 24403 for (var i = 0, len = aArray.length; i < len; i++) { 24404 set.add(aArray[i], aAllowDuplicates); 24405 } 24406 return set; 24407 }; 24408 24409 /** 24410 * Return how many unique items are in this ArraySet. If duplicates have been 24411 * added, than those do not count towards the size. 24412 * 24413 * @returns Number 24414 */ 24415 ArraySet.prototype.size = function ArraySet_size() { 24416 return Object.getOwnPropertyNames(this._set).length; 24417 }; 24418 24419 /** 24420 * Add the given string to this set. 24421 * 24422 * @param String aStr 24423 */ 24424 ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { 24425 var isDuplicate = this.has(aStr); 24426 var idx = this._array.length; 24427 if (!isDuplicate || aAllowDuplicates) { 24428 this._array.push(aStr); 24429 } 24430 if (!isDuplicate) { 24431 this._set[util.toSetString(aStr)] = idx; 24432 } 24433 }; 24434 24435 /** 24436 * Is the given string a member of this set? 24437 * 24438 * @param String aStr 24439 */ 24440 ArraySet.prototype.has = function ArraySet_has(aStr) { 24441 return Object.prototype.hasOwnProperty.call(this._set, 24442 util.toSetString(aStr)); 24443 }; 24444 24445 /** 24446 * What is the index of the given string in the array? 24447 * 24448 * @param String aStr 24449 */ 24450 ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { 24451 if (this.has(aStr)) { 24452 return this._set[util.toSetString(aStr)]; 24453 } 24454 throw new Error('"' + aStr + '" is not in the set.'); 24455 }; 24456 24457 /** 24458 * What is the element at the given index? 24459 * 24460 * @param Number aIdx 24461 */ 24462 ArraySet.prototype.at = function ArraySet_at(aIdx) { 24463 if (aIdx >= 0 && aIdx < this._array.length) { 24464 return this._array[aIdx]; 24465 } 24466 throw new Error('No element indexed by ' + aIdx); 24467 }; 24468 24469 /** 24470 * Returns the array representation of this set (which has the proper indices 24471 * indicated by indexOf). Note that this is a copy of the internal array used 24472 * for storing the members so that no one can mess with internal state. 24473 */ 24474 ArraySet.prototype.toArray = function ArraySet_toArray() { 24475 return this._array.slice(); 24476 }; 24477 24478 exports.ArraySet = ArraySet; 24479 24480}); 24481 24482},{"./util":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/util.js","amdefine":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/amdefine/amdefine.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/base64-vlq.js":[function(require,module,exports){ 24483/* -*- Mode: js; js-indent-level: 2; -*- */ 24484/* 24485 * Copyright 2011 Mozilla Foundation and contributors 24486 * Licensed under the New BSD license. See LICENSE or: 24487 * http://opensource.org/licenses/BSD-3-Clause 24488 *
24489 * Based on the Base 64 VLQ implementation in Closure Compiler: 24490 * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java 24491 * 24492 * Copyright 2011 The Closure Compiler Authors. All rights reserved. 24493 * Redistribution and use in source and binary forms, with or without 24494 * modification, are permitted provided that the following conditions are 24495 * met: 24496 * 24497 * * Redistributions of source code must retain the above copyright 24498 * notice, this list of conditions and the following disclaimer. 24499 * * Redistributions in binary form must reproduce the above 24500 * copyright notice, this list of conditions and the following 24501 * disclaimer in the documentation and/or other materials provided 24502 * with the distribution. 24503 * * Neither the name of Google Inc. nor the names of its 24504 * contributors may be used to endorse or promote products derived 24505 * from this software without specific prior written permission. 24506 * 24507 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24508 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24509 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24510 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24511 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24512 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24513 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24514 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24515 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24516 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24517 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24518 */ 24519if (typeof define !== 'function') { 24520 var define = require('amdefine')(module, require); 24521} 24522define(function (require, exports, module) { 24523 24524 var base64 = require('./base64'); 24525 24526 // A single base 64 digit can contain 6 bits of data. For the base 64 variable 24527 // length quantities we use in the source map spec, the first bit is the sign, 24528 // the next four bits are the actual value, and the 6th bit is the 24529 // continuation bit. The continuation bit tells us whether there are more 24530 // digits in this value following this digit. 24531 // 24532 // Continuation 24533 // | Sign 24534 // | | 24535 // V V 24536 // 101011 24537 24538 var VLQ_BASE_SHIFT = 5; 24539 24540 // binary: 100000 24541 var VLQ_BASE = 1 << VLQ_BASE_SHIFT; 24542 24543 // binary: 011111 24544 var VLQ_BASE_MASK = VLQ_BASE - 1; 24545 24546 // binary: 100000 24547 var VLQ_CONTINUATION_BIT = VLQ_BASE; 24548 24549 /** 24550 * Converts from a two-complement value to a value where the sign bit is 24551 * placed in the least significant bit. For example, as decimals: 24552 * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) 24553 * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) 24554 */ 24555 function toVLQSigned(aValue) { 24556 return aValue < 0 24557 ? ((-aValue) << 1) + 1 24558 : (aValue << 1) + 0; 24559 } 24560 24561 /** 24562 * Converts to a two-complement value from a value where the sign bit is 24563 * placed in the least significant bit. For example, as decimals: 24564 * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 24565 * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 24566 */ 24567 function fromVLQSigned(aValue) { 24568 var isNegative = (aValue & 1) === 1; 24569 var shifted = aValue >> 1; 24570 return isNegative 24571 ? -shifted 24572 : shifted; 24573 } 24574 24575 /** 24576 * Returns the base 64 VLQ encoded value. 24577 */ 24578 exports.encode = function base64VLQ_encode(aValue) { 24579 var encoded = ""; 24580 var digit; 24581 24582 var vlq = toVLQSigned(aValue); 24583 24584 do { 24585 digit = vlq & VLQ_BASE_MASK; 24586 vlq >>>= VLQ_BASE_SHIFT; 24587 if (vlq > 0) { 24588 // There are still more digits in this value, so we must make sure the 24589 // continuation bit is marked. 24590 digit |= VLQ_CONTINUATION_BIT; 24591 } 24592 encoded += base64.encode(digit); 24593 } while (vlq > 0); 24594 24595 return encoded; 24596 }; 24597 24598 /** 24599 * Decodes the next base 64 VLQ value from the given string and returns the 24600 * value and the rest of the string via the out parameter. 24601 */ 24602 exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { 24603 var strLen = aStr.length; 24604 var result = 0; 24605 var shift = 0; 24606 var continuation, digit; 24607 24608 do { 24609 if (aIndex >= strLen) { 24610 throw new Error("Expected more digits in base 64 VLQ value."); 24611 } 24612 24613 digit = base64.decode(aStr.charCodeAt(aIndex++)); 24614 if (digit === -1) { 24615 throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); 24616 } 24617 24618 continuation = !!(digit & VLQ_CONTINUATION_BIT); 24619 digit &= VLQ_BASE_MASK; 24620 result = result + (digit << shift); 24621 shift += VLQ_BASE_SHIFT; 24622 } while (continuation); 24623 24624 aOutParam.value = fromVLQSigned(result); 24625 aOutParam.rest = aIndex; 24626 }; 24627 24628}); 24629 24630},{"./base64":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/base64.js","amdefine":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/amdefine/amdefine.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/base64.js":[function(require,module,exports){ 24631/* -*- Mode: js; js-indent-level: 2; -*- */ 24632/* 24633 * Copyright 2011 Mozilla Foundation and contributors 24634 * Licensed under the New BSD license. See LICENSE or: 24635 * http://opensource.org/licenses/BSD-3-Clause 24636 */ 24637if (typeof define !== 'function') { 24638 var define = require('amdefine')(module, require); 24639} 24640define(function (require, exports, module) { 24641 24642 var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
24642+/'.split(''); 24643 24644 /** 24645 * Encode an integer in the range of 0 to 63 to a single base 64 digit. 24646 */ 24647 exports.encode = function (number) { 24648 if (0 <= number && number < intToCharMap.length) { 24649 return intToCharMap[number]; 24650 } 24651 throw new TypeError("Must be between 0 and 63: " + aNumber); 24652 }; 24653 24654 /** 24655 * Decode a single base 64 character code digit to an integer. Returns -1 on 24656 * failure. 24657 */ 24658 exports.decode = function (charCode) { 24659 var bigA = 65; // 'A' 24660 var bigZ = 90; // 'Z' 24661 24662 var littleA = 97; // 'a' 24663 var littleZ = 122; // 'z' 24664 24665 var zero = 48; // '0' 24666 var nine = 57; // '9' 24667 24668 var plus = 43; // '+' 24669 var slash = 47; // '/' 24670 24671 var littleOffset = 26; 24672 var numberOffset = 52; 24673 24674 // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ 24675 if (bigA <= charCode && charCode <= bigZ) { 24676 return (charCode - bigA); 24677 } 24678 24679 // 26 - 51: abcdefghijklmnopqrstuvwxyz 24680 if (littleA <= charCode && charCode <= littleZ) { 24681 return (charCode - littleA + littleOffset); 24682 } 24683 24684 // 52 - 61: 0123456789 24685 if (zero <= charCode && charCode <= nine) { 24686 return (charCode - zero + numberOffset); 24687 } 24688 24689 // 62: + 24690 if (charCode == plus) { 24691 return 62; 24692 } 24693 24694 // 63: / 24695 if (charCode == slash) { 24696 return 63; 24697 } 24698 24699 // Invalid base64 digit. 24700 return -1; 24701 }; 24702 24703}); 24704 24705},{"amdefine":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/amdefine/amdefine.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/binary-search.js":[function(require,module,exports){ 24706/* -*- Mode: js; js-indent-level: 2; -*- */ 24707/* 24708 * Copyright 2011 Mozilla Foundation and contributors 24709 * Licensed under the New BSD license. See LICENSE or: 24710 * http://opensource.org/licenses/BSD-3-Clause 24711 */ 24712if (typeof define !== 'function') { 24713 var define = require('amdefine')(module, require); 24714} 24715define(function (require, exports, module) { 24716 24717 exports.GREATEST_LOWER_BOUND = 1; 24718 exports.LEAST_UPPER_BOUND = 2; 24719 24720 /** 24721 * Recursive implementation of binary search. 24722 * 24723 * @param aLow Indices here and lower do not contain the needle. 24724 * @param aHigh Indices here and higher do not contain the needle. 24725 * @param aNeedle The element being searched for. 24726 * @param aHaystack The non-empty array being searched. 24727 * @param aCompare Function which takes two elements and returns -1, 0, or 1. 24728 * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or 24729 * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the 24730 * closest element that is smaller than or greater than the one we are 24731 * searching for, respectively, if the exact element cannot be found. 24732 */ 24733 function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { 24734 // This function terminates when one of the following is true: 24735 // 24736 // 1. We find the exact element we are looking for. 24737 // 24738 // 2. We did not find the exact element, but we can return the index of 24739 // the next-closest element. 24740 // 24741 // 3. We did not find the exact element, and there is no next-closest 24742 // element than the one we are searching for, so we return -1. 24743 var mid = Math.floor((aHigh - aLow) / 2) + aLow; 24744 var cmp = aCompare(aNeedle, aHaystack[mid], true); 24745 if (cmp === 0) { 24746 // Found the element we are looking for. 24747 return mid; 24748 } 24749 else if (cmp > 0) { 24750 // Our needle is greater than aHaystack[mid]. 24751 if (aHigh - mid > 1) { 24752 // The element is in the upper half. 24753 return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); 24754 } 24755 24756 // The exact needle element was not found in this haystack. Determine if 24757 // we are in termination case (3) or (2) and return the appropriate thing. 24758 if (aBias == exports.LEAST_UPPER_BOUND) { 24759 return aHigh < aHaystack.length ? aHigh : -1; 24760 } else { 24761 return mid; 24762 } 24763 } 24764 else { 24765 // Our needle is less than aHaystack[mid]. 24766 if (mid - aLow > 1) { 24767 // The element is in the lower half. 24768 return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); 24769 } 24770 24771 // we are in termination case (3) or (2) and return the appropriate thing. 24772 if (aBias == exports.LEAST_UPPER_BOUND) { 24773 return mid; 24774 } else { 24775 return aLow < 0 ? -1 : aLow; 24776 } 24777 } 24778 } 24779 24780 /** 24781 * This is an implementation of binary search which will always try and return 24782 * the index of the closest element if there is no exact hit. This is because 24783 * mappings between original and generated line/col pairs are single points, 24784 * and there is an implicit region between each of them, so a miss just means
24785 * that you aren't on the very start of a region. 24786 * 24787 * @param aNeedle The element you are looking for. 24788 * @param aHaystack The array that is being searched. 24789 * @param aCompare A function which takes the needle and an element in the 24790 * array and returns -1, 0, or 1 depending on whether the needle is less 24791 * than, equal to, or greater than the element, respectively. 24792 * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or 24793 * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the 24794 * closest element that is smaller than or greater than the one we are 24795 * searching for, respectively, if the exact element cannot be found. 24796 * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. 24797 */ 24798 exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { 24799 if (aHaystack.length === 0) { 24800 return -1; 24801 } 24802 24803 var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, 24804 aCompare, aBias || exports.GREATEST_LOWER_BOUND); 24805 if (index < 0) { 24806 return -1; 24807 } 24808 24809 // We have found either the exact element, or the next-closest element than 24810 // the one we are searching for. However, there may be more than one such 24811 // element. Make sure we always return the smallest of these. 24812 while (index - 1 >= 0) { 24813 if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { 24814 break; 24815 } 24816 --index; 24817 } 24818 24819 return index; 24820 }; 24821 24822}); 24823 24824},{"amdefine":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/amdefine/amdefine.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/mapping-list.js":[function(require,module,exports){ 24825/* -*- Mode: js; js-indent-level: 2; -*- */ 24826/* 24827 * Copyright 2014 Mozilla Foundation and contributors 24828 * Licensed under the New BSD license. See LICENSE or: 24829 * http://opensource.org/licenses/BSD-3-Clause 24830 */ 24831if (typeof define !== 'function') { 24832 var define = require('amdefine')(module, require); 24833} 24834define(function (require, exports, module) { 24835 24836 var util = require('./util'); 24837 24838 /** 24839 * Determine whether mappingB is after mappingA with respect to generated 24840 * position. 24841 */ 24842 function generatedPositionAfter(mappingA, mappingB) { 24843 // Optimized for most common case 24844 var lineA = mappingA.generatedLine; 24845 var lineB = mappingB.generatedLine; 24846 var columnA = mappingA.generatedColumn; 24847 var columnB = mappingB.generatedColumn; 24848 return lineB > lineA || lineB == lineA && columnB >= columnA || 24849 util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; 24850 } 24851 24852 /** 24853 * A data structure to provide a sorted view of accumulated mappings in a 24854 * performance conscious manner. It trades a neglibable overhead in general 24855 * case for a large speedup in case of mappings being added in order. 24856 */ 24857 function MappingList() { 24858 this._array = []; 24859 this._sorted = true; 24860 // Serves as infimum 24861 this._last = {generatedLine: -1, generatedColumn: 0}; 24862 } 24863 24864 /** 24865 * Iterate through internal items. This method takes the same arguments that 24866 * `Array.prototype.forEach` takes. 24867 * 24868 * NOTE: The order of the mappings is NOT guaranteed. 24869 */ 24870 MappingList.prototype.unsortedForEach = 24871 function MappingList_forEach(aCallback, aThisArg) { 24872 this._array.forEach(aCallback, aThisArg); 24873 }; 24874 24875 /** 24876 * Add the given source mapping. 24877 * 24878 * @param Object aMapping 24879 */ 24880 MappingList.prototype.add = function MappingList_add(aMapping) { 24881 var mapping; 24882 if (generatedPositionAfter(this._last, aMapping)) { 24883 this._last = aMapping; 24884 this._array.push(aMapping); 24885 } else { 24886 this._sorted = false; 24887 this._array.push(aMapping); 24888 } 24889 }; 24890 24891 /** 24892 * Returns the flat, sorted array of mappings. The mappings are sorted by 24893 * generated position. 24894 * 24895 * WARNING: This method returns internal data without copying, for 24896 * performance. The return value must NOT be mutated, and should be treated as 24897 * an immutable borrow. If you want to take ownership, you must make your own 24898 * copy. 24899 */ 24900 MappingList.prototype.toArray = function MappingList_toArray() { 24901 if (!this._sorted) { 24902 this._array.sort(util.compareByGeneratedPositionsInflated); 24903 this._sorted = true; 24904 } 24905 return this._array; 24906 }; 24907 24908 exports.MappingList = MappingList; 24909 24910}); 24911 24912},{"./util":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/util.js","amdefine":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/amdefine/amdefine.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/quick-sort.js":[function(require,module,exports){ 24913/* -*- Mode: js; js-indent-level: 2; -*- */ 24914/* 24915 * Copyright 2011 Mozilla Foundation and contributors 24916 * Licensed under the New BSD license. See LICENSE or: 24917 * http://opensource.org/licenses/BSD-3-Clause 24918 */ 24919if (typeof define !== 'function') { 24920 var define = require('amdefine')(module, require); 24921} 24922define(function (require, exports, module) { 24923 24924 // It turns out that some (most?) JavaScript engines don't self-host 24925 // `Array.prototype.sort`. This makes sense because C++ will likely remain 24926 // faster than JS when doing raw CPU-intensive sorting. However, when using a 24927 // custom comparator function, calling back and forth between the VM's C++ and 24928 // JIT'd JS is rather slow *and* loses JIT type information, resulting in 24929 // worse generated code for the comparator function than would be optimal. In 24930 // fact, when sorting with a comparator, these costs outweigh the benefits of 24931 // sorting in C++. By using our own JS-implemented Quick Sort (below), we get 24932 // a ~3500ms mean speed-up in `bench/bench.html`. 24933 24934 /** 24935 * Swap the elements indexed by `x` and `y` in the array `ary`. 24936 * 24937 * @param {Array} ary 24938 * The array. 24939 * @param {Number} x 24940 * The index of the first item. 24941 * @param {Number} y 24942 * The index of the second item. 24943 */ 24944 function swap(ary, x, y) { 24945 var temp = ary[x]; 24946 ary[x] = ary[y]; 24947 ary[y] = temp; 24948 } 24949 24950 /** 24951 * Returns a random integer within the range `low .. high` inclusive. 24952 * 24953 * @param {Number} low 24954 * The lower bound on the range. 24955 * @param {Number} high 24956 * The upper bound on the range. 24957 */ 24958 function randomIntInRange(low, high) { 24959 return Math.round(low + (Math.random() * (high - low))); 24960 } 24961 24962 /** 24963 * The Quick Sort algorithm. 24964 * 24965 * @param {Array} ary 24966 * An array to sort. 24967 * @param {function} comparator 24968 * Function to use to compare two items. 24969 * @param {Number} p 24970 * Start index of the array 24971 * @param {Number} r 24972 * End index of the array 24973 */ 24974 function doQuickSort(ary, comparator, p, r) { 24975 // If our lower bound is less than our upper bound, we (1) partition the 24976 // array into two pieces and (2) recurse on each half. If it is not, this is 24977 // the empty array and our base case. 24978 24979 if (p < r) { 24980 // (1) Partitioning. 24981 // 24982 // The partitioning chooses a pivot between `p` and `r` and moves all 24983 // elements that are less than or equal to the pivot to the before it, and 24984 // all the elements that are greater than it after it. The effect is that 24985 // once partition is done, the pivot is in the exact place it will be when 24986 // the array is put in sorted order, and it will not need to be moved 24987 // again. This runs in O(n) time. 24988 24989 // Always choose a random pivot so that an input array which is reverse 24990 // sorted does not cause O(n^2) running time. 24991 var pivotIndex = randomIntInRange(p, r); 24992 var i = p - 1; 24993 24994 swap(ary, pivotIndex, r); 24995 var pivot = ary[r]; 24996 24997 // Immediately after `j` is incremented in this loop, the following hold 24998 // true: 24999 // 25000 // * Every element in `ary[p .. i]` is less than or equal to the pivot. 25001 // 25002 // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. 25003 for (var j = p; j < r; j++) { 25004 if (comparator(ary[j], pivot) <= 0) { 25005 i += 1; 25006 swap(ary, i, j); 25007 } 25008 } 25009 25010 swap(ary, i + 1, j); 25011 var q = i + 1; 25012 25013 // (2) Recurse on each half. 25014 25015 doQuickSort(ary, comparator, p, q - 1); 25016 doQuickSort(ary, comparator, q + 1, r); 25017 } 25018 } 25019 25020 /** 25021 * Sort the given array in-place with the given comparator function. 25022 * 25023 * @param {Array} ary 25024 * An array to sort. 25025 * @param {function} comparator 25026 * Function to use to compare two items. 25027 */ 25028 exports.quickSort = function (ary, comparator) { 25029 doQuickSort(ary, comparator, 0, ary.length - 1); 25030 }; 25031 25032}); 25033 25034},{"amdefine":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/amdefine/amdefine.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/source-map-consumer.js":[function(require,module,exports){ 25035/* -*- Mode: js; js-indent-level: 2; -*- */ 25036/* 25037 * Copyright 2011 Mozilla Foundation and contributors 25038 * Licensed under the New BSD license. See LICENSE or: 25039 * http://opensource.org/licenses/BSD-3-Clause 25040 */ 25041if (typeof define !== 'function') { 25042 var define = require('amdefine')(module, require); 25043} 25044define(function (require, exports, module) { 25045 25046 var util = require('./util'); 25047 var binarySearch = require('./binary-search'); 25048 var ArraySet = require('./array-set').ArraySet; 25049 var base64VLQ = require('./base64-vlq'); 25050 var quickSort = require('./quick-sort').quickSort; 25051 25052 function SourceMapConsumer(aSourceMap) { 25053 var sourceMap = aSourceMap; 25054 if (typeof aSourceMap === 'string') { 25055 sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); 25056 } 25057 25058 return sourceMap.sections != null 25059 ? new IndexedSourceMapConsumer(sourceMap) 25060 : new BasicSourceMapConsumer(sourceMap); 25061 } 25062 25063 SourceMapConsumer.fromSourceMap = function(aSourceMap) { 25064 return BasicSourceMapConsumer.fromSourceMap(aSourceMap); 25065 } 25066 25067 /** 25068 * The version of the source mapping spec that we are consuming. 25069 */ 25070 SourceMapConsumer.prototype._version = 3; 25071 25072 // `__generatedMappings` and `__originalMappings` are arrays that hold the 25073 // parsed mapping coordinates from the source map's "mappings" attribute. They 25074 // are lazily instantiated, accessed via the `_generatedMappings` and 25075 // `_originalMappings` getters respectively, and we only parse the mappings 25076 // and create these arrays once queried for a source location. We jump through 25077 // these hoops because there can be many thousands of mappings, and parsing 25078 // them is expensive, so we only want to do it if we must. 25079 // 25080 // Each object in the arrays is of the form: 25081 // 25082 // { 25083 // generatedLine: The line number in the generated code, 25084 // generatedColumn: The column number in the generated code, 25085 // source: The path to the original source file that generated this 25086 // chunk of code, 25087 // originalLine: The line number in the original source that 25088 // corresponds to this chunk of generated code, 25089 // originalColumn: The column number in the original source that 25090 // corresponds to this chunk of generated code, 25091 // name: The name of the original symbol which generated this chunk of 25092 // code. 25093 // } 25094 // 25095 // All properties except for `generatedLine` and `generatedColumn` can be 25096 // `null`. 25097 // 25098 // `_generatedMappings` is ordered by the generated positions. 25099 // 25100 // `_originalMappings` is ordered by the original positions. 25101 25102 SourceMapConsumer.prototype.__generatedMappings = null; 25103 Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { 25104 get: function () { 25105 if (!this.__generatedMappings) { 25106 this._parseMappings(this._mappings, this.sourceRoot); 25107 } 25108 25109 return this.__generatedMappings; 25110 } 25111 }); 25112 25113 SourceMapConsumer.prototype.__originalMappings = null; 25114 Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { 25115 get: function () { 25116 if (!this.__originalMappings) { 25117 this._parseMappings(this._mappings, this.sourceRoot); 25118 } 25119 25120 return this.__originalMappings; 25121 } 25122 }); 25123 25124 SourceMapConsumer.prototype._charIsMappingSeparator = 25125 function SourceMapConsumer_charIsMappingSeparator(aStr, index) { 25126 var c = aStr.charAt(index); 25127 return c === ";" || c === ","; 25128 }; 25129 25130 /** 25131 * Parse the mappings in a string in to a data structure which we can easily 25132 * query (the ordered arrays in the `this.__generatedMappings` and 25133 * `this.__originalMappings` properties). 25134 */ 25135 SourceMapConsumer.prototype._parseMappings = 25136 function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { 25137 throw new Error("Subclasses must implement _parseMappings"); 25138 }; 25139 25140 SourceMapConsumer.GENERATED_ORDER = 1; 25141 SourceMapConsumer.ORIGINAL_ORDER = 2; 25142 25143 SourceMapConsumer.GREATEST_LOWER_BOUND = 1; 25144 SourceMapConsumer.LEAST_UPPER_BOUND = 2; 25145 25146 /** 25147 * Iterate over each mapping between an original source/line/column and a 25148 * generated line/column in this source map. 25149 * 25150 * @param Function aCallback 25151 * The function that is called with each mapping. 25152 * @param Object aContext 25153 * Optional. If specified, this object will be the value of `this` every 25154 * time that `aCallback` is called. 25155 * @param aOrder 25156 * Either `SourceMapConsumer.GENERATED_ORDER` or 25157 * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to 25158 * iterate over the mappings sorted by the generated file's line/column 25159 * order or the original's source/line/column order, respectively. Defaults to 25160 * `SourceMapConsumer.GENERATED_ORDER`. 25161 */ 25162 SourceMapConsumer.prototype.eachMapping = 25163 function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { 25164 var context = aContext || null; 25165 var order = aOrder || SourceMapConsumer.GENERATED_ORDER; 25166 25167 var mappings; 25168 switch (order) { 25169 case SourceMapConsumer.GENERATED_ORDER: 25170 mappings = this._generatedMappings; 25171 break; 25172 case SourceMapConsumer.ORIGINAL_ORDER: 25173 mappings = this._originalMappings; 25174 break; 25175 default: 25176 throw new Error("Unknown order of iteration."); 25177 } 25178 25179 var sourceRoot = this.sourceRoot; 25180 mappings.map(function (mapping) { 25181 var source = mapping.source === null ? null : this._sources.at(mapping.source); 25182 if (source != null && sourceRoot != null) { 25183 source = util.join(sourceRoot, source); 25184 } 25185 return { 25186 source: source, 25187 generatedLine: mapping.generatedLine, 25188 generatedColumn: mapping.generatedColumn, 25189 originalLine: mapping.originalLine, 25190 originalColumn: mapping.originalColumn, 25191 name: mapping.name === null ? null : this._names.at(mapping.name) 25192 }; 25193 }
vendor: 6,142 bytes, lines 25193-25336
25193, this).forEach(aCallback, context); 25194 }; 25195 25196 /** 25197 * Returns all generated line and column information for the original source, 25198 * line, and column provided. If no column is provided, returns all mappings 25199 * corresponding to a either the line we are searching for or the next 25200 * closest line that has any mappings. Otherwise, returns all mappings 25201 * corresponding to the given line and either the column we are searching for 25202 * or the next closest column that has any offsets. 25203 * 25204 * The only argument is an object with the following properties: 25205 * 25206 * - source: The filename of the original source. 25207 * - line: The line number in the original source. 25208 * - column: Optional. the column number in the original source. 25209 * 25210 * and an array of objects is returned, each with the following properties: 25211 * 25212 * - line: The line number in the generated source, or null. 25213 * - column: The column number in the generated source, or null. 25214 */ 25215 SourceMapConsumer.prototype.allGeneratedPositionsFor = 25216 function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { 25217 var line = util.getArg(aArgs, 'line'); 25218 25219 // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping 25220 // returns the index of the closest mapping less than the needle. By 25221 // setting needle.originalColumn to 0, we thus find the last mapping for 25222 // the given line, provided such a mapping exists. 25223 var needle = { 25224 source: util.getArg(aArgs, 'source'), 25225 originalLine: line, 25226 originalColumn: util.getArg(aArgs, 'column', 0) 25227 }; 25228 25229 if (this.sourceRoot != null) { 25230 needle.source = util.relative(this.sourceRoot, needle.source); 25231 } 25232 if (!this._sources.has(needle.source)) { 25233 return []; 25234 } 25235 needle.source = this._sources.indexOf(needle.source); 25236 25237 var mappings = []; 25238 25239 var index = this._findMapping(needle, 25240 this._originalMappings, 25241 "originalLine", 25242 "originalColumn", 25243 util.compareByOriginalPositions, 25244 binarySearch.LEAST_UPPER_BOUND); 25245 if (index >= 0) { 25246 var mapping = this._originalMappings[index]; 25247 25248 if (aArgs.column === undefined) { 25249 var originalLine = mapping.originalLine; 25250 25251 // Iterate until either we run out of mappings, or we run into 25252 // a mapping for a different line than the one we found. Since 25253 // mappings are sorted, this is guaranteed to find all mappings for 25254 // the line we found. 25255 while (mapping && mapping.originalLine === originalLine) { 25256 mappings.push({ 25257 line: util.getArg(mapping, 'generatedLine', null), 25258 column: util.getArg(mapping, 'generatedColumn', null), 25259 lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) 25260 }); 25261 25262 mapping = this._originalMappings[++index]; 25263 } 25264 } else { 25265 var originalColumn = mapping.originalColumn; 25266 25267 // Iterate until either we run out of mappings, or we run into 25268 // a mapping for a different line than the one we were searching for. 25269 // Since mappings are sorted, this is guaranteed to find all mappings for 25270 // the line we are searching for. 25271 while (mapping && 25272 mapping.originalLine === line && 25273 mapping.originalColumn == originalColumn) { 25274 mappings.push({ 25275 line: util.getArg(mapping, 'generatedLine', null), 25276 column: util.getArg(mapping, 'generatedColumn', null), 25277 lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) 25278 }); 25279 25280 mapping = this._originalMappings[++index]; 25281 } 25282 } 25283 } 25284 25285 return mappings; 25286 }; 25287 25288 exports.SourceMapConsumer = SourceMapConsumer; 25289 25290 /** 25291 * A BasicSourceMapConsumer instance represents a parsed source map which we can 25292 * query for information about the original file positions by giving it a file 25293 * position in the generated source. 25294 * 25295 * The only parameter is the raw source map (either as a JSON string, or 25296 * already parsed to an object). According to the spec, source maps have the 25297 * following attributes: 25298 * 25299 * - version: Which version of the source map spec this map is following. 25300 * - sources: An array of URLs to the original source files. 25301 * - names: An array of identifiers which can be referrenced by individual mappings. 25302 * - sourceRoot: Optional. The URL root from which all sources are relative. 25303 * - sourcesContent: Optional. An array of contents of the original source files. 25304 * - mappings: A string of base64 VLQs which contain the actual mappings. 25305 * - file: Optional. The generated file this source map is associated with. 25306 * 25307 * Here is an example source map, taken from the source map spec[0]: 25308 * 25309 * { 25310 * version : 3, 25311 * file: "out.js", 25312 * sourceRoot : "", 25313 * sources: ["foo.js", "bar.js"], 25314 * names: ["src", "maps", "are", "fun"], 25315 * mappings: "AA,AB;;ABCDE;" 25316 * } 25317 * 25318 * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# 25319 */ 25320 function BasicSourceMapConsumer(aSourceMap) { 25321 var sourceMap = aSourceMap; 25322 if (typeof aSourceMap === 'string') { 25323 sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); 25324 } 25325 25326 var version = util.getArg(sourceMap, 'version'); 25327 var sources = util.getArg(sourceMap, 'sources'); 25328 // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which 25329 // requires the array) to play nice here. 25330 var names = util.getArg(sourceMap, 'names', []); 25331 var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); 25332 var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); 25333 var mappings = util.getArg(sourceMap, 'mappings'); 25334 var file = util.getArg(sourceMap, 'file', null); 25335 25336 // Once again, Sass deviates from the spec and supplies the version as a
25337 // string rather than a number, so we use loose equality checking here. 25338 if (version != this._version) { 25339 throw new Error('Unsupported version: ' + version); 25340 } 25341 25342 // Some source maps produce relative source paths like "./foo.js" instead of 25343 // "foo.js". Normalize these first so that future comparisons will succeed. 25344 // See bugzil.la/1090768. 25345 sources = sources.map(util.normalize); 25346 25347 // Pass `true` below to allow duplicate names and sources. While source maps 25348 // are intended to be compressed and deduplicated, the TypeScript compiler 25349 // sometimes generates source maps with duplicates in them. See Github issue 25350 // #72 and bugzil.la/889492. 25351 this._names = ArraySet.fromArray(names, true); 25352 this._sources = ArraySet.fromArray(sources, true); 25353 25354 this.sourceRoot = sourceRoot; 25355 this.sourcesContent = sourcesContent; 25356 this._mappings = mappings; 25357 this.file = file; 25358 } 25359 25360 BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); 25361 BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; 25362 25363 /** 25364 * Create a BasicSourceMapConsumer from a SourceMapGenerator. 25365 * 25366 * @param SourceMapGenerator aSourceMap 25367 * The source map that will be consumed. 25368 * @returns BasicSourceMapConsumer 25369 */ 25370 BasicSourceMapConsumer.fromSourceMap = 25371 function SourceMapConsumer_fromSourceMap(aSourceMap) { 25372 var smc = Object.create(BasicSourceMapConsumer.prototype); 25373 25374 var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); 25375 var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); 25376 smc.sourceRoot = aSourceMap._sourceRoot; 25377 smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), 25378 smc.sourceRoot); 25379 smc.file = aSourceMap._file; 25380
vendor: 19,659 bytes, lines 25381-25936
25381 // Because we are modifying the entries (by converting string sources and 25382 // names to indices into the sources and names ArraySets), we have to make 25383 // a copy of the entry or else bad things happen. Shared mutable state 25384 // strikes again! See github issue #191. 25385 25386 var generatedMappings = aSourceMap._mappings.toArray().slice(); 25387 var destGeneratedMappings = smc.__generatedMappings = []; 25388 var destOriginalMappings = smc.__originalMappings = []; 25389 25390 for (var i = 0, length = generatedMappings.length; i < length; i++) { 25391 var srcMapping = generatedMappings[i]; 25392 var destMapping = new Mapping; 25393 destMapping.generatedLine = srcMapping.generatedLine; 25394 destMapping.generatedColumn = srcMapping.generatedColumn; 25395 25396 if (srcMapping.source) { 25397 destMapping.source = sources.indexOf(srcMapping.source); 25398 destMapping.originalLine = srcMapping.originalLine; 25399 destMapping.originalColumn = srcMapping.originalColumn; 25400 25401 if (srcMapping.name) { 25402 destMapping.name = names.indexOf(srcMapping.name); 25403 } 25404 25405 destOriginalMappings.push(destMapping); 25406 } 25407 25408 destGeneratedMappings.push(destMapping); 25409 } 25410 25411 quickSort(smc.__originalMappings, util.compareByOriginalPositions); 25412 25413 return smc; 25414 }; 25415 25416 /** 25417 * The version of the source mapping spec that we are consuming. 25418 */ 25419 BasicSourceMapConsumer.prototype._version = 3; 25420 25421 /** 25422 * The list of original sources. 25423 */ 25424 Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { 25425 get: function () { 25426 return this._sources.toArray().map(function (s) { 25427 return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; 25428 }, this); 25429 } 25430 }); 25431 25432 /** 25433 * Provide the JIT with a nice shape / hidden class. 25434 */ 25435 function Mapping() { 25436 this.generatedLine = 0; 25437 this.generatedColumn = 0; 25438 this.source = null; 25439 this.originalLine = null; 25440 this.originalColumn = null; 25441 this.name = null; 25442 } 25443 25444 /** 25445 * Parse the mappings in a string in to a data structure which we can easily 25446 * query (the ordered arrays in the `this.__generatedMappings` and 25447 * `this.__originalMappings` properties). 25448 */ 25449 BasicSourceMapConsumer.prototype._parseMappings = 25450 function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { 25451 var generatedLine = 1; 25452 var previousGeneratedColumn = 0; 25453 var previousOriginalLine = 0; 25454 var previousOriginalColumn = 0; 25455 var previousSource = 0; 25456 var previousName = 0; 25457 var length = aStr.length; 25458 var index = 0; 25459 var cachedSegments = {}; 25460 var temp = {}; 25461 var originalMappings = []; 25462 var generatedMappings = []; 25463 var mapping, str, segment, end, value; 25464 25465 while (index < length) { 25466 if (aStr.charAt(index) === ';') { 25467 generatedLine++; 25468 index++; 25469 previousGeneratedColumn = 0; 25470 } 25471 else if (aStr.charAt(index) === ',') { 25472 index++; 25473 } 25474 else { 25475 mapping = new Mapping(); 25476 mapping.generatedLine = generatedLine; 25477 25478 // Because each offset is encoded relative to the previous one, 25479 // many segments often have the same encoding. We can exploit this 25480 // fact by caching the parsed variable length fields of each segment, 25481 // allowing us to avoid a second parse if we encounter the same 25482 // segment again. 25483 for (end = index; end < length; end++) { 25484 if (this._charIsMappingSeparator(aStr, end)) { 25485 break; 25486 } 25487 } 25488 str = aStr.slice(index, end); 25489 25490 segment = cachedSegments[str]; 25491 if (segment) { 25492 index += str.length; 25493 } else { 25494 segment = []; 25495 while (index < end) { 25496 base64VLQ.decode(aStr, index, temp); 25497 value = temp.value; 25498 index = temp.rest; 25499 segment.push(value); 25500 } 25501 25502 if (segment.length === 2) { 25503 throw new Error('Found a source, but no line and column'); 25504 } 25505 25506 if (segment.length === 3) { 25507 throw new Error('Found a source and line, but no column'); 25508 } 25509 25510 cachedSegments[str] = segment; 25511 } 25512 25513 // Generated column. 25514 mapping.generatedColumn = previousGeneratedColumn + segment[0]; 25515 previousGeneratedColumn = mapping.generatedColumn; 25516 25517 if (segment.length > 1) { 25518 // Original source. 25519 mapping.source = previousSource + segment[1]; 25520 previousSource += segment[1]; 25521 25522 // Original line. 25523 mapping.originalLine = previousOriginalLine + segment[2]; 25524 previousOriginalLine = mapping.originalLine; 25525 // Lines are stored 0-based 25526 mapping.originalLine += 1; 25527 25528 // Original column. 25529 mapping.originalColumn = previousOriginalColumn + segment[3]; 25530 previousOriginalColumn = mapping.originalColumn; 25531 25532 if (segment.length > 4) { 25533 // Original name. 25534 mapping.name = previousName + segment[4]; 25535 previousName += segment[4]; 25536 } 25537 } 25538 25539 generatedMappings.push(mapping); 25540 if (typeof mapping.originalLine === 'number') { 25541 originalMappings.push(mapping); 25542 } 25543 } 25544 } 25545 25546 quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); 25547 this.__generatedMappings = generatedMappings; 25548 25549 quickSort(originalMappings, util.compareByOriginalPositions); 25550 this.__originalMappings = originalMappings; 25551 }; 25552 25553 /** 25554 * Find the mapping that best matches the hypothetical "needle" mapping that 25555 * we are searching for in the given "haystack" of mappings. 25556 */ 25557 BasicSourceMapConsumer.prototype._findMapping = 25558 function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, 25559 aColumnName, aComparator, aBias) { 25560 // To return the position we are searching for, we must first find the 25561 // mapping for the given position and then return the opposite position it 25562 // points to. Because the mappings are sorted, we can use binary search to 25563 // find the best mapping. 25564 25565 if (aNeedle[aLineName] <= 0) { 25566 throw new TypeError('Line must be greater than or equal to 1, got ' 25567 + aNeedle[aLineName]); 25568 } 25569 if (aNeedle[aColumnName] < 0) { 25570 throw new TypeError('Column must be greater than or equal to 0, got ' 25571 + aNeedle[aColumnName]); 25572 } 25573 25574 return binarySearch.search(aNeedle, aMappings, aComparator, aBias); 25575 }; 25576 25577 /** 25578 * Compute the last column for each generated mapping. The last column is 25579 * inclusive. 25580 */ 25581 BasicSourceMapConsumer.prototype.computeColumnSpans = 25582 function SourceMapConsumer_computeColumnSpans() { 25583 for (var index = 0; index < this._generatedMappings.length; ++index) { 25584 var mapping = this._generatedMappings[index]; 25585 25586 // Mappings do not contain a field for the last generated columnt. We 25587 // can come up with an optimistic estimate, however, by assuming that 25588 // mappings are contiguous (i.e. given two consecutive mappings, the 25589 // first mapping ends where the second one starts). 25590 if (index + 1 < this._generatedMappings.length) { 25591 var nextMapping = this._generatedMappings[index + 1]; 25592 25593 if (mapping.generatedLine === nextMapping.generatedLine) { 25594 mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; 25595 continue; 25596 } 25597 } 25598 25599 // The last mapping for each line spans the entire line. 25600 mapping.lastGeneratedColumn = Infinity; 25601 } 25602 }; 25603 25604 /** 25605 * Returns the original source, line, and column information for the generated 25606 * source's line and column positions provided. The only argument is an object 25607 * with the following properties: 25608 * 25609 * - line: The line number in the generated source. 25610 * - column: The column number in the generated source. 25611 * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or 25612 * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the 25613 * closest element that is smaller than or greater than the one we are 25614 * searching for, respectively, if the exact element cannot be found. 25615 * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. 25616 * 25617 * and an object is returned with the following properties: 25618 * 25619 * - source: The original source file, or null. 25620 * - line: The line number in the original source, or null. 25621 * - column: The column number in the original source, or null. 25622 * - name: The original identifier, or null. 25623 */ 25624 BasicSourceMapConsumer.prototype.originalPositionFor = 25625 function SourceMapConsumer_originalPositionFor(aArgs) { 25626 var needle = { 25627 generatedLine: util.getArg(aArgs, 'line'), 25628 generatedColumn: util.getArg(aArgs, 'column') 25629 }; 25630 25631 var index = this._findMapping( 25632 needle, 25633 this._generatedMappings, 25634 "generatedLine", 25635 "generatedColumn", 25636 util.compareByGeneratedPositionsDeflated, 25637 util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) 25638 ); 25639 25640 if (index >= 0) { 25641 var mapping = this._generatedMappings[index]; 25642 25643 if (mapping.generatedLine === needle.generatedLine) { 25644 var source = util.getArg(mapping, 'source', null); 25645 if (source !== null) { 25646 source = this._sources.at(source); 25647 if (this.sourceRoot != null) { 25648 source = util.join(this.sourceRoot, source); 25649 } 25650 } 25651 var name = util.getArg(mapping, 'name', null); 25652 if (name !== null) { 25653 name = this._names.at(name); 25654 } 25655 return { 25656 source: source, 25657 line: util.getArg(mapping, 'originalLine', null), 25658 column: util.getArg(mapping, 'originalColumn', null), 25659 name: name 25660 }; 25661 } 25662 } 25663 25664 return { 25665 source: null, 25666 line: null, 25667 column: null, 25668 name: null 25669 }; 25670 }; 25671 25672 /** 25673 * Return true if we have the source content for every source in the source 25674 * map, false otherwise. 25675 */ 25676 BasicSourceMapConsumer.prototype.hasContentsOfAllSources = 25677 function BasicSourceMapConsumer_hasContentsOfAllSources() { 25678 if (!this.sourcesContent) { 25679 return false; 25680 } 25681 return this.sourcesContent.length >= this._sources.size() && 25682 !this.sourcesContent.some(function (sc) { return sc == null; }); 25683 }; 25684 25685 /** 25686 * Returns the original source content. The only argument is the url of the 25687 * original source file. Returns null if no original source content is 25688 * availible. 25689 */ 25690 BasicSourceMapConsumer.prototype.sourceContentFor = 25691 function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { 25692 if (!this.sourcesContent) { 25693 return null; 25694 } 25695 25696 if (this.sourceRoot != null) { 25697 aSource = util.relative(this.sourceRoot, aSource); 25698 } 25699 25700 if (this._sources.has(aSource)) { 25701 return this.sourcesContent[this._sources.indexOf(aSource)]; 25702 } 25703 25704 var url; 25705 if (this.sourceRoot != null 25706 && (url = util.urlParse(this.sourceRoot))) { 25707 // XXX: file:// URIs and absolute paths lead to unexpected behavior for 25708 // many users. We can help them out when they expect file:// URIs to 25709 // behave like it would if they were running a local HTTP server. See 25710 // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. 25711 var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); 25712 if (url.scheme == "file" 25713 && this._sources.has(fileUriAbsPath)) { 25714 return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] 25715 } 25716 25717 if ((!url.path || url.path == "/") 25718 && this._sources.has("/" + aSource)) { 25719 return this.sourcesContent[this._sources.indexOf("/" + aSource)]; 25720 } 25721 } 25722 25723 // This function is used recursively from 25724 // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we 25725 // don't want to throw if we can't find the source - we just want to 25726 // return null, so we provide a flag to exit gracefully. 25727 if (nullOnMissing) { 25728 return null; 25729 } 25730 else { 25731 throw new Error('"' + aSource + '" is not in the SourceMap.'); 25732 } 25733 }; 25734 25735 /** 25736 * Returns the generated line and column information for the original source, 25737 * line, and column positions provided. The only argument is an object with 25738 * the following properties: 25739 * 25740 * - source: The filename of the original source. 25741 * - line: The line number in the original source. 25742 * - column: The column number in the original source. 25743 * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or 25744 * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the 25745 * closest element that is smaller than or greater than the one we are 25746 * searching for, respectively, if the exact element cannot be found. 25747 * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. 25748 * 25749 * and an object is returned with the following properties: 25750 * 25751 * - line: The line number in the generated source, or null. 25752 * - column: The column number in the generated source, or null. 25753 */ 25754 BasicSourceMapConsumer.prototype.generatedPositionFor = 25755 function SourceMapConsumer_generatedPositionFor(aArgs) { 25756 var source = util.getArg(aArgs, 'source'); 25757 if (this.sourceRoot != null) { 25758 source = util.relative(this.sourceRoot, source); 25759 } 25760 if (!this._sources.has(source)) { 25761 return { 25762 line: null, 25763 column: null, 25764 lastColumn: null 25765 }; 25766 } 25767 source = this._sources.indexOf(source); 25768 25769 var needle = { 25770 source: source, 25771 originalLine: util.getArg(aArgs, 'line'), 25772 originalColumn: util.getArg(aArgs, 'column') 25773 }; 25774 25775 var index = this._findMapping( 25776 needle, 25777 this._originalMappings, 25778 "originalLine", 25779 "originalColumn", 25780 util.compareByOriginalPositions, 25781 util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) 25782 ); 25783 25784 if (index >= 0) { 25785 var mapping = this._originalMappings[index]; 25786 25787 if (mapping.source === needle.source) { 25788 return { 25789 line: util.getArg(mapping, 'generatedLine', null), 25790 column: util.getArg(mapping, 'generatedColumn', null), 25791 lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) 25792 }; 25793 } 25794 } 25795 25796 return { 25797 line: null, 25798 column: null, 25799 lastColumn: null 25800 }; 25801 }; 25802 25803 exports.BasicSourceMapConsumer = BasicSourceMapConsumer; 25804 25805 /** 25806 * An IndexedSourceMapConsumer instance represents a parsed source map which 25807 * we can query for information. It differs from BasicSourceMapConsumer in 25808 * that it takes "indexed" source maps (i.e. ones with a "sections" field) as 25809 * input. 25810 * 25811 * The only parameter is a raw source map (either as a JSON string, or already 25812 * parsed to an object). According to the spec for indexed source maps, they 25813 * have the following attributes: 25814 * 25815 * - version: Which version of the source map spec this map is following. 25816 * - file: Optional. The generated file this source map is associated with. 25817 * - sections: A list of section definitions. 25818 * 25819 * Each value under the "sections" field has two fields: 25820 * - offset: The offset into the original specified at which this section 25821 * begins to apply, defined as an object with a "line" and "column" 25822 * field. 25823 * - map: A source map definition. This source map could also be indexed, 25824 * but doesn't have to be. 25825 * 25826 * Instead of the "map" field, it's also possible to have a "url" field 25827 * specifying a URL to retrieve a source map from, but that's currently 25828 * unsupported. 25829 * 25830 * Here's an example source map, taken from the source map spec[0], but 25831 * modified to omit a section which uses the "url" field. 25832 * 25833 * { 25834 * version : 3, 25835 * file: "app.js", 25836 * sections: [{ 25837 * offset: {line:100, column:10}, 25838 * map: { 25839 * version : 3, 25840 * file: "section.js", 25841 * sources: ["foo.js", "bar.js"], 25842 * names: ["src", "maps", "are", "fun"], 25843 * mappings: "AAAA,E;;ABCDE;" 25844 * } 25845 * }], 25846 * } 25847 * 25848 * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt 25849 */ 25850 function IndexedSourceMapConsumer(aSourceMap) { 25851 var sourceMap = aSourceMap; 25852 if (typeof aSourceMap === 'string') { 25853 sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); 25854 } 25855 25856 var version = util.getArg(sourceMap, 'version'); 25857 var sections = util.getArg(sourceMap, 'sections'); 25858 25859 if (version != this._version) { 25860 throw new Error('Unsupported version: ' + version); 25861 } 25862 25863 this._sources = new ArraySet(); 25864 this._names = new ArraySet(); 25865 25866 var lastOffset = { 25867 line: -1, 25868 column: 0 25869 }; 25870 this._sections = sections.map(function (s) { 25871 if (s.url) { 25872 // The url field will require support for asynchronicity. 25873 // See https://github.com/mozilla/source-map/issues/16 25874 throw new Error('Support for url field in sections not implemented.'); 25875 } 25876 var offset = util.getArg(s, 'offset'); 25877 var offsetLine = util.getArg(offset, 'line'); 25878 var offsetColumn = util.getArg(offset, 'column'); 25879 25880 if (offsetLine < lastOffset.line || 25881 (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { 25882 throw new Error('Section offsets must be ordered and non-overlapping.'); 25883 } 25884 lastOffset = offset; 25885 25886 return { 25887 generatedOffset: { 25888 // The offset fields are 0-based, but we use 1-based indices when 25889 // encoding/decoding from VLQ. 25890 generatedLine: offsetLine + 1, 25891 generatedColumn: offsetColumn + 1 25892 }, 25893 consumer: new SourceMapConsumer(util.getArg(s, 'map')) 25894 } 25895 }); 25896 } 25897 25898 IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); 25899 IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; 25900 25901 /** 25902 * The version of the source mapping spec that we are consuming. 25903 */ 25904 IndexedSourceMapConsumer.prototype._version = 3; 25905 25906 /** 25907 * The list of original sources. 25908 */ 25909 Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { 25910 get: function () { 25911 var sources = []; 25912 for (var i = 0; i < this._sections.length; i++) { 25913 for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { 25914 sources.push(this._sections[i].consumer.sources[j]); 25915 } 25916 }; 25917 return sources; 25918 } 25919 }); 25920 25921 /** 25922 * Returns the original source, line, and column information for the generated 25923 * source's line and column positions provided. The only argument is an object 25924 * with the following properties: 25925 * 25926 * - line: The line number in the generated source. 25927 * - column: The column number in the generated source. 25928 * 25929 * and an object is returned with the following properties: 25930 * 25931 * - source: The original source file, or null. 25932 * - line: The line number in the original source, or null. 25933 * - column: The column number in the original source, or null. 25934 * - name: The original identifier, or null. 25935 */ 25936 IndexedSourceMapConsumer.prototype.originalPositionFor =
25937 function IndexedSourceMapConsumer_originalPositionFor(aArgs) { 25938 var needle = { 25939 generatedLine: util.getArg(aArgs, 'line'), 25940 generatedColumn: util.getArg(aArgs, 'column') 25941 }; 25942 25943 // Find the section containing the generated position we're trying to map 25944 // to an original position. 25945 var sectionIndex = binarySearch.search(needle, this._sections, 25946 function(needle, section) { 25947 var cmp = needle.generatedLine - section.generatedOffset.generatedLine; 25948 if (cmp) { 25949 return cmp; 25950 } 25951 25952 return (needle.generatedColumn - 25953 section.generatedOffset.generatedColumn); 25954 }); 25955 var section = this._sections[sectionIndex]; 25956 25957 if (!section) { 25958 return { 25959 source: null, 25960 line: null, 25961 column: null, 25962 name: null 25963 }; 25964 } 25965 25966 return section.consumer.originalPositionFor({ 25967 line: needle.generatedLine - 25968 (section.generatedOffset.generatedLine - 1), 25969 column: needle.generatedColumn - 25970 (section.generatedOffset.generatedLine === needle.generatedLine 25971 ? section.generatedOffset.generatedColumn - 1 25972 : 0), 25973 bias: aArgs.bias 25974 }); 25975 }; 25976 25977 /** 25978 * Return true if we have the source content for every source in the source 25979 * map, false otherwise. 25980 */ 25981 IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = 25982 function IndexedSourceMapConsumer_hasContentsOfAllSources() { 25983 return this._sections.every(function (s) { 25984 return s.consumer.hasContentsOfAllSources(); 25985 }); 25986 }; 25987 25988 /** 25989 * Returns the original source content. The only argument is the url of the 25990 * original source file. Returns null if no original source content is 25991 * available. 25992 */ 25993 IndexedSourceMapConsumer.prototype.sourceContentFor = 25994 function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { 25995 for (var i = 0; i < this._sections.length; i++) { 25996 var section = this._sections[i]; 25997 25998 var content = section.consumer.sourceContentFor(aSource, true); 25999 if (content) { 26000 return content; 26001 } 26002 } 26003 if (nullOnMissing) { 26004 return null; 26005 } 26006 else { 26007 throw new Error('"' + aSource + '" is not in the SourceMap.'); 26008 } 26009 }; 26010 26011 /** 26012 * Returns the generated line and column information for the original source, 26013 * line, and column positions provided. The only argument is an object with 26014 * the following properties: 26015 * 26016 * - source: The filename of the original source. 26017 * - line: The line number in the original source. 26018 * - column: The column number in the original source. 26019 * 26020 * and an object is returned with the following properties: 26021 * 26022 * - line: The line number in the generated source, or null. 26023 * - column: The column number in the generated source, or null. 26024 */ 26025 IndexedSourceMapConsumer.prototype.generatedPositionFor = 26026 function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { 26027 for (var i = 0; i < this._sections.length; i++) { 26028 var section = this._sections[i]; 26029 26030 // Only consider this section if the requested source is in the list of 26031 // sources of the consumer. 26032 if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { 26033 continue; 26034 } 26035 var generatedPosition = section.consumer.generatedPositionFor(aArgs); 26036 if (generatedPosition) { 26037 var ret = { 26038 line: generatedPosition.line + 26039 (section.generatedOffset.generatedLine - 1), 26040 column: generatedPosition.column + 26041 (section.generatedOffset.generatedLine === generatedPosition.line 26042 ? section.generatedOffset.generatedColumn - 1 26043 : 0) 26044 }; 26045 return ret; 26046 } 26047 } 26048 26049 return { 26050 line: null, 26051 column: null 26052 }; 26053 }; 26054 26055 /** 26056 * Parse the mappings in a string in to a data structure which we can easily 26057 * query (the ordered arrays in the `this.__generatedMappings` and 26058 * `this.__originalMappings` properties). 26059 */ 26060 IndexedSourceMapConsumer.prototype._parseMappings = 26061 function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { 26062 this.__generatedMappings = []; 26063 this.__originalMappings = []; 26064 for (var i = 0; i < this._sections.length; i++) { 26065 var section = this._sections[i]; 26066 var sectionMappings = section.consumer._generatedMappings; 26067 for (var j = 0; j < sectionMappings.length; j++) { 26068 var mapping = sectionMappings[i]; 26069 26070 var source = section.consumer._sources.at(mapping.source); 26071 if (section.consumer.sourceRoot !== null) { 26072 source = util.join(section.consumer.sourceRoot, source); 26073 } 26074 this._sources.add(source); 26075 source = this._sources.indexOf(source); 26076 26077 var name = section.consumer._names.at(mapping.name); 26078 this._names.add(name); 26079 name = this._names.indexOf(name); 26080 26081 // The mappings coming from the consumer for the section have 26082 // generated positions relative to the start of the section, so we 26083 // need to offset them to be relative to the start of the concatenated 26084 // generated file. 26085 var adjustedMapping = { 26086 source: source, 26087 generatedLine: mapping.generatedLine + 26088 (section.generatedOffset.generatedLine - 1), 26089 generatedColumn: mapping.column + 26090 (section.generatedOffset.generatedLine === mapping.generatedLine) 26091 ? section.generatedOffset.generatedColumn - 1 26092 : 0, 26093 originalLine: mapping.originalLine, 26094 originalColumn: mapping.originalColumn, 26095 name: name 26096 }; 26097 26098 this.__generatedMappings.push(adjustedMapping); 26099 if (typeof adjustedMapping.originalLine === 'number') { 26100 this.__originalMappings.push(adjustedMapping); 26101 } 26102 }; 26103 }; 26104 26105 quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); 26106 quickSort(this.__originalMappings, util.compareByOriginalPositions); 26107 }; 26108 26109 exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; 26110 26111}); 26112 26113},{"./array-set":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/array-set.js","./base64-vlq":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/base64-vlq.js","./binary-search":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/binary-search.js","./quick-sort":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/quick-sort.js","./util":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/util.js","amdefine":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/amdefine/amdefine.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/source-map-generator.js":[function(require,module,exports){ 26114/* -*- Mode: js; js-indent-level: 2; -*- */ 26115/* 26116 * Copyright 2011 Mozilla Foundation and contributors 26117 * Licensed under the New BSD license. See LICENSE or: 26118 * http://opensource.org/licenses/BSD-3-Clause 26119 */ 26120if (typeof define !== 'function') { 26121 var define = require('amdefine')(module, require); 26122} 26123define(function (require, exports, module) { 26124 26125 var base64VLQ = require('./base64-vlq'); 26126 var util = require('./util'); 26127 var ArraySet = require('./array-set').ArraySet; 26128 var MappingList = require('./mapping-list').MappingList; 26129 26130 /** 26131 * An instance of the SourceMapGenerator represents a source map which is 26132 * being built incrementally. You may pass an object with the following 26133 * properties: 26134 * 26135 * - file: The filename of the generated source. 26136 * - sourceRoot: A root for all relative URLs in this source map. 26137 */ 26138 function SourceMapGenerator(aArgs) { 26139 if (!aArgs) { 26140 aArgs = {}; 26141 } 26142 this._file = util.getArg(aArgs, 'file', null); 26143 this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); 26144 this._skipValidation = util.getArg(aArgs, 'skipValidation', false); 26145 this._sources = new ArraySet(); 26146 this._names = new ArraySet();
vendor: 14,448 bytes, lines 26147-26532
26147 this._mappings = new MappingList(); 26148 this._sourcesContents = null; 26149 } 26150 26151 SourceMapGenerator.prototype._version = 3; 26152 26153 /** 26154 * Creates a new SourceMapGenerator based on a SourceMapConsumer 26155 * 26156 * @param aSourceMapConsumer The SourceMap. 26157 */ 26158 SourceMapGenerator.fromSourceMap = 26159 function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { 26160 var sourceRoot = aSourceMapConsumer.sourceRoot; 26161 var generator = new SourceMapGenerator({ 26162 file: aSourceMapConsumer.file, 26163 sourceRoot: sourceRoot 26164 }); 26165 aSourceMapConsumer.eachMapping(function (mapping) { 26166 var newMapping = { 26167 generated: { 26168 line: mapping.generatedLine, 26169 column: mapping.generatedColumn 26170 } 26171 }; 26172 26173 if (mapping.source != null) { 26174 newMapping.source = mapping.source; 26175 if (sourceRoot != null) { 26176 newMapping.source = util.relative(sourceRoot, newMapping.source); 26177 } 26178 26179 newMapping.original = { 26180 line: mapping.originalLine, 26181 column: mapping.originalColumn 26182 }; 26183 26184 if (mapping.name != null) { 26185 newMapping.name = mapping.name; 26186 } 26187 } 26188 26189 generator.addMapping(newMapping); 26190 }); 26191 aSourceMapConsumer.sources.forEach(function (sourceFile) { 26192 var content = aSourceMapConsumer.sourceContentFor(sourceFile); 26193 if (content != null) { 26194 generator.setSourceContent(sourceFile, content); 26195 } 26196 }); 26197 return generator; 26198 }; 26199 26200 /** 26201 * Add a single mapping from original source line and column to the generated 26202 * source's line and column for this source map being created. The mapping 26203 * object should have the following properties: 26204 * 26205 * - generated: An object with the generated line and column positions. 26206 * - original: An object with the original line and column positions. 26207 * - source: The original source file (relative to the sourceRoot). 26208 * - name: An optional original token name for this mapping. 26209 */ 26210 SourceMapGenerator.prototype.addMapping = 26211 function SourceMapGenerator_addMapping(aArgs) { 26212 var generated = util.getArg(aArgs, 'generated'); 26213 var original = util.getArg(aArgs, 'original', null); 26214 var source = util.getArg(aArgs, 'source', null); 26215 var name = util.getArg(aArgs, 'name', null); 26216 26217 if (!this._skipValidation) { 26218 this._validateMapping(generated, original, source, name); 26219 } 26220 26221 if (source != null && !this._sources.has(source)) { 26222 this._sources.add(source); 26223 } 26224 26225 if (name != null && !this._names.has(name)) { 26226 this._names.add(name); 26227 } 26228 26229 this._mappings.add({ 26230 generatedLine: generated.line, 26231 generatedColumn: generated.column, 26232 originalLine: original != null && original.line, 26233 originalColumn: original != null && original.column, 26234 source: source, 26235 name: name 26236 }); 26237 }; 26238 26239 /** 26240 * Set the source content for a source file. 26241 */ 26242 SourceMapGenerator.prototype.setSourceContent = 26243 function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { 26244 var source = aSourceFile; 26245 if (this._sourceRoot != null) { 26246 source = util.relative(this._sourceRoot, source); 26247 } 26248 26249 if (aSourceContent != null) { 26250 // Add the source content to the _sourcesContents map. 26251 // Create a new _sourcesContents map if the property is null. 26252 if (!this._sourcesContents) { 26253 this._sourcesContents = {}; 26254 } 26255 this._sourcesContents[util.toSetString(source)] = aSourceContent; 26256 } else if (this._sourcesContents) { 26257 // Remove the source file from the _sourcesContents map. 26258 // If the _sourcesContents map is empty, set the property to null. 26259 delete this._sourcesContents[util.toSetString(source)]; 26260 if (Object.keys(this._sourcesContents).length === 0) { 26261 this._sourcesContents = null; 26262 } 26263 } 26264 }; 26265 26266 /** 26267 * Applies the mappings of a sub-source-map for a specific source file to the 26268 * source map being generated. Each mapping to the supplied source file is 26269 * rewritten using the supplied source map. Note: The resolution for the 26270 * resulting mappings is the minimium of this map and the supplied map. 26271 * 26272 * @param aSourceMapConsumer The source map to be applied. 26273 * @param aSourceFile Optional. The filename of the source file. 26274 * If omitted, SourceMapConsumer's file property will be used. 26275 * @param aSourceMapPath Optional. The dirname of the path to the source map 26276 * to be applied. If relative, it is relative to the SourceMapConsumer. 26277 * This parameter is needed when the two source maps aren't in the same 26278 * directory, and the source map to be applied contains relative source 26279 * paths. If so, those relative source paths need to be rewritten 26280 * relative to the SourceMapGenerator. 26281 */ 26282 SourceMapGenerator.prototype.applySourceMap = 26283 function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { 26284 var sourceFile = aSourceFile; 26285 // If aSourceFile is omitted, we will use the file property of the SourceMap 26286 if (aSourceFile == null) { 26287 if (aSourceMapConsumer.file == null) { 26288 throw new Error( 26289 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + 26290 'or the source map\'s "file" property. Both were omitted.' 26291 ); 26292 } 26293 sourceFile = aSourceMapConsumer.file; 26294 } 26295 var sourceRoot = this._sourceRoot; 26296 // Make "sourceFile" relative if an absolute Url is passed. 26297 if (sourceRoot != null) { 26298 sourceFile = util.relative(sourceRoot, sourceFile); 26299 } 26300 // Applying the SourceMap can add and remove items from the sources and 26301 // the names array. 26302 var newSources = new ArraySet(); 26303 var newNames = new ArraySet(); 26304 26305 // Find mappings for the "sourceFile" 26306 this._mappings.unsortedForEach(function (mapping) { 26307 if (mapping.source === sourceFile && mapping.originalLine != null) { 26308 // Check if it can be mapped by the source map, then update the mapping. 26309 var original = aSourceMapConsumer.originalPositionFor({ 26310 line: mapping.originalLine, 26311 column: mapping.originalColumn 26312 }); 26313 if (original.source != null) { 26314 // Copy mapping 26315 mapping.source = original.source; 26316 if (aSourceMapPath != null) { 26317 mapping.source = util.join(aSourceMapPath, mapping.source) 26318 } 26319 if (sourceRoot != null) { 26320 mapping.source = util.relative(sourceRoot, mapping.source); 26321 } 26322 mapping.originalLine = original.line; 26323 mapping.originalColumn = original.column; 26324 if (original.name != null) { 26325 mapping.name = original.name; 26326 } 26327 } 26328 } 26329 26330 var source = mapping.source; 26331 if (source != null && !newSources.has(source)) { 26332 newSources.add(source); 26333 } 26334 26335 var name = mapping.name; 26336 if (name != null && !newNames.has(name)) { 26337 newNames.add(name); 26338 } 26339 26340 }, this); 26341 this._sources = newSources; 26342 this._names = newNames; 26343 26344 // Copy sourcesContents of applied map. 26345 aSourceMapConsumer.sources.forEach(function (sourceFile) { 26346 var content = aSourceMapConsumer.sourceContentFor(sourceFile); 26347 if (content != null) { 26348 if (aSourceMapPath != null) { 26349 sourceFile = util.join(aSourceMapPath, sourceFile); 26350 } 26351 if (sourceRoot != null) { 26352 sourceFile = util.relative(sourceRoot, sourceFile); 26353 } 26354 this.setSourceContent(sourceFile, content); 26355 } 26356 }, this); 26357 }; 26358 26359 /** 26360 * A mapping can have one of the three levels of data: 26361 * 26362 * 1. Just the generated position. 26363 * 2. The Generated position, original position, and original source. 26364 * 3. Generated and original position, original source, as well as a name 26365 * token. 26366 * 26367 * To maintain consistency, we validate that any new mapping being added falls 26368 * in to one of these categories. 26369 */ 26370 SourceMapGenerator.prototype._validateMapping = 26371 function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, 26372 aName) { 26373 if (aGenerated && 'line' in aGenerated && 'column' in aGenerated 26374 && aGenerated.line > 0 && aGenerated.column >= 0 26375 && !aOriginal && !aSource && !aName) { 26376 // Case 1. 26377 return; 26378 } 26379 else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated 26380 && aOriginal && 'line' in aOriginal && 'column' in aOriginal 26381 && aGenerated.line > 0 && aGenerated.column >= 0 26382 && aOriginal.line > 0 && aOriginal.column >= 0 26383 && aSource) { 26384 // Cases 2 and 3. 26385 return; 26386 } 26387 else { 26388 throw new Error('Invalid mapping: ' + JSON.stringify({ 26389 generated: aGenerated, 26390 source: aSource, 26391 original: aOriginal, 26392 name: aName 26393 })); 26394 } 26395 }; 26396 26397 /** 26398 * Serialize the accumulated mappings in to the stream of base 64 VLQs 26399 * specified by the source map format. 26400 */ 26401 SourceMapGenerator.prototype._serializeMappings = 26402 function SourceMapGenerator_serializeMappings() { 26403 var previousGeneratedColumn = 0; 26404 var previousGeneratedLine = 1; 26405 var previousOriginalColumn = 0; 26406 var previousOriginalLine = 0; 26407 var previousName = 0; 26408 var previousSource = 0; 26409 var result = ''; 26410 var mapping; 26411 26412 var mappings = this._mappings.toArray(); 26413 for (var i = 0, len = mappings.length; i < len; i++) { 26414 mapping = mappings[i]; 26415 26416 if (mapping.generatedLine !== previousGeneratedLine) { 26417 previousGeneratedColumn = 0; 26418 while (mapping.generatedLine !== previousGeneratedLine) { 26419 result += ';'; 26420 previousGeneratedLine++; 26421 } 26422 } 26423 else { 26424 if (i > 0) { 26425 if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { 26426 continue; 26427 } 26428 result += ','; 26429 } 26430 } 26431 26432 result += base64VLQ.encode(mapping.generatedColumn 26433 - previousGeneratedColumn); 26434 previousGeneratedColumn = mapping.generatedColumn; 26435 26436 if (mapping.source != null) { 26437 result += base64VLQ.encode(this._sources.indexOf(mapping.source) 26438 - previousSource); 26439 previousSource = this._sources.indexOf(mapping.source); 26440 26441 // lines are stored 0-based in SourceMap spec version 3 26442 result += base64VLQ.encode(mapping.originalLine - 1 26443 - previousOriginalLine); 26444 previousOriginalLine = mapping.originalLine - 1; 26445 26446 result += base64VLQ.encode(mapping.originalColumn 26447 - previousOriginalColumn); 26448 previousOriginalColumn = mapping.originalColumn; 26449 26450 if (mapping.name != null) { 26451 result += base64VLQ.encode(this._names.indexOf(mapping.name) 26452 - previousName); 26453 previousName = this._names.indexOf(mapping.name); 26454 } 26455 } 26456 } 26457 26458 return result; 26459 }; 26460 26461 SourceMapGenerator.prototype._generateSourcesContent = 26462 function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { 26463 return aSources.map(function (source) { 26464 if (!this._sourcesContents) { 26465 return null; 26466 } 26467 if (aSourceRoot != null) { 26468 source = util.relative(aSourceRoot, source); 26469 } 26470 var key = util.toSetString(source); 26471 return Object.prototype.hasOwnProperty.call(this._sourcesContents, 26472 key) 26473 ? this._sourcesContents[key] 26474 : null; 26475 }, this); 26476 }; 26477 26478 /** 26479 * Externalize the source map. 26480 */ 26481 SourceMapGenerator.prototype.toJSON = 26482 function SourceMapGenerator_toJSON() { 26483 var map = { 26484 version: this._version, 26485 sources: this._sources.toArray(), 26486 names: this._names.toArray(), 26487 mappings: this._serializeMappings() 26488 }; 26489 if (this._file != null) { 26490 map.file = this._file; 26491 } 26492 if (this._sourceRoot != null) { 26493 map.sourceRoot = this._sourceRoot; 26494 } 26495 if (this._sourcesContents) { 26496 map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); 26497 } 26498 26499 return map; 26500 }; 26501 26502 /** 26503 * Render the source map being generated to a string. 26504 */ 26505 SourceMapGenerator.prototype.toString = 26506 function SourceMapGenerator_toString() { 26507 return JSON.stringify(this.toJSON()); 26508 }; 26509 26510 exports.SourceMapGenerator = SourceMapGenerator; 26511 26512}); 26513 26514},{"./array-set":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/array-set.js","./base64-vlq":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/base64-vlq.js","./mapping-list":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/mapping-list.js","./util":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/util.js","amdefine":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/amdefine/amdefine.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/source-node.js":[function(require,module,exports){ 26515/* -*- Mode: js; js-indent-level: 2; -*- */ 26516/* 26517 * Copyright 2011 Mozilla Foundation and contributors 26518 * Licensed under the New BSD license. See LICENSE or: 26519 * http://opensource.org/licenses/BSD-3-Clause 26520 */ 26521if (typeof define !== 'function') { 26522 var define = require('amdefine')(module, require); 26523} 26524define(function (require, exports, module) { 26525 26526 var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator; 26527 var util = require('./util'); 26528 26529 // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other 26530 // operating systems these days (capturing the result). 26531 var REGEX_NEWLINE = /(\r?\n)/; 26532
26533 // Newline character code for charCodeAt() comparisons 26534 var NEWLINE_CODE = 10; 26535 26536 // Private symbol for identifying `SourceNode`s when multiple versions of 26537 // the source-map library are loaded. This MUST NOT CHANGE across 26538 // versions! 26539 var isSourceNode = "$$$isSourceNode$$$"; 26540 26541 /** 26542 * SourceNodes provide a way to abstract over interpolating/concatenating 26543 * snippets of generated JavaScript source code while maintaining the line and 26544 * column information associated with the original source code. 26545 * 26546 * @param aLine The original line number. 26547 * @param aColumn The original column number. 26548 * @param aSource The original source's filename. 26549 * @param aChunks Optional. An array of strings which are snippets of 26550 * generated JS, or other SourceNodes. 26551 * @param aName The original identifier. 26552 */ 26553 function SourceNode(aLine, aColumn, aSource, aChunks, aName) { 26554 this.children = []; 26555 this.sourceContents = {}; 26556 this.line = aLine == null ? null : aLine; 26557 this.column = aColumn == null ? null : aColumn; 26558 this.source = aSource == null ? null : aSource; 26559 this.name = aName == null ? null : aName; 26560 this[isSourceNode] = true; 26561 if (aChunks != null) this.add(aChunks); 26562 } 26563 26564 /** 26565 * Creates a SourceNode from generated code and a SourceMapConsumer. 26566 * 26567 * @param aGeneratedCode The generated code 26568 * @param aSourceMapConsumer The SourceMap for the generated code 26569 * @param aRelativePath Optional. The path that relative sources in the 26570 * SourceMapConsumer should be relative to. 26571 */ 26572 SourceNode.fromStringWithSourceMap = 26573 function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { 26574 // The SourceNode we want to fill with the generated code 26575 // and the SourceMap 26576 var node = new SourceNode(); 26577 26578 // All even indices of this array are one line of the generated code, 26579 // while all odd indices are the newlines between two adjacent lines 26580 // (since `REGEX_NEWLINE` captures its match). 26581 // Processed fragments are removed from this array, by calling `shiftNextLine`. 26582 var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); 26583 var shiftNextLine = function() { 26584 var lineContents = remainingLines.shift(); 26585 // The last line of a file might not have a newline. 26586 var newLine = remainingLines.shift() || ""; 26587 return lineContents + newLine; 26588 }; 26589 26590 // We need to remember the position of "remainingLines" 26591 var lastGeneratedLine = 1, lastGeneratedColumn = 0; 26592 26593 // The generate SourceNodes we need a code range. 26594 // To extract it current and last mapping is used. 26595 // Here we store the last mapping. 26596 var lastMapping = null; 26597 26598 aSourceMapConsumer.eachMapping(function (mapping) { 26599 if (lastMapping !== null) { 26600 // We add the code from "lastMapping" to "mapping": 26601 // First check if there is a new line in between. 26602 if (lastGeneratedLine < mapping.generatedLine) { 26603 var code = ""; 26604 // Associate first line with "lastMapping" 26605 addMappingWithCode(lastMapping, shiftNextLine()); 26606 lastGeneratedLine++; 26607 lastGeneratedColumn = 0; 26608 // The remaining code is added without mapping 26609 } else { 26610 // There is no new line in between. 26611 // Associate the code between "lastGeneratedColumn" and 26612 // "mapping.generatedColumn" with "lastMapping" 26613 var nextLine = remainingLines[0]; 26614 var code = nextLine.substr(0, mapping.generatedColumn - 26615 lastGeneratedColumn); 26616 remainingLines[0] = nextLine.substr(mapping.generatedColumn - 26617 lastGeneratedColumn); 26618 lastGeneratedColumn = mapping.generatedColumn; 26619 addMappingWithCode(lastMapping, code); 26620 // No more remaining code, continue 26621 lastMapping = mapping; 26622 return; 26623 } 26624 } 26625 // We add the generated code until the first mapping 26626 // to the SourceNode without any mapping.
vendor: 21,410 bytes, lines 26627-27329
26627 // Each line is added as separate string. 26628 while (lastGeneratedLine < mapping.generatedLine) { 26629 node.add(shiftNextLine()); 26630 lastGeneratedLine++; 26631 } 26632 if (lastGeneratedColumn < mapping.generatedColumn) { 26633 var nextLine = remainingLines[0]; 26634 node.add(nextLine.substr(0, mapping.generatedColumn)); 26635 remainingLines[0] = nextLine.substr(mapping.generatedColumn); 26636 lastGeneratedColumn = mapping.generatedColumn; 26637 } 26638 lastMapping = mapping; 26639 }, this); 26640 // We have processed all mappings. 26641 if (remainingLines.length > 0) { 26642 if (lastMapping) { 26643 // Associate the remaining code in the current line with "lastMapping" 26644 addMappingWithCode(lastMapping, shiftNextLine()); 26645 } 26646 // and add the remaining lines without any mapping 26647 node.add(remainingLines.join("")); 26648 } 26649 26650 // Copy sourcesContent into SourceNode 26651 aSourceMapConsumer.sources.forEach(function (sourceFile) { 26652 var content = aSourceMapConsumer.sourceContentFor(sourceFile); 26653 if (content != null) { 26654 if (aRelativePath != null) { 26655 sourceFile = util.join(aRelativePath, sourceFile); 26656 } 26657 node.setSourceContent(sourceFile, content); 26658 } 26659 }); 26660 26661 return node; 26662 26663 function addMappingWithCode(mapping, code) { 26664 if (mapping === null || mapping.source === undefined) { 26665 node.add(code); 26666 } else { 26667 var source = aRelativePath 26668 ? util.join(aRelativePath, mapping.source) 26669 : mapping.source; 26670 node.add(new SourceNode(mapping.originalLine, 26671 mapping.originalColumn, 26672 source, 26673 code, 26674 mapping.name)); 26675 } 26676 } 26677 }; 26678 26679 /** 26680 * Add a chunk of generated JS to this source node. 26681 * 26682 * @param aChunk A string snippet of generated JS code, another instance of 26683 * SourceNode, or an array where each member is one of those things. 26684 */ 26685 SourceNode.prototype.add = function SourceNode_add(aChunk) { 26686 if (Array.isArray(aChunk)) { 26687 aChunk.forEach(function (chunk) { 26688 this.add(chunk); 26689 }, this); 26690 } 26691 else if (aChunk[isSourceNode] || typeof aChunk === "string") { 26692 if (aChunk) { 26693 this.children.push(aChunk); 26694 } 26695 } 26696 else { 26697 throw new TypeError( 26698 "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk 26699 ); 26700 } 26701 return this; 26702 }; 26703 26704 /** 26705 * Add a chunk of generated JS to the beginning of this source node. 26706 * 26707 * @param aChunk A string snippet of generated JS code, another instance of 26708 * SourceNode, or an array where each member is one of those things. 26709 */ 26710 SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { 26711 if (Array.isArray(aChunk)) { 26712 for (var i = aChunk.length-1; i >= 0; i--) { 26713 this.prepend(aChunk[i]); 26714 } 26715 } 26716 else if (aChunk[isSourceNode] || typeof aChunk === "string") { 26717 this.children.unshift(aChunk); 26718 } 26719 else { 26720 throw new TypeError( 26721 "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk 26722 ); 26723 } 26724 return this; 26725 }; 26726 26727 /** 26728 * Walk over the tree of JS snippets in this node and its children. The 26729 * walking function is called once for each snippet of JS and is passed that 26730 * snippet and the its original associated source's line/column location. 26731 * 26732 * @param aFn The traversal function. 26733 */ 26734 SourceNode.prototype.walk = function SourceNode_walk(aFn) { 26735 var chunk; 26736 for (var i = 0, len = this.children.length; i < len; i++) { 26737 chunk = this.children[i]; 26738 if (chunk[isSourceNode]) { 26739 chunk.walk(aFn); 26740 } 26741 else { 26742 if (chunk !== '') { 26743 aFn(chunk, { source: this.source, 26744 line: this.line, 26745 column: this.column, 26746 name: this.name }); 26747 } 26748 } 26749 } 26750 }; 26751 26752 /** 26753 * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between 26754 * each of `this.children`. 26755 * 26756 * @param aSep The separator. 26757 */ 26758 SourceNode.prototype.join = function SourceNode_join(aSep) { 26759 var newChildren; 26760 var i; 26761 var len = this.children.length; 26762 if (len > 0) { 26763 newChildren = []; 26764 for (i = 0; i < len-1; i++) { 26765 newChildren.push(this.children[i]); 26766 newChildren.push(aSep); 26767 } 26768 newChildren.push(this.children[i]); 26769 this.children = newChildren; 26770 } 26771 return this; 26772 }; 26773 26774 /** 26775 * Call String.prototype.replace on the very right-most source snippet. Useful 26776 * for trimming whitespace from the end of a source node, etc. 26777 * 26778 * @param aPattern The pattern to replace. 26779 * @param aReplacement The thing to replace the pattern with. 26780 */ 26781 SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { 26782 var lastChild = this.children[this.children.length - 1]; 26783 if (lastChild[isSourceNode]) { 26784 lastChild.replaceRight(aPattern, aReplacement); 26785 } 26786 else if (typeof lastChild === 'string') { 26787 this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); 26788 } 26789 else { 26790 this.children.push(''.replace(aPattern, aReplacement)); 26791 } 26792 return this; 26793 }; 26794 26795 /** 26796 * Set the source content for a source file. This will be added to the SourceMapGenerator 26797 * in the sourcesContent field. 26798 * 26799 * @param aSourceFile The filename of the source file 26800 * @param aSourceContent The content of the source file 26801 */ 26802 SourceNode.prototype.setSourceContent = 26803 function SourceNode_setSourceContent(aSourceFile, aSourceContent) { 26804 this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; 26805 }; 26806 26807 /** 26808 * Walk over the tree of SourceNodes. The walking function is called for each 26809 * source file content and is passed the filename and source content. 26810 * 26811 * @param aFn The traversal function. 26812 */ 26813 SourceNode.prototype.walkSourceContents = 26814 function SourceNode_walkSourceContents(aFn) { 26815 for (var i = 0, len = this.children.length; i < len; i++) { 26816 if (this.children[i][isSourceNode]) { 26817 this.children[i].walkSourceContents(aFn); 26818 } 26819 } 26820 26821 var sources = Object.keys(this.sourceContents); 26822 for (var i = 0, len = sources.length; i < len; i++) { 26823 aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); 26824 } 26825 }; 26826 26827 /** 26828 * Return the string representation of this source node. Walks over the tree 26829 * and concatenates all the various snippets together to one string. 26830 */ 26831 SourceNode.prototype.toString = function SourceNode_toString() { 26832 var str = ""; 26833 this.walk(function (chunk) { 26834 str += chunk; 26835 }); 26836 return str; 26837 }; 26838 26839 /** 26840 * Returns the string representation of this source node along with a source 26841 * map. 26842 */ 26843 SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { 26844 var generated = { 26845 code: "", 26846 line: 1, 26847 column: 0 26848 }; 26849 var map = new SourceMapGenerator(aArgs); 26850 var sourceMappingActive = false; 26851 var lastOriginalSource = null; 26852 var lastOriginalLine = null; 26853 var lastOriginalColumn = null; 26854 var lastOriginalName = null; 26855 this.walk(function (chunk, original) { 26856 generated.code += chunk; 26857 if (original.source !== null 26858 && original.line !== null 26859 && original.column !== null) { 26860 if(lastOriginalSource !== original.source 26861 || lastOriginalLine !== original.line 26862 || lastOriginalColumn !== original.column 26863 || lastOriginalName !== original.name) { 26864 map.addMapping({ 26865 source: original.source, 26866 original: { 26867 line: original.line, 26868 column: original.column 26869 }, 26870 generated: { 26871 line: generated.line, 26872 column: generated.column 26873 }, 26874 name: original.name 26875 }); 26876 } 26877 lastOriginalSource = original.source; 26878 lastOriginalLine = original.line; 26879 lastOriginalColumn = original.column; 26880 lastOriginalName = original.name; 26881 sourceMappingActive = true; 26882 } else if (sourceMappingActive) { 26883 map.addMapping({ 26884 generated: { 26885 line: generated.line, 26886 column: generated.column 26887 } 26888 }); 26889 lastOriginalSource = null; 26890 sourceMappingActive = false; 26891 } 26892 for (var idx = 0, length = chunk.length; idx < length; idx++) { 26893 if (chunk.charCodeAt(idx) === NEWLINE_CODE) { 26894 generated.line++; 26895 generated.column = 0; 26896 // Mappings end at eol 26897 if (idx + 1 === length) { 26898 lastOriginalSource = null; 26899 sourceMappingActive = false; 26900 } else if (sourceMappingActive) { 26901 map.addMapping({ 26902 source: original.source, 26903 original: { 26904 line: original.line, 26905 column: original.column 26906 }, 26907 generated: { 26908 line: generated.line, 26909 column: generated.column 26910 }, 26911 name: original.name 26912 }); 26913 } 26914 } else { 26915 generated.column++; 26916 } 26917 } 26918 }); 26919 this.walkSourceContents(function (sourceFile, sourceContent) { 26920 map.setSourceContent(sourceFile, sourceContent); 26921 }); 26922 26923 return { code: generated.code, map: map }; 26924 }; 26925 26926 exports.SourceNode = SourceNode; 26927 26928}); 26929 26930},{"./source-map-generator":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/source-map-generator.js","./util":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/util.js","amdefine":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/amdefine/amdefine.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/source-map/lib/source-map/util.js":[function(require,module,exports){ 26931/* -*- Mode: js; js-indent-level: 2; -*- */ 26932/* 26933 * Copyright 2011 Mozilla Foundation and contributors 26934 * Licensed under the New BSD license. See LICENSE or: 26935 * http://opensource.org/licenses/BSD-3-Clause 26936 */ 26937if (typeof define !== 'function') { 26938 var define = require('amdefine')(module, require); 26939} 26940define(function (require, exports, module) { 26941 26942 /** 26943 * This is a helper function for getting values from parameter/options 26944 * objects. 26945 * 26946 * @param args The object we are extracting values from 26947 * @param name The name of the property we are getting. 26948 * @param defaultValue An optional value to return if the property is missing 26949 * from the object. If this is not specified and the property is missing, an 26950 * error will be thrown. 26951 */ 26952 function getArg(aArgs, aName, aDefaultValue) { 26953 if (aName in aArgs) { 26954 return aArgs[aName]; 26955 } else if (arguments.length === 3) { 26956 return aDefaultValue; 26957 } else { 26958 throw new Error('"' + aName + '" is a required argument.'); 26959 } 26960 } 26961 exports.getArg = getArg; 26962 26963 var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; 26964 var dataUrlRegexp = /^data:.+\,.+$/; 26965 26966 function urlParse(aUrl) { 26967 var match = aUrl.match(urlRegexp); 26968 if (!match) { 26969 return null; 26970 } 26971 return { 26972 scheme: match[1], 26973 auth: match[2], 26974 host: match[3], 26975 port: match[4], 26976 path: match[5] 26977 }; 26978 } 26979 exports.urlParse = urlParse; 26980 26981 function urlGenerate(aParsedUrl) { 26982 var url = ''; 26983 if (aParsedUrl.scheme) { 26984 url += aParsedUrl.scheme + ':'; 26985 } 26986 url += '//'; 26987 if (aParsedUrl.auth) { 26988 url += aParsedUrl.auth + '@'; 26989 } 26990 if (aParsedUrl.host) { 26991 url += aParsedUrl.host; 26992 } 26993 if (aParsedUrl.port) { 26994 url += ":" + aParsedUrl.port 26995 } 26996 if (aParsedUrl.path) { 26997 url += aParsedUrl.path; 26998 } 26999 return url; 27000 } 27001 exports.urlGenerate = urlGenerate; 27002 27003 /** 27004 * Normalizes a path, or the path portion of a URL: 27005 * 27006 * - Replaces consequtive slashes with one slash. 27007 * - Removes unnecessary '.' parts. 27008 * - Removes unnecessary '<dir>/..' parts. 27009 * 27010 * Based on code in the Node.js 'path' core module. 27011 * 27012 * @param aPath The path or url to normalize. 27013 */ 27014 function normalize(aPath) { 27015 var path = aPath; 27016 var url = urlParse(aPath); 27017 if (url) { 27018 if (!url.path) { 27019 return aPath; 27020 } 27021 path = url.path; 27022 } 27023 var isAbsolute = (path.charAt(0) === '/'); 27024 27025 var parts = path.split(/\/+/); 27026 for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { 27027 part = parts[i]; 27028 if (part === '.') { 27029 parts.splice(i, 1); 27030 } else if (part === '..') { 27031 up++; 27032 } else if (up > 0) { 27033 if (part === '') { 27034 // The first part is blank if the path is absolute. Trying to go 27035 // above the root is a no-op. Therefore we can remove all '..' parts 27036 // directly after the root. 27037 parts.splice(i + 1, up); 27038 up = 0; 27039 } else { 27040 parts.splice(i, 2); 27041 up--; 27042 } 27043 } 27044 } 27045 path = parts.join('/'); 27046 27047 if (path === '') { 27048 path = isAbsolute ? '/' : '.'; 27049 } 27050 27051 if (url) { 27052 url.path = path; 27053 return urlGenerate(url); 27054 } 27055 return path; 27056 } 27057 exports.normalize = normalize; 27058 27059 /** 27060 * Joins two paths/URLs. 27061 * 27062 * @param aRoot The root path or URL. 27063 * @param aPath The path or URL to be joined with the root. 27064 * 27065 * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a 27066 * scheme-relative URL: Then the scheme of aRoot, if any, is prepended 27067 * first. 27068 * - Otherwise aPath is a path. If aRoot is a URL, then its path portion 27069 * is updated with the result and aRoot is returned. Otherwise the result 27070 * is returned. 27071 * - If aPath is absolute, the result is aPath. 27072 * - Otherwise the two paths are joined with a slash. 27073 * - Joining for example 'http://' and 'www.example.com' is also supported. 27074 */ 27075 function join(aRoot, aPath) { 27076 if (aRoot === "") { 27077 aRoot = "."; 27078 } 27079 if (aPath === "") { 27080 aPath = "."; 27081 } 27082 var aPathUrl = urlParse(aPath); 27083 var aRootUrl = urlParse(aRoot); 27084 if (aRootUrl) { 27085 aRoot = aRootUrl.path || '/'; 27086 } 27087 27088 // `join(foo, '//www.example.org')` 27089 if (aPathUrl && !aPathUrl.scheme) { 27090 if (aRootUrl) { 27091 aPathUrl.scheme = aRootUrl.scheme; 27092 } 27093 return urlGenerate(aPathUrl); 27094 } 27095 27096 if (aPathUrl || aPath.match(dataUrlRegexp)) { 27097 return aPath; 27098 } 27099 27100 // `join('http://', 'www.example.com')` 27101 if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { 27102 aRootUrl.host = aPath; 27103 return urlGenerate(aRootUrl); 27104 } 27105 27106 var joined = aPath.charAt(0) === '/' 27107 ? aPath 27108 : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); 27109 27110 if (aRootUrl) { 27111 aRootUrl.path = joined; 27112 return urlGenerate(aRootUrl); 27113 } 27114 return joined; 27115 } 27116 exports.join = join; 27117 27118 /** 27119 * Make a path relative to a URL or another path. 27120 * 27121 * @param aRoot The root path or URL. 27122 * @param aPath The path or URL to be made relative to aRoot. 27123 */ 27124 function relative(aRoot, aPath) { 27125 if (aRoot === "") { 27126 aRoot = "."; 27127 } 27128 27129 aRoot = aRoot.replace(/\/$/, ''); 27130 27131 // It is possible for the path to be above the root. In this case, simply 27132 // checking whether the root is a prefix of the path won't work. Instead, we 27133 // need to remove components from the root one by one, until either we find 27134 // a prefix that fits, or we run out of components to remove. 27135 var level = 0; 27136 while (aPath.indexOf(aRoot + '/') !== 0) { 27137 var index = aRoot.lastIndexOf("/"); 27138 if (index < 0) { 27139 return aPath; 27140 } 27141 27142 // If the only part of the root that is left is the scheme (i.e. http://, 27143 // file:///, etc.), one or more slashes (/), or simply nothing at all, we 27144 // have exhausted all components, so the path is not relative to the root. 27145 aRoot = aRoot.slice(0, index); 27146 if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { 27147 return aPath; 27148 } 27149 27150 ++level; 27151 } 27152 27153 // Make sure we add a "../" for each component we removed from the root. 27154 return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); 27155 } 27156 exports.relative = relative; 27157 27158 /** 27159 * Because behavior goes wacky when you set `__proto__` on objects, we 27160 * have to prefix all the strings in our set with an arbitrary character. 27161 * 27162 * See https://github.com/mozilla/source-map/pull/31 and 27163 * https://github.com/mozilla/source-map/issues/30 27164 * 27165 * @param String aStr 27166 */ 27167 function toSetString(aStr) { 27168 return '$' + aStr; 27169 } 27170 exports.toSetString = toSetString; 27171 27172 function fromSetString(aStr) { 27173 return aStr.substr(1); 27174 } 27175 exports.fromSetString = fromSetString; 27176 27177 /** 27178 * Comparator between two mappings where the original positions are compared. 27179 * 27180 * Optionally pass in `true` as `onlyCompareGenerated` to consider two 27181 * mappings with the same original source/line/column, but different generated 27182 * line and column the same. Useful when searching for a mapping with a 27183 * stubbed out mapping. 27184 */ 27185 function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { 27186 var cmp = mappingA.source - mappingB.source; 27187 if (cmp !== 0) { 27188 return cmp; 27189 } 27190 27191 cmp = mappingA.originalLine - mappingB.originalLine; 27192 if (cmp !== 0) { 27193 return cmp; 27194 } 27195 27196 cmp = mappingA.originalColumn - mappingB.originalColumn; 27197 if (cmp !== 0 || onlyCompareOriginal) { 27198 return cmp; 27199 } 27200 27201 cmp = mappingA.generatedColumn - mappingB.generatedColumn; 27202 if (cmp !== 0) { 27203 return cmp; 27204 } 27205 27206 cmp = mappingA.generatedLine - mappingB.generatedLine; 27207 if (cmp !== 0) { 27208 return cmp; 27209 } 27210 27211 return mappingA.name - mappingB.name; 27212 }; 27213 exports.compareByOriginalPositions = compareByOriginalPositions; 27214 27215 /** 27216 * Comparator between two mappings with deflated source and name indices where 27217 * the generated positions are compared. 27218 * 27219 * Optionally pass in `true` as `onlyCompareGenerated` to consider two 27220 * mappings with the same generated line and column, but different 27221 * source/name/original line and column the same. Useful when searching for a 27222 * mapping with a stubbed out mapping. 27223 */ 27224 function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { 27225 var cmp = mappingA.generatedLine - mappingB.generatedLine; 27226 if (cmp !== 0) { 27227 return cmp; 27228 } 27229 27230 cmp = mappingA.generatedColumn - mappingB.generatedColumn; 27231 if (cmp !== 0 || onlyCompareGenerated) { 27232 return cmp; 27233 } 27234 27235 cmp = mappingA.source - mappingB.source; 27236 if (cmp !== 0) { 27237 return cmp; 27238 } 27239 27240 cmp = mappingA.originalLine - mappingB.originalLine; 27241 if (cmp !== 0) { 27242 return cmp; 27243 } 27244 27245 cmp = mappingA.originalColumn - mappingB.originalColumn; 27246 if (cmp !== 0) { 27247 return cmp; 27248 } 27249 27250 return mappingA.name - mappingB.name; 27251 }; 27252 exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; 27253 27254 function strcmp(aStr1, aStr2) { 27255 if (aStr1 === aStr2) { 27256 return 0; 27257 } 27258 27259 if (aStr1 > aStr2) { 27260 return 1; 27261 } 27262 27263 return -1; 27264 } 27265 27266 /** 27267 * Comparator between two mappings with inflated source and name strings where 27268 * the generated positions are compared. 27269 */ 27270 function compareByGeneratedPositionsInflated(mappingA, mappingB) { 27271 var cmp = mappingA.generatedLine - mappingB.generatedLine; 27272 if (cmp !== 0) { 27273 return cmp; 27274 } 27275 27276 cmp = mappingA.generatedColumn - mappingB.generatedColumn; 27277 if (cmp !== 0) { 27278 return cmp; 27279 } 27280 27281 cmp = strcmp(mappingA.source, mappingB.source); 27282 if (cmp !== 0) { 27283 return cmp; 27284 } 27285 27286 cmp = mappingA.originalLine - mappingB.originalLine; 27287 if (cmp !== 0) { 27288 return cmp; 27289 } 27290 27291 cmp = mappingA.originalColumn - mappingB.originalColumn; 27292 if (cmp !== 0) { 27293 return cmp; 27294 } 27295 27296 return strcmp(mappingA.name, mappingB.name); 27297 }; 27298 exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; 27299 27300}); 27301 27302},{"amdefine":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/amdefine/amdefine.js"}],"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/src/js/main":[function(require,module,exports){ 27303(function (global){ 27304global.$ = global.jQuery = require('jquery'); 27305var foundation = require('../../node_modules/foundation-sites/dist/foundation.js'); 27306var Handlebars = require('handlebars'); 27307 27308+function() { 27309 // Load all foundation scripts 27310 $(document).foundation(); 27311 27312 // Search functionality object 27313 var search = { 27314 currentPage: 0, 27315 // Call request with query on form submission 27316 request: function() { 27317 var that = this; 27318 var sort = search.getSort(); 27319 var query = search.getQuery(); 27320 var currentPage = search.currentPage; 27321 27322 var sortStr = ''; 27323 // Build sort if it exists 27324 if (sort.length > 0) sortStr = '&sort=' + sort; 27325 27326 var startStr = ''; 27327 if (currentPage > 1) startStr = '&start=' + (currentPage * 10); 27328 27329 $.ajax({
27330 url: 'https://www.googleapis.com/customsearch/v1?q=' + query + '&cx=011959165799163814160:hkizrflkr9e&key=AIzaSyCMGfdDaSfjqv5zYoS0mTJnOT3e9MURWkU' + sortStr + startStr 27331 }).done(that.handler); 27332 }, 27333 // Automatically handle the results 27334 handler: function(results) { 27335 // Update meta data automatically 27336 search.updateMeta(results); 27337 // Grab the results template 27338 var source = $("#result-template").html(); 27339 var template = Handlebars.compile(source); 27340 27341 // Empty results for new query 27342 $('#results').empty(); 27343 27344 // Empty results for new query 27345 $('.pagination').empty(); 27346 27347 if (results.items){ 27348 for (var i = 0; i < results.items.length; i++) { 27349 // Append each template to the main results div 27350 $('#results').append(template(results.items[i])); 27351 } 27352 } 27353 27354 // Build pagination 27355 search.buildPagination(results); 27356 }, 27357 updateMeta: function(results) { 27358 $('#searchInformation').html('About ' + results.queries.request[0].totalResults + ' Results (' + results.searchInformation.formattedSearchTime + ' seconds)'); 27359 }, 27360 getQuery: function() { 27361 return $('.search-form').find('.search-input').val(); 27362 }, 27363 getSort: function() { 27364 return $('#sortBy').val(); 27365 }, 27366 buildPagination: function(results) { 27367 var currentPage = search.currentPage; 27368 var range = 4; 27369 var totalResults = results.queries.request[0].totalResults; 27370 var resultCountPerPage = results.queries.request[0].count; 27371 27372 var totalPages = (totalResults/resultCountPerPage); 27373 27374 // Grab the results template 27375 var source = $("#pagination-template").html(); 27376 var template = Handlebars.compile(source); 27377 27378 for (var i = 0; i < totalPages; i++) { 27379 // Append each template to the main results div 27380 if (i == currentPage) { 27381 $(template(i+1)).addClass('current').appendTo('.pagination'); 27382 } else if (i >= (currentPage - range) && i <= (currentPage + range)) { 27383 $('.pagination').append(template(i+1)); 27384 } 27385 } 27386 27387 if ($('.pagination li:first-child a').html() != '1') { 27388 $(template()).addClass('ellipsis').prependTo('.pagination'); 27389 $(template(1)).prependTo('.pagination'); 27390 } 27391 27392 if ($('.pagination li:last-child a').html() < totalPages) { 27393 $(template()).addClass('ellipsis').appendTo('.pagination'); 27394 } 27395 } 27396 }; 27397 27398 // Attach events when document is ready 27399 $(document).ready(function(){ 27400 // Trigger the menu UI in the header 27401 $('.hamburger').on('click', function(e){ 27402 e.preventDefault(); 27403 $(this).toggleClass('open'); 27404 $('body').toggleClass('dim nav'); 27405 }); 27406 27407 // Trigger the search UI in the header 27408 $('.search-action').on('click', function(e){ 27409 e.preventDefault(); 27410 $(this).toggleClass('open'); 27411 $('body').toggleClass('dim search'); 27412 $('.search-input').trigger('focus'); 27413 }); 27414 27415 // Form submission listener 27416 $('.search-form').on('submit', function(e) { 27417 dow.location.replace(query); 27418 // } 27419 e.preventDefault(); 27420 }); 27421 27422 // Form sort listener 27423 $('#sortBy').on('change', function() { 27424 search.currentPage = 0; 27425 }); 27426 }); 27427}(); 27428 27429}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 27430},{"../../node_modules/foundation-sites/dist/foundation.js":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/foundation-sites/dist/foundation.js","handlebars":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/handlebars/lib/index.js","jquery":"/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/node_modules/jquery/dist/jquery.js"}]},{},["/Users/beckandstone/Sites/nationalaffairs_CMS/themes/national_affairs/src/js/main"]); 27431 27432//# sourceMappingURL=bundle.js.map
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.