vendor: 5,570 bytes, lines 1-165
1/** vim: et:ts=4:sw=4:sts=4 2 * @license RequireJS 2.1.22 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved. 3 * Available via the MIT or new BSD license. 4 * see: http://github.com/jrburke/requirejs for details 5 */ 6//Not using strict: uneven strict support in browsers, #392, and causes 7//problems with requirejs.exec()/transpiler plugins that may not be strict. 8/*jslint regexp: true, nomen: true, sloppy: true */ 9/*global window, navigator, document, importScripts, setTimeout, opera */ 10 11var requirejs, require, define; 12(function (global) { 13 var req, s, head, baseElement, dataMain, src, 14 interactiveScript, currentlyAddingScript, mainScript, subPath, 15 version = '2.1.22', 16 commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg, 17 cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, 18 jsSuffixRegExp = /\.js$/, 19 currDirRegExp = /^\.\//, 20 op = Object.prototype, 21 ostring = op.toString, 22 hasOwn = op.hasOwnProperty, 23 ap = Array.prototype, 24 isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document), 25 isWebWorker = !isBrowser && typeof importScripts !== 'undefined', 26 //PS3 indicates loaded and complete, but need to wait for complete 27 //specifically. Sequence is 'loading', 'loaded', execution, 28 // then 'complete'. The UA check is unfortunate, but not sure how 29 //to feature test w/o causing perf issues. 30 readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ? 31 /^complete$/ : /^(complete|loaded)$/, 32 defContextName = '_', 33 //Oh the tragedy, detecting opera. See the usage of isOpera for reason. 34 isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]', 35 contexts = {}, 36 cfg = {}, 37 globalDefQueue = [], 38 useInteractive = false; 39 40 function isFunction(it) { 41 return ostring.call(it) === '[object Function]'; 42 } 43 44 function isArray(it) { 45 return ostring.call(it) === '[object Array]'; 46 } 47 48 /** 49 * Helper function for iterating over an array. If the func returns 50 * a true value, it will break out of the loop. 51 */ 52 function each(ary, func) { 53 if (ary) { 54 var i; 55 for (i = 0; i < ary.length; i += 1) { 56 if (ary[i] && func(ary[i], i, ary)) { 57 break; 58 } 59 } 60 } 61 } 62 63 /** 64 * Helper function for iterating over an array backwards. If the func 65 * returns a true value, it will break out of the loop. 66 */ 67 function eachReverse(ary, func) { 68 if (ary) { 69 var i; 70 for (i = ary.length - 1; i > -1; i -= 1) { 71 if (ary[i] && func(ary[i], i, ary)) { 72 break; 73 } 74 } 75 } 76 } 77 78 function hasProp(obj, prop) { 79 return hasOwn.call(obj, prop); 80 } 81 82 function getOwn(obj, prop) { 83 return hasProp(obj, prop) && obj[prop]; 84 } 85 86 /** 87 * Cycles over properties in an object and calls a function for each 88 * property value. If the function returns a truthy value, then the 89 * iteration is stopped. 90 */ 91 function eachProp(obj, func) { 92 var prop; 93 for (prop in obj) { 94 if (hasProp(obj, prop)) { 95 if (func(obj[prop], prop)) { 96 break; 97 } 98 } 99 } 100 } 101 102 /** 103 * Simple function to mix in properties from source into target, 104 * but only if target does not already have a property of the same name. 105 */ 106 function mixin(target, source, force, deepStringMixin) { 107 if (source) { 108 eachProp(source, function (value, prop) { 109 if (force || !hasProp(target, prop)) { 110 if (deepStringMixin && typeof value === 'object' && value && 111 !isArray(value) && !isFunction(value) && 112 !(value instanceof RegExp)) { 113 114 if (!target[prop]) { 115 target[prop] = {}; 116 } 117 mixin(target[prop], value, force, deepStringMixin); 118 } else { 119 target[prop] = value; 120 } 121 } 122 }); 123 } 124 return target; 125 } 126 127 //Similar to Function.prototype.bind, but the 'this' object is specified 128 //first, since it is easier to read/figure out what 'this' will be. 129 function bind(obj, fn) { 130 return function () { 131 return fn.apply(obj, arguments); 132 }; 133 } 134 135 function scripts() { 136 return document.getElementsByTagName('script'); 137 } 138 139 function defaultOnError(err) { 140 throw err; 141 } 142 143 //Allow getting a global that is expressed in 144 //dot notation, like 'a.b.c'. 145 function getGlobal(value) { 146 if (!value) { 147 return value; 148 } 149 var g = global; 150 each(value.split('.'), function (part) { 151 g = g[part]; 152 }); 153 return g; 154 } 155 156 /** 157 * Constructs an error with a pointer to an URL with more information. 158 * @param {String} id the error ID that maps to an ID on a web page. 159 * @param {String} message human readable error. 160 * @param {Error} [err] the original error, if there is one. 161 * 162 * @returns {Error} 163 */ 164 function makeError(id, msg, err, requireModules) { 165 var e = new Error(msg + '\nhttp
vendor: 27,045 bytes, lines 165-864
165://requirejs.org/docs/errors.html#' + id); 166 e.requireType = id; 167 e.requireModules = requireModules; 168 if (err) { 169 e.originalError = err; 170 } 171 return e; 172 } 173 174 if (typeof define !== 'undefined') { 175 //If a define is already in play via another AMD loader, 176 //do not overwrite. 177 return; 178 } 179 180 if (typeof requirejs !== 'undefined') { 181 if (isFunction(requirejs)) { 182 //Do not overwrite an existing requirejs instance. 183 return; 184 } 185 cfg = requirejs; 186 requirejs = undefined; 187 } 188 189 //Allow for a require config object 190 if (typeof require !== 'undefined' && !isFunction(require)) { 191 //assume it is a config object. 192 cfg = require; 193 require = undefined; 194 } 195 196 function newContext(contextName) { 197 var inCheckLoaded, Module, context, handlers, 198 checkLoadedTimeoutId, 199 config = { 200 //Defaults. Do not set a default for map 201 //config to speed up normalize(), which 202 //will run faster if there is no default. 203 waitSeconds: 7, 204 baseUrl: './', 205 paths: {}, 206 bundles: {}, 207 pkgs: {}, 208 shim: {}, 209 config: {} 210 }, 211 registry = {}, 212 //registry of just enabled modules, to speed 213 //cycle breaking code when lots of modules 214 //are registered, but not activated. 215 enabledRegistry = {}, 216 undefEvents = {}, 217 defQueue = [], 218 defined = {}, 219 urlFetched = {}, 220 bundlesMap = {}, 221 requireCounter = 1, 222 unnormalizedCounter = 1; 223 224 /** 225 * Trims the . and .. from an array of path segments. 226 * It will keep a leading path segment if a .. will become 227 * the first path segment, to help with module name lookups, 228 * which act like paths, but can be remapped. But the end result, 229 * all paths that use this function should look normalized. 230 * NOTE: this method MODIFIES the input array. 231 * @param {Array} ary the array of path segments. 232 */ 233 function trimDots(ary) { 234 var i, part; 235 for (i = 0; i < ary.length; i++) { 236 part = ary[i]; 237 if (part === '.') { 238 ary.splice(i, 1); 239 i -= 1; 240 } else if (part === '..') { 241 // If at the start, or previous value is still .., 242 // keep them so that when converted to a path it may 243 // still work when converted to a path, even though 244 // as an ID it is less than ideal. In larger point 245 // releases, may be better to just kick out an error. 246 if (i === 0 || (i === 1 && ary[2] === '..') || ary[i - 1] === '..') { 247 continue; 248 } else if (i > 0) { 249 ary.splice(i - 1, 2); 250 i -= 2; 251 } 252 } 253 } 254 } 255 256 /** 257 * Given a relative module name, like ./something, normalize it to 258 * a real name that can be mapped to a path. 259 * @param {String} name the relative name 260 * @param {String} baseName a real name that the name arg is relative 261 * to. 262 * @param {Boolean} applyMap apply the map config to the value. Should 263 * only be done if this normalization is for a dependency ID. 264 * @returns {String} normalized name 265 */ 266 function normalize(name, baseName, applyMap) { 267 var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex, 268 foundMap, foundI, foundStarMap, starI, normalizedBaseParts, 269 baseParts = (baseName && baseName.split('/')), 270 map = config.map, 271 starMap = map && map['*']; 272 273 //Adjust any relative paths. 274 if (name) { 275 name = name.split('/'); 276 lastIndex = name.length - 1; 277 278 // If wanting node ID compatibility, strip .js from end 279 // of IDs. Have to do this here, and not in nameToUrl 280 // because node allows either .js or non .js to map 281 // to same file. 282 if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { 283 name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); 284 } 285 286 // Starts with a '.' so need the baseName 287 if (name[0].charAt(0) === '.' && baseParts) { 288 //Convert baseName to array, and lop off the last part, 289 //so that . matches that 'directory' and not name of the baseName's 290 //module. For instance, baseName of 'one/two/three', maps to 291 //'one/two/three.js', but we want the directory, 'one/two' for 292 //this normalization. 293 normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); 294 name = normalizedBaseParts.concat(name); 295 } 296 297 trimDots(name); 298 name = name.join('/'); 299 } 300 301 //Apply map config if available. 302 if (applyMap && map && (baseParts || starMap)) { 303 nameParts = name.split('/'); 304 305 outerLoop: for (i = nameParts.length; i > 0; i -= 1) { 306 nameSegment = nameParts.slice(0, i).join('/'); 307 308 if (baseParts) { 309 //Find the longest baseName segment match in the config. 310 //So, do joins on the biggest to smallest lengths of baseParts. 311 for (j = baseParts.length; j > 0; j -= 1) { 312 mapValue = getOwn(map, baseParts.slice(0, j).join('/')); 313 314 //baseName segment has config, find if it has one for 315 //this name. 316 if (mapValue) { 317 mapValue = getOwn(mapValue, nameSegment); 318 if (mapValue) { 319 //Match, update name to the new value. 320 foundMap = mapValue; 321 foundI = i; 322 break outerLoop; 323 } 324 } 325 } 326 } 327 328 //Check for a star map match, but just hold on to it, 329 //if there is a shorter segment match later in a matching 330 //config, then favor over this star map. 331 if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) { 332 foundStarMap = getOwn(starMap, nameSegment); 333 starI = i; 334 } 335 } 336 337 if (!foundMap && foundStarMap) { 338 foundMap = foundStarMap; 339 foundI = starI; 340 } 341 342 if (foundMap) { 343 nameParts.splice(0, foundI, foundMap); 344 name = nameParts.join('/'); 345 } 346 } 347 348 // If the name points to a package's name, use 349 // the package main instead. 350 pkgMain = getOwn(config.pkgs, name); 351 352 return pkgMain ? pkgMain : name; 353 } 354 355 function removeScript(name) { 356 if (isBrowser) { 357 each(scripts(), function (scriptNode) { 358 if (scriptNode.getAttribute('data-requiremodule') === name && 359 scriptNode.getAttribute('data-requirecontext') === context.contextName) { 360 scriptNode.parentNode.removeChild(scriptNode); 361 return true; 362 } 363 }); 364 } 365 } 366 367 function hasPathFallback(id) { 368 var pathConfig = getOwn(config.paths, id); 369 if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) { 370 //Pop off the first array value, since it failed, and 371 //retry 372 pathConfig.shift(); 373 context.require.undef(id); 374 375 //Custom require that does not do map translation, since 376 //ID is "absolute", already mapped/resolved. 377 context.makeRequire(null, { 378 skipMap: true 379 })([id]); 380 381 return true; 382 } 383 } 384 385 //Turns a plugin!resource to [plugin, resource] 386 //with the plugin being undefined if the name 387 //did not have a plugin prefix. 388 function splitPrefix(name) { 389 var prefix, 390 index = name ? name.indexOf('!') : -1; 391 if (index > -1) { 392 prefix = name.substring(0, index); 393 name = name.substring(index + 1, name.length); 394 } 395 return [prefix, name]; 396 } 397 398 /** 399 * Creates a module mapping that includes plugin prefix, module 400 * name, and path. If parentModuleMap is provided it will 401 * also normalize the name via require.normalize() 402 * 403 * @param {String} name the module name 404 * @param {String} [parentModuleMap] parent module map 405 * for the module name, used to resolve relative names. 406 * @param {Boolean} isNormalized: is the ID already normalized. 407 * This is true if this call is done for a define() module ID. 408 * @param {Boolean} applyMap: apply the map config to the ID. 409 * Should only be true if this map is for a dependency. 410 * 411 * @returns {Object} 412 */ 413 function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) { 414 var url, pluginModule, suffix, nameParts, 415 prefix = null, 416 parentName = parentModuleMap ? parentModuleMap.name : null, 417 originalName = name, 418 isDefine = true, 419 normalizedName = ''; 420 421 //If no name, then it means it is a require call, generate an 422 //internal name. 423 if (!name) { 424 isDefine = false; 425 name = '_@r' + (requireCounter += 1); 426 } 427 428 nameParts = splitPrefix(name); 429 prefix = nameParts[0]; 430 name = nameParts[1]; 431 432 if (prefix) { 433 prefix = normalize(prefix, parentName, applyMap); 434 pluginModule = getOwn(defined, prefix); 435 } 436 437 //Account for relative paths if there is a base name. 438 if (name) { 439 if (prefix) { 440 if (pluginModule && pluginModule.normalize) { 441 //Plugin is loaded, use its normalize method. 442 normalizedName = pluginModule.normalize(name, function (name) { 443 return normalize(name, parentName, applyMap); 444 }); 445 } else { 446 // If nested plugin references, then do not try to 447 // normalize, as it will not normalize correctly. This 448 // places a restriction on resourceIds, and the longer 449 // term solution is not to normalize until plugins are 450 // loaded and all normalizations to allow for async 451 // loading of a loader plugin. But for now, fixes the 452 // common uses. Details in #1131 453 normalizedName = name.indexOf('!') === -1 ? 454 normalize(name, parentName, applyMap) : 455 name; 456 } 457 } else { 458 //A regular module. 459 normalizedName = normalize(name, parentName, applyMap); 460 461 //Normalized name may be a plugin ID due to map config 462 //application in normalize. The map config values must 463 //already be normalized, so do not need to redo that part. 464 nameParts = splitPrefix(normalizedName); 465 prefix = nameParts[0]; 466 normalizedName = nameParts[1]; 467 isNormalized = true; 468 469 url = context.nameToUrl(normalizedName); 470 } 471 } 472 473 //If the id is a plugin id that cannot be determined if it needs 474 //normalization, stamp it with a unique ID so two matching relative 475 //ids that may conflict can be separate. 476 suffix = prefix && !pluginModule && !isNormalized ? 477 '_unnormalized' + (unnormalizedCounter += 1) : 478 ''; 479 480 return { 481 prefix: prefix, 482 name: normalizedName, 483 parentMap: parentModuleMap, 484 unnormalized: !!suffix, 485 url: url, 486 originalName: originalName, 487 isDefine: isDefine, 488 id: (prefix ? 489 prefix + '!' + normalizedName : 490 normalizedName) + suffix 491 }; 492 } 493 494 function getModule(depMap) { 495 var id = depMap.id, 496 mod = getOwn(registry, id); 497 498 if (!mod) { 499 mod = registry[id] = new context.Module(depMap); 500 } 501 502 return mod; 503 } 504 505 function on(depMap, name, fn) { 506 var id = depMap.id, 507 mod = getOwn(registry, id); 508 509 if (hasProp(defined, id) && 510 (!mod || mod.defineEmitComplete)) { 511 if (name === 'defined') { 512 fn(defined[id]); 513 } 514 } else { 515 mod = getModule(depMap); 516 if (mod.error && name === 'error') { 517 fn(mod.error); 518 } else { 519 mod.on(name, fn); 520 } 521 } 522 } 523 524 function onError(err, errback) { 525 var ids = err.requireModules, 526 notified = false; 527 528 if (errback) { 529 errback(err); 530 } else { 531 each(ids, function (id) { 532 var mod = getOwn(registry, id); 533 if (mod) { 534 //Set error on module, so it skips timeout checks. 535 mod.error = err; 536 if (mod.events.error) { 537 notified = true; 538 mod.emit('error', err); 539 } 540 } 541 }); 542 543 if (!notified) { 544 req.onError(err); 545 } 546 } 547 } 548 549 /** 550 * Internal method to transfer globalQueue items to this context's 551 * defQueue. 552 */ 553 function takeGlobalQueue() { 554 //Push all the globalDefQueue items into the context's defQueue 555 if (globalDefQueue.length) { 556 each(globalDefQueue, function(queueItem) { 557 var id = queueItem[0]; 558 if (typeof id === 'string') { 559 context.defQueueMap[id] = true; 560 } 561 defQueue.push(queueItem); 562 }); 563 globalDefQueue = []; 564 } 565 } 566 567 handlers = { 568 'require': function (mod) { 569 if (mod.require) { 570 return mod.require; 571 } else { 572 return (mod.require = context.makeRequire(mod.map)); 573 } 574 }, 575 'exports': function (mod) { 576 mod.usingExports = true; 577 if (mod.map.isDefine) { 578 if (mod.exports) { 579 return (defined[mod.map.id] = mod.exports); 580 } else { 581 return (mod.exports = defined[mod.map.id] = {}); 582 } 583 } 584 }, 585 'module': function (mod) { 586 if (mod.module) { 587 return mod.module; 588 } else { 589 return (mod.module = { 590 id: mod.map.id, 591 uri: mod.map.url, 592 config: function () { 593 return getOwn(config.config, mod.map.id) || {}; 594 }, 595 exports: mod.exports || (mod.exports = {}) 596 }); 597 } 598 } 599 }; 600 601 function cleanRegistry(id) { 602 //Clean up machinery used for waiting modules. 603 delete registry[id]; 604 delete enabledRegistry[id]; 605 } 606 607 function breakCycle(mod, traced, processed) { 608 var id = mod.map.id; 609 610 if (mod.error) { 611 mod.emit('error', mod.error); 612 } else { 613 traced[id] = true; 614 each(mod.depMaps, function (depMap, i) { 615 var depId = depMap.id, 616 dep = getOwn(registry, depId); 617 618 //Only force things that have not completed 619 //being defined, so still in the registry, 620 //and only if it has not been matched up 621 //in the module already. 622 if (dep && !mod.depMatched[i] && !processed[depId]) { 623 if (getOwn(traced, depId)) { 624 mod.defineDep(i, defined[depId]); 625 mod.check(); //pass false? 626 } else { 627 breakCycle(dep, traced, processed); 628 } 629 } 630 }); 631 processed[id] = true; 632 } 633 } 634 635 function checkLoaded() { 636 var err, usingPathFallback, 637 waitInterval = config.waitSeconds * 1000, 638 //It is possible to disable the wait interval by using waitSeconds of 0. 639 expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(), 640 noLoads = [], 641 reqCalls = [], 642 stillLoading = false, 643 needCycleCheck = true; 644 645 //Do not bother if this call was a result of a cycle break. 646 if (inCheckLoaded) { 647 return; 648 } 649 650 inCheckLoaded = true; 651 652 //Figure out the state of all the modules. 653 eachProp(enabledRegistry, function (mod) { 654 var map = mod.map, 655 modId = map.id; 656 657 //Skip things that are not enabled or in error state. 658 if (!mod.enabled) { 659 return; 660 } 661 662 if (!map.isDefine) { 663 reqCalls.push(mod); 664 } 665 666 if (!mod.error) { 667 //If the module should be executed, and it has not 668 //been inited and time is up, remember it. 669 if (!mod.inited && expired) { 670 if (hasPathFallback(modId)) { 671 usingPathFallback = true; 672 stillLoading = true; 673 } else { 674 noLoads.push(modId); 675 removeScript(modId); 676 } 677 } else if (!mod.inited && mod.fetched && map.isDefine) { 678 stillLoading = true; 679 if (!map.prefix) { 680 //No reason to keep looking for unfinished 681 //loading. If the only stillLoading is a 682 //plugin resource though, keep going, 683 //because it may be that a plugin resource 684 //is waiting on a non-plugin cycle. 685 return (needCycleCheck = false); 686 } 687 } 688 } 689 }); 690 691 if (expired && noLoads.length) { 692 //If wait time expired, throw error of unloaded modules. 693 err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads); 694 err.contextName = context.contextName; 695 return onError(err); 696 } 697 698 //Not expired, check for a cycle. 699 if (needCycleCheck) { 700 each(reqCalls, function (mod) { 701 breakCycle(mod, {}, {}); 702 }); 703 } 704 705 //If still waiting on loads, and the waiting load is something 706 //other than a plugin resource, or there are still outstanding 707 //scripts, then just try back later. 708 if ((!expired || usingPathFallback) && stillLoading) { 709 //Something is still waiting to load. Wait for it, but only 710 //if a timeout is not already in effect. 711 if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) { 712 checkLoadedTimeoutId = setTimeout(function () { 713 checkLoadedTimeoutId = 0; 714 checkLoaded(); 715 }, 50); 716 } 717 } 718 719 inCheckLoaded = false; 720 } 721 722 Module = function (map) { 723 this.events = getOwn(undefEvents, map.id) || {}; 724 this.map = map; 725 this.shim = getOwn(config.shim, map.id); 726 this.depExports = []; 727 this.depMaps = []; 728 this.depMatched = []; 729 this.pluginMaps = {}; 730 this.depCount = 0; 731 732 /* this.exports this.factory 733 this.depMaps = [], 734 this.enabled, this.fetched 735 */ 736 }; 737 738 Module.prototype = { 739 init: function (depMaps, factory, errback, options) { 740 options = options || {}; 741 742 //Do not do more inits if already done. Can happen if there 743 //are multiple define calls for the same module. That is not 744 //a normal, common case, but it is also not unexpected. 745 if (this.inited) { 746 return; 747 } 748 749 this.factory = factory; 750 751 if (errback) { 752 //Register for errors on this module. 753 this.on('error', errback); 754 } else if (this.events.error) { 755 //If no errback already, but there are error listeners 756 //on this module, set up an errback to pass to the deps. 757 errback = bind(this, function (err) { 758 this.emit('error', err); 759 }); 760 } 761 762 //Do a copy of the dependency array, so that 763 //source inputs are not modified. For example 764 //"shim" deps are passed in here directly, and 765 //doing a direct modification of the depMaps array 766 //would affect that config. 767 this.depMaps = depMaps && depMaps.slice(0); 768 769 this.errback = errback; 770 771 //Indicate this module has be initialized 772 this.inited = true; 773 774 this.ignore = options.ignore; 775 776 //Could have option to init this module in enabled mode, 777 //or could have been previously marked as enabled. However, 778 //the dependencies are not known until init is called. So 779 //if enabled previously, now trigger dependencies as enabled. 780 if (options.enabled || this.enabled) { 781 //Enable this module and dependencies. 782 //Will call this.check() 783 this.enable(); 784 } else { 785 this.check(); 786 } 787 }, 788 789 defineDep: function (i, depExports) { 790 //Because of cycles, defined callback for a given 791 //export can be called more than once. 792 if (!this.depMatched[i]) { 793 this.depMatched[i] = true; 794 this.depCount -= 1; 795 this.depExports[i] = depExports; 796 } 797 }, 798 799 fetch: function () { 800 if (this.fetched) { 801 return; 802 } 803 this.fetched = true; 804 805 context.startTime = (new Date()).getTime(); 806 807 var map = this.map; 808 809 //If the manager is for a plugin managed resource, 810 //ask the plugin to load it now. 811 if (this.shim) { 812 context.makeRequire(this.map, { 813 enableBuildCallback: true 814 })(this.shim.deps || [], bind(this, function () { 815 return map.prefix ? this.callPlugin() : this.load(); 816 })); 817 } else { 818 //Regular dependency. 819 return map.prefix ? this.callPlugin() : this.load(); 820 } 821 }, 822 823 load: function () { 824 var url = this.map.url; 825 826 //Regular dependency. 827 if (!urlFetched[url]) { 828 urlFetched[url] = true; 829 context.load(this.map.id, url); 830 } 831 }, 832 833 /** 834 * Checks if the module is ready to define itself, and if so, 835 * define it. 836 */ 837 check: function () { 838 if (!this.enabled || this.enabling) { 839 return; 840 } 841 842 var err, cjsModule, 843 id = this.map.id, 844 depExports = this.depExports, 845 exports = this.exports, 846 factory = this.factory; 847 848 if (!this.inited) { 849 // Only fetch if not already in the defQueue. 850 if (!hasProp(context.defQueueMap, id)) { 851 this.fetch(); 852 } 853 } else if (this.error) { 854 this.emit('error', this.error); 855 } else if (!this.defining) { 856 //The factory could trigger another require call 857 //that would result in checking this module to 858 //define itself again. If already in the process 859 //of doing that, skip this work. 860 this.defining = true; 861 862 if (this.depCount < 1 && !this.defined) { 863 if (isFunction(factory)) { 864
864try { 865 exports = context.execCb(id, factory, depExports, exports); 866 } catch (e) { 867 err = e; 868 } 869 870 // Favor return value over exports. If node/cjs in play, 871 // then will not have a return value anyway. Favor 872 // module.exports assignment over exports object. 873 if (this.map.isDefine && exports === undefined) { 874 cjsModule = this.module; 875 if (cjsModule) { 876 exports = cjsModule.exports; 877 } else if (this.usingExports) { 878 //exports already set the defined value. 879 exports = this.exports; 880 } 881 } 882 883 if (err) { 884 // If there is an error listener, favor passing 885 // to that instead of throwing an error. However, 886 // only do it for define()'d modules. require 887 // errbacks should not be called for failures in 888 // their callbacks (#699). However if a global 889 // onError is set, use that. 890 if ((this.events.error && this.map.isDefine) || 891 req.onError !== defaultOnError) { 892 err.requireMap = this.map; 893 err.requireModules = this.map.isDefine ? [this.map.id] : null; 894 err.requireType = this.map.isDefine ? 'define' : 'require'; 895 return onError((this.error = err)); 896 } else if (typeof console !== 'undefined' && 897 console.error) { 898 // Log the error for debugging. If promises could be 899 // used, this would be different, but making do. 900 console.error(err); 901 } else { 902 // Do not want to completely lose the error. While this 903 // will mess up processing and lead to similar results 904 // as bug 1440, it at least surfaces the error. 905 req.onError(err); 906 } 907 } 908 } else { 909 //Just a literal value 910 exports = factory; 911 } 912 913 this.exports = exports; 914 915 if (this.map.isDefine && !this.ignore) { 916 defined[id] = exports; 917 918 if (req.onResourceLoad) { 919 var resLoadMaps = []; 920 each(this.depMaps, function (depMap) { 921 resLoadMaps.push(depMap.normalizedMap || depMap); 922 }); 923 req.onResourceLoad(context, this.map, resLoadMaps); 924 } 925 } 926 927 //Clean up 928 cleanRegistry(id); 929 930 this.defined = true; 931 } 932 933 //Finished the define stage. Allow calling check again 934 //to allow define notifications below in the case of a 935 //cycle. 936 this.defining = false;
vendor: 14,577 bytes, lines 937-1288
937 938 if (this.defined && !this.defineEmitted) { 939 this.defineEmitted = true; 940 this.emit('defined', this.exports); 941 this.defineEmitComplete = true; 942 } 943 944 } 945 }, 946 947 callPlugin: function () { 948 var map = this.map, 949 id = map.id, 950 //Map already normalized the prefix. 951 pluginMap = makeModuleMap(map.prefix); 952 953 //Mark this as a dependency for this plugin, so it 954 //can be traced for cycles. 955 this.depMaps.push(pluginMap); 956 957 on(pluginMap, 'defined', bind(this, function (plugin) { 958 var load, normalizedMap, normalizedMod, 959 bundleId = getOwn(bundlesMap, this.map.id), 960 name = this.map.name, 961 parentName = this.map.parentMap ? this.map.parentMap.name : null, 962 localRequire = context.makeRequire(map.parentMap, { 963 enableBuildCallback: true 964 }); 965 966 //If current map is not normalized, wait for that 967 //normalized name to load instead of continuing. 968 if (this.map.unnormalized) { 969 //Normalize the ID if the plugin allows it. 970 if (plugin.normalize) { 971 name = plugin.normalize(name, function (name) { 972 return normalize(name, parentName, true); 973 }) || ''; 974 } 975 976 //prefix and name should already be normalized, no need 977 //for applying map config again either. 978 normalizedMap = makeModuleMap(map.prefix + '!' + name, 979 this.map.parentMap); 980 on(normalizedMap, 981 'defined', bind(this, function (value) { 982 this.map.normalizedMap = normalizedMap; 983 this.init([], function () { return value; }, null, { 984 enabled: true, 985 ignore: true 986 }); 987 })); 988 989 normalizedMod = getOwn(registry, normalizedMap.id); 990 if (normalizedMod) { 991 //Mark this as a dependency for this plugin, so it 992 //can be traced for cycles. 993 this.depMaps.push(normalizedMap); 994 995 if (this.events.error) { 996 normalizedMod.on('error', bind(this, function (err) { 997 this.emit('error', err); 998 })); 999 } 1000 normalizedMod.enable(); 1001 } 1002 1003 return; 1004 } 1005 1006 //If a paths config, then just load that file instead to 1007 //resolve the plugin, as it is built into that paths layer. 1008 if (bundleId) { 1009 this.map.url = context.nameToUrl(bundleId); 1010 this.load(); 1011 return; 1012 } 1013 1014 load = bind(this, function (value) { 1015 this.init([], function () { return value; }, null, { 1016 enabled: true 1017 }); 1018 }); 1019 1020 load.error = bind(this, function (err) { 1021 this.inited = true; 1022 this.error = err; 1023 err.requireModules = [id]; 1024 1025 //Remove temp unnormalized modules for this module, 1026 //since they will never be resolved otherwise now. 1027 eachProp(registry, function (mod) { 1028 if (mod.map.id.indexOf(id + '_unnormalized') === 0) { 1029 cleanRegistry(mod.map.id); 1030 } 1031 }); 1032 1033 onError(err); 1034 }); 1035 1036 //Allow plugins to load other code without having to know the 1037 //context or how to 'complete' the load. 1038 load.fromText = bind(this, function (text, textAlt) { 1039 /*jslint evil: true */ 1040 var moduleName = map.name, 1041 moduleMap = makeModuleMap(moduleName), 1042 hasInteractive = useInteractive; 1043 1044 //As of 2.1.0, support just passing the text, to reinforce 1045 //fromText only being called once per resource. Still 1046 //support old style of passing moduleName but discard 1047 //that moduleName in favor of the internal ref. 1048 if (textAlt) { 1049 text = textAlt; 1050 } 1051 1052 //Turn off interactive script matching for IE for any define 1053 //calls in the text, then turn it back on at the end. 1054 if (hasInteractive) { 1055 useInteractive = false; 1056 } 1057 1058 //Prime the system by creating a module instance for 1059 //it. 1060 getModule(moduleMap); 1061 1062 //Transfer any config to this other module. 1063 if (hasProp(config.config, id)) { 1064 config.config[moduleName] = config.config[id]; 1065 } 1066 1067 try { 1068 req.exec(text); 1069 } catch (e) { 1070 return onError(makeError('fromtexteval', 1071 'fromText eval for ' + id + 1072 ' failed: ' + e, 1073 e, 1074 [id])); 1075 } 1076 1077 if (hasInteractive) { 1078 useInteractive = true; 1079 } 1080 1081 //Mark this as a dependency for the plugin 1082 //resource 1083 this.depMaps.push(moduleMap); 1084 1085 //Support anonymous modules. 1086 context.completeLoad(moduleName); 1087 1088 //Bind the value of that module to the value for this 1089 //resource ID. 1090 localRequire([moduleName], load); 1091 }); 1092 1093 //Use parentName here since the plugin's name is not reliable, 1094 //could be some weird string with no path that actually wants to 1095 //reference the parentName's path. 1096 plugin.load(map.name, localRequire, load, config); 1097 })); 1098 1099 context.enable(pluginMap, this); 1100 this.pluginMaps[pluginMap.id] = pluginMap; 1101 }, 1102 1103 enable: function () { 1104 enabledRegistry[this.map.id] = this; 1105 this.enabled = true; 1106 1107 //Set flag mentioning that the module is enabling, 1108 //so that immediate calls to the defined callbacks 1109 //for dependencies do not trigger inadvertent load 1110 //with the depCount still being zero. 1111 this.enabling = true; 1112 1113 //Enable each dependency 1114 each(this.depMaps, bind(this, function (depMap, i) { 1115 var id, mod, handler; 1116 1117 if (typeof depMap === 'string') { 1118 //Dependency needs to be converted to a depMap 1119 //and wired up to this module. 1120 depMap = makeModuleMap(depMap, 1121 (this.map.isDefine ? this.map : this.map.parentMap), 1122 false, 1123 !this.skipMap); 1124 this.depMaps[i] = depMap; 1125 1126 handler = getOwn(handlers, depMap.id); 1127 1128 if (handler) { 1129 this.depExports[i] = handler(this); 1130 return; 1131 } 1132 1133 this.depCount += 1; 1134 1135 on(depMap, 'defined', bind(this, function (depExports) { 1136 if (this.undefed) { 1137 return; 1138 } 1139 this.defineDep(i, depExports); 1140 this.check(); 1141 })); 1142 1143 if (this.errback) { 1144 on(depMap, 'error', bind(this, this.errback)); 1145 } else if (this.events.error) { 1146 // No direct errback on this module, but something 1147 // else is listening for errors, so be sure to 1148 // propagate the error correctly. 1149 on(depMap, 'error', bind(this, function(err) { 1150 this.emit('error', err); 1151 })); 1152 } 1153 } 1154 1155 id = depMap.id; 1156 mod = registry[id]; 1157 1158 //Skip special modules like 'require', 'exports', 'module' 1159 //Also, don't call enable if it is already enabled, 1160 //important in circular dependency cases. 1161 if (!hasProp(handlers, id) && mod && !mod.enabled) { 1162 context.enable(depMap, this); 1163 } 1164 })); 1165 1166 //Enable each plugin that is used in 1167 //a dependency 1168 eachProp(this.pluginMaps, bind(this, function (pluginMap) { 1169 var mod = getOwn(registry, pluginMap.id); 1170 if (mod && !mod.enabled) { 1171 context.enable(pluginMap, this); 1172 } 1173 })); 1174 1175 this.enabling = false; 1176 1177 this.check(); 1178 }, 1179 1180 on: function (name, cb) { 1181 var cbs = this.events[name]; 1182 if (!cbs) { 1183 cbs = this.events[name] = []; 1184 } 1185 cbs.push(cb); 1186 }, 1187 1188 emit: function (name, evt) { 1189 each(this.events[name], function (cb) { 1190 cb(evt); 1191 }); 1192 if (name === 'error') { 1193 //Now that the error handler was triggered, remove 1194 //the listeners, since this broken Module instance 1195 //can stay around for a while in the registry. 1196 delete this.events[name]; 1197 } 1198 } 1199 }; 1200 1201 function callGetModule(args) { 1202 //Skip modules already defined. 1203 if (!hasProp(defined, args[0])) { 1204 getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]); 1205 } 1206 } 1207 1208 function removeListener(node, func, name, ieName) { 1209 //Favor detachEvent because of IE9 1210 //issue, see attachEvent/addEventListener comment elsewhere 1211 //in this file. 1212 if (node.detachEvent && !isOpera) { 1213 //Probably IE. If not it will throw an error, which will be 1214 //useful to know. 1215 if (ieName) { 1216 node.detachEvent(ieName, func); 1217 } 1218 } else { 1219 node.removeEventListener(name, func, false); 1220 } 1221 } 1222 1223 /** 1224 * Given an event from a script node, get the requirejs info from it, 1225 * and then removes the event listeners on the node. 1226 * @param {Event} evt 1227 * @returns {Object} 1228 */ 1229 function getScriptData(evt) { 1230 //Using currentTarget instead of target for Firefox 2.0's sake. Not 1231 //all old browsers will be supported, but this one was easy enough 1232 //to support and still makes sense. 1233 var node = evt.currentTarget || evt.srcElement; 1234 1235 //Remove the listeners once here. 1236 removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange'); 1237 removeListener(node, context.onScriptError, 'error'); 1238 1239 return { 1240 node: node, 1241 id: node && node.getAttribute('data-requiremodule') 1242 }; 1243 } 1244 1245 function intakeDefines() { 1246 var args; 1247 1248 //Any defined modules in the global queue, intake them now. 1249 takeGlobalQueue(); 1250 1251 //Make sure any remaining defQueue items get properly processed. 1252 while (defQueue.length) { 1253 args = defQueue.shift(); 1254 if (args[0] === null) { 1255 return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + 1256 args[args.length - 1])); 1257 } else { 1258 //args are id, deps, factory. Should be normalized by the 1259 //define() function. 1260 callGetModule(args); 1261 } 1262 } 1263 context.defQueueMap = {}; 1264 } 1265 1266 context = { 1267 config: config, 1268 contextName: contextName, 1269 registry: registry, 1270 defined: defined, 1271 urlFetched: urlFetched, 1272 defQueue: defQueue, 1273 defQueueMap: {}, 1274 Module: Module, 1275 makeModuleMap: makeModuleMap, 1276 nextTick: req.nextTick, 1277 onError: onError, 1278 1279 /** 1280 * Set a configuration for the context. 1281 * @param {Object} cfg config object to integrate. 1282 */ 1283 configure: function (cfg) { 1284 //Make sure the baseUrl ends in a slash. 1285 if (cfg.baseUrl) { 1286 if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') { 1287 cfg.baseUrl += '/'; 1288 }
vendor: 16,459 bytes, lines 1288-1667
1288 1289 } 1290 1291 //Save off the paths since they require special processing, 1292 //they are additive. 1293 var shim = config.shim, 1294 objs = { 1295 paths: true, 1296 bundles: true, 1297 config: true, 1298 map: true 1299 }; 1300 1301 eachProp(cfg, function (value, prop) { 1302 if (objs[prop]) { 1303 if (!config[prop]) { 1304 config[prop] = {}; 1305 } 1306 mixin(config[prop], value, true, true); 1307 } else { 1308 config[prop] = value; 1309 } 1310 }); 1311 1312 //Reverse map the bundles 1313 if (cfg.bundles) { 1314 eachProp(cfg.bundles, function (value, prop) { 1315 each(value, function (v) { 1316 if (v !== prop) { 1317 bundlesMap[v] = prop; 1318 } 1319 }); 1320 }); 1321 } 1322 1323 //Merge shim 1324 if (cfg.shim) { 1325 eachProp(cfg.shim, function (value, id) { 1326 //Normalize the structure 1327 if (isArray(value)) { 1328 value = { 1329 deps: value 1330 }; 1331 } 1332 if ((value.exports || value.init) && !value.exportsFn) { 1333 value.exportsFn = context.makeShimExports(value); 1334 } 1335 shim[id] = value; 1336 }); 1337 config.shim = shim; 1338 } 1339 1340 //Adjust packages if necessary. 1341 if (cfg.packages) { 1342 each(cfg.packages, function (pkgObj) { 1343 var location, name; 1344 1345 pkgObj = typeof pkgObj === 'string' ? {name: pkgObj} : pkgObj; 1346 1347 name = pkgObj.name; 1348 location = pkgObj.location; 1349 if (location) { 1350 config.paths[name] = pkgObj.location; 1351 } 1352 1353 //Save pointer to main module ID for pkg name. 1354 //Remove leading dot in main, so main paths are normalized, 1355 //and remove any trailing .js, since different package 1356 //envs have different conventions: some use a module name, 1357 //some use a file name. 1358 config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main') 1359 .replace(currDirRegExp, '') 1360 .replace(jsSuffixRegExp, ''); 1361 }); 1362 } 1363 1364 //If there are any "waiting to execute" modules in the registry, 1365 //update the maps for them, since their info, like URLs to load, 1366 //may have changed. 1367 eachProp(registry, function (mod, id) { 1368 //If module already has init called, since it is too 1369 //late to modify them, and ignore unnormalized ones 1370 //since they are transient. 1371 if (!mod.inited && !mod.map.unnormalized) { 1372 mod.map = makeModuleMap(id, null, true); 1373 } 1374 }); 1375 1376 //If a deps array or a config callback is specified, then call 1377 //require with those args. This is useful when require is defined as a 1378 //config object before require.js is loaded. 1379 if (cfg.deps || cfg.callback) { 1380 context.require(cfg.deps || [], cfg.callback); 1381 } 1382 }, 1383 1384 makeShimExports: function (value) { 1385 function fn() { 1386 var ret; 1387 if (value.init) { 1388 ret = value.init.apply(global, arguments); 1389 } 1390 return ret || (value.exports && getGlobal(value.exports)); 1391 } 1392 return fn; 1393 }, 1394 1395 makeRequire: function (relMap, options) { 1396 options = options || {}; 1397 1398 function localRequire(deps, callback, errback) { 1399 var id, map, requireMod; 1400 1401 if (options.enableBuildCallback && callback && isFunction(callback)) { 1402 callback.__requireJsBuild = true; 1403 } 1404 1405 if (typeof deps === 'string') { 1406 if (isFunction(callback)) { 1407 //Invalid call 1408 return onError(makeError('requireargs', 'Invalid require call'), errback); 1409 } 1410 1411 //If require|exports|module are requested, get the 1412 //value for them from the special handlers. Caveat: 1413 //this only works while module is being defined. 1414 if (relMap && hasProp(handlers, deps)) { 1415 return handlers[deps](registry[relMap.id]); 1416 } 1417 1418 //Synchronous access to one module. If require.get is 1419 //available (as in the Node adapter), prefer that. 1420 if (req.get) { 1421 return req.get(context, deps, relMap, localRequire); 1422 } 1423 1424 //Normalize module name, if it contains . or .. 1425 map = makeModuleMap(deps, relMap, false, true); 1426 id = map.id; 1427 1428 if (!hasProp(defined, id)) { 1429 return onError(makeError('notloaded', 'Module name "' + 1430 id + 1431 '" has not been loaded yet for context: ' + 1432 contextName + 1433 (relMap ? '' : '. Use require([])'))); 1434 } 1435 return defined[id]; 1436 } 1437 1438 //Grab defines waiting in the global queue. 1439 intakeDefines(); 1440 1441 //Mark all the dependencies as needing to be loaded. 1442 context.nextTick(function () { 1443 //Some defines could have been added since the 1444 //require call, collect them. 1445 intakeDefines(); 1446 1447 requireMod = getModule(makeModuleMap(null, relMap)); 1448 1449 //Store if map config should be applied to this require 1450 //call for dependencies. 1451 requireMod.skipMap = options.skipMap; 1452 1453 requireMod.init(deps, callback, errback, { 1454 enabled: true 1455 }); 1456 1457 checkLoaded(); 1458 }); 1459 1460 return localRequire; 1461 } 1462 1463 mixin(localRequire, { 1464 isBrowser: isBrowser, 1465 1466 /** 1467 * Converts a module name + .extension into an URL path. 1468 * *Requires* the use of a module name. It does not support using 1469 * plain URLs like nameToUrl. 1470 */ 1471 toUrl: function (moduleNamePlusExt) { 1472 var ext, 1473 index = moduleNamePlusExt.lastIndexOf('.'), 1474 segment = moduleNamePlusExt.split('/')[0], 1475 isRelative = segment === '.' || segment === '..'; 1476 1477 //Have a file extension alias, and it is not the 1478 //dots from a relative path. 1479 if (index !== -1 && (!isRelative || index > 1)) { 1480 ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length); 1481 moduleNamePlusExt = moduleNamePlusExt.substring(0, index); 1482 } 1483 1484 return context.nameToUrl(normalize(moduleNamePlusExt, 1485 relMap && relMap.id, true), ext, true); 1486 }, 1487 1488 defined: function (id) { 1489 return hasProp(defined, makeModuleMap(id, relMap, false, true).id); 1490 }, 1491 1492 specified: function (id) { 1493 id = makeModuleMap(id, relMap, false, true).id; 1494 return hasProp(defined, id) || hasProp(registry, id); 1495 } 1496 }); 1497 1498 //Only allow undef on top level require calls 1499 if (!relMap) { 1500 localRequire.undef = function (id) { 1501 //Bind any waiting define() calls to this context, 1502 //fix for #408 1503 takeGlobalQueue(); 1504 1505 var map = makeModuleMap(id, relMap, true), 1506 mod = getOwn(registry, id); 1507 1508 mod.undefed = true; 1509 removeScript(id); 1510 1511 delete defined[id]; 1512 delete urlFetched[map.url]; 1513 delete undefEvents[id]; 1514 1515 //Clean queued defines too. Go backwards 1516 //in array so that the splices do not 1517 //mess up the iteration. 1518 eachReverse(defQueue, function(args, i) { 1519 if (args[0] === id) { 1520 defQueue.splice(i, 1); 1521 } 1522 }); 1523 delete context.defQueueMap[id]; 1524 1525 if (mod) { 1526 //Hold on to listeners in case the 1527 //module will be attempted to be reloaded 1528 //using a different config. 1529 if (mod.events.defined) { 1530 undefEvents[id] = mod.events; 1531 } 1532 1533 cleanRegistry(id); 1534 } 1535 }; 1536 } 1537 1538 return localRequire; 1539 }, 1540 1541 /** 1542 * Called to enable a module if it is still in the registry 1543 * awaiting enablement. A second arg, parent, the parent module, 1544 * is passed in for context, when this method is overridden by 1545 * the optimizer. Not shown here to keep code compact. 1546 */ 1547 enable: function (depMap) { 1548 var mod = getOwn(registry, depMap.id); 1549 if (mod) { 1550 getModule(depMap).enable(); 1551 } 1552 }, 1553 1554 /** 1555 * Internal method used by environment adapters to complete a load event. 1556 * A load event could be a script load or just a load pass from a synchronous 1557 * load call. 1558 * @param {String} moduleName the name of the module to potentially complete. 1559 */ 1560 completeLoad: function (moduleName) { 1561 var found, args, mod, 1562 shim = getOwn(config.shim, moduleName) || {}, 1563 shExports = shim.exports; 1564 1565 takeGlobalQueue(); 1566 1567 while (defQueue.length) { 1568 args = defQueue.shift(); 1569 if (args[0] === null) { 1570 args[0] = moduleName; 1571 //If already found an anonymous module and bound it 1572 //to this name, then this is some other anon module 1573 //waiting for its completeLoad to fire. 1574 if (found) { 1575 break; 1576 } 1577 found = true; 1578 } else if (args[0] === moduleName) { 1579 //Found matching define call for this script! 1580 found = true; 1581 } 1582 1583 callGetModule(args); 1584 } 1585 context.defQueueMap = {}; 1586 1587 //Do this after the cycle of callGetModule in case the result 1588 //of those calls/init calls changes the registry. 1589 mod = getOwn(registry, moduleName); 1590 1591 if (!found && !hasProp(defined, moduleName) && mod && !mod.inited) { 1592 if (config.enforceDefine && (!shExports || !getGlobal(shExports))) { 1593 if (hasPathFallback(moduleName)) { 1594 return; 1595 } else { 1596 return onError(makeError('nodefine', 1597 'No define call for ' + moduleName, 1598 null, 1599 [moduleName])); 1600 } 1601 } else { 1602 //A script that does not call define(), so just simulate 1603 //the call for it. 1604 callGetModule([moduleName, (shim.deps || []), shim.exportsFn]); 1605 } 1606 } 1607 1608 checkLoaded(); 1609 }, 1610 1611 /** 1612 * Converts a module name to a file path. Supports cases where 1613 * moduleName may actually be just an URL. 1614 * Note that it **does not** call normalize on the moduleName, 1615 * it is assumed to have already been normalized. This is an 1616 * internal API, not a public one. Use toUrl for the public API. 1617 */ 1618 nameToUrl: function (moduleName, ext, skipExt) { 1619 var paths, syms, i, parentModule, url, 1620 parentPath, bundleId, 1621 pkgMain = getOwn(config.pkgs, moduleName); 1622 1623 if (pkgMain) { 1624 moduleName = pkgMain; 1625 } 1626 1627 bundleId = getOwn(bundlesMap, moduleName); 1628 1629 if (bundleId) { 1630 return context.nameToUrl(bundleId, ext, skipExt); 1631 } 1632 1633 //If a colon is in the URL, it indicates a protocol is used and it is just 1634 //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?) 1635 //or ends with .js, then assume the user meant to use an url and not a module id. 1636 //The slash is important for protocol-less URLs as well as full paths. 1637 if (req.jsExtRegExp.test(moduleName)) { 1638 //Just a plain path, not module name lookup, so just return it. 1639 //Add extension if it is included. This is a bit wonky, only non-.js things pass 1640 //an extension, this method probably needs to be reworked. 1641 url = moduleName + (ext || ''); 1642 } else { 1643 //A module that needs to be converted to a path. 1644 paths = config.paths; 1645 1646 syms = moduleName.split('/'); 1647 //For each module name segment, see if there is a path 1648 //registered for it. Start with most specific name 1649 //and work up from it. 1650 for (i = syms.length; i > 0; i -= 1) { 1651 parentModule = syms.slice(0, i).join('/'); 1652 1653 parentPath = getOwn(paths, parentModule); 1654 if (parentPath) { 1655 //If an array, it means there are a few choices, 1656 //Choose the one that is desired 1657 if (isArray(parentPath)) { 1658 parentPath = parentPath[0]; 1659 } 1660 syms.splice(0, i, parentPath); 1661 break; 1662 } 1663 } 1664 1665 //Join the path parts together, then figure out if baseUrl is needed. 1666 url = syms.join('/'); 1667 url += (ext || (/^data\:|
1667\?/.test(url) || skipExt ? '' : '.js')); 1668 url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url; 1669 } 1670 1671 return config.urlArgs ? url + 1672 ((url.indexOf('?') === -1 ? '?' : '&') + 1673 config.urlArgs) : url; 1674 }, 1675 1676 //Delegates to req.load. Broken out as a separate function to 1677 //allow overriding in the optimizer. 1678 load: function (id, url) { 1679 req.load(context, id, url); 1680 }, 1681 1682 /** 1683 * Executes a module callback function. Broken out as a separate function 1684 * solely to allow the build system to sequence the files in the built 1685 * layer in the right sequence. 1686 * 1687 * @private 1688 */
vendor: 14,847 bytes, lines 1689-2061
1689 execCb: function (name, callback, args, exports) { 1690 return callback.apply(exports, args); 1691 }, 1692 1693 /** 1694 * callback for script loads, used to check status of loading. 1695 * 1696 * @param {Event} evt the event from the browser for the script 1697 * that was loaded. 1698 */ 1699 onScriptLoad: function (evt) { 1700 //Using currentTarget instead of target for Firefox 2.0's sake. Not 1701 //all old browsers will be supported, but this one was easy enough 1702 //to support and still makes sense. 1703 if (evt.type === 'load' || 1704 (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) { 1705 //Reset interactive script so a script node is not held onto for 1706 //to long. 1707 interactiveScript = null; 1708 1709 //Pull out the name of the module and the context. 1710 var data = getScriptData(evt); 1711 context.completeLoad(data.id); 1712 } 1713 }, 1714 1715 /** 1716 * Callback for script errors. 1717 */ 1718 onScriptError: function (evt) { 1719 var data = getScriptData(evt); 1720 if (!hasPathFallback(data.id)) { 1721 var parents = []; 1722 eachProp(registry, function(value, key) { 1723 if (key.indexOf('_@r') !== 0) { 1724 each(value.depMaps, function(depMap) { 1725 if (depMap.id === data.id) { 1726 parents.push(key); 1727 } 1728 return true; 1729 }); 1730 } 1731 }); 1732 return onError(makeError('scripterror', 'Script error for "' + data.id + 1733 (parents.length ? 1734 '", needed by: ' + parents.join(', ') : 1735 '"'), evt, [data.id])); 1736 } 1737 } 1738 }; 1739 1740 context.require = context.makeRequire(); 1741 return context; 1742 } 1743 1744 /** 1745 * Main entry point. 1746 * 1747 * If the only argument to require is a string, then the module that 1748 * is represented by that string is fetched for the appropriate context. 1749 * 1750 * If the first argument is an array, then it will be treated as an array 1751 * of dependency string names to fetch. An optional function callback can 1752 * be specified to execute when all of those dependencies are available. 1753 * 1754 * Make a local req variable to help Caja compliance (it assumes things 1755 * on a require that are not standardized), and to give a short 1756 * name for minification/local scope use. 1757 */ 1758 req = requirejs = function (deps, callback, errback, optional) { 1759 1760 //Find the right context, use default 1761 var context, config, 1762 contextName = defContextName; 1763 1764 // Determine if have config object in the call. 1765 if (!isArray(deps) && typeof deps !== 'string') { 1766 // deps is a config object 1767 config = deps; 1768 if (isArray(callback)) { 1769 // Adjust args if there are dependencies 1770 deps = callback; 1771 callback = errback; 1772 errback = optional; 1773 } else { 1774 deps = []; 1775 } 1776 } 1777 1778 if (config && config.context) { 1779 contextName = config.context; 1780 } 1781 1782 context = getOwn(contexts, contextName); 1783 if (!context) { 1784 context = contexts[contextName] = req.s.newContext(contextName); 1785 } 1786 1787 if (config) { 1788 context.configure(config); 1789 } 1790 1791 return context.require(deps, callback, errback); 1792 }; 1793 1794 /** 1795 * Support require.config() to make it easier to cooperate with other 1796 * AMD loaders on globally agreed names. 1797 */ 1798 req.config = function (config) { 1799 return req(config); 1800 }; 1801 1802 /** 1803 * Execute something after the current tick 1804 * of the event loop. Override for other envs 1805 * that have a better solution than setTimeout. 1806 * @param {Function} fn function to execute later. 1807 */ 1808 req.nextTick = typeof setTimeout !== 'undefined' ? function (fn) { 1809 setTimeout(fn, 4); 1810 } : function (fn) { fn(); }; 1811 1812 /** 1813 * Export require as a global, but only if it does not already exist. 1814 */ 1815 if (!require) { 1816 require = req; 1817 } 1818 1819 req.version = version; 1820 1821 //Used to filter out dependencies that are already paths. 1822 req.jsExtRegExp = /^\/|:|\?|\.js$/; 1823 req.isBrowser = isBrowser; 1824 s = req.s = { 1825 contexts: contexts, 1826 newContext: newContext 1827 }; 1828 1829 //Create default context. 1830 req({}); 1831 1832 //Exports some context-sensitive methods on global require. 1833 each([ 1834 'toUrl', 1835 'undef', 1836 'defined', 1837 'specified' 1838 ], function (prop) { 1839 //Reference from contexts instead of early binding to default context, 1840 //so that during builds, the latest instance of the default context 1841 //with its config gets used. 1842 req[prop] = function () { 1843 var ctx = contexts[defContextName]; 1844 return ctx.require[prop].apply(ctx, arguments); 1845 }; 1846 }); 1847 1848 if (isBrowser) { 1849 head = s.head = document.getElementsByTagName('head')[0]; 1850 //If BASE tag is in play, using appendChild is a problem for IE6. 1851 //When that browser dies, this can be removed. Details in this jQuery bug: 1852 //http://dev.jquery.com/ticket/2709 1853 baseElement = document.getElementsByTagName('base')[0]; 1854 if (baseElement) { 1855 head = s.head = baseElement.parentNode; 1856 } 1857 } 1858 1859 /** 1860 * Any errors that require explicitly generates will be passed to this 1861 * function. Intercept/override it if you want custom error handling. 1862 * @param {Error} err the error object. 1863 */ 1864 req.onError = defaultOnError; 1865 1866 /** 1867 * Creates the node for the load command. Only used in browser envs. 1868 */ 1869 req.createNode = function (config, moduleName, url) { 1870 var node = config.xhtml ? 1871 document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') : 1872 document.createElement('script'); 1873 node.type = config.scriptType || 'text/javascript'; 1874 node.charset = 'utf-8'; 1875 node.async = true; 1876 return node; 1877 }; 1878 1879 /** 1880 * Does the request to load a module for the browser case. 1881 * Make this a separate function to allow other environments 1882 * to override it. 1883 * 1884 * @param {Object} context the require context to find state. 1885 * @param {String} moduleName the name of the module. 1886 * @param {Object} url the URL to the module. 1887 */ 1888 req.load = function (context, moduleName, url) { 1889 var config = (context && context.config) || {}, 1890 node; 1891 if (isBrowser) { 1892 //In the browser so use a script tag 1893 node = req.createNode(config, moduleName, url); 1894 if (config.onNodeCreated) { 1895 config.onNodeCreated(node, config, moduleName, url); 1896 } 1897 1898 node.setAttribute('data-requirecontext', context.contextName); 1899 node.setAttribute('data-requiremodule', moduleName); 1900 1901 //Set up load listener. Test attachEvent first because IE9 has 1902 //a subtle issue in its addEventListener and script onload firings 1903 //that do not match the behavior of all other browsers with 1904 //addEventListener support, which fire the onload event for a 1905 //script right after the script execution. See: 1906 //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution 1907 //UNFORTUNATELY Opera implements attachEvent but does not follow the script 1908 //script execution mode. 1909 if (node.attachEvent && 1910 //Check if node.attachEvent is artificially added by custom script or 1911 //natively supported by browser 1912 //read https://github.com/jrburke/requirejs/issues/187 1913 //if we can NOT find [native code] then it must NOT natively supported. 1914 //in IE8, node.attachEvent does not have toString() 1915 //Note the test for "[native code" with no closing brace, see: 1916 //https://github.com/jrburke/requirejs/issues/273 1917 !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) && 1918 !isOpera) { 1919 //Probably IE. IE (at least 6-8) do not fire 1920 //script onload right after executing the script, so 1921 //we cannot tie the anonymous define call to a name. 1922 //However, IE reports the script as being in 'interactive' 1923 //readyState at the time of the define call. 1924 useInteractive = true; 1925 1926 node.attachEvent('onreadystatechange', context.onScriptLoad); 1927 //It would be great to add an error handler here to catch 1928 //404s in IE9+. However, onreadystatechange will fire before 1929 //the error handler, so that does not help. If addEventListener 1930 //is used, then IE will fire error before load, but we cannot 1931 //use that pathway given the connect.microsoft.com issue 1932 //mentioned above about not doing the 'script execute, 1933 //then fire the script load event listener before execute 1934 //next script' that other browsers do. 1935 //Best hope: IE10 fixes the issues, 1936 //and then destroys all installs of IE 6-9. 1937 //node.attachEvent('onerror', context.onScriptError); 1938 } else { 1939 node.addEventListener('load', context.onScriptLoad, false); 1940 node.addEventListener('error', context.onScriptError, false); 1941 } 1942 node.src = url; 1943 1944 //For some cache cases in IE 6-8, the script executes before the end 1945 //of the appendChild execution, so to tie an anonymous define 1946 //call to the module name (which is stored on the node), hold on 1947 //to a reference to this node, but clear after the DOM insertion. 1948 currentlyAddingScript = node; 1949 if (baseElement) { 1950 head.insertBefore(node, baseElement); 1951 } else { 1952 head.appendChild(node); 1953 } 1954 currentlyAddingScript = null; 1955 1956 return node; 1957 } else if (isWebWorker) { 1958 try { 1959 //In a web worker, use importScripts. This is not a very 1960 //efficient use of importScripts, importScripts will block until 1961 //its script is downloaded and evaluated. However, if web workers 1962 //are in play, the expectation is that a build has been done so 1963 //that only one script needs to be loaded anyway. This may need 1964 //to be reevaluated if other use cases become common. 1965 importScripts(url); 1966 1967 //Account for anonymous modules 1968 context.completeLoad(moduleName); 1969 } catch (e) { 1970 context.onError(makeError('importscripts', 1971 'importScripts failed for ' + 1972 moduleName + ' at ' + url, 1973 e, 1974 [moduleName])); 1975 } 1976 } 1977 }; 1978 1979 function getInteractiveScript() { 1980 if (interactiveScript && interactiveScript.readyState === 'interactive') { 1981 return interactiveScript; 1982 } 1983 1984 eachReverse(scripts(), function (script) { 1985 if (script.readyState === 'interactive') { 1986 return (interactiveScript = script); 1987 } 1988 }); 1989 return interactiveScript; 1990 } 1991 1992 //Look for a data-main script attribute, which could also adjust the baseUrl. 1993 if (isBrowser && !cfg.skipDataMain) { 1994 //Figure out baseUrl. Get it from the script tag with require.js in it. 1995 eachReverse(scripts(), function (script) { 1996 //Set the 'head' where we can append children by 1997 //using the script's parent. 1998 if (!head) { 1999 head = script.parentNode; 2000 } 2001 2002 //Look for a data-main attribute to set main script for the page 2003 //to load. If it is there, the path to data main becomes the 2004 //baseUrl, if it is not already set. 2005 dataMain = script.getAttribute('data-main'); 2006 if (dataMain) { 2007 //Preserve dataMain in case it is a path (i.e. contains '?') 2008 mainScript = dataMain; 2009 2010 //Set final baseUrl if there is not already an explicit one. 2011 if (!cfg.baseUrl) { 2012 //Pull off the directory of data-main for use as the 2013 //baseUrl. 2014 src = mainScript.split('/'); 2015 mainScript = src.pop(); 2016 subPath = src.length ? src.join('/') + '/' : './'; 2017 2018 cfg.baseUrl = subPath; 2019 } 2020 2021 //Strip off any trailing .js since mainScript is now 2022 //like a module name. 2023 mainScript = mainScript.replace(jsSuffixRegExp, ''); 2024 2025 //If mainScript is still a path, fall back to dataMain 2026 if (req.jsExtRegExp.test(mainScript)) { 2027 mainScript = dataMain; 2028 } 2029 2030 //Put the data-main script in the files to load. 2031 cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript]; 2032 2033 return true; 2034 } 2035 }); 2036 } 2037 2038 /** 2039 * The function that handles definitions of modules. Differs from 2040 * require() in that a string for the module should be the first argument, 2041 * and the function to execute after dependencies are loaded should 2042 * return a value to define the module corresponding to the first argument's 2043 * name. 2044 */ 2045 define = function (name, deps, callback) { 2046 var node, context; 2047 2048 //Allow for anonymous modules 2049 if (typeof name !== 'string') { 2050 //Adjust args appropriately 2051 callback = deps; 2052 deps = name; 2053 name = null; 2054 } 2055 2056 //This module may not have dependencies 2057 if (!isArray(deps)) { 2058 callback = deps; 2059 deps = null; 2060 } 2061
2062 //If no name, and callback is a function, then figure out if it a 2063 //CommonJS thing with dependencies. 2064 if (!deps && isFunction(callback)) { 2065 deps = []; 2066 //Remove comments from the callback string, 2067 //look for require calls, and pull them into the dependencies, 2068 //but only if there are function args. 2069 if (callback.length) { 2070 callback 2071 .toString() 2072 .replace(commentRegExp, '') 2073 .replace(cjsRequireRegExp, function (match, dep) { 2074 deps.push(dep); 2075 }); 2076 2077 //May be a CommonJS thing even without require calls, but still 2078 //could use exports, and module. Avoid doing exports and module 2079 //work though if it just needs require. 2080 //REQUIRES the function to expect the CommonJS variables in the 2081 //order listed below. 2082 deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps); 2083 } 2084 } 2085 2086 //If in IE 6-8 and hit an anonymous define() call, do the interactive 2087 //work. 2088 if (useInteractive) { 2089 node = currentlyAddingScript || getInteractiveScript(); 2090 if (node) { 2091 if (!name) { 2092 name = node.getAttribute('data-requiremodule'); 2093 } 2094 context = contexts[node.getAttribute('data-requirecontext')]; 2095 } 2096 } 2097 2098 //Always save off evaluating the def call until the script onload handler. 2099 //This allows multiple modules to be in a file without prematurely 2100 //tracing dependencies, and allows for anonymous module support, 2101 //where the module name is not known until the script onload event 2102 //occurs. If no context, use the global queue, and get it processed 2103 //in the onscript load callback. 2104 if (context) { 2105 context.defQueue.push([name, deps, callback]); 2106 context.defQueueMap[name] = true; 2107 } else { 2108 globalDefQueue.push([name, deps, callback]); 2109 } 2110 }; 2111 2112 define.amd = { 2113 jQuery: true 2114 }; 2115 2116 /** 2117 * Executes the text. Normally just uses eval, but can be modified 2118 * to use a better, environment-specific call. Only used for transpiling 2119 * loader plugins, not for plain JS modules. 2120 * @param {String} text the text to execute/evaluate. 2121 */ 2122 req.exec = function (text) { 2123 /*jslint evil: true */ 2124 return eval(text); 2125 }; 2126 2127 //Set up with config info. 2128 req(cfg); 2129}(this)); 2130/*! 2131 * jQuery JavaScript Library v2.1.4 2132 * http://jquery.com/ 2133 * 2134 * Includes Sizzle.js 2135 * http://sizzlejs.com/ 2136 * 2137 * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors 2138 * Released under the MIT license 2139 * http://jquery.org/license 2140 * 2141 * Date: 2015-04-28T16:01Z 2142 */ 2143 2144(function( global, factory ) { 2145 2146 if ( typeof module === "object" && typeof module.exports === "object" ) { 2147 // For CommonJS and CommonJS-like environments where a proper `window` 2148 // is present, execute the factory and get jQuery. 2149 // For environments that do not have a `window` with a `document` 2150 // (such as Node.js), expose a factory as module.exports. 2151 // This accentuates the need for the creation of a real `window`. 2152 // e.g. var jQuery = require("jquery")(window); 2153 // See ticket #14549 for more info. 2154 module.exports = global.document ? 2155 factory( global, true ) : 2156 function( w ) { 2157 if ( !w.document ) { 2158 throw new Error( "jQuery requires a window with a document" ); 2159 } 2160 return factory( w ); 2161 }; 2162 } else { 2163 factory( global ); 2164 } 2165 2166// Pass this if window is not defined yet 2167}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 2168 2169// Support: Firefox 18+ 2170// Can't be in strict mode, several libs including ASP.NET trace 2171// the stack via arguments.caller.callee and Firefox dies if 2172// you try to trace through "use strict" call chains. (#13335) 2173// 2174 2175var arr = []; 2176 2177var slice = arr.slice; 2178 2179var concat = arr.concat; 2180 2181var push = arr.push; 2182 2183var indexOf = arr.indexOf; 2184 2185var class2type = {}; 2186 2187var toString = class2type.toString; 2188 2189var hasOwn = class2type.hasOwnProperty; 2190 2191var support = {}; 2192 2193 2194 2195var 2196 // Use the correct document accordingly with window argument (sandbox) 2197 document = window.document, 2198 2199 version = "2.1.4", 2200 2201 // Define a local copy of jQuery 2202 jQuery = function( selector, context ) { 2203 // The jQuery object is actually just the init constructor 'enhanced' 2204 // Need init if jQuery is called (just allow error to be thrown if not included) 2205 return new jQuery.fn.init( selector, context ); 2206 }, 2207 2208 // Support: Android<4.1 2209 // Make sure we trim BOM and NBSP 2210 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, 2211 2212 // Matches dashed string for camelizing 2213 rmsPrefix = /^-ms-/, 2214 rdashAlpha = /-([\da-z])/gi, 2215 2216 // Used by jQuery.camelCase as callback to replace() 2217 fcamelCase = function( all, letter ) { 2218 return letter.toUpperCase(); 2219 }; 2220 2221jQuery.fn = jQuery.prototype = { 2222 // The current version of jQuery being used 2223 jquery: version, 2224 2225 constructor: jQuery, 2226 2227 // Start with an empty selector 2228 selector: "", 2229 2230 // The default length of a jQuery object is 0 2231 length: 0, 2232 2233 toArray: function() { 2234 return slice.call( this ); 2235 }, 2236 2237 // Get the Nth element in the matched element set OR 2238 // Get the whole matched element set as a clean array 2239 get: function( num ) { 2240 return num != null ? 2241 2242 // Return just the one element from the set 2243 ( num < 0 ? this[ num + this.length ] : this[ num ] ) : 2244 2245 // Return all the elements in a clean array 2246 slice.call( this ); 2247 }, 2248 2249 // Take an array of elements and push it onto the stack 2250 // (returning the new matched element set) 2251 pushStack: function( elems ) { 2252 2253 // Build a new jQuery matched element set 2254 var ret = jQuery.merge( this.constructor(), elems ); 2255 2256 // Add the old object onto the stack (as a reference)
2257 ret.prevObject = this; 2258 ret.context = this.context; 2259 2260 // Return the newly-formed element set 2261 return ret; 2262 }, 2263 2264 // Execute a callback for every element in the matched set. 2265 // (You can seed the arguments with an array of args, but this is 2266 // only used internally.) 2267 each: function( callback, args ) { 2268 return jQuery.each( this, callback, args ); 2269 }, 2270 2271 map: function( callback ) { 2272 return this.pushStack( jQuery.map(this, function( elem, i ) { 2273 return callback.call( elem, i, elem ); 2274 })); 2275 }, 2276 2277 slice: function() { 2278 return this.pushStack( slice.apply( this, arguments ) ); 2279 }, 2280 2281 first: function() { 2282 return this.eq( 0 ); 2283 }, 2284 2285 last: function() { 2286 return this.eq( -1 ); 2287 }, 2288 2289 eq: function( i ) { 2290 var len = this.length, 2291 j = +i + ( i < 0 ? len : 0 ); 2292 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); 2293 }, 2294 2295 end: function() { 2296 return this.prevObject || this.constructor(null); 2297 }, 2298 2299 // For internal use only. 2300 // Behaves like an Array's method, not like a jQuery method. 2301 push: push, 2302 sort: arr.sort, 2303 splice: arr.splice 2304}; 2305 2306jQuery.extend = jQuery.fn.extend = function() { 2307 var options, name, src, copy, copyIsArray, clone, 2308 target = arguments[0] || {}, 2309 i = 1, 2310 length = arguments.length, 2311 deep = false; 2312 2313 // Handle a deep copy situation 2314 if ( typeof target === "boolean" ) { 2315 deep = target; 2316 2317 // Skip the boolean and the target 2318 target = arguments[ i ] || {}; 2319 i++; 2320 } 2321 2322 // Handle case when target is a string or something (possible in deep copy) 2323 if ( typeof target !== "object" && !jQuery.isFunction(target) ) { 2324 target = {}; 2325 } 2326 2327 // Extend jQuery itself if only one argument is passed 2328 if ( i === length ) { 2329 target = this; 2330 i--; 2331 } 2332 2333 for ( ; i < length; i++ ) { 2334 // Only deal with non-null/undefined values 2335 if ( (options = arguments[ i ]) != null ) { 2336 // Extend the base object 2337 for ( name in options ) { 2338 src = target[ name ]; 2339 copy = options[ name ]; 2340 2341 // Prevent never-ending loop 2342 if ( target === copy ) { 2343 continue; 2344 } 2345 2346 // Recurse if we're merging plain objects or arrays 2347 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { 2348 if ( copyIsArray ) { 2349 copyIsArray = false; 2350 clone = src && jQuery.isArray(src) ? src : []; 2351 2352 } else { 2353 clone = src && jQuery.isPlainObject(src) ? src : {}; 2354 } 2355 2356 // Never move original objects, clone them 2357 target[ name ] = jQuery.extend( deep, clone, copy ); 2358 2359 // Don't bring in undefined values 2360 } else if ( copy !== undefined ) { 2361 target[ name ] = copy; 2362 } 2363 } 2364 } 2365 } 2366 2367 // Return the modified object 2368 return target; 2369}; 2370 2371jQuery.extend({ 2372 // Unique for each copy of jQuery on the page 2373 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 2374 2375 // Assume jQuery is ready without the ready module 2376 isReady: true, 2377 2378 error: function( msg ) { 2379 throw new Error( msg ); 2380 }, 2381 2382 noop: function() {}, 2383 2384 isFunction: function( obj ) { 2385 return jQuery.type(obj) === "function"; 2386 }, 2387 2388 isArray: Array.isArray, 2389 2390 isWindow: function( obj ) { 2391 return obj != null && obj === obj.window; 2392 }, 2393 2394 isNumeric: function( obj ) { 2395 // parseFloat NaNs numeric-cast false positives (null|true|false|"") 2396 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 2397 // subtraction forces infinities to NaN 2398 // adding 1 corrects loss of precision from parseFloat (#15100) 2399 return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0; 2400 }, 2401 2402 isPlainObject: function( obj ) { 2403 // Not plain objects: 2404 // - Any object or value whose internal [[Class]] property is not "[object Object]" 2405 // - DOM nodes 2406 // - window 2407 if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { 2408 return false; 2409 } 2410 2411 if ( obj.constructor && 2412 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { 2413 return false; 2414 } 2415 2416 // If the function hasn't returned already, we're confident that 2417 // |obj| is a plain object, created by {} or constructed with new Object 2418 return true; 2419 }, 2420 2421 isEmptyObject: function( obj ) { 2422 var name; 2423 for ( name in obj ) { 2424 return false;
2425 } 2426 return true; 2427 }, 2428 2429 type: function( obj ) { 2430 if ( obj == null ) { 2431 return obj + ""; 2432 } 2433 // Support: Android<4.0, iOS<6 (functionish RegExp) 2434 return typeof obj === "object" || typeof obj === "function" ? 2435 class2type[ toString.call(obj) ] || "object" : 2436 typeof obj; 2437 }, 2438 2439 // Evaluates a script in a global context 2440 globalEval: function( code ) { 2441 var script, 2442 indirect = eval; 2443 2444 code = jQuery.trim( code ); 2445 2446 if ( code ) { 2447 // If the code includes a valid, prologue position 2448 // strict mode pragma, execute code by injecting a 2449 // script tag into the document. 2450 if ( code.indexOf("use strict") === 1 ) { 2451 script = document.createElement("script"); 2452 script.text = code; 2453 document.head.appendChild( script ).parentNode.removeChild( script ); 2454 } else { 2455 // Otherwise, avoid the DOM node creation, insertion 2456 // and removal by using an indirect global eval 2457 indirect( code ); 2458 } 2459 } 2460 }, 2461 2462 // Convert dashed to camelCase; used by the css and data modules 2463 // Support: IE9-11+ 2464 // Microsoft forgot to hump their vendor prefix (#9572) 2465 camelCase: function( string ) { 2466 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 2467 }, 2468
2469 nodeName: function( elem, name ) { 2470 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 2471 }, 2472 2473 // args is for internal usage only 2474 each: function( obj, callback, args ) { 2475 var value, 2476 i = 0, 2477 length = obj.length, 2478 isArray = isArraylike( obj ); 2479 2480 if ( args ) { 2481 if ( isArray ) { 2482 for ( ; i < length; i++ ) { 2483 value = callback.apply( obj[ i ], args ); 2484 2485 if ( value === false ) { 2486 break; 2487 } 2488 } 2489 } else { 2490 for ( i in obj ) { 2491 value = callback.apply( obj[ i ], args ); 2492 2493 if ( value === false ) { 2494 break; 2495 } 2496 } 2497 } 2498 2499 // A special, fast, case for the most common use of each 2500 } else { 2501 if ( isArray ) { 2502 for ( ; i < length; i++ ) { 2503 value = callback.call( obj[ i ], i, obj[ i ] ); 2504 2505 if ( value === false ) { 2506 break; 2507 } 2508 } 2509 } else { 2510 for ( i in obj ) { 2511 value = callback.call( obj[ i ], i, obj[ i ] ); 2512 2513 if ( value === false ) { 2514 break; 2515 } 2516 } 2517 } 2518 } 2519 2520 return obj; 2521 }, 2522 2523 // Support: Android<4.1 2524 trim: function( text ) { 2525 return text == null ? 2526 "" : 2527 ( text + "" ).replace( rtrim, "" ); 2528 }, 2529 2530 // results is for internal usage only 2531 makeArray: function( arr, results ) { 2532 var ret = results || []; 2533 2534 if ( arr != null ) { 2535 if ( isArraylike( Object(arr) ) ) { 2536 jQuery.merge( ret, 2537 typeof arr === "string" ? 2538 [ arr ] : arr 2539 ); 2540 } else { 2541 push.call( ret, arr ); 2542 } 2543 } 2544 2545 return ret; 2546 }, 2547 2548 inArray: function( elem, arr, i ) { 2549 return arr == null ? -1 : indexOf.call( arr, elem, i ); 2550 }, 2551 2552 merge: function( first, second ) { 2553 var len = +second.length, 2554 j = 0, 2555 i = first.length; 2556 2557 for ( ; j < len; j++ ) { 2558 first[ i++ ] = second[ j ]; 2559 } 2560 2561 first.length = i; 2562 2563 return first; 2564 }, 2565 2566 grep: function( elems, callback, invert ) { 2567 var callbackInverse, 2568 matches = [], 2569 i = 0, 2570 length = elems.length, 2571 callbackExpect = !invert; 2572 2573 // Go through the array, only saving the items 2574 // that pass the validator function 2575 for ( ; i < length; i++ ) { 2576 callbackInverse = !callback( elems[ i ], i ); 2577 if ( callbackInverse !== callbackExpect ) { 2578 matches.push( elems[ i ] ); 2579 } 2580 } 2581 2582 return matches; 2583 }, 2584 2585 // arg is for internal usage only 2586 map: function( elems, callback, arg ) { 2587 var value, 2588 i = 0, 2589 length = elems.length, 2590 isArray = isArraylike( elems ), 2591 ret = []; 2592 2593 // Go through the array, translating each of the items to their new values 2594 if ( isArray ) { 2595 for ( ; i < length; i++ ) { 2596 value = callback( elems[ i ], i, arg ); 2597 2598 if ( value != null ) { 2599 ret.push( value ); 2600 } 2601 } 2602 2603 // Go through every key on the object, 2604 } else { 2605 for ( i in elems ) { 2606 value = callback( elems[ i ], i, arg ); 2607 2608 if ( value != null ) { 2609 ret.push( value ); 2610 } 2611 } 2612 } 2613 2614 // Flatten any nested arrays 2615 return concat.apply( [], ret ); 2616 }, 2617 2618 // A global GUID counter for objects 2619 guid: 1, 2620 2621 // Bind a function to a context, optionally partially applying any 2622 // arguments. 2623 proxy: function( fn, context ) { 2624 var tmp, args, proxy; 2625 2626 if ( typeof context === "string" ) { 2627 tmp = fn[ context ]; 2628 context = fn; 2629 fn = tmp; 2630 } 2631 2632 // Quick check to determine if target is callable, in the spec 2633 // this throws a TypeError, but we will just return undefined. 2634 if ( !jQuery.isFunction( fn ) ) { 2635 return undefined; 2636 } 2637 2638 // Simulated bind 2639 args = slice.call( arguments, 2 ); 2640 proxy = function() { 2641 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 2642 }; 2643 2644 // Set the guid of unique handler to the same of original handler, so it can be removed 2645 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 2646 2647 return proxy; 2648 }, 2649 2650 now: Date.now, 2651 2652 // jQuery.support is not used in Core but other projects attach their 2653 // properties to it so it needs to exist. 2654 support: support 2655}); 2656 2657// Populate the class2type map 2658jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { 2659 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 2660}); 2661 2662function isArraylike( obj ) { 2663 2664 // Support: iOS 8.2 (not reproducible in simulator) 2665 // `in` check used to prevent JIT error (gh-2145) 2666 // hasOwn isn't used here due to false negatives 2667 // regarding Nodelist length in IE 2668 var length = "length" in obj && obj.length, 2669 type = jQuery.type( obj ); 2670 2671 if ( type === "function" || jQuery.isWindow( obj ) ) { 2672 return false;
vendor: 4,412 bytes, lines 2673-2814
2673 } 2674 2675 if ( obj.nodeType === 1 && length ) { 2676 return true; 2677 } 2678 2679 return type === "array" || length === 0 || 2680 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 2681} 2682var Sizzle = 2683/*! 2684 * Sizzle CSS Selector Engine v2.2.0-pre 2685 * http://sizzlejs.com/ 2686 * 2687 * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors 2688 * Released under the MIT license 2689 * http://jquery.org/license 2690 * 2691 * Date: 2014-12-16 2692 */ 2693(function( window ) { 2694 2695var i, 2696 support, 2697 Expr, 2698 getText, 2699 isXML, 2700 tokenize, 2701 compile, 2702 select, 2703 outermostContext, 2704 sortInput, 2705 hasDuplicate, 2706 2707 // Local document vars 2708 setDocument, 2709 document, 2710 docElem, 2711 documentIsHTML, 2712 rbuggyQSA, 2713 rbuggyMatches, 2714 matches, 2715 contains, 2716 2717 // Instance-specific data 2718 expando = "sizzle" + 1 * new Date(), 2719 preferredDoc = window.document, 2720 dirruns = 0, 2721 done = 0, 2722 classCache = createCache(), 2723 tokenCache = createCache(), 2724 compilerCache = createCache(), 2725 sortOrder = function( a, b ) { 2726 if ( a === b ) { 2727 hasDuplicate = true; 2728 } 2729 return 0; 2730 }, 2731 2732 // General-purpose constants 2733 MAX_NEGATIVE = 1 << 31, 2734 2735 // Instance methods 2736 hasOwn = ({}).hasOwnProperty, 2737 arr = [], 2738 pop = arr.pop, 2739 push_native = arr.push, 2740 push = arr.push, 2741 slice = arr.slice, 2742 // Use a stripped-down indexOf as it's faster than native 2743 // http://jsperf.com/thor-indexof-vs-for/5 2744 indexOf = function( list, elem ) { 2745 var i = 0, 2746 len = list.length; 2747 for ( ; i < len; i++ ) { 2748 if ( list[i] === elem ) { 2749 return i; 2750 } 2751 } 2752 return -1; 2753 }, 2754 2755 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", 2756 2757 // Regular expressions 2758 2759 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace 2760 whitespace = "[\\x20\\t\\r\\n\\f]", 2761 // http://www.w3.org/TR/css3-syntax/#characters 2762 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", 2763 2764 // Loosely modeled on CSS identifier characters 2765 // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors 2766 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier 2767 identifier = characterEncoding.replace( "w", "w#" ), 2768 2769 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 2770 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + 2771 // Operator (capture 2) 2772 "*([*^$|!~]?=)" + whitespace + 2773 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 2774 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + 2775 "*\\]", 2776 2777 pseudos = ":(" + characterEncoding + ")(?:\\((" + 2778 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 2779 // 1. quoted (capture 3; capture 4 or capture 5) 2780 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 2781 // 2. simple (capture 6) 2782 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 2783 // 3. anything else (capture 2) 2784 ".*" + 2785 ")\\)|)", 2786 2787 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 2788 rwhitespace = new RegExp( whitespace + "+", "g" ), 2789 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), 2790 2791 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 2792 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), 2793 2794 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), 2795 2796 rpseudo = new RegExp( pseudos ), 2797 ridentifier = new RegExp( "^" + identifier + "$" ), 2798 2799 matchExpr = { 2800 "ID": new RegExp( "^#(" + characterEncoding + ")" ), 2801 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), 2802 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), 2803 "ATTR": new RegExp( "^" + attributes ), 2804 "PSEUDO": new RegExp( "^" + pseudos ), 2805 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + 2806 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + 2807 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 2808 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 2809 // For use in libraries implementing .is() 2810 // We use this for POS matching in `select` 2811 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + 2812 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 2813 }, 2814
2815 rinputs = /^(?:input|select|textarea|button)$/i, 2816 rheader = /^h\d$/i, 2817 2818 rnative = /^[^{]+\{\s*\[native \w/, 2819 2820 // Easily-parseable/retrievable ID or TAG or CLASS selectors 2821 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 2822 2823 rsibling = /[+~]/, 2824 rescape = /'|\\/g, 2825 2826 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 2827 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), 2828 funescape = function( _, escaped, escapedWhitespace ) { 2829 var high = "0x" + escaped - 0x10000; 2830 // NaN means non-codepoint 2831 // Support: Firefox<24 2832 // Workaround erroneous numeric interpretation of +"0x" 2833 return high !== high || escapedWhitespace ? 2834 escaped : 2835 high < 0 ? 2836 // BMP codepoint 2837 String.fromCharCode( high + 0x10000 ) : 2838 // Supplemental Plane codepoint (surrogate pair) 2839 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 2840 }, 2841 2842 // Used for iframes 2843 // See setDocument() 2844 // Removing the function wrapper causes a "Permission Denied" 2845 // error in IE 2846 unloadHandler = function() { 2847 setDocument(); 2848 }; 2849 2850// Optimize for push.apply( _, NodeList ) 2851try { 2852 push.apply( 2853 (arr = slice.call( preferredDoc.childNodes )), 2854 preferredDoc.childNodes 2855 ); 2856 // Support: Android<4.0 2857 // Detect silently failing push.apply 2858 arr[ preferredDoc.childNodes.length ].nodeType; 2859} catch ( e ) { 2860 push = { apply: arr.length ? 2861 2862 // Leverage slice if possible 2863 function( target, els ) { 2864 push_native.apply( target, slice.call(els) ); 2865 } : 2866 2867 // Support: IE<9 2868 // Otherwise append directly 2869 function( target, els ) { 2870 var j = target.length, 2871 i = 0; 2872 // Can't trust NodeList.length 2873 while ( (target[j++] = els[i++]) ) {} 2874 target.length = j - 1; 2875 } 2876 }; 2877} 2878 2879function Sizzle( selector, context, results, seed ) { 2880 var match, elem, m, nodeType, 2881 // QSA vars 2882 i, groups, old, nid, newContext, newSelector; 2883 2884 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { 2885 setDocument( context ); 2886 } 2887 2888 context = context || document; 2889 results = results || []; 2890 nodeType = context.nodeType; 2891 2892 if ( typeof selector !== "string" || !selector || 2893 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 2894 2895 return results; 2896 } 2897 2898 if ( !seed && documentIsHTML ) { 2899 2900 // Try to shortcut find operations when possible (e.g., not under DocumentFragment) 2901 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { 2902 // Speed-up: Sizzle("#ID") 2903 if ( (m = match[1]) ) { 2904 if ( nodeType === 9 ) { 2905 elem = context.getElementById( m ); 2906 // Check parentNode to catch when Blackberry 4.6 returns 2907 // nodes that are no longer in the document (jQuery #6963) 2908 if ( elem && elem.parentNode ) { 2909 // Handle the case where IE, Opera, and Webkit return items 2910 // by name instead of ID 2911 if ( elem.id === m ) { 2912 results.push( elem ); 2913 return results; 2914 } 2915 } else { 2916 return results; 2917 } 2918 } else { 2919 // Context is not a document 2920 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && 2921 contains( context, elem ) && elem.id === m ) { 2922 results.push( elem ); 2923 return results; 2924 } 2925 } 2926 2927 // Speed-up: Sizzle("TAG") 2928 } else if ( match[2] ) { 2929 push.apply( results, context.getElementsByTagName( selector ) ); 2930 return results; 2931 2932 // Speed-up: Sizzle(".CLASS") 2933 } else if ( (m = match[3]) && support.getElementsByClassName ) { 2934 push.apply( results, context.getElementsByClassName( m ) ); 2935 return results; 2936 } 2937 } 2938 2939 // QSA path 2940 if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { 2941 nid = old = expando; 2942 newContext = context; 2943 newSelector = nodeType !== 1 && selector; 2944 2945 // qSA works strangely on Element-rooted queries 2946 // We can work around this by specifying an extra ID on the root 2947 // and working up from there (Thanks to Andrew Dupont for the technique) 2948 // IE 8 doesn't work on object elements 2949 if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { 2950 groups = tokenize( selector ); 2951 2952 if ( (old = context.getAttribute("id")) ) { 2953 nid = old.replace( rescape, "\\$&" ); 2954 } else { 2955 context.setAttribute( "id", nid ); 2956 } 2957 nid = "[id='" + nid + "'] "; 2958 2959 i = groups.length; 2960 while ( i-- ) { 2961 groups[i] = nid + toSelector( groups[i] ); 2962 }
vendor: 4,489 bytes, lines 2963-3145
2963 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; 2964 newSelector = groups.join(","); 2965 } 2966 2967 if ( newSelector ) { 2968 try { 2969 push.apply( results, 2970 newContext.querySelectorAll( newSelector ) 2971 ); 2972 return results; 2973 } catch(qsaError) { 2974 } finally { 2975 if ( !old ) { 2976 context.removeAttribute("id"); 2977 } 2978 } 2979 } 2980 } 2981 } 2982 2983 // All others 2984 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 2985} 2986 2987/** 2988 * Create key-value caches of limited size 2989 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with 2990 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 2991 * deleting the oldest entry 2992 */ 2993function createCache() { 2994 var keys = []; 2995 2996 function cache( key, value ) { 2997 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 2998 if ( keys.push( key + " " ) > Expr.cacheLength ) { 2999 // Only keep the most recent entries 3000 delete cache[ keys.shift() ]; 3001 } 3002 return (cache[ key + " " ] = value); 3003 } 3004 return cache; 3005} 3006 3007/** 3008 * Mark a function for special use by Sizzle 3009 * @param {Function} fn The function to mark 3010 */ 3011function markFunction( fn ) { 3012 fn[ expando ] = true; 3013 return fn; 3014} 3015 3016/** 3017 * Support testing using an element 3018 * @param {Function} fn Passed the created div and expects a boolean result 3019 */ 3020function assert( fn ) { 3021 var div = document.createElement("div"); 3022 3023 try { 3024 return !!fn( div ); 3025 } catch (e) { 3026 return false; 3027 } finally { 3028 // Remove from its parent by default 3029 if ( div.parentNode ) { 3030 div.parentNode.removeChild( div ); 3031 } 3032 // release memory in IE 3033 div = null; 3034 } 3035} 3036 3037/** 3038 * Adds the same handler for all of the specified attrs 3039 * @param {String} attrs Pipe-separated list of attributes 3040 * @param {Function} handler The method that will be applied 3041 */ 3042function addHandle( attrs, handler ) { 3043 var arr = attrs.split("|"), 3044 i = attrs.length; 3045 3046 while ( i-- ) { 3047 Expr.attrHandle[ arr[i] ] = handler; 3048 } 3049} 3050 3051/** 3052 * Checks document order of two siblings 3053 * @param {Element} a 3054 * @param {Element} b 3055 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 3056 */ 3057function siblingCheck( a, b ) { 3058 var cur = b && a, 3059 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 3060 ( ~b.sourceIndex || MAX_NEGATIVE ) - 3061 ( ~a.sourceIndex || MAX_NEGATIVE ); 3062 3063 // Use IE sourceIndex if available on both nodes 3064 if ( diff ) { 3065 return diff; 3066 } 3067 3068 // Check if b follows a 3069 if ( cur ) { 3070 while ( (cur = cur.nextSibling) ) { 3071 if ( cur === b ) { 3072 return -1; 3073 } 3074 } 3075 } 3076 3077 return a ? 1 : -1; 3078} 3079 3080/** 3081 * Returns a function to use in pseudos for input types 3082 * @param {String} type 3083 */ 3084function createInputPseudo( type ) { 3085 return function( elem ) { 3086 var name = elem.nodeName.toLowerCase(); 3087 return name === "input" && elem.type === type; 3088 }; 3089} 3090 3091/** 3092 * Returns a function to use in pseudos for buttons 3093 * @param {String} type 3094 */ 3095function createButtonPseudo( type ) { 3096 return function( elem ) { 3097 var name = elem.nodeName.toLowerCase(); 3098 return (name === "input" || name === "button") && elem.type === type; 3099 }; 3100} 3101 3102/** 3103 * Returns a function to use in pseudos for positionals 3104 * @param {Function} fn 3105 */ 3106function createPositionalPseudo( fn ) { 3107 return markFunction(function( argument ) { 3108 argument = +argument; 3109 return markFunction(function( seed, matches ) { 3110 var j, 3111 matchIndexes = fn( [], seed.length, argument ), 3112 i = matchIndexes.length; 3113 3114 // Match elements found at the specified indexes 3115 while ( i-- ) { 3116 if ( seed[ (j = matchIndexes[i]) ] ) { 3117 seed[j] = !(matches[j] = seed[j]); 3118 } 3119 } 3120 }); 3121 }); 3122} 3123 3124/** 3125 * Checks a node for validity as a Sizzle context 3126 * @param {Element|Object=} context 3127 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 3128 */ 3129function testContext( context ) { 3130 return context && typeof context.getElementsByTagName !== "undefined" && context; 3131} 3132 3133// Expose support vars for convenience 3134support = Sizzle.support = {}; 3135 3136/** 3137 * Detects XML nodes 3138 * @param {Element|Object} elem An element or a document 3139 * @returns {Boolean} True iff elem is a non-HTML XML node 3140 */ 3141isXML = Sizzle.isXML = function( elem ) { 3142 // documentElement is verified for cases where it doesn't yet exist 3143 // (such as loading iframes in IE - #4833) 3144 var documentElement = elem && (elem.ownerDocument || elem).documentElement; 3145 return documentElement ? documentElement.nodeName !== "HTML" : false;
3146}; 3147 3148/** 3149 * Sets document-related variables once based on the current document 3150 * @param {Element|Object} [doc] An element or document object to use to set the document 3151 * @returns {Object} Returns the current document 3152 */ 3153setDocument = Sizzle.setDocument = function( node ) { 3154 var hasCompare, parent, 3155 doc = node ? node.ownerDocument || node : preferredDoc; 3156 3157 // If no document and documentElement is available, return 3158 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { 3159 return document; 3160 } 3161 3162 // Set our document 3163 document = doc; 3164 docElem = doc.documentElement; 3165 parent = doc.defaultView; 3166 3167 // Support: IE>8 3168 // If iframe document is assigned to "document" variable and if iframe has been reloaded, 3169 // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 3170 // IE6-8 do not support the defaultView property so parent will be undefined 3171 if ( parent && parent !== parent.top ) { 3172 // IE11 does not have attachEvent, so all must suffer 3173 if ( parent.addEventListener ) { 3174 parent.addEventListener( "unload", unloadHandler, false ); 3175 } else if ( parent.attachEvent ) { 3176 parent.attachEvent( "onunload", unloadHandler ); 3177 } 3178 } 3179 3180 /* Support tests 3181 ---------------------------------------------------------------------- */ 3182 documentIsHTML = !isXML( doc ); 3183 3184 /* Attributes 3185 ---------------------------------------------------------------------- */ 3186 3187 // Support: IE<8 3188 // Verify that getAttribute really returns attributes and not properties 3189 // (excepting IE8 booleans) 3190 support.attributes = assert(function( div ) { 3191 div.className = "i"; 3192 return !div.getAttribute("className"); 3193 }); 3194 3195 /* getElement(s)By* 3196 ---------------------------------------------------------------------- */ 3197 3198 // Check if getElementsByTagName("*") returns only elements 3199 support.getElementsByTagName = assert(function( div ) { 3200 div.appendChild( doc.createComment("") ); 3201 return !div.getElementsByTagName("*").length; 3202 }); 3203 3204 // Support: IE<9 3205 support.getElementsByClassName = rnative.test( doc.getElementsByClassName ); 3206 3207 // Support: IE<10 3208 // Check if getElementById returns elements by name 3209 // The broken getElementById methods don't pick up programatically-set names, 3210 // so use a roundabout getElementsByName test 3211 support.getById = assert(function( div ) { 3212 docElem.appendChild( div ).id = expando; 3213 return !doc.getElementsByName || !doc.getElementsByName( expando ).length; 3214 }); 3215 3216 // ID find and filter 3217 if ( support.getById ) { 3218 Expr.find["ID"] = function( id, context ) { 3219 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 3220 var m = context.getElementById( id ); 3221 // Check parentNode to catch when Blackberry 4.6 returns 3222 // nodes that are no longer in the document #6963 3223 return m && m.parentNode ? [ m ] : []; 3224 } 3225 }; 3226 Expr.filter["ID"] = function( id ) { 3227 var attrId = id.replace( runescape, funescape ); 3228 return function( elem ) { 3229 return elem.getAttribute("id") === attrId; 3230 }; 3231 }; 3232 } else {
vendor: 10,252 bytes, lines 3233-3583
3233 // Support: IE6/7 3234 // getElementById is not reliable as a find shortcut 3235 delete Expr.find["ID"]; 3236 3237 Expr.filter["ID"] = function( id ) { 3238 var attrId = id.replace( runescape, funescape ); 3239 return function( elem ) { 3240 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); 3241 return node && node.value === attrId; 3242 }; 3243 }; 3244 } 3245 3246 // Tag 3247 Expr.find["TAG"] = support.getElementsByTagName ? 3248 function( tag, context ) { 3249 if ( typeof context.getElementsByTagName !== "undefined" ) { 3250 return context.getElementsByTagName( tag ); 3251 3252 // DocumentFragment nodes don't have gEBTN 3253 } else if ( support.qsa ) { 3254 return context.querySelectorAll( tag ); 3255 } 3256 } : 3257 3258 function( tag, context ) { 3259 var elem, 3260 tmp = [], 3261 i = 0, 3262 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 3263 results = context.getElementsByTagName( tag ); 3264 3265 // Filter out possible comments 3266 if ( tag === "*" ) { 3267 while ( (elem = results[i++]) ) { 3268 if ( elem.nodeType === 1 ) { 3269 tmp.push( elem ); 3270 } 3271 } 3272 3273 return tmp; 3274 } 3275 return results; 3276 }; 3277 3278 // Class 3279 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { 3280 if ( documentIsHTML ) { 3281 return context.getElementsByClassName( className ); 3282 } 3283 }; 3284 3285 /* QSA/matchesSelector 3286 ---------------------------------------------------------------------- */ 3287 3288 // QSA and matchesSelector support 3289 3290 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 3291 rbuggyMatches = []; 3292 3293 // qSa(:focus) reports false when true (Chrome 21) 3294 // We allow this because of a bug in IE8/9 that throws an error 3295 // whenever `document.activeElement` is accessed on an iframe 3296 // So, we allow :focus to pass through QSA all the time to avoid the IE error 3297 // See http://bugs.jquery.com/ticket/13378 3298 rbuggyQSA = []; 3299 3300 if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { 3301 // Build QSA regex 3302 // Regex strategy adopted from Diego Perini 3303 assert(function( div ) { 3304 // Select is set to empty string on purpose 3305 // This is to test IE's treatment of not explicitly 3306 // setting a boolean content attribute, 3307 // since its presence should be enough 3308 // http://bugs.jquery.com/ticket/12359 3309 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" + 3310 "<select id='" + expando + "-\f]' msallowcapture=''>" + 3311 "<option selected=''></option></select>"; 3312 3313 // Support: IE8, Opera 11-12.16 3314 // Nothing should be selected when empty strings follow ^= or $= or *= 3315 // The test attribute must be unknown in Opera but "safe" for WinRT 3316 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 3317 if ( div.querySelectorAll("[msallowcapture^='']").length ) { 3318 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 3319 } 3320 3321 // Support: IE8 3322 // Boolean attributes and "value" are not treated correctly 3323 if ( !div.querySelectorAll("[selected]").length ) { 3324 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 3325 } 3326 3327 // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+ 3328 if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 3329 rbuggyQSA.push("~="); 3330 } 3331 3332 // Webkit/Opera - :checked should return selected option elements 3333 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 3334 // IE8 throws error here and will not see later tests 3335 if ( !div.querySelectorAll(":checked").length ) { 3336 rbuggyQSA.push(":checked"); 3337 } 3338 3339 // Support: Safari 8+, iOS 8+ 3340 // https://bugs.webkit.org/show_bug.cgi?id=136851 3341 // In-page `selector#id sibing-combinator selector` fails 3342 if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { 3343 rbuggyQSA.push(".#.+[+~]"); 3344 } 3345 }); 3346 3347 assert(function( div ) { 3348 // Support: Windows 8 Native Apps 3349 // The type and name attributes are restricted during .innerHTML assignment 3350 var input = doc.createElement("input"); 3351 input.setAttribute( "type", "hidden" ); 3352 div.appendChild( input ).setAttribute( "name", "D" ); 3353 3354 // Support: IE8 3355 // Enforce case-sensitivity of name attribute 3356 if ( div.querySelectorAll("[name=d]").length ) { 3357 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 3358 } 3359 3360 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 3361 // IE8 throws error here and will not see later tests 3362 if ( !div.querySelectorAll(":enabled").length ) { 3363 rbuggyQSA.push( ":enabled", ":disabled" ); 3364 } 3365 3366 // Opera 10-11 does not throw on post-comma invalid pseudos 3367 div.querySelectorAll("*,:x"); 3368 rbuggyQSA.push(",.*:"); 3369 }); 3370 } 3371 3372 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || 3373 docElem.webkitMatchesSelector || 3374 docElem.mozMatchesSelector || 3375 docElem.oMatchesSelector || 3376 docElem.msMatchesSelector) )) ) { 3377 3378 assert(function( div ) { 3379 // Check to see if it's possible to do matchesSelector 3380 // on a disconnected node (IE 9) 3381 support.disconnectedMatch = matches.call( div, "div" ); 3382 3383 // This should fail with an exception 3384 // Gecko does not error, returns false instead 3385 matches.call( div, "[s!='']:x" ); 3386 rbuggyMatches.push( "!=", pseudos ); 3387 }); 3388 } 3389 3390 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); 3391 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); 3392 3393 /* Contains 3394 ---------------------------------------------------------------------- */ 3395 hasCompare = rnative.test( docElem.compareDocumentPosition ); 3396 3397 // Element contains another 3398 // Purposefully does not implement inclusive descendent 3399 // As in, an element does not contain itself 3400 contains = hasCompare || rnative.test( docElem.contains ) ? 3401 function( a, b ) { 3402 var adown = a.nodeType === 9 ? a.documentElement : a, 3403 bup = b && b.parentNode; 3404 return a === bup || !!( bup && bup.nodeType === 1 && ( 3405 adown.contains ? 3406 adown.contains( bup ) : 3407 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 3408 )); 3409 } : 3410 function( a, b ) { 3411 if ( b ) { 3412 while ( (b = b.parentNode) ) { 3413 if ( b === a ) { 3414 return true; 3415 } 3416 } 3417 } 3418 return false; 3419 }; 3420 3421 /* Sorting 3422 ---------------------------------------------------------------------- */ 3423 3424 // Document order sorting 3425 sortOrder = hasCompare ? 3426 function( a, b ) { 3427 3428 // Flag for duplicate removal 3429 if ( a === b ) { 3430 hasDuplicate = true; 3431 return 0; 3432 } 3433 3434 // Sort on method existence if only one input has compareDocumentPosition 3435 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 3436 if ( compare ) { 3437 return compare; 3438 } 3439 3440 // Calculate position if both inputs belong to the same document 3441 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? 3442 a.compareDocumentPosition( b ) : 3443 3444 // Otherwise we know they are disconnected 3445 1; 3446 3447 // Disconnected nodes 3448 if ( compare & 1 || 3449 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { 3450 3451 // Choose the first element that is related to our preferred document 3452 if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { 3453 return -1; 3454 } 3455 if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { 3456 return 1; 3457 } 3458 3459 // Maintain original order 3460 return sortInput ? 3461 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 3462 0; 3463 } 3464 3465 return compare & 4 ? -1 : 1; 3466 } : 3467 function( a, b ) { 3468 // Exit early if the nodes are identical 3469 if ( a === b ) { 3470 hasDuplicate = true; 3471 return 0; 3472 } 3473 3474 var cur, 3475 i = 0, 3476 aup = a.parentNode, 3477 bup = b.parentNode, 3478 ap = [ a ], 3479 bp = [ b ]; 3480 3481 // Parentless nodes are either documents or disconnected 3482 if ( !aup || !bup ) { 3483 return a === doc ? -1 : 3484 b === doc ? 1 : 3485 aup ? -1 : 3486 bup ? 1 : 3487 sortInput ? 3488 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 3489 0; 3490 3491 // If the nodes are siblings, we can do a quick check 3492 } else if ( aup === bup ) { 3493 return siblingCheck( a, b ); 3494 } 3495 3496 // Otherwise we need full lists of their ancestors for comparison 3497 cur = a; 3498 while ( (cur = cur.parentNode) ) { 3499 ap.unshift( cur ); 3500 } 3501 cur = b; 3502 while ( (cur = cur.parentNode) ) { 3503 bp.unshift( cur ); 3504 } 3505 3506 // Walk down the tree looking for a discrepancy 3507 while ( ap[i] === bp[i] ) { 3508 i++; 3509 } 3510 3511 return i ? 3512 // Do a sibling check if the nodes have a common ancestor 3513 siblingCheck( ap[i], bp[i] ) : 3514 3515 // Otherwise nodes in our document sort first 3516 ap[i] === preferredDoc ? -1 : 3517 bp[i] === preferredDoc ? 1 : 3518 0; 3519 }; 3520 3521 return doc; 3522}; 3523 3524Sizzle.matches = function( expr, elements ) { 3525 return Sizzle( expr, null, null, elements ); 3526}; 3527 3528Sizzle.matchesSelector = function( elem, expr ) { 3529 // Set document vars if needed 3530 if ( ( elem.ownerDocument || elem ) !== document ) { 3531 setDocument( elem ); 3532 } 3533 3534 // Make sure that attribute selectors are quoted 3535 expr = expr.replace( rattributeQuotes, "='$1']" ); 3536 3537 if ( support.matchesSelector && documentIsHTML && 3538 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 3539 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 3540 3541 try { 3542 var ret = matches.call( elem, expr ); 3543 3544 // IE 9's matchesSelector returns false on disconnected nodes 3545 if ( ret || support.disconnectedMatch || 3546 // As well, disconnected nodes are said to be in a document 3547 // fragment in IE 9 3548 elem.document && elem.document.nodeType !== 11 ) { 3549 return ret; 3550 } 3551 } catch (e) {} 3552 } 3553 3554 return Sizzle( expr, document, null, [ elem ] ).length > 0; 3555}; 3556 3557Sizzle.contains = function( context, elem ) { 3558 // Set document vars if needed 3559 if ( ( context.ownerDocument || context ) !== document ) { 3560 setDocument( context ); 3561 } 3562 return contains( context, elem ); 3563}; 3564 3565Sizzle.attr = function( elem, name ) { 3566 // Set document vars if needed 3567 if ( ( elem.ownerDocument || elem ) !== document ) { 3568 setDocument( elem ); 3569 } 3570 3571 var fn = Expr.attrHandle[ name.toLowerCase() ], 3572 // Don't get fooled by Object.prototype properties (jQuery #13807) 3573 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 3574 fn( elem, name, !documentIsHTML ) : 3575 undefined; 3576 3577 return val !== undefined ? 3578 val : 3579 support.attributes || !documentIsHTML ? 3580 elem.getAttribute( name ) : 3581 (val = elem.getAttributeNode(name)) && val.specified ? 3582 val.value : 3583 null
vendor: 6,106 bytes, lines 3583-3811
3583; 3584}; 3585 3586Sizzle.error = function( msg ) { 3587 throw new Error( "Syntax error, unrecognized expression: " + msg ); 3588}; 3589 3590/** 3591 * Document sorting and removing duplicates 3592 * @param {ArrayLike} results 3593 */ 3594Sizzle.uniqueSort = function( results ) { 3595 var elem, 3596 duplicates = [], 3597 j = 0, 3598 i = 0; 3599 3600 // Unless we *know* we can detect duplicates, assume their presence 3601 hasDuplicate = !support.detectDuplicates; 3602 sortInput = !support.sortStable && results.slice( 0 ); 3603 results.sort( sortOrder ); 3604 3605 if ( hasDuplicate ) { 3606 while ( (elem = results[i++]) ) { 3607 if ( elem === results[ i ] ) { 3608 j = duplicates.push( i ); 3609 } 3610 } 3611 while ( j-- ) { 3612 results.splice( duplicates[ j ], 1 ); 3613 } 3614 } 3615 3616 // Clear input after sorting to release objects 3617 // See https://github.com/jquery/sizzle/pull/225 3618 sortInput = null; 3619 3620 return results; 3621}; 3622 3623/** 3624 * Utility function for retrieving the text value of an array of DOM nodes 3625 * @param {Array|Element} elem 3626 */ 3627getText = Sizzle.getText = function( elem ) { 3628 var node, 3629 ret = "", 3630 i = 0, 3631 nodeType = elem.nodeType; 3632 3633 if ( !nodeType ) { 3634 // If no nodeType, this is expected to be an array 3635 while ( (node = elem[i++]) ) { 3636 // Do not traverse comment nodes 3637 ret += getText( node ); 3638 } 3639 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 3640 // Use textContent for elements 3641 // innerText usage removed for consistency of new lines (jQuery #11153) 3642 if ( typeof elem.textContent === "string" ) { 3643 return elem.textContent; 3644 } else { 3645 // Traverse its children 3646 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 3647 ret += getText( elem ); 3648 } 3649 } 3650 } else if ( nodeType === 3 || nodeType === 4 ) { 3651 return elem.nodeValue; 3652 } 3653 // Do not include comment or processing instruction nodes 3654 3655 return ret; 3656}; 3657 3658Expr = Sizzle.selectors = { 3659 3660 // Can be adjusted by the user 3661 cacheLength: 50, 3662 3663 createPseudo: markFunction, 3664 3665 match: matchExpr, 3666 3667 attrHandle: {}, 3668 3669 find: {}, 3670 3671 relative: { 3672 ">": { dir: "parentNode", first: true }, 3673 " ": { dir: "parentNode" }, 3674 "+": { dir: "previousSibling", first: true }, 3675 "~": { dir: "previousSibling" } 3676 }, 3677 3678 preFilter: { 3679 "ATTR": function( match ) { 3680 match[1] = match[1].replace( runescape, funescape ); 3681 3682 // Move the given value to match[3] whether quoted or unquoted 3683 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); 3684 3685 if ( match[2] === "~=" ) { 3686 match[3] = " " + match[3] + " "; 3687 } 3688 3689 return match.slice( 0, 4 ); 3690 }, 3691 3692 "CHILD": function( match ) { 3693 /* matches from matchExpr["CHILD"] 3694 1 type (only|nth|...) 3695 2 what (child|of-type) 3696 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 3697 4 xn-component of xn+y argument ([+-]?\d*n|) 3698 5 sign of xn-component 3699 6 x of xn-component 3700 7 sign of y-component 3701 8 y of y-component 3702 */ 3703 match[1] = match[1].toLowerCase(); 3704 3705 if ( match[1].slice( 0, 3 ) === "nth" ) { 3706 // nth-* requires argument 3707 if ( !match[3] ) { 3708 Sizzle.error( match[0] ); 3709 } 3710 3711 // numeric x and y parameters for Expr.filter.CHILD 3712 // remember that false/true cast respectively to 0/1 3713 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); 3714 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); 3715 3716 // other types prohibit arguments 3717 } else if ( match[3] ) { 3718 Sizzle.error( match[0] ); 3719 } 3720 3721 return match; 3722 }, 3723 3724 "PSEUDO": function( match ) { 3725 var excess, 3726 unquoted = !match[6] && match[2]; 3727 3728 if ( matchExpr["CHILD"].test( match[0] ) ) { 3729 return null; 3730 } 3731 3732 // Accept quoted arguments as-is 3733 if ( match[3] ) { 3734 match[2] = match[4] || match[5] || ""; 3735 3736 // Strip excess characters from unquoted arguments 3737 } else if ( unquoted && rpseudo.test( unquoted ) && 3738 // Get excess from tokenize (recursively) 3739 (excess = tokenize( unquoted, true )) && 3740 // advance to the next closing parenthesis 3741 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { 3742 3743 // excess is a negative index 3744 match[0] = match[0].slice( 0, excess ); 3745 match[2] = unquoted.slice( 0, excess ); 3746 } 3747 3748 // Return only captures needed by the pseudo filter method (type and argument) 3749 return match.slice( 0, 3 ); 3750 } 3751 }, 3752 3753 filter: { 3754 3755 "TAG": function( nodeNameSelector ) { 3756 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 3757 return nodeNameSelector === "*" ? 3758 function() { return true; } : 3759 function( elem ) { 3760 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 3761 }; 3762 }, 3763 3764 "CLASS": function( className ) { 3765 var pattern = classCache[ className + " " ]; 3766 3767 return pattern || 3768 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && 3769 classCache( className, function( elem ) { 3770 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); 3771 }); 3772 }, 3773 3774 "ATTR": function( name, operator, check ) { 3775 return function( elem ) { 3776 var result = Sizzle.attr( elem, name ); 3777 3778 if ( result == null ) { 3779 return operator === "!="; 3780 } 3781 if ( !operator ) { 3782 return true; 3783 } 3784 3785 result += ""; 3786 3787 return operator === "=" ? result === check : 3788 operator === "!=" ? result !== check : 3789 operator === "^=" ? check && result.indexOf( check ) === 0 : 3790 operator === "*=" ? check && result.indexOf( check ) > -1 : 3791 operator === "$=" ? check && result.slice( -check.length ) === check : 3792 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 3793 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 3794 false; 3795 }; 3796 }, 3797 3798 "CHILD": function( type, what, argument, first, last ) { 3799 var simple = type.slice( 0, 3 ) !== "nth", 3800 forward = type.slice( -4 ) !== "last", 3801 ofType = what === "of-type"; 3802 3803 return first === 1 && last === 0 ? 3804 3805 // Shortcut for :nth-*(n) 3806 function( elem ) { 3807 return !!elem.parentNode; 3808 } : 3809 3810 function( elem, context, xml ) { 3811 var cache,
vendor: 28,348 bytes, lines 3811-4813
3811outerCache, node, diff, nodeIndex, start, 3812 dir = simple !== forward ? "nextSibling" : "previousSibling", 3813 parent = elem.parentNode, 3814 name = ofType && elem.nodeName.toLowerCase(), 3815 useCache = !xml && !ofType; 3816 3817 if ( parent ) { 3818 3819 // :(first|last|only)-(child|of-type) 3820 if ( simple ) { 3821 while ( dir ) { 3822 node = elem; 3823 while ( (node = node[ dir ]) ) { 3824 if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { 3825 return false; 3826 } 3827 } 3828 // Reverse direction for :only-* (if we haven't yet done so) 3829 start = dir = type === "only" && !start && "nextSibling"; 3830 } 3831 return true; 3832 } 3833 3834 start = [ forward ? parent.firstChild : parent.lastChild ]; 3835 3836 // non-xml :nth-child(...) stores cache data on `parent` 3837 if ( forward && useCache ) { 3838 // Seek `elem` from a previously-cached index 3839 outerCache = parent[ expando ] || (parent[ expando ] = {}); 3840 cache = outerCache[ type ] || []; 3841 nodeIndex = cache[0] === dirruns && cache[1]; 3842 diff = cache[0] === dirruns && cache[2]; 3843 node = nodeIndex && parent.childNodes[ nodeIndex ]; 3844 3845 while ( (node = ++nodeIndex && node && node[ dir ] || 3846 3847 // Fallback to seeking `elem` from the start 3848 (diff = nodeIndex = 0) || start.pop()) ) { 3849 3850 // When found, cache indexes on `parent` and break 3851 if ( node.nodeType === 1 && ++diff && node === elem ) { 3852 outerCache[ type ] = [ dirruns, nodeIndex, diff ]; 3853 break; 3854 } 3855 } 3856 3857 // Use previously-cached element index if available 3858 } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { 3859 diff = cache[1]; 3860 3861 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) 3862 } else { 3863 // Use the same loop as above to seek `elem` from the start 3864 while ( (node = ++nodeIndex && node && node[ dir ] || 3865 (diff = nodeIndex = 0) || start.pop()) ) { 3866 3867 if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { 3868 // Cache the index of each encountered element 3869 if ( useCache ) { 3870 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; 3871 } 3872 3873 if ( node === elem ) { 3874 break; 3875 } 3876 } 3877 } 3878 } 3879 3880 // Incorporate the offset, then check against cycle size 3881 diff -= last; 3882 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 3883 } 3884 }; 3885 }, 3886 3887 "PSEUDO": function( pseudo, argument ) { 3888 // pseudo-class names are case-insensitive 3889 // http://www.w3.org/TR/selectors/#pseudo-classes 3890 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 3891 // Remember that setFilters inherits from pseudos 3892 var args, 3893 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 3894 Sizzle.error( "unsupported pseudo: " + pseudo ); 3895 3896 // The user may use createPseudo to indicate that 3897 // arguments are needed to create the filter function 3898 // just as Sizzle does 3899 if ( fn[ expando ] ) { 3900 return fn( argument ); 3901 } 3902 3903 // But maintain support for old signatures 3904 if ( fn.length > 1 ) { 3905 args = [ pseudo, pseudo, "", argument ]; 3906 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 3907 markFunction(function( seed, matches ) { 3908 var idx, 3909 matched = fn( seed, argument ), 3910 i = matched.length; 3911 while ( i-- ) { 3912 idx = indexOf( seed, matched[i] ); 3913 seed[ idx ] = !( matches[ idx ] = matched[i] ); 3914 } 3915 }) : 3916 function( elem ) { 3917 return fn( elem, 0, args ); 3918 }; 3919 } 3920 3921 return fn; 3922 } 3923 }, 3924 3925 pseudos: { 3926 // Potentially complex pseudos 3927 "not": markFunction(function( selector ) { 3928 // Trim the selector passed to compile 3929 // to avoid treating leading and trailing 3930 // spaces as combinators 3931 var input = [], 3932 results = [], 3933 matcher = compile( selector.replace( rtrim, "$1" ) ); 3934 3935 return matcher[ expando ] ? 3936 markFunction(function( seed, matches, context, xml ) { 3937 var elem, 3938 unmatched = matcher( seed, null, xml, [] ), 3939 i = seed.length; 3940 3941 // Match elements unmatched by `matcher` 3942 while ( i-- ) { 3943 if ( (elem = unmatched[i]) ) { 3944 seed[i] = !(matches[i] = elem); 3945 } 3946 } 3947 }) : 3948 function( elem, context, xml ) { 3949 input[0] = elem; 3950 matcher( input, null, xml, results ); 3951 // Don't keep the element (issue #299) 3952 input[0] = null; 3953 return !results.pop(); 3954 }; 3955 }), 3956 3957 "has": markFunction(function( selector ) { 3958 return function( elem ) { 3959 return Sizzle( selector, elem ).length > 0; 3960 }; 3961 }), 3962 3963 "contains": markFunction(function( text ) { 3964 text = text.replace( runescape, funescape ); 3965 return function( elem ) { 3966 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; 3967 }; 3968 }), 3969 3970 // "Whether an element is represented by a :lang() selector 3971 // is based solely on the element's language value 3972 // being equal to the identifier C, 3973 // or beginning with the identifier C immediately followed by "-". 3974 // The matching of C against the element's language value is performed case-insensitively. 3975 // The identifier C does not have to be a valid language name." 3976 // http://www.w3.org/TR/selectors/#lang-pseudo 3977 "lang": markFunction( function( lang ) { 3978 // lang value must be a valid identifier 3979 if ( !ridentifier.test(lang || "") ) { 3980 Sizzle.error( "unsupported lang: " + lang ); 3981 } 3982 lang = lang.replace( runescape, funescape ).toLowerCase(); 3983 return function( elem ) { 3984 var elemLang; 3985 do { 3986 if ( (elemLang = documentIsHTML ? 3987 elem.lang : 3988 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { 3989 3990 elemLang = elemLang.toLowerCase(); 3991 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 3992 } 3993 } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); 3994 return false; 3995 }; 3996 }), 3997 3998 // Miscellaneous 3999 "target": function( elem ) { 4000 var hash = window.location && window.location.hash; 4001 return hash && hash.slice( 1 ) === elem.id; 4002 }, 4003 4004 "root": function( elem ) { 4005 return elem === docElem; 4006 }, 4007 4008 "focus": function( elem ) { 4009 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); 4010 }, 4011 4012 // Boolean properties 4013 "enabled": function( elem ) { 4014 return elem.disabled === false; 4015 }, 4016 4017 "disabled": function( elem ) { 4018 return elem.disabled === true; 4019 }, 4020 4021 "checked": function( elem ) { 4022 // In CSS3, :checked should return both checked and selected elements 4023 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 4024 var nodeName = elem.nodeName.toLowerCase(); 4025 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); 4026 }, 4027 4028 "selected": function( elem ) { 4029 // Accessing this property makes selected-by-default 4030 // options in Safari work properly 4031 if ( elem.parentNode ) { 4032 elem.parentNode.selectedIndex; 4033 } 4034 4035 return elem.selected === true; 4036 }, 4037 4038 // Contents 4039 "empty": function( elem ) { 4040 // http://www.w3.org/TR/selectors/#empty-pseudo 4041 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 4042 // but not by others (comment: 8; processing instruction: 7; etc.) 4043 // nodeType < 6 works because attributes (2) do not appear as children 4044 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 4045 if ( elem.nodeType < 6 ) { 4046 return false; 4047 } 4048 } 4049 return true; 4050 }, 4051 4052 "parent": function( elem ) { 4053 return !Expr.pseudos["empty"]( elem ); 4054 }, 4055 4056 // Element/input types 4057 "header": function( elem ) { 4058 return rheader.test( elem.nodeName ); 4059 }, 4060 4061 "input": function( elem ) { 4062 return rinputs.test( elem.nodeName ); 4063 }, 4064 4065 "button": function( elem ) { 4066 var name = elem.nodeName.toLowerCase(); 4067 return name === "input" && elem.type === "button" || name === "button"; 4068 }, 4069 4070 "text": function( elem ) { 4071 var attr; 4072 return elem.nodeName.toLowerCase() === "input" && 4073 elem.type === "text" && 4074 4075 // Support: IE<8 4076 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 4077 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); 4078 }, 4079 4080 // Position-in-collection 4081 "first": createPositionalPseudo(function() { 4082 return [ 0 ]; 4083 }), 4084 4085 "last": createPositionalPseudo(function( matchIndexes, length ) { 4086 return [ length - 1 ]; 4087 }), 4088 4089 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { 4090 return [ argument < 0 ? argument + length : argument ]; 4091 }), 4092 4093 "even": createPositionalPseudo(function( matchIndexes, length ) { 4094 var i = 0; 4095 for ( ; i < length; i += 2 ) { 4096 matchIndexes.push( i ); 4097 } 4098 return matchIndexes; 4099 }), 4100 4101 "odd": createPositionalPseudo(function( matchIndexes, length ) { 4102 var i = 1; 4103 for ( ; i < length; i += 2 ) { 4104 matchIndexes.push( i ); 4105 } 4106 return matchIndexes; 4107 }), 4108 4109 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { 4110 var i = argument < 0 ? argument + length : argument; 4111 for ( ; --i >= 0; ) { 4112 matchIndexes.push( i ); 4113 } 4114 return matchIndexes; 4115 }), 4116 4117 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { 4118 var i = argument < 0 ? argument + length : argument; 4119 for ( ; ++i < length; ) { 4120 matchIndexes.push( i ); 4121 } 4122 return matchIndexes; 4123 }) 4124 } 4125}; 4126 4127Expr.pseudos["nth"] = Expr.pseudos["eq"]; 4128 4129// Add button/input type pseudos 4130for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 4131 Expr.pseudos[ i ] = createInputPseudo( i ); 4132} 4133for ( i in { submit: true, reset: true } ) { 4134 Expr.pseudos[ i ] = createButtonPseudo( i ); 4135} 4136 4137// Easy API for creating new setFilters 4138function setFilters() {} 4139setFilters.prototype = Expr.filters = Expr.pseudos; 4140Expr.setFilters = new setFilters(); 4141 4142tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 4143 var matched, match, tokens, type, 4144 soFar, groups, preFilters, 4145 cached = tokenCache[ selector + " " ]; 4146 4147 if ( cached ) { 4148 return parseOnly ? 0 : cached.slice( 0 ); 4149 } 4150 4151 soFar = selector; 4152 groups = []; 4153 preFilters = Expr.preFilter; 4154 4155 while ( soFar ) { 4156 4157 // Comma and first run 4158 if ( !matched || (match = rcomma.exec( soFar )) ) { 4159 if ( match ) { 4160 // Don't consume trailing commas as valid 4161 soFar = soFar.slice( match[0].length ) || soFar; 4162 } 4163 groups.push( (tokens = []) ); 4164 } 4165 4166 matched = false; 4167 4168 // Combinators 4169 if ( (match = rcombinators.exec( soFar )) ) { 4170 matched = match.shift(); 4171 tokens.push({ 4172 value: matched, 4173 // Cast descendant combinators to space 4174 type: match[0].replace( rtrim, " " ) 4175 }); 4176 soFar = soFar.slice( matched.length ); 4177 } 4178 4179 // Filters 4180 for ( type in Expr.filter ) { 4181 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || 4182 (match = preFilters[ type ]( match ))) ) { 4183 matched = match.shift(); 4184 tokens.push({ 4185 value: matched, 4186 type: type, 4187 matches: match 4188 }); 4189 soFar = soFar.slice( matched.length ); 4190 } 4191 } 4192 4193 if ( !matched ) { 4194 break; 4195 } 4196 } 4197 4198 // Return the length of the invalid excess 4199 // if we're just parsing 4200 // Otherwise, throw an error or return tokens 4201 return parseOnly ? 4202 soFar.length : 4203 soFar ? 4204 Sizzle.error( selector ) : 4205 // Cache the tokens 4206 tokenCache( selector, groups ).slice( 0 ); 4207}; 4208 4209function toSelector( tokens ) { 4210 var i = 0, 4211 len = tokens.length, 4212 selector = ""; 4213 for ( ; i < len; i++ ) { 4214 selector += tokens[i].value; 4215 } 4216 return selector; 4217} 4218 4219function addCombinator( matcher, combinator, base ) { 4220 var dir = combinator.dir, 4221 checkNonElements = base && dir === "parentNode", 4222 doneName = done++; 4223 4224 return combinator.first ? 4225 // Check against closest ancestor/preceding element 4226 function( elem, context, xml ) { 4227 while ( (elem = elem[ dir ]) ) { 4228 if ( elem.nodeType === 1 || checkNonElements ) { 4229 return matcher( elem, context, xml ); 4230 } 4231 } 4232 } : 4233 4234 // Check against all ancestor/preceding elements 4235 function( elem, context, xml ) { 4236 var oldCache, outerCache, 4237 newCache = [ dirruns, doneName ]; 4238 4239 // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching 4240 if ( xml ) { 4241 while ( (elem = elem[ dir ]) ) { 4242 if ( elem.nodeType === 1 || checkNonElements ) { 4243 if ( matcher( elem, context, xml ) ) { 4244 return true; 4245 } 4246 } 4247 } 4248 } else { 4249 while ( (elem = elem[ dir ]) ) { 4250 if ( elem.nodeType === 1 || checkNonElements ) { 4251 outerCache = elem[ expando ] || (elem[ expando ] = {}); 4252 if ( (oldCache = outerCache[ dir ]) && 4253 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 4254 4255 // Assign to newCache so results back-propagate to previous elements 4256 return (newCache[ 2 ] = oldCache[ 2 ]); 4257 } else { 4258 // Reuse newcache so results back-propagate to previous elements 4259 outerCache[ dir ] = newCache; 4260 4261 // A match means we're done; a fail means we have to keep checking 4262 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { 4263 return true; 4264 } 4265 } 4266 } 4267 } 4268 } 4269 }; 4270} 4271 4272function elementMatcher( matchers ) { 4273 return matchers.length > 1 ? 4274 function( elem, context, xml ) { 4275 var i = matchers.length; 4276 while ( i-- ) { 4277 if ( !matchers[i]( elem, context, xml ) ) { 4278 return false; 4279 } 4280 } 4281 return true; 4282 } : 4283 matchers[0]; 4284} 4285 4286function multipleContexts( selector, contexts, results ) { 4287 var i = 0, 4288 len = contexts.length; 4289 for ( ; i < len; i++ ) { 4290 Sizzle( selector, contexts[i], results ); 4291 } 4292 return results; 4293} 4294 4295function condense( unmatched, map, filter, context, xml ) { 4296 var elem, 4297 newUnmatched = [], 4298 i = 0, 4299 len = unmatched.length, 4300 mapped = map != null; 4301 4302 for ( ; i < len; i++ ) { 4303 if ( (elem = unmatched[i]) ) { 4304 if ( !filter || filter( elem, context, xml ) ) { 4305 newUnmatched.push( elem ); 4306 if ( mapped ) { 4307 map.push( i ); 4308 } 4309 } 4310 } 4311 } 4312 4313 return newUnmatched; 4314} 4315 4316function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 4317 if ( postFilter && !postFilter[ expando ] ) { 4318 postFilter = setMatcher( postFilter ); 4319 } 4320 if ( postFinder && !postFinder[ expando ] ) { 4321 postFinder = setMatcher( postFinder, postSelector ); 4322 } 4323 return markFunction(function( seed, results, context, xml ) { 4324 var temp, i, elem, 4325 preMap = [], 4326 postMap = [], 4327 preexisting = results.length, 4328 4329 // Get initial elements from seed or context 4330 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), 4331 4332 // Prefilter to get matcher input, preserving a map for seed-results synchronization 4333 matcherIn = preFilter && ( seed || !selector ) ? 4334 condense( elems, preMap, preFilter, context, xml ) : 4335 elems, 4336 4337 matcherOut = matcher ? 4338 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 4339 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 4340 4341 // ...intermediate processing is necessary 4342 [] : 4343 4344 // ...otherwise use results directly 4345 results : 4346 matcherIn; 4347 4348 // Find primary matches 4349 if ( matcher ) { 4350 matcher( matcherIn, matcherOut, context, xml ); 4351 } 4352 4353 // Apply postFilter 4354 if ( postFilter ) { 4355 temp = condense( matcherOut, postMap ); 4356 postFilter( temp, [], context, xml ); 4357 4358 // Un-match failing elements by moving them back to matcherIn 4359 i = temp.length; 4360 while ( i-- ) { 4361 if ( (elem = temp[i]) ) { 4362 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); 4363 } 4364 } 4365 } 4366 4367 if ( seed ) { 4368 if ( postFinder || preFilter ) { 4369 if ( postFinder ) { 4370 // Get the final matcherOut by condensing this intermediate into postFinder contexts 4371 temp = []; 4372 i = matcherOut.length; 4373 while ( i-- ) { 4374 if ( (elem = matcherOut[i]) ) { 4375 // Restore matcherIn since elem is not yet a final match 4376 temp.push( (matcherIn[i] = elem) ); 4377 } 4378 } 4379 postFinder( null, (matcherOut = []), temp, xml ); 4380 } 4381 4382 // Move matched elements from seed to results to keep them synchronized 4383 i = matcherOut.length; 4384 while ( i-- ) { 4385 if ( (elem = matcherOut[i]) && 4386 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { 4387 4388 seed[temp] = !(results[temp] = elem); 4389 } 4390 } 4391 } 4392 4393 // Add elements to results, through postFinder if defined 4394 } else { 4395 matcherOut = condense( 4396 matcherOut === results ? 4397 matcherOut.splice( preexisting, matcherOut.length ) : 4398 matcherOut 4399 ); 4400 if ( postFinder ) { 4401 postFinder( null, results, matcherOut, xml ); 4402 } else { 4403 push.apply( results, matcherOut ); 4404 } 4405 } 4406 }); 4407} 4408 4409function matcherFromTokens( tokens ) { 4410 var checkContext, matcher, j, 4411 len = tokens.length, 4412 leadingRelative = Expr.relative[ tokens[0].type ], 4413 implicitRelative = leadingRelative || Expr.relative[" "], 4414 i = leadingRelative ? 1 : 0, 4415 4416 // The foundational matcher ensures that elements are reachable from top-level context(s) 4417 matchContext = addCombinator( function( elem ) { 4418 return elem === checkContext; 4419 }, implicitRelative, true ), 4420 matchAnyContext = addCombinator( function( elem ) { 4421 return indexOf( checkContext, elem ) > -1; 4422 }, implicitRelative, true ), 4423 matchers = [ function( elem, context, xml ) { 4424 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 4425 (checkContext = context).nodeType ? 4426 matchContext( elem, context, xml ) : 4427 matchAnyContext( elem, context, xml ) ); 4428 // Avoid hanging onto element (issue #299) 4429 checkContext = null; 4430 return ret; 4431 } ]; 4432 4433 for ( ; i < len; i++ ) { 4434 if ( (matcher = Expr.relative[ tokens[i].type ]) ) { 4435 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; 4436 } else { 4437 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); 4438 4439 // Return special upon seeing a positional matcher 4440 if ( matcher[ expando ] ) { 4441 // Find the next relative operator (if any) for proper handling 4442 j = ++i; 4443 for ( ; j < len; j++ ) { 4444 if ( Expr.relative[ tokens[j].type ] ) { 4445 break; 4446 } 4447 } 4448 return setMatcher( 4449 i > 1 && elementMatcher( matchers ), 4450 i > 1 && toSelector( 4451 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 4452 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) 4453 ).replace( rtrim, "$1" ), 4454 matcher, 4455 i < j && matcherFromTokens( tokens.slice( i, j ) ), 4456 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), 4457 j < len && toSelector( tokens ) 4458 ); 4459 } 4460 matchers.push( matcher ); 4461 } 4462 } 4463 4464 return elementMatcher( matchers ); 4465} 4466 4467function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 4468 var bySet = setMatchers.length > 0, 4469 byElement = elementMatchers.length > 0, 4470 superMatcher = function( seed, context, xml, results, outermost ) { 4471 var elem, j, matcher, 4472 matchedCount = 0, 4473 i = "0", 4474 unmatched = seed && [], 4475 setMatched = [], 4476 contextBackup = outermostContext, 4477 // We must always have either seed elements or outermost context 4478 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), 4479 // Use integer dirruns iff this is the outermost matcher 4480 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), 4481 len = elems.length; 4482 4483 if ( outermost ) { 4484 outermostContext = context !== document && context; 4485 } 4486 4487 // Add elements passing elementMatchers directly to results 4488 // Keep `i` a string if there are no elements so `matchedCount` will be "00" below 4489 // Support: IE<9, Safari 4490 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 4491 for ( ; i !== len && (elem = elems[i]) != null; i++ ) { 4492 if ( byElement && elem ) { 4493 j = 0; 4494 while ( (matcher = elementMatchers[j++]) ) { 4495 if ( matcher( elem, context, xml ) ) { 4496 results.push( elem ); 4497 break; 4498 } 4499 } 4500 if ( outermost ) { 4501 dirruns = dirrunsUnique; 4502 } 4503 } 4504 4505 // Track unmatched elements for set filters 4506 if ( bySet ) { 4507 // They will have gone through all possible matchers 4508 if ( (elem = !matcher && elem) ) { 4509 matchedCount--; 4510 } 4511 4512 // Lengthen the array for every element, matched or not 4513 if ( seed ) { 4514 unmatched.push( elem ); 4515 } 4516 } 4517 } 4518 4519 // Apply set filters to unmatched elements 4520 matchedCount += i; 4521 if ( bySet && i !== matchedCount ) { 4522 j = 0; 4523 while ( (matcher = setMatchers[j++]) ) { 4524 matcher( unmatched, setMatched, context, xml ); 4525 } 4526 4527 if ( seed ) { 4528 // Reintegrate element matches to eliminate the need for sorting 4529 if ( matchedCount > 0 ) { 4530 while ( i-- ) { 4531 if ( !(unmatched[i] || setMatched[i]) ) { 4532 setMatched[i] = pop.call( results ); 4533 } 4534 } 4535 } 4536 4537 // Discard index placeholder values to get only actual matches 4538 setMatched = condense( setMatched ); 4539 } 4540 4541 // Add matches to results 4542 push.apply( results, setMatched ); 4543 4544 // Seedless set matches succeeding multiple successful matchers stipulate sorting 4545 if ( outermost && !seed && setMatched.length > 0 && 4546 ( matchedCount + setMatchers.length ) > 1 ) { 4547 4548 Sizzle.uniqueSort( results ); 4549 } 4550 } 4551 4552 // Override manipulation of globals by nested matchers 4553 if ( outermost ) { 4554 dirruns = dirrunsUnique; 4555 outermostContext = contextBackup; 4556 } 4557 4558 return unmatched; 4559 }; 4560 4561 return bySet ? 4562 markFunction( superMatcher ) : 4563 superMatcher; 4564} 4565 4566compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 4567 var i, 4568 setMatchers = [], 4569 elementMatchers = [], 4570 cached = compilerCache[ selector + " " ]; 4571 4572 if ( !cached ) { 4573 // Generate a function of recursive functions that can be used to check each element 4574 if ( !match ) { 4575 match = tokenize( selector ); 4576 } 4577 i = match.length; 4578 while ( i-- ) { 4579 cached = matcherFromTokens( match[i] ); 4580 if ( cached[ expando ] ) { 4581 setMatchers.push( cached ); 4582 } else { 4583 elementMatchers.push( cached ); 4584 } 4585 } 4586 4587 // Cache the compiled function 4588 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 4589 4590 // Save selector and tokenization 4591 cached.selector = selector; 4592 } 4593 return cached; 4594}; 4595 4596/** 4597 * A low-level selection function that works with Sizzle's compiled 4598 * selector functions 4599 * @param {String|Function} selector A selector or a pre-compiled 4600 * selector function built with Sizzle.compile 4601 * @param {Element} context 4602 * @param {Array} [results] 4603 * @param {Array} [seed] A set of elements to match against 4604 */ 4605select = Sizzle.select = function( selector, context, results, seed ) { 4606 var i, tokens, token, type, find, 4607 compiled = typeof selector === "function" && selector, 4608 match = !seed && tokenize( (selector = compiled.selector || selector) ); 4609 4610 results = results || []; 4611 4612 // Try to minimize operations if there is no seed and only one group 4613 if ( match.length === 1 ) { 4614 4615 // Take a shortcut and set the context if the root selector is an ID 4616 tokens = match[0] = match[0].slice( 0 ); 4617 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && 4618 support.getById && context.nodeType === 9 && documentIsHTML && 4619 Expr.relative[ tokens[1].type ] ) { 4620 4621 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; 4622 if ( !context ) { 4623 return results; 4624 4625 // Precompiled matchers will still verify ancestry, so step up a level 4626 } else if ( compiled ) { 4627 context = context.parentNode; 4628 } 4629 4630 selector = selector.slice( tokens.shift().value.length ); 4631 } 4632 4633 // Fetch a seed set for right-to-left matching 4634 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; 4635 while ( i-- ) { 4636 token = tokens[i]; 4637 4638 // Abort if we hit a combinator 4639 if ( Expr.relative[ (type = token.type) ] ) { 4640 break; 4641 } 4642 if ( (find = Expr.find[ type ]) ) { 4643 // Search, expanding context for leading sibling combinators 4644 if ( (seed = find( 4645 token.matches[0].replace( runescape, funescape ), 4646 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context 4647 )) ) { 4648 4649 // If seed is empty or no tokens remain, we can return early 4650 tokens.splice( i, 1 ); 4651 selector = seed.length && toSelector( tokens ); 4652 if ( !selector ) { 4653 push.apply( results, seed ); 4654 return results; 4655 } 4656 4657 break; 4658 } 4659 } 4660 } 4661 } 4662 4663 // Compile and execute a filtering function if one is not provided 4664 // Provide `match` to avoid retokenization if we modified the selector above 4665 ( compiled || compile( selector, match ) )( 4666 seed, 4667 context, 4668 !documentIsHTML, 4669 results, 4670 rsibling.test( selector ) && testContext( context.parentNode ) || context 4671 ); 4672 return results; 4673}; 4674 4675// One-time assignments 4676 4677// Sort stability 4678support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; 4679 4680// Support: Chrome 14-35+ 4681// Always assume duplicates if they aren't passed to the comparison function 4682support.detectDuplicates = !!hasDuplicate; 4683 4684// Initialize against the default document 4685setDocument(); 4686 4687// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 4688// Detached nodes confoundingly follow *each other* 4689support.sortDetached = assert(function( div1 ) { 4690 // Should return 1, but returns 4 (following) 4691 return div1.compareDocumentPosition( document.createElement("div") ) & 1; 4692}); 4693 4694// Support: IE<8 4695// Prevent attribute/property "interpolation" 4696// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 4697if ( !assert(function( div ) { 4698 div.innerHTML = "<a href='#'></a>"; 4699 return div.firstChild.getAttribute("href") === "#" ; 4700}) ) { 4701 addHandle( "type|href|height|width", function( elem, name, isXML ) { 4702 if ( !isXML ) { 4703 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 4704 } 4705 }); 4706} 4707 4708// Support: IE<9 4709// Use defaultValue in place of getAttribute("value") 4710if ( !support.attributes || !assert(function( div ) { 4711 div.innerHTML = "<input/>"; 4712 div.firstChild.setAttribute( "value", "" ); 4713 return div.firstChild.getAttribute( "value" ) === ""; 4714}) ) { 4715 addHandle( "value", function( elem, name, isXML ) { 4716 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 4717 return elem.defaultValue; 4718 } 4719 }); 4720} 4721 4722// Support: IE<9 4723// Use getAttributeNode to fetch booleans when getAttribute lies 4724if ( !assert(function( div ) { 4725 return div.getAttribute("disabled") == null; 4726}) ) { 4727 addHandle( booleans, function( elem, name, isXML ) { 4728 var val; 4729 if ( !isXML ) { 4730 return elem[ name ] === true ? name.toLowerCase() : 4731 (val = elem.getAttributeNode( name )) && val.specified ? 4732 val.value : 4733 null; 4734 } 4735 }); 4736} 4737 4738return Sizzle; 4739 4740})( window ); 4741 4742 4743 4744jQuery.find = Sizzle; 4745jQuery.expr = Sizzle.selectors; 4746jQuery.expr[":"] = jQuery.expr.pseudos; 4747jQuery.unique = Sizzle.uniqueSort; 4748jQuery.text = Sizzle.getText; 4749jQuery.isXMLDoc = Sizzle.isXML; 4750jQuery.contains = Sizzle.contains; 4751 4752 4753 4754var rneedsContext = jQuery.expr.match.needsContext; 4755 4756var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); 4757 4758 4759 4760var risSimple = /^.[^:#\[\.,]*$/; 4761 4762// Implement the identical functionality for filter and not 4763function winnow( elements, qualifier, not ) { 4764 if ( jQuery.isFunction( qualifier ) ) { 4765 return jQuery.grep( elements, function( elem, i ) { 4766 /* jshint -W018 */ 4767 return !!qualifier.call( elem, i, elem ) !== not; 4768 }); 4769 4770 } 4771 4772 if ( qualifier.nodeType ) { 4773 return jQuery.grep( elements, function( elem ) { 4774 return ( elem === qualifier ) !== not; 4775 }); 4776 4777 } 4778 4779 if ( typeof qualifier === "string" ) { 4780 if ( risSimple.test( qualifier ) ) { 4781 return jQuery.filter( qualifier, elements, not ); 4782 } 4783 4784 qualifier = jQuery.filter( qualifier, elements ); 4785 } 4786 4787 return jQuery.grep( elements, function( elem ) { 4788 return ( indexOf.call( qualifier, elem ) >= 0 ) !== not; 4789 }); 4790} 4791 4792jQuery.filter = function( expr, elems, not ) { 4793 var elem = elems[ 0 ]; 4794 4795 if ( not ) { 4796 expr = ":not(" + expr + ")"; 4797 } 4798 4799 return elems.length === 1 && elem.nodeType === 1 ? 4800 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : 4801 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 4802 return elem.nodeType === 1; 4803 })); 4804}; 4805 4806jQuery.fn.extend({ 4807 find: function( selector ) { 4808 var i, 4809 len = this.length, 4810 ret = [], 4811 self = this; 4812 4813 if ( typeof selector !== "string" ) {
4814 return this.pushStack( jQuery( selector ).filter(function() { 4815 for ( i = 0; i < len; i++ ) { 4816 if ( jQuery.contains( self[ i ], this ) ) { 4817 return true; 4818 } 4819 } 4820 }) ); 4821 } 4822 4823 for ( i = 0; i < len; i++ ) { 4824 jQuery.find( selector, self[ i ], ret ); 4825 } 4826 4827 // Needed because $( selector, context ) becomes $( context ).find( selector ) 4828 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); 4829 ret.selector = this.selector ? this.selector + " " + selector : selector; 4830 return ret; 4831 }, 4832 filter: function( selector ) { 4833 return this.pushStack( winnow(this, selector || [], false) ); 4834 }, 4835 not: function( selector ) { 4836 return this.pushStack( winnow(this, selector || [], true) ); 4837 }, 4838 is: function( selector ) { 4839 return !!winnow( 4840 this, 4841 4842 // If this is a positional/relative selector, check membership in the returned set 4843 // so $("p:first").is("p:last") won't return true for a doc with two "p". 4844 typeof selector === "string" && rneedsContext.test( selector ) ? 4845 jQuery( selector ) : 4846 selector || [], 4847 false 4848 ).length; 4849 } 4850}); 4851 4852 4853// Initialize a jQuery object 4854 4855 4856// A central reference to the root jQuery(document) 4857var rootjQuery, 4858 4859 // A simple way to check for HTML strings 4860 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 4861 // Strict HTML recognition (#11290: must start with <) 4862 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, 4863 4864 init = jQuery.fn.init = function( selector, context ) { 4865 var match, elem; 4866 4867 // HANDLE: $(""), $(null), $(undefined), $(false) 4868 if ( !selector ) { 4869 return this; 4870 } 4871 4872 // Handle HTML strings 4873 if ( typeof selector === "string" ) { 4874 if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) { 4875 // Assume that strings that start and end with <> are HTML and skip the regex check 4876 match = [ null, selector, null ]; 4877 4878 } else { 4879 match = rquickExpr.exec( selector ); 4880 } 4881 4882 // Match html or make sure no context is specified for #id 4883 if ( match && (match[1] || !context) ) { 4884 4885 // HANDLE: $(html) -> $(array) 4886 if ( match[1] ) { 4887 context = context instanceof jQuery ? context[0] : context; 4888 4889 // Option to run scripts is true for back-compat 4890 // Intentionally let the error be thrown if parseHTML is not present 4891 jQuery.merge( this, jQuery.parseHTML( 4892 match[1], 4893 context && context.nodeType ? context.ownerDocument || context : document, 4894 true 4895 ) ); 4896 4897 // HANDLE: $(html, props) 4898 if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { 4899 for ( match in context ) { 4900 // Properties of context are called as methods if possible 4901 if ( jQuery.isFunction( this[ match ] ) ) { 4902 this[ match ]( context[ match ] ); 4903 4904 // ...and otherwise set as attributes 4905 } else { 4906 this.attr( match, context[ match ] ); 4907 } 4908 } 4909 } 4910 4911 return this; 4912 4913 // HANDLE: $(#id) 4914 } else { 4915 elem = document.getElementById( match[2] ); 4916 4917 // Support: Blackberry 4.6 4918 // gEBID returns nodes no longer in the document (#6963) 4919 if ( elem && elem.parentNode ) { 4920 // Inject the element directly into the jQuery object 4921 this.length = 1; 4922 this[0] = elem; 4923 } 4924 4925 this.context = document; 4926 this.selector = selector; 4927 return this; 4928 } 4929 4930 // HANDLE: $(expr, $(...)) 4931 } else if ( !context || context.jquery ) { 4932 return ( context || rootjQuery ).find( selector ); 4933 4934 // HANDLE: $(expr, context) 4935 // (which is just equivalent to: $(context).find(expr) 4936 } else { 4937 return this.constructor( context ).find( selector ); 4938 } 4939 4940 // HANDLE: $(DOMElement) 4941 } else if ( selector.nodeType ) { 4942 this.context = this[0] = selector; 4943 this.length = 1; 4944 return this; 4945 4946 // HANDLE: $(function) 4947 // Shortcut for document ready 4948 } else if ( jQuery.isFunction( selector ) ) { 4949 return typeof rootjQuery.ready !== "undefined" ? 4950 rootjQuery.ready( selector ) : 4951 // Execute immediately if ready is not present 4952 selector( jQuery ); 4953 } 4954 4955 if ( selector.selector !== undefined ) { 4956 this.selector = selector.selector; 4957 this.context = selector.context; 4958 } 4959 4960 return jQuery.makeArray( selector, this ); 4961 }; 4962 4963// Give the init function the jQuery prototype for later instantiation 4964init.prototype = jQuery.fn; 4965 4966// Initialize central reference 4967rootjQuery = jQuery( document ); 4968 4969 4970var rparentsprev = /^(?:parents|prev(?:Until|All))/, 4971 // Methods guaranteed to produce a unique set when starting from a unique set 4972 guaranteedUnique = { 4973 children: true, 4974 contents: true, 4975 next: true, 4976 prev: true 4977 }; 4978 4979jQuery.extend({ 4980 dir: function( elem, dir, until ) { 4981 var matched = [], 4982 truncate = until !== undefined; 4983 4984 while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) { 4985 if ( elem.nodeType === 1 ) { 4986 if ( truncate && jQuery( elem ).is( until ) ) { 4987 break; 4988 } 4989 matched.push( elem ); 4990 } 4991 } 4992 return matched; 4993 }, 4994 4995 sibling: function( n, elem ) { 4996 var matched = []; 4997 4998 for ( ; n; n = n.nextSibling ) { 4999 if ( n.nodeType === 1 && n !== elem ) { 5000 matched.push( n ); 5001 } 5002 } 5003 5004 return matched; 5005 } 5006}); 5007 5008jQuery.fn.extend({ 5009 has: function( target ) { 5010 var targets = jQuery( target, this ), 5011 l = targets.length; 5012 5013 return this.filter(function() { 5014 var i = 0; 5015 for ( ; i < l; i++ ) { 5016 if ( jQuery.contains( this, targets[i] ) ) { 5017 return true; 5018 } 5019 } 5020 }); 5021 }, 5022 5023 closest: function( selectors, context ) { 5024 var cur, 5025 i = 0, 5026 l = this.length, 5027 matched = [], 5028 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
vendor: 5,006 bytes, lines 5029-5216
5029 jQuery( selectors, context || this.context ) : 5030 0; 5031 5032 for ( ; i < l; i++ ) { 5033 for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { 5034 // Always skip document fragments 5035 if ( cur.nodeType < 11 && (pos ? 5036 pos.index(cur) > -1 : 5037 5038 // Don't pass non-elements to Sizzle 5039 cur.nodeType === 1 && 5040 jQuery.find.matchesSelector(cur, selectors)) ) { 5041 5042 matched.push( cur ); 5043 break; 5044 } 5045 } 5046 } 5047 5048 return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); 5049 }, 5050 5051 // Determine the position of an element within the set 5052 index: function( elem ) { 5053 5054 // No argument, return index in parent 5055 if ( !elem ) { 5056 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 5057 } 5058 5059 // Index in selector 5060 if ( typeof elem === "string" ) { 5061 return indexOf.call( jQuery( elem ), this[ 0 ] ); 5062 } 5063 5064 // Locate the position of the desired element 5065 return indexOf.call( this, 5066 5067 // If it receives a jQuery object, the first element is used 5068 elem.jquery ? elem[ 0 ] : elem 5069 ); 5070 }, 5071 5072 add: function( selector, context ) { 5073 return this.pushStack( 5074 jQuery.unique( 5075 jQuery.merge( this.get(), jQuery( selector, context ) ) 5076 ) 5077 ); 5078 }, 5079 5080 addBack: function( selector ) { 5081 return this.add( selector == null ? 5082 this.prevObject : this.prevObject.filter(selector) 5083 ); 5084 } 5085}); 5086 5087function sibling( cur, dir ) { 5088 while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {} 5089 return cur; 5090} 5091 5092jQuery.each({ 5093 parent: function( elem ) { 5094 var parent = elem.parentNode; 5095 return parent && parent.nodeType !== 11 ? parent : null; 5096 }, 5097 parents: function( elem ) { 5098 return jQuery.dir( elem, "parentNode" ); 5099 }, 5100 parentsUntil: function( elem, i, until ) { 5101 return jQuery.dir( elem, "parentNode", until ); 5102 }, 5103 next: function( elem ) { 5104 return sibling( elem, "nextSibling" ); 5105 }, 5106 prev: function( elem ) { 5107 return sibling( elem, "previousSibling" ); 5108 }, 5109 nextAll: function( elem ) { 5110 return jQuery.dir( elem, "nextSibling" ); 5111 }, 5112 prevAll: function( elem ) { 5113 return jQuery.dir( elem, "previousSibling" ); 5114 }, 5115 nextUntil: function( elem, i, until ) { 5116 return jQuery.dir( elem, "nextSibling", until ); 5117 }, 5118 prevUntil: function( elem, i, until ) { 5119 return jQuery.dir( elem, "previousSibling", until ); 5120 }, 5121 siblings: function( elem ) { 5122 return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); 5123 }, 5124 children: function( elem ) { 5125 return jQuery.sibling( elem.firstChild ); 5126 }, 5127 contents: function( elem ) { 5128 return elem.contentDocument || jQuery.merge( [], elem.childNodes ); 5129 } 5130}, function( name, fn ) { 5131 jQuery.fn[ name ] = function( until, selector ) { 5132 var matched = jQuery.map( this, fn, until ); 5133 5134 if ( name.slice( -5 ) !== "Until" ) { 5135 selector = until; 5136 } 5137 5138 if ( selector && typeof selector === "string" ) { 5139 matched = jQuery.filter( selector, matched ); 5140 } 5141 5142 if ( this.length > 1 ) { 5143 // Remove duplicates 5144 if ( !guaranteedUnique[ name ] ) { 5145 jQuery.unique( matched ); 5146 } 5147 5148 // Reverse order for parents* and prev-derivatives 5149 if ( rparentsprev.test( name ) ) { 5150 matched.reverse(); 5151 } 5152 } 5153 5154 return this.pushStack( matched ); 5155 }; 5156}); 5157var rnotwhite = (/\S+/g); 5158 5159 5160 5161// String to Object options format cache 5162var optionsCache = {}; 5163 5164// Convert String-formatted options into Object-formatted ones and store in cache 5165function createOptions( options ) { 5166 var object = optionsCache[ options ] = {}; 5167 jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { 5168 object[ flag ] = true; 5169 }); 5170 return object; 5171} 5172 5173/* 5174 * Create a callback list using the following parameters: 5175 * 5176 * options: an optional list of space-separated options that will change how 5177 * the callback list behaves or a more traditional option object 5178 * 5179 * By default a callback list will act like an event callback list and can be 5180 * "fired" multiple times. 5181 * 5182 * Possible options: 5183 * 5184 * once: will ensure the callback list can only be fired once (like a Deferred) 5185 * 5186 * memory: will keep track of previous values and will call any callback added 5187 * after the list has been fired right away with the latest "memorized" 5188 * values (like a Deferred) 5189 * 5190 * unique: will ensure a callback can only be added once (no duplicate in the list) 5191 * 5192 * stopOnFalse: interrupt callings when a callback returns false 5193 * 5194 */ 5195jQuery.Callbacks = function( options ) { 5196 5197 // Convert options from String-formatted to Object-formatted if needed 5198 // (we check in cache first) 5199 options = typeof options === "string" ? 5200 ( optionsCache[ options ] || createOptions( options ) ) : 5201 jQuery.extend( {}, options ); 5202 5203 var // Last fire value (for non-forgettable lists) 5204 memory, 5205 // Flag to know if list was already fired 5206 fired, 5207 // Flag to know if list is currently firing 5208 firing, 5209 // First callback to fire (used internally by add and fireWith) 5210 firingStart, 5211 // End of the loop when firing 5212 firingLength, 5213 // Index of currently firing callback (modified by remove if needed) 5214 firingIndex, 5215 // Actual callback list 5216 list = [],
5217 // Stack of fire calls for repeatable lists 5218 stack = !options.once && [], 5219 // Fire callbacks 5220 fire = function( data ) { 5221 memory = options.memory && data; 5222 fired = true; 5223 firingIndex = firingStart || 0; 5224 firingStart = 0; 5225 firingLength = list.length; 5226 firing = true; 5227 for ( ; list && firingIndex < firingLength; firingIndex++ ) { 5228 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { 5229 memory = false; // To prevent further calls using add 5230 break; 5231 } 5232 } 5233 firing = false; 5234 if ( list ) { 5235 if ( stack ) { 5236 if ( stack.length ) { 5237 fire( stack.shift() ); 5238 } 5239 } else if ( memory ) { 5240 list = []; 5241 } else { 5242 self.disable(); 5243 } 5244 } 5245 }, 5246 // Actual Callbacks object 5247 self = { 5248 // Add a callback or a collection of callbacks to the list 5249 add: function() { 5250 if ( list ) { 5251 // First, we save the current length 5252 var start = list.length; 5253 (function add( args ) { 5254 jQuery.each( args, function( _, arg ) { 5255 var type = jQuery.type( arg ); 5256 if ( type === "function" ) { 5257 if ( !options.unique || !self.has( arg ) ) { 5258 list.push( arg ); 5259 } 5260 } else if ( arg && arg.length && type !== "string" ) { 5261 // Inspect recursively 5262 add( arg ); 5263 } 5264 }); 5265 })( arguments ); 5266 // Do we need to add the callbacks to the 5267 // current firing batch? 5268 if ( firing ) { 5269 firingLength = list.length; 5270 // With memory, if we're not firing then 5271 // we should call right away 5272 } else if ( memory ) { 5273 firingStart = start; 5274 fire( memory ); 5275 } 5276 } 5277 return this; 5278 }, 5279 // Remove a callback from the list 5280 remove: function() { 5281 if ( list ) { 5282 jQuery.each( arguments, function( _, arg ) { 5283 var index; 5284 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 5285 list.splice( index, 1 ); 5286 // Handle firing indexes 5287 if ( firing ) { 5288 if ( index <= firingLength ) { 5289 firingLength--; 5290 } 5291 if ( index <= firingIndex ) { 5292 firingIndex--; 5293 } 5294 } 5295 } 5296 }); 5297 } 5298 return this; 5299 }, 5300 // Check if a given callback is in the list. 5301 // If no argument is given, return whether or not list has callbacks attached. 5302 has: function( fn ) { 5303 return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); 5304 }, 5305 // Remove all callbacks from the list 5306 empty: function() { 5307 list = []; 5308 firingLength = 0; 5309 return this; 5310 }, 5311 // Have the list do nothing anymore 5312 disable: function() { 5313 list = stack = memory = undefined; 5314 return this; 5315 }, 5316 // Is it disabled? 5317 disabled: function() { 5318 return !list; 5319 }, 5320 // Lock the list in its current state 5321 lock: function() { 5322 stack = undefined; 5323 if ( !memory ) { 5324 self.disable(); 5325 } 5326 return this; 5327 }, 5328 // Is it locked? 5329 locked: function() { 5330 return !stack; 5331 }, 5332 // Call all callbacks with the given context and arguments 5333 fireWith: function( context, args ) { 5334 if ( list && ( !fired || stack ) ) { 5335 args = args || []; 5336 args = [ context, args.slice ? args.slice() : args ]; 5337 if ( firing ) { 5338 stack.push( args ); 5339 } else { 5340 fire( args ); 5341 } 5342 } 5343 return this; 5344 }, 5345 // Call all the callbacks with the given arguments 5346 fire: function() { 5347 self.fireWith( this, arguments ); 5348 return this; 5349 }, 5350 // To know if the callbacks have already been called at least once 5351 fired: function() { 5352 return !!fired; 5353 } 5354 }; 5355 5356 return self; 5357}; 5358 5359 5360jQuery.extend({ 5361 5362 Deferred: function( func ) { 5363 var tuples = [ 5364 // action, add listener, listener list, final state 5365 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], 5366 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], 5367 [ "notify", "progress", jQuery.Callbacks("memory") ] 5368 ], 5369 state = "pending", 5370 promise = { 5371 state: function() { 5372 return state; 5373 }, 5374 always: function() { 5375 deferred.done( arguments ).fail( arguments ); 5376 return this; 5377 }, 5378 then: function( /* fnDone, fnFail, fnProgress */ ) { 5379 var fns = arguments; 5380 return jQuery.Deferred(function( newDefer ) { 5381 jQuery.each( tuples, function( i, tuple ) { 5382 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; 5383 // deferred[ done | fail | progress ] for forwarding actions to newDefer 5384 deferred[ tuple[1] ](function() { 5385 var returned = fn && fn.apply( this, arguments ); 5386 if ( returned && jQuery.isFunction( returned.promise ) ) { 5387 returned.promise() 5388 .done( newDefer.resolve ) 5389 .fail( newDefer.reject ) 5390 .progress( newDefer.notify ); 5391 } else { 5392 newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); 5393 } 5394 }); 5395 }); 5396 fns = null; 5397 }).promise(); 5398 }, 5399 // Get a promise for this deferred 5400 // If obj is provided, the promise aspect is added to the object 5401 promise: function( obj ) { 5402 return obj != null ? jQuery.extend( obj, promise ) : promise; 5403 } 5404 }, 5405 deferred = {}; 5406 5407 // Keep pipe for back-compat 5408 promise.pipe = promise.then; 5409 5410 // Add list-specific methods 5411 jQuery.each( tuples, function( i, tuple ) { 5412 var list = tuple[ 2 ], 5413 stateString = tuple[ 3 ]; 5414 5415 // promise[ done | fail | progress ] = list.add 5416 promise[ tuple[1] ] = list.add; 5417 5418 // Handle state 5419 if ( stateString ) { 5420 list.add(function() { 5421 // state = [ resolved | rejected ] 5422 state = stateString; 5423 5424 // [ reject_list | resolve_list ].disable; progress_list.lock 5425 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); 5426 } 5427 5428 // deferred[ resolve | reject | notify ] 5429 deferred[ tuple[0] ] = function() { 5430 deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); 5431 return this; 5432 }; 5433 deferred[ tuple[0] + "With" ] = list.fireWith; 5434 }); 5435 5436 // Make the deferred a promise 5437 promise.promise( deferred ); 5438 5439 // Call given func if any 5440 if ( func ) { 5441 func.call( deferred, deferred ); 5442 } 5443 5444 // All done! 5445 return deferred; 5446 }, 5447 5448 // Deferred helper 5449 when: function( subordinate /* , ..., subordinateN */ ) { 5450 var i = 0, 5451 resolveValues = slice.call( arguments ), 5452 length = resolveValues.length, 5453 5454 // the count of uncompleted subordinates 5455 remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, 5456 5457 // the master Deferred. If resolveValues consist of only a single Deferred, just use that. 5458 deferred = remaining === 1 ? subordinate : jQuery.Deferred(), 5459 5460 // Update function for both resolve and progress values 5461 updateFunc = function( i, contexts, values ) { 5462 return function( value ) { 5463 contexts[ i ] = this; 5464 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 5465 if ( values === progressValues ) { 5466 deferred.notifyWith( contexts, values ); 5467 } else if ( !( --remaining ) ) { 5468 deferred.resolveWith( contexts, values ); 5469 } 5470 }; 5471 }, 5472 5473 progressValues, progressContexts, resolveContexts; 5474 5475 // Add listeners to Deferred subordinates; treat others as resolved 5476 if ( length > 1 ) { 5477 progressValues = new Array( length ); 5478 progressContexts = new Array( length ); 5479 resolveContexts = new Array( length ); 5480 for ( ; i < length; i++ ) { 5481 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { 5482 resolveValues[ i ].promise() 5483 .done( updateFunc( i, resolveContexts, resolveValues ) ) 5484 .fail( deferred.reject ) 5485 .progress( updateFunc( i, progressContexts, progressValues ) ); 5486 } else { 5487 --remaining; 5488 } 5489 } 5490 } 5491 5492 // If we're not waiting on anything, resolve the master 5493 if ( !remaining ) {
5494 deferred.resolveWith( resolveContexts, resolveValues ); 5495 } 5496 5497 return deferred.promise(); 5498 } 5499}); 5500 5501 5502// The deferred used on DOM ready 5503var readyList; 5504 5505jQuery.fn.ready = function( fn ) { 5506 // Add the callback 5507 jQuery.ready.promise().done( fn ); 5508 5509 return this; 5510}; 5511 5512jQuery.extend({ 5513 // Is the DOM ready to be used? Set to true once it occurs. 5514 isReady: false, 5515 5516 // A counter to track how many items to wait for before 5517 // the ready event fires. See #6781 5518 readyWait: 1, 5519 5520 // Hold (or release) the ready event 5521 holdReady: function( hold ) { 5522 if ( hold ) { 5523 jQuery.readyWait++; 5524 } else { 5525 jQuery.ready( true ); 5526 } 5527 }, 5528 5529 // Handle when the DOM is ready 5530 ready: function( wait ) { 5531 5532 // Abort if there are pending holds or we're already ready 5533 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 5534 return; 5535 } 5536 5537 // Remember that the DOM is ready 5538 jQuery.isReady = true; 5539 5540 // If a normal DOM Ready event fired, decrement, and wait if need be 5541 if ( wait !== true && --jQuery.readyWait > 0 ) { 5542 return; 5543 } 5544 5545 // If there are functions bound, to execute 5546 readyList.resolveWith( document, [ jQuery ] ); 5547 5548 // Trigger any bound ready events 5549 if ( jQuery.fn.triggerHandler ) { 5550 jQuery( document ).triggerHandler( "ready" ); 5551 jQuery( document ).off( "ready" ); 5552 } 5553 } 5554}); 5555 5556/** 5557 * The ready event handler and self cleanup method 5558 */ 5559function completed() { 5560 document.removeEventListener( "DOMContentLoaded", completed, false ); 5561 window.removeEventListener( "load", completed, false ); 5562 jQuery.ready(); 5563} 5564 5565jQuery.ready.promise = function( obj ) { 5566 if ( !readyList ) { 5567 5568 readyList = jQuery.Deferred(); 5569 5570 // Catch cases where $(document).ready() is called after the browser event has already occurred. 5571 // We once tried to use readyState "interactive" here, but it caused issues like the one 5572 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 5573 if ( document.readyState === "complete" ) { 5574 // Handle it asynchronously to allow scripts the opportunity to delay ready 5575 setTimeout( jQuery.ready ); 5576 5577 } else { 5578 5579 // Use the handy event callback 5580 document.addEventListener( "DOMContentLoaded", completed, false ); 5581 5582 // A fallback to window.onload, that will always work 5583 window.addEventListener( "load", completed, false ); 5584 } 5585 } 5586 return readyList.promise( obj ); 5587}; 5588 5589// Kick off the DOM ready check even if the user does not 5590jQuery.ready.promise(); 5591 5592 5593 5594 5595// Multifunctional method to get and set values of a collection 5596// The value/s can optionally be executed if it's a function 5597var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 5598 var i = 0, 5599 len = elems.length, 5600 bulk = key == null; 5601 5602 // Sets many values 5603 if ( jQuery.type( key ) === "object" ) { 5604 chainable = true; 5605 for ( i in key ) { 5606 jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); 5607 } 5608 5609 // Sets one value 5610 } else if ( value !== undefined ) { 5611 chainable = true; 5612 5613 if ( !jQuery.isFunction( value ) ) { 5614 raw = true; 5615 } 5616 5617 if ( bulk ) { 5618 // Bulk operations run against the entire set 5619 if ( raw ) { 5620 fn.call( elems, value ); 5621 fn = null; 5622 5623 // ...except when executing function values 5624 } else { 5625 bulk = fn; 5626 fn = function( elem, key, value ) { 5627 return bulk.call( jQuery( elem ), value ); 5628 }; 5629 } 5630 } 5631 5632 if ( fn ) { 5633 for ( ; i < len; i++ ) { 5634 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); 5635 } 5636 } 5637 } 5638 5639 return chainable ? 5640 elems : 5641 5642 // Gets 5643 bulk ? 5644 fn.call( elems ) : 5645 len ? fn( elems[0], key ) : emptyGet; 5646}; 5647 5648 5649/** 5650 * Determines whether an object can have data 5651 */ 5652jQuery.acceptData = function( owner ) { 5653 // Accepts only: 5654 // - Node 5655 // - Node.ELEMENT_NODE 5656 // - Node.DOCUMENT_NODE 5657 // - Object 5658 // - Any 5659 /* jshint -W018 */ 5660 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 5661}; 5662 5663 5664function Data() { 5665 // Support: Android<4, 5666 // Old WebKit does not have Object.preventExtensions/freeze method, 5667 // return new empty object instead with no [[set]] accessor 5668 Object.defineProperty( this.cache = {}, 0, { 5669 get: function() { 5670 return {}; 5671 } 5672 }); 5673 5674 this.expando = jQuery.expando + Data.uid++; 5675} 5676 5677Data.uid = 1; 5678Data.accepts = jQuery.acceptData; 5679 5680Data.prototype = { 5681 key: function( owner ) { 5682 // We can accept data for non-element nodes in modern browsers, 5683 // but we should not, see #8335. 5684 // Always return the key for a frozen object. 5685 if ( !Data.accepts( owner ) ) { 5686 return 0; 5687 } 5688 5689 var descriptor = {}, 5690 // Check if the owner object already has a cache key 5691 unlock = owner[ this.expando ]; 5692 5693 // If not, create one 5694 if ( !unlock ) { 5695 unlock = Data.uid++; 5696 5697 // Secure it in a non-enumerable, non-writable property 5698 try { 5699 descriptor[ this.expando ] = { value: unlock }; 5700 Object.defineProperties( owner, descriptor ); 5701
5702 // Support: Android<4 5703 // Fallback to a less secure definition 5704 } catch ( e ) { 5705 descriptor[ this.expando ] = unlock; 5706 jQuery.extend( owner, descriptor ); 5707 } 5708 } 5709 5710 // Ensure the cache object 5711 if ( !this.cache[ unlock ] ) { 5712 this.cache[ unlock ] = {}; 5713 } 5714 5715 return unlock; 5716 }, 5717 set: function( owner, data, value ) { 5718 var prop, 5719 // There may be an unlock assigned to this node, 5720 // if there is no entry for this "owner", create one inline 5721 // and set the unlock as though an owner entry had always existed 5722 unlock = this.key( owner ), 5723 cache = this.cache[ unlock ]; 5724 5725 // Handle: [ owner, key, value ] args 5726 if ( typeof data === "string" ) { 5727 cache[ data ] = value; 5728 5729 // Handle: [ owner, { properties } ] args 5730 } else { 5731 // Fresh assignments by object are shallow copied 5732 if ( jQuery.isEmptyObject( cache ) ) { 5733 jQuery.extend( this.cache[ unlock ], data ); 5734 // Otherwise, copy the properties one-by-one to the cache object 5735 } else { 5736 for ( prop in data ) { 5737 cache[ prop ] = data[ prop ]; 5738 } 5739 } 5740 } 5741 return cache; 5742 }, 5743 get: function( owner, key ) { 5744 // Either a valid cache is found, or will be created. 5745 // New caches will be created and the unlock returned, 5746 // allowing direct access to the newly created 5747 // empty data object. A valid owner object must be provided. 5748 var cache = this.cache[ this.key( owner ) ]; 5749 5750 return key === undefined ? 5751 cache : cache[ key ]; 5752 }, 5753 access: function( owner, key, value ) { 5754 var stored; 5755 // In cases where either: 5756 // 5757 // 1. No key was specified 5758 // 2. A string key was specified, but no value provided 5759 // 5760 // Take the "read" path and allow the get method to determine 5761 // which value to return, respectively either: 5762 // 5763 // 1. The entire cache object 5764 // 2. The data stored at the key 5765 // 5766 if ( key === undefined || 5767 ((key && typeof key === "string") && value === undefined) ) { 5768 5769 stored = this.get( owner, key ); 5770 5771 return stored !== undefined ? 5772 stored : this.get( owner, jQuery.camelCase(key) ); 5773 } 5774 5775 // [*]When the key is not a string, or both a key and value 5776 // are specified, set or extend (existing objects) with either: 5777 // 5778 // 1. An object of properties 5779 // 2. A key and value 5780 // 5781 this.set( owner, key, value ); 5782 5783 // Since the "set" path can have two possible entry points 5784 // return the expected data based on which path was taken[*] 5785 return value !== undefined ? value : key; 5786 }, 5787 remove: function( owner, key ) { 5788 var i, name, camel, 5789 unlock = this.key( owner ), 5790 cache = this.cache[ unlock ]; 5791 5792 if ( key === undefined ) { 5793 this.cache[ unlock ] = {}; 5794 5795 } else { 5796 // Support array or space separated string of keys 5797 if ( jQuery.isArray( key ) ) { 5798 // If "name" is an array of keys... 5799 // When data is initially created, via ("key", "val") signature, 5800 // keys will be converted to camelCase. 5801 // Since there is no way to tell _how_ a key was added, remove 5802 // both plain key and camelCase key. #12786 5803 // This will only penalize the array argument path. 5804 name = key.concat( key.map( jQuery.camelCase ) ); 5805 } else { 5806 camel = jQuery.camelCase( key ); 5807 // Try the string as a key before any manipulation 5808 if ( key in cache ) { 5809 name = [ key, camel ]; 5810 } else { 5811 // If a key with the spaces exists, use it. 5812 // Otherwise, create an array by matching non-whitespace 5813 name = camel; 5814 name = name in cache ? 5815 [ name ] : ( name.match( rnotwhite ) || [] ); 5816 } 5817 } 5818 5819 i = name.length; 5820 while ( i-- ) { 5821 delete cache[ name[ i ] ]; 5822 } 5823 } 5824 }, 5825 hasData: function( owner ) { 5826 return !jQuery.isEmptyObject( 5827 this.cache[ owner[ this.expando ] ] || {} 5828 ); 5829 }, 5830 discard: function( owner ) { 5831 if ( owner[ this.expando ] ) { 5832 delete this.cache[ owner[ this.expando ] ]; 5833 } 5834 } 5835}; 5836var data_priv = new Data(); 5837 5838var data_user = new Data(); 5839 5840 5841 5842// Implementation Summary 5843// 5844// 1. Enforce API surface and semantic compatibility with 1.9.x branch 5845// 2. Improve the module's maintainability by reducing the storage 5846// paths to a single mechanism.
vendor: 4,184 bytes, lines 5847-5993
5847// 3. Use the same single mechanism to support "private" and "user" data. 5848// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 5849// 5. Avoid exposing implementation details on user objects (eg. expando properties) 5850// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 5851 5852var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 5853 rmultiDash = /([A-Z])/g; 5854 5855function dataAttr( elem, key, data ) { 5856 var name; 5857 5858 // If nothing was found internally, try to fetch any 5859 // data from the HTML5 data-* attribute 5860 if ( data === undefined && elem.nodeType === 1 ) { 5861 name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); 5862 data = elem.getAttribute( name ); 5863 5864 if ( typeof data === "string" ) { 5865 try { 5866 data = data === "true" ? true : 5867 data === "false" ? false : 5868 data === "null" ? null : 5869 // Only convert to a number if it doesn't change the string 5870 +data + "" === data ? +data : 5871 rbrace.test( data ) ? jQuery.parseJSON( data ) : 5872 data; 5873 } catch( e ) {} 5874 5875 // Make sure we set the data so it isn't changed later 5876 data_user.set( elem, key, data ); 5877 } else { 5878 data = undefined; 5879 } 5880 } 5881 return data; 5882} 5883 5884jQuery.extend({ 5885 hasData: function( elem ) { 5886 return data_user.hasData( elem ) || data_priv.hasData( elem ); 5887 }, 5888 5889 data: function( elem, name, data ) { 5890 return data_user.access( elem, name, data ); 5891 }, 5892 5893 removeData: function( elem, name ) { 5894 data_user.remove( elem, name ); 5895 }, 5896 5897 // TODO: Now that all calls to _data and _removeData have been replaced 5898 // with direct calls to data_priv methods, these can be deprecated. 5899 _data: function( elem, name, data ) { 5900 return data_priv.access( elem, name, data ); 5901 }, 5902 5903 _removeData: function( elem, name ) { 5904 data_priv.remove( elem, name ); 5905 } 5906}); 5907 5908jQuery.fn.extend({ 5909 data: function( key, value ) { 5910 var i, name, data, 5911 elem = this[ 0 ], 5912 attrs = elem && elem.attributes; 5913 5914 // Gets all values 5915 if ( key === undefined ) { 5916 if ( this.length ) { 5917 data = data_user.get( elem ); 5918 5919 if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) { 5920 i = attrs.length; 5921 while ( i-- ) { 5922 5923 // Support: IE11+ 5924 // The attrs elements can be null (#14894) 5925 if ( attrs[ i ] ) { 5926 name = attrs[ i ].name; 5927 if ( name.indexOf( "data-" ) === 0 ) { 5928 name = jQuery.camelCase( name.slice(5) ); 5929 dataAttr( elem, name, data[ name ] ); 5930 } 5931 } 5932 } 5933 data_priv.set( elem, "hasDataAttrs", true ); 5934 } 5935 } 5936 5937 return data; 5938 } 5939 5940 // Sets multiple values 5941 if ( typeof key === "object" ) { 5942 return this.each(function() { 5943 data_user.set( this, key ); 5944 }); 5945 } 5946 5947 return access( this, function( value ) { 5948 var data, 5949 camelKey = jQuery.camelCase( key ); 5950 5951 // The calling jQuery object (element matches) is not empty 5952 // (and therefore has an element appears at this[ 0 ]) and the 5953 // `value` parameter was not undefined. An empty jQuery object 5954 // will result in `undefined` for elem = this[ 0 ] which will 5955 // throw an exception if an attempt to read a data cache is made. 5956 if ( elem && value === undefined ) { 5957 // Attempt to get data from the cache 5958 // with the key as-is 5959 data = data_user.get( elem, key ); 5960 if ( data !== undefined ) { 5961 return data; 5962 } 5963 5964 // Attempt to get data from the cache 5965 // with the key camelized 5966 data = data_user.get( elem, camelKey ); 5967 if ( data !== undefined ) { 5968 return data; 5969 } 5970 5971 // Attempt to "discover" the data in 5972 // HTML5 custom data-* attrs 5973 data = dataAttr( elem, camelKey, undefined ); 5974 if ( data !== undefined ) { 5975 return data; 5976 } 5977 5978 // We tried really hard, but the data doesn't exist. 5979 return; 5980 } 5981 5982 // Set the data... 5983 this.each(function() { 5984 // First, attempt to store a copy or reference of any 5985 // data that might've been store with a camelCased key. 5986 var data = data_user.get( this, camelKey ); 5987 5988 // For HTML5 data-* attribute interop, we have to 5989 // store property names with dashes in a camelCase form. 5990 // This might not apply to all properties...* 5991 data_user.set( this, camelKey, value ); 5992 5993 // *... In the case of properties that might _actually_
vendor: 3,939 bytes, lines 5994-6163
5994 // have dashes, we need to also store a copy of that 5995 // unchanged property. 5996 if ( key.indexOf("-") !== -1 && data !== undefined ) { 5997 data_user.set( this, key, value ); 5998 } 5999 }); 6000 }, null, value, arguments.length > 1, null, true ); 6001 }, 6002 6003 removeData: function( key ) { 6004 return this.each(function() { 6005 data_user.remove( this, key ); 6006 }); 6007 } 6008}); 6009 6010 6011jQuery.extend({ 6012 queue: function( elem, type, data ) { 6013 var queue; 6014 6015 if ( elem ) { 6016 type = ( type || "fx" ) + "queue"; 6017 queue = data_priv.get( elem, type ); 6018 6019 // Speed up dequeue by getting out quickly if this is just a lookup 6020 if ( data ) { 6021 if ( !queue || jQuery.isArray( data ) ) { 6022 queue = data_priv.access( elem, type, jQuery.makeArray(data) ); 6023 } else { 6024 queue.push( data ); 6025 } 6026 } 6027 return queue || []; 6028 } 6029 }, 6030 6031 dequeue: function( elem, type ) { 6032 type = type || "fx"; 6033 6034 var queue = jQuery.queue( elem, type ), 6035 startLength = queue.length, 6036 fn = queue.shift(), 6037 hooks = jQuery._queueHooks( elem, type ), 6038 next = function() { 6039 jQuery.dequeue( elem, type ); 6040 }; 6041 6042 // If the fx queue is dequeued, always remove the progress sentinel 6043 if ( fn === "inprogress" ) { 6044 fn = queue.shift(); 6045 startLength--; 6046 } 6047 6048 if ( fn ) { 6049 6050 // Add a progress sentinel to prevent the fx queue from being 6051 // automatically dequeued 6052 if ( type === "fx" ) { 6053 queue.unshift( "inprogress" ); 6054 } 6055 6056 // Clear up the last queue stop function 6057 delete hooks.stop; 6058 fn.call( elem, next, hooks ); 6059 } 6060 6061 if ( !startLength && hooks ) { 6062 hooks.empty.fire(); 6063 } 6064 }, 6065 6066 // Not public - generate a queueHooks object, or return the current one 6067 _queueHooks: function( elem, type ) { 6068 var key = type + "queueHooks"; 6069 return data_priv.get( elem, key ) || data_priv.access( elem, key, { 6070 empty: jQuery.Callbacks("once memory").add(function() { 6071 data_priv.remove( elem, [ type + "queue", key ] ); 6072 }) 6073 }); 6074 } 6075}); 6076 6077jQuery.fn.extend({ 6078 queue: function( type, data ) { 6079 var setter = 2; 6080 6081 if ( typeof type !== "string" ) { 6082 data = type; 6083 type = "fx"; 6084 setter--; 6085 } 6086 6087 if ( arguments.length < setter ) { 6088 return jQuery.queue( this[0], type ); 6089 } 6090 6091 return data === undefined ? 6092 this : 6093 this.each(function() { 6094 var queue = jQuery.queue( this, type, data ); 6095 6096 // Ensure a hooks for this queue 6097 jQuery._queueHooks( this, type ); 6098 6099 if ( type === "fx" && queue[0] !== "inprogress" ) { 6100 jQuery.dequeue( this, type ); 6101 } 6102 }); 6103 }, 6104 dequeue: function( type ) { 6105 return this.each(function() { 6106 jQuery.dequeue( this, type ); 6107 }); 6108 }, 6109 clearQueue: function( type ) { 6110 return this.queue( type || "fx", [] ); 6111 }, 6112 // Get a promise resolved when queues of a certain type 6113 // are emptied (fx is the type by default) 6114 promise: function( type, obj ) { 6115 var tmp, 6116 count = 1, 6117 defer = jQuery.Deferred(), 6118 elements = this, 6119 i = this.length, 6120 resolve = function() { 6121 if ( !( --count ) ) { 6122 defer.resolveWith( elements, [ elements ] ); 6123 } 6124 }; 6125 6126 if ( typeof type !== "string" ) { 6127 obj = type; 6128 type = undefined; 6129 } 6130 type = type || "fx"; 6131 6132 while ( i-- ) { 6133 tmp = data_priv.get( elements[ i ], type + "queueHooks" ); 6134 if ( tmp && tmp.empty ) { 6135 count++; 6136 tmp.empty.add( resolve ); 6137 } 6138 } 6139 resolve(); 6140 return defer.promise( obj ); 6141 } 6142}); 6143var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; 6144 6145var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 6146 6147var isHidden = function( elem, el ) { 6148 // isHidden might be called from jQuery#filter function; 6149 // in that case, element will be second argument 6150 elem = el || elem; 6151 return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); 6152 }; 6153 6154var rcheckableType = (/^(?:checkbox|radio)$/i); 6155 6156 6157 6158(function() { 6159 var fragment = document.createDocumentFragment(), 6160 div = fragment.appendChild( document.createElement( "div" ) ), 6161 input = document.createElement( "input" ); 6162 6163 // Support: Safari<=5.1
vendor: 13,020 bytes, lines 6164-6591
6164 // Check state lost if the name is set (#11217) 6165 // Support: Windows Web Apps (WWA) 6166 // `name` and `type` must use .setAttribute for WWA (#14901) 6167 input.setAttribute( "type", "radio" ); 6168 input.setAttribute( "checked", "checked" ); 6169 input.setAttribute( "name", "t" ); 6170 6171 div.appendChild( input ); 6172 6173 // Support: Safari<=5.1, Android<4.2 6174 // Older WebKit doesn't clone checked state correctly in fragments 6175 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 6176 6177 // Support: IE<=11+ 6178 // Make sure textarea (and checkbox) defaultValue is properly cloned 6179 div.innerHTML = "<textarea>x</textarea>"; 6180 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 6181})(); 6182var strundefined = typeof undefined; 6183 6184 6185 6186support.focusinBubbles = "onfocusin" in window; 6187 6188 6189var 6190 rkeyEvent = /^key/, 6191 rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, 6192 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 6193 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; 6194 6195function returnTrue() { 6196 return true; 6197} 6198 6199function returnFalse() { 6200 return false; 6201} 6202 6203function safeActiveElement() { 6204 try { 6205 return document.activeElement; 6206 } catch ( err ) { } 6207} 6208 6209/* 6210 * Helper functions for managing events -- not part of the public interface. 6211 * Props to Dean Edwards' addEvent library for many of the ideas. 6212 */ 6213jQuery.event = { 6214 6215 global: {}, 6216 6217 add: function( elem, types, handler, data, selector ) { 6218 6219 var handleObjIn, eventHandle, tmp, 6220 events, t, handleObj, 6221 special, handlers, type, namespaces, origType, 6222 elemData = data_priv.get( elem ); 6223 6224 // Don't attach events to noData or text/comment nodes (but allow plain objects) 6225 if ( !elemData ) { 6226 return; 6227 } 6228 6229 // Caller can pass in an object of custom data in lieu of the handler 6230 if ( handler.handler ) { 6231 handleObjIn = handler; 6232 handler = handleObjIn.handler; 6233 selector = handleObjIn.selector; 6234 } 6235 6236 // Make sure that the handler has a unique ID, used to find/remove it later 6237 if ( !handler.guid ) { 6238 handler.guid = jQuery.guid++; 6239 } 6240 6241 // Init the element's event structure and main handler, if this is the first 6242 if ( !(events = elemData.events) ) { 6243 events = elemData.events = {}; 6244 } 6245 if ( !(eventHandle = elemData.handle) ) { 6246 eventHandle = elemData.handle = function( e ) { 6247 // Discard the second event of a jQuery.event.trigger() and 6248 // when an event is called after a page has unloaded 6249 return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ? 6250 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 6251 }; 6252 } 6253 6254 // Handle multiple events separated by a space 6255 types = ( types || "" ).match( rnotwhite ) || [ "" ]; 6256 t = types.length; 6257 while ( t-- ) { 6258 tmp = rtypenamespace.exec( types[t] ) || []; 6259 type = origType = tmp[1]; 6260 namespaces = ( tmp[2] || "" ).split( "." ).sort(); 6261 6262 // There *must* be a type, no attaching namespace-only handlers 6263 if ( !type ) { 6264 continue; 6265 } 6266 6267 // If event changes its type, use the special event handlers for the changed type 6268 special = jQuery.event.special[ type ] || {}; 6269 6270 // If selector defined, determine special event api type, otherwise given type 6271 type = ( selector ? special.delegateType : special.bindType ) || type; 6272 6273 // Update special based on newly reset type 6274 special = jQuery.event.special[ type ] || {}; 6275 6276 // handleObj is passed to all event handlers 6277 handleObj = jQuery.extend({ 6278 type: type, 6279 origType: origType, 6280 data: data, 6281 handler: handler, 6282 guid: handler.guid, 6283 selector: selector, 6284 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 6285 namespace: namespaces.join(".") 6286 }, handleObjIn ); 6287 6288 // Init the event handler queue if we're the first 6289 if ( !(handlers = events[ type ]) ) { 6290 handlers = events[ type ] = []; 6291 handlers.delegateCount = 0; 6292 6293 // Only use addEventListener if the special events handler returns false 6294 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 6295 if ( elem.addEventListener ) { 6296 elem.addEventListener( type, eventHandle, false ); 6297 } 6298 } 6299 } 6300 6301 if ( special.add ) { 6302 special.add.call( elem, handleObj ); 6303 6304 if ( !handleObj.handler.guid ) { 6305 handleObj.handler.guid = handler.guid; 6306 } 6307 } 6308 6309 // Add to the element's handler list, delegates in front 6310 if ( selector ) { 6311 handlers.splice( handlers.delegateCount++, 0, handleObj ); 6312 } else { 6313 handlers.push( handleObj ); 6314 } 6315 6316 // Keep track of which events have ever been used, for event optimization 6317 jQuery.event.global[ type ] = true; 6318 } 6319 6320 }, 6321 6322 // Detach an event or set of events from an element 6323 remove: function( elem, types, handler, selector, mappedTypes ) { 6324 6325 var j, origCount, tmp, 6326 events, t, handleObj, 6327 special, handlers, type, namespaces, origType, 6328 elemData = data_priv.hasData( elem ) && data_priv.get( elem ); 6329 6330 if ( !elemData || !(events = elemData.events) ) { 6331 return; 6332 } 6333 6334 // Once for each type.namespace in types; type may be omitted 6335 types = ( types || "" ).match( rnotwhite ) || [ "" ]; 6336 t = types.length; 6337 while ( t-- ) { 6338 tmp = rtypenamespace.exec( types[t] ) || []; 6339 type = origType = tmp[1]; 6340 namespaces = ( tmp[2] || "" ).split( "." ).sort(); 6341 6342 // Unbind all events (on this namespace, if provided) for the element 6343 if ( !type ) { 6344 for ( type in events ) { 6345 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 6346 } 6347 continue; 6348 } 6349 6350 special = jQuery.event.special[ type ] || {}; 6351 type = ( selector ? special.delegateType : special.bindType ) || type; 6352 handlers = events[ type ] || []; 6353 tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); 6354 6355 // Remove matching events 6356 origCount = j = handlers.length; 6357 while ( j-- ) { 6358 handleObj = handlers[ j ]; 6359 6360 if ( ( mappedTypes || origType === handleObj.origType ) && 6361 ( !handler || handler.guid === handleObj.guid ) && 6362 ( !tmp || tmp.test( handleObj.namespace ) ) && 6363 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { 6364 handlers.splice( j, 1 ); 6365 6366 if ( handleObj.selector ) { 6367 handlers.delegateCount--; 6368 } 6369 if ( special.remove ) { 6370 special.remove.call( elem, handleObj ); 6371 } 6372 } 6373 } 6374 6375 // Remove generic event handler if we removed something and no more handlers exist 6376 // (avoids potential for endless recursion during removal of special event handlers) 6377 if ( origCount && !handlers.length ) { 6378 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 6379 jQuery.removeEvent( elem, type, elemData.handle ); 6380 } 6381 6382 delete events[ type ]; 6383 } 6384 } 6385 6386 // Remove the expando if it's no longer used 6387 if ( jQuery.isEmptyObject( events ) ) { 6388 delete elemData.handle; 6389 data_priv.remove( elem, "events" ); 6390 } 6391 }, 6392 6393 trigger: function( event, data, elem, onlyHandlers ) { 6394 6395 var i, cur, tmp, bubbleType, ontype, handle, special, 6396 eventPath = [ elem || document ], 6397 type = hasOwn.call( event, "type" ) ? event.type : event, 6398 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; 6399 6400 cur = tmp = elem = elem || document; 6401 6402 // Don't do events on text and comment nodes 6403 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 6404 return; 6405 } 6406 6407 // focus/blur morphs to focusin/out; ensure we're not firing them right now 6408 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 6409 return; 6410 } 6411 6412 if ( type.indexOf(".") >= 0 ) { 6413 // Namespaced trigger; create a regexp to match event type in handle() 6414 namespaces = type.split("."); 6415 type = namespaces.shift(); 6416 namespaces.sort(); 6417 } 6418 ontype = type.indexOf(":") < 0 && "on" + type; 6419 6420 // Caller can pass in a jQuery.Event object, Object, or just an event type string 6421 event = event[ jQuery.expando ] ? 6422 event : 6423 new jQuery.Event( type, typeof event === "object" && event ); 6424 6425 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 6426 event.isTrigger = onlyHandlers ? 2 : 3; 6427 event.namespace = namespaces.join("."); 6428 event.namespace_re = event.namespace ? 6429 new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : 6430 null; 6431 6432 // Clean up the event in case it is being reused 6433 event.result = undefined; 6434 if ( !event.target ) { 6435 event.target = elem; 6436 } 6437 6438 // Clone any incoming data and prepend the event, creating the handler arg list 6439 data = data == null ? 6440 [ event ] : 6441 jQuery.makeArray( data, [ event ] ); 6442 6443 // Allow special events to draw outside the lines 6444 special = jQuery.event.special[ type ] || {}; 6445 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 6446 return; 6447 } 6448 6449 // Determine event propagation path in advance, per W3C events spec (#9951) 6450 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 6451 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { 6452 6453 bubbleType = special.delegateType || type; 6454 if ( !rfocusMorph.test( bubbleType + type ) ) { 6455 cur = cur.parentNode; 6456 } 6457 for ( ; cur; cur = cur.parentNode ) { 6458 eventPath.push( cur ); 6459 tmp = cur; 6460 } 6461 6462 // Only add window if we got to document (e.g., not plain obj or detached DOM) 6463 if ( tmp === (elem.ownerDocument || document) ) { 6464 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 6465 } 6466 } 6467 6468 // Fire handlers on the event path 6469 i = 0; 6470 while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { 6471 6472 event.type = i > 1 ? 6473 bubbleType : 6474 special.bindType || type; 6475 6476 // jQuery handler 6477 handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" ); 6478 if ( handle ) { 6479 handle.apply( cur, data ); 6480 } 6481 6482 // Native handler 6483 handle = ontype && cur[ ontype ]; 6484 if ( handle && handle.apply && jQuery.acceptData( cur ) ) { 6485 event.result = handle.apply( cur, data ); 6486 if ( event.result === false ) { 6487 event.preventDefault(); 6488 } 6489 } 6490 } 6491 event.type = type; 6492 6493 // If nobody prevented the default action, do it now 6494 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 6495 6496 if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && 6497 jQuery.acceptData( elem ) ) { 6498 6499 // Call a native DOM method on the target with the same name name as the event. 6500 // Don't do default actions on window, that's where global variables be (#6170) 6501 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { 6502 6503 // Don't re-trigger an onFOO event when we call its FOO() method 6504 tmp = elem[ ontype ]; 6505 6506 if ( tmp ) { 6507 elem[ ontype ] = null; 6508 } 6509 6510 // Prevent re-triggering of the same event, since we already bubbled it above 6511 jQuery.event.triggered = type; 6512 elem[ type ](); 6513 jQuery.event.triggered = undefined; 6514 6515 if ( tmp ) { 6516 elem[ ontype ] = tmp; 6517 } 6518 } 6519 } 6520 } 6521 6522 return event.result; 6523 }, 6524 6525 dispatch: function( event ) { 6526 6527 // Make a writable jQuery.Event from the native event object 6528 event = jQuery.event.fix( event ); 6529 6530 var i, j, ret, matched, handleObj, 6531 handlerQueue = [], 6532 args = slice.call( arguments ), 6533 handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [], 6534 special = jQuery.event.special[ event.type ] || {}; 6535 6536 // Use the fix-ed jQuery.Event rather than the (read-only) native event 6537 args[0] = event; 6538 event.delegateTarget = this; 6539 6540 // Call the preDispatch hook for the mapped type, and let it bail if desired 6541 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 6542 return; 6543 } 6544 6545 // Determine handlers 6546 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 6547 6548 // Run delegates first; they may want to stop propagation beneath us 6549 i = 0; 6550 while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { 6551 event.currentTarget = matched.elem; 6552 6553 j = 0; 6554 while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { 6555 6556 // Triggered event must either 1) have no namespace, or 2) have namespace(s) 6557 // a subset or equal to those in the bound event (both can have no namespace). 6558 if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { 6559 6560 event.handleObj = handleObj; 6561 event.data = handleObj.data; 6562 6563 ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) 6564 .apply( matched.elem, args ); 6565 6566 if ( ret !== undefined ) { 6567 if ( (event.result = ret) === false ) { 6568 event.preventDefault(); 6569 event.stopPropagation(); 6570 } 6571 } 6572 } 6573 } 6574 } 6575 6576 // Call the postDispatch hook for the mapped type 6577 if ( special.postDispatch ) { 6578 special.postDispatch.call( this, event ); 6579 } 6580 6581 return event.result; 6582 }, 6583 6584 handlers: function( event, handlers ) { 6585 var i, matches, sel, handleObj, 6586 handlerQueue = [], 6587 delegateCount = handlers.delegateCount, 6588 cur = event.target; 6589 6590 // Find delegate handlers 6591 // Black-hole SVG <use> instance trees (#13180)
6592 // Avoid non-left-click bubbling in Firefox (#3861) 6593 if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { 6594 6595 for ( ; cur !== this; cur = cur.parentNode || this ) { 6596 6597 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 6598 if ( cur.disabled !== true || event.type !== "click" ) { 6599 matches = []; 6600 for ( i = 0; i < delegateCount; i++ ) { 6601 handleObj = handlers[ i ]; 6602 6603 // Don't conflict with Object.prototype properties (#13203) 6604 sel = handleObj.selector + " "; 6605 6606 if ( matches[ sel ] === undefined ) { 6607 matches[ sel ] = handleObj.needsContext ? 6608 jQuery( sel, this ).index( cur ) >= 0 : 6609 jQuery.find( sel, this, null, [ cur ] ).length; 6610 } 6611 if ( matches[ sel ] ) { 6612 matches.push( handleObj ); 6613 } 6614 } 6615 if ( matches.length ) { 6616 handlerQueue.push({ elem: cur, handlers: matches }); 6617 } 6618 } 6619 } 6620 } 6621 6622 // Add the remaining (directly-bound) handlers 6623 if ( delegateCount < handlers.length ) { 6624 handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); 6625 } 6626 6627 return handlerQueue; 6628 }, 6629 6630 // Includes some event props shared by KeyEvent and MouseEvent 6631 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), 6632 6633 fixHooks: {}, 6634 6635 keyHooks: { 6636 props: "char charCode key keyCode".split(" "), 6637 filter: function( event, original ) { 6638 6639 // Add which for key events 6640 if ( event.which == null ) { 6641 event.which = original.charCode != null ? original.charCode : original.keyCode; 6642 } 6643 6644 return event; 6645 } 6646 }, 6647 6648 mouseHooks: { 6649 props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "), 6650 filter: function( event, original ) { 6651 var eventDoc, doc, body, 6652 button = original.button; 6653 6654 // Calculate pageX/Y if missing and clientX/Y available 6655 if ( event.pageX == null && original.clientX != null ) { 6656 eventDoc = event.target.ownerDocument || document; 6657 doc = eventDoc.documentElement; 6658 body = eventDoc.body; 6659 6660 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); 6661 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); 6662 } 6663 6664 // Add which for click: 1 === left; 2 === middle; 3 === right 6665 // Note: button is not normalized, so don't use it 6666 if ( !event.which && button !== undefined ) { 6667 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); 6668 } 6669 6670 return event; 6671 } 6672 }, 6673 6674 fix: function( event ) { 6675 if ( event[ jQuery.expando ] ) { 6676 return event; 6677 } 6678 6679 // Create a writable copy of the event object and normalize some properties 6680 var i, prop, copy, 6681 type = event.type, 6682 originalEvent = event, 6683 fixHook = this.fixHooks[ type ]; 6684 6685 if ( !fixHook ) { 6686 this.fixHooks[ type ] = fixHook = 6687 rmouseEvent.test( type ) ? this.mouseHooks : 6688 rkeyEvent.test( type ) ? this.keyHooks : 6689 {}; 6690 } 6691 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; 6692 6693 event = new jQuery.Event( originalEvent ); 6694 6695 i = copy.length; 6696 while ( i-- ) { 6697 prop = copy[ i ]; 6698 event[ prop ] = originalEvent[ prop ]; 6699 } 6700 6701 // Support: Cordova 2.5 (WebKit) (#13255) 6702 // All events should have a target; Cordova deviceready doesn't 6703 if ( !event.target ) { 6704 event.target = document; 6705 } 6706 6707 // Support: Safari 6.0+, Chrome<28 6708 // Target should not be a text node (#504, #13143) 6709 if ( event.target.nodeType === 3 ) { 6710 event.target = event.target.parentNode; 6711 } 6712 6713 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; 6714 }, 6715 6716 special: { 6717 load: { 6718 // Prevent triggered image.load events from bubbling to window.load 6719 noBubble: true 6720 }, 6721 focus: { 6722 // Fire native event if possible so blur/focus sequence is correct 6723 trigger: function() { 6724 if ( this !== safeActiveElement() && this.focus ) { 6725 this.focus(); 6726 return false;
6727 } 6728 }, 6729 delegateType: "focusin" 6730 }, 6731 blur: { 6732 trigger: function() { 6733 if ( this === safeActiveElement() && this.blur ) { 6734 this.blur(); 6735 return false; 6736 } 6737 }, 6738 delegateType: "focusout" 6739 }, 6740 click: { 6741 // For checkbox, fire native event so checked state will be right 6742 trigger: function() { 6743 if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { 6744 this.click(); 6745 return false; 6746 } 6747 }, 6748 6749 // For cross-browser consistency, don't fire native .click() on links 6750 _default: function( event ) { 6751 return jQuery.nodeName( event.target, "a" ); 6752 } 6753 }, 6754 6755 beforeunload: { 6756 postDispatch: function( event ) { 6757 6758 // Support: Firefox 20+ 6759 // Firefox doesn't alert if the returnValue field is not set. 6760 if ( event.result !== undefined && event.originalEvent ) { 6761 event.originalEvent.returnValue = event.result; 6762 } 6763 } 6764 } 6765 }, 6766 6767 simulate: function( type, elem, event, bubble ) { 6768 // Piggyback on a donor event to simulate a different one. 6769 // Fake originalEvent to avoid donor's stopPropagation, but if the 6770 // simulated event prevents default then we do the same on the donor. 6771 var e = jQuery.extend( 6772 new jQuery.Event(), 6773 event, 6774 { 6775 type: type, 6776 isSimulated: true, 6777 originalEvent: {} 6778 } 6779 ); 6780 if ( bubble ) { 6781 jQuery.event.trigger( e, null, elem ); 6782 } else { 6783 jQuery.event.dispatch.call( elem, e ); 6784 } 6785 if ( e.isDefaultPrevented() ) { 6786 event.preventDefault(); 6787 } 6788 } 6789}; 6790 6791jQuery.removeEvent = function( elem, type, handle ) { 6792 if ( elem.removeEventListener ) { 6793 elem.removeEventListener( type, handle, false ); 6794 } 6795}; 6796 6797jQuery.Event = function( src, props ) { 6798 // Allow instantiation without the 'new' keyword 6799 if ( !(this instanceof jQuery.Event) ) { 6800 return new jQuery.Event( src, props ); 6801 } 6802 6803 // Event object 6804 if ( src && src.type ) { 6805 this.originalEvent = src; 6806 this.type = src.type; 6807 6808 // Events bubbling up the document may have been marked as prevented 6809 // by a handler lower down the tree; reflect the correct value. 6810 this.isDefaultPrevented = src.defaultPrevented || 6811 src.defaultPrevented === undefined && 6812 // Support: Android<4.0 6813 src.returnValue === false ? 6814 returnTrue : 6815 returnFalse; 6816 6817 // Event type 6818 } else { 6819 this.type = src; 6820 } 6821 6822 // Put explicitly provided properties onto the event object 6823 if ( props ) { 6824 jQuery.extend( this, props ); 6825 } 6826 6827 // Create a timestamp if incoming event doesn't have one 6828 this.timeStamp = src && src.timeStamp || jQuery.now(); 6829 6830 // Mark it as fixed 6831 this[ jQuery.expando ] = true; 6832}; 6833 6834// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 6835// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 6836jQuery.Event.prototype = { 6837 isDefaultPrevented: returnFalse, 6838 isPropagationStopped: returnFalse, 6839 isImmediatePropagationStopped: returnFalse, 6840 6841 preventDefault: function() { 6842 var e = this.originalEvent; 6843 6844 this.isDefaultPrevented = returnTrue; 6845 6846 if ( e && e.preventDefault ) { 6847 e.preventDefault(); 6848 } 6849 }, 6850 stopPropagation: function() { 6851 var e = this.originalEvent; 6852 6853 this.isPropagationStopped = returnTrue; 6854 6855 if ( e && e.stopPropagation ) { 6856 e.stopPropagation(); 6857 } 6858 }, 6859 stopImmediatePropagation: function() { 6860 var e = this.originalEvent; 6861 6862 this.isImmediatePropagationStopped = returnTrue; 6863 6864 if ( e && e.stopImmediatePropagation ) { 6865 e.stopImmediatePropagation(); 6866 } 6867 6868 this.stopPropagation(); 6869 } 6870}; 6871 6872// Create mouseenter/leave events using mouseover/out and event-time checks 6873// Support: Chrome 15+ 6874jQuery.each({ 6875 mouseenter: "mouseover", 6876 mouseleave: "mouseout", 6877 pointerenter: "pointerover", 6878 pointerleave: "pointerout" 6879}, function( orig, fix ) { 6880 jQuery.event.special[ orig ] = { 6881 delegateType: fix, 6882 bindType: fix, 6883 6884 handle: function( event ) { 6885 var ret, 6886 target = this, 6887 related = event.relatedTarget, 6888 handleObj = event.handleObj; 6889 6890 // For mousenter/leave call the handler if related is outside the target. 6891 // NB: No relatedTarget if the mouse left/entered the browser window 6892 if ( !related || (related !== target && !jQuery.contains( target, related )) ) { 6893 event.type = handleObj.origType; 6894 ret = handleObj.handler.apply( this, arguments ); 6895 event.type = fix; 6896 } 6897 return ret; 6898 } 6899 }; 6900}); 6901 6902// Support: Firefox, Chrome, Safari 6903// Create "bubbling" focus and blur events 6904if ( !support.focusinBubbles ) { 6905 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { 6906 6907 // Attach a single capturing handler on the document while someone wants focusin/focusout 6908 var handler = function( event ) { 6909 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); 6910 }; 6911 6912 jQuery.event.special[ fix ] = { 6913 setup: function() { 6914 var doc = this.ownerDocument || this, 6915 attaches = data_priv.access( doc, fix ); 6916 6917 if ( !attaches ) { 6918 doc.addEventListener( orig, handler, true ); 6919 } 6920 data_priv.access( doc, fix, ( attaches || 0 ) + 1 ); 6921 }, 6922 teardown: function() { 6923 var doc = this.ownerDocument || this, 6924 attaches = data_priv.access( doc, fix ) - 1; 6925 6926 if ( !attaches ) { 6927 doc.removeEventListener( orig, handler, true ); 6928 data_priv.remove( doc, fix ); 6929 6930 } else { 6931 data_priv.access( doc, fix, attaches ); 6932 } 6933 } 6934 }; 6935 }); 6936} 6937 6938jQuery.fn.extend({ 6939 6940 on: function( types, selector, data, fn, /*INTERNAL*/ one ) { 6941 var origFn, type; 6942 6943 // Types can be a map of types/handlers 6944 if ( typeof types === "object" ) { 6945 // ( types-Object, selector, data ) 6946 if ( typeof selector !== "string" ) { 6947 // ( types-Object, data ) 6948 data = data || selector; 6949 selector = undefined; 6950 } 6951 for ( type in types ) { 6952 this.on( type, selector, data, types[ type ], one ); 6953 } 6954 return this; 6955 } 6956 6957 if ( data == null && fn == null ) { 6958 // ( types, fn ) 6959 fn = selector; 6960 data = selector = undefined; 6961 } else if ( fn == null ) { 6962 if ( typeof selector === "string" ) { 6963 // ( types, selector, fn ) 6964 fn = data; 6965 data = undefined; 6966 } else { 6967 // ( types, data, fn ) 6968 fn = data; 6969 data = selector; 6970 selector = undefined; 6971 } 6972 } 6973 if ( fn === false ) { 6974 fn = returnFalse; 6975 } else if ( !fn ) { 6976 return this; 6977 } 6978 6979 if ( one === 1 ) { 6980 origFn = fn; 6981 fn = function( event ) { 6982 // Can use an empty set, since event contains the info 6983 jQuery().off( event ); 6984 return origFn.apply( this, arguments ); 6985 }; 6986 // Use same guid so caller can remove using origFn 6987 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 6988 } 6989 return this.each( function() { 6990 jQuery.event.add( this, types, fn, data, selector ); 6991 }); 6992 }, 6993 one: function( types, selector, data, fn ) { 6994 return this.on( types, selector, data, fn, 1 ); 6995 }, 6996 off: function( types, selector, fn ) { 6997 var handleObj, type; 6998 if ( types && types.preventDefault && types.handleObj ) { 6999 // ( event ) dispatched jQuery.Event 7000 handleObj = types.handleObj; 7001 jQuery( types.delegateTarget ).off( 7002 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, 7003 handleObj.selector, 7004 handleObj.handler 7005 ); 7006 return this; 7007 } 7008 if ( typeof types === "object" ) { 7009 // ( types-object [, selector] ) 7010 for ( type in types ) { 7011 this.off( type, selector, types[ type ] ); 7012 } 7013 return this; 7014 } 7015 if ( selector === false || typeof selector === "function" ) { 7016 // ( types [, fn] ) 7017 fn = selector; 7018 selector = undefined; 7019 } 7020 if ( fn === false ) { 7021 fn = returnFalse; 7022 } 7023 return this.each(function() { 7024 jQuery.event.remove( this, types, fn, selector ); 7025 }); 7026 }, 7027 7028 trigger: function( type, data ) { 7029 return this.each(function() { 7030 jQuery.event.trigger( type, data, this ); 7031 }); 7032 }, 7033 triggerHandler: function( type, data ) { 7034 var elem = this[0]; 7035 if ( elem ) { 7036 return jQuery.event.trigger( type, data, elem, true ); 7037 } 7038 } 7039}); 7040 7041 7042var 7043 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, 7044 rtagName = /<([\w:]+)/,
vendor: 5,058 bytes, lines 7045-7227
7045 rhtml = /<|&#?\w+;/, 7046 rnoInnerhtml = /<(?:script|style|link)/i, 7047 // checked="checked" or checked 7048 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 7049 rscriptType = /^$|\/(?:java|ecma)script/i, 7050 rscriptTypeMasked = /^true\/(.*)/, 7051 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, 7052 7053 // We have to close these tags to support XHTML (#13200) 7054 wrapMap = { 7055 7056 // Support: IE9 7057 option: [ 1, "<select multiple='multiple'>", "</select>" ], 7058 7059 thead: [ 1, "<table>", "</table>" ], 7060 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 7061 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 7062 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 7063 7064 _default: [ 0, "", "" ] 7065 }; 7066 7067// Support: IE9 7068wrapMap.optgroup = wrapMap.option; 7069 7070wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 7071wrapMap.th = wrapMap.td; 7072 7073// Support: 1.x compatibility 7074// Manipulating tables requires a tbody 7075function manipulationTarget( elem, content ) { 7076 return jQuery.nodeName( elem, "table" ) && 7077 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? 7078 7079 elem.getElementsByTagName("tbody")[0] || 7080 elem.appendChild( elem.ownerDocument.createElement("tbody") ) : 7081 elem; 7082} 7083 7084// Replace/restore the type attribute of script elements for safe DOM manipulation 7085function disableScript( elem ) { 7086 elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; 7087 return elem; 7088} 7089function restoreScript( elem ) { 7090 var match = rscriptTypeMasked.exec( elem.type ); 7091 7092 if ( match ) { 7093 elem.type = match[ 1 ]; 7094 } else { 7095 elem.removeAttribute("type"); 7096 } 7097 7098 return elem; 7099} 7100 7101// Mark scripts as having already been evaluated 7102function setGlobalEval( elems, refElements ) { 7103 var i = 0, 7104 l = elems.length; 7105 7106 for ( ; i < l; i++ ) { 7107 data_priv.set( 7108 elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" ) 7109 ); 7110 } 7111} 7112 7113function cloneCopyEvent( src, dest ) { 7114 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; 7115 7116 if ( dest.nodeType !== 1 ) { 7117 return; 7118 } 7119 7120 // 1. Copy private data: events, handlers, etc. 7121 if ( data_priv.hasData( src ) ) { 7122 pdataOld = data_priv.access( src ); 7123 pdataCur = data_priv.set( dest, pdataOld ); 7124 events = pdataOld.events; 7125 7126 if ( events ) { 7127 delete pdataCur.handle; 7128 pdataCur.events = {}; 7129 7130 for ( type in events ) { 7131 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 7132 jQuery.event.add( dest, type, events[ type ][ i ] ); 7133 } 7134 } 7135 } 7136 } 7137 7138 // 2. Copy user data 7139 if ( data_user.hasData( src ) ) { 7140 udataOld = data_user.access( src ); 7141 udataCur = jQuery.extend( {}, udataOld ); 7142 7143 data_user.set( dest, udataCur ); 7144 } 7145} 7146 7147function getAll( context, tag ) { 7148 var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) : 7149 context.querySelectorAll ? context.querySelectorAll( tag || "*" ) : 7150 []; 7151 7152 return tag === undefined || tag && jQuery.nodeName( context, tag ) ? 7153 jQuery.merge( [ context ], ret ) : 7154 ret; 7155} 7156 7157// Fix IE bugs, see support tests 7158function fixInput( src, dest ) { 7159 var nodeName = dest.nodeName.toLowerCase(); 7160 7161 // Fails to persist the checked state of a cloned checkbox or radio button. 7162 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 7163 dest.checked = src.checked; 7164 7165 // Fails to return the selected option to the default selected state when cloning options 7166 } else if ( nodeName === "input" || nodeName === "textarea" ) { 7167 dest.defaultValue = src.defaultValue; 7168 } 7169} 7170 7171jQuery.extend({ 7172 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 7173 var i, l, srcElements, destElements, 7174 clone = elem.cloneNode( true ), 7175 inPage = jQuery.contains( elem.ownerDocument, elem ); 7176 7177 // Fix IE cloning issues 7178 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 7179 !jQuery.isXMLDoc( elem ) ) { 7180 7181 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 7182 destElements = getAll( clone ); 7183 srcElements = getAll( elem ); 7184 7185 for ( i = 0, l = srcElements.length; i < l; i++ ) { 7186 fixInput( srcElements[ i ], destElements[ i ] ); 7187 } 7188 } 7189 7190 // Copy the events from the original to the clone 7191 if ( dataAndEvents ) { 7192 if ( deepDataAndEvents ) { 7193 srcElements = srcElements || getAll( elem ); 7194 destElements = destElements || getAll( clone ); 7195 7196 for ( i = 0, l = srcElements.length; i < l; i++ ) { 7197 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 7198 } 7199 } else { 7200 cloneCopyEvent( elem, clone ); 7201 } 7202 } 7203 7204 // Preserve script evaluation history 7205 destElements = getAll( clone, "script" ); 7206 if ( destElements.length > 0 ) { 7207 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 7208 } 7209 7210 // Return the cloned set 7211 return clone; 7212 }, 7213 7214 buildFragment: function( elems, context, scripts, selection ) { 7215 var elem, tmp, tag, wrap, contains, j, 7216 fragment = context.createDocumentFragment(), 7217 nodes = [], 7218 i = 0, 7219 l = elems.length; 7220 7221 for ( ; i < l; i++ ) { 7222 elem = elems[ i ]; 7223 7224 if ( elem || elem === 0 ) { 7225 7226 // Add nodes directly 7227 if ( jQuery.type( elem ) === "object" ) {
7228 // Support: QtWebKit, PhantomJS 7229 // push.apply(_, arraylike) throws on ancient WebKit 7230 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 7231 7232 // Convert non-html into a text node 7233 } else if ( !rhtml.test( elem ) ) { 7234 nodes.push( context.createTextNode( elem ) ); 7235 7236 // Convert html into DOM nodes 7237 } else { 7238 tmp = tmp || fragment.appendChild( context.createElement("div") ); 7239 7240 // Deserialize a standard representation 7241 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 7242 wrap = wrapMap[ tag ] || wrapMap._default; 7243 tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ]; 7244 7245 // Descend through wrappers to the right content 7246 j = wrap[ 0 ]; 7247 while ( j-- ) { 7248 tmp = tmp.lastChild; 7249 } 7250 7251 // Support: QtWebKit, PhantomJS 7252 // push.apply(_, arraylike) throws on ancient WebKit 7253 jQuery.merge( nodes, tmp.childNodes ); 7254 7255 // Remember the top-level container 7256 tmp = fragment.firstChild; 7257 7258 // Ensure the created nodes are orphaned (#12392) 7259 tmp.textContent = ""; 7260 } 7261 } 7262 } 7263 7264 // Remove wrapper from fragment 7265 fragment.textContent = ""; 7266 7267 i = 0; 7268 while ( (elem = nodes[ i++ ]) ) { 7269 7270 // #4087 - If origin and destination elements are the same, and this is 7271 // that element, do not do anything 7272 if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { 7273 continue; 7274 } 7275 7276 contains = jQuery.contains( elem.ownerDocument, elem ); 7277 7278 // Append to fragment 7279 tmp = getAll( fragment.appendChild( elem ), "script" ); 7280 7281 // Preserve script evaluation history 7282 if ( contains ) { 7283 setGlobalEval( tmp ); 7284 } 7285 7286 // Capture executables 7287 if ( scripts ) { 7288 j = 0; 7289 while ( (elem = tmp[ j++ ]) ) { 7290 if ( rscriptType.test( elem.type || "" ) ) { 7291 scripts.push( elem ); 7292 } 7293 } 7294 } 7295 } 7296 7297 return fragment; 7298 }, 7299 7300 cleanData: function( elems ) { 7301 var data, elem, type, key, 7302 special = jQuery.event.special, 7303 i = 0; 7304 7305 for ( ; (elem = elems[ i ]) !== undefined; i++ ) { 7306 if ( jQuery.acceptData( elem ) ) { 7307 key = elem[ data_priv.expando ]; 7308 7309 if ( key && (data = data_priv.cache[ key ]) ) { 7310 if ( data.events ) { 7311 for ( type in data.events ) { 7312 if ( special[ type ] ) { 7313 jQuery.event.remove( elem, type ); 7314 7315 // This is a shortcut to avoid jQuery.event.remove's overhead 7316 } else { 7317 jQuery.removeEvent( elem, type, data.handle ); 7318 } 7319 } 7320 } 7321 if ( data_priv.cache[ key ] ) { 7322 // Discard any remaining `private` data 7323 delete data_priv.cache[ key ]; 7324 } 7325 } 7326 } 7327 // Discard any remaining `user` data 7328 delete data_user.cache[ elem[ data_user.expando ] ]; 7329 } 7330 } 7331}); 7332 7333jQuery.fn.extend({ 7334 text: function( value ) { 7335 return access( this, function( value ) { 7336 return value === undefined ? 7337 jQuery.text( this ) : 7338 this.empty().each(function() { 7339 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 7340 this.textContent = value; 7341 } 7342 }); 7343 }, null, value, arguments.length ); 7344 }, 7345 7346 append: function() { 7347 return this.domManip( arguments, function( elem ) { 7348 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 7349 var target = manipulationTarget( this, elem ); 7350 target.appendChild( elem ); 7351 } 7352 }); 7353 }, 7354
7355 prepend: function() { 7356 return this.domManip( arguments, function( elem ) { 7357 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 7358 var target = manipulationTarget( this, elem ); 7359 target.insertBefore( elem, target.firstChild ); 7360 } 7361 }); 7362 }, 7363 7364 before: function() { 7365 return this.domManip( arguments, function( elem ) { 7366 if ( this.parentNode ) { 7367 this.parentNode.insertBefore( elem, this ); 7368 } 7369 }); 7370 }, 7371 7372 after: function() { 7373 return this.domManip( arguments, function( elem ) { 7374 if ( this.parentNode ) { 7375 this.parentNode.insertBefore( elem, this.nextSibling ); 7376 } 7377 }); 7378 }, 7379 7380 remove: function( selector, keepData /* Internal Use Only */ ) { 7381 var elem, 7382 elems = selector ? jQuery.filter( selector, this ) : this, 7383 i = 0; 7384 7385 for ( ; (elem = elems[i]) != null; i++ ) { 7386 if ( !keepData && elem.nodeType === 1 ) { 7387 jQuery.cleanData( getAll( elem ) ); 7388 } 7389 7390 if ( elem.parentNode ) { 7391 if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { 7392 setGlobalEval( getAll( elem, "script" ) ); 7393 } 7394 elem.parentNode.removeChild( elem ); 7395 } 7396 } 7397 7398 return this; 7399 }, 7400 7401 empty: function() { 7402 var elem, 7403 i = 0; 7404 7405 for ( ; (elem = this[i]) != null; i++ ) { 7406 if ( elem.nodeType === 1 ) { 7407 7408 // Prevent memory leaks 7409 jQuery.cleanData( getAll( elem, false ) ); 7410 7411 // Remove any remaining nodes 7412 elem.textContent = ""; 7413 } 7414 } 7415 7416 return this; 7417 }, 7418 7419 clone: function( dataAndEvents, deepDataAndEvents ) { 7420 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 7421 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 7422 7423 return this.map(function() { 7424 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 7425 }); 7426 }, 7427 7428 html: function( value ) { 7429 return access( this, function( value ) { 7430 var elem = this[ 0 ] || {}, 7431 i = 0, 7432 l = this.length; 7433 7434 if ( value === undefined && elem.nodeType === 1 ) { 7435 return elem.innerHTML; 7436 } 7437 7438 // See if we can take a shortcut and just use innerHTML 7439 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 7440 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 7441 7442 value = value.replace( rxhtmlTag, "<$1></$2>" ); 7443 7444 try { 7445 for ( ; i < l; i++ ) { 7446 elem = this[ i ] || {}; 7447 7448 // Remove element nodes and prevent memory leaks 7449 if ( elem.nodeType === 1 ) { 7450 jQuery.cleanData( getAll( elem, false ) ); 7451 elem.innerHTML = value; 7452 } 7453 } 7454 7455 elem = 0; 7456 7457 // If using innerHTML throws an exception, use the fallback method 7458 } catch( e ) {} 7459 } 7460 7461 if ( elem ) { 7462 this.empty().append( value ); 7463 } 7464 }, null, value, arguments.length ); 7465 }, 7466 7467 replaceWith: function() { 7468 var arg = arguments[ 0 ]; 7469 7470 // Make the changes, replacing each context element with the new content 7471 this.domManip( arguments, function( elem ) { 7472 arg = this.parentNode; 7473 7474 jQuery.cleanData( getAll( this ) ); 7475 7476 if ( arg ) { 7477 arg.replaceChild( elem, this ); 7478 } 7479 }); 7480 7481 // Force removal if there was no new content (e.g., from empty arguments) 7482 return arg && (arg.length || arg.nodeType) ? this : this.remove(); 7483 }, 7484 7485 detach: function( selector ) { 7486 return this.remove( selector, true ); 7487 }, 7488 7489 domManip: function( args, callback ) { 7490 7491 // Flatten any nested arrays 7492 args = concat.apply( [], args ); 7493 7494 var fragment, first, scripts, hasScripts, node, doc, 7495 i = 0, 7496 l = this.length, 7497 set = this, 7498 iNoClone = l - 1, 7499 value = args[ 0 ], 7500 isFunction = jQuery.isFunction( value ); 7501 7502 // We can't cloneNode fragments that contain checked, in WebKit 7503 if ( isFunction || 7504 ( l > 1 && typeof value === "string" && 7505 !support.checkClone && rchecked.test( value ) ) ) { 7506 return this.each(function( index ) { 7507 var self = set.eq( index ); 7508 if ( isFunction ) { 7509 args[ 0 ] = value.call( this, index, self.html() ); 7510 } 7511 self.domManip( args, callback ); 7512 }); 7513 } 7514 7515 if ( l ) { 7516 fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); 7517 first = fragment.firstChild; 7518 7519 if ( fragment.childNodes.length === 1 ) { 7520 fragment = first; 7521 } 7522 7523 if ( first ) { 7524 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 7525 hasScripts = scripts.length; 7526 7527 // Use the original fragment for the last item instead of the first because it can end up 7528 // being emptied incorrectly in certain situations (#8070). 7529 for ( ; i < l; i++ ) { 7530 node = fragment; 7531 7532 if ( i !== iNoClone ) { 7533 node = jQuery.clone( node, true, true ); 7534 7535 // Keep references to cloned scripts for later restoration 7536 if ( hasScripts ) {
7537 // Support: QtWebKit 7538 // jQuery.merge because push.apply(_, arraylike) throws 7539 jQuery.merge( scripts, getAll( node, "script" ) ); 7540 } 7541 } 7542 7543 callback.call( this[ i ], node, i ); 7544 } 7545 7546 if ( hasScripts ) { 7547 doc = scripts[ scripts.length - 1 ].ownerDocument; 7548 7549 // Reenable scripts 7550 jQuery.map( scripts, restoreScript ); 7551 7552 // Evaluate executable scripts on first document insertion 7553 for ( i = 0; i < hasScripts; i++ ) { 7554 node = scripts[ i ]; 7555 if ( rscriptType.test( node.type || "" ) && 7556 !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { 7557 7558 if ( node.src ) { 7559 // Optional AJAX dependency, but won't run scripts if not present 7560 if ( jQuery._evalUrl ) { 7561 jQuery._evalUrl( node.src ); 7562 } 7563 } else { 7564 jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); 7565 } 7566 } 7567 } 7568 } 7569 } 7570 } 7571 7572 return this; 7573 } 7574}); 7575 7576jQuery.each({ 7577 appendTo: "append", 7578 prependTo: "prepend", 7579 insertBefore: "before", 7580 insertAfter: "after", 7581 replaceAll: "replaceWith" 7582}, function( name, original ) { 7583 jQuery.fn[ name ] = function( selector ) { 7584 var elems, 7585 ret = [], 7586 insert = jQuery( selector ), 7587 last = insert.length - 1, 7588 i = 0; 7589 7590 for ( ; i <= last; i++ ) { 7591 elems = i === last ? this : this.clone( true ); 7592 jQuery( insert[ i ] )[ original ]( elems ); 7593 7594 // Support: QtWebKit 7595 // .get() because push.apply(_, arraylike) throws 7596 push.apply( ret, elems.get() ); 7597 } 7598 7599 return this.pushStack( ret ); 7600 }; 7601}); 7602 7603 7604var iframe, 7605 elemdisplay = {}; 7606 7607/** 7608 * Retrieve the actual display of a element 7609 * @param {String} name nodeName of the element 7610 * @param {Object} doc Document object 7611 */ 7612// Called only from within defaultDisplay 7613function actualDisplay( name, doc ) { 7614 var style, 7615 elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), 7616 7617 // getDefaultComputedStyle might be reliably used only on attached element 7618 display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? 7619 7620 // Use of this method is a temporary fix (more like optimization) until something better comes along, 7621 // since it was removed from specification and supported only in FF 7622 style.display : jQuery.css( elem[ 0 ], "display" ); 7623 7624 // We don't have any data stored on the element, 7625 // so use "detach" method as fast way to get rid of the element 7626 elem.detach(); 7627 7628 return display; 7629} 7630 7631/** 7632 * Try to determine the default display value of an element 7633 * @param {String} nodeName 7634 */ 7635function defaultDisplay( nodeName ) { 7636 var doc = document, 7637 display = elemdisplay[ nodeName ]; 7638 7639 if ( !display ) { 7640 display = actualDisplay( nodeName, doc ); 7641 7642 // If the simple way fails, read from inside an iframe 7643 if ( display === "none" || !display ) { 7644 7645 // Use the already-created iframe if possible 7646 iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement ); 7647 7648 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse 7649 doc = iframe[ 0 ].contentDocument; 7650 7651 // Support: IE 7652 doc.write(); 7653 doc.close(); 7654 7655 display = actualDisplay( nodeName, doc ); 7656 iframe.detach(); 7657 } 7658 7659 // Store the correct default display 7660 elemdisplay[ nodeName ] = display; 7661 } 7662 7663 return display; 7664} 7665var rmargin = (/^margin/); 7666 7667var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 7668 7669var getStyles = function( elem ) { 7670 // Support: IE<=11+, Firefox<=30+ (#15098, #14150) 7671 // IE throws on elements created in popups 7672 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 7673 if ( elem.ownerDocument.defaultView.opener ) { 7674 return elem.ownerDocument.defaultView.getComputedStyle( elem, null ); 7675 } 7676 7677 return window.getComputedStyle( elem, null ); 7678 }; 7679 7680 7681 7682function curCSS( elem, name, computed ) { 7683 var width, minWidth, maxWidth, ret, 7684 style = elem.style; 7685 7686 computed = computed || getStyles( elem ); 7687 7688 // Support: IE9 7689 // getPropertyValue is only needed for .css('filter') (#12537) 7690 if ( computed ) { 7691 ret = computed.getPropertyValue( name ) || computed[ name ]; 7692 } 7693 7694 if ( computed ) { 7695 7696 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { 7697 ret = jQuery.style( elem, name ); 7698 } 7699
7700 // Support: iOS < 6 7701 // A tribute to the "awesome hack by Dean Edwards" 7702 // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels 7703 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values 7704 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { 7705 7706 // Remember the original values 7707 width = style.width; 7708 minWidth = style.minWidth; 7709 maxWidth = style.maxWidth; 7710 7711 // Put in the new values to get a computed value out 7712 style.minWidth = style.maxWidth = style.width = ret; 7713 ret = computed.width; 7714 7715 // Revert the changed values 7716 style.width = width; 7717 style.minWidth = minWidth; 7718 style.maxWidth = maxWidth; 7719 } 7720 } 7721 7722 return ret !== undefined ? 7723 // Support: IE 7724 // IE returns zIndex value as an integer. 7725 ret + "" : 7726 ret; 7727} 7728 7729 7730function addGetHookIf( conditionFn, hookFn ) { 7731 // Define the hook, we'll check on the first run if it's really needed. 7732 return { 7733 get: function() { 7734 if ( conditionFn() ) { 7735 // Hook not needed (or it's not possible to use it due 7736 // to missing dependency), remove it. 7737 delete this.get; 7738 return; 7739 } 7740 7741 // Hook needed; redefine it so that the support test is not executed again. 7742 return (this.get = hookFn).apply( this, arguments ); 7743 } 7744 }; 7745} 7746 7747 7748(function() { 7749 var pixelPositionVal, boxSizingReliableVal, 7750 docElem = document.documentElement, 7751 container = document.createElement( "div" ), 7752 div = document.createElement( "div" ); 7753 7754 if ( !div.style ) { 7755 return; 7756 } 7757 7758 // Support: IE9-11+ 7759 // Style of cloned element affects source element cloned (#8908) 7760 div.style.backgroundClip = "content-box"; 7761 div.cloneNode( true ).style.backgroundClip = ""; 7762 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 7763 7764 container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" + 7765 "position:absolute"; 7766 container.appendChild( div ); 7767 7768 // Executing both pixelPosition & boxSizingReliable tests require only one layout 7769 // so they're executed at the same time to save the second computation. 7770 function computePixelPositionAndBoxSizingReliable() { 7771 div.style.cssText = 7772 // Support: Firefox<29, Android 2.3 7773 // Vendor-prefix box-sizing 7774 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" + 7775 "box-sizing:border-box;display:block;margin-top:1%;top:1%;" + 7776 "border:1px;padding:1px;width:4px;position:absolute"; 7777 div.innerHTML = ""; 7778 docElem.appendChild( container ); 7779 7780 var divStyle = window.getComputedStyle( div, null ); 7781 pixelPositionVal = divStyle.top !== "1%"; 7782 boxSizingReliableVal = divStyle.width === "4px"; 7783 7784 docElem.removeChild( container ); 7785 } 7786 7787 // Support: node.js jsdom 7788 // Don't assume that getComputedStyle is a property of the global object 7789 if ( window.getComputedStyle ) { 7790 jQuery.extend( support, { 7791 pixelPosition: function() { 7792 7793 // This test is executed only once but we still do memoizing 7794 // since we can use the boxSizingReliable pre-computing. 7795 // No need to check if the test was already performed, though. 7796 computePixelPositionAndBoxSizingReliable(); 7797 return pixelPositionVal; 7798 }, 7799 boxSizingReliable: function() { 7800 if ( boxSizingReliableVal == null ) { 7801 computePixelPositionAndBoxSizingReliable(); 7802 } 7803 return boxSizingReliableVal; 7804 }, 7805 reliableMarginRight: function() { 7806 7807 // Support: Android 2.3 7808 // Check if div with explicit width and no margin-right incorrectly 7809 // gets computed margin-right based on width of container. (#3333) 7810 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 7811 // This support function is only executed once so no memoizing is needed. 7812 var ret, 7813 marginDiv = div.appendChild( document.createElement( "div" ) ); 7814 7815 // Reset CSS: box-sizing; display; margin; border; padding 7816 marginDiv.style.cssText = div.style.cssText = 7817 // Support: Firefox<29, Android 2.3 7818 // Vendor-prefix box-sizing 7819 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + 7820 "box-sizing:content-box;display:block;margin:0;border:0;padding:0"; 7821 marginDiv.style.marginRight = marginDiv.style.width = "0"; 7822 div.style.width = "1px"; 7823 docElem.appendChild( container ); 7824 7825 ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight ); 7826 7827 docElem.removeChild( container ); 7828 div.removeChild( marginDiv ); 7829 7830 return ret; 7831 } 7832 }); 7833 } 7834})(); 7835 7836 7837// A method for quickly swapping in/out CSS properties to get correct calculations. 7838jQuery.swap = function( elem, options, callback, args ) { 7839 var ret, name,
7840 old = {}; 7841 7842 // Remember the old values, and insert the new ones 7843 for ( name in options ) { 7844 old[ name ] = elem.style[ name ]; 7845 elem.style[ name ] = options[ name ]; 7846 } 7847 7848 ret = callback.apply( elem, args || [] ); 7849 7850 // Revert the old values 7851 for ( name in options ) { 7852 elem.style[ name ] = old[ name ]; 7853 } 7854 7855 return ret; 7856}; 7857 7858 7859var 7860 // Swappable if display is none or starts with table except "table", "table-cell", or "table-caption" 7861 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 7862 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 7863 rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ), 7864 rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ), 7865 7866 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 7867 cssNormalTransform = { 7868 letterSpacing: "0", 7869 fontWeight: "400" 7870 }, 7871 7872 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; 7873 7874// Return a css property mapped to a potentially vendor prefixed property 7875function vendorPropName( style, name ) { 7876 7877 // Shortcut for names that are not vendor prefixed 7878 if ( name in style ) { 7879 return name; 7880 } 7881 7882 // Check for vendor prefixed names 7883 var capName = name[0].toUpperCase() + name.slice(1), 7884 origName = name, 7885 i = cssPrefixes.length; 7886 7887 while ( i-- ) { 7888 name = cssPrefixes[ i ] + capName; 7889 if ( name in style ) { 7890 return name; 7891 } 7892 } 7893 7894 return origName; 7895} 7896 7897function setPositiveNumber( elem, value, subtract ) { 7898 var matches = rnumsplit.exec( value ); 7899 return matches ? 7900 // Guard against undefined "subtract", e.g., when used as in cssHooks 7901 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : 7902 value; 7903} 7904 7905function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { 7906 var i = extra === ( isBorderBox ? "border" : "content" ) ? 7907 // If we already have the right measurement, avoid augmentation 7908 4 : 7909 // Otherwise initialize for horizontal or vertical properties 7910 name === "width" ? 1 : 0, 7911 7912 val = 0; 7913 7914 for ( ; i < 4; i += 2 ) { 7915 // Both box models exclude margin, so add it if we want it 7916 if ( extra === "margin" ) { 7917 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); 7918 } 7919 7920 if ( isBorderBox ) { 7921 // border-box includes padding, so remove it if we want content 7922 if ( extra === "content" ) { 7923 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 7924 } 7925 7926 // At this point, extra isn't border nor margin, so remove border 7927 if ( extra !== "margin" ) { 7928 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 7929 } 7930 } else { 7931 // At this point, extra isn't content, so add padding 7932 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 7933 7934 // At this point, extra isn't content nor padding, so add border 7935 if ( extra !== "padding" ) { 7936 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 7937 } 7938 } 7939 } 7940 7941 return val; 7942} 7943 7944function getWidthOrHeight( elem, name, extra ) { 7945 7946 // Start with offset property, which is equivalent to the border-box value 7947 var valueIsBorderBox = true, 7948 val = name === "width" ? elem.offsetWidth : elem.offsetHeight, 7949 styles = getStyles( elem ), 7950 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 7951 7952 // Some non-html elements return undefined for offsetWidth, so check for null/undefined 7953 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 7954 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 7955 if ( val <= 0 || val == null ) { 7956 // Fall back to computed then uncomputed css if necessary 7957 val = curCSS( elem, name, styles ); 7958 if ( val < 0 || val == null ) { 7959 val = elem.style[ name ]; 7960 } 7961 7962 // Computed unit is not pixels. Stop here and return. 7963 if ( rnumnonpx.test(val) ) { 7964 return val; 7965 } 7966 7967 // Check for style in case a browser which returns unreliable values 7968 // for getComputedStyle silently falls back to the reliable elem.style 7969 valueIsBorderBox = isBorderBox && 7970 ( support.boxSizingReliable() || val === elem.style[ name ] ); 7971 7972 // Normalize "", auto, and prepare for extra 7973 val = parseFloat( val ) || 0; 7974 } 7975 7976 // Use the active box-sizing model to add/subtract irrelevant styles 7977 return ( val + 7978 augmentWidthOrHeight( 7979 elem, 7980 name, 7981 extra || ( isBorderBox ? "border" : "content" ), 7982 valueIsBorderBox, 7983 styles 7984 ) 7985 ) + "px"; 7986} 7987 7988function showHide( elements, show ) { 7989 var display, elem, hidden, 7990 values = [], 7991 index = 0, 7992 length = elements.length; 7993 7994 for ( ; index < length; index++ ) { 7995 elem = elements[ index ]; 7996 if ( !elem.style ) { 7997 continue; 7998 } 7999 8000 values[ index ] = data_priv.get( elem, "olddisplay" ); 8001 display = elem.style.display; 8002 if ( show ) { 8003 // Reset the inline display of this element to learn if it is 8004 // being hidden by cascaded rules or not 8005 if ( !values[ index ] && display === "none" ) { 8006 elem.style.display = ""; 8007 } 8008 8009 // Set elements which have been overridden with display: none 8010 // in a stylesheet to whatever the default browser style is 8011 // for such an element 8012 if ( elem.style.display === "" && isHidden( elem ) ) { 8013 values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) ); 8014 } 8015 } else { 8016 hidden = isHidden( elem ); 8017 8018 if ( display !== "none" || !hidden ) { 8019 data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "dis
8019play" ) ); 8020 } 8021 } 8022 } 8023 8024 // Set the display of most of the elements in a second loop 8025 // to avoid the constant reflow 8026 for ( index = 0; index < length; index++ ) { 8027 elem = elements[ index ]; 8028 if ( !elem.style ) { 8029 continue; 8030 } 8031 if ( !show || elem.style.display === "none" || elem.style.display === "" ) { 8032 elem.style.display = show ? values[ index ] || "" : "none"; 8033 } 8034 } 8035 8036 return elements; 8037} 8038 8039jQuery.extend({ 8040 8041 // Add in style property hooks for overriding the default 8042 // behavior of getting and setting a style property 8043 cssHooks: { 8044 opacity: { 8045 get: function( elem, computed ) { 8046 if ( computed ) { 8047 8048 // We should always get a number back from opacity 8049 var ret = curCSS( elem, "opacity" ); 8050 return ret === "" ? "1" : ret; 8051 } 8052 } 8053 } 8054 }, 8055 8056 // Don't automatically add "px" to these possibly-unitless properties 8057 cssNumber: { 8058 "columnCount": true, 8059 "fillOpacity": true, 8060 "flexGrow": true, 8061 "flexShrink": true, 8062 "fontWeight": true, 8063 "lineHeight": true, 8064 "opacity": true, 8065 "order": true, 8066 "orphans": true, 8067 "widows": true, 8068 "zIndex": true, 8069 "zoom": true 8070 }, 8071 8072 // Add in properties whose names you wish to fix before 8073 // setting or getting the value 8074 cssProps: { 8075 "float": "cssFloat" 8076 }, 8077 8078 // Get and set the style property on a DOM Node 8079 style: function( elem, name, value, extra ) { 8080 8081 // Don't set styles on text and comment nodes 8082 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 8083 return; 8084 } 8085 8086 // Make sure that we're working with the right name 8087 var ret, type, hooks, 8088 origName = jQuery.camelCase( name ), 8089 style = elem.style; 8090 8091 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); 8092 8093 // Gets hook for the prefixed version, then unprefixed version 8094 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 8095 8096 // Check if we're setting a value 8097 if ( value !== undefined ) { 8098 type = typeof value; 8099 8100 // Convert "+=" or "-=" to relative numbers (#7345) 8101 if ( type === "string" && (ret = rrelNum.exec( value )) ) { 8102 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); 8103 // Fixes bug #9237 8104 type = "number"; 8105 } 8106 8107 // Make sure that null and NaN values aren't set (#7116) 8108 if ( value == null || value !== value ) { 8109 return; 8110 } 8111 8112 // If a number, add 'px' to the (except for certain CSS properties) 8113 if ( type === "number" && !jQuery.cssNumber[ origName ] ) { 8114 value += "px"; 8115 } 8116 8117 // Support: IE9-11+ 8118 // background-* props affect original clone's values 8119 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 8120 style[ name ] = "inherit"; 8121 } 8122 8123 // If a hook was provided, use that value, otherwise just set the specified value 8124 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { 8125 style[ name ] = value; 8126 } 8127 8128 } else { 8129 // If a hook was provided get the non-computed value from there 8130 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { 8131 return ret; 8132 } 8133 8134 // Otherwise just get the value from the style object 8135 return style[ name ]; 8136 } 8137 }, 8138 8139 css: function( elem, name, extra, styles ) { 8140 var val, num, hooks, 8141 origName = jQuery.camelCase( name ); 8142 8143 // Make sure that we're working with the right name 8144 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); 8145 8146 // Try prefixed name followed by the unprefixed name 8147 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 8148 8149 // If a hook was provided get the computed value from there 8150 if ( hooks && "get" in hooks ) { 8151 val = hooks.get( elem, true, extra ); 8152 } 8153 8154 // Otherwise, if a way to get the computed value exists, use that 8155 if ( val === undefined ) { 8156 val = curCSS( elem, name, styles ); 8157 } 8158 8159 // Convert "normal" to computed value 8160 if ( val === "normal" && name in cssNormalTransform ) { 8161 val = cssNormalTransform[ name ]; 8162 } 8163 8164 // Make numeric if forced or a qualifier was provided and val looks numeric 8165 if ( extra === "" || extra ) { 8166 num = parseFloat( val ); 8167 return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; 8168 } 8169 return val; 8170 } 8171}); 8172 8173jQuery.each([ "height", "width" ], function( i, name ) { 8174 jQuery.cssHooks[ name ] = { 8175 get: function( elem, computed, extra ) { 8176 if ( computed ) { 8177 8178 // Certain elements can have dimension info if we invisibly show them 8179 // but it must have a current display style that would benefit
8180 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ? 8181 jQuery.swap( elem, cssShow, function() { 8182 return getWidthOrHeight( elem, name, extra ); 8183 }) : 8184 getWidthOrHeight( elem, name, extra ); 8185 } 8186 }, 8187 8188 set: function( elem, value, extra ) { 8189 var styles = extra && getStyles( elem ); 8190 return setPositiveNumber( elem, value, extra ? 8191 augmentWidthOrHeight( 8192 elem, 8193 name, 8194 extra, 8195 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 8196 styles 8197 ) : 0 8198 ); 8199 } 8200 }; 8201}); 8202 8203// Support: Android 2.3 8204jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, 8205 function( elem, computed ) { 8206 if ( computed ) { 8207 return jQuery.swap( elem, { "display": "inline-block" }, 8208 curCSS, [ elem, "marginRight" ] ); 8209 } 8210 } 8211); 8212 8213// These hooks are used by animate to expand properties 8214jQuery.each({ 8215 margin: "", 8216 padding: "", 8217 border: "Width" 8218}, function( prefix, suffix ) { 8219 jQuery.cssHooks[ prefix + suffix ] = { 8220 expand: function( value ) { 8221 var i = 0, 8222 expanded = {}, 8223 8224 // Assumes a single number if not a string 8225 parts = typeof value === "string" ? value.split(" ") : [ value ]; 8226 8227 for ( ; i < 4; i++ ) { 8228 expanded[ prefix + cssExpand[ i ] + suffix ] = 8229 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 8230 } 8231 8232 return expanded; 8233 } 8234 }; 8235 8236 if ( !rmargin.test( prefix ) ) { 8237 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 8238 } 8239}); 8240 8241jQuery.fn.extend({ 8242 css: function( name, value ) { 8243 return access( this, function( elem, name, value ) { 8244 var styles, len, 8245 map = {}, 8246 i = 0; 8247 8248 if ( jQuery.isArray( name ) ) { 8249 styles = getStyles( elem ); 8250 len = name.length; 8251 8252 for ( ; i < len; i++ ) { 8253 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 8254 } 8255 8256 return map; 8257 } 8258 8259 return value !== undefined ? 8260 jQuery.style( elem, name, value ) : 8261 jQuery.css( elem, name ); 8262 }, name, value, arguments.length > 1 ); 8263 }, 8264 show: function() { 8265 return showHide( this, true ); 8266 }, 8267 hide: function() { 8268 return showHide( this ); 8269 }, 8270 toggle: function( state ) { 8271 if ( typeof state === "boolean" ) { 8272 return state ? this.show() : this.hide(); 8273 } 8274 8275 return this.each(function() { 8276 if ( isHidden( this ) ) { 8277 jQuery( this ).show(); 8278 } else { 8279 jQuery( this ).hide(); 8280 } 8281 }); 8282 } 8283}); 8284 8285 8286function Tween( elem, options, prop, end, easing ) { 8287 return new Tween.prototype.init( elem, options, prop, end, easing ); 8288} 8289jQuery.Tween = Tween; 8290 8291Tween.prototype = { 8292 constructor: Tween, 8293 init: function( elem, options, prop, end, easing, unit ) { 8294 this.elem = elem; 8295 this.prop = prop; 8296 this.easing = easing || "swing"; 8297 this.options = options; 8298 this.start = this.now = this.cur(); 8299 this.end = end; 8300 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 8301 }, 8302 cur: function() { 8303 var hooks = Tween.propHooks[ this.prop ]; 8304 8305 return hooks && hooks.get ? 8306 hooks.get( this ) : 8307 Tween.propHooks._default.get( this ); 8308 }, 8309 run: function( percent ) { 8310 var eased, 8311 hooks = Tween.propHooks[ this.prop ]; 8312 8313 if ( this.options.duration ) { 8314 this.pos = eased = jQuery.easing[ this.easing ]( 8315 percent, this.options.duration * percent, 0, 1, this.options.duration 8316 ); 8317 } else { 8318 this.pos = eased = percent; 8319 } 8320 this.now = ( this.end - this.start ) * eased + this.start; 8321 8322 if ( this.options.step ) { 8323 this.options.step.call( this.elem, this.now, this ); 8324 } 8325 8326 if ( hooks && hooks.set ) { 8327 hooks.set( this ); 8328 } else { 8329 Tween.propHooks._default.set( this ); 8330 } 8331 return this; 8332 } 8333}; 8334 8335Tween.prototype.init.prototype = Tween.prototype; 8336 8337Tween.propHooks = { 8338 _default: { 8339 get: function( tween ) { 8340 var result; 8341 8342 if ( tween.elem[ tween.prop ] != null && 8343 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { 8344 return tween.elem[ tween.prop ]; 8345 } 8346 8347 // Passing an empty string as a 3rd parameter to .css will automatically 8348 // attempt a parseFloat and fallback to a string if the parse fails. 8349 // Simple values such as "10px" are parsed to Float; 8350 // complex values such as "rotate(1rad)" are returned as-is. 8351 result = jQuery.css( tween.elem, tween.prop, "" ); 8352 // Empty strings, null, undefined and "auto" are converted to 0. 8353 return !result || result === "auto" ? 0 : result; 8354 }, 8355 set: function( tween ) { 8356 // Use step hook for back compat. 8357 // Use cssHook if its there. 8358 // Use .style if available and use plain properties where available. 8359 if ( jQuery.fx.step[ tween.prop ] ) { 8360 jQuery.fx.step[ tween.prop ]( tween ); 8361 } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { 8362 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 8363 } else { 8364 tween.elem[ tween.prop ] = tween.now; 8365 } 8366 } 8367 } 8368}; 8369 8370// Support: IE9
8371// Panic based approach to setting things on disconnected nodes 8372Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 8373 set: function( tween ) { 8374 if ( tween.elem.nodeType && tween.elem.parentNode ) { 8375 tween.elem[ tween.prop ] = tween.now; 8376 } 8377 } 8378}; 8379 8380jQuery.easing = { 8381 linear: function( p ) { 8382 return p; 8383 }, 8384 swing: function( p ) { 8385 return 0.5 - Math.cos( p * Math.PI ) / 2; 8386 } 8387}; 8388 8389jQuery.fx = Tween.prototype.init; 8390 8391// Back Compat <1.8 extension point 8392jQuery.fx.step = {}; 8393 8394 8395 8396 8397var 8398 fxNow, timerId, 8399 rfxtypes = /^(?:toggle|show|hide)$/, 8400 rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ), 8401 rrun = /queueHooks$/, 8402 animationPrefilters = [ defaultPrefilter ], 8403 tweeners = { 8404 "*": [ function( prop, value ) { 8405 var tween = this.createTween( prop, value ), 8406 target = tween.cur(), 8407 parts = rfxnum.exec( value ), 8408 unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 8409 8410 // Starting value computation is required for potential unit mismatches 8411 start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) && 8412 rfxnum.exec( jQuery.css( tween.elem, prop ) ), 8413 scale = 1, 8414 maxIterations = 20; 8415 8416 if ( start && start[ 3 ] !== unit ) { 8417 // Trust units reported by jQuery.css 8418 unit = unit || start[ 3 ]; 8419 8420 // Make sure we update the tween properties later on 8421 parts = parts || []; 8422 8423 // Iteratively approximate from a nonzero starting point 8424 start = +target || 1; 8425 8426 do { 8427 // If previous iteration zeroed out, double until we get *something*. 8428 // Use string for doubling so we don't accidentally see scale as unchanged below 8429 scale = scale || ".5"; 8430 8431 // Adjust and apply 8432 start = start / scale; 8433 jQuery.style( tween.elem, prop, start + unit ); 8434 8435 // Update scale, tolerating zero or NaN from tween.cur(), 8436 // break the loop if scale is unchanged or perfect, or if we've just had enough 8437 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); 8438 } 8439 8440 // Update tween properties 8441 if ( parts ) { 8442 start = tween.start = +start || +target || 0; 8443 tween.unit = unit; 8444 // If a +=/-= token was provided, we're doing a relative animation 8445 tween.end = parts[ 1 ] ? 8446 start + ( parts[ 1 ] + 1 ) * parts[ 2 ] : 8447 +parts[ 2 ]; 8448 } 8449 8450 return tween; 8451 } ] 8452 }; 8453 8454// Animations created synchronously will run synchronously 8455function createFxNow() { 8456 setTimeout(function() { 8457 fxNow = undefined; 8458 }); 8459 return ( fxNow = jQuery.now() ); 8460} 8461 8462// Generate parameters to create a standard animation 8463function genFx( type, includeWidth ) { 8464 var which, 8465 i = 0, 8466 attrs = { height: type }; 8467 8468 // If we include width, step value is 1 to do all cssExpand values, 8469 // otherwise step value is 2 to skip over Left and Right 8470 includeWidth = includeWidth ? 1 : 0; 8471 for ( ; i < 4 ; i += 2 - includeWidth ) { 8472 which = cssExpand[ i ]; 8473 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 8474 } 8475 8476 if ( includeWidth ) { 8477 attrs.opacity = attrs.width = type; 8478 } 8479 8480 return attrs; 8481} 8482 8483function createTween( value, prop, animation ) { 8484 var tween, 8485 collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), 8486 index = 0, 8487 length = collection.length; 8488 for ( ; index < length; index++ ) { 8489 if ( (tween = collection[ index ].call( animation, prop, value )) ) { 8490 8491 // We're done with this property 8492 return tween; 8493 } 8494 } 8495} 8496 8497function defaultPrefilter( elem, props, opts ) { 8498 /* jshint validthis: true */ 8499 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, 8500 anim = this, 8501 orig = {}, 8502 style = elem.style, 8503 hidden = elem.nodeType && isHidden( elem ), 8504 dataShow = data_priv.get( elem, "fxshow" ); 8505 8506 // Handle queue: false promises 8507 if ( !opts.queue ) { 8508 hooks = jQuery._queueHooks( elem, "fx" ); 8509 if ( hooks.unqueued == null ) { 8510 hooks.unqueued = 0; 8511 oldfire = hooks.empty.fire; 8512 hooks.empty.fire = function() { 8513 if ( !hooks.unqueued ) { 8514 oldfire(); 8515 } 8516 }; 8517 } 8518 hooks.unqueued++; 8519 8520 anim.always(function() { 8521 // Ensure the complete handler is called before this completes 8522 anim.always(function() { 8523 hooks.unqueued--; 8524 if ( !jQuery.queue( elem, "fx" ).length ) { 8525 hooks.empty.fire(); 8526 } 8527 }); 8528 }); 8529 } 8530 8531 // Height/width overflow pass 8532 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { 8533 // Make sure that nothing sneaks out
8534 // Record all 3 overflow attributes because IE9-10 do not 8535 // change the overflow attribute when overflowX and 8536 // overflowY are set to the same value 8537 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 8538 8539 // Set display property to inline-block for height/width 8540 // animations on inline elements that are having width/height animated 8541 display = jQuery.css( elem, "display" ); 8542 8543 // Test default display if display is currently "none" 8544 checkDisplay = display === "none" ? 8545 data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; 8546 8547 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { 8548 style.display = "inline-block"; 8549 } 8550 } 8551 8552 if ( opts.overflow ) { 8553 style.overflow = "hidden"; 8554 anim.always(function() { 8555 style.overflow = opts.overflow[ 0 ]; 8556 style.overflowX = opts.overflow[ 1 ]; 8557 style.overflowY = opts.overflow[ 2 ]; 8558 }); 8559 } 8560 8561 // show/hide pass 8562 for ( prop in props ) { 8563 value = props[ prop ]; 8564 if ( rfxtypes.exec( value ) ) { 8565 delete props[ prop ]; 8566 toggle = toggle || value === "toggle"; 8567 if ( value === ( hidden ? "hide" : "show" ) ) { 8568 8569 // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden 8570 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 8571 hidden = true; 8572 } else { 8573 continue; 8574 } 8575 } 8576 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 8577 8578 // Any non-fx value stops us from restoring the original display value 8579 } else { 8580 display = undefined; 8581 } 8582 } 8583 8584 if ( !jQuery.isEmptyObject( orig ) ) { 8585 if ( dataShow ) { 8586 if ( "hidden" in dataShow ) { 8587 hidden = dataShow.hidden; 8588 } 8589 } else { 8590 dataShow = data_priv.access( elem, "fxshow", {} ); 8591 } 8592 8593 // Store state if its toggle - enables .stop().toggle() to "reverse" 8594 if ( toggle ) { 8595 dataShow.hidden = !hidden; 8596 } 8597 if ( hidden ) { 8598 jQuery( elem ).show(); 8599 } else { 8600 anim.done(function() { 8601 jQuery( elem ).hide(); 8602 }); 8603 } 8604 anim.done(function() { 8605 var prop; 8606 8607 data_priv.remove( elem, "fxshow" ); 8608 for ( prop in orig ) { 8609 jQuery.style( elem, prop, orig[ prop ] ); 8610 } 8611 }); 8612 for ( prop in orig ) { 8613 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 8614 8615 if ( !( prop in dataShow ) ) { 8616 dataShow[ prop ] = tween.start; 8617 if ( hidden ) { 8618 tween.end = tween.start; 8619 tween.start = prop === "width" || prop === "height" ? 1 : 0; 8620 } 8621 } 8622 } 8623 8624 // If this is a noop like .hide().hide(), restore an overwritten display value 8625 } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) { 8626 style.display = display; 8627 } 8628} 8629 8630function propFilter( props, specialEasing ) { 8631 var index, name, easing, value, hooks; 8632 8633 // camelCase, specialEasing and expand cssHook pass 8634 for ( index in props ) { 8635 name = jQuery.camelCase( index ); 8636 easing = specialEasing[ name ]; 8637 value = props[ index ]; 8638 if ( jQuery.isArray( value ) ) { 8639 easing = value[ 1 ]; 8640 value = props[ index ] = value[ 0 ]; 8641 } 8642 8643 if ( index !== name ) { 8644 props[ name ] = value; 8645 delete props[ index ]; 8646 } 8647 8648 hooks = jQuery.cssHooks[ name ]; 8649 if ( hooks && "expand" in hooks ) { 8650 value = hooks.expand( value ); 8651 delete props[ name ]; 8652 8653 // Not quite $.extend, this won't overwrite existing keys. 8654 // Reusing 'index' because we have the correct "name" 8655 for ( index in value ) { 8656 if ( !( index in props ) ) { 8657 props[ index ] = value[ index ]; 8658 specialEasing[ index ] = easing; 8659 } 8660 } 8661 } else { 8662 specialEasing[ name ] = easing; 8663 } 8664 } 8665} 8666 8667function Animation( elem, properties, options ) { 8668 var result, 8669 stopped, 8670 index = 0, 8671 length = animationPrefilters.length, 8672 deferred = jQuery.Deferred().always( function() { 8673 // Don't match elem in the :animated selector 8674 delete tick.elem; 8675 }), 8676 tick = function() { 8677 if ( stopped ) { 8678 return false; 8679 } 8680 var currentTime = fxNow || createFxNow(), 8681 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 8682 // Support: Android 2.3
8683 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 8684 temp = remaining / animation.duration || 0, 8685 percent = 1 - temp, 8686 index = 0, 8687 length = animation.tweens.length; 8688 8689 for ( ; index < length ; index++ ) { 8690 animation.tweens[ index ].run( percent ); 8691 } 8692 8693 deferred.notifyWith( elem, [ animation, percent, remaining ]); 8694 8695 if ( percent < 1 && length ) { 8696 return remaining; 8697 } else { 8698 deferred.resolveWith( elem, [ animation ] ); 8699 return false; 8700 } 8701 }, 8702 animation = deferred.promise({ 8703 elem: elem, 8704 props: jQuery.extend( {}, properties ), 8705 opts: jQuery.extend( true, { specialEasing: {} }, options ), 8706 originalProperties: properties, 8707 originalOptions: options, 8708 startTime: fxNow || createFxNow(), 8709 duration: options.duration, 8710 tweens: [], 8711 createTween: function( prop, end ) { 8712 var tween = jQuery.Tween( elem, animation.opts, prop, end, 8713 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 8714 animation.tweens.push( tween ); 8715 return tween; 8716 }, 8717 stop: function( gotoEnd ) { 8718 var index = 0, 8719 // If we are going to the end, we want to run all the tweens 8720 // otherwise we skip this part 8721 length = gotoEnd ? animation.tweens.length : 0; 8722 if ( stopped ) { 8723 return this; 8724 } 8725 stopped = true; 8726 for ( ; index < length ; index++ ) { 8727 animation.tweens[ index ].run( 1 ); 8728 } 8729 8730 // Resolve when we played the last frame; otherwise, reject 8731 if ( gotoEnd ) { 8732 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 8733 } else { 8734 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 8735 } 8736 return this; 8737 } 8738 }), 8739 props = animation.props; 8740 8741 propFilter( props, animation.opts.specialEasing ); 8742 8743 for ( ; index < length ; index++ ) { 8744 result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); 8745 if ( result ) { 8746 return result; 8747 } 8748 } 8749 8750 jQuery.map( props, createTween, animation ); 8751 8752 if ( jQuery.isFunction( animation.opts.start ) ) { 8753 animation.opts.start.call( elem, animation ); 8754 } 8755 8756 jQuery.fx.timer( 8757 jQuery.extend( tick, { 8758 elem: elem, 8759 anim: animation, 8760 queue: animation.opts.queue 8761 }) 8762 ); 8763 8764 // attach callbacks from options 8765 return animation.progress( animation.opts.progress ) 8766 .done( animation.opts.done, animation.opts.complete ) 8767 .fail( animation.opts.fail ) 8768 .always( animation.opts.always ); 8769} 8770 8771jQuery.Animation = jQuery.extend( Animation, { 8772 8773 tweener: function( props, callback ) { 8774 if ( jQuery.isFunction( props ) ) { 8775 callback = props; 8776 props = [ "*" ]; 8777 } else { 8778 props = props.split(" "); 8779 } 8780 8781 var prop, 8782 index = 0, 8783 length = props.length; 8784 8785 for ( ; index < length ; index++ ) { 8786 prop = props[ index ]; 8787 tweeners[ prop ] = tweeners[ prop ] || []; 8788 tweeners[ prop ].unshift( callback ); 8789 } 8790 }, 8791 8792 prefilter: function( callback, prepend ) { 8793 if ( prepend ) { 8794 animationPrefilters.unshift( callback ); 8795 } else { 8796 animationPrefilters.push( callback ); 8797 } 8798 } 8799}); 8800 8801jQuery.speed = function( speed, easing, fn ) { 8802 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 8803 complete: fn || !fn && easing || 8804 jQuery.isFunction( speed ) && speed, 8805 duration: speed, 8806 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing 8807 }; 8808 8809 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : 8810 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; 8811 8812 // Normalize opt.queue - true/undefined/null -> "fx" 8813 if ( opt.queue == null || opt.queue === true ) { 8814 opt.queue = "fx"; 8815 } 8816 8817 // Queueing 8818 opt.old = opt.complete; 8819 8820 opt.complete = function() { 8821 if ( jQuery.isFunction( opt.old ) ) { 8822 opt.old.call( this ); 8823 } 8824 8825 if ( opt.queue ) { 8826 jQuery.dequeue( this, opt.queue ); 8827 } 8828 }; 8829 8830 return opt; 8831}; 8832 8833jQuery.fn.extend({ 8834 fadeTo: function( speed, to, easing, callback ) { 8835 8836 // Show any hidden elements after setting opacity to 0 8837 return this.filter( isHidden ).css( "opacity", 0 ).show() 8838 8839 // Animate to the value specified 8840 .end().animate({ opacity: to }, speed, easing, callback ); 8841 }, 8842 animate: function( prop, speed, easing, callback ) { 8843 var empty = jQuery.isEmptyObject( prop ), 8844 optall = jQuery.speed( speed, easing, callback ), 8845 doAnimation = function() { 8846 // Operate on a copy of prop so per-property easing won't be lost 8847 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 8848 8849 // Empty animations, or finishing resolves immediately 8850 if ( empty || data_priv.get( this, "finish" ) ) { 8851 anim.stop( true ); 8852 } 8853 }; 8854 doAnimation.finish = doAnimation; 8855 8856 return empty || optall.queue === false ? 8857 this.each( doAnimation ) : 8858 this.queue( optall.queue, doAnimation ); 8859 }, 8860 stop: function( type, clearQueue, gotoEnd ) { 8861 var stopQueue = function( hooks ) { 8862 var stop = hooks.stop; 8863 delete hooks.stop; 8864 stop( gotoEnd ); 8865 }; 8866 8867 if ( typeof type !== "string" ) { 8868 gotoEnd = clearQueue; 8869 clearQueue = type; 8870 type = undefined; 8871 } 8872 if ( clearQueue && type !== false ) { 8873 this.queue( type || "fx", [] ); 8874 } 8875 8876 return this.each(function() { 8877 var dequeue = true, 8878 index = type != null && type + "queueHooks", 8879 timers = jQuery.timers, 8880 data = data_priv.get( this ); 8881 8882 if ( index ) { 8883 if ( data[ index ] && data[ index ].stop ) { 8884 stopQueue( data[ index ] ); 8885 } 8886 } else { 8887 for ( index in data ) { 8888 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 8889 stopQueue( data[ index ] ); 8890 } 8891 } 8892 } 8893 8894 for ( index = timers.length; index--; ) { 8895 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { 8896 timers[ index ].anim.stop( gotoEnd ); 8897 dequeue = false;
vendor: 3,033 bytes, lines 8898-9029
8898 timers.splice( index, 1 ); 8899 } 8900 } 8901 8902 // Start the next in the queue if the last step wasn't forced. 8903 // Timers currently will call their complete callbacks, which 8904 // will dequeue but only if they were gotoEnd. 8905 if ( dequeue || !gotoEnd ) { 8906 jQuery.dequeue( this, type ); 8907 } 8908 }); 8909 }, 8910 finish: function( type ) { 8911 if ( type !== false ) { 8912 type = type || "fx"; 8913 } 8914 return this.each(function() { 8915 var index, 8916 data = data_priv.get( this ), 8917 queue = data[ type + "queue" ], 8918 hooks = data[ type + "queueHooks" ], 8919 timers = jQuery.timers, 8920 length = queue ? queue.length : 0; 8921 8922 // Enable finishing flag on private data 8923 data.finish = true; 8924 8925 // Empty the queue first 8926 jQuery.queue( this, type, [] ); 8927 8928 if ( hooks && hooks.stop ) { 8929 hooks.stop.call( this, true ); 8930 } 8931 8932 // Look for any active animations, and finish them 8933 for ( index = timers.length; index--; ) { 8934 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 8935 timers[ index ].anim.stop( true ); 8936 timers.splice( index, 1 ); 8937 } 8938 } 8939 8940 // Look for any animations in the old queue and finish them 8941 for ( index = 0; index < length; index++ ) { 8942 if ( queue[ index ] && queue[ index ].finish ) { 8943 queue[ index ].finish.call( this ); 8944 } 8945 } 8946 8947 // Turn off finishing flag 8948 delete data.finish; 8949 }); 8950 } 8951}); 8952 8953jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { 8954 var cssFn = jQuery.fn[ name ]; 8955 jQuery.fn[ name ] = function( speed, easing, callback ) { 8956 return speed == null || typeof speed === "boolean" ? 8957 cssFn.apply( this, arguments ) : 8958 this.animate( genFx( name, true ), speed, easing, callback ); 8959 }; 8960}); 8961 8962// Generate shortcuts for custom animations 8963jQuery.each({ 8964 slideDown: genFx("show"), 8965 slideUp: genFx("hide"), 8966 slideToggle: genFx("toggle"), 8967 fadeIn: { opacity: "show" }, 8968 fadeOut: { opacity: "hide" }, 8969 fadeToggle: { opacity: "toggle" } 8970}, function( name, props ) { 8971 jQuery.fn[ name ] = function( speed, easing, callback ) { 8972 return this.animate( props, speed, easing, callback ); 8973 }; 8974}); 8975 8976jQuery.timers = []; 8977jQuery.fx.tick = function() { 8978 var timer, 8979 i = 0, 8980 timers = jQuery.timers; 8981 8982 fxNow = jQuery.now(); 8983 8984 for ( ; i < timers.length; i++ ) { 8985 timer = timers[ i ]; 8986 // Checks the timer has not already been removed 8987 if ( !timer() && timers[ i ] === timer ) { 8988 timers.splice( i--, 1 ); 8989 } 8990 } 8991 8992 if ( !timers.length ) { 8993 jQuery.fx.stop(); 8994 } 8995 fxNow = undefined; 8996}; 8997 8998jQuery.fx.timer = function( timer ) { 8999 jQuery.timers.push( timer ); 9000 if ( timer() ) { 9001 jQuery.fx.start(); 9002 } else { 9003 jQuery.timers.pop(); 9004 } 9005}; 9006 9007jQuery.fx.interval = 13; 9008 9009jQuery.fx.start = function() { 9010 if ( !timerId ) { 9011 timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); 9012 } 9013}; 9014 9015jQuery.fx.stop = function() { 9016 clearInterval( timerId ); 9017 timerId = null; 9018}; 9019 9020jQuery.fx.speeds = { 9021 slow: 600, 9022 fast: 200, 9023 // Default speed 9024 _default: 400 9025}; 9026 9027 9028// Based off of the plugin by Clint Helfers, with permission. 9029// http://blindsignals.com/index.php/2009/07/jquery-delay/
9030jQuery.fn.delay = function( time, type ) { 9031 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 9032 type = type || "fx"; 9033 9034 return this.queue( type, function( next, hooks ) { 9035 var timeout = setTimeout( next, time ); 9036 hooks.stop = function() { 9037 clearTimeout( timeout ); 9038 }; 9039 }); 9040}; 9041 9042 9043(function() { 9044 var input = document.createElement( "input" ), 9045 select = document.createElement( "select" ), 9046 opt = select.appendChild( document.createElement( "option" ) ); 9047 9048 input.type = "checkbox"; 9049 9050 // Support: iOS<=5.1, Android<=4.2+ 9051 // Default value for a checkbox should be "on" 9052 support.checkOn = input.value !== ""; 9053 9054 // Support: IE<=11+ 9055 // Must access selectedIndex to make default options select 9056 support.optSelected = opt.selected; 9057 9058 // Support: Android<=2.3 9059 // Options inside disabled selects are incorrectly marked as disabled 9060 select.disabled = true; 9061 support.optDisabled = !opt.disabled; 9062 9063 // Support: IE<=11+ 9064 // An input loses its value after becoming a radio 9065 input = document.createElement( "input" ); 9066 input.value = "t"; 9067 input.type = "radio"; 9068 support.radioValue = input.value === "t"; 9069})(); 9070 9071 9072var nodeHook, boolHook, 9073 attrHandle = jQuery.expr.attrHandle; 9074 9075jQuery.fn.extend({ 9076 attr: function( name, value ) { 9077 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 9078 }, 9079 9080 removeAttr: function( name ) { 9081 return this.each(function() { 9082 jQuery.removeAttr( this, name ); 9083 }); 9084 } 9085}); 9086 9087jQuery.extend({ 9088 attr: function( elem, name, value ) { 9089 var hooks, ret, 9090 nType = elem.nodeType; 9091 9092 // don't get/set attributes on text, comment and attribute nodes 9093 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { 9094 return; 9095 } 9096 9097 // Fallback to prop when attributes are not supported 9098 if ( typeof elem.getAttribute === strundefined ) { 9099 return jQuery.prop( elem, name, value ); 9100 } 9101 9102 // All attributes are lowercase 9103 // Grab necessary hook if one is defined 9104 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 9105 name = name.toLowerCase(); 9106 hooks = jQuery.attrHooks[ name ] || 9107 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); 9108 } 9109 9110 if ( value !== undefined ) { 9111 9112 if ( value === null ) { 9113 jQuery.removeAttr( elem, name ); 9114 9115 } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { 9116 return ret; 9117 9118 } else { 9119 elem.setAttribute( name, value + "" ); 9120 return value; 9121 } 9122 9123 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { 9124 return ret; 9125 9126 } else { 9127 ret = jQuery.find.attr( elem, name ); 9128 9129 // Non-existent attributes return null, we normalize to undefined 9130 return ret == null ? 9131 undefined : 9132 ret; 9133 } 9134 }, 9135 9136 removeAttr: function( elem, value ) { 9137 var name, propName, 9138 i = 0, 9139 attrNames = value && value.match( rnotwhite ); 9140 9141 if ( attrNames && elem.nodeType === 1 ) { 9142 while ( (name = attrNames[i++]) ) { 9143 propName = jQuery.propFix[ name ] || name; 9144 9145 // Boolean attributes get special treatment (#10870) 9146 if ( jQuery.expr.match.bool.test( name ) ) { 9147 // Set corresponding property to false 9148 elem[ propName ] = false; 9149 } 9150 9151 elem.removeAttribute( name ); 9152 } 9153 } 9154 }, 9155 9156 attrHooks: { 9157 type: { 9158 set: function( elem, value ) { 9159 if ( !support.radioValue && value === "radio" && 9160 jQuery.nodeName( elem, "input" ) ) { 9161 var val = elem.value; 9162 elem.setAttribute( "type", value ); 9163 if ( val ) { 9164 elem.value = val; 9165 } 9166 return value; 9167 } 9168 } 9169 } 9170 } 9171}); 9172 9173// Hooks for boolean attributes 9174boolHook = { 9175 set: function( elem, value, name ) { 9176 if ( value === false ) { 9177 // Remove boolean attributes when set to false 9178 jQuery.removeAttr( elem, name ); 9179 } else { 9180 elem.setAttribute( name, name ); 9181 } 9182 return name; 9183 } 9184}; 9185jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { 9186 var getter = attrHandle[ name ] || jQuery.find.attr; 9187 9188 attrHandle[ name ] = function( elem, name, isXML ) { 9189 var ret, handle; 9190 if ( !isXML ) { 9191 // Avoid an infinite loop by temporarily removing this function from the getter 9192 handle = attrHandle[ name ]; 9193 attrHandle[ name ] = ret; 9194 ret = getter( elem, name, isXML ) != null ? 9195 name.toLowerCase() : 9196 null; 9197 attrHandle[ name ] = handle; 9198 } 9199 return ret; 9200 }; 9201}); 9202 9203 9204 9205 9206var rfocusable = /^(?:input|select|textarea|button)$/i; 9207 9208jQuery.fn.extend({ 9209 prop: function( name, value ) { 9210 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 9211 }, 9212 9213 removeProp: function( name ) { 9214 return this.each(function() { 9215 delete this[ jQuery.propFix[ name ] || name ]; 9216 }); 9217 } 9218}); 9219 9220jQuery.extend({ 9221 propFix: { 9222 "for": "htmlFor", 9223 "class": "className" 9224 }, 9225 9226 prop: function( elem, name, value ) { 9227 var ret, hooks, notxml, 9228 nType = elem.nodeType; 9229 9230 // Don't get/set properties on text, comment and attribute nodes 9231 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { 9232 return; 9233 } 9234 9235 notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); 9236 9237 if ( notxml ) { 9238 // Fix name and attach hooks 9239 name = jQuery.propFix[ name ] || name; 9240 hooks = jQuery.propHooks[ name ]; 9241 } 9242 9243 if ( value !== undefined ) { 9244 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? 9245 ret : 9246 ( elem[ name ] = value ); 9247 9248 } else { 9249 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? 9250 ret : 9251 elem[ name ]; 9252 } 9253 }, 9254 9255 propHooks: { 9256 tabIndex: { 9257 get: function( elem ) { 9258 return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ? 9259 elem.tabIndex : 9260 -1; 9261 } 9262 } 9263 } 9264}); 9265 9266if ( !support.optSelected ) { 9267 jQuery.propHooks.selected = { 9268 get: function( elem ) { 9269 var parent = elem.parentNode; 9270 if ( parent && parent.parentNode ) { 9271 parent.parentNode.selectedIndex; 9272 } 9273 return null; 9274 } 9275 }; 9276} 9277 9278jQuery.each([ 9279 "tabIndex", 9280 "readOnly", 9281 "maxLength", 9282 "cellSpacing", 9283 "cellPadding", 9284 "rowSpan", 9285 "colSpan", 9286 "useMap", 9287 "frameBorder", 9288 "contentEditable" 9289], function() { 9290 jQuery.propFix[ this.toLowerCase() ] = this; 9291}); 9292 9293 9294 9295 9296var rclass = /[\t\r\n\f]/g; 9297 9298jQuery.fn.extend({ 9299 addClass: function( value ) { 9300 var classes, elem, cur, clazz, j, finalValue, 9301 proceed = typeof value === "string" && value, 9302 i = 0, 9303 len = this.length; 9304 9305 if ( jQuery.isFunction( value ) ) { 9306 return this.each(function( j ) { 9307 jQuery( this ).addClass( value.call( this, j, this.className ) ); 9308 }); 9309 } 9310 9311 if ( proceed ) { 9312 // The disjunction here is for better compressibility (see removeClass) 9313 classes = ( value || "" ).match( rnotwhite ) || []; 9314 9315 for ( ; i < len; i++ ) { 9316 elem = this[ i ]; 9317 cur = elem.nodeType === 1 && ( elem.className ? 9318 ( " " + elem.className + " " ).replace( rclass, " " ) : 9319 " " 9320 ); 9321 9322 if ( cur ) { 9323 j = 0; 9324 while ( (clazz = classes[j++]) ) { 9325 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 9326 cur += clazz + " "; 9327 } 9328 } 9329 9330 // only assign if different to avoid unneeded rendering. 9331 finalValue = jQuery.trim( cur ); 9332 if ( elem.className !== finalValue ) { 9333 elem.className = finalValue; 9334 } 9335 } 9336 } 9337 } 9338 9339 return this; 9340 }, 9341 9342 removeClass: function( value ) { 9343 var classes, elem, cur, clazz, j, finalValue, 9344 proceed = arguments.length === 0 || typeof value === "string" && value, 9345 i = 0, 9346 len = this.length; 9347 9348 if ( jQuery.isFunction( value ) ) { 9349 return this.each(function( j ) { 9350 jQuery( this ).removeClass( value.call( this, j, this.className ) ); 9351 }); 9352 } 9353 if ( proceed ) { 9354 classes = ( value || "" ).match( rnotwhite ) || []; 9355 9356 for ( ; i < len; i++ ) { 9357 elem = this[ i ]; 9358 // This expression is here for better compressibility (see addClass) 9359 cur = elem.nodeType === 1 && ( elem.className ? 9360 ( " " + elem.className + " " ).replace( rclass, " " ) : 9361 "" 9362 ); 9363 9364 if ( cur ) { 9365 j = 0; 9366 while ( (clazz = classes[j++]) ) {
9367 // Remove *all* instances 9368 while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { 9369 cur = cur.replace( " " + clazz + " ", " " ); 9370 } 9371 } 9372 9373 // Only assign if different to avoid unneeded rendering. 9374 finalValue = value ? jQuery.trim( cur ) : ""; 9375 if ( elem.className !== finalValue ) { 9376 elem.className = finalValue; 9377 } 9378 } 9379 } 9380 } 9381 9382 return this; 9383 }, 9384 9385 toggleClass: function( value, stateVal ) { 9386 var type = typeof value; 9387 9388 if ( typeof stateVal === "boolean" && type === "string" ) { 9389 return stateVal ? this.addClass( value ) : this.removeClass( value ); 9390 } 9391 9392 if ( jQuery.isFunction( value ) ) { 9393 return this.each(function( i ) { 9394 jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); 9395 }); 9396 } 9397 9398 return this.each(function() { 9399 if ( type === "string" ) { 9400 // Toggle individual class names 9401 var className, 9402 i = 0, 9403 self = jQuery( this ), 9404 classNames = value.match( rnotwhite ) || []; 9405 9406 while ( (className = classNames[ i++ ]) ) { 9407 // Check each className given, space separated list 9408 if ( self.hasClass( className ) ) { 9409 self.removeClass( className ); 9410 } else { 9411 self.addClass( className ); 9412 } 9413 } 9414 9415 // Toggle whole class name 9416 } else if ( type === strundefined || type === "boolean" ) { 9417 if ( this.className ) { 9418 // store className if set 9419 data_priv.set( this, "__className__", this.className ); 9420 } 9421 9422 // If the element has a class name or if we're passed `false`, 9423 // then remove the whole classname (if there was one, the above saved it). 9424 // Otherwise bring back whatever was previously saved (if anything), 9425 // falling back to the empty string if nothing was stored. 9426 this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || ""; 9427 } 9428 }); 9429 }, 9430 9431 hasClass: function( selector ) { 9432 var className = " " + selector + " ", 9433 i = 0, 9434 l = this.length; 9435 for ( ; i < l; i++ ) { 9436 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { 9437 return true; 9438 } 9439 } 9440 9441 return false; 9442 } 9443}); 9444 9445 9446 9447 9448var rreturn = /\r/g; 9449 9450jQuery.fn.extend({ 9451 val: function( value ) { 9452 var hooks, ret, isFunction, 9453 elem = this[0]; 9454 9455 if ( !arguments.length ) { 9456 if ( elem ) { 9457 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 9458 9459 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { 9460 return ret; 9461 } 9462 9463 ret = elem.value; 9464 9465 return typeof ret === "string" ? 9466 // Handle most common string cases 9467 ret.replace(rreturn, "") : 9468 // Handle cases where value is null/undef or number 9469 ret == null ? "" : ret; 9470 } 9471 9472 return; 9473 } 9474 9475 isFunction = jQuery.isFunction( value ); 9476 9477 return this.each(function( i ) { 9478 var val; 9479 9480 if ( this.nodeType !== 1 ) { 9481 return; 9482 } 9483 9484 if ( isFunction ) { 9485 val = value.call( this, i, jQuery( this ).val() ); 9486 } else { 9487 val = value; 9488 } 9489 9490 // Treat null/undefined as ""; convert numbers to string 9491 if ( val == null ) { 9492 val = ""; 9493 9494 } else if ( typeof val === "number" ) { 9495 val += ""; 9496 9497 } else if ( jQuery.isArray( val ) ) { 9498 val = jQuery.map( val, function( value ) { 9499 return value == null ? "" : value + ""; 9500 }); 9501 } 9502 9503 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 9504 9505 // If set returns undefined, fall back to normal setting 9506 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { 9507 this.value = val; 9508 } 9509 }); 9510 } 9511}); 9512 9513jQuery.extend({ 9514 valHooks: { 9515 option: { 9516 get: function( elem ) { 9517 var val = jQuery.find.attr( elem, "value" ); 9518 return val != null ? 9519 val : 9520 // Support: IE10-11+ 9521 // option.text throws exceptions (#14686, #14858) 9522 jQuery.trim( jQuery.text( elem ) ); 9523 } 9524 }, 9525 select: { 9526 get: function( elem ) { 9527 var value, option, 9528 options = elem.options, 9529 index = elem.selectedIndex, 9530 one = elem.type === "select-one" || index < 0, 9531 values = one ? null : [], 9532 max = one ? index + 1 : options.length, 9533 i = index < 0 ? 9534 max : 9535 one ? index : 0; 9536 9537 // Loop through all the selected options 9538 for ( ; i < max; i++ ) { 9539 option = options[ i ]; 9540 9541 // IE6-9 doesn't update selected after form reset (#2551) 9542 if ( ( option.selected || i === index ) && 9543 // Don't return options that are disabled or in a disabled optgroup 9544 ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) && 9545 ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { 9546 9547 // Get the specific value for the option 9548 value = jQuery( option ).val(); 9549 9550 // We don't need an array for one selects 9551 if ( one ) { 9552 return value; 9553 } 9554 9555 // Multi-Selects return an array 9556 values.push( value ); 9557 } 9558 } 9559 9560 return values; 9561 }, 9562 9563 set: function( elem, value ) { 9564 var optionSet, option, 9565 options = elem.options, 9566 values = jQuery.makeArray( value ), 9567 i = options.length; 9568 9569 while ( i-- ) { 9570 option = options[ i ]; 9571 if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) { 9572 optionSet = true; 9573 } 9574 } 9575 9576 // Force browsers to behave consistently when non-matching value is set 9577 if ( !optionSet ) { 9578 elem.selectedIndex = -1; 9579 } 9580 return values; 9581 } 9582 } 9583 } 9584}); 9585 9586// Radios and checkboxes getter/setter 9587jQuery.each([ "radio", "checkbox" ], function() { 9588 jQuery.valHooks[ this ] = { 9589 set: function( elem, value ) { 9590 if ( jQuery.isArray( value ) ) { 9591 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); 9592 } 9593 } 9594 }; 9595 if ( !support.checkOn ) { 9596 jQuery.valHooks[ this ].get = function( elem ) { 9597 return elem.getAttribute("value") === null ? "on" : elem.value; 9598 }; 9599 } 9600}); 9601 9602 9603 9604 9605// Return jQuery for attributes-only inclusion 9606 9607 9608jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + 9609 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 9610 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { 9611 9612 // Handle event binding 9613 jQuery.fn[ name ] = function( data, fn ) { 9614 return arguments.length > 0 ? 9615 this.on( name, null, data, fn ) : 9616 this.trigger( name ); 9617 }; 9618}); 9619 9620jQuery.fn.extend({ 9621 hover: function( fnOver, fnOut ) { 9622 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 9623 }, 9624 9625 bind: function( types, data, fn ) { 9626 return this.on( types, null, data, fn ); 9627 }, 9628 unbind: function( types, fn ) { 9629 return this.off( types, null, fn ); 9630 }, 9631 9632 delegate: function( selector, types, data, fn ) { 9633 return this.on( types, selector, data, fn ); 9634 }, 9635 undelegate: function( selector, types, fn ) { 9636 // ( namespace ) or ( selector, types [, fn] ) 9637 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); 9638 } 9639}); 9640 9641 9642var nonce = jQuery.now(); 9643 9644var rquery = (/\?/); 9645 9646 9647 9648// Support: Android 2.3 9649// Workaround failure to string-cast null input 9650jQuery.parseJSON = function( data ) { 9651 return JSON.parse( data + "" ); 9652}; 9653 9654 9655// Cross-browser xml parsing
vendor: 4,742 bytes, lines 9656-9821
9656jQuery.parseXML = function( data ) { 9657 var xml, tmp; 9658 if ( !data || typeof data !== "string" ) { 9659 return null; 9660 } 9661 9662 // Support: IE9 9663 try { 9664 tmp = new DOMParser(); 9665 xml = tmp.parseFromString( data, "text/xml" ); 9666 } catch ( e ) { 9667 xml = undefined; 9668 } 9669 9670 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { 9671 jQuery.error( "Invalid XML: " + data ); 9672 } 9673 return xml; 9674}; 9675 9676 9677var 9678 rhash = /#.*$/, 9679 rts = /([?&])_=[^&]*/, 9680 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 9681 // #7653, #8125, #8152: local protocol detection 9682 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 9683 rnoContent = /^(?:GET|HEAD)$/, 9684 rprotocol = /^\/\//, 9685 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/, 9686 9687 /* Prefilters 9688 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 9689 * 2) These are called: 9690 * - BEFORE asking for a transport 9691 * - AFTER param serialization (s.data is a string if s.processData is true) 9692 * 3) key is the dataType 9693 * 4) the catchall symbol "*" can be used 9694 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 9695 */ 9696 prefilters = {}, 9697 9698 /* Transports bindings 9699 * 1) key is the dataType 9700 * 2) the catchall symbol "*" can be used 9701 * 3) selection will start with transport dataType and THEN go to "*" if needed 9702 */ 9703 transports = {}, 9704 9705 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 9706 allTypes = "*/".concat( "*" ), 9707 9708 // Document location 9709 ajaxLocation = window.location.href, 9710 9711 // Segment location into parts 9712 ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; 9713 9714// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 9715function addToPrefiltersOrTransports( structure ) { 9716 9717 // dataTypeExpression is optional and defaults to "*" 9718 return function( dataTypeExpression, func ) { 9719 9720 if ( typeof dataTypeExpression !== "string" ) { 9721 func = dataTypeExpression; 9722 dataTypeExpression = "*"; 9723 } 9724 9725 var dataType, 9726 i = 0, 9727 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; 9728 9729 if ( jQuery.isFunction( func ) ) { 9730 // For each dataType in the dataTypeExpression 9731 while ( (dataType = dataTypes[i++]) ) { 9732 // Prepend if requested 9733 if ( dataType[0] === "+" ) { 9734 dataType = dataType.slice( 1 ) || "*"; 9735 (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); 9736 9737 // Otherwise append 9738 } else { 9739 (structure[ dataType ] = structure[ dataType ] || []).push( func ); 9740 } 9741 } 9742 } 9743 }; 9744} 9745 9746// Base inspection function for prefilters and transports 9747function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 9748 9749 var inspected = {}, 9750 seekingTransport = ( structure === transports ); 9751 9752 function inspect( dataType ) { 9753 var selected; 9754 inspected[ dataType ] = true; 9755 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 9756 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 9757 if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 9758 options.dataTypes.unshift( dataTypeOrTransport ); 9759 inspect( dataTypeOrTransport ); 9760 return false; 9761 } else if ( seekingTransport ) { 9762 return !( selected = dataTypeOrTransport ); 9763 } 9764 }); 9765 return selected; 9766 } 9767 9768 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 9769} 9770 9771// A special extend for ajax options 9772// that takes "flat" options (not to be deep extended) 9773// Fixes #9887 9774function ajaxExtend( target, src ) { 9775 var key, deep, 9776 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 9777 9778 for ( key in src ) { 9779 if ( src[ key ] !== undefined ) { 9780 ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; 9781 } 9782 } 9783 if ( deep ) { 9784 jQuery.extend( true, target, deep ); 9785 } 9786 9787 return target; 9788} 9789 9790/* Handles responses to an ajax request: 9791 * - finds the right dataType (mediates between content-type and expected dataType) 9792 * - returns the corresponding response 9793 */ 9794function ajaxHandleResponses( s, jqXHR, responses ) { 9795 9796 var ct, type, finalDataType, firstDataType, 9797 contents = s.contents, 9798 dataTypes = s.dataTypes; 9799 9800 // Remove auto dataType and get content-type in the process 9801 while ( dataTypes[ 0 ] === "*" ) { 9802 dataTypes.shift(); 9803 if ( ct === undefined ) { 9804 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); 9805 } 9806 } 9807 9808 // Check if we're dealing with a known content-type 9809 if ( ct ) { 9810 for ( type in contents ) { 9811 if ( contents[ type ] && contents[ type ].test( ct ) ) { 9812 dataTypes.unshift( type ); 9813 break; 9814 } 9815 } 9816 } 9817 9818 // Check to see if we have a response for the expected dataType 9819 if ( dataTypes[ 0 ] in responses ) { 9820 finalDataType = dataTypes[ 0 ]; 9821 } else {
9822 // Try convertible dataTypes 9823 for ( type in responses ) { 9824 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { 9825 finalDataType = type; 9826 break; 9827 } 9828 if ( !firstDataType ) { 9829 firstDataType = type; 9830 } 9831 } 9832 // Or just use first one 9833 finalDataType = finalDataType || firstDataType; 9834 } 9835 9836 // If we found a dataType 9837 // We add the dataType to the list if needed 9838 // and return the corresponding response 9839 if ( finalDataType ) { 9840 if ( finalDataType !== dataTypes[ 0 ] ) { 9841 dataTypes.unshift( finalDataType ); 9842 } 9843 return responses[ finalDataType ]; 9844 } 9845} 9846 9847/* Chain conversions given the request and the original response 9848 * Also sets the responseXXX fields on the jqXHR instance 9849 */ 9850function ajaxConvert( s, response, jqXHR, isSuccess ) { 9851 var conv2, current, conv, tmp, prev, 9852 converters = {}, 9853 // Work with a copy of dataTypes in case we need to modify it for conversion 9854 dataTypes = s.dataTypes.slice(); 9855 9856 // Create converters map with lowercased keys 9857 if ( dataTypes[ 1 ] ) { 9858 for ( conv in s.converters ) { 9859 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 9860 } 9861 } 9862 9863 current = dataTypes.shift(); 9864 9865 // Convert to each sequential dataType 9866 while ( current ) { 9867 9868 if ( s.responseFields[ current ] ) { 9869 jqXHR[ s.responseFields[ current ] ] = response; 9870 } 9871 9872 // Apply the dataFilter if provided 9873 if ( !prev && isSuccess && s.dataFilter ) { 9874 response = s.dataFilter( response, s.dataType ); 9875 } 9876 9877 prev = current; 9878 current = dataTypes.shift(); 9879 9880 if ( current ) { 9881 9882 // There's only work to do if current dataType is non-auto 9883 if ( current === "*" ) { 9884 9885 current = prev; 9886 9887 // Convert response if prev dataType is non-auto and differs from current 9888 } else if ( prev !== "*" && prev !== current ) { 9889 9890 // Seek a direct converter 9891 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 9892 9893 // If none found, seek a pair 9894 if ( !conv ) { 9895 for ( conv2 in converters ) { 9896 9897 // If conv2 outputs current 9898 tmp = conv2.split( " " ); 9899 if ( tmp[ 1 ] === current ) { 9900 9901 // If prev can be converted to accepted input 9902 conv = converters[ prev + " " + tmp[ 0 ] ] || 9903 converters[ "* " + tmp[ 0 ] ]; 9904 if ( conv ) { 9905 // Condense equivalence converters 9906 if ( conv === true ) { 9907 conv = converters[ conv2 ]; 9908 9909 // Otherwise, insert the intermediate dataType 9910 } else if ( converters[ conv2 ] !== true ) { 9911 current = tmp[ 0 ]; 9912 dataTypes.unshift( tmp[ 1 ] ); 9913 } 9914 break; 9915 } 9916 } 9917 } 9918 } 9919 9920 // Apply converter (if not an equivalence) 9921 if ( conv !== true ) { 9922 9923 // Unless errors are allowed to bubble, catch and return them 9924 if ( conv && s[ "throws" ] ) { 9925 response = conv( response ); 9926 } else { 9927 try { 9928 response = conv( response ); 9929 } catch ( e ) { 9930 return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; 9931 } 9932 } 9933 } 9934 } 9935 } 9936 } 9937 9938 return { state: "success", data: response }; 9939} 9940 9941jQuery.extend({ 9942 9943 // Counter for holding the number of active queries 9944 active: 0, 9945 9946 // Last-Modified header cache for next request 9947 lastModified: {}, 9948 etag: {}, 9949 9950 ajaxSettings: { 9951 url: ajaxLocation, 9952 type: "GET", 9953 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), 9954 global: true, 9955 processData: true, 9956 async: true, 9957 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9958 /* 9959 timeout: 0, 9960 data: null, 9961 dataType: null, 9962 username: null, 9963 password: null, 9964 cache: null, 9965 throws: false, 9966 traditional: false, 9967 headers: {}, 9968 */ 9969 9970 accepts: { 9971 "*": allTypes, 9972 text: "text/plain", 9973 html: "text/html", 9974 xml: "application/xml, text/xml", 9975 json: "application/json, text/javascript" 9976 }, 9977 9978 contents: { 9979 xml: /xml/, 9980 html: /html/, 9981 json: /json/ 9982 }, 9983 9984 responseFields: { 9985 xml: "responseXML", 9986 text: "responseText", 9987 json: "responseJSON" 9988 }, 9989 9990 // Data converters 9991 // Keys separate source (or catchall "*") and destination types with a single space 9992 converters: { 9993 9994 // Convert anything to text 9995 "* text": String, 9996 9997 // Text to html (true = no transformation) 9998 "text html": true, 9999 10000 // Evaluate text as a json expression 10001 "text json": jQuery.parseJSON, 10002 10003 // Parse text as xml 10004 "text xml": jQuery.parseXML 10005 }, 10006 10007 // For options that shouldn't be deep extended: 10008 // you can add your own custom options here if 10009 // and when you create one that shouldn't be 10010 // deep extended (see ajaxExtend) 10011 flatOptions: { 10012 url: true, 10013 context: true 10014 } 10015 }, 10016 10017 // Creates a full fledged settings object into target 10018 // with both ajaxSettings and settings fields. 10019 // If target is omitted, writes into ajaxSettings. 10020 ajaxSetup: function( target, settings ) { 10021 return settings ? 10022 10023 // Building a settings object 10024 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 10025 10026 // Extending ajaxSettings 10027 ajaxExtend( jQuery.ajaxSettings, target ); 10028 }, 10029 10030 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 10031 ajaxTransport: addToPrefiltersOrTransports( transports ), 10032 10033 // Main method 10034 ajax: function( url, options ) { 10035 10036 // If url is an object, simulate pre-1.5 signature 10037 if ( typeof url === "object" ) { 10038 options = url; 10039 url = undefined; 10040 } 10041 10042 // Force options to be an object 10043 options = options || {}; 10044 10045 var transport, 10046 // URL without anti-cache param 10047 cacheURL, 10048 // Response headers 10049 responseHeadersString, 10050 responseHeaders, 10051 // timeout handle 10052 timeoutTimer, 10053 // Cross-domain detection vars 10054 parts, 10055 // To know if global events are to be dispatched 10056 fireGlobals, 10057 // Loop variable 10058 i, 10059 // Create the final options object 10060 s = jQuery.ajaxSetup( {}, options ), 10061 // Callbacks context 10062 callbackContext = s.context || s, 10063 // Context for global events is callbackContext if it is a DOM node or jQuery collection 10064 globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? 10065 jQuery( callbackContext ) : 10066 jQuery.event, 10067 // Deferreds 10068 deferred = jQuery.Deferred(), 10069 completeDeferred = jQuery.Callbacks("once memory"), 10070 // Status-dependent callbacks 10071 statusCode = s.statusCode || {}, 10072 // Headers (they are sent all at once) 10073 requestHeaders = {}, 10074 requestHeadersNames = {}, 10075 // The jqXHR state 10076 state = 0, 10077 // Default abort message 10078 strAbort = "canceled", 10079 // Fake xhr 10080 jqXHR = { 10081 readyState: 0, 10082 10083 // Builds headers hashtable if needed 10084 getResponseHeader: function( key ) { 10085 var match; 10086 if ( state === 2 ) { 10087 if ( !responseHeaders ) { 10088 responseHeaders = {}; 10089 while ( (match = rheaders.exec( responseHeadersString )) ) { 10090 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; 10091 } 10092 } 10093 match = responseHeaders[ key.toLowerCase() ]; 10094 } 10095 return match == null ? null : match; 10096 }, 10097 10098 // Raw string 10099 getAllResponseHeaders: function() { 10100 return state === 2 ? responseHeadersString : null; 10101 }, 10102 10103 // Caches the header 10104 setRequestHeader: function( name, value ) { 10105 var lname = name.toLowerCase(); 10106 if ( !state ) { 10107 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; 10108 requestHeaders[ name ] = value; 10109 } 10110 return this; 10111 }, 10112 10113 // Overrides response content-type header 10114 overrideMimeType: function( type ) { 10115 if ( !state ) { 10116 s.mimeType = type; 10117 } 10118 return this; 10119 }, 10120 10121 // Status-dependent callbacks 10122 statusCode: function( map ) { 10123 var code; 10124 if ( map ) { 10125 if ( state < 2 ) { 10126 for ( code in map ) { 10127 // Lazy-add the new callback in a way that preserves old ones 10128 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 10129 } 10130 } else { 10131 // Execute the appropriate callbacks 10132 jqXHR.always( map[ jqXHR.status ] ); 10133 } 10134 } 10135 return this; 10136 }, 10137 10138 // Cancel the request 10139 abort: function( statusText ) { 10140 var finalText = statusText || strAbort; 10141 if ( transport ) { 10142 transport.abort( finalText ); 10143 } 10144 done( 0, finalText ); 10145 return this; 10146 } 10147 }; 10148 10149 // Attach deferreds 10150 deferred.promise( jqXHR ).complete = completeDeferred.add; 10151 jqXHR.success = jqXHR.done; 10152 jqXHR.error = jqXHR.fail; 10153 10154 // Remove hash character (#7531: and string promotion) 10155 // Add protocol if not provided (prefilters might expect it) 10156 // Handle falsy url in the settings object (#10093: consistency with old signature) 10157 // We also use the url parameter if available 10158 s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ) 10159 .replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); 10160 10161 // Alias method option to type as per ticket #12004 10162 s.type = options.method || options.type || s.method || s.type; 10163 10164 // Extract dataTypes list 10165 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; 10166 10167 // A cross-domain request is in order when we have a protocol:host:port mismatch 10168 if ( s.crossDomain == null ) { 10169 parts = rurl.exec( s.url.toLowerCase() ); 10170 s.crossDomain = !!( parts && 10171 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || 10172 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !== 10173 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) ) 10174 ); 10175 } 10176 10177 // Convert data if not already a string 10178 if ( s.data && s.processData && typeof s.data !== "string" ) { 10179 s.data = jQuery.param( s.data, s.traditional ); 10180 } 10181 10182 // Apply prefilters 10183 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 10184 10185 // If request was aborted inside a prefilter, stop there 10186 if ( state === 2 ) { 10187 return jqXHR; 10188 } 10189 10190 // We can fire global events as of now if asked to 10191 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 10192 fireGlobals = jQuery.event && s.global; 10193 10194 // Watch for a new set of requests 10195 if ( fireGlobals && jQuery.active++ === 0 ) { 10196 jQuery.event.trigger("ajaxStart"); 10197 } 10198 10199 // Uppercase the type 10200 s.type = s.type.toUpperCase(); 10201 10202 // Determine if request has content 10203 s.hasContent = !rnoContent.test( s.type ); 10204 10205 // Save the URL in case we're toying with the If-Modified-Since 10206 // and/or If-None-Match header later on 10207 cacheURL = s.url; 10208 10209 // More options handling for requests with no content 10210 if ( !s.hasContent ) { 10211 10212 // If data is available, append data to url 10213 if ( s.data ) {
10214 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); 10215 // #9682: remove data so that it's not used in an eventual retry 10216 delete s.data; 10217 } 10218 10219 // Add anti-cache in url if needed 10220 if ( s.cache === false ) { 10221 s.url = rts.test( cacheURL ) ? 10222 10223 // If there is already a '_' parameter, set its value 10224 cacheURL.replace( rts, "$1_=" + nonce++ ) : 10225 10226 // Otherwise add one to the end 10227 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++; 10228 } 10229 } 10230 10231 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 10232 if ( s.ifModified ) { 10233 if ( jQuery.lastModified[ cacheURL ] ) { 10234 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 10235 } 10236 if ( jQuery.etag[ cacheURL ] ) { 10237 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 10238 } 10239 } 10240 10241 // Set the correct header, if data is being sent 10242 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 10243 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 10244 } 10245 10246 // Set the Accepts header for the server, depending on the dataType 10247 jqXHR.setRequestHeader( 10248 "Accept", 10249 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? 10250 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 10251 s.accepts[ "*" ] 10252 ); 10253 10254 // Check for headers option 10255 for ( i in s.headers ) { 10256 jqXHR.setRequestHeader( i, s.headers[ i ] ); 10257 } 10258 10259 // Allow custom headers/mimetypes and early abort 10260 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { 10261 // Abort if not done already and return 10262 return jqXHR.abort(); 10263 } 10264 10265 // Aborting is no longer a cancellation 10266 strAbort = "abort"; 10267 10268 // Install callbacks on deferreds 10269 for ( i in { success: 1, error: 1, complete: 1 } ) { 10270 jqXHR[ i ]( s[ i ] ); 10271 } 10272 10273 // Get transport 10274 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 10275 10276 // If no transport, we auto-abort 10277 if ( !transport ) { 10278 done( -1, "No Transport" ); 10279 } else { 10280 jqXHR.readyState = 1; 10281 10282 // Send global event 10283 if ( fireGlobals ) { 10284 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 10285 } 10286 // Timeout 10287 if ( s.async && s.timeout > 0 ) { 10288 timeoutTimer = setTimeout(function() { 10289 jqXHR.abort("timeout"); 10290 }, s.timeout ); 10291 } 10292 10293 try { 10294 state = 1; 10295 transport.send( requestHeaders, done ); 10296 } catch ( e ) { 10297 // Propagate exception as error if not done 10298 if ( state < 2 ) { 10299 done( -1, e ); 10300 // Simply rethrow otherwise 10301 } else { 10302 throw e; 10303 } 10304 } 10305 } 10306 10307 // Callback for when everything is done 10308 function done( status, nativeStatusText, responses, headers ) { 10309 var isSuccess, success, error, response, modified, 10310 statusText = nativeStatusText; 10311 10312 // Called once 10313 if ( state === 2 ) { 10314 return; 10315 } 10316 10317 // State is "done" now 10318 state = 2; 10319 10320 // Clear timeout if it exists 10321 if ( timeoutTimer ) { 10322 clearTimeout( timeoutTimer ); 10323 } 10324 10325 // Dereference transport for early garbage collection 10326 // (no matter how long the jqXHR object will be used) 10327 transport = undefined; 10328 10329 // Cache response headers 10330 responseHeadersString = headers || ""; 10331 10332 // Set readyState 10333 jqXHR.readyState = status > 0 ? 4 : 0; 10334 10335 // Determine if successful 10336 isSuccess = status >= 200 && status < 300 || status === 304; 10337 10338 // Get response data 10339 if ( responses ) { 10340 response = ajaxHandleResponses( s, jqXHR, responses ); 10341 } 10342 10343 // Convert no matter what (that way responseXXX fields are always set) 10344 response = ajaxConvert( s, response, jqXHR, isSuccess ); 10345 10346 // If successful, handle type chaining 10347 if ( isSuccess ) { 10348 10349 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 10350 if ( s.ifModified ) { 10351 modified = jqXHR.getResponseHeader("Last-Modified"); 10352 if ( modified ) { 10353 jQuery.lastModified[ cacheURL ] = modified; 10354 } 10355 modified = jqXHR.getResponseHeader("etag"); 10356 if ( modified ) { 10357 jQuery.etag[ cacheURL ] = modified; 10358 } 10359 } 10360 10361 // if no content 10362 if ( status === 204 || s.type === "HEAD" ) { 10363 statusText = "nocontent"; 10364 10365 // if not modified 10366 } else if ( status === 304 ) { 10367 statusText = "notmodified"; 10368 10369 // If we have data, let's convert it 10370 } else { 10371 statusText = response.state; 10372 success = response.data; 10373 error = response.error; 10374 isSuccess = !error; 10375 } 10376 } else { 10377 // Extract error from statusText and normalize for non-aborts 10378 error = statusText; 10379 if ( status || !statusText ) { 10380 statusText = "error"; 10381 if ( status < 0 ) { 10382 status = 0; 10383 } 10384 } 10385 } 10386 10387 // Set data for the fake xhr object 10388 jqXHR.status = status; 10389 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 10390 10391 // Success/Error 10392 if ( isSuccess ) { 10393 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 10394 } else { 10395 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 10396 } 10397 10398 // Status-dependent callbacks 10399 jqXHR.statusCode( statusCode ); 10400 statusCode = undefined; 10401 10402 if ( fireGlobals ) { 10403 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 10404 [ jqXHR, s, isSuccess ? success : error ] ); 10405 } 10406 10407 // Complete 10408 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 10409 10410 if ( fireGlobals ) { 10411 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 10412 // Handle the global AJAX counter 10413 if ( !( --jQuery.active ) ) { 10414 jQuery.event.trigger("ajaxStop"); 10415 } 10416 } 10417 } 10418 10419 return jqXHR; 10420 }, 10421 10422 getJSON: function( url, data, callback ) { 10423 return jQuery.get( url, data, callback, "json" ); 10424 }, 10425 10426 getScript: function( url, callback ) { 10427 return jQuery.get( url, undefined, callback, "script" ); 10428 } 10429}); 10430 10431jQuery.each( [ "get", "post" ], function( i, method ) { 10432 jQuery[ method ] = function( url, data, callback, type ) { 10433 // Shift arguments if data argument was omitted 10434 if ( jQuery.isFunction( data ) ) { 10435 type = type || callback; 10436 callback = data; 10437 data = undefined; 10438 } 10439 10440 return jQuery.ajax({ 10441 url: url, 10442 type: method, 10443 dataType: type, 10444 data: data, 10445 success: callback 10446 }); 10447 }; 10448}); 10449 10450 10451jQuery._evalUrl = function( url ) { 10452 return jQuery.ajax({ 10453 url: url, 10454 type: "GET", 10455 dataType: "script", 10456 async: false, 10457 global: false, 10458 "throws": true 10459 }); 10460}; 10461 10462 10463jQuery.fn.extend({ 10464 wrapAll: function( html ) { 10465 var wrap; 10466 10467 if ( jQuery.isFunction( html ) ) { 10468 return this.each(function( i ) { 10469 jQuery( this ).wrapAll( html.call(this, i) ); 10470 }); 10471 } 10472 10473 if ( this[ 0 ] ) { 10474 10475 // The elements to wrap the target around 10476 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 10477 10478 if ( this[ 0 ].parentNode ) { 10479 wrap.insertBefore( this[ 0 ] ); 10480 } 10481 10482 wrap.map(function() { 10483 var elem = this; 10484 10485 while ( elem.firstElementChild ) { 10486 elem = elem.firstElementChild; 10487 } 10488 10489 return elem; 10490 }).append( this ); 10491 } 10492 10493 return this; 10494 }, 10495 10496 wrapInner: function( html ) { 10497 if ( jQuery.isFunction( html ) ) { 10498 return this.each(function( i ) { 10499 jQuery( this ).wrapInner( html.call(this, i) ); 10500 }); 10501 } 10502 10503 return this.each(function() { 10504 var self = jQuery( this ), 10505 contents = self.contents(); 10506 10507 if ( contents.length ) { 10508 contents.wrapAll( html ); 10509 10510 } else { 10511 self.append( html ); 10512 } 10513 }); 10514 }, 10515 10516 wrap: function( html ) { 10517 var isFunction = jQuery.isFunction( html ); 10518 10519 return this.each(function( i ) { 10520 jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); 10521 }); 10522 }, 10523 10524 unwrap: function() { 10525 return this.parent().each(function() { 10526 if ( !jQuery.nodeName( this, "body" ) ) { 10527 jQuery( this ).replaceWith( this.childNodes ); 10528 } 10529 }).end(); 10530 } 10531}); 10532 10533 10534jQuery.expr.filters.hidden = function( elem ) { 10535 // Support: Opera <= 12.12 10536 // Opera reports offsetWidths and offsetHeights less than zero on some elements 10537 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0; 10538}; 10539jQuery.expr.filters.visible = function( elem ) { 10540 return !jQuery.expr.filters.hidden( elem ); 10541}; 10542 10543 10544 10545 10546var r20 = /%20/g, 10547 rbracket = /\[\]$/, 10548 rCRLF = /\r?\n/g, 10549 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 10550 rsubmittable = /^(?:input|select|textarea|keygen)/i; 10551 10552function buildParams( prefix, obj, traditional, add ) { 10553 var name; 10554 10555 if ( jQuery.isArray( obj ) ) { 10556 // Serialize array item. 10557 jQuery.each( obj, function( i, v ) { 10558 if ( traditional || rbracket.test( prefix ) ) { 10559 // Treat each array item as a scalar. 10560 add( prefix, v ); 10561 10562 } else { 10563 // Item is non-scalar (array or object), encode its numeric index. 10564 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); 10565 } 10566 }); 10567 10568 } else if ( !traditional && jQuery.type( obj ) === "object" ) { 10569 // Serialize object item. 10570 for ( name in obj ) { 10571 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 10572 } 10573 10574 } else { 10575 // Serialize scalar item. 10576 add( prefix, obj ); 10577 } 10578} 10579 10580// Serialize an array of form elements or a set of 10581// key/values into a query string 10582jQuery.param = function( a, traditional ) { 10583 var prefix, 10584 s = [], 10585 add = function( key, value ) { 10586 // If value is a function, invoke it and return its value
10587 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); 10588 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); 10589 }; 10590 10591 // Set traditional to true for jQuery <= 1.3.2 behavior. 10592 if ( traditional === undefined ) { 10593 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; 10594 } 10595 10596 // If an array was passed in, assume that it is an array of form elements. 10597 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 10598 // Serialize the form elements 10599 jQuery.each( a, function() { 10600 add( this.name, this.value ); 10601 }); 10602 10603 } else { 10604 // If traditional, encode the "old" way (the way 1.3.2 or older 10605 // did it), otherwise encode params recursively. 10606 for ( prefix in a ) { 10607 buildParams( prefix, a[ prefix ], traditional, add ); 10608 } 10609 } 10610 10611 // Return the resulting serialization 10612 return s.join( "&" ).replace( r20, "+" ); 10613}; 10614 10615jQuery.fn.extend({ 10616 serialize: function() { 10617 return jQuery.param( this.serializeArray() ); 10618 }, 10619 serializeArray: function() { 10620 return this.map(function() { 10621 // Can add propHook for "elements" to filter or add form elements 10622 var elements = jQuery.prop( this, "elements" ); 10623 return elements ? jQuery.makeArray( elements ) : this; 10624 }) 10625 .filter(function() { 10626 var type = this.type; 10627 10628 // Use .is( ":disabled" ) so that fieldset[disabled] works 10629 return this.name && !jQuery( this ).is( ":disabled" ) && 10630 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 10631 ( this.checked || !rcheckableType.test( type ) ); 10632 }) 10633 .map(function( i, elem ) { 10634 var val = jQuery( this ).val(); 10635 10636 return val == null ? 10637 null : 10638 jQuery.isArray( val ) ? 10639 jQuery.map( val, function( val ) { 10640 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 10641 }) : 10642 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 10643 }).get(); 10644 } 10645}); 10646 10647 10648jQuery.ajaxSettings.xhr = function() { 10649 try { 10650 return new XMLHttpRequest(); 10651 } catch( e ) {} 10652}; 10653 10654var xhrId = 0, 10655 xhrCallbacks = {}, 10656 xhrSuccessStatus = { 10657 // file protocol always yields status code 0, assume 200 10658 0: 200,
10659 // Support: IE9 10660 // #1450: sometimes IE returns 1223 when it should be 204 10661 1223: 204 10662 }, 10663 xhrSupported = jQuery.ajaxSettings.xhr(); 10664 10665// Support: IE9 10666// Open requests must be manually aborted on unload (#5280) 10667// See https://support.microsoft.com/kb/2856746 for more info 10668if ( window.attachEvent ) { 10669 window.attachEvent( "onunload", function() { 10670 for ( var key in xhrCallbacks ) { 10671 xhrCallbacks[ key ](); 10672 } 10673 }); 10674} 10675 10676support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 10677support.ajax = xhrSupported = !!xhrSupported; 10678 10679jQuery.ajaxTransport(function( options ) { 10680 var callback; 10681 10682 // Cross domain only allowed if supported through XMLHttpRequest 10683 if ( support.cors || xhrSupported && !options.crossDomain ) { 10684 return { 10685 send: function( headers, complete ) { 10686 var i, 10687 xhr = options.xhr(), 10688 id = ++xhrId; 10689 10690 xhr.open( options.type, options.url, options.async, options.username, options.password ); 10691 10692 // Apply custom fields if provided 10693 if ( options.xhrFields ) { 10694 for ( i in options.xhrFields ) { 10695 xhr[ i ] = options.xhrFields[ i ]; 10696 } 10697 } 10698 10699 // Override mime type if needed 10700 if ( options.mimeType && xhr.overrideMimeType ) { 10701 xhr.overrideMimeType( options.mimeType ); 10702 } 10703 10704 // X-Requested-With header 10705 // For cross-domain requests, seeing as conditions for a preflight are 10706 // akin to a jigsaw puzzle, we simply never set it to be sure. 10707 // (it can always be set on a per-request basis or even using ajaxSetup)
10708 // For same-domain requests, won't change header if already provided. 10709 if ( !options.crossDomain && !headers["X-Requested-With"] ) { 10710 headers["X-Requested-With"] = "XMLHttpRequest"; 10711 } 10712 10713 // Set headers 10714 for ( i in headers ) { 10715 xhr.setRequestHeader( i, headers[ i ] ); 10716 } 10717 10718 // Callback 10719 callback = function( type ) { 10720 return function() { 10721 if ( callback ) { 10722 delete xhrCallbacks[ id ]; 10723 callback = xhr.onload = xhr.onerror = null; 10724 10725 if ( type === "abort" ) { 10726 xhr.abort(); 10727 } else if ( type === "error" ) { 10728 complete( 10729 // file: protocol always yields status 0; see #8605, #14207 10730 xhr.status, 10731 xhr.statusText 10732 ); 10733 } else { 10734 complete( 10735 xhrSuccessStatus[ xhr.status ] || xhr.status, 10736 xhr.statusText, 10737 // Support: IE9 10738 // Accessing binary-data responseText throws an exception 10739 // (#11426) 10740 typeof xhr.responseText === "string" ? { 10741 text: xhr.responseText 10742 } : undefined, 10743 xhr.getAllResponseHeaders() 10744 ); 10745 } 10746 } 10747 }; 10748 }; 10749 10750 // Listen to events 10751 xhr.onload = callback(); 10752 xhr.onerror = callback("error"); 10753 10754 // Create the abort callback 10755 callback = xhrCallbacks[ id ] = callback("abort"); 10756 10757 try { 10758 // Do send the request (this may raise an exception) 10759 xhr.send( options.hasContent && options.data || null ); 10760 } catch ( e ) { 10761 // #14683: Only rethrow if this hasn't been notified as an error yet 10762 if ( callback ) { 10763 throw e; 10764 } 10765 } 10766 }, 10767 10768 abort: function() { 10769 if ( callback ) { 10770 callback(); 10771 } 10772 } 10773 }; 10774 } 10775}); 10776 10777 10778 10779 10780// Install script dataType 10781jQuery.ajaxSetup({ 10782 accepts: { 10783 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" 10784 }, 10785 contents: { 10786 script: /(?:java|ecma)script/ 10787 }, 10788 converters: { 10789 "text script": function( text ) { 10790 jQuery.globalEval( text ); 10791 return text; 10792 } 10793 } 10794}); 10795 10796// Handle cache's special case and crossDomain 10797jQuery.ajaxPrefilter( "script", function( s ) { 10798 if ( s.cache === undefined ) { 10799 s.cache = false; 10800 } 10801 if ( s.crossDomain ) { 10802 s.type = "GET"; 10803 } 10804}); 10805 10806// Bind script tag hack transport 10807jQuery.ajaxTransport( "script", function( s ) { 10808 // This transport only deals with cross domain requests 10809 if ( s.crossDomain ) { 10810 var script, callback; 10811 return { 10812 send: function( _, complete ) { 10813 script = jQuery("<script>").prop({ 10814 async: true, 10815 charset: s.scriptCharset, 10816 src: s.url 10817 }).on( 10818 "load error", 10819 callback = function( evt ) { 10820 script.remove(); 10821 callback = null; 10822 if ( evt ) { 10823 complete( evt.type === "error" ? 404 : 200, evt.type ); 10824 } 10825 } 10826 ); 10827 document.head.appendChild( script[ 0 ] ); 10828 }, 10829 abort: function() { 10830 if ( callback ) { 10831 callback(); 10832 } 10833 } 10834 }; 10835 } 10836}); 10837 10838 10839 10840 10841var oldCallbacks = [], 10842 rjsonp = /(=)\?(?=&|$)|\?\?/; 10843 10844// Default jsonp settings 10845jQuery.ajaxSetup({ 10846 jsonp: "callback", 10847 jsonpCallback: function() { 10848 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); 10849 this[ callback ] = true; 10850 return callback; 10851 } 10852}); 10853 10854// Detect, normalize options and install callbacks for jsonp requests 10855jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 10856 10857 var callbackName, overwritten, responseContainer, 10858 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 10859 "url" : 10860 typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" 10861 ); 10862 10863 // Handle iff the expected data type is "jsonp" or we have a parameter to set 10864 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 10865 10866 // Get callback name, remembering preexisting value associated with it 10867 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? 10868 s.jsonpCallback() : 10869 s.jsonpCallback; 10870 10871 // Insert callback into url or form data 10872 if ( jsonProp ) { 10873 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 10874 } else if ( s.jsonp !== false ) { 10875 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 10876 } 10877 10878 // Use data converter to retrieve json after script execution 10879 s.converters["script json"] = function() { 10880 if ( !responseContainer ) { 10881 jQuery.error( callbackName + " was not called" ); 10882 } 10883 return responseContainer[ 0 ]; 10884 }; 10885 10886 // force json dataType 10887 s.dataTypes[ 0 ] = "json"; 10888 10889 // Install callback 10890 overwritten = window[ callbackName ]; 10891 window[ callbackName ] = function() { 10892 responseContainer = arguments; 10893 }; 10894 10895 // Clean-up function (fires after converters) 10896 jqXHR.always(function() { 10897 // Restore preexisting value 10898 window[ callbackName ] = overwritten; 10899 10900 // Save back as free 10901 if ( s[ callbackName ] ) { 10902 // make sure that re-using the options doesn't screw things around 10903 s.jsonpCallback = originalSettings.jsonpCallback; 10904 10905 // save the callback name for future use 10906 oldCallbacks.push( callbackName ); 10907 } 10908 10909 // Call if it was a function and we have a response 10910 if ( responseContainer && jQuery.isFunction( overwritten ) ) { 10911 overwritten( responseContainer[ 0 ] ); 10912 } 10913 10914 responseContainer = overwritten = undefined; 10915 }); 10916 10917 // Delegate to script 10918 return "script"; 10919 } 10920}); 10921 10922 10923 10924 10925// data: string of html 10926// context (optional): If specified, the fragment will be created in this context, defaults to document 10927// keepScripts (optional): If true, will include scripts passed in the html string 10928jQuery.parseHTML = function( data, context, keepScripts ) { 10929 if ( !data || typeof data !== "string" ) { 10930 return null; 10931 } 10932 if ( typeof context === "boolean" ) { 10933 keepScripts = context; 10934 context = false;
10935 } 10936 context = context || document; 10937 10938 var parsed = rsingleTag.exec( data ), 10939 scripts = !keepScripts && []; 10940 10941 // Single tag 10942 if ( parsed ) { 10943 return [ context.createElement( parsed[1] ) ]; 10944 } 10945 10946 parsed = jQuery.buildFragment( [ data ], context, scripts ); 10947 10948 if ( scripts && scripts.length ) { 10949 jQuery( scripts ).remove(); 10950 } 10951 10952 return jQuery.merge( [], parsed.childNodes ); 10953}; 10954 10955 10956// Keep a copy of the old load method 10957var _load = jQuery.fn.load; 10958 10959/** 10960 * Load a url into a page 10961 */ 10962jQuery.fn.load = function( url, params, callback ) { 10963 if ( typeof url !== "string" && _load ) { 10964 return _load.apply( this, arguments ); 10965 } 10966 10967 var selector, type, response, 10968 self = this, 10969 off = url.indexOf(" "); 10970 10971 if ( off >= 0 ) { 10972 selector = jQuery.trim( url.slice( off ) ); 10973 url = url.slice( 0, off ); 10974 } 10975 10976 // If it's a function 10977 if ( jQuery.isFunction( params ) ) { 10978 10979 // We assume that it's the callback 10980 callback = params; 10981 params = undefined; 10982 10983 // Otherwise, build a param string 10984 } else if ( params && typeof params === "object" ) { 10985 type = "POST"; 10986 } 10987 10988 // If we have elements to modify, make the request 10989 if ( self.length > 0 ) { 10990 jQuery.ajax({ 10991 url: url, 10992 10993 // if "type" variable is undefined, then "GET" method will be used 10994 type: type, 10995 dataType: "html", 10996 data: params 10997 }).done(function( responseText ) { 10998 10999 // Save response for use in complete callback 11000 response = arguments; 11001 11002 self.html( selector ? 11003 11004 // If a selector was specified, locate the right elements in a dummy div 11005 // Exclude scripts to avoid IE 'Permission Denied' errors 11006 jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : 11007 11008 // Otherwise use the full result 11009 responseText ); 11010 11011 }).complete( callback && function( jqXHR, status ) { 11012 self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); 11013 }); 11014 } 11015 11016 return this; 11017}; 11018 11019 11020 11021 11022// Attach a bunch of functions for handling common AJAX events 11023jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { 11024 jQuery.fn[ type ] = function( fn ) { 11025 return this.on( type, fn ); 11026 }; 11027}); 11028 11029 11030 11031 11032jQuery.expr.filters.animated = function( elem ) { 11033 return jQuery.grep(jQuery.timers, function( fn ) { 11034 return elem === fn.elem; 11035 }).length; 11036}; 11037 11038 11039 11040 11041var docElem = window.document.documentElement; 11042 11043/** 11044 * Gets a window from an element 11045 */ 11046function getWindow( elem ) { 11047 return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView; 11048} 11049 11050jQuery.offset = { 11051 setOffset: function( elem, options, i ) { 11052 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 11053 position = jQuery.css( elem, "position" ), 11054 curElem = jQuery( elem ), 11055 props = {}; 11056 11057 // Set position first, in-case top/left are set even on static elem 11058 if ( position === "static" ) { 11059 elem.style.position = "relative"; 11060 } 11061 11062 curOffset = curElem.offset(); 11063 curCSSTop = jQuery.css( elem, "top" ); 11064 curCSSLeft = jQuery.css( elem, "left" ); 11065 calculatePosition = ( position === "absolute" || position === "fixed" ) && 11066 ( curCSSTop + curCSSLeft ).indexOf("auto") > -1; 11067 11068 // Need to be able to calculate position if either 11069 // top or left is auto and position is either absolute or fixed 11070 if ( calculatePosition ) { 11071 curPosition = curElem.position(); 11072 curTop = curPosition.top; 11073 curLeft = curPosition.left; 11074 11075 } else { 11076 curTop = parseFloat( curCSSTop ) || 0; 11077 curLeft = parseFloat( curCSSLeft ) || 0; 11078 } 11079 11080 if ( jQuery.isFunction( options ) ) { 11081 options = options.call( elem, i, curOffset ); 11082 } 11083 11084 if ( options.top != null ) { 11085 props.top = ( options.top - curOffset.top ) + curTop; 11086 } 11087 if ( options.left != null ) { 11088 props.left = ( options.left - curOffset.left ) + curLeft; 11089 } 11090 11091 if ( "using" in options ) { 11092 options.using.call( elem, props ); 11093 11094 } else { 11095 curElem.css( props ); 11096 } 11097 } 11098}; 11099 11100jQuery.fn.extend({ 11101 offset: function( options ) { 11102 if ( arguments.length ) { 11103 return options === undefined ? 11104 this : 11105 this.each(function( i ) { 11106 jQuery.offset.setOffset( this, options, i ); 11107 }); 11108 } 11109 11110 var docElem, win, 11111 elem = this[ 0 ], 11112 box = { top: 0, left: 0 }, 11113 doc = elem && elem.ownerDocument; 11114 11115 if ( !doc ) { 11116 return; 11117 } 11118 11119 docElem = doc.documentElement; 11120 11121 // Make sure it's not a disconnected DOM node 11122 if ( !jQuery.contains( docElem, elem ) ) { 11123 return box; 11124 } 11125
11126 // Support: BlackBerry 5, iOS 3 (original iPhone) 11127 // If we don't have gBCR, just use 0,0 rather than error 11128 if ( typeof elem.getBoundingClientRect !== strundefined ) { 11129 box = elem.getBoundingClientRect(); 11130 } 11131 win = getWindow( doc ); 11132 return { 11133 top: box.top + win.pageYOffset - docElem.clientTop, 11134 left: box.left + win.pageXOffset - docElem.clientLeft 11135 }; 11136 }, 11137 11138 position: function() { 11139 if ( !this[ 0 ] ) { 11140 return; 11141 } 11142 11143 var offsetParent, offset, 11144 elem = this[ 0 ], 11145 parentOffset = { top: 0, left: 0 }; 11146 11147 // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent 11148 if ( jQuery.css( elem, "position" ) === "fixed" ) { 11149 // Assume getBoundingClientRect is there when computed position is fixed 11150 offset = elem.getBoundingClientRect(); 11151 11152 } else { 11153 // Get *real* offsetParent 11154 offsetParent = this.offsetParent(); 11155 11156 // Get correct offsets 11157 offset = this.offset(); 11158 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { 11159 parentOffset = offsetParent.offset(); 11160 } 11161 11162 // Add offsetParent borders 11163 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); 11164 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); 11165 } 11166 11167 // Subtract parent offsets and element margins 11168 return { 11169 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 11170 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 11171 }; 11172 }, 11173 11174 offsetParent: function() { 11175 return this.map(function() { 11176 var offsetParent = this.offsetParent || docElem; 11177 11178 while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) { 11179 offsetParent = offsetParent.offsetParent; 11180 } 11181 11182 return offsetParent || docElem; 11183 }); 11184 } 11185}); 11186 11187// Create scrollLeft and scrollTop methods 11188jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 11189 var top = "pageYOffset" === prop; 11190 11191 jQuery.fn[ method ] = function( val ) { 11192 return access( this, function( elem, method, val ) { 11193 var win = getWindow( elem ); 11194 11195 if ( val === undefined ) { 11196 return win ? win[ prop ] : elem[ method ]; 11197 } 11198 11199 if ( win ) { 11200 win.scrollTo( 11201 !top ? val : window.pageXOffset, 11202 top ? val : window.pageYOffset 11203 ); 11204 11205 } else { 11206 elem[ method ] = val; 11207 } 11208 }, method, val, arguments.length, null ); 11209 }; 11210}); 11211 11212// Support: Safari<7+, Chrome<37+ 11213// Add the top/left cssHooks using jQuery.fn.position 11214// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 11215// Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280 11216// getComputedStyle returns percent when specified for top/left/bottom/right; 11217// rather than make the css module depend on the offset module, just check for it here 11218jQuery.each( [ "top", "left" ], function( i, prop ) { 11219 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 11220 function( elem, computed ) { 11221 if ( computed ) { 11222 computed = curCSS( elem, prop ); 11223 // If curCSS returns percentage, fallback to offset 11224 return rnumnonpx.test( computed ) ? 11225 jQuery( elem ).position()[ prop ] + "px" : 11226 computed; 11227 } 11228 } 11229 ); 11230}); 11231 11232 11233// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 11234jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 11235 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { 11236 // Margin is only for outerHeight, outerWidth 11237 jQuery.fn[ funcName ] = function( margin, value ) { 11238 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 11239 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 11240 11241 return access( this, function( elem, type, value ) { 11242 var doc; 11243 11244 if ( jQuery.isWindow( elem ) ) { 11245 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there 11246 // isn't a whole lot we can do. See pull request at this URL for discussion: 11247 // https://github.com/jquery/jquery/pull/764 11248 return elem.document.documentElement[ "client" + name ]; 11249 } 11250 11251 // Get document width or height 11252 if ( elem.nodeType === 9 ) { 11253 doc = elem.documentElement; 11254 11255 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 11256 // whichever is greatest 11257 return Math.max( 11258 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 11259 elem.body[ "offset" + name ], doc[ "offset" + name ], 11260 doc[ "client" + name ] 11261 ); 11262 } 11263 11264 return value === undefined ? 11265 // Get width or height on the element, requesting but not forcing parseFloat 11266 jQuery.css( elem, type, extra ) : 11267 11268 // Set width or height on the element 11269 jQuery.style( elem, type, value, extra ); 11270 }, type, chainable ? margin : undefined, chainable, null ); 11271 }; 11272 }); 11273}); 11274 11275 11276// The number of elements contained in the matched element set 11277jQuery.fn.size = function() { 11278 return this.length; 11279}; 11280 11281jQuery.fn.andSelf = jQuery.fn.addBack; 11282 11283 11284 11285 11286// Register as a named AMD module, since jQuery can be concatenated with other 11287// files that may use define, but not via a proper concatenation script that 11288// understands anonymous AMD modules. A named AMD is safest and most robust 11289// way to register. Lowercase jquery is used because AMD module names are 11290// derived from file names, and jQuery is normally delivered in a lowercase 11291// file name. Do this after creating the global so that if an AMD module wants 11292// to call noConflict to hide this version of jQuery, it will work. 11293 11294// Note that for maximum portability, libraries that are not jQuery should 11295// declare themselves as anonymous modules, and avoid setting a global if an 11296// AMD loader is present. jQuery is a special case. For more information, see
11297// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 11298 11299if ( typeof define === "function" && define.amd ) { 11300 define( "jquery", [], function() { 11301 return jQuery; 11302 }); 11303} 11304 11305 11306 11307 11308var 11309 // Map over jQuery in case of overwrite 11310 _jQuery = window.jQuery, 11311 11312 // Map over the $ in case of overwrite 11313 _$ = window.$; 11314 11315jQuery.noConflict = function( deep ) { 11316 if ( window.$ === jQuery ) { 11317 window.$ = _$; 11318 } 11319 11320 if ( deep && window.jQuery === jQuery ) { 11321 window.jQuery = _jQuery; 11322 } 11323 11324 return jQuery; 11325}; 11326 11327// Expose jQuery and $ identifiers, even in AMD 11328// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 11329// and CommonJS for browser emulators (#13566) 11330if ( typeof noGlobal === strundefined ) { 11331 window.jQuery = window.$ = jQuery; 11332} 11333 11334 11335 11336 11337return jQuery; 11338 11339})); 11340 11341/** 11342 * @license 11343 * Lodash lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE 11344 */ 11345;(function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u<i;){var o=n[u];t(e,o,r(o),n)}return e}function r(n,t){for(var r=-1,e=null==n?0:n.length;++r<e&&false!==t(n[r],r,n););return n}function e(n,t){for(var r=null==n?0:n.length;r--&&false!==t(n[r],r,n););return n}function u(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(!t(n[r],r,n))return false; 11346return true}function i(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o)}return i}function o(n,t){return!(null==n||!n.length)&&-1<v(n,t,0)}function f(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return true;return false}function c(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n); 11347return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return true;return false}function p(n,t,r){var e;return r(n,function(n,r,u){if(t(n,r,u))return e=r,false}),e}function _(n,t,r,e){var u=n.length;for(r+=e?1:-1;e?r--:++r<u;)if(t(n[r],r,n))return r;return-1}function v(n,t,r){if(t===t)n:{--r;for(var e=n.length;++r<e;)if(n[r]===t){n=r;break n}n=-1}else n=_(n,d,r);return n}function g(n,t,r,e){ 11348--r;for(var u=n.length;++r<u;)if(e(n[r],t))return r;return-1}function d(n){return n!==n}function y(n,t){var r=null==n?0:n.length;return r?m(n,t)/r:F}function b(n){return function(t){return null==t?T:t[n]}}function x(n){return function(t){return null==n?T:n[t]}}function j(n,t,r,e,u){return u(n,function(n,u,i){r=e?(e=false,n):t(r,n,u,i)}),r}function w(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].c;return n}function m(n,t){for(var r,e=-1,u=n.length;++e<u;){var i=t(n[e]);i!==T&&(r=r===T?i:r+i)}return r; 11349}function A(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function E(n,t){return c(t,function(t){return[t,n[t]]})}function k(n){return function(t){return n(t)}}function S(n,t){return c(t,function(t){return n[t]})}function O(n,t){return n.has(t)}function I(n,t){for(var r=-1,e=n.length;++r<e&&-1<v(t,n[r],0););return r}function R(n,t){for(var r=n.length;r--&&-1<v(t,n[r],0););return r}function z(n){return"\\"+Un[n]}function W(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]; 11350}),r}function B(n,t){return function(r){return n(t(r))}}function L(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&"__lodash_placeholder__"!==o||(n[r]="__lodash_placeholder__",i[u++]=r)}return i}function U(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=n}),r}function C(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=[n,n]}),r}function D(n){if(Rn.test(n)){for(var t=On.lastIndex=0;On.test(n);)++t;n=t}else n=Qn(n);return n}function M(n){return Rn.test(n)?n.match(On)||[]:n.split(""); 11351}var T,$=1/0,F=NaN,N=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],P=/\b__p\+='';/g,Z=/\b(__p\+=)''\+/g,q=/(__e\(.*?\)|\b__t\))\+'';/g,V=/&(?:amp|lt|gt|quot|#39);/g,K=/[&<>"']/g,G=RegExp(V.source),H=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nn=/^\w*$/,tn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rn=/[\\^$.*+?()[\]{}|]/g,en=RegExp(rn.source),un=/^\s+|\s+$/g,on=/^\s+/,fn=/\s+$/,cn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,an=/\{\n\/\* \[wrapped with (.+)\] \*/,ln=/,? & /,sn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,hn=/\\(\\)?/g,pn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_n=/\w*$/,vn=/^[-+]0x[0-9a-f]+$/i,gn=/^0b[01]+$/i,dn=/^\[object .+?Constructor\]$/,yn=/^0o[0-7]+$/i,bn=/^(?:0|[1-9]\d*)$/,xn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u01
113517f]/g,jn=/($^)/,wn=/['\n\r\u2028\u2029\\]/g,mn="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",An="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+mn,En="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",kn=RegExp("['\u2019]","g"),Sn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),On=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+En+mn,"g"),In=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",An].join("|"),"g"),Rn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),zn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wn="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Bn={}; 11352Bn["[object Float32Array]"]=Bn["[object Float64Array]"]=Bn["[object Int8Array]"]=Bn["[object Int16Array]"]=Bn["[object Int32Array]"]=Bn["[object Uint8Array]"]=Bn["[object Uint8ClampedArray]"]=Bn["[object Uint16Array]"]=Bn["[object Uint32Array]"]=true,Bn["[object Arguments]"]=Bn["[object Array]"]=Bn["[object ArrayBuffer]"]=Bn["[object Boolean]"]=Bn["[object DataView]"]=Bn["[object Date]"]=Bn["[object Error]"]=Bn["[object Function]"]=Bn["[object Map]"]=Bn["[object Number]"]=Bn["[object Object]"]=Bn["[object RegExp]"]=Bn["[object Set]"]=Bn["[object String]"]=Bn["[object WeakMap]"]=false; 11353var Ln={};Ln["[object Arguments]"]=Ln["[object Array]"]=Ln["[object ArrayBuffer]"]=Ln["[object DataView]"]=Ln["[object Boolean]"]=Ln["[object Date]"]=Ln["[object Float32Array]"]=Ln["[object Float64Array]"]=Ln["[object Int8Array]"]=Ln["[object Int16Array]"]=Ln["[object Int32Array]"]=Ln["[object Map]"]=Ln["[object Number]"]=Ln["[object Object]"]=Ln["[object RegExp]"]=Ln["[object Set]"]=Ln["[object String]"]=Ln["[object Symbol]"]=Ln["[object Uint8Array]"]=Ln["[object Uint8ClampedArray]"]=Ln["[object Uint16Array]"]=Ln["[object Uint32Array]"]=true, 11354Ln["[object Error]"]=Ln["[object Function]"]=Ln["[object WeakMap]"]=false;var Un={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Cn=parseFloat,Dn=parseInt,Mn=typeof global=="object"&&global&&global.Object===Object&&global,Tn=typeof self=="object"&&self&&self.Object===Object&&self,$n=Mn||Tn||Function("return this")(),Fn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Nn=Fn&&typeof module=="object"&&module&&!module.nodeType&&module,Pn=Nn&&Nn.exports===Fn,Zn=Pn&&Mn.process,qn=function(){
11355try{var n=Nn&&Nn.f&&Nn.f("util").types;return n?n:Zn&&Zn.binding&&Zn.binding("util")}catch(n){}}(),Vn=qn&&qn.isArrayBuffer,Kn=qn&&qn.isDate,Gn=qn&&qn.isMap,Hn=qn&&qn.isRegExp,Jn=qn&&qn.isSet,Yn=qn&&qn.isTypedArray,Qn=b("length"),Xn=x({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I", 11356"\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C", 11357"\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i", 11358"\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r", 11359"\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij", 11360"\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),nt=x({"&":"&","<":"<",">":">",'"':""","'":"'"}),tt=x({"&":"&","<":"<",">":">",""":'"',"'":"'"}),rt=function x(mn){function An(n){if(yu(n)&&!ff(n)&&!(n instanceof Un)){if(n instanceof On)return n;if(oi.call(n,"__wrapped__"))return Fe(n)}return new On(n)}function En(){}function On(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=T}function Un(n){this.__wrapped__=n, 11361this.__actions__=[],this.__dir__=1,this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Mn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Tn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Fn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Nn(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new Fn;++t<r;)this.add(n[t]); 11362}function Zn(n){this.size=(this.__data__=new Tn(n)).size}function qn(n,t){var r,e=ff(n),u=!e&&of(n),i=!e&&!u&&af(n),o=!e&&!u&&!i&&_f(n),u=(e=e||u||i||o)?A(n.length,ni):[],f=u.length;for(r in n)!t&&!oi.call(n,r)||e&&("length"==r||i&&("offset"==r||"parent"==r)||o&&("buffer"==r||"byteLength"==r||"byteOffset"==r)||Se(r,f))||u.push(r);return u}function Qn(n){var t=n.length;return t?n[ir(0,t-1)]:T}function et(n,t){return De(Ur(n),pt(t,0,n.length))}function ut(n){return De(Ur(n))}function it(n,t,r){(r===T||lu(n[t],r))&&(r!==T||t in n)||st(n,t,r); 11363}function ot(n,t,r){var e=n[t];oi.call(n,t)&&lu(e,r)&&(r!==T||t in n)||st(n,t,r)}function ft(n,t){for(var r=n.length;r--;)if(lu(n[r][0],t))return r;return-1}function ct(n,t,r,e){return uo(n,function(n,u,i){t(e,n,r(n),i)}),e}function at(n,t){return n&&Cr(t,Wu(t),n)}function lt(n,t){return n&&Cr(t,Bu(t),n)}function st(n,t,r){"__proto__"==t&&Ai?Ai(n,t,{configurable:true,enumerable:true,value:r,writable:true}):n[t]=r}function ht(n,t){for(var r=-1,e=t.length,u=Ku(e),i=null==n;++r<e;)u[r]=i?T:Ru(n,t[r]);return u; 11364}function pt(n,t,r){return n===n&&(r!==T&&(n=n<=r?n:r),t!==T&&(n=n>=t?n:t)),n}function _t(n,t,e,u,i,o){var f,c=1&t,a=2&t,l=4&t;if(e&&(f=i?e(n,u,i,o):e(n)),f!==T)return f;if(!du(n))return n;if(u=ff(n)){if(f=me(n),!c)return Ur(n,f)}else{var s=vo(n),h="[object Function]"==s||"[object GeneratorFunction]"==s;
11364if(af(n))return Ir(n,c);if("[object Object]"==s||"[object Arguments]"==s||h&&!i){if(f=a||h?{}:Ae(n),!c)return a?Mr(n,lt(f,n)):Dr(n,at(f,n))}else{if(!Ln[s])return i?n:{};f=Ee(n,s,c)}}if(o||(o=new Zn), 11365i=o.get(n))return i;o.set(n,f),pf(n)?n.forEach(function(r){f.add(_t(r,t,e,r,n,o))}):sf(n)&&n.forEach(function(r,u){f.set(u,_t(r,t,e,u,n,o))});var a=l?a?ve:_e:a?Bu:Wu,p=u?T:a(n);return r(p||n,function(r,u){p&&(u=r,r=n[u]),ot(f,u,_t(r,t,e,u,n,o))}),f}function vt(n){var t=Wu(n);return function(r){return gt(r,n,t)}}function gt(n,t,r){var e=r.length;if(null==n)return!e;for(n=Qu(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===T&&!(u in n)||!i(o))return false}return true}function dt(n,t,r){if(typeof n!="function")throw new ti("Expected a function"); 11366return bo(function(){n.apply(T,r)},t)}function yt(n,t,r,e){var u=-1,i=o,a=true,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,k(r))),e?(i=f,a=false):200<=t.length&&(i=O,a=false,t=new Nn(t));n:for(;++u<l;){var p=n[u],_=null==r?p:r(p),p=e||0!==p?p:0;if(a&&_===_){for(var v=h;v--;)if(t[v]===_)continue n;s.push(p)}else i(t,_,e)||s.push(p)}return s}function bt(n,t){var r=true;return uo(n,function(n,e,u){return r=!!t(n,e,u)}),r}function xt(n,t,r){for(var e=-1,u=n.length;++e<u;){var i=n[e],o=t(i);if(null!=o&&(f===T?o===o&&!wu(o):r(o,f)))var f=o,c=i; 11367}return c}function jt(n,t){var r=[];return uo(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function wt(n,t,r,e,u){var i=-1,o=n.length;for(r||(r=ke),u||(u=[]);++i<o;){var f=n[i];0<t&&r(f)?1<t?wt(f,t-1,r,e,u):a(u,f):e||(u[u.length]=f)}return u}function mt(n,t){return n&&oo(n,t,Wu)}function At(n,t){return n&&fo(n,t,Wu)}function Et(n,t){return i(t,function(t){return _u(n[t])})}function kt(n,t){t=Sr(t,n);for(var r=0,e=t.length;null!=n&&r<e;)n=n[Me(t[r++])];return r&&r==e?n:T}function St(n,t,r){return t=t(n), 11368ff(n)?t:a(t,r(n))}function Ot(n){if(null==n)n=n===T?"[object Undefined]":"[object Null]";else if(mi&&mi in Qu(n)){var t=oi.call(n,mi),r=n[mi];try{n[mi]=T;var e=true}catch(n){}var u=ai.call(n);e&&(t?n[mi]=r:delete n[mi]),n=u}else n=ai.call(n);return n}function It(n,t){return n>t}function Rt(n,t){return null!=n&&oi.call(n,t)}function zt(n,t){return null!=n&&t in Qu(n)}function Wt(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=Ku(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,k(t))),s=Ci(p.length,s), 11369l[a]=!r&&(t||120<=u&&120<=p.length)?new Nn(a&&p):T}var p=n[0],_=-1,v=l[0];n:for(;++_<u&&h.length<s;){var g=p[_],d=t?t(g):g,g=r||0!==g?g:0;if(v?!O(v,d):!e(h,d,r)){for(a=i;--a;){var y=l[a];if(y?!O(y,d):!e(n[a],d,r))continue n}v&&v.push(d),h.push(g)}}return h}function Bt(n,t,r){var e={};return mt(n,function(n,u,i){t(e,r(n),u,i)}),e}function Lt(t,r,e){return r=Sr(r,t),t=2>r.length?t:kt(t,hr(r,0,-1)),r=null==t?t:t[Me(Ve(r))],null==r?T:n(r,t,e)}function Ut(n){return yu(n)&&"[object Arguments]"==Ot(n)}function Ct(n){ 11370return yu(n)&&"[object ArrayBuffer]"==Ot(n)}function Dt(n){return yu(n)&&"[object Date]"==Ot(n)}function Mt(n,t,r,e,u){if(n===t)t=true;else if(null==n||null==t||!yu(n)&&!yu(t))t=n!==n&&t!==t;else n:{var i=ff(n),o=ff(t),f=i?"[object Array]":vo(n),c=o?"[object Array]":vo(t),f="[object Arguments]"==f?"[object Object]":f,c="[object Arguments]"==c?"[object Object]":c,a="[object Object]"==f,o="[object Object]"==c;if((c=f==c)&&af(n)){if(!af(t)){t=false;break n}i=true,a=false}if(c&&!a)u||(u=new Zn),t=i||_f(n)?se(n,t,r,e,Mt,u):he(n,t,f,r,e,Mt,u);else{ 11371if(!(1&r)&&(i=a&&oi.call(n,"__wrapped__"),f=o&&oi.call(t,"__wrapped__"),i||f)){n=i?n.value():n,t=f?t.value():t,u||(u=new Zn),t=Mt(n,t,r,e,u);break n}if(c)t:if(u||(u=new Zn),i=1&r,f=_e(n),o=f.length,c=_e(t).length,o==c||i){for(a=o;a--;){var l=f[a];if(!(i?l in t:oi.call(t,l))){t=false;break t}}if((c=u.get(n))&&u.get(t))t=c==t;else{c=true,u.set(n,t),u.set(t,n);for(var s=i;++a<o;){var l=f[a],h=n[l],p=t[l];if(e)var _=i?e(p,h,l,t,n,u):e(h,p,l,n,t,u);if(_===T?h!==p&&!Mt(h,p,r,e,u):!_){c=false;break}s||(s="constructor"==l); 11372}c&&!s&&(r=n.constructor,e=t.constructor,r!=e&&"constructor"in n&&"constructor"in t&&!(typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)&&(c=false)),u.delete(n),u.delete(t),t=c}}else t=false;else t=false}}return t}function Tt(n){return yu(n)&&"[object Map]"==vo(n)}function $t(n,t,r,e){var u=r.length,i=u,o=!e;if(null==n)return!i;for(n=Qu(n);u--;){var f=r[u];
11372if(o&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return false}for(;++u<i;){var f=r[u],c=f[0],a=n[c],l=f[1];if(o&&f[2]){if(a===T&&!(c in n))return false; 11373}else{if(f=new Zn,e)var s=e(a,l,c,n,t,f);if(s===T?!Mt(l,a,3,e,f):!s)return false}}return true}function Ft(n){return!(!du(n)||ci&&ci in n)&&(_u(n)?hi:dn).test(Te(n))}function Nt(n){return yu(n)&&"[object RegExp]"==Ot(n)}function Pt(n){return yu(n)&&"[object Set]"==vo(n)}function Zt(n){return yu(n)&&gu(n.length)&&!!Bn[Ot(n)]}function qt(n){return typeof n=="function"?n:null==n?$u:typeof n=="object"?ff(n)?Jt(n[0],n[1]):Ht(n):Zu(n)}function Vt(n){if(!ze(n))return Li(n);var t,r=[];for(t in Qu(n))oi.call(n,t)&&"constructor"!=t&&r.push(t); 11374return r}function Kt(n,t){return n<t}function Gt(n,t){var r=-1,e=su(n)?Ku(n.length):[];return uo(n,function(n,u,i){e[++r]=t(n,u,i)}),e}function Ht(n){var t=xe(n);return 1==t.length&&t[0][2]?We(t[0][0],t[0][1]):function(r){return r===n||$t(r,n,t)}}function Jt(n,t){return Ie(n)&&t===t&&!du(t)?We(Me(n),t):function(r){var e=Ru(r,n);return e===T&&e===t?zu(r,n):Mt(t,e,3)}}function Yt(n,t,r,e,u){n!==t&&oo(t,function(i,o){if(u||(u=new Zn),du(i)){var f=u,c=Le(n,o),a=Le(t,o),l=f.get(a);if(l)it(n,o,l);else{ 11375var l=e?e(c,a,o+"",n,t,f):T,s=l===T;if(s){var h=ff(a),p=!h&&af(a),_=!h&&!p&&_f(a),l=a;h||p||_?ff(c)?l=c:hu(c)?l=Ur(c):p?(s=false,l=Ir(a,true)):_?(s=false,l=zr(a,true)):l=[]:xu(a)||of(a)?(l=c,of(c)?l=Ou(c):du(c)&&!_u(c)||(l=Ae(a))):s=false}s&&(f.set(a,l),Yt(l,a,r,e,f),f.delete(a)),it(n,o,l)}}else f=e?e(Le(n,o),i,o+"",n,t,u):T,f===T&&(f=i),it(n,o,f)},Bu)}function Qt(n,t){var r=n.length;if(r)return t+=0>t?r:0,Se(t,r)?n[t]:T}function Xt(n,t,r){var e=-1;return t=c(t.length?t:[$u],k(ye())),n=Gt(n,function(n){return{ 11376a:c(t,function(t){return t(n)}),b:++e,c:n}}),w(n,function(n,t){var e;n:{e=-1;for(var u=n.a,i=t.a,o=u.length,f=r.length;++e<o;){var c=Wr(u[e],i[e]);if(c){e=e>=f?c:c*("desc"==r[e]?-1:1);break n}}e=n.b-t.b}return e})}function nr(n,t){return tr(n,t,function(t,r){return zu(n,r)})}function tr(n,t,r){for(var e=-1,u=t.length,i={};++e<u;){var o=t[e],f=kt(n,o);r(f,o)&&lr(i,Sr(o,n),f)}return i}function rr(n){return function(t){return kt(t,n)}}function er(n,t,r,e){var u=e?g:v,i=-1,o=t.length,f=n;for(n===t&&(t=Ur(t)), 11377r&&(f=c(n,k(r)));++i<o;)for(var a=0,l=t[i],l=r?r(l):l;-1<(a=u(f,l,a,e));)f!==n&&xi.call(f,a,1),xi.call(n,a,1);return n}function ur(n,t){for(var r=n?t.length:0,e=r-1;r--;){var u=t[r];if(r==e||u!==i){var i=u;Se(u)?xi.call(n,u,1):xr(n,u)}}}function ir(n,t){return n+Ii(Ti()*(t-n+1))}function or(n,t){var r="";if(!n||1>t||9007199254740991<t)return r;do t%2&&(r+=n),(t=Ii(t/2))&&(n+=n);while(t);return r}function fr(n,t){return xo(Be(n,t,$u),n+"")}function cr(n){return Qn(Uu(n))}function ar(n,t){var r=Uu(n); 11378return De(r,pt(t,0,r.length))}function lr(n,t,r,e){if(!du(n))return n;t=Sr(t,n);for(var u=-1,i=t.length,o=i-1,f=n;null!=f&&++u<i;){var c=Me(t[u]),a=r;if(u!=o){var l=f[c],a=e?e(l,c,f):T;a===T&&(a=du(l)?l:Se(t[u+1])?[]:{})}ot(f,c,a),f=f[c]}return n}function sr(n){return De(Uu(n))}function hr(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Ku(u);++e<u;)r[e]=n[e+t];return r}function pr(n,t){var r;return uo(n,function(n,e,u){return r=t(n,e,u),!r}),!!r} 11379function _r(n,t,r){var e=0,u=null==n?e:n.length;if(typeof t=="number"&&t===t&&2147483647>=u){for(;e<u;){var i=e+u>>>1,o=n[i];null!==o&&!wu(o)&&(r?o<=t:o<t)?e=i+1:u=i}return u}return vr(n,t,$u,r)}function vr(n,t,r,e){t=r(t);for(var u=0,i=null==n?0:n.length,o=t!==t,f=null===t,c=wu(t),a=t===T;u<i;){var l=Ii((u+i)/2),s=r(n[l]),h=s!==T,p=null===s,_=s===s,v=wu(s);(o?e||_:a?_&&(e||h):f?_&&h&&(e||!p):c?_&&h&&!p&&(e||!v):p||v?0:e?s<=t:s<t)?u=l+1:i=l}return Ci(i,4294967294)}function gr(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){ 11380var o=n[r],f=t?t(o):o;if(!r||!lu(f,c)){var c=f;i[u++]=0===o?0:o}}return i}function dr(n){return typeof n=="number"?n:wu(n)?F:+n}function yr(n){if(typeof n=="string")return n;if(ff(n))return c(n,yr)+"";if(wu(n))return ro?ro.call(n):"";var t=n+"";return"0"==t&&1/n==-$?"-0":t}function br(n,t,r){var e=-1,u=o,i=n.length,c=true,a=[],l=a;if(r)c=false,u=f;else if(200<=i){if(u=t?null:so(n))return U(u);c=false,u=O,l=new Nn}else l=t?[]:a;n:for(;++e<i;){var s=n[e],h=t?t(s):s,s=r||0!==s?s:0;if(c&&h===h){for(var p=l.length;p--;)if(l[p]===h)continue n; 11381t&&l.push(h),a.push(s)}else u(l,h,r)||(l!==a&&l.push(h),a.push(s))}return a}function xr(n,t){return t=Sr(t,n),n=2>t.length?n:kt(n,hr(t,0,-1)),null==n||delete n[Me(Ve(t))]}function jr(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++i<u)&&t(n[i],i,n););return r?hr(n,e?0:i,e?i+1:u):hr(n,e?i+1:0,e?u:i)}function wr(n,t){var r=n;return r instanceof Un&&(r=r.value()),l(t,function(n,t){return t.func.apply(t.thisArg,a([n],t.args))},r)}function mr(n,t,r){var e=n.length;if(2>e)return e?br(n[0]):[];for(var u=-1,i=Ku(e);++u<e;)for(var o=n[u],f=-1;++f<e;)f!=u&&(i[u]=yt(i[u]||o,n[f],t,r)); 11382return br(wt(i,1),t,r)}function Ar(n,t,r){for(var e=-1,u=n.length,i=t.length,o={};++e<u;)r(o,n[e],e<i?t[e]:T);return o}function Er(n){return hu(n)?n:[]}function kr(n){return typeof n=="function"?n:$u}function Sr(n,t){return ff(n)?n:Ie(n,t)?[n]:jo(Iu(n))}function Or(n,t,r){var e=n.length;return r=r===T?e:r,!t&&r>=e?n:hr(n,t,r)}function Ir(n,t){if(t)return n.slice();var r=n.length,r=gi?gi(r):new n.constructor(r);return n.copy(r),r}function Rr(n){var t=new n.constructor(n.byteLength);return new vi(t).set(new vi(n)), 11383t}function zr(n,t){return new n.constructor(t?Rr(n.buffer):n.buffer,n.byteOffset,n.length)}function Wr(n,t){if(n!==t){var r=n!==T,e=null===n,u=n===n,i=wu(n),o=t!==T,f=null===t,c=t===t,a=wu(t);if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&n<t||a&&r&&u&&!e&&!i||f&&r&&u||!o&&u||!c)return-1}return 0}function Br(n,t,r,e){var u=-1,i=n.length,o=r.length,f=-1,c=t.length,a=Ui(i-o,0),l=Ku(c+a);for(e=!e;++f<c;)l[f]=t[f];for(;++u<o;)(e||u<i)&&(l[r[u]]=n[u]);for(;a--;)l[f++]=n[u++]; 11384return l}function Lr(n,t,r,e){var u=-1,i=n.length,o=-1,f=r.length,c=-1,a=t.length,l=Ui(i-f,0),s=Ku(l+a);for(e=!e;++u<l;)s[u]=n[u];for(l=u;++c<a;)s[l+c]=t[c];for(;++o<f;)(e||u<i)&&(s[l+r[o]]=n[u++]);return s}function Ur(n,t){var r=-1,e=n.length;for(t||(t=Ku(e));++r<e;)t[r]=n[r];return t}function Cr(n,t,r,e){var u=!r;r||(r={});for(var i=-1,o=t.length;++i<o;){var f=t[i],c=e?e(r[f],n[f],f,r,n):T;c===T&&(c=n[f]),u?st(r,f,c):ot(r,f,c)}return r}function Dr(n,t){return Cr(n,po(n),t)}function Mr(n,t){return Cr(n,_o(n),t); 11385}function Tr(n,r){return function(e,u){var i=ff(e)?t:ct,o=r?r():{};return i(e,n,ye(u,2),o)}}function $r(n){return fr(function(t,r){var e=-1,u=r.length,i=1<u?r[u-1]:T,o=2<u?r[2]:T,i=3<n.length&&typeof i=="function"?(u--,i):T;for(o&&Oe(r[0],r[1],o)&&(i=3>u?T:i,u=1),t=Qu(t);++e<u;)(o=r[e])&&n(t,o,e,i);return t})}function Fr(n,t){return function(r,e){if(null==r)return r;if(!su(r))return n(r,e);for(var u=r.length,i=t?u:-1,o=Qu(r);(t?i--:++i<u)&&false!==e(o[i],i,o););return r}}function Nr(n){return function(t,r,e){ 11386var u=-1,i=Qu(t);e=e(t);for(var o=e.length;o--;){var f=e[n?o:++u];if(false===r(i[f],f,i))break}return t}}function Pr(n,t,r){function e(){return(this&&this!==$n&&this instanceof e?i:n).apply(u?r:this,arguments)}var u=1&t,i=Vr(n);return e}function Zr(n){return function(t){t=Iu(t);var r=Rn.test(t)?M(t):T,e=r?r[0]:t.charAt(0);return t=r?Or(r,1).join(""):t.slice(1),e[n]()+t}}function qr(n){return function(t){return l(Mu(Du(t).replace(kn,"")),n,"")}}function Vr(n){return function(){var t=arguments;switch(t.length){ 11387case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=eo(n.prototype),t=n.apply(r,t);return du(t)?t:r}}function Kr(t,r,e){function u(){for(var o=arguments.length,f=Ku(o),c=o,a=de(u);c--;)f[c]=arguments[c];return c=3>o&&f[0]!==a&&f[o-1]!==a?[]:L(f,a), 11388o-=c.length,o<e?ue(t,r,Jr,u.placeholder,T,f,c,T,T,e-o):n(this&&this!==$n&&this instanceof u?i:t,this,f)}var i=Vr(t);return u}function Gr(n){return function(t,r,e){var u=Qu(t);if(!su(t)){var i=ye(r,3);t=Wu(t),r=function(n){return i(u[n],n,u)}}return r=n(t,r,e),-1<r?u[i?t[r]:r]:T}}function Hr(n){return pe(function(t){var r=t.length,e=r,u=On.prototype.thru;for(n&&t.reverse();e--;){var i=t[e];if(typeof i!="function")throw new ti("Expected a function");if(u&&!o&&"wrapper"==ge(i))var o=new On([],true)}for(e=o?e:r;
11388++e<r;)var i=t[e],u=ge(i),f="wrapper"==u?ho(i):T,o=f&&Re(f[0])&&424==f[1]&&!f[4].length&&1==f[9]?o[ge(f[0])].apply(o,f[3]):1==i.length&&Re(i)?o[u]():o.thru(i); 11389return function(){var n=arguments,e=n[0];if(o&&1==n.length&&ff(e))return o.plant(e).value();for(var u=0,n=r?t[u].apply(this,n):e;++u<r;)n=t[u].call(this,n);return n}})}function Jr(n,t,r,e,u,i,o,f,c,a){function l(){for(var d=arguments.length,y=Ku(d),b=d;b--;)y[b]=arguments[b];if(_){var x,j=de(l),b=y.length;for(x=0;b--;)y[b]===j&&++x}if(e&&(y=Br(y,e,u,_)),i&&(y=Lr(y,i,o,_)),d-=x,_&&d<a)return j=L(y,j),ue(n,t,Jr,l.placeholder,r,y,j,f,c,a-d);if(j=h?r:this,b=p?j[n]:n,d=y.length,f){x=y.length;for(var w=Ci(f.length,x),m=Ur(y);w--;){ 11390var A=f[w];y[w]=Se(A,x)?m[A]:T}}else v&&1<d&&y.reverse();return s&&c<d&&(y.length=c),this&&this!==$n&&this instanceof l&&(b=g||Vr(b)),b.apply(j,y)}var s=128&t,h=1&t,p=2&t,_=24&t,v=512&t,g=p?T:Vr(n);return l}function Yr(n,t){return function(r,e){return Bt(r,n,t(e))}}function Qr(n,t){return function(r,e){var u;if(r===T&&e===T)return t;if(r!==T&&(u=r),e!==T){if(u===T)return e;typeof r=="string"||typeof e=="string"?(r=yr(r),e=yr(e)):(r=dr(r),e=dr(e)),u=n(r,e)}return u}}function Xr(t){return pe(function(r){ 11391return r=c(r,k(ye())),fr(function(e){var u=this;return t(r,function(t){return n(t,u,e)})})})}function ne(n,t){t=t===T?" ":yr(t);var r=t.length;return 2>r?r?or(t,n):t:(r=or(t,Oi(n/D(t))),Rn.test(t)?Or(M(r),0,n).join(""):r.slice(0,n))}function te(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=Ku(l+c),h=this&&this!==$n&&this instanceof i?f:t;++a<l;)s[a]=u[a];for(;c--;)s[a++]=arguments[++r];return n(h,o?e:this,s)}var o=1&r,f=Vr(t);return i}function re(n){return function(t,r,e){ 11392e&&typeof e!="number"&&Oe(t,r,e)&&(r=e=T),t=Au(t),r===T?(r=t,t=0):r=Au(r),e=e===T?t<r?1:-1:Au(e);var u=-1;r=Ui(Oi((r-t)/(e||1)),0);for(var i=Ku(r);r--;)i[n?r:++u]=t,t+=e;return i}}function ee(n){return function(t,r){return typeof t=="string"&&typeof r=="string"||(t=Su(t),r=Su(r)),n(t,r)}}function ue(n,t,r,e,u,i,o,f,c,a){var l=8&t,s=l?o:T;o=l?T:o;var h=l?i:T;return i=l?T:i,t=(t|(l?32:64))&~(l?64:32),4&t||(t&=-4),u=[n,t,u,h,s,i,o,f,c,a],r=r.apply(T,u),Re(n)&&yo(r,u),r.placeholder=e,Ue(r,n,t)}function ie(n){ 11393var t=Yu[n];return function(n,r){if(n=Su(n),(r=null==r?0:Ci(Eu(r),292))&&Wi(n)){var e=(Iu(n)+"e").split("e"),e=t(e[0]+"e"+(+e[1]+r)),e=(Iu(e)+"e").split("e");return+(e[0]+"e"+(+e[1]-r))}return t(n)}}function oe(n){return function(t){var r=vo(t);return"[object Map]"==r?W(t):"[object Set]"==r?C(t):E(t,n(t))}}function fe(n,t,r,e,u,i,o,f){var c=2&t;if(!c&&typeof n!="function")throw new ti("Expected a function");var a=e?e.length:0;if(a||(t&=-97,e=u=T),o=o===T?o:Ui(Eu(o),0),f=f===T?f:Eu(f),a-=u?u.length:0, 1139464&t){var l=e,s=u;e=u=T}var h=c?T:ho(n);return i=[n,t,r,e,u,l,s,i,o,f],h&&(r=i[1],n=h[1],t=r|n,e=128==n&&8==r||128==n&&256==r&&i[7].length<=h[8]||384==n&&h[7].length<=h[8]&&8==r,131>t||e)&&(1&n&&(i[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=i[3],i[3]=e?Br(e,r,h[4]):r,i[4]=e?L(i[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=i[5],i[5]=e?Lr(e,r,h[6]):r,i[6]=e?L(i[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(i[7]=r),128&n&&(i[8]=null==i[8]?h[8]:Ci(i[8],h[8])),null==i[9]&&(i[9]=h[9]),i[0]=h[0],i[1]=t),n=i[0], 11395t=i[1],r=i[2],e=i[3],u=i[4],f=i[9]=i[9]===T?c?0:n.length:Ui(i[9]-a,0),!f&&24&t&&(t&=-25),Ue((h?co:yo)(t&&1!=t?8==t||16==t?Kr(n,t,f):32!=t&&33!=t||u.length?Jr.apply(T,i):te(n,t,r,e):Pr(n,t,r),i),n,t)}function ce(n,t,r,e){return n===T||lu(n,ei[r])&&!oi.call(e,r)?t:n}function ae(n,t,r,e,u,i){return du(n)&&du(t)&&(i.set(t,n),Yt(n,t,T,ae,i),i.delete(t)),n}function le(n){return xu(n)?T:n}function se(n,t,r,e,u,i){var o=1&r,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return false;if((c=i.get(n))&&i.get(t))return c==t; 11396var c=-1,a=true,l=2&r?new Nn:T;for(i.set(n,t),i.set(t,n);++c<f;){var s=n[c],p=t[c];if(e)var _=o?e(p,s,c,t,n,i):e(s,p,c,n,t,i);if(_!==T){if(_)continue;a=false;break}if(l){if(!h(t,function(n,t){if(!O(l,t)&&(s===n||u(s,n,r,e,i)))return l.push(t)})){a=false;break}}else if(s!==p&&!u(s,p,r,e,i)){a=false;break}}return i.delete(n),i.delete(t),a}function he(n,t,r,e,u,i,o){switch(r){case"[object DataView]":if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)break;n=n.buffer,t=t.buffer;case"[object ArrayBuffer]": 11397if(n.byteLength!=t.byteLength||!i(new vi(n),new vi(t)))break;return true;case"[object Boolean]":case"[object Date]":case"[object Number]":return lu(+n,+t);case"[object Error]":return n.name==t.name&&n.message==t.message;case"[object RegExp]":case"[object String]":return n==t+"";case"[object Map]":var f=W;case"[object Set]":if(f||(f=U),n.size!=t.size&&!(1&e))break;return(r=o.get(n))?r==t:(e|=2,o.set(n,t),t=se(f(n),f(t),e,u,i,o),o.delete(n),t);case"[object Symbol]":if(to)return to.call(n)==to.call(t)} 11398return false}function pe(n){return xo(Be(n,T,Ze),n+"")}function _e(n){return St(n,Wu,po)}function ve(n){return St(n,Bu,_o)}function ge(n){for(var t=n.name+"",r=Gi[t],e=oi.call(Gi,t)?r.length:0;e--;){var u=r[e],i=u.func;if(null==i||i==n)return u.name}return t}function de(n){return(oi.call(An,"placeholder")?An:n).placeholder}function ye(){var n=An.iteratee||Fu,n=n===Fu?qt:n;return arguments.length?n(arguments[0],arguments[1]):n}function be(n,t){var r=n.__data__,e=typeof t;return("string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t)?r[typeof t=="string"?"string":"hash"]:r.map; 11399}function xe(n){for(var t=Wu(n),r=t.length;r--;){var e=t[r],u=n[e];t[r]=[e,u,u===u&&!du(u)]}return t}function je(n,t){var r=null==n?T:n[t];return Ft(r)?r:T}function we(n,t,r){t=Sr(t,n);for(var e=-1,u=t.length,i=false;++e<u;){var o=Me(t[e]);if(!(i=null!=n&&r(n,o)))break;n=n[o]}return i||++e!=u?i:(u=null==n?0:n.length,!!u&&gu(u)&&Se(o,u)&&(ff(n)||of(n)))}function me(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&oi.call(n,"index")&&(r.index=n.index,r.input
11399=n.input),r}function Ae(n){ 11400return typeof n.constructor!="function"||ze(n)?{}:eo(di(n))}function Ee(n,t,r){var e=n.constructor;switch(t){case"[object ArrayBuffer]":return Rr(n);case"[object Boolean]":case"[object Date]":return new e(+n);case"[object DataView]":return t=r?Rr(n.buffer):n.buffer,new n.constructor(t,n.byteOffset,n.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]": 11401case"[object Uint16Array]":case"[object Uint32Array]":return zr(n,r);case"[object Map]":return new e;case"[object Number]":case"[object String]":return new e(n);case"[object RegExp]":return t=new n.constructor(n.source,_n.exec(n)),t.lastIndex=n.lastIndex,t;case"[object Set]":return new e;case"[object Symbol]":return to?Qu(to.call(n)):{}}}function ke(n){return ff(n)||of(n)||!!(ji&&n&&n[ji])}function Se(n,t){var r=typeof n;return t=null==t?9007199254740991:t,!!t&&("number"==r||"symbol"!=r&&bn.test(n))&&-1<n&&0==n%1&&n<t; 11402}function Oe(n,t,r){if(!du(r))return false;var e=typeof t;return!!("number"==e?su(r)&&Se(t,r.length):"string"==e&&t in r)&&lu(r[t],n)}function Ie(n,t){if(ff(n))return false;var r=typeof n;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=n&&!wu(n))||(nn.test(n)||!X.test(n)||null!=t&&n in Qu(t))}function Re(n){var t=ge(n),r=An[t];return typeof r=="function"&&t in Un.prototype&&(n===r||(t=ho(r),!!t&&n===t[0]))}function ze(n){var t=n&&n.constructor;return n===(typeof t=="function"&&t.prototype||ei)}function We(n,t){ 11403return function(r){return null!=r&&(r[n]===t&&(t!==T||n in Qu(r)))}}function Be(t,r,e){return r=Ui(r===T?t.length-1:r,0),function(){for(var u=arguments,i=-1,o=Ui(u.length-r,0),f=Ku(o);++i<o;)f[i]=u[r+i];for(i=-1,o=Ku(r+1);++i<r;)o[i]=u[i];return o[r]=e(f),n(t,this,o)}}function Le(n,t){if(("constructor"!==t||"function"!=typeof n[t])&&"__proto__"!=t)return n[t]}function Ue(n,t,r){var e=t+"";t=xo;var u,i=$e;return u=(u=e.match(an))?u[1].split(ln):[],r=i(u,r),(i=r.length)&&(u=i-1,r[u]=(1<i?"& ":"")+r[u], 11404r=r.join(2<i?", ":" "),e=e.replace(cn,"{\n/* [wrapped with "+r+"] */\n")),t(n,e)}function Ce(n){var t=0,r=0;return function(){var e=Di(),u=16-(e-r);if(r=e,0<u){if(800<=++t)return arguments[0]}else t=0;return n.apply(T,arguments)}}function De(n,t){var r=-1,e=n.length,u=e-1;for(t=t===T?e:t;++r<t;){var e=ir(r,u),i=n[e];n[e]=n[r],n[r]=i}return n.length=t,n}function Me(n){if(typeof n=="string"||wu(n))return n;var t=n+"";return"0"==t&&1/n==-$?"-0":t}function Te(n){if(null!=n){try{return ii.call(n)}catch(n){} 11405return n+""}return""}function $e(n,t){return r(N,function(r){var e="_."+r[0];t&r[1]&&!o(n,e)&&n.push(e)}),n.sort()}function Fe(n){if(n instanceof Un)return n.clone();var t=new On(n.__wrapped__,n.__chain__);return t.__actions__=Ur(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function Ne(n,t,r){var e=null==n?0:n.length;return e?(r=null==r?0:Eu(r),0>r&&(r=Ui(e+r,0)),_(n,ye(t,3),r)):-1}function Pe(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==T&&(u=Eu(r),u=0>r?Ui(e+u,0):Ci(u,e-1)), 11406_(n,ye(t,3),u,true)}function Ze(n){return(null==n?0:n.length)?wt(n,1):[]}function qe(n){return n&&n.length?n[0]:T}function Ve(n){var t=null==n?0:n.length;return t?n[t-1]:T}function Ke(n,t){return n&&n.length&&t&&t.length?er(n,t):n}function Ge(n){return null==n?n:$i.call(n)}function He(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){if(hu(n))return t=Ui(n.length,t),true}),A(t,function(t){return c(n,b(t))})}function Je(t,r){if(!t||!t.length)return[];var e=He(t);return null==r?e:c(e,function(t){ 11407return n(r,T,t)})}function Ye(n){return n=An(n),n.__chain__=true,n}function Qe(n,t){return t(n)}function Xe(){return this}function nu(n,t){return(ff(n)?r:uo)(n,ye(t,3))}function tu(n,t){return(ff(n)?e:io)(n,ye(t,3))}function ru(n,t){return(ff(n)?c:Gt)(n,ye(t,3))}function eu(n,t,r){return t=r?T:t,t=n&&null==t?n.length:t,fe(n,128,T,T,T,T,t)}function uu(n,t){var r;if(typeof t!="function")throw new ti("Expected a function");return n=Eu(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=T), 11408r}}function iu(n,t,r){return t=r?T:t,n=fe(n,8,T,T,T,T,T,t),n.placeholder=iu.placeholder,n}function ou(n,t,r){return t=r?T:t,n=fe(n,16,T,T,T,T,T,t),n.placeholder=ou.placeholder,n}function fu(n,t,r){function e(t){var r=c,e=a;return c=a=T,_=t,s=n.apply(e,r)}function u(n){var r=n-p;return n-=_,p===T||r>=t||0>r||g&&n>=l}function i(){var n=Go();if(u(n))return o(n);var r,e=bo;r=n-_,n=t-(n-p),r=g?Ci(n,l-r):n,h=e(i,r)}function o(n){return h=T,d&&c?e(n):(c=a=T,s)}function f(){var n=Go(),r=u(n);if(c=arguments, 11409a=this,p=n,r){if(h===T)return _=n=p,h=bo(i,t),v?e(n):s;if(g)return lo(h),h=bo(i,t),e(p)}return h===T&&(h=bo(i,t)),s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof n!="function")throw new ti("Expected a function");return t=Su(t)||0,du(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Ui(Su(r.maxWait)||0,t):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==T&&lo(h),_=0,c=p=a=h=T},f.flush=function(){return h===T?s:o(Go())},f}function cu(n,t){function r(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;
11410return i.has(u)?i.get(u):(e=n.apply(this,e),r.cache=i.set(u,e)||i,e)}if(typeof n!="function"||null!=t&&typeof t!="function")throw new ti("Expected a function");return r.cache=new(cu.Cache||Fn),r}function au(n){if(typeof n!="function")throw new ti("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function lu(n,t){return n===t||n!==n&&t!==t; 11411}function su(n){return null!=n&&gu(n.length)&&!_u(n)}function hu(n){return yu(n)&&su(n)}function pu(n){if(!yu(n))return false;var t=Ot(n);return"[object Error]"==t||"[object DOMException]"==t||typeof n.message=="string"&&typeof n.name=="string"&&!xu(n)}function _u(n){return!!du(n)&&(n=Ot(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function vu(n){return typeof n=="number"&&n==Eu(n)}function gu(n){return typeof n=="number"&&-1<n&&0==n%1&&9007199254740991>=n; 11412}function du(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function yu(n){return null!=n&&typeof n=="object"}function bu(n){return typeof n=="number"||yu(n)&&"[object Number]"==Ot(n)}function xu(n){return!(!yu(n)||"[object Object]"!=Ot(n))&&(n=di(n),null===n||(n=oi.call(n,"constructor")&&n.constructor,typeof n=="function"&&n instanceof n&&ii.call(n)==li))}function ju(n){return typeof n=="string"||!ff(n)&&yu(n)&&"[object String]"==Ot(n)}function wu(n){return typeof n=="symbol"||yu(n)&&"[object Symbol]"==Ot(n); 11413}function mu(n){if(!n)return[];if(su(n))return ju(n)?M(n):Ur(n);if(wi&&n[wi]){n=n[wi]();for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}return t=vo(n),("[object Map]"==t?W:"[object Set]"==t?U:Uu)(n)}function Au(n){return n?(n=Su(n),n===$||n===-$?1.7976931348623157e308*(0>n?-1:1):n===n?n:0):0===n?n:0}function Eu(n){n=Au(n);var t=n%1;return n===n?t?n-t:n:0}function ku(n){return n?pt(Eu(n),0,4294967295):0}function Su(n){if(typeof n=="number")return n;if(wu(n))return F;if(du(n)&&(n=typeof n.valueOf=="function"?n.valueOf():n, 11414n=du(n)?n+"":n),typeof n!="string")return 0===n?n:+n;n=n.replace(un,"");var t=gn.test(n);return t||yn.test(n)?Dn(n.slice(2),t?2:8):vn.test(n)?F:+n}function Ou(n){return Cr(n,Bu(n))}function Iu(n){return null==n?"":yr(n)}function Ru(n,t,r){return n=null==n?T:kt(n,t),n===T?r:n}function zu(n,t){return null!=n&&we(n,t,zt)}function Wu(n){return su(n)?qn(n):Vt(n)}function Bu(n){if(su(n))n=qn(n,true);else if(du(n)){var t,r=ze(n),e=[];for(t in n)("constructor"!=t||!r&&oi.call(n,t))&&e.push(t);n=e}else{if(t=[], 11415null!=n)for(r in Qu(n))t.push(r);n=t}return n}function Lu(n,t){if(null==n)return{};var r=c(ve(n),function(n){return[n]});return t=ye(t),tr(n,r,function(n,r){return t(n,r[0])})}function Uu(n){return null==n?[]:S(n,Wu(n))}function Cu(n){return $f(Iu(n).toLowerCase())}function Du(n){return(n=Iu(n))&&n.replace(xn,Xn).replace(Sn,"")}function Mu(n,t,r){return n=Iu(n),t=r?T:t,t===T?zn.test(n)?n.match(In)||[]:n.match(sn)||[]:n.match(t)||[]}function Tu(n){return function(){return n}}function $u(n){return n; 11416}function Fu(n){return qt(typeof n=="function"?n:_t(n,1))}function Nu(n,t,e){var u=Wu(t),i=Et(t,u);null!=e||du(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=Et(t,Wu(t)));var o=!(du(e)&&"chain"in e&&!e.chain),f=_u(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Ur(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function Pu(){} 11417function Zu(n){return Ie(n)?b(Me(n)):rr(n)}function qu(){return[]}function Vu(){return false}mn=null==mn?$n:rt.defaults($n.Object(),mn,rt.pick($n,Wn));var Ku=mn.Array,Gu=mn.Date,Hu=mn.Error,Ju=mn.Function,Yu=mn.Math,Qu=mn.Object,Xu=mn.RegExp,ni=mn.String,ti=mn.TypeError,ri=Ku.prototype,ei=Qu.prototype,ui=mn["__core-js_shared__"],ii=Ju.prototype.toString,oi=ei.hasOwnProperty,fi=0,ci=function(){var n=/[^.]+$/.exec(ui&&ui.keys&&ui.keys.IE_PROTO||"");
11417return n?"Symbol(src)_1."+n:""}(),ai=ei.toString,li=ii.call(Qu),si=$n._,hi=Xu("^"+ii.call(oi).replace(rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pi=Pn?mn.Buffer:T,_i=mn.Symbol,vi=mn.Uint8Array,gi=pi?pi.g:T,di=B(Qu.getPrototypeOf,Qu),yi=Qu.create,bi=ei.propertyIsEnumerable,xi=ri.splice,ji=_i?_i.isConcatSpreadable:T,wi=_i?_i.iterator:T,mi=_i?_i.toStringTag:T,Ai=function(){ 11418try{var n=je(Qu,"defineProperty");return n({},"",{}),n}catch(n){}}(),Ei=mn.clearTimeout!==$n.clearTimeout&&mn.clearTimeout,ki=Gu&&Gu.now!==$n.Date.now&&Gu.now,Si=mn.setTimeout!==$n.setTimeout&&mn.setTimeout,Oi=Yu.ceil,Ii=Yu.floor,Ri=Qu.getOwnPropertySymbols,zi=pi?pi.isBuffer:T,Wi=mn.isFinite,Bi=ri.join,Li=B(Qu.keys,Qu),Ui=Yu.max,Ci=Yu.min,Di=Gu.now,Mi=mn.parseInt,Ti=Yu.random,$i=ri.reverse,Fi=je(mn,"DataView"),Ni=je(mn,"Map"),Pi=je(mn,"Promise"),Zi=je(mn,"Set"),qi=je(mn,"WeakMap"),Vi=je(Qu,"create"),Ki=qi&&new qi,Gi={},Hi=Te(Fi),Ji=Te(Ni),Yi=Te(Pi),Qi=Te(Zi),Xi=Te(qi),no=_i?_i.prototype:T,to=no?no.valueOf:T,ro=no?no.toString:T,eo=function(){ 11419function n(){}return function(t){return du(t)?yi?yi(t):(n.prototype=t,t=new n,n.prototype=T,t):{}}}();An.templateSettings={escape:J,evaluate:Y,interpolate:Q,variable:"",imports:{_:An}},An.prototype=En.prototype,An.prototype.constructor=An,On.prototype=eo(En.prototype),On.prototype.constructor=On,Un.prototype=eo(En.prototype),Un.prototype.constructor=Un,Mn.prototype.clear=function(){this.__data__=Vi?Vi(null):{},this.size=0},Mn.prototype.delete=function(n){return n=this.has(n)&&delete this.__data__[n], 11420this.size-=n?1:0,n},Mn.prototype.get=function(n){var t=this.__data__;return Vi?(n=t[n],"__lodash_hash_undefined__"===n?T:n):oi.call(t,n)?t[n]:T},Mn.prototype.has=function(n){var t=this.__data__;return Vi?t[n]!==T:oi.call(t,n)},Mn.prototype.set=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=Vi&&t===T?"__lodash_hash_undefined__":t,this},Tn.prototype.clear=function(){this.__data__=[],this.size=0},Tn.prototype.delete=function(n){var t=this.__data__;return n=ft(t,n),!(0>n)&&(n==t.length-1?t.pop():xi.call(t,n,1), 11421--this.size,true)},Tn.prototype.get=function(n){var t=this.__data__;return n=ft(t,n),0>n?T:t[n][1]},Tn.prototype.has=function(n){return-1<ft(this.__data__,n)},Tn.prototype.set=function(n,t){var r=this.__data__,e=ft(r,n);return 0>e?(++this.size,r.push([n,t])):r[e][1]=t,this},Fn.prototype.clear=function(){this.size=0,this.__data__={hash:new Mn,map:new(Ni||Tn),string:new Mn}},Fn.prototype.delete=function(n){return n=be(this,n).delete(n),this.size-=n?1:0,n},Fn.prototype.get=function(n){return be(this,n).get(n); 11422},Fn.prototype.has=function(n){return be(this,n).has(n)},Fn.prototype.set=function(n,t){var r=be(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},Nn.prototype.add=Nn.prototype.push=function(n){return this.__data__.set(n,"__lodash_hash_undefined__"),this},Nn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.clear=function(){this.__data__=new Tn,this.size=0},Zn.prototype.delete=function(n){var t=this.__data__;return n=t.delete(n),this.size=t.size,n},Zn.prototype.get=function(n){ 11423return this.__data__.get(n)},Zn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.set=function(n,t){var r=this.__data__;if(r instanceof Tn){var e=r.__data__;if(!Ni||199>e.length)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new Fn(e)}return r.set(n,t),this.size=r.size,this};var uo=Fr(mt),io=Fr(At,true),oo=Nr(),fo=Nr(true),co=Ki?function(n,t){return Ki.set(n,t),n}:$u,ao=Ai?function(n,t){return Ai(n,"toString",{configurable:true,enumerable:false,value:Tu(t),writable:true})}:$u,lo=Ei||function(n){ 11424return $n.clearTimeout(n)},so=Zi&&1/U(new Zi([,-0]))[1]==$?function(n){return new Zi(n)}:Pu,ho=Ki?function(n){return Ki.get(n)}:Pu,po=Ri?function(n){return null==n?[]:(n=Qu(n),i(Ri(n),function(t){return bi.call(n,t)}))}:qu,_o=Ri?function(n){for(var t=[];n;)a(t,po(n)),n=di(n);return t}:qu,vo=Ot;(Fi&&"[object DataView]"!=vo(new Fi(new ArrayBuffer(1)))||Ni&&"[object Map]"!=vo(new Ni)||Pi&&"[object Promise]"!=vo(Pi.resolve())||Zi&&"[object Set]"!=vo(new Zi)||qi&&"[object WeakMap]"!=vo(new qi))&&(vo=function(n){ 11425var t=Ot(n);if(n=(n="[object Object]"==t?n.constructor:T)?Te(n):"")switch(n){case Hi:return"[object DataView]";case Ji:return"[object Map]";case Yi:return"[object Promise]";case Qi:return"[object Set]";case Xi:return"[object WeakMap]"}return t});var go=ui?_u:Vu,yo=Ce(co),bo=Si||function(n,t){return $n.setTimeout(n,t)},xo=Ce(ao),jo=function(n){n=cu(n,function(n){return 500===t.size&&t.clear(),n});var t=n.cache;return n}(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(tn,function(n,r,e,u){ 11426t.push(e?u.replace(hn,"$1"):r||n)}),t}),wo=fr(function(n,t){return hu(n)?yt(n,wt(t,1,hu,true)):[]}),mo=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),ye(r,2)):[]}),Ao=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),T,r):[]}),Eo=fr(function(n){var t=c(n,Er);return t.length&&t[0]===n[0]?Wt(t):[]}),ko=fr(function(n){var t=Ve(n),r=c(n,Er);return t===Ve(r)?t=T:r.pop(),r.length&&r[0]===n[0]?Wt(r,ye(t,2)):[]}),So=fr(function(n){var t=Ve(n),r=c(n,Er);return(t=typeof t=="function"?t:T)&&r.pop(), 11427r.length&&r[0]===n[0]?Wt(r,T,t):[]}
11427),Oo=fr(Ke),Io=pe(function(n,t){var r=null==n?0:n.length,e=ht(n,t);return ur(n,c(t,function(n){return Se(n,r)?+n:n}).sort(Wr)),e}),Ro=fr(function(n){return br(wt(n,1,hu,true))}),zo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T),br(wt(n,1,hu,true),ye(t,2))}),Wo=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return br(wt(n,1,hu,true),T,t)}),Bo=fr(function(n,t){return hu(n)?yt(n,t):[]}),Lo=fr(function(n){return mr(i(n,hu))}),Uo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T), 11428mr(i(n,hu),ye(t,2))}),Co=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return mr(i(n,hu),T,t)}),Do=fr(He),Mo=fr(function(n){var t=n.length,t=1<t?n[t-1]:T,t=typeof t=="function"?(n.pop(),t):T;return Je(n,t)}),To=pe(function(n){function t(t){return ht(t,n)}var r=n.length,e=r?n[0]:0,u=this.__wrapped__;return!(1<r||this.__actions__.length)&&u instanceof Un&&Se(e)?(u=u.slice(e,+e+(r?1:0)),u.__actions__.push({func:Qe,args:[t],thisArg:T}),new On(u,this.__chain__).thru(function(n){return r&&!n.length&&n.push(T), 11429n})):this.thru(t)}),$o=Tr(function(n,t,r){oi.call(n,r)?++n[r]:st(n,r,1)}),Fo=Gr(Ne),No=Gr(Pe),Po=Tr(function(n,t,r){oi.call(n,r)?n[r].push(t):st(n,r,[t])}),Zo=fr(function(t,r,e){var u=-1,i=typeof r=="function",o=su(t)?Ku(t.length):[];return uo(t,function(t){o[++u]=i?n(r,t,e):Lt(t,r,e)}),o}),qo=Tr(function(n,t,r){st(n,r,t)}),Vo=Tr(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),Ko=fr(function(n,t){if(null==n)return[];var r=t.length;return 1<r&&Oe(n,t[0],t[1])?t=[]:2<r&&Oe(t[0],t[1],t[2])&&(t=[t[0]]), 11430Xt(n,wt(t,1),[])}),Go=ki||function(){return $n.Date.now()},Ho=fr(function(n,t,r){var e=1;if(r.length)var u=L(r,de(Ho)),e=32|e;return fe(n,e,t,r,u)}),Jo=fr(function(n,t,r){var e=3;if(r.length)var u=L(r,de(Jo)),e=32|e;return fe(t,e,n,r,u)}),Yo=fr(function(n,t){return dt(n,1,t)}),Qo=fr(function(n,t,r){return dt(n,Su(t)||0,r)});cu.Cache=Fn;var Xo=fr(function(t,r){r=1==r.length&&ff(r[0])?c(r[0],k(ye())):c(wt(r,1),k(ye()));var e=r.length;return fr(function(u){for(var i=-1,o=Ci(u.length,e);++i<o;)u[i]=r[i].call(this,u[i]); 11431return n(t,this,u)})}),nf=fr(function(n,t){return fe(n,32,T,t,L(t,de(nf)))}),tf=fr(function(n,t){return fe(n,64,T,t,L(t,de(tf)))}),rf=pe(function(n,t){return fe(n,256,T,T,T,t)}),ef=ee(It),uf=ee(function(n,t){return n>=t}),of=Ut(function(){return arguments}())?Ut:function(n){return yu(n)&&oi.call(n,"callee")&&!bi.call(n,"callee")},ff=Ku.isArray,cf=Vn?k(Vn):Ct,af=zi||Vu,lf=Kn?k(Kn):Dt,sf=Gn?k(Gn):Tt,hf=Hn?k(Hn):Nt,pf=Jn?k(Jn):Pt,_f=Yn?k(Yn):Zt,vf=ee(Kt),gf=ee(function(n,t){return n<=t}),df=$r(function(n,t){ 11432if(ze(t)||su(t))Cr(t,Wu(t),n);else for(var r in t)oi.call(t,r)&&ot(n,r,t[r])}),yf=$r(function(n,t){Cr(t,Bu(t),n)}),bf=$r(function(n,t,r,e){Cr(t,Bu(t),n,e)}),xf=$r(function(n,t,r,e){Cr(t,Wu(t),n,e)}),jf=pe(ht),wf=fr(function(n,t){n=Qu(n);var r=-1,e=t.length,u=2<e?t[2]:T;for(u&&Oe(t[0],t[1],u)&&(e=1);++r<e;)for(var u=t[r],i=Bu(u),o=-1,f=i.length;++o<f;){var c=i[o],a=n[c];(a===T||lu(a,ei[c])&&!oi.call(n,c))&&(n[c]=u[c])}return n}),mf=fr(function(t){return t.push(T,ae),n(Of,T,t)}),Af=Yr(function(n,t,r){ 11433null!=t&&typeof t.toString!="function"&&(t=ai.call(t)),n[t]=r},Tu($u)),Ef=Yr(function(n,t,r){null!=t&&typeof t.toString!="function"&&(t=ai.call(t)),oi.call(n,t)?n[t].push(r):n[t]=[r]},ye),kf=fr(Lt),Sf=$r(function(n,t,r){Yt(n,t,r)}),Of=$r(function(n,t,r,e){Yt(n,t,r,e)}),If=pe(function(n,t){var r={};if(null==n)return r;var e=false;t=c(t,function(t){return t=Sr(t,n),e||(e=1<t.length),t}),Cr(n,ve(n),r),e&&(r=_t(r,7,le));for(var u=t.length;u--;)xr(r,t[u]);return r}),Rf=pe(function(n,t){return null==n?{}:nr(n,t); 11434}),zf=oe(Wu),Wf=oe(Bu),Bf=qr(function(n,t,r){return t=t.toLowerCase(),n+(r?Cu(t):t)}),Lf=qr(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),Uf=qr(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),Cf=Zr("toLowerCase"),Df=qr(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()}),Mf=qr(function(n,t,r){return n+(r?" ":"")+$f(t)}),Tf=qr(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),$f=Zr("toUpperCase"),Ff=fr(function(t,r){try{return n(t,T,r)}catch(n){return pu(n)?n:new Hu(n)}}),Nf=pe(function(n,t){ 11435return r(t,function(t){t=Me(t),st(n,t,Ho(n[t],n))}),n}),Pf=Hr(),Zf=Hr(true),qf=fr(function(n,t){return function(r){return Lt(r,n,t)}}),Vf=fr(function(n,t){return function(r){return Lt(n,r,t)}}),Kf=Xr(c),Gf=Xr(u),Hf=Xr(h),Jf=re(),Yf=re(true),Qf=Qr(function(n,t){return n+t},0),Xf=ie("ceil"),nc=Qr(function(n,t){return n/t},1),tc=ie("floor"),rc=Qr(function(n,t){return n*t},1),ec=ie("round"),uc=Qr(function(n,t){return n-t},0);return An.after=function(n,t){if(typeof t!="function")throw new ti("Expected a function"); 11436return n=Eu(n),function(){if(1>--n)return t.apply(this,arguments)}},An.ary=eu,An.assign=df,An.assignIn=yf,An.assignInWith=bf,An.assignWith=xf,An.at=jf,An.before=uu,An.bind=Ho,An.bindAll=Nf,An.bindKey=Jo,An.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return ff(n)?n:[n]},An.chain=Ye,An.chunk=function(n,t,r){if(t=(r?Oe(n,t,r):t===T)?1:Ui(Eu(t),0),r=null==n?0:n.length,!r||1>t)return[];for(var e=0,u=0,i=Ku(Oi(r/t));e<r;)i[u++]=hr(n,e,e+=t);return i},An.compact=function(n){for(var t=-1,r=null==n?0:n.length,e=0,u=[];++t<r;){ 11437var i=n[t];i&&(u[e++]=i)}return u},An.concat=function(){var n=arguments.length;if(!n)return[];for(var t=Ku(n-1),r=arguments[0];n--;)t[n-1]=arguments[n];return a(ff(r)?Ur(r):[r],wt(t,1))},An.cond=function(t){var r=null==t?0:t.length,e=ye();return t=r?c(t,function(n){if("function"!=typeof n[1])throw new ti("Expected a function");return[e(n[0]),n[1]]}):[],fr(function(e){for(var u=-1;++u<r;){var i=t[u];
11437if(n(i[0],this,e))return n(i[1],this,e)}})},An.conforms=function(n){return vt(_t(n,1))},An.constant=Tu, 11438An.countBy=$o,An.create=function(n,t){var r=eo(n);return null==t?r:at(r,t)},An.curry=iu,An.curryRight=ou,An.debounce=fu,An.defaults=wf,An.defaultsDeep=mf,An.defer=Yo,An.delay=Qo,An.difference=wo,An.differenceBy=mo,An.differenceWith=Ao,An.drop=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Eu(t),hr(n,0>t?0:t,e)):[]},An.dropRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Eu(t),t=e-t,hr(n,0,0>t?0:t)):[]},An.dropRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true,true):[]; 11439},An.dropWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true):[]},An.fill=function(n,t,r,e){var u=null==n?0:n.length;if(!u)return[];for(r&&typeof r!="number"&&Oe(n,t,r)&&(r=0,e=u),u=n.length,r=Eu(r),0>r&&(r=-r>u?0:u+r),e=e===T||e>u?u:Eu(e),0>e&&(e+=u),e=r>e?0:ku(e);r<e;)n[r++]=t;return n},An.filter=function(n,t){return(ff(n)?i:jt)(n,ye(t,3))},An.flatMap=function(n,t){return wt(ru(n,t),1)},An.flatMapDeep=function(n,t){return wt(ru(n,t),$)},An.flatMapDepth=function(n,t,r){return r=r===T?1:Eu(r), 11440wt(ru(n,t),r)},An.flatten=Ze,An.flattenDeep=function(n){return(null==n?0:n.length)?wt(n,$):[]},An.flattenDepth=function(n,t){return null!=n&&n.length?(t=t===T?1:Eu(t),wt(n,t)):[]},An.flip=function(n){return fe(n,512)},An.flow=Pf,An.flowRight=Zf,An.fromPairs=function(n){for(var t=-1,r=null==n?0:n.length,e={};++t<r;){var u=n[t];e[u[0]]=u[1]}return e},An.functions=function(n){return null==n?[]:Et(n,Wu(n))},An.functionsIn=function(n){return null==n?[]:Et(n,Bu(n))},An.groupBy=Po,An.initial=function(n){ 11441return(null==n?0:n.length)?hr(n,0,-1):[]},An.intersection=Eo,An.intersectionBy=ko,An.intersectionWith=So,An.invert=Af,An.invertBy=Ef,An.invokeMap=Zo,An.iteratee=Fu,An.keyBy=qo,An.keys=Wu,An.keysIn=Bu,An.map=ru,An.mapKeys=function(n,t){var r={};return t=ye(t,3),mt(n,function(n,e,u){st(r,t(n,e,u),n)}),r},An.mapValues=function(n,t){var r={};return t=ye(t,3),mt(n,function(n,e,u){st(r,e,t(n,e,u))}),r},An.matches=function(n){return Ht(_t(n,1))},An.matchesProperty=function(n,t){return Jt(n,_t(t,1))},An.memoize=cu, 11442An.merge=Sf,An.mergeWith=Of,An.method=qf,An.methodOf=Vf,An.mixin=Nu,An.negate=au,An.nthArg=function(n){return n=Eu(n),fr(function(t){return Qt(t,n)})},An.omit=If,An.omitBy=function(n,t){return Lu(n,au(ye(t)))},An.once=function(n){return uu(2,n)},An.orderBy=function(n,t,r,e){return null==n?[]:(ff(t)||(t=null==t?[]:[t]),r=e?T:r,ff(r)||(r=null==r?[]:[r]),Xt(n,t,r))},An.over=Kf,An.overArgs=Xo,An.overEvery=Gf,An.overSome=Hf,An.partial=nf,An.partialRight=tf,An.partition=Vo,An.pick=Rf,An.pickBy=Lu,An.property=Zu, 11443An.propertyOf=function(n){return function(t){return null==n?T:kt(n,t)}},An.pull=Oo,An.pullAll=Ke,An.pullAllBy=function(n,t,r){return n&&n.length&&t&&t.length?er(n,t,ye(r,2)):n},An.pullAllWith=function(n,t,r){return n&&n.length&&t&&t.length?er(n,t,T,r):n},An.pullAt=Io,An.range=Jf,An.rangeRight=Yf,An.rearg=rf,An.reject=function(n,t){return(ff(n)?i:jt)(n,au(ye(t,3)))},An.remove=function(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],i=n.length;for(t=ye(t,3);++e<i;){var o=n[e];t(o,e,n)&&(r.push(o), 11444u.push(e))}return ur(n,u),r},An.rest=function(n,t){if(typeof n!="function")throw new ti("Expected a function");return t=t===T?t:Eu(t),fr(n,t)},An.reverse=Ge,An.sampleSize=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:Eu(t),(ff(n)?et:ar)(n,t)},An.set=function(n,t,r){return null==n?n:lr(n,t,r)},An.setWith=function(n,t,r,e){return e=typeof e=="function"?e:T,null==n?n:lr(n,t,r,e)},An.shuffle=function(n){return(ff(n)?ut:sr)(n)},An.slice=function(n,t,r){var e=null==n?0:n.length;return e?(r&&typeof r!="number"&&Oe(n,t,r)?(t=0, 11445r=e):(t=null==t?0:Eu(t),r=r===T?e:Eu(r)),hr(n,t,r)):[]},An.sortBy=Ko,An.sortedUniq=function(n){return n&&n.length?gr(n):[]},An.sortedUniqBy=function(n,t){return n&&n.length?gr(n,ye(t,2)):[]},An.split=function(n,t,r){return r&&typeof r!="number"&&Oe(n,t,r)&&(t=r=T),r=r===T?4294967295:r>>>0,r?(n=Iu(n))&&(typeof t=="string"||null!=t&&!hf(t))&&(t=yr(t),!t&&Rn.test(n))?Or(M(n),0,r):n.split(t,r):[]},An.spread=function(t,r){if(typeof t!="function")throw new ti("Expected a function");return r=null==r?0:Ui(Eu(r),0), 11446fr(function(e){var u=e[r];return e=Or(e,0,r),u&&a(e,u),n(t,this,e)})},An.tail=function(n){var t=null==n?0:n.length;return t?hr(n,1,t):[]},An.take=function(n,t,r){return n&&n.length?(t=r||t===T?1:Eu(t),hr(n,0,0>t?0:t)):[]},An.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Eu(t),t=e-t,hr(n,0>t?0:t,e)):[]},An.takeRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),false,true):[]},An.takeWhile=function(n,t){return n&&n.length?jr(n,ye(t,3)):[]},An.tap=function(n,t){return t(n), 11447n},An.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new ti("Expected a function");return du(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),fu(n,t,{leading:e,maxWait:t,trailing:u})},An.thru=Qe,An.toArray=mu,An.toPairs=zf,An.toPairsIn=Wf,An.toPath=function(n){return ff(n)?c(n,Me):wu(n)?[n]:Ur(jo(Iu(n)))},An.toPlainObject=Ou,An.transform=function(n,t,e){var u=ff(n),i=u||af(n)||_f(n);if(t=ye(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:du(n)&&_u(o)?eo(di(n)):{}; 11448}return(i?r:mt)(n,function(n,r,u){return t(e,n,r,u)}),e},An.unary=function(n){return eu(n,1)},An.union=Ro,An.unionBy=zo,An.unionWith=Wo,An.uniq=function(n){return n&&n.length?br(n):[]},An.uniqBy=function(n,t){return n&&n.length?br(n,ye(t,2)):[]},An.uniqWith=function(n,t){return t=typeof t=="function"?t:T,n&&n.length?br(n,T,t):[]},An.unset=function(n,t){return null==n||xr(n,t)},An.unzip=He,An.unzipWith=Je,An.update=function(n,t,r){return null==n?n:lr(n,t,kr(r)(kt(n,t)),void 0)},An.updateWith=function(n,t,r,e){ 11449return e=typeof e=="function"?e:T,null!=n&&(n=lr(n,t,kr(r)(kt(n,t)),e)),n},An.values=Uu,An.valuesIn=function(n){return null==n?[]:S(n,Bu(n))},An.without=Bo,An.words=Mu,An.wrap=function(n,t){return nf(kr(t),n)},An.xor=Lo,An.xorBy=Uo,An.xorWith=Co,An.zip=Do,An.zipObject=function(n,t){return Ar(n||[],t||[],ot)},An.zipObjectDeep=function(n,t){return Ar(n||[],t||[],lr)},An.zipWith=Mo,An.entries=zf,An.entriesIn=Wf,An.extend=yf,An.extendWith=bf,Nu(An,An),An.add=Qf,An.attempt=Ff,An.camel
11449Case=Bf,An.capitalize=Cu, 11450An.ceil=Xf,An.clamp=function(n,t,r){return r===T&&(r=t,t=T),r!==T&&(r=Su(r),r=r===r?r:0),t!==T&&(t=Su(t),t=t===t?t:0),pt(Su(n),t,r)},An.clone=function(n){return _t(n,4)},An.cloneDeep=function(n){return _t(n,5)},An.cloneDeepWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,5,t)},An.cloneWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,4,t)},An.conformsTo=function(n,t){return null==t||gt(n,t,Wu(t))},An.deburr=Du,An.defaultTo=function(n,t){return null==n||n!==n?t:n},An.divide=nc,An.endsWith=function(n,t,r){ 11451n=Iu(n),t=yr(t);var e=n.length,e=r=r===T?e:pt(Eu(r),0,e);return r-=t.length,0<=r&&n.slice(r,e)==t},An.eq=lu,An.escape=function(n){return(n=Iu(n))&&H.test(n)?n.replace(K,nt):n},An.escapeRegExp=function(n){return(n=Iu(n))&&en.test(n)?n.replace(rn,"\\$&"):n},An.every=function(n,t,r){var e=ff(n)?u:bt;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.find=Fo,An.findIndex=Ne,An.findKey=function(n,t){return p(n,ye(t,3),mt)},An.findLast=No,An.findLastIndex=Pe,An.findLastKey=function(n,t){return p(n,ye(t,3),At); 11452},An.floor=tc,An.forEach=nu,An.forEachRight=tu,An.forIn=function(n,t){return null==n?n:oo(n,ye(t,3),Bu)},An.forInRight=function(n,t){return null==n?n:fo(n,ye(t,3),Bu)},An.forOwn=function(n,t){return n&&mt(n,ye(t,3))},An.forOwnRight=function(n,t){return n&&At(n,ye(t,3))},An.get=Ru,An.gt=ef,An.gte=uf,An.has=function(n,t){return null!=n&&we(n,t,Rt)},An.hasIn=zu,An.head=qe,An.identity=$u,An.includes=function(n,t,r,e){return n=su(n)?n:Uu(n),r=r&&!e?Eu(r):0,e=n.length,0>r&&(r=Ui(e+r,0)),ju(n)?r<=e&&-1<n.indexOf(t,r):!!e&&-1<v(n,t,r); 11453},An.indexOf=function(n,t,r){var e=null==n?0:n.length;return e?(r=null==r?0:Eu(r),0>r&&(r=Ui(e+r,0)),v(n,t,r)):-1},An.inRange=function(n,t,r){return t=Au(t),r===T?(r=t,t=0):r=Au(r),n=Su(n),n>=Ci(t,r)&&n<Ui(t,r)},An.invoke=kf,An.isArguments=of,An.isArray=ff,An.isArrayBuffer=cf,An.isArrayLike=su,An.isArrayLikeObject=hu,An.isBoolean=function(n){return true===n||false===n||yu(n)&&"[object Boolean]"==Ot(n)},An.isBuffer=af,An.isDate=lf,An.isElement=function(n){return yu(n)&&1===n.nodeType&&!xu(n)},An.isEmpty=function(n){ 11454if(null==n)return true;if(su(n)&&(ff(n)||typeof n=="string"||typeof n.splice=="function"||af(n)||_f(n)||of(n)))return!n.length;var t=vo(n);if("[object Map]"==t||"[object Set]"==t)return!n.size;if(ze(n))return!Vt(n).length;for(var r in n)if(oi.call(n,r))return false;return true},An.isEqual=function(n,t){return Mt(n,t)},An.isEqualWith=function(n,t,r){var e=(r=typeof r=="function"?r:T)?r(n,t):T;return e===T?Mt(n,t,T,r):!!e},An.isError=pu,An.isFinite=function(n){return typeof n=="number"&&Wi(n)},An.isFunction=_u, 11455An.isInteger=vu,An.isLength=gu,An.isMap=sf,An.isMatch=function(n,t){return n===t||$t(n,t,xe(t))},An.isMatchWith=function(n,t,r){return r=typeof r=="function"?r:T,$t(n,t,xe(t),r)},An.isNaN=function(n){return bu(n)&&n!=+n},An.isNative=function(n){if(go(n))throw new Hu("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ft(n)},An.isNil=function(n){return null==n},An.isNull=function(n){return null===n},An.isNumber=bu,An.isObject=du,An.isObjectLike=yu,An.isPlainObject=xu,An.isRegExp=hf, 11456An.isSafeInteger=function(n){return vu(n)&&-9007199254740991<=n&&9007199254740991>=n},An.isSet=pf,An.isString=ju,An.isSymbol=wu,An.isTypedArray=_f,An.isUndefined=function(n){return n===T},An.isWeakMap=function(n){return yu(n)&&"[object WeakMap]"==vo(n)},An.isWeakSet=function(n){return yu(n)&&"[object WeakSet]"==Ot(n)},An.join=function(n,t){return null==n?"":Bi.call(n,t)},An.kebabCase=Lf,An.last=Ve,An.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;if(r!==T&&(u=Eu(r),u=0>u?Ui(e+u,0):Ci(u,e-1)), 11457t===t){for(r=u+1;r--&&n[r]!==t;);n=r}else n=_(n,d,u,true);return n},An.lowerCase=Uf,An.lowerFirst=Cf,An.lt=vf,An.lte=gf,An.max=function(n){return n&&n.length?xt(n,$u,It):T},An.maxBy=function(n,t){return n&&n.length?xt(n,ye(t,2),It):T},An.mean=function(n){return y(n,$u)},An.meanBy=function(n,t){return y(n,ye(t,2))},An.min=function(n){return n&&n.length?xt(n,$u,Kt):T},An.minBy=function(n,t){return n&&n.length?xt(n,ye(t,2),Kt):T},An.stubArray=qu,An.stubFalse=Vu,An.stubObject=function(){return{}},An.stubString=function(){ 11458return""},An.stubTrue=function(){return true},An.multiply=rc,An.nth=function(n,t){return n&&n.length?Qt(n,Eu(t)):T},An.noConflict=function(){return $n._===this&&($n._=si),this},An.noop=Pu,An.now=Go,An.pad=function(n,t,r){n=Iu(n);var e=(t=Eu(t))?D(n):0;return!t||e>=t?n:(t=(t-e)/2,ne(Ii(t),r)+n+ne(Oi(t),r))},An.padEnd=function(n,t,r){n=Iu(n);var e=(t=Eu(t))?D(n):0;return t&&e<t?n+ne(t-e,r):n},An.padStart=function(n,t,r){n=Iu(n);var e=(t=Eu(t))?D(n):0;return t&&e<t?ne(t-e,r)+n:n},An.parseInt=function(n,t,r){ 11459return r||null==t?t=0:t&&(t=+t),Mi(Iu(n).replace(on,""),t||0)},An.random=function(n,t,r){if(r&&typeof r!="boolean"&&Oe(n,t,r)&&(t=r=T),r===T&&(typeof t=="boolean"?(r=t,t=T):typeof n=="boolean"&&(r=n,n=T)),n===T&&t===T?(n=0,t=1):(n=Au(n),t===T?(t=n,n=0):t=Au(t)),n>t){var e=n;n=t,t=e}return r||n%1||t%1?(r=Ti(),Ci(n+r*(t-n+Cn("1e-"+((r+"").length-1))),t)):ir(n,t)},An.reduce=function(n,t,r){var e=ff(n)?l:j,u=3>arguments.length;return e(n,ye(t,4),r,u,uo)},An.reduceRight=function(n,t,r){var e=ff(n)?s:j,u=3>arguments.length; 11460return e(n,ye(t,4),r,u,io)},An.repeat=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:Eu(t),or(Iu(n),t)},An.replace=function(){var n=arguments,t=Iu(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},An.result=function(n,t,r){t=Sr(t,n);var e=-1,u=t.length;for(u||(u=1,n=T);++e<u;){var i=null==n?T:n[Me(t[e])];i===T&&(e=u,i=r),n=_u(i)?i.call(n):i}return n},An.round=ec,An.runInContext=x,An.sample=function(n){return(ff(n)?Qn:cr)(n)},An.size=function(n){if(null==n)return 0;if(su(n))return ju(n)?D(n):n.length; 11461var t=vo(n);return"[object Map]"==t||"[object Set]"==t?n.size:Vt(n).length},An.snakeCase=Df,An.some=function(n,t,r){var e=ff(n)?h:pr;
11461return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.sortedIndex=function(n,t){return _r(n,t)},An.sortedIndexBy=function(n,t,r){return vr(n,t,ye(r,2))},An.sortedIndexOf=function(n,t){var r=null==n?0:n.length;if(r){var e=_r(n,t);if(e<r&&lu(n[e],t))return e}return-1},An.sortedLastIndex=function(n,t){return _r(n,t,true)},An.sortedLastIndexBy=function(n,t,r){return vr(n,t,ye(r,2),true); 11462},An.sortedLastIndexOf=function(n,t){if(null==n?0:n.length){var r=_r(n,t,true)-1;if(lu(n[r],t))return r}return-1},An.startCase=Mf,An.startsWith=function(n,t,r){return n=Iu(n),r=null==r?0:pt(Eu(r),0,n.length),t=yr(t),n.slice(r,r+t.length)==t},An.subtract=uc,An.sum=function(n){return n&&n.length?m(n,$u):0},An.sumBy=function(n,t){return n&&n.length?m(n,ye(t,2)):0},An.template=function(n,t,r){var e=An.templateSettings;r&&Oe(n,t,r)&&(t=T),n=Iu(n),t=bf({},t,e,ce),r=bf({},t.imports,e.imports,ce);var u,i,o=Wu(r),f=S(r,o),c=0; 11463r=t.interpolate||jn;var a="__p+='";r=Xu((t.escape||jn).source+"|"+r.source+"|"+(r===Q?pn:jn).source+"|"+(t.evaluate||jn).source+"|$","g");var l=oi.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/[\r\n]/g," ")+"\n":"";if(n.replace(r,function(t,r,e,o,f,l){return e||(e=o),a+=n.slice(c,l).replace(wn,z),r&&(u=true,a+="'+__e("+r+")+'"),f&&(i=true,a+="';"+f+";\n__p+='"),e&&(a+="'+((__t=("+e+"))==null?'':__t)+'"),c=l+t.length,t}),a+="';",(t=oi.call(t,"variable")&&t.variable)||(a="with(obj){"+a+"}"), 11464a=(i?a.replace(P,""):a).replace(Z,"$1").replace(q,"$1;"),a="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+a+"return __p}",t=Ff(function(){return Ju(o,l+"return "+a).apply(T,f)}),t.source=a,pu(t))throw t;return t},An.times=function(n,t){if(n=Eu(n),1>n||9007199254740991<n)return[];var r=4294967295,e=Ci(n,4294967295);for(t=ye(t),n-=4294967295,e=A(e,t);++r<n;)t(r);return e},An.toFinite=Au, 11465An.toInteger=Eu,An.toLength=ku,An.toLower=function(n){return Iu(n).toLowerCase()},An.toNumber=Su,An.toSafeInteger=function(n){return n?pt(Eu(n),-9007199254740991,9007199254740991):0===n?n:0},An.toString=Iu,An.toUpper=function(n){return Iu(n).toUpperCase()},An.trim=function(n,t,r){return(n=Iu(n))&&(r||t===T)?n.replace(un,""):n&&(t=yr(t))?(n=M(n),r=M(t),t=I(n,r),r=R(n,r)+1,Or(n,t,r).join("")):n},An.trimEnd=function(n,t,r){return(n=Iu(n))&&(r||t===T)?n.replace(fn,""):n&&(t=yr(t))?(n=M(n),t=R(n,M(t))+1, 11466Or(n,0,t).join("")):n},An.trimStart=function(n,t,r){return(n=Iu(n))&&(r||t===T)?n.replace(on,""):n&&(t=yr(t))?(n=M(n),t=I(n,M(t)),Or(n,t).join("")):n},An.truncate=function(n,t){var r=30,e="...";if(du(t))var u="separator"in t?t.separator:u,r="length"in t?Eu(t.length):r,e="omission"in t?yr(t.omission):e;n=Iu(n);var i=n.length;if(Rn.test(n))var o=M(n),i=o.length;if(r>=i)return n;if(i=r-D(e),1>i)return e;if(r=o?Or(o,0,i).join(""):n.slice(0,i),u===T)return r+e;if(o&&(i+=r.length-i),hf(u)){if(n.slice(i).search(u)){ 11467var f=r;for(u.global||(u=Xu(u.source,Iu(_n.exec(u))+"g")),u.lastIndex=0;o=u.exec(f);)var c=o.index;r=r.slice(0,c===T?i:c)}}else n.indexOf(yr(u),i)!=i&&(u=r.lastIndexOf(u),-1<u&&(r=r.slice(0,u)));return r+e},An.unescape=function(n){return(n=Iu(n))&&G.test(n)?n.replace(V,tt):n},An.uniqueId=function(n){var t=++fi;return Iu(n)+t},An.upperCase=Tf,An.upperFirst=$f,An.each=nu,An.eachRight=tu,An.first=qe,Nu(An,function(){var n={};return mt(An,function(t,r){oi.call(An.prototype,r)||(n[r]=t)}),n}(),{chain:false 11468}),An.VERSION="4.17.15",r("bind bindKey curry curryRight partial partialRight".split(" "),function(n){An[n].placeholder=An}),r(["drop","take"],function(n,t){Un.prototype[n]=function(r){r=r===T?1:Ui(Eu(r),0);var e=this.__filtered__&&!t?new Un(this):this.clone();return e.__filtered__?e.__takeCount__=Ci(r,e.__takeCount__):e.__views__.push({size:Ci(r,4294967295),type:n+(0>e.__dir__?"Right":"")}),e},Un.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){ 11469var r=t+1,e=1==r||3==r;Un.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:ye(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){var r="take"+(t?"Right":"");
11469Un.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Un.prototype[n]=function(){return this.__filtered__?new Un(this):this[r](1)}}),Un.prototype.compact=function(){return this.filter($u)},Un.prototype.find=function(n){ 11470return this.filter(n).head()},Un.prototype.findLast=function(n){return this.reverse().find(n)},Un.prototype.invokeMap=fr(function(n,t){return typeof n=="function"?new Un(this):this.map(function(r){return Lt(r,n,t)})}),Un.prototype.reject=function(n){return this.filter(au(ye(n)))},Un.prototype.slice=function(n,t){n=Eu(n);var r=this;return r.__filtered__&&(0<n||0>t)?new Un(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==T&&(t=Eu(t),r=0>t?r.dropRight(-t):r.take(t-n)),r)},Un.prototype.takeRightWhile=function(n){ 11471return this.reverse().takeWhile(n).reverse()},Un.prototype.toArray=function(){return this.take(4294967295)},mt(Un.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=An[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);u&&(An.prototype[t]=function(){function t(n){return n=u.apply(An,a([n],f)),e&&h?n[0]:n}var o=this.__wrapped__,f=e?[1]:arguments,c=o instanceof Un,l=f[0],s=c||ff(o);s&&r&&typeof l=="function"&&1!=l.length&&(c=s=false);var h=this.__chain__,p=!!this.__actions__.length,l=i&&!h,c=c&&!p; 11472return!i&&s?(o=c?o:new Un(this),o=n.apply(o,f),o.__actions__.push({func:Qe,args:[t],thisArg:T}),new On(o,h)):l&&c?n.apply(this,f):(o=this.thru(t),l?e?o.value()[0]:o.value():o)})}),r("pop push shift sort splice unshift".split(" "),function(n){var t=ri[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);An.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(ff(u)?u:[],n)}return this[r](function(r){return t.apply(ff(r)?r:[],n)}); 11473}}),mt(Un.prototype,function(n,t){var r=An[t];if(r){var e=r.name+"";oi.call(Gi,e)||(Gi[e]=[]),Gi[e].push({name:t,func:r})}}),Gi[Jr(T,2).name]=[{name:"wrapper",func:T}],Un.prototype.clone=function(){var n=new Un(this.__wrapped__);return n.__actions__=Ur(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Ur(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Ur(this.__views__),n},Un.prototype.reverse=function(){if(this.__filtered__){var n=new Un(this); 11474n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},Un.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=ff(t),u=0>r,i=e?t.length:0;n=i;for(var o=this.__views__,f=0,c=-1,a=o.length;++c<a;){var l=o[c],s=l.size;switch(l.type){case"drop":f+=s;break;case"dropRight":n-=s;break;case"take":n=Ci(n,f+s);break;case"takeRight":f=Ui(f,n-s)}}if(n={start:f,end:n},o=n.start,f=n.end,n=f-o,o=u?f:o-1,f=this.__iteratees__,c=f.length,a=0,l=Ci(n,this.__takeCount__),!e||!u&&i==n&&l==n)return wr(t,this.__actions__); 11475e=[];n:for(;n--&&a<l;){for(o+=r,u=-1,i=t[o];++u<c;){var h=f[u],s=h.type,h=(0,h.iteratee)(i);if(2==s)i=h;else if(!h){if(1==s)continue n;break n}}e[a++]=i}return e},An.prototype.at=To,An.prototype.chain=function(){return Ye(this)},An.prototype.commit=function(){return new On(this.value(),this.__chain__)},An.prototype.next=function(){this.__values__===T&&(this.__values__=mu(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){ 11476for(var t,r=this;r instanceof En;){var e=Fe(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Un?(this.__actions__.length&&(n=new Un(this)),n=n.reverse(),n.__actions__.push({func:Qe,args:[Ge],thisArg:T}),new On(n,this.__chain__)):this.thru(Ge)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head, 11477wi&&(An.prototype[wi]=Xe),An}();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($n._=rt, define('lodash',[],function(){return rt})):Nn?((Nn.exports=rt)._=rt,Fn._=rt):$n._=rt}).call(this); 11478define('const/devicetypeconst',[],function () { 11479 "use strict"; 11480 11481 //#import 11482 11483 //@implementation 11484 11485 /** 11486 * DeviceTypeConst 11487 * 11488 * @name DeviceTypeConst 11489 * 11490 */ 11491 var DeviceTypeConst = {}; 11492 11493 DeviceTypeConst.MOBILE = {}; 11494 DeviceTypeConst.MOBILE.name = 'mobile'; 11495 DeviceTypeConst.MOBILE.maxWidth = 750; 11496 DeviceTypeConst.MOBILE.minWidth = null; 11497 11498 DeviceTypeConst.TABLET = {}; 11499 DeviceTypeConst.TABLET.name = 'tablet'; 11500 DeviceTypeConst.TABLET.maxWidth = 1024; 11501 DeviceTypeConst.TABLET.minWidth = 751; 11502 11503 DeviceTypeConst.DESKTOP = {};
11504 DeviceTypeConst.DESKTOP.name = 'desktop'; 11505 DeviceTypeConst.DESKTOP.maxWidth = 1849; 11506 DeviceTypeConst.DESKTOP.minWidth = 1025; 11507 11508 DeviceTypeConst.FULLHD = {}; 11509 DeviceTypeConst.FULLHD.name = 'fullhd'; 11510 DeviceTypeConst.FULLHD.maxWidth = null; 11511 DeviceTypeConst.FULLHD.minWidth = 1850; 11512 11513 //Export 11514 return DeviceTypeConst; 11515 11516 //@end 11517}); 11518/*! 11519 * EventEmitter v4.2.11 - git.io/ee 11520 * Unlicense - http://unlicense.org/ 11521 * Oliver Caldwell - http://oli.me.uk/ 11522 * @preserve 11523 */ 11524 11525;(function () { 11526 'use strict'; 11527 11528 /** 11529 * Class for managing events. 11530 * Can be extended to provide event functionality in other classes. 11531 * 11532 * @class EventEmitter Manages event registering and emitting. 11533 */ 11534 function EventEmitter() {} 11535 11536 // Shortcuts to improve speed and size 11537 var proto = EventEmitter.prototype; 11538 var exports = this; 11539 var originalGlobalValue = exports.EventEmitter; 11540 11541 /** 11542 * Finds the index of the listener for the event in its storage array. 11543 * 11544 * @param {Function[]} listeners Array of listeners to search through. 11545 * @param {Function} listener Method to look for. 11546 * @return {Number} Index of the specified listener, -1 if not found 11547 * @api private 11548 */ 11549 function indexOfListener(listeners, listener) { 11550 var i = listeners.length; 11551 while (i--) { 11552 if (listeners[i].listener === listener) { 11553 return i; 11554 } 11555 } 11556 11557 return -1; 11558 } 11559 11560 /** 11561 * Alias a method while keeping the context correct, to allow for overwriting of target method. 11562 * 11563 * @param {String} name The name of the target method. 11564 * @return {Function} The aliased method 11565 * @api private 11566 */ 11567 function alias(name) { 11568 return function aliasClosure() { 11569 return this[name].apply(this, arguments); 11570 }; 11571 } 11572 11573 /** 11574 * Returns the listener array for the specified event. 11575 * Will initialise the event object and listener arrays if required. 11576 * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object c
11576ontaining bar and baz. But only if you have either defined them with defineEvent or added some listeners to them. 11577 * Each property in the object response is an array of listener functions. 11578 * 11579 * @param {String|RegExp} evt Name of the event to return the listeners from. 11580 * @return {Function[]|Object} All listener functions for the event. 11581 */ 11582 proto.getListeners = function getListeners(evt) { 11583 var events = this._getEvents(); 11584 var response; 11585 var key; 11586 11587 // Return a concatenated array of all matching events if 11588 // the selector is a regular expression. 11589 if (evt instanceof RegExp) { 11590 response = {}; 11591 for (key in events) { 11592 if (events.hasOwnProperty(key) && evt.test(key)) { 11593 response[key] = events[key]; 11594 } 11595 } 11596 } 11597 else { 11598 response = events[evt] || (events[evt] = []); 11599 } 11600 11601 return response; 11602 }; 11603 11604 /** 11605 * Takes a list of listener objects and flattens it into a list of listener functions. 11606 * 11607 * @param {Object[]} listeners Raw listener objects. 11608 * @return {Function[]} Just the listener functions. 11609 */ 11610 proto.flattenListeners = function flattenListeners(listeners) { 11611 var flatListeners = []; 11612 var i; 11613 11614 for (i = 0; i < listeners.length; i += 1) { 11615 flatListeners.push(listeners[i].listener); 11616 } 11617 11618 return flatListeners; 11619 }; 11620 11621 /** 11622 * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful. 11623 * 11624 * @param {String|RegExp} evt Name of the event to return the listeners from. 11625 * @return {Object} All listener functions for an event in an object. 11626 */ 11627 proto.getListenersAsObject = function getListenersAsObject(evt) { 11628 var listeners = this.getListeners(evt); 11629 var response; 11630 11631 if (listeners instanceof Array) { 11632 response = {}; 11633 response[evt] = listeners; 11634 } 11635 11636 return response || listeners; 11637 }; 11638 11639 /** 11640 * Adds a listener function to the specified event. 11641 * The listener will not be added if it is a duplicate. 11642 * If the listener returns true then it will be removed after it is called. 11643 * If you pass a regular expression as the event name then the listener will be added to all events that match it. 11644 * 11645 * @param {String|RegExp} evt Name of the event to attach the listener to. 11646 * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. 11647 * @return {Object} Current instance of EventEmitter for chaining. 11648 */ 11649 proto.addListener = function addListener(evt, listener) { 11650 var listeners = this.getListenersAsObject(evt); 11651 var listenerIsWrapped = typeof listener === 'object'; 11652 var key; 11653 11654 for (key in listeners) { 11655 if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) { 11656 listeners[key].push(listenerIsWrapped ? listener : { 11657 listener: listener, 11658 once: false 11659 }); 11660 } 11661 } 11662 11663 return this; 11664 }; 11665 11666 /** 11667 * Alias of addListener 11668 */ 11669 proto.on = alias('addListener'); 11670 11671 /** 11672 * Semi-alias of addListener. It will add a listener that will be 11673 * automatically removed after its first execution. 11674 * 11675 * @param {String|RegExp} evt Name of the event to attach the listener to. 11676 * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. 11677 * @return {Object} Current instance of EventEmitter for chaining. 11678 */ 11679 proto.addOnceListener = function addOnceListener(evt, listener) { 11680 return this.addListener(evt, { 11681 listener: listener, 11682 once: true 11683 }); 11684 }; 11685 11686 /** 11687 * Alias of addOnceListener. 11688 */ 11689 proto.once = alias('addOnceListener'); 11690 11691 /** 11692 * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad. 11693 * You need to tell it what event names should be matched by a regex. 11694 * 11695 * @param {String} evt Name of the event to create. 11696 * @return {Object} Current instance of EventEmitter for chaining. 11697 */ 11698 proto.defineEvent = function defineEvent(evt) { 11699 this.getListeners(evt); 11700 return this; 11701 }; 11702 11703 /** 11704 * Uses defineEvent to define multiple events. 11705 * 11706 * @param {String[]} evts An array of event names to define. 11707 * @return {Object} Current instance of EventEmitter for chaining. 11708 */ 11709 proto.defineEvents = function defineEvents(evts) { 11710 for (var i = 0; i < evts.length; i += 1) { 11711 this.defineEvent(evts[i]); 11712 } 11713 return this; 11714 }; 11715 11716 /** 11717 * Removes a listener function from the specified event. 11718 * When passed a regular expression as the event name, it will remove the listener from all events that match it. 11719 * 11720 * @param {String|RegExp} evt Name of the event to remove the listener from. 11721 * @param {Function} listener Method to remove from the event. 11722 * @return {Object} Current instance of EventEmitter for chaining. 11723 */ 11724 proto.removeListener = function removeListener(evt, listener) { 11725 var listeners = this.getListenersAsObject(evt); 11726 var index; 11727 var key; 11728 11729 for (key in listeners) { 11730 if (listeners.hasOwnProperty(key)) { 11731 index = indexOfListener(listeners[key], listener); 11732 11733 if (index !== -1) { 11734 listeners[key].splice(index, 1); 11735 } 11736 } 11737 } 11738 11739 return this; 11740 }; 11741 11742 /** 11743 * Alias of removeListener 11744 */ 11745 proto.off = alias('removeListener'); 11746 11747 /** 11748 * Adds listeners in bulk using the manipulateListeners method. 11749 * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added. 11750 * You can also pass it a regular expression to add the array of listeners to all events that match it. 11751 * Yeah, this function does quite a bit. That's probably a bad thing. 11752 * 11753 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once. 11754 * @param {Function[]} [listeners] An optional array of listener functions to add. 11755 * @return {Object} Current instance of EventEmitter for chaining. 11756 */ 11757 proto.addListeners = function addListeners(evt, listeners) { 11758 // Pass through to manipulateListeners 11759 return this.manipulateListeners(false, evt, listeners); 11760 }; 11761 11762 /** 11763 * Removes listeners in bulk using the manipulateListeners method. 11764 * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. 11765 * You can also pass it an event name and an array of listeners to be removed. 11766 * You can also pass it a regular expression to remove the listeners from all events that match it. 11767 * 11768 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once. 11769 * @param {Function[]} [listeners] An optional array of listener functions to remove. 11770 * @return {Object} Current instance of EventEmitter for chaining. 11771 */ 11772 proto.removeListeners = function removeListeners(evt, listeners) { 11773 // Pass through to manipulateListeners 11774 return this.manipulateListeners(true, evt, listeners); 11775 }; 11776 11777 /** 11778 * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level. 11779 * The first argument will determine if the listeners are removed (true) or added (false). 11780 * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. 11781 * You can also pass it an event name and an array of listeners to be added/removed. 11782 * You can also pass it a regular expression to manipulate the listeners of all events that match it. 11783 * 11784 * @param {Boolean} remove True if you want to remove listeners, false if you want to add. 11785 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once. 11786 * @param {Function[]} [listeners] An optional array of listener functions to add/remove. 11787 * @return {Object} Current instance of EventEmitter for chaining. 11788 */ 11789 proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) { 11790 var i; 11791 var value; 11792 var single = remove ? this.removeListener : this.addListener; 11793 var multiple = remove ? this.removeListeners : this.addListeners; 11794 11795 // If evt is an object then pass each of its properties to this method 11796 if (typeof evt === 'object' && !(evt instanceof RegExp)) { 11797 for (i in evt) { 11798 if (evt.hasOwnProperty(i) && (value = evt[i])) { 11799 // Pass the single listener straight through to the singular method 11800 if (typeof value === 'function') { 11801 single.call(this, i, value); 11802 } 11803 else { 11804 // Otherwise pass back to the multiple function 11805 multiple.call(this, i, value); 11806 } 11807 } 11808 } 11809 } 11810 else { 11811 // So evt must be a string 11812 // And listeners must be an array of listeners 11813 // Loop over it and pass each one to the multiple method 11814 i = listeners.length; 11815 while (i--) { 11816 single.call(this, evt, listeners[i]); 11817 } 11818 } 11819 11820 return this; 11821 }; 11822 11823 /** 11824 * Removes all listeners from a specified event. 11825 * If you do not specify an event then all listeners will be removed. 11826 * That means every event will be emptied. 11827 * You can also pass a regex to remove all events that match it. 11828 * 11829 * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed. 11830 * @return {Object} Current instance of EventEmitter for chaining. 11831 */ 11832 proto.removeEvent = function removeEvent(evt) { 11833 var type = typeof evt; 11834 var events = this._getEvents(); 11835 var key; 11836 11837 // Remove different things depending on the state of evt 11838 if (type === 'string') { 11839 // Remove all listeners for the specified event 11840 delete events[evt]; 11841 } 11842 else if (evt instanceof RegExp) { 11843 // Remove all events matching the regex. 11844 for (key in events) { 11845 if (events.hasOwnProperty(key) && evt.test(key)) { 11846 delete events[key]; 11847 } 11848 } 11849 } 11850 else { 11851 // Remove all listeners in all events 11852 delete this._events; 11853 } 11854 11855 return this; 11856 }; 11857 11858 /** 11859 * Alias of removeEvent. 11860 * 11861 * Added to mirror the node API. 11862 */ 11863 proto.removeAllListeners = alias('removeEvent'); 11864 11865 /** 11866 * Emits an event of your choice. 11867 * When emitted, every listener attached to that event will be executed. 11868 * If you pass the optional argument array then those arguments will be passed to every listener upon execution. 11869 * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately. 11870 * So they will not arrive within the array on the other side, they will be separate. 11871 * You can also pass a regular expression to emit to all events that match it. 11872 * 11873 * @param {String|RegExp} evt Name of the event to emit and execute listeners for. 11874 * @param {Array} [args] Optional array of arguments to be passed to each listener. 11875 * @return {Object} Current instance of EventEmitter for chaining. 11876 */ 11877 proto.emitEvent = function emitEvent(evt, args) { 11878 var listenersMap = this.getListenersAsObject(evt); 11879 var listeners; 11880 var listener; 11881 var i; 11882 var key; 11883 var response; 11884 11885 for (key in listenersMap) { 11886 if (listenersMap.hasOwnProperty(key)) { 11887 listeners = listenersMap[key].slice(0); 11888 i = listeners.length; 11889 11890 while (i--) { 11891 // If the listener returns true then it shall be removed from the event 11892 // The function is executed either with a basic call or an apply if there is an args array 11893 listener = listeners[i]; 11894 11895 if (listener.once === true) { 11896 this.removeListener(evt, listener.listener); 11897 } 11898 11899 response = listener.listener.apply(this, args || []); 11900 11901 if (response === this._getOnceReturnValue()) { 11902 this.removeListener(evt, listener.listener); 11903 } 11904 } 11905 } 11906 } 11907 11908 return this; 11909 }; 11910 11911 /** 11912 * Alias of emitEvent 11913 */ 11914 proto.trigger = alias('emitEvent'); 11915 11916 /** 11917 * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on. 11918 * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it. 11919 * 11920 * @param {String|RegExp} evt Name of the event to emit and execute listeners for. 11921 * @param {...*} Optional additional arguments to be passed to each listener. 11922 * @return {Object} Current instance of EventEmitter for chaining. 11923 */ 11924 proto.emit = function emit(evt) { 11925 var args = Array.prototype.slice.call(arguments, 1); 11926 return this.emitEvent(evt, args); 11927 }; 11928 11929 /** 11930 * Sets the current value to check against when executing listeners. If a 11931 * listeners return value matches the one set here then it will be removed 11932 * after execution. This value defaults to true. 11933 * 11934 * @param {*} value The new value to check for when executing listeners. 11935 * @return {Object} Current instance of EventEmitter for chaining. 11936 */ 11937 proto.setOnceReturnValue = function setOnceReturnValue(value) { 11938 this._onceReturnValue = value; 11939 return this; 11940 }; 11941 11942 /** 11943 * Fetches the current value to check against when executing listeners. If 11944 * the listeners return value matches this one then it should be removed 11945 * automatically. It will return true by default. 11946 * 11947 * @return {*|Boolean} The current value to check for or the default, true. 11948 * @api private 11949 */ 11950 proto._getOnceReturnValue = function _getOnceReturnValue() { 11951 if (this.hasOwnProperty('_onceReturnValue')) { 11952 return this._onceReturnValue; 11953 } 11954 else { 11955 return true; 11956 } 11957 }; 11958 11959 /** 11960 * Fetches the events object and creates one if required. 11961 * 11962 * @return {Object} The events storage object. 11963 * @api private 11964 */ 11965 proto._getEvents = function _getEvents() { 11966 return this._events || (this._events = {}); 11967 }; 11968 11969 /** 11970 * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version. 11971 * 11972 * @return {Function} Non conflicting EventEmitter class. 11973 */ 11974 EventEmitter.noConflict = function noConflict() { 11975 exports.EventEmitter = originalGlobalValue; 11976 return EventEmitter; 11977 }; 11978 11979 // Expose the class either via AMD, CommonJS or the global object 11980 if (typeof define === 'function' && define.amd) { 11981 define('eventE
11981mitter/EventEmitter',[],function () { 11982 return EventEmitter; 11983 }); 11984 } 11985 else if (typeof module === 'object' && module.exports){ 11986 module.exports = EventEmitter; 11987 } 11988 else { 11989 exports.EventEmitter = EventEmitter; 11990 } 11991}.call(this)); 11992 11993define('core/layout',[ 11994 'jquery', 11995 'lodash', 11996 'const/devicetypeconst', 11997 'eventEmitter/EventEmitter' 11998], function ($, _, DeviceTypeConst, EventEmitter) { 11999 function Layout() { 12000 } 12001 12002 Layout.prototype = _.clone(EventEmitter.prototype); 12003 12004 var proto = Layout.prototype; 12005 12006 var $window = $(window); 12007 12008 proto.desktop = null; 12009 proto.tablet = null; 12010 proto.mobile = null; 12011 12012 function _init() { 12013 _checkType(); 12014 _bindResize(); 12015 } 12016 12017 function _checkType() { 12018 var width = $window.innerWidth(); 12019 var scrollPosition = $(window).scrollTop(); 12020 proto.fullhd = width >= DeviceTypeConst.FULLHD.minWidth; 12021 proto.desktop = width >= DeviceTypeConst.DESKTOP.minWidth && width <= DeviceTypeConst.DESKTOP.maxWidth; 12022 proto.tablet = width >= DeviceTypeConst.TABLET.minWidth && width <= DeviceTypeConst.TABLET.maxWidth; 12023 proto.mobile = width <= DeviceTypeConst.MOBILE.maxWidth; 12024 12025 proto.emitEvent('reload'); 12026 $(window).scrollTop(scrollPosition); 12027 } 12028 12029 function _bindResize() { 12030 var _lazyResize = _.debounce(_checkType, 300); 12031 $window.on('resize.Layout orientationchange.Layout', _lazyResize); 12032 } 12033 12034 function _reload() { 12035 _checkType(); 12036 12037 } 12038 12039 proto.init = _init; 12040 proto.reload = _reload; 12041 12042 return Layout; 12043}); 12044 12045/*! 12046 * eventie v1.0.6 12047 * event binding helper 12048 * eventie.bind( elem, 'click', myFn ) 12049 * eventie.unbind( elem, 'click', myFn ) 12050 * MIT license 12051 */ 12052 12053/*jshint browser: true, undef: true, unused: true */ 12054/*global define: false, module: false */ 12055 12056( function( window ) { 12057 12058 12059 12060var docElem = document.documentElement; 12061 12062var bind = function() {}; 12063 12064function getIEEvent( obj ) { 12065 var event = window.event; 12066 // add event.target 12067 event.target = event.target || event.srcElement || obj; 12068 return event; 12069} 12070 12071if ( docElem.addEventListener ) { 12072 bind = function( obj, type, fn ) { 12073 obj.addEventListener( type, fn, false ); 12074 }; 12075} else if ( docElem.attachEvent ) { 12076 bind = function( obj, type, fn ) { 12077 obj[ type + fn ] = fn.handleEvent ? 12078 function() { 12079 var event = getIEEvent( obj ); 12080 fn.handleEvent.call( fn, event ); 12081 } : 12082 function() { 12083 var event = getIEEvent( obj ); 12084 fn.call( obj, event ); 12085 }; 12086 obj.attachEvent( "on" + type, obj[ type + fn ] ); 12087 }; 12088} 12089 12090var unbind = function() {}; 12091 12092if ( docElem.removeEventListener ) { 12093 unbind = function( obj, type, fn ) { 12094 obj.removeEventListener( type, fn, false ); 12095 }; 12096} else if ( docElem.detachEvent ) { 12097 unbind = function( obj, type, fn ) { 12098 obj.detachEvent( "on" + type, obj[ type + fn ] ); 12099 try { 12100 delete obj[ type + fn ]; 12101 } catch ( err ) { 12102 // can't delete window object properties 12103 obj[ type + fn ] = undefined; 12104 } 12105 }; 12106} 12107 12108var eventie = { 12109 bind: bind, 12110 unbind: unbind 12111}; 12112 12113// ----- module definition ----- // 12114 12115if ( typeof define === 'function' && define.amd ) { 12116 // AMD 12117 define( 'eventie/eventie',eventie ); 12118} else if ( typeof exports === 'object' ) { 12119 // CommonJS 12120 module.exports = eventie; 12121} else { 12122 // browser global 12123 window.eventie = eventie; 12124} 12125 12126})( window ); 12127 12128/*! 12129 * getStyleProperty v1.0.4 12130 * original by kangax 12131 * http://perfectionkills.com/feature-testing-css-properties/ 12132 * MIT license 12133 */ 12134 12135/*jshint browser: true, strict: true, undef: true */ 12136/*global define: false, exports: false, module: false */ 12137 12138( function( window ) { 12139 12140 12141 12142var prefixes = 'Webkit Moz ms Ms O'.split(' '); 12143var docElemStyle = document.documentElement.style; 12144 12145function getStyleProperty( propName ) { 12146 if ( !propName ) { 12147 return; 12148 } 12149 12150 // test standard property first 12151 if ( typeof docElemStyle[ propName ] === 'string' ) { 12152 return propName; 12153 } 12154 12155 // capitalize 12156 propName = propName.charAt(0).toUpperCase() + propName.slice(1); 12157 12158 // test vendor specific properties 12159 var prefixed; 12160 for ( var i=0, len = prefixes.length; i < len; i++ ) { 12161 prefixed = prefixes[i] + propName; 12162 if ( typeof docElemStyle[ prefixed ] === 'string' ) { 12163 return prefixed; 12164 } 12165 } 12166} 12167 12168// transport 12169if ( typeof define === 'function' && define.amd ) { 12170 // AMD 12171 define( 'get-style-property/get-style-property',[],function() { 12172 return getStyleProperty; 12173 }); 12174} else if ( typeof exports === 'object' ) { 12175 // CommonJS for Component 12176 module.exports = getStyleProperty; 12177} else { 12178 // browser global 12179 window.getStyleProperty = getStyleProperty; 12180} 12181 12182})( window ); 12183 12184/*! 12185 * getSize v1.2.2 12186 * measure size of elements 12187 * MIT license 12188 */ 12189 12190/*jshint browser: true, strict: true, undef: true, unused: true */ 12191/*global define: false, exports: false, require: false, module: false, console: false */ 12192 12193( function( window, undefined ) { 12194 12195 12196 12197// -------------------------- helpers -------------------------- // 12198 12199// get a number from a string, not a percentage 12200function getStyleSize( value ) { 12201 var num = parseFloat( value ); 12202 // not a percent like '100%', and a number 12203 var isValid = value.indexOf('%') === -1 && !isNaN( num ); 12204 return isValid && num; 12205} 12206 12207function noop() {} 12208 12209var logError = typeof console === 'undefined' ? noop : 12210 function( message ) { 12211 console.error( message ); 12212 }; 12213 12214// -------------------------- measurements -------------------------- // 12215 12216var measurements = [ 12217 'paddingLeft', 12218 'paddingRight', 12219 'paddingTop', 12220 'paddingBottom', 12221 'marginLeft', 12222 'marginRight', 12223 'marginTop', 12224 'marginBottom', 12225 'borderLeftWidth', 12226 'borderRightWidth', 12227 'borderTopWidth', 12228 'borderBottomWidth' 12229]; 12230 12231function getZeroSize() { 12232 var size = { 12233 width: 0, 12234 height: 0, 12235 innerWidth: 0, 12236 innerHeight: 0, 12237 outerWidth: 0, 12238 outerHeight: 0 12239 }; 12240 for ( var i=0, len = measurements.length; i < len; i++ ) { 12241 var measurement = measurements[i]; 12242 size[ measurement ] = 0; 12243 } 12244 return size; 12245} 12246 12247 12248 12249function defineGetSize( getStyleProperty ) { 12250 12251// -------------------------- setup -------------------------- // 12252 12253var isSetup = false;
12254 12255var getStyle, boxSizingProp, isBoxSizeOuter; 12256 12257/** 12258 * setup vars and functions 12259 * do it on initial getSize(), rather than on script load 12260 * For Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=548397 12261 */ 12262function setup() { 12263 // setup once 12264 if ( isSetup ) { 12265 return; 12266 } 12267 isSetup = true; 12268 12269 var getComputedStyle = window.getComputedStyle; 12270 getStyle = ( function() { 12271 var getStyleFn = getComputedStyle ? 12272 function( elem ) { 12273 return getComputedStyle( elem, null ); 12274 } : 12275 function( elem ) { 12276 return elem.currentStyle; 12277 }; 12278 12279 return function getStyle( elem ) { 12280 var style = getStyleFn( elem ); 12281 if ( !style ) { 12282 logError( 'Style returned ' + style + 12283 '. Are you running this code in a hidden iframe on Firefox? ' + 12284 'See http://bit.ly/getsizebug1' ); 12285 } 12286 return style; 12287 }; 12288 })(); 12289 12290 // -------------------------- box sizing -------------------------- // 12291 12292 boxSizingProp = getStyleProperty('boxSizing'); 12293 12294 /** 12295 * WebKit measures the outer-width on style.width on border-box elems 12296 * IE & Firefox measures the inner-width 12297 */ 12298 if ( boxSizingProp ) { 12299 var div = document.createElement('div'); 12300 div.style.width = '200px'; 12301 div.style.padding = '1px 2px 3px 4px'; 12302 div.style.borderStyle = 'solid'; 12303 div.style.borderWidth = '1px 2px 3px 4px'; 12304 div.style[ boxSizingProp ] = 'border-box'; 12305 12306 var body = document.body || document.documentElement; 12307 body.appendChild( div ); 12308 var style = getStyle( div ); 12309 12310 isBoxSizeOuter = getStyleSize( style.width ) === 200; 12311 body.removeChild( div ); 12312 } 12313 12314} 12315 12316// -------------------------- getSize -------------------------- // 12317 12318function getSize( elem ) { 12319 setup(); 12320 12321 // use querySeletor if elem is string 12322 if ( typeof elem === 'string' ) { 12323 elem = document.querySelector( elem ); 12324 } 12325 12326 // do not proceed on non-objects 12327 if ( !elem || typeof elem !== 'object' || !elem.nodeType ) { 12328 return; 12329 } 12330 12331 var style = getStyle( elem ); 12332 12333 // if hidden, everything is 0 12334 if ( style.display === 'none' ) { 12335 return getZeroSize(); 12336 } 12337 12338 var size = {}; 12339 size.width = elem.offsetWidth; 12340 size.height = elem.offsetHeight; 12341 12342 var isBorderBox = size.isBorderBox = !!( boxSizingProp && 12343 style[ boxSizingProp ] && style[ boxSizingProp ] === 'border-box' ); 12344 12345 // get all measurements 12346 for ( var i=0, len = measurements.length; i < len; i++ ) { 12347 var measurement = measurements[i]; 12348 var value = style[ measurement ]; 12349 value = mungeNonPixel( elem, value ); 12350 var num = parseFloat( value ); 12351 // any 'auto', 'medium' value will be 0 12352 size[ measurement ] = !isNaN( num ) ? num : 0; 12353 } 12354 12355 var paddingWidth = size.paddingLeft + size.paddingRight; 12356 var paddingHeight = size.paddingTop + size.paddingBottom; 12357 var marginWidth = size.marginLeft + size.marginRight; 12358 var marginHeight = size.marginTop + size.marginBottom; 12359 var borderWidth = size.borderLeftWidth + size.borderRightWidth; 12360 var borderHeight = size.borderTopWidth + size.borderBottomWidth; 12361 12362 var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter; 12363 12364 // overwrite width and height if we can get it from style 12365 var styleWidth = getStyleSize( style.width ); 12366 if ( styleWidth !== false ) { 12367 size.width = styleWidth + 12368 // add padding and border unless it's already including it 12369 ( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth ); 12370 } 12371 12372 var styleHeight = getStyleSize( style.height ); 12373 if ( styleHeight !== false ) { 12374 size.height = styleHeight + 12375 // add padding and border unless it's already including it 12376 ( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight ); 12377 } 12378 12379 size.innerWidth = size.width - ( paddingWidth + borderWidth ); 12380 size.innerHeight = size.height - ( paddingHeight + borderHeight ); 12381 12382 size.outerWidth = size.width + marginWidth; 12383 size.outerHeight = size.height + marginHeight; 12384 12385 return size; 12386} 12387 12388// IE8 returns percent values, not pixels 12389// taken from jQuery's curCSS 12390function mungeNonPixel( elem, value ) { 12391 // IE8 and has percent value 12392 if ( window.getComputedStyle || value.indexOf('%') === -1 ) { 12393 return value; 12394 } 12395 var style = elem.style; 12396 // Remember the original values 12397 var left = style.left; 12398 var rs = elem.runtimeStyle; 12399 var rsLeft = rs && rs.left; 12400 12401 // Put in the new values to get a computed value out 12402 if ( rsLeft ) { 12403 rs.left = elem.currentStyle.left; 12404 } 12405 style.left = value; 12406 value = style.pixelLeft; 12407 12408 // Revert the changed values 12409 style.left = left; 12410 if ( rsLeft ) { 12411 rs.left = rsLeft; 12412 } 12413 12414 return value; 12415} 12416 12417return getSize; 12418 12419} 12420 12421// transport 12422if ( typeof define === 'function' && define.amd ) { 12423 // AMD for RequireJS 12424 define( 'get-size/get-size',[ 'get-style-property/get-style-property' ], defineGetSize ); 12425} else if ( typeof exports === 'object' ) { 12426 // CommonJS for Component 12427 module.exports = defineGetSize( require('desandro-get-style-property') ); 12428} else { 12429 // browser global 12430 window.getSize = defineGetSize( window.getStyleProperty ); 12431} 12432 12433})( window ); 12434 12435/*! 12436 * docReady v1.0.4 12437 * Cross browser DOMContentLoaded event emitter 12438 * MIT license 12439 */ 12440 12441/*jshint browser: true, strict: true, undef: true, unused: true*/ 12442/*global define: false, require: false, module: false */ 12443 12444( function( window ) { 12445 12446 12447 12448var document = window.document; 12449// collection of functions to be triggered on ready 12450var queue = []; 12451 12452function docReady( fn ) { 12453 // throw out non-functions 12454 if ( typeof fn !== 'function' ) { 12455 return; 12456 } 12457 12458 if ( docReady.isReady ) { 12459 // ready now, hit it 12460 fn(); 12461 } else { 12462 // queue function when ready 12463 queue.push( fn ); 12464 } 12465} 12466 12467docReady.isReady = false;
12468 12469// triggered on various doc ready events 12470function onReady( event ) { 12471 // bail if already triggered or IE8 document is not ready just yet 12472 var isIE8NotReady = event.type === 'readystatechange' && document.readyState !== 'complete'; 12473 if ( docReady.isReady || isIE8NotReady ) { 12474 return; 12475 } 12476 12477 trigger(); 12478} 12479 12480function trigger() { 12481 docReady.isReady = true; 12482 // process queue 12483 for ( var i=0, len = queue.length; i < len; i++ ) { 12484 var fn = queue[i]; 12485 fn(); 12486 } 12487} 12488 12489function defineDocReady( eventie ) { 12490 // trigger ready if page is ready 12491 if ( document.readyState === 'complete' ) { 12492 trigger(); 12493 } else { 12494 // listen for events 12495 eventie.bind( document, 'DOMContentLoaded', onReady ); 12496 eventie.bind( document, 'readystatechange', onReady ); 12497 eventie.bind( window, 'load', onReady ); 12498 } 12499 12500 return docReady; 12501} 12502 12503// transport 12504if ( typeof define === 'function' && define.amd ) { 12505 // AMD 12506 define( 'doc-ready/doc-ready',[ 'eventie/eventie' ], defineDocReady ); 12507} else if ( typeof exports === 'object' ) { 12508 module.exports = defineDocReady( require('eventie') ); 12509} else { 12510 // browser global 12511 window.docReady = defineDocReady( window.eventie ); 12512} 12513 12514})( window ); 12515 12516/** 12517 * matchesSelector v1.0.3 12518 * matchesSelector( element, '.selector' ) 12519 * MIT license 12520 */ 12521 12522/*jshint browser: true, strict: true, undef: true, unused: true */ 12523/*global define: false, module: false */ 12524 12525( function( ElemProto ) { 12526 12527 'use strict'; 12528 12529 var matchesMethod = ( function() { 12530 // check for the standard method name first 12531 if ( ElemProto.matches ) { 12532 return 'matches'; 12533 } 12534 // check un-prefixed 12535 if ( ElemProto.matchesSelector ) { 12536 return 'matchesSelector'; 12537 } 12538 // check vendor prefixes 12539 var prefixes = [ 'webkit', 'moz', 'ms', 'o' ]; 12540 12541 for ( var i=0, len = prefixes.length; i < len; i++ ) { 12542 var prefix = prefixes[i]; 12543 var method = prefix + 'MatchesSelector'; 12544 if ( ElemProto[ method ] ) { 12545 return method; 12546 } 12547 } 12548 })(); 12549 12550 // ----- match ----- // 12551 12552 function match( elem, selector ) { 12553 return elem[ matchesMethod ]( selector ); 12554 } 12555 12556 // ----- appendToFragment ----- // 12557 12558 function checkParent( elem ) { 12559 // not needed if already has parent 12560 if ( elem.parentNode ) { 12561 return; 12562 } 12563 var fragment = document.createDocumentFragment(); 12564 fragment.appendChild( elem ); 12565 } 12566 12567 // ----- query ----- // 12568 12569 // fall back to using QSA 12570 // thx @jonathantneal https://gist.github.com/3062955 12571 function query( elem, selector ) { 12572 // append to fragment if no parent 12573 checkParent( elem ); 12574 12575 // match elem with all selected elems of parent 12576 var elems = elem.parentNode.querySelectorAll( selector ); 12577 for ( var i=0, len = elems.length; i < len; i++ ) { 12578 // return true if match 12579 if ( elems[i] === elem ) { 12580 return true; 12581 } 12582 } 12583 // otherwise return false 12584 return false; 12585 } 12586 12587 // ----- matchChild ----- // 12588 12589 function matchChild( elem, selector ) { 12590 checkParent( elem ); 12591 return match( elem, selector ); 12592 } 12593 12594 // ----- matchesSelector ----- // 12595 12596 var matchesSelector; 12597 12598 if ( matchesMethod ) { 12599 // IE9 supports matchesSelector, but doesn't work on orphaned elems 12600 // check for that 12601 var div = document.createElement('div'); 12602 var supportsOrphans = match( div, 'div' ); 12603 matchesSelector = supportsOrphans ? match : matchChild; 12604 } else { 12605 matchesSelector = query; 12606 } 12607 12608 // transport 12609 if ( typeof define === 'function' && define.amd ) { 12610 // AMD 12611 define( 'matches-selector/matches-selector',[],function() { 12612 return matchesSelector; 12613 }); 12614 } else if ( typeof exports === 'object' ) { 12615 module.exports = matchesSelector; 12616 } 12617 else { 12618 // browser global 12619 window.matchesSelector = matchesSelector; 12620 } 12621 12622})( Element.prototype ); 12623 12624/** 12625 * Fizzy UI utils v1.0.1 12626 * MIT license 12627 */ 12628 12629/*jshint browser: true, undef: true, unused: true, strict: true */ 12630 12631( function( window, factory ) { 12632 /*global define: false, module: false, require: false */ 12633 'use strict'; 12634 // universal module definition 12635 12636 if ( typeof define == 'function' && define.amd ) { 12637 // AMD 12638 define( 'fizzy-ui-utils/utils',[ 12639 'doc-ready/doc-ready', 12640 'matches-selector/matches-selector' 12641 ], function( docReady, matchesSelector ) { 12642 return factory( window, docReady, matchesSelector ); 12643 }); 12644 } else if ( typeof exports == 'object' ) { 12645 // CommonJS 12646 module.exports = factory( 12647 window, 12648 require('doc-ready'), 12649 require('desandro-matches-selector') 12650 ); 12651 } else { 12652 // browser global 12653 window.fizzyUIUtils = factory( 12654 window, 12655 window.docReady, 12656 window.matchesSelector 12657 ); 12658 } 12659 12660}( window, function factory( window, docReady, matchesSelector ) { 12661 12662 12663 12664var utils = {}; 12665 12666// ----- extend ----- // 12667 12668// extends objects 12669utils.extend = function( a, b ) { 12670 for ( var prop in b ) { 12671 a[ prop ] = b[ prop ]; 12672 } 12673 return a; 12674}; 12675 12676// ----- modulo ----- // 12677 12678utils.modulo = function( num, div ) { 12679 return ( ( num % div ) + div ) % div; 12680}; 12681 12682// ----- isArray ----- // 12683 12684var objToString = Object.prototype.toString; 12685utils.isArray = function( obj ) { 12686 return objToString.call( obj ) == '[object Array]'; 12687}; 12688 12689// ----- makeArray ----- // 12690 12691// turn element or nodeList into an array 12692utils.makeArray = function( obj ) { 12693 var ary = []; 12694 if ( utils.isArray( obj ) ) { 12695 // use object if already an array 12696 ary = obj; 12697 } else if ( obj && typeof obj.length == 'number' ) { 12698 // convert nodeList to array 12699 for ( var i=0, len = obj.length; i < len; i++ ) { 12700 ary.push( obj[i] ); 12701 } 12702 } else { 12703 // array of single index 12704 ary.push( obj ); 12705 } 12706 return ary; 12707}; 12708 12709// ----- indexOf ----- // 12710 12711// index of helper cause IE8 12712utils.indexOf = Array.prototype.indexOf ? function( ary, obj ) { 12713 return ary.indexOf( obj ); 12714 } : function( ary, obj ) { 12715 for ( var i=0, len = ary.length; i < len; i++ ) { 12716 if ( ary[i] === obj ) { 12717 return i; 12718 } 12719 } 12720 return -1; 12721 }; 12722 12723// ----- removeFrom ----- // 12724 12725utils.removeFrom = function( ary, obj ) { 12726 var index = utils.indexOf( ary, obj ); 12727 if ( index != -1 ) { 12728 ary.splice( index, 1 ); 12729 } 12730}; 12731 12732// ----- isElement ----- // 12733 12734// http://stackoverflow.com/a/384380/182183 12735utils.isElement = ( typeof HTMLElement == 'function' || typeof HTMLElement == 'object' ) ? 12736 function isElementDOM2( obj ) { 12737 return obj instanceof HTMLElement; 12738 } : 12739 function isElementQuirky( obj ) { 12740 return obj && typeof obj == 'object' && 12741 obj.nodeType == 1 && typeof obj.nodeName == 'string'; 12742 }; 12743 12744// ----- setText ----- // 12745 12746utils.setText = ( function() { 12747 var setTextProperty; 12748 function setText( elem, text ) { 12749 // only check setTextProperty once 12750 setTextProperty = setTextProperty || ( document.documentElement.textContent !== undefined ? 'textContent' : 'innerText' ); 12751 elem[ setTextProperty ] = text; 12752 } 12753 return setText; 12754})(); 12755 12756// ----- getParent ----- // 12757 12758utils.getParent = function( elem, selector ) { 12759 while ( elem != document.body ) { 12760 elem = elem.parentNode; 12761 if ( matchesSelector( elem, selector ) ) { 12762 return elem; 12763 } 12764 } 12765}; 12766 12767// ----- getQueryElement ----- // 12768 12769// use element as selector string 12770utils.getQueryElement = function( elem ) { 12771 if ( typeof elem == 'string' ) { 12772 return document.querySelector( elem ); 12773 } 12774 return elem; 12775}; 12776 12777// ----- handleEvent ----- // 12778 12779// enable .ontype to trigger from .addEventListener( elem, 'type' ) 12780utils.handleEvent = function( event ) { 12781 var method = 'on' + event.type; 12782 if ( this[ method ] ) { 12783 this[ method ]( event ); 12784 } 12785}; 12786 12787// ----- filterFindElements ----- // 12788 12789utils.filterFindElements = function( elems, selector ) { 12790 // make array of elems 12791 elems = utils.makeArray( elems ); 12792 var ffElems = []; 12793 12794 for ( var i=0, len = elems.length; i < len; i++ ) { 12795 var elem = elems[i]; 12796 // check that elem is an actual element 12797 if ( !utils.isElement( elem ) ) { 12798 continue; 12799 } 12800 // filter & find items if we have a selector 12801 if ( selector ) { 12802 // filter siblings 12803 if ( matchesSelector( elem, selector ) ) { 12804 ffElems.push( elem ); 12805 } 12806 // find children 12807 var childElems = elem.querySelectorAll( selector ); 12808 // concat childElems to filterFound array 12809 for ( var j=0, jLen = childElems.length; j < jLen; j++ ) { 12810 ffElems.push( childElems[j] ); 12811 } 12812 } else { 12813 ffElems.push( elem ); 12814 } 12815 } 12816 12817 return ffElems; 12818}; 12819 12820// ----- debounceMethod ----- // 12821 12822utils.debounceMethod = function( _class, methodName, threshold ) { 12823 // original method 12824 var method = _class.prototype[ methodName ]; 12825 var timeoutName = methodName + 'Timeout'; 12826 12827 _class.prototype[ methodName ] = function() { 12828 var timeout = this[ timeoutName ]; 12829 if ( timeout ) { 12830 clearTimeout( timeout ); 12831 } 12832 var args = arguments; 12833 12834 var _this = this; 12835 this[ timeoutName ] = setTimeout( function() { 12836 method.apply( _this, args ); 12837 delete _this[ timeoutName ]; 12838 }, threshold || 100 ); 12839 }; 12840}; 12841 12842// ----- htmlInit ----- // 12843 12844// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/ 12845utils.toDashed = function( str ) { 12846 return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) { 12847 return $1 + '-' + $2; 12848 }).toLowerCase(); 12849}; 12850
12851var console = window.console; 12852/** 12853 * allow user to initialize classes via .js-namespace class 12854 * htmlInit( Widget, 'widgetName' ) 12855 * options are parsed from data-namespace-option attribute 12856 */ 12857utils.htmlInit = function( WidgetClass, namespace ) { 12858 docReady( function() { 12859 var dashedNamespace = utils.toDashed( namespace ); 12860 var elems = document.querySelectorAll( '.js-' + dashedNamespace ); 12861 var dataAttr = 'data-' + dashedNamespace + '-options'; 12862 12863 for ( var i=0, len = elems.length; i < len; i++ ) { 12864 var elem = elems[i]; 12865 var attr = elem.getAttribute( dataAttr ); 12866 var options; 12867 try { 12868 options = attr && JSON.parse( attr ); 12869 } catch ( error ) { 12870 // log error, do not initialize 12871 if ( console ) { 12872 console.error( 'Error parsing ' + dataAttr + ' on ' + 12873 elem.nodeName.toLowerCase() + ( elem.id ? '#' + elem.id : '' ) + ': ' + 12874 error ); 12875 } 12876 continue; 12877 } 12878 // initialize 12879 var instance = new WidgetClass( elem, options ); 12880 // make available via $().data('layoutname') 12881 var jQuery = window.jQuery; 12882 if ( jQuery ) { 12883 jQuery.data( elem, namespace, instance ); 12884 } 12885 } 12886 }); 12887}; 12888 12889// ----- ----- // 12890 12891return utils; 12892 12893})); 12894 12895/** 12896 * Outlayer Item 12897 */ 12898 12899( function( window, factory ) { 12900 'use strict'; 12901 // universal module definition 12902 if ( typeof define === 'function' && define.amd ) { 12903 // AMD 12904 define( 'outlayer/item',[ 12905 'eventEmitter/EventEmitter', 12906 'get-size/get-size', 12907 'get-style-property/get-style-property', 12908 'fizzy-ui-utils/utils' 12909 ], 12910 function( EventEmitter, getSize, getStyleProperty, utils ) { 12911 return factory( window, EventEmitter, getSize, getStyleProperty, utils ); 12912 } 12913 ); 12914 } else if (typeof exports === 'object') { 12915 // CommonJS 12916 module.exports = factory( 12917 window, 12918 require('wolfy87-eventemitter'), 12919 require('get-size'), 12920 require('desandro-get-style-property'), 12921 require('fizzy-ui-utils') 12922 ); 12923 } else { 12924 // browser global 12925 window.Outlayer = {}; 12926 window.Outlayer.Item = factory( 12927 window, 12928 window.EventEmitter, 12929 window.getSize, 12930 window.getStyleProperty, 12931 window.fizzyUIUtils 12932 ); 12933 } 12934 12935}( window, function factory( window, EventEmitter, getSize, getStyleProperty, utils ) { 12936'use strict'; 12937 12938// ----- helpers ----- // 12939 12940var getComputedStyle = window.getComputedStyle; 12941var getStyle = getComputedStyle ? 12942 function( elem ) { 12943 return getComputedStyle( elem, null ); 12944 } : 12945 function( elem ) { 12946 return elem.currentStyle; 12947 }; 12948 12949 12950function isEmptyObj( obj ) { 12951 for ( var prop in obj ) { 12952 return false; 12953 } 12954 prop = null; 12955 return true; 12956} 12957 12958// -------------------------- CSS3 support -------------------------- // 12959 12960var transitionProperty = getStyleProperty('transition'); 12961var transformProperty = getStyleProperty('transform'); 12962var supportsCSS3 = transitionProperty && transformProperty; 12963var is3d = !!getStyleProperty('perspective'); 12964 12965var transitionEndEvent = { 12966 WebkitTransition: 'webkitTransitionEnd', 12967 MozTransition: 'transitionend', 12968 OTransition: 'otransitionend', 12969 transition: 'transitionend' 12970}[ transitionProperty ]; 12971 12972// properties that could have vendor prefix 12973var prefixableProperties = [ 12974 'transform', 12975 'transition', 12976 'transitionDuration', 12977 'transitionProperty' 12978]; 12979 12980// cache all vendor properties 12981var vendorProperties = ( function() { 12982 var cache = {}; 12983 for ( var i=0, len = prefixableProperties.length; i < len; i++ ) { 12984 var prop = prefixableProperties[i]; 12985 var supportedProp = getStyleProperty( prop ); 12986 if ( supportedProp && supportedProp !== prop ) { 12987 cache[ prop ] = supportedProp; 12988 } 12989 } 12990 return cache; 12991})(); 12992 12993// -------------------------- Item -------------------------- // 12994 12995function Item( element, layout ) { 12996 if ( !element ) { 12997 return; 12998 } 12999 13000 this.element = element; 13001 // parent layout class, i.e. Masonry, Isotope, or Packery 13002 this.layout = layout; 13003 this.position = { 13004 x: 0, 13005 y: 0 13006 }; 13007 13008 this._create(); 13009} 13010 13011// inherit EventEmitter 13012utils.extend( Item.prototype, EventEmitter.prototype ); 13013 13014Item.prototype._create = function() { 13015 // transition objects 13016 this._transn = { 13017 ingProperties: {}, 13018 clean: {}, 13019 onEnd: {} 13020 }; 13021 13022 this.css({ 13023 position: 'absolute' 13024 }); 13025}; 13026 13027// trigger specified handler for event type 13028Item.prototype.handleEvent = function( event ) { 13029 var method = 'on' + event.type; 13030 if ( this[ method ] ) { 13031 this[ method ]( event ); 13032 } 13033}; 13034 13035Item.prototype.getSize = function() { 13036 this.size = getSize( this.element ); 13037}; 13038 13039/** 13040 * apply CSS styles to element 13041 * @param {Object} style 13042 */ 13043Item.prototype.css = function( style ) { 13044 var elemStyle = this.element.style; 13045 13046 for ( var prop in style ) { 13047 // use vendor property if available
13048 var supportedProp = vendorProperties[ prop ] || prop; 13049 elemStyle[ supportedProp ] = style[ prop ]; 13050 } 13051}; 13052 13053 // measure position, and sets it 13054Item.prototype.getPosition = function() { 13055 var style = getStyle( this.element ); 13056 var layoutOptions = this.layout.options; 13057 var isOriginLeft = layoutOptions.isOriginLeft; 13058 var isOriginTop = layoutOptions.isOriginTop; 13059 var xValue = style[ isOriginLeft ? 'left' : 'right' ]; 13060 var yValue = style[ isOriginTop ? 'top' : 'bottom' ]; 13061 // convert percent to pixels 13062 var layoutSize = this.layout.size; 13063 var x = xValue.indexOf('%') != -1 ? 13064 ( parseFloat( xValue ) / 100 ) * layoutSize.width : parseInt( xValue, 10 ); 13065 var y = yValue.indexOf('%') != -1 ? 13066 ( parseFloat( yValue ) / 100 ) * layoutSize.height : parseInt( yValue, 10 ); 13067 13068 // clean up 'auto' or other non-integer values 13069 x = isNaN( x ) ? 0 : x; 13070 y = isNaN( y ) ? 0 : y; 13071 // remove padding from measurement 13072 x -= isOriginLeft ? layoutSize.paddingLeft : layoutSize.paddingRight; 13073 y -= isOriginTop ? layoutSize.paddingTop : layoutSize.paddingBottom; 13074 13075 this.position.x = x; 13076 this.position.y = y; 13077}; 13078 13079// set settled position, apply padding 13080Item.prototype.layoutPosition = function() { 13081 var layoutSize = this.layout.size; 13082 var layoutOptions = this.layout.options; 13083 var style = {}; 13084 13085 // x 13086 var xPadding = layoutOptions.isOriginLeft ? 'paddingLeft' : 'paddingRight'; 13087 var xProperty = layoutOptions.isOriginLeft ? 'left' : 'right'; 13088 var xResetProperty = layoutOptions.isOriginLeft ? 'right' : 'left'; 13089 13090 var x = this.position.x + layoutSize[ xPadding ]; 13091 // set in percentage or pixels 13092 style[ xProperty ] = this.getXValue( x ); 13093 // reset other property 13094 style[ xResetProperty ] = ''; 13095 13096 // y 13097 var yPadding = layoutOptions.isOriginTop ? 'paddingTop' : 'paddingBottom'; 13098 var yProperty = layoutOptions.isOriginTop ? 'top' : 'bottom'; 13099 var yResetProperty = layoutOptions.isOriginTop ? 'bottom' : 'top'; 13100 13101 var y = this.position.y + layoutSize[ yPadding ]; 13102 // set in percentage or pixels 13103 style[ yProperty ] = this.getYValue( y ); 13104 // reset other property 13105 style[ yResetProperty ] = ''; 13106 13107 this.css( style ); 13108 this.emitEvent( 'layout', [ this ] ); 13109}; 13110 13111Item.prototype.getXValue = function( x ) { 13112 var layoutOptions = this.layout.options; 13113 return layoutOptions.percentPosition && !layoutOptions.isHorizontal ? 13114 ( ( x / this.layout.size.width ) * 100 ) + '%' : x + 'px'; 13115}; 13116 13117Item.prototype.getYValue = function( y ) { 13118 var layoutOptions = this.layout.options; 13119 return layoutOptions.percentPosition && layoutOptions.isHorizontal ? 13120 ( ( y / this.layout.size.height ) * 100 ) + '%' : y + 'px'; 13121}; 13122 13123 13124Item.prototype._transitionTo = function( x, y ) { 13125 this.getPosition(); 13126 // get current x & y from top/left 13127 var curX = this.position.x; 13128 var curY = this.position.y; 13129 13130 var compareX = parseInt( x, 10 ); 13131 var compareY = parseInt( y, 10 ); 13132 var didNotMove = compareX === this.position.x && compareY === this.position.y; 13133 13134 // save end position 13135 this.setPosition( x, y ); 13136 13137 // if did not move and not transitioning, just go to layout 13138 if ( didNotMove && !this.isTransitioning ) { 13139 this.layoutPosition(); 13140 return; 13141 } 13142 13143 var transX = x - curX; 13144 var transY = y - curY; 13145 var transitionStyle = {}; 13146 transitionStyle.transform = this.getTranslate( transX, transY ); 13147 13148 this.transition({ 13149 to: transitionStyle, 13150 onTransitionEnd: { 13151 transform: this.layoutPosition 13152 }, 13153 isCleaning: true 13154 }); 13155}; 13156 13157Item.prototype.getTranslate = function( x, y ) { 13158 // flip cooridinates if origin on right or bottom 13159 var layoutOptions = this.layout.options; 13160 x = layoutOptions.isOriginLeft ? x : -x; 13161 y = layoutOptions.isOriginTop ? y : -y; 13162 13163 if ( is3d ) { 13164 return 'translate3d(' + x + 'px, ' + y + 'px, 0)'; 13165 } 13166 13167 return 'translate(' + x + 'px, ' + y + 'px)'; 13168}; 13169 13170// non transition + transform support 13171Item.prototype.goTo = function( x, y ) { 13172 this.setPosition( x, y ); 13173 this.layoutPosition(); 13174}; 13175 13176// use transition and transforms if supported 13177Item.prototype.moveTo = supportsCSS3 ? 13178 Item.prototype._transitionTo : Item.prototype.goTo; 13179 13180Item.prototype.setPosition = function( x, y ) { 13181 this.position.x = parseInt( x, 10 ); 13182 this.position.y = parseInt( y, 10 ); 13183}; 13184 13185// ----- transition ----- // 13186 13187/** 13188 * @param {Object} style - CSS 13189 * @param {Function} onTransitionEnd 13190 */ 13191 13192// non transition, just trigger callback 13193Item.prototype._nonTransition = function( args ) { 13194 this.css( args.to ); 13195 if ( args.isCleaning ) { 13196 this._removeStyles( args.to ); 13197 } 13198 for ( var prop in args.onTransitionEnd ) { 13199 args.onTransitionEnd[ prop ].call( this ); 13200 } 13201}; 13202 13203/** 13204 * proper transition 13205 * @param {Object} args - arguments 13206 * @param {Object} to - style to transition to 13207 * @param {Object} from - style to start transition from 13208 * @param {Boolean} isCleaning - removes transition styles after transition 13209 * @param {Function} onTransitionEnd - callback 13210 */ 13211Item.prototype._transition = function( args ) { 13212 // redirect to nonTransition if no transition duration 13213 if ( !parseFloat( this.layout.options.transitionDuration ) ) { 13214 this._nonTransition( args ); 13215 return; 13216 } 13217 13218 var _transition = this._transn; 13219 // keep track of onTransitionEnd callback by css property 13220 for ( var prop in args.onTransitionEnd ) { 13221 _transition.onEnd[ prop ] = args.onTransitionEnd[ prop ]; 13222 } 13223 // keep track of properties that are transitioning 13224 for ( prop in args.to ) { 13225 _transition.ingProperties[ prop ] = true; 13226 // keep track of properties to clean up when transition is done 13227 if ( args.isCleaning ) { 13228 _transition.clean[ prop ] = true; 13229 } 13230 } 13231 13232 // set from styles 13233 if ( args.from ) { 13234 this.css( args.from ); 13235 // force redraw. http://blog.alexmaccaw.com/css-transitions 13236 var h = this.element.offsetHeight; 13237 // hack for JSHint to hush about unused var 13238 h = null; 13239 } 13240 // enable transition 13241 this.enableTransition( args.to ); 13242 // set styles that are transitioning 13243 this.css( args.to ); 13244 13245 this.isTransitioning = true; 13246 13247}; 13248 13249// dash before all cap letters, including first for 13250// WebkitTransform => -webkit-transform 13251function toDashedAll( str ) { 13252 return str.replace( /([A-Z])/g, function( $1 ) { 13253 return '-' + $1.toLowerCase(); 13254 }); 13255} 13256 13257var transitionProps = 'opacity,' +
vendor: 11,190 bytes, lines 13258-13704
13258 toDashedAll( vendorProperties.transform || 'transform' ); 13259 13260Item.prototype.enableTransition = function(/* style */) { 13261 // HACK changing transitionProperty during a transition 13262 // will cause transition to jump 13263 if ( this.isTransitioning ) { 13264 return; 13265 } 13266 13267 // make `transition: foo, bar, baz` from style object 13268 // HACK un-comment this when enableTransition can work 13269 // while a transition is happening 13270 // var transitionValues = []; 13271 // for ( var prop in style ) { 13272 // // dash-ify camelCased properties like WebkitTransition 13273 // prop = vendorProperties[ prop ] || prop; 13274 // transitionValues.push( toDashedAll( prop ) ); 13275 // } 13276 // enable transition styles 13277 this.css({ 13278 transitionProperty: transitionProps, 13279 transitionDuration: this.layout.options.transitionDuration 13280 }); 13281 // listen for transition end event 13282 this.element.addEventListener( transitionEndEvent, this, false ); 13283}; 13284 13285Item.prototype.transition = Item.prototype[ transitionProperty ? '_transition' : '_nonTransition' ]; 13286 13287// ----- events ----- // 13288 13289Item.prototype.onwebkitTransitionEnd = function( event ) { 13290 this.ontransitionend( event ); 13291}; 13292 13293Item.prototype.onotransitionend = function( event ) { 13294 this.ontransitionend( event ); 13295}; 13296 13297// properties that I munge to make my life easier 13298var dashedVendorProperties = { 13299 '-webkit-transform': 'transform', 13300 '-moz-transform': 'transform', 13301 '-o-transform': 'transform' 13302}; 13303 13304Item.prototype.ontransitionend = function( event ) { 13305 // disregard bubbled events from children 13306 if ( event.target !== this.element ) { 13307 return; 13308 } 13309 var _transition = this._transn; 13310 // get property name of transitioned property, convert to prefix-free 13311 var propertyName = dashedVendorProperties[ event.propertyName ] || event.propertyName; 13312 13313 // remove property that has completed transitioning 13314 delete _transition.ingProperties[ propertyName ]; 13315 // check if any properties are still transitioning 13316 if ( isEmptyObj( _transition.ingProperties ) ) { 13317 // all properties have completed transitioning 13318 this.disableTransition(); 13319 } 13320 // clean style 13321 if ( propertyName in _transition.clean ) { 13322 // clean up style 13323 this.element.style[ event.propertyName ] = ''; 13324 delete _transition.clean[ propertyName ]; 13325 } 13326 // trigger onTransitionEnd callback 13327 if ( propertyName in _transition.onEnd ) { 13328 var onTransitionEnd = _transition.onEnd[ propertyName ]; 13329 onTransitionEnd.call( this ); 13330 delete _transition.onEnd[ propertyName ]; 13331 } 13332 13333 this.emitEvent( 'transitionEnd', [ this ] ); 13334}; 13335 13336Item.prototype.disableTransition = function() { 13337 this.removeTransitionStyles(); 13338 this.element.removeEventListener( transitionEndEvent, this, false ); 13339 this.isTransitioning = false; 13340}; 13341 13342/** 13343 * removes style property from element 13344 * @param {Object} style 13345**/ 13346Item.prototype._removeStyles = function( style ) { 13347 // clean up transition styles 13348 var cleanStyle = {}; 13349 for ( var prop in style ) { 13350 cleanStyle[ prop ] = ''; 13351 } 13352 this.css( cleanStyle ); 13353}; 13354 13355var cleanTransitionStyle = { 13356 transitionProperty: '', 13357 transitionDuration: '' 13358}; 13359 13360Item.prototype.removeTransitionStyles = function() { 13361 // remove transition 13362 this.css( cleanTransitionStyle ); 13363}; 13364 13365// ----- show/hide/remove ----- // 13366 13367// remove element from DOM 13368Item.prototype.removeElem = function() { 13369 this.element.parentNode.removeChild( this.element ); 13370 // remove display: none 13371 this.css({ display: '' }); 13372 this.emitEvent( 'remove', [ this ] ); 13373}; 13374 13375Item.prototype.remove = function() { 13376 // just remove element if no transition support or no transition 13377 if ( !transitionProperty || !parseFloat( this.layout.options.transitionDuration ) ) { 13378 this.removeElem(); 13379 return; 13380 } 13381 13382 // start transition 13383 var _this = this; 13384 this.once( 'transitionEnd', function() { 13385 _this.removeElem(); 13386 }); 13387 this.hide(); 13388}; 13389 13390Item.prototype.reveal = function() { 13391 delete this.isHidden; 13392 // remove display: none 13393 this.css({ display: '' }); 13394 13395 var options = this.layout.options; 13396 13397 var onTransitionEnd = {}; 13398 var transitionEndProperty = this.getHideRevealTransitionEndProperty('visibleStyle'); 13399 onTransitionEnd[ transitionEndProperty ] = this.onRevealTransitionEnd; 13400 13401 this.transition({ 13402 from: options.hiddenStyle, 13403 to: options.visibleStyle, 13404 isCleaning: true, 13405 onTransitionEnd: onTransitionEnd 13406 }); 13407}; 13408 13409Item.prototype.onRevealTransitionEnd = function() { 13410 // check if still visible 13411 // during transition, item may have been hidden 13412 if ( !this.isHidden ) { 13413 this.emitEvent('reveal'); 13414 } 13415}; 13416 13417/** 13418 * get style property use for hide/reveal transition end 13419 * @param {String} styleProperty - hiddenStyle/visibleStyle 13420 * @returns {String} 13421 */ 13422Item.prototype.getHideRevealTransitionEndProperty = function( styleProperty ) { 13423 var optionStyle = this.layout.options[ styleProperty ]; 13424 // use opacity 13425 if ( optionStyle.opacity ) { 13426 return 'opacity'; 13427 } 13428 // get first property 13429 for ( var prop in optionStyle ) { 13430 return prop; 13431 } 13432}; 13433 13434Item.prototype.hide = function() { 13435 // set flag 13436 this.isHidden = true; 13437 // remove display: none 13438 this.css({ display: '' }); 13439 13440 var options = this.layout.options; 13441 13442 var onTransitionEnd = {}; 13443 var transitionEndProperty = this.getHideRevealTransitionEndProperty('hiddenStyle'); 13444 onTransitionEnd[ transitionEndProperty ] = this.onHideTransitionEnd; 13445 13446 this.transition({ 13447 from: options.visibleStyle, 13448 to: options.hiddenStyle, 13449 // keep hidden stuff hidden 13450 isCleaning: true, 13451 onTransitionEnd: onTransitionEnd 13452 }); 13453}; 13454 13455Item.prototype.onHideTransitionEnd = function() { 13456 // check if still hidden 13457 // during transition, item may have been un-hidden 13458 if ( this.isHidden ) { 13459 this.css({ display: 'none' }); 13460 this.emitEvent('hide'); 13461 } 13462}; 13463 13464Item.prototype.destroy = function() { 13465 this.css({ 13466 position: '', 13467 left: '', 13468 right: '', 13469 top: '', 13470 bottom: '', 13471 transition: '', 13472 transform: '' 13473 }); 13474}; 13475 13476return Item; 13477 13478})); 13479 13480/*! 13481 * Outlayer v1.4.2 13482 * the brains and guts of a layout library 13483 * MIT license 13484 */ 13485 13486( function( window, factory ) { 13487 'use strict'; 13488 // universal module definition 13489 13490 if ( typeof define == 'function' && define.amd ) { 13491 // AMD 13492 define( 'outlayer/outlayer',[ 13493 'eventie/eventie', 13494 'eventEmitter/EventEmitter', 13495 'get-size/get-size', 13496 'fizzy-ui-utils/utils', 13497 './item' 13498 ], 13499 function( eventie, EventEmitter, getSize, utils, Item ) { 13500 return factory( window, eventie, EventEmitter, getSize, utils, Item); 13501 } 13502 ); 13503 } else if ( typeof exports == 'object' ) { 13504 // CommonJS 13505 module.exports = factory( 13506 window, 13507 require('eventie'), 13508 require('wolfy87-eventemitter'), 13509 require('get-size'), 13510 require('fizzy-ui-utils'), 13511 require('./item') 13512 ); 13513 } else { 13514 // browser global 13515 window.Outlayer = factory( 13516 window, 13517 window.eventie, 13518 window.EventEmitter, 13519 window.getSize, 13520 window.fizzyUIUtils, 13521 window.Outlayer.Item 13522 ); 13523 } 13524 13525}( window, function factory( window, eventie, EventEmitter, getSize, utils, Item ) { 13526'use strict'; 13527 13528// ----- vars ----- // 13529 13530var console = window.console; 13531var jQuery = window.jQuery; 13532var noop = function() {}; 13533 13534// -------------------------- Outlayer -------------------------- // 13535 13536// globally unique identifiers 13537var GUID = 0; 13538// internal store of all Outlayer intances 13539var instances = {}; 13540 13541 13542/** 13543 * @param {Element, String} element 13544 * @param {Object} options 13545 * @constructor 13546 */ 13547function Outlayer( element, options ) { 13548 var queryElement = utils.getQueryElement( element ); 13549 if ( !queryElement ) { 13550 if ( console ) { 13551 console.error( 'Bad element for ' + this.constructor.namespace + 13552 ': ' + ( queryElement || element ) ); 13553 } 13554 return; 13555 } 13556 this.element = queryElement; 13557 // add jQuery 13558 if ( jQuery ) { 13559 this.$element = jQuery( this.element ); 13560 } 13561 13562 // options 13563 this.options = utils.extend( {}, this.constructor.defaults ); 13564 this.option( options ); 13565 13566 // add id for Outlayer.getFromElement 13567 var id = ++GUID; 13568 this.element.outlayerGUID = id; // expando 13569 instances[ id ] = this; // associate via id 13570 13571 // kick it off 13572 this._create(); 13573 13574 if ( this.options.isInitLayout ) { 13575 this.layout(); 13576 } 13577} 13578 13579// settings are for internal use only 13580Outlayer.namespace = 'outlayer'; 13581Outlayer.Item = Item; 13582 13583// default options 13584Outlayer.defaults = { 13585 containerStyle: { 13586 position: 'relative' 13587 }, 13588 isInitLayout: true, 13589 isOriginLeft: true, 13590 isOriginTop: true, 13591 isResizeBound: true, 13592 isResizingContainer: true, 13593 // item options 13594 transitionDuration: '0.4s', 13595 hiddenStyle: { 13596 opacity: 0, 13597 transform: 'scale(0.001)' 13598 }, 13599 visibleStyle: { 13600 opacity: 1, 13601 transform: 'scale(1)' 13602 } 13603}; 13604 13605// inherit EventEmitter 13606utils.extend( Outlayer.prototype, EventEmitter.prototype ); 13607 13608/** 13609 * set options 13610 * @param {Object} opts 13611 */ 13612Outlayer.prototype.option = function( opts ) { 13613 utils.extend( this.options, opts ); 13614}; 13615 13616Outlayer.prototype._create = function() { 13617 // get items from children 13618 this.reloadItems(); 13619 // elements that affect layout, but are not laid out 13620 this.stamps = []; 13621 this.stamp( this.options.stamp ); 13622 // set container style 13623 utils.extend( this.element.style, this.options.containerStyle ); 13624 13625 // bind resize method 13626 if ( this.options.isResizeBound ) { 13627 this.bindResize(); 13628 } 13629}; 13630 13631// goes through all children again and gets bricks in proper order 13632Outlayer.prototype.reloadItems = function() { 13633 // collection of item elements 13634 this.items = this._itemize( this.element.children ); 13635}; 13636 13637 13638/** 13639 * turn elements into Outlayer.Items to be used in layout 13640 * @param {Array or NodeList or HTMLElement} elems 13641 * @returns {Array} items - collection of new Outlayer Items 13642 */ 13643Outlayer.prototype._itemize = function( elems ) { 13644 13645 var itemElems = this._filterFindItemElements( elems ); 13646 var Item = this.constructor.Item; 13647 13648 // create new Outlayer Items for collection 13649 var items = []; 13650 for ( var i=0, len = itemElems.length; i < len; i++ ) { 13651 var elem = itemElems[i]; 13652 var item = new Item( elem, this ); 13653 items.push( item ); 13654 } 13655 13656 return items; 13657}; 13658 13659/** 13660 * get item elements to be used in layout 13661 * @param {Array or NodeList or HTMLElement} elems 13662 * @returns {Array} items - item elements 13663 */ 13664Outlayer.prototype._filterFindItemElements = function( elems ) { 13665 return utils.filterFindElements( elems, this.options.itemSelector ); 13666}; 13667 13668/** 13669 * getter method for getting item elements 13670 * @returns {Array} elems - collection of item elements 13671 */ 13672Outlayer.prototype.getItemElements = function() { 13673 var elems = []; 13674 for ( var i=0, len = this.items.length; i < len; i++ ) { 13675 elems.push( this.items[i].element ); 13676 } 13677 return elems; 13678}; 13679 13680// ----- init & layout ----- // 13681 13682/** 13683 * lays out all items 13684 */ 13685Outlayer.prototype.layout = function() { 13686 this._resetLayout(); 13687 this._manageStamps(); 13688 13689 // don't animate first layout 13690 var isInstant = this.options.isLayoutInstant !== undefined ? 13691 this.options.isLayoutInstant : !this._isLayoutInited; 13692 this.layoutItems( this.items, isInstant ); 13693 13694 // flag for initalized 13695 this._isLayoutInited = true; 13696}; 13697 13698// _init is alias for layout 13699Outlayer.prototype._init = Outlayer.prototype.layout; 13700 13701/** 13702 * logic before any new layout 13703 */ 13704Outlayer.prototype._resetLayout = function() {
13705 this.getSize(); 13706}; 13707 13708 13709Outlayer.prototype.getSize = function() { 13710 this.size = getSize( this.element ); 13711}; 13712 13713/** 13714 * get measurement from option, for columnWidth, rowHeight, gutter 13715 * if option is String -> get element from selector string, & get size of element 13716 * if option is Element -> get size of element 13717 * else use option as a number 13718 * 13719 * @param {String} measurement 13720 * @param {String} size - width or height 13721 * @private 13722 */ 13723Outlayer.prototype._getMeasurement = function( measurement, size ) { 13724 var option = this.options[ measurement ]; 13725 var elem; 13726 if ( !option ) { 13727 // default to 0 13728 this[ measurement ] = 0; 13729 } else { 13730 // use option as an element 13731 if ( typeof option === 'string' ) { 13732 elem = this.element.querySelector( option ); 13733 } else if ( utils.isElement( option ) ) { 13734 elem = option; 13735 } 13736 // use size of element, if element 13737 this[ measurement ] = elem ? getSize( elem )[ size ] : option; 13738 } 13739}; 13740 13741/** 13742 * layout a collection of item elements 13743 * @api public 13744 */ 13745Outlayer.prototype.layoutItems = function( items, isInstant ) { 13746 items = this._getItemsForLayout( items ); 13747 13748 this._layoutItems( items, isInstant ); 13749 13750 this._postLayout(); 13751}; 13752 13753/** 13754 * get the items to be laid out 13755 * you may want to skip over some items 13756 * @param {Array} items 13757 * @returns {Array} items 13758 */ 13759Outlayer.prototype._getItemsForLayout = function( items ) { 13760 var layoutItems = []; 13761 for ( var i=0, len = items.length; i < len; i++ ) { 13762 var item = items[i]; 13763 if ( !item.isIgnored ) { 13764 layoutItems.push( item ); 13765 } 13766 } 13767 return layoutItems; 13768}; 13769 13770/** 13771 * layout items 13772 * @param {Array} items 13773 * @param {Boolean} isInstant 13774 */ 13775Outlayer.prototype._layoutItems = function( items, isInstant ) { 13776 this._emitCompleteOnItems( 'layout', items ); 13777 13778 if ( !items || !items.length ) { 13779 // no items, emit event with empty array 13780 return; 13781 } 13782 13783 var queue = []; 13784 13785 for ( var i=0, len = items.length; i < len; i++ ) { 13786 var item = items[i]; 13787 // get x/y object from method 13788 var position = this._getItemLayoutPosition( item ); 13789 // enqueue 13790 position.item = item; 13791 position.isInstant = isInstant || item.isLayoutInstant; 13792 queue.push( position ); 13793 } 13794 13795 this._processLayoutQueue( queue ); 13796}; 13797 13798/** 13799 * get item layout position 13800 * @param {Outlayer.Item} item 13801 * @returns {Object} x and y position 13802 */ 13803Outlayer.prototype._getItemLayoutPosition = function( /* item */ ) { 13804 return { 13805 x: 0, 13806 y: 0 13807 }; 13808}; 13809 13810/** 13811 * iterate over array and position each item 13812 * Reason being - separating this logic prevents 'layout invalidation' 13813 * thx @paul_irish 13814 * @param {Array} queue 13815 */ 13816Outlayer.prototype._processLayoutQueue = function( queue ) { 13817 for ( var i=0, len = queue.length; i < len; i++ ) { 13818 var obj = queue[i]; 13819 this._positionItem( obj.item, obj.x, obj.y, obj.isInstant ); 13820 } 13821}; 13822 13823/** 13824 * Sets position of item in DOM 13825 * @param {Outlayer.Item} item 13826 * @param {Number} x - horizontal position 13827 * @param {Number} y - vertical position 13828 * @param {Boolean} isInstant - disables transitions 13829 */ 13830Outlayer.prototype._positionItem = function( item, x, y, isInstant ) { 13831 if ( isInstant ) { 13832 // if not transition, just set CSS 13833 item.goTo( x, y ); 13834 } else { 13835 item.moveTo( x, y ); 13836 } 13837}; 13838 13839/** 13840 * Any logic you want to do after each layout, 13841 * i.e. size the container 13842 */ 13843Outlayer.prototype._postLayout = function() { 13844 this.resizeContainer(); 13845}; 13846 13847Outlayer.prototype.resizeContainer = function() { 13848 if ( !this.options.isResizingContainer ) { 13849 return; 13850 } 13851 var size = this._getContainerSize(); 13852 if ( size ) { 13853 this._setContainerMeasure( size.width, true ); 13854 this._setContainerMeasure( size.height, false ); 13855 } 13856}; 13857 13858/** 13859 * Sets width or height of container if returned 13860 * @returns {Object} size 13861 * @param {Number} width 13862 * @param {Number} height 13863 */ 13864Outlayer.prototype._getContainerSize = noop; 13865 13866/** 13867 * @param {Number} measure - size of width or height 13868 * @param {Boolean} isWidth 13869 */ 13870Outlayer.prototype._setContainerMeasure = function( measure, isWidth ) { 13871 if ( measure === undefined ) { 13872 return; 13873 } 13874 13875 var elemSize = this.size; 13876 // add padding and border width if border box 13877 if ( elemSize.isBorderBox ) { 13878 measure += isWidth ? elemSize.paddingLeft + elemSize.paddingRight + 13879 elemSize.borderLeftWidth + elemSize.borderRightWidth : 13880 elemSize.paddingBottom + elemSize.paddingTop + 13881 elemSize.borderTopWidth + elemSize.borderBottomWidth; 13882 } 13883 13884 measure = Math.max( measure, 0 ); 13885 this.element.style[ isWidth ? 'width' : 'height' ] = measure + 'px'; 13886}; 13887 13888/** 13889 * emit eventComplete on a collection of items events 13890 * @param {String} eventName 13891 * @param {Array} items - Outlayer.Items 13892 */ 13893Outlayer.prototype._emitCompleteOnItems = function( eventName, items ) { 13894 var _this = this; 13895 function onComplete() { 13896 _this.dispatchEvent( eventName + 'Complete', null, [ items ] ); 13897 } 13898 13899 var count = items.length; 13900 if ( !items || !count ) { 13901 onComplete(); 13902 return; 13903 } 13904 13905 var doneCount = 0; 13906 function tick() { 13907 doneCount++; 13908 if ( doneCount === count ) { 13909 onComplete(); 13910 } 13911 } 13912 13913 // bind callback 13914 for ( var i=0, len = items.length; i < len; i++ ) { 13915 var item = items[i]; 13916 item.once( eventName, tick ); 13917 } 13918}; 13919 13920/** 13921 * emits events via eventEmitter and jQuery events 13922 * @param {String} type - name of event 13923 * @param {Event} event - original event 13924 * @param {Array} args - extra arguments 13925 */ 13926Outlayer.prototype.dispatchEvent = function( type, event, args ) { 13927 // add original event to arguments 13928 var emitArgs = event ? [ event ].concat( args ) : args; 13929 this.emitEvent( type, emitArgs ); 13930 13931 if ( jQuery ) { 13932 // set this.$element 13933 this.$element = this.$element || jQuery( this.element ); 13934 if ( event ) { 13935 // create jQuery event 13936 var $event = jQuery.Event( event ); 13937 $event.type = type; 13938 this.$element.trigger( $event, args ); 13939 } else { 13940 // just trigger with type if no event available 13941 this.$element.trigger( type, args ); 13942 } 13943 } 13944}; 13945 13946// -------------------------- ignore & stamps -------------------------- // 13947 13948 13949/** 13950 * keep item in collection, but do not lay it out 13951 * ignored items do not get skipped in layout 13952 * @param {Element} elem 13953 */ 13954Outlayer.prototype.ignore = function( elem ) { 13955 var item = this.getItem( elem ); 13956 if ( item ) { 13957 item.isIgnored = true; 13958 } 13959}; 13960 13961/** 13962 * return item to layout collection 13963 * @param {Element} elem 13964 */ 13965Outlayer.prototype.unignore = function( elem ) { 13966 var item = this.getItem( elem ); 13967 if ( item ) { 13968 delete item.isIgnored; 13969 } 13970}; 13971 13972/** 13973 * adds elements to stamps 13974 * @param {NodeList, Array, Element, or String} elems 13975 */ 13976Outlayer.prototype.stamp = function( elems ) { 13977 elems = this._find( elems ); 13978 if ( !elems ) { 13979 return; 13980 } 13981
13982 this.stamps = this.stamps.concat( elems ); 13983 // ignore 13984 for ( var i=0, len = elems.length; i < len; i++ ) { 13985 var elem = elems[i]; 13986 this.ignore( elem ); 13987 } 13988}; 13989 13990/** 13991 * removes elements to stamps 13992 * @param {NodeList, Array, or Element} elems 13993 */ 13994Outlayer.prototype.unstamp = function( elems ) { 13995 elems = this._find( elems ); 13996 if ( !elems ){ 13997 return; 13998 } 13999 14000 for ( var i=0, len = elems.length; i < len; i++ ) { 14001 var elem = elems[i]; 14002 // filter out removed stamp elements 14003 utils.removeFrom( this.stamps, elem ); 14004 this.unignore( elem ); 14005 } 14006 14007}; 14008 14009/** 14010 * finds child elements 14011 * @param {NodeList, Array, Element, or String} elems 14012 * @returns {Array} elems 14013 */ 14014Outlayer.prototype._find = function( elems ) { 14015 if ( !elems ) { 14016 return; 14017 } 14018 // if string, use argument as selector string 14019 if ( typeof elems === 'string' ) { 14020 elems = this.element.querySelectorAll( elems ); 14021 } 14022 elems = utils.makeArray( elems ); 14023 return elems; 14024}; 14025 14026Outlayer.prototype._manageStamps = function() { 14027 if ( !this.stamps || !this.stamps.length ) { 14028 return; 14029 } 14030 14031 this._getBoundingRect(); 14032 14033 for ( var i=0, len = this.stamps.length; i < len; i++ ) { 14034 var stamp = this.stamps[i]; 14035 this._manageStamp( stamp ); 14036 } 14037}; 14038 14039// update boundingLeft / Top 14040Outlayer.prototype._getBoundingRect = function() { 14041 // get bounding rect for container element 14042 var boundingRect = this.element.getBoundingClientRect(); 14043 var size = this.size; 14044 this._boundingRect = { 14045 left: boundingRect.left + size.paddingLeft + size.borderLeftWidth, 14046 top: boundingRect.top + size.paddingTop + size.borderTopWidth, 14047 right: boundingRect.right - ( size.paddingRight + size.borderRightWidth ), 14048 bottom: boundingRect.bottom - ( size.paddingBottom + size.borderBottomWidth ) 14049 }; 14050}; 14051 14052/** 14053 * @param {Element} stamp 14054**/ 14055Outlayer.prototype._manageStamp = noop; 14056 14057/** 14058 * get x/y position of element relative to container element 14059 * @param {Element} elem 14060 * @returns {Object} offset - has left, top, right, bottom 14061 */ 14062Outlayer.prototype._getElementOffset = function( elem ) { 14063 var boundingRect = elem.getBoundingClientRect(); 14064 var thisRect = this._boundingRect; 14065 var size = getSize( elem ); 14066 var offset = { 14067 left: boundingRect.left - thisRect.left - size.marginLeft, 14068 top: boundingRect.top - thisRect.top - size.marginTop, 14069 right: thisRect.right - boundingRect.right - size.marginRight, 14070 bottom: thisRect.bottom - boundingRect.bottom - size.marginBottom 14071 }; 14072 return offset; 14073}; 14074 14075// -------------------------- resize -------------------------- // 14076 14077// enable event handlers for listeners 14078// i.e. resize -> onresize 14079Outlayer.prototype.handleEvent = function( event ) { 14080 var method = 'on' + event.type; 14081 if ( this[ method ] ) { 14082 this[ method ]( event ); 14083 } 14084}; 14085 14086/** 14087 * Bind layout to window resizing 14088 */ 14089Outlayer.prototype.bindResize = function() { 14090 // bind just one listener 14091 if ( this.isResizeBound ) { 14092 return; 14093 } 14094 eventie.bind( window, 'resize', this ); 14095 this.isResizeBound = true; 14096}; 14097 14098/** 14099 * Unbind layout to window resizing 14100 */ 14101Outlayer.prototype.unbindResize = function() { 14102 if ( this.isResizeBound ) { 14103 eventie.unbind( window, 'resize', this ); 14104 } 14105 this.isResizeBound = false; 14106}; 14107 14108// original debounce by John Hann 14109// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ 14110 14111// this fires every resize 14112Outlayer.prototype.onresize = function() { 14113 if ( this.resizeTimeout ) { 14114 clearTimeout( this.resizeTimeout ); 14115 } 14116 14117 var _this = this; 14118 function delayed() { 14119 _this.resize(); 14120 delete _this.resizeTimeout; 14121 } 14122 14123 this.resizeTimeout = setTimeout( delayed, 100 ); 14124}; 14125 14126// debounced, layout on resize 14127Outlayer.prototype.resize = function() { 14128 // don't trigger if size did not change 14129 // or if resize was unbound. See #9 14130 if ( !this.isResizeBound || !this.needsResizeLayout() ) { 14131 return; 14132 } 14133 14134 this.layout(); 14135}; 14136 14137/** 14138 * check if layout is needed post layout 14139 * @returns Boolean 14140 */ 14141Outlayer.prototype.needsResizeLayout = function() { 14142 var size = getSize( this.element ); 14143 // check that this.size and size are there 14144 // IE8 triggers resize on body size change, so they might not be 14145 var hasSizes = this.size && size; 14146 return hasSizes && size.innerWidth !== this.size.innerWidth; 14147}; 14148 14149// -------------------------- methods -------------------------- // 14150 14151/** 14152 * add items to Outlayer instance 14153 * @param {Array or NodeList or Element} elems 14154 * @returns {Array} items - Outlayer.Items 14155**/ 14156Outlayer.prototype.addItems = function( elems ) { 14157 var items = this._itemize( elems ); 14158 // add items to collection 14159 if ( items.length ) { 14160 this.items = this.items.concat( items ); 14161 } 14162 return items; 14163}; 14164 14165/** 14166 * Layout newly-appended item elements 14167 * @param {Array or NodeList or Element} elems 14168 */ 14169Outlayer.prototype.appended = function( elems ) { 14170 var items = this.addItems( elems ); 14171 if ( !items.length ) { 14172 return; 14173 } 14174 // layout and reveal just the new items 14175 this.layoutItems( items, true ); 14176 this.reveal( items ); 14177}; 14178 14179/** 14180 * Layout prepended elements 14181 * @param {Array or NodeList or Element} elems 14182 */ 14183Outlayer.prototype.prepended = function( elems ) { 14184 var items = this._itemize( elems ); 14185 if ( !items.length ) { 14186 return; 14187 } 14188 // add items to beginning of collection 14189 var previousItems = this.items.slice(0); 14190 this.items = items.concat( previousItems ); 14191 // start new layout 14192 this._resetLayout(); 14193 this._manageStamps(); 14194 // layout new stuff without transition 14195 this.layoutItems( items, true ); 14196 this.reveal( items ); 14197 // layout previous items 14198 this.layoutItems( previousItems ); 14199}; 14200 14201/** 14202 * reveal a collection of items 14203 * @param {Array of Outlayer.Items} items 14204 */ 14205Outlayer.prototype.reveal = function( items ) { 14206 this._emitCompleteOnItems( 'reveal', items ); 14207 14208 var len = items && items.length; 14209 for ( var i=0; len && i < len; i++ ) { 14210 var item = items[i]; 14211 item.reveal(); 14212 } 14213}; 14214 14215/** 14216 * hide a collection of items 14217 * @param {Array of Outlayer.Items} items 14218 */ 14219Outlayer.prototype.hide = function( items ) { 14220 this._emitCompleteOnItems( 'hide', items ); 14221 14222 var len = items && items.length; 14223 for ( var i=0; len && i < len; i++ ) { 14224 var item = items[i]; 14225 item.hide(); 14226 } 14227}; 14228 14229/** 14230 * reveal item elements 14231 * @param {Array}, {Element}, {NodeList} items 14232 */ 14233Outlayer.prototype.revealItemElements = function( elems ) { 14234 var items = this.getItems( elems ); 14235 this.reveal( items ); 14236}; 14237 14238/** 14239 * hide item elements 14240 * @param {Array}, {Element}, {NodeList} items 14241 */ 14242Outlayer.prototype.hideItemElements = function( elems ) { 14243 var items = this.getItems( elems ); 14244 this.hide( items ); 14245}; 14246 14247/** 14248 * get Outlayer.Item, given an Element 14249 * @param {Element} elem 14250 * @param {Function} callback 14251 * @returns {Outlayer.Item} item 14252 */ 14253Outlayer.prototype.getItem = function( elem ) { 14254 // loop through items to get the one that matches 14255 for ( var i=0, len = this.items.length; i < len; i++ ) { 14256 var item = this.items[i]; 14257 if ( item.element === elem ) { 14258 // return item 14259 return item; 14260 } 14261 } 14262}; 14263 14264/** 14265 * get collection of Outlayer.Items, given Elements 14266 * @param {Array} elems 14267 * @returns {Array} items - Outlayer.Items 14268 */ 14269Outlayer.prototype.getItems = function( elems ) { 14270 elems = utils.makeArray( elems ); 14271 var items = []; 14272 for ( var i=0, len = elems.length; i < len; i++ ) { 14273 var elem = elems[i]; 14274 var item = this.getItem( elem ); 14275 if ( item ) { 14276 items.push( item ); 14277 } 14278 } 14279 14280 return items; 14281}; 14282 14283/**
14284 * remove element(s) from instance and DOM 14285 * @param {Array or NodeList or Element} elems 14286 */ 14287Outlayer.prototype.remove = function( elems ) { 14288 var removeItems = this.getItems( elems ); 14289 14290 this._emitCompleteOnItems( 'remove', removeItems ); 14291 14292 // bail if no items to remove 14293 if ( !removeItems || !removeItems.length ) { 14294 return; 14295 } 14296 14297 for ( var i=0, len = removeItems.length; i < len; i++ ) { 14298 var item = removeItems[i]; 14299 item.remove(); 14300 // remove item from collection 14301 utils.removeFrom( this.items, item ); 14302 } 14303}; 14304 14305// ----- destroy ----- // 14306 14307// remove and disable Outlayer instance 14308Outlayer.prototype.destroy = function() { 14309 // clean up dynamic styles 14310 var style = this.element.style; 14311 style.height = ''; 14312 style.position = ''; 14313 style.width = ''; 14314 // destroy items 14315 for ( var i=0, len = this.items.length; i < len; i++ ) { 14316 var item = this.items[i]; 14317 item.destroy(); 14318 } 14319 14320 this.unbindResize(); 14321 14322 var id = this.element.outlayerGUID; 14323 delete instances[ id ]; // remove reference to instance by id 14324 delete this.element.outlayerGUID; 14325 // remove data for jQuery 14326 if ( jQuery ) { 14327 jQuery.removeData( this.element, this.constructor.namespace ); 14328 } 14329 14330}; 14331 14332// -------------------------- data -------------------------- // 14333 14334/** 14335 * get Outlayer instance from element 14336 * @param {Element} elem 14337 * @returns {Outlayer} 14338 */ 14339Outlayer.data = function( elem ) { 14340 elem = utils.getQueryElement( elem ); 14341 var id = elem && elem.outlayerGUID; 14342 return id && instances[ id ]; 14343}; 14344 14345 14346// -------------------------- create Outlayer class -------------------------- // 14347 14348/** 14349 * create a layout class 14350 * @param {String} namespace 14351 */ 14352Outlayer.create = function( namespace, options ) { 14353 // sub-class Outlayer 14354 function Layout() { 14355 Outlayer.apply( this, arguments ); 14356 } 14357 // inherit Outlayer prototype, use Object.create if there 14358 if ( Object.create ) { 14359 Layout.prototype = Object.create( Outlayer.prototype ); 14360 } else { 14361 utils.extend( Layout.prototype, Outlayer.prototype ); 14362 } 14363 // set contructor, used for namespace and Item 14364 Layout.prototype.constructor = Layout; 14365 14366 Layout.defaults = utils.extend( {}, Outlayer.defaults ); 14367 // apply new options 14368 utils.extend( Layout.defaults, options ); 14369 // keep prototype.settings for backwards compatibility (Packery v1.2.0) 14370 Layout.prototype.settings = {}; 14371 14372 Layout.namespace = namespace; 14373 14374 Layout.data = Outlayer.data; 14375 14376 // sub-class Item 14377 Layout.Item = function LayoutItem() { 14378 Item.apply( this, arguments ); 14379 }; 14380 14381 Layout.Item.prototype = new Item(); 14382 14383 // -------------------------- declarative -------------------------- // 14384 14385 utils.htmlInit( Layout, namespace ); 14386 14387 // -------------------------- jQuery bridge -------------------------- // 14388 14389 // make into jQuery plugin 14390 if ( jQuery && jQuery.bridget ) { 14391 jQuery.bridget( namespace, Layout ); 14392 } 14393 14394 return Layout; 14395}; 14396 14397// ----- fin ----- // 14398 14399// back in global 14400Outlayer.Item = Item; 14401 14402return Outlayer; 14403 14404})); 14405 14406 14407/*! 14408 * Masonry v3.1.5 14409 * Cascading grid layout library 14410 * http://masonry.desandro.com 14411 * MIT License 14412 * by David DeSandro 14413 */ 14414 14415( function( window ) { 14416 14417 14418 14419// -------------------------- helpers -------------------------- // 14420 14421var indexOf = Array.prototype.indexOf ? 14422 function( items, value ) { 14423 return items.indexOf( value ); 14424 } : 14425 function ( items, value ) { 14426 for ( var i=0, len = items.length; i < len; i++ ) { 14427 var item = items[i]; 14428 if ( item === value ) { 14429 return i; 14430 } 14431 } 14432 return -1; 14433 }; 14434 14435// -------------------------- masonryDefinition -------------------------- // 14436 14437// used for AMD definition and requires 14438function masonryDefinition( Outlayer, getSize ) { 14439 // create an Outlayer layout class 14440 var Masonry = Outlayer.create('masonry'); 14441 14442 Masonry.prototype._resetLayout = function() { 14443 this.getSize(); 14444 this._getMeasurement( 'columnWidth', 'outerWidth' ); 14445 this._getMeasurement( 'gutter', 'outerWidth' ); 14446 this.measureColumns(); 14447 14448 // reset column Y 14449 var i = this.cols; 14450 this.colYs = []; 14451 while (i--) { 14452 this.colYs.push( 0 ); 14453 } 14454 14455 this.maxY = 0; 14456 }; 14457 14458 Masonry.prototype.measureColumns = function() { 14459 this.getContainerWidth(); 14460 // if columnWidth is 0, default to outerWidth of first item 14461 if ( !this.columnWidth ) { 14462 var firstItem = this.items[0]; 14463 var firstItemElem = firstItem && firstItem.element; 14464 // columnWidth fall back to item of first element 14465 this.columnWidth = firstItemElem && getSize( firstItemElem ).outerWidth || 14466 // if first elem has no width, default to size of container 14467 this.containerWidth; 14468 } 14469 14470 this.columnWidth += this.gutter; 14471 14472 this.cols = Math.floor( ( this.containerWidth + this.gutter ) / this.columnWidth ); 14473 this.cols = Math.max( this.cols, 1 ); 14474 }; 14475 14476 Masonry.prototype.getContainerWidth = function() { 14477 // container is parent if fit width 14478 var container = this.options.isFitWidth ? this.element.parentNode : this.element; 14479 // check that this.size and size are there 14480 // IE8 triggers resize on body size change, so they might not be 14481 var size = getSize( container ); 14482 this.containerWidth = size && size.innerWidth; 14483 }; 14484 14485 Masonry.prototype._getItemLayoutPosition = function( item ) { 14486 item.getSize(); 14487 // how many columns does this brick span 14488 var remainder = item.size.outerWidth % this.columnWidth; 14489 var mathMethod = remainder && remainder < 1 ? 'round' : 'ceil'; 14490 // round if off by 1 pixel, otherwise use ceil 14491 var colSpan = Math[ mathMethod ]( item.size.outerWidth / this.columnWidth ); 14492 colSpan = Math.min( colSpan, this.cols ); 14493 14494 var colGroup = this._getColGroup( colSpan ); 14495 // get the minimum Y value from the columns 14496 var minimumY = Math.min.apply( Math, colGroup ); 14497 var shortColIndex = indexOf( colGroup, minimumY ); 14498 14499 // position the brick 14500 var position = { 14501 x: this.columnWidth * shortColIndex, 14502 y: minimumY 14503 }; 14504 14505 // apply setHeight to necessary columns 14506 var setHeight = minimumY + item.size.outerHeight; 14507 var setSpan = this.cols + 1 - colGroup.length; 14508 for ( var i = 0; i < setSpan; i++ ) { 14509 this.colYs[ shortColIndex + i ] = setHeight; 14510 } 14511 14512 return position; 14513 }; 14514 14515 /** 14516 * @param {Number} colSpan - number of columns the element spans 14517 * @returns {Array} colGroup 14518 */ 14519 Masonry.prototype._getColGroup = function( colSpan ) { 14520 if ( colSpan < 2 ) { 14521 // if brick spans only one column, use all the column Ys 14522 return this.colYs; 14523 } 14524 14525 var colGroup = []; 14526 // how many different places could this brick fit horizontally 14527 var groupCount = this.cols + 1 - colSpan; 14528 // for each group potential horizontal position 14529 for ( var i = 0; i < groupCount; i++ ) { 14530 // make an array of colY values for that one group 14531 var groupColYs = this.colYs.slice( i, i + colSpan ); 14532 // and get the max value of the array 14533 colGroup[i] = Math.max.apply( Math, groupColYs ); 14534 } 14535 return colGroup; 14536 }; 14537 14538 Masonry.prototype._manageStamp = function( stamp ) { 14539 var stampSize = getSize( stamp ); 14540 var offset = this._getElementOffset( stamp ); 14541 // get the columns that this stamp affects 14542 var firstX = this.options.isOriginLeft ? offset.left : offset.right; 14543 var lastX = firstX + stampSize.outerWidth; 14544 var firstCol = Math.floor( firstX / this.columnWidth ); 14545 firstCol = Math.max( 0, firstCol ); 14546 var lastCol = Math.floor( lastX / this.columnWidth ); 14547 // lastCol should not go over if multiple of columnWidth #425 14548 lastCol -= lastX % this.columnWidth ? 0 : 1; 14549 lastCol = Math.min( this.cols - 1, lastCol ); 14550 // set colYs to bottom of the stamp 14551 var stampMaxY = ( this.options.isOriginTop ? offset.top : offset.bottom ) + 14552 stampSize.outerHeight; 14553 for ( var i = firstCol; i <= lastCol; i++ ) { 14554 this.colYs[i] = Math.max( stampMaxY, this.colYs[i] ); 14555 } 14556 }; 14557 14558 Masonry.prototype._getContainerSize = function() { 14559 this.maxY = Math.max.apply( Math, this.colYs ); 14560 var size = { 14561 height: this.maxY 14562 }; 14563 14564 if ( this.options.isFitWidth ) { 14565 size.width = this._getContainerFitWidth(); 14566 } 14567 14568 return size; 14569 }; 14570 14571 Masonry.prototype._getContainerFitWidth = function() { 14572 var unusedCols = 0; 14573 // count unused columns 14574 var i = this.cols; 14575 while ( --i ) { 14576 if ( this.colYs[i] !== 0 ) { 14577 break; 14578 } 14579 unusedCols++; 14580 } 14581 // fit container to columns that have been used 14582 return ( this.cols - unusedCols ) * this.columnWidth - this.gutter; 14583 }; 14584 14585 Masonry.prototype.needsResizeLayout = function() { 14586 var previousWidth = this.containerWidth; 14587 this.getContainerWidth(); 14588 return previousWidth !== this.containerWidth; 14589 }; 14590 14591 return Masonry; 14592} 14593 14594// -------------------------- transport -------------------------- // 14595 14596if ( typeof define === 'function' && define.amd ) { 14597 // AMD 14598 define( 'masonry',[ 14599 'outlayer/outlayer', 14600 'get-size/get-size' 14601 ], 14602 masonryDefinition ); 14603} else { 14604 // browser global 14605 window.Masonry = masonryDefinition( 14606 window.Outlayer, 14607 window.getSize 14608 ); 14609} 14610 14611})( window ); 14612 14613/*! 14614 * imagesLoaded PACKAGED v3.1.4 14615 * JavaScript is all like "You images are done yet or what?" 14616 * MIT License 14617 */ 14618 14619 14620/*! 14621 * EventEmitter v4.2.6 - git.io/ee 14622 * Oliver Caldwell 14623 * MIT license 14624 * @preserve 14625 */ 14626 14627(function () { 14628 14629 14630 /** 14631 * Class for managing events. 14632 * Can be extended to provide event functionality in other classes. 14633 * 14634 * @class EventEmitter Manages event registering and emitting. 14635 */ 14636 function EventEmitter() {} 14637 14638 // Shortcuts to improve speed and size 14639 var proto = EventEmitter.prototype; 14640 var exports = this; 14641 var originalGlobalValue = exports.EventEmitter; 14642 14643 /** 14644 * Finds the index of the listener for the event in it's storage array. 14645 * 14646 * @param {Function[]} listeners Array of listeners to search through. 14647 * @param {Function} listener Method to look for. 14648 * @return {Number} Index of the specified listener, -1 if not found 14649 * @api private 14650 */ 14651 function indexOfListener(listeners, listener) { 14652 var i = listeners.length; 14653 while (i--) { 14654 if (listeners[i].listener === listener) { 14655 return i; 14656 } 14657 } 14658 14659 return -1; 14660 } 14661 14662 /** 14663 * Alias a method while keeping the context correct, to allow for over
14663writing of target method. 14664 * 14665 * @param {String} name The name of the target method. 14666 * @return {Function} The aliased method 14667 * @api private 14668 */ 14669 function alias(name) { 14670 return function aliasClosure() { 14671 return this[name].apply(this, arguments); 14672 }; 14673 } 14674 14675 /** 14676 * Returns the listener array for the specified event. 14677 * Will initialise the event object and listener arrays if required. 14678 * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them. 14679 * Each property in the object response is an array of listener functions. 14680 * 14681 * @param {String|RegExp} evt Name of the event to return the listeners from. 14682 * @return {Function[]|Object} All listener functions for the event. 14683 */ 14684 proto.getListeners = function getListeners(evt) { 14685 var events = this._getEvents(); 14686 var response; 14687 var key; 14688 14689 // Return a concatenated array of all matching events if 14690 // the selector is a regular expression. 14691 if (typeof evt === 'object') { 14692 response = {}; 14693 for (key in events) { 14694 if (events.hasOwnProperty(key) && evt.test(key)) { 14695 response[key] = events[key]; 14696 } 14697 } 14698 } 14699 else { 14700 response = events[evt] || (events[evt] = []); 14701 } 14702 14703 return response; 14704 }; 14705 14706 /** 14707 * Takes a list of listener objects and flattens it into a list of listener functions. 14708 * 14709 * @param {Object[]} listeners Raw listener objects. 14710 * @return {Function[]} Just the listener functions. 14711 */ 14712 proto.flattenListeners = function flattenListeners(listeners) { 14713 var flatListeners = []; 14714 var i; 14715 14716 for (i = 0; i < listeners.length; i += 1) { 14717 flatListeners.push(listeners[i].listener); 14718 } 14719 14720 return flatListeners; 14721 }; 14722 14723 /** 14724 * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful. 14725 * 14726 * @param {String|RegExp} evt Name of the event to return the listeners from. 14727 * @return {Object} All listener functions for an event in an object. 14728 */ 14729 proto.getListenersAsObject = function getListenersAsObject(evt) { 14730 var listeners = this.getListeners(evt); 14731 var response; 14732 14733 if (listeners instanceof Array) { 14734 response = {}; 14735 response[evt] = listeners; 14736 } 14737 14738 return response || listeners; 14739 }; 14740 14741 /** 14742 * Adds a listener function to the specified event. 14743 * The listener will not be added if it is a duplicate. 14744 * If the listener returns true then it will be removed after it is called. 14745 * If you pass a regular expression as the event name then the listener will be added to all events that match it. 14746 * 14747 * @param {String|RegExp} evt Name of the event to attach the listener to. 14748 * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. 14749 * @return {Object} Current instance of EventEmitter for chaining. 14750 */ 14751 proto.addListener = function addListener(evt, listener) { 14752 var listeners = this.getListenersAsObject(evt); 14753 var listenerIsWrapped = typeof listener === 'object'; 14754 var key; 14755 14756 for (key in listeners) { 14757 if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) { 14758 listeners[key].push(listenerIsWrapped ? listener : { 14759 listener: listener, 14760 once: false 14761 }); 14762 } 14763 } 14764 14765 return this; 14766 }; 14767 14768 /** 14769 * Alias of addListener 14770 */ 14771 proto.on = alias('addListener'); 14772 14773 /** 14774 * Semi-alias of addListener. It will add a listener that will be 14775 * automatically removed after it's first execution. 14776 * 14777 * @param {String|RegExp} evt Name of the event to attach the listener to. 14778 * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. 14779 * @return {Object} Current instance of EventEmitter for chaining. 14780 */ 14781 proto.addOnceListener = function addOnceListener(evt, listener) { 14782 return this.addListener(evt, { 14783 listener: listener, 14784 once: true 14785 }); 14786 }; 14787 14788 /** 14789 * Alias of addOnceListener. 14790 */ 14791 proto.once = alias('addOnceListener'); 14792 14793 /** 14794 * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad. 14795 * You need to tell it what event names should be matched by a regex. 14796 * 14797 * @param {String} evt Name of the event to create. 14798 * @return {Object} Current instance of EventEmitter for chaining. 14799 */ 14800 proto.defineEvent = function defineEvent(evt) { 14801 this.getListeners(evt); 14802 return this; 14803 }; 14804 14805 /** 14806 * Uses defineEvent to define multiple events. 14807 * 14808 * @param {String[]} evts An array of event names to define. 14809 * @return {Object} Current instance of EventEmitter for chaining. 14810 */ 14811 proto.defineEvents = function defineEvents(evts) { 14812 for (var i = 0; i < evts.length; i += 1) { 14813 this.defineEvent(evts[i]); 14814 } 14815 return this; 14816 }; 14817 14818 /** 14819 * Removes a listener function from the specified event. 14820 * When passed a regular expression as the event name, it will remove the listener from all events that match it. 14821 * 14822 * @param {String|RegExp} evt Name of the event to remove the listener from. 14823 * @param {Function} listener Method to remove from the event. 14824 * @return {Object} Current instance of EventEmitter for chaining. 14825 */ 14826 proto.removeListener = function removeListener(evt, listener) { 14827 var listeners = this.getListenersAsObject(evt); 14828 var index; 14829 var key; 14830 14831 for (key in listeners) { 14832 if (listeners.hasOwnProperty(key)) { 14833 index = indexOfListener(listeners[key], listener); 14834 14835 if (index !== -1) { 14836 listeners[key].splice(index, 1); 14837 } 14838 } 14839 } 14840 14841 return this; 14842 }; 14843 14844 /** 14845 * Alias of removeListener 14846 */ 14847 proto.off = alias('removeListener'); 14848 14849 /** 14850 * Adds listeners in bulk using the manipulateListeners method. 14851 * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added. 14852 * You can also pass it a regular expression to add the array of listeners to all events that match it. 14853 * Yeah, this function does quite a bit. That's probably a bad thing. 14854 * 14855 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once. 14856 * @param {Function[]} [listeners] An optional array of listener functions to add. 14857 * @return {Object} Current instance of EventEmitter for chaining. 14858 */ 14859 proto.addListeners = function addListeners(evt, listeners) { 14860 // Pass through to manipulateListeners 14861 return this.manipulateListeners(false, evt, listeners); 14862 }; 14863 14864 /** 14865 * Removes listeners in bulk using the manipulateListeners method. 14866 * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. 14867 * You can also pass it an event name and an array of listeners to be removed. 14868 * You can also pass it a regular expression to remove the listeners from all events that match it. 14869 * 14870 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once. 14871 * @param {Function[]} [listeners] An optional array of listener functions to remove. 14872 * @return {Object} Current instance of EventEmitter for chaining. 14873 */ 14874 proto.removeListeners = function removeListeners(evt, listeners) { 14875 // Pass through to manipulateListeners 14876 return this.manipulateListeners(true, evt, listeners); 14877 }; 14878 14879 /** 14880 * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level. 14881 * The first argument will determine if the listeners are removed (true) or added (false). 14882 * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. 14883 * You can also pass it an event name and an array of listeners to be added/removed. 14884 * You can also pass it a regular expression to manipulate the listeners of all events that match it. 14885 * 14886 * @param {Boolean} remove True if you want to remove listeners, false if you want to add. 14887 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once. 14888 * @param {Function[]} [listeners] An optional array of listener functions to add/remove. 14889 * @return {Object} Current instance of EventEmitter for chaining. 14890 */ 14891 proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) { 14892 var i; 14893 var value; 14894 var single = remove ? this.removeListener : this.addListener; 14895 var multiple = remove ? this.removeListeners : this.addListeners; 14896 14897 // If evt is an object then pass each of it's properties to this method 14898 if (typeof evt === 'object' && !(evt instanceof RegExp)) { 14899 for (i in evt) { 14900 if (evt.hasOwnProperty(i) && (value = evt[i])) { 14901 // Pass the single listener straight through to the singular method 14902 if (typeof value === 'function') { 14903 single.call(this, i, value); 14904 } 14905 else { 14906 // Otherwise pass back to the multiple function 14907 multiple.call(this, i, value); 14908 } 14909 } 14910 } 14911 } 14912 else { 14913 // So evt must be a string 14914 // And listeners must be an array of listeners 14915 // Loop over it and pass each one to the multiple method 14916 i = listeners.length; 14917 while (i--) { 14918 single.call(this, evt, listeners[i]); 14919 } 14920 } 14921 14922 return this; 14923 }; 14924 14925 /** 14926 * Removes all listeners from a specified event. 14927 * If you do not specify an event then all listeners will be removed. 14928 * That means every event will be emptied. 14929 * You can also pass a regex to remove all events that match it. 14930 * 14931 * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed. 14932 * @return {Object} Current instance of EventEmitter for chaining. 14933 */ 14934 proto.removeEvent = function removeEvent(evt) { 14935 var type = typeof evt; 14936 var events = this._getEvents(); 14937 var key; 14938 14939 // Remove different things depending on the state of evt 14940 if (type === 'string') { 14941 // Remove all listeners for the specified event 14942 delete events[evt]; 14943 } 14944 else if (type === 'object') { 14945 // Remove all events matching the regex. 14946 for (key in events) { 14947 if (events.hasOwnProperty(key) && evt.test(key)) { 14948 delete events[key]; 14949 } 14950 } 14951 } 14952 else { 14953 // Remove all listeners in all events 14954 delete this._events; 14955 } 14956 14957 return this; 14958 }; 14959 14960 /** 14961 * Alias of removeEvent. 14962 * 14963 * Added to mirror the node API. 14964 */ 14965 proto.removeAllListeners = alias('removeEvent'); 14966 14967 /** 14968 * Emits an event of your choice. 14969 * When emitted, every listener attached to that event will be executed. 14970 * If you pass the optional argument array then those arguments will be passed to every listener upon execution. 14971 * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
14972 * So they will not arrive within the array on the other side, they will be separate. 14973 * You can also pass a regular expression to emit to all events that match it. 14974 * 14975 * @param {String|RegExp} evt Name of the event to emit and execute listeners for. 14976 * @param {Array} [args] Optional array of arguments to be passed to each listener. 14977 * @return {Object} Current instance of EventEmitter for chaining. 14978 */ 14979 proto.emitEvent = function emitEvent(evt, args) { 14980 var listeners = this.getListenersAsObject(evt); 14981 var listener; 14982 var i; 14983 var key; 14984 var response; 14985 14986 for (key in listeners) { 14987 if (listeners.hasOwnProperty(key)) { 14988 i = listeners[key].length; 14989 14990 while (i--) { 14991 // If the listener returns true then it shall be removed from the event 14992 // The function is executed either with a basic call or an apply if there is an args array 14993 listener = listeners[key][i]; 14994 14995 if (listener.once === true) { 14996 this.removeListener(evt, listener.listener); 14997 } 14998 14999 response = listener.listener.apply(this, args || []); 15000 15001 if (response === this._getOnceReturnValue()) { 15002 this.removeListener(evt, listener.listener); 15003 } 15004 } 15005 } 15006 } 15007 15008 return this; 15009 }; 15010 15011 /** 15012 * Alias of emitEvent 15013 */ 15014 proto.trigger = alias('emitEvent'); 15015 15016 /** 15017 * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on. 15018 * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it. 15019 * 15020 * @param {String|RegExp} evt Name of the event to emit and execute listeners for. 15021 * @param {...*} Optional additional arguments to be passed to each listener. 15022 * @return {Object} Current instance of EventEmitter for chaining. 15023 */ 15024 proto.emit = function emit(evt) { 15025 var args = Array.prototype.slice.call(arguments, 1); 15026 return this.emitEvent(evt, args); 15027 }; 15028 15029 /** 15030 * Sets the current value to check against when executing listeners. If a 15031 * listeners return value matches the one set here then it will be removed 15032 * after execution. This value defaults to true. 15033 * 15034 * @param {*} value The new value to check for when executing listeners. 15035 * @return {Object} Current instance of EventEmitter for chaining. 15036 */ 15037 proto.setOnceReturnValue = function setOnceReturnValue(value) { 15038 this._onceReturnValue = value; 15039 return this; 15040 }; 15041 15042 /** 15043 * Fetches the current value to check against when executing listeners. If 15044 * the listeners return value matches this one then it should be removed 15045 * automatically. It will return true by default. 15046 * 15047 * @return {*|Boolean} The current value to check for or the default, true. 15048 * @api private 15049 */ 15050 proto._getOnceReturnValue = function _getOnceReturnValue() { 15051 if (this.hasOwnProperty('_onceReturnValue')) { 15052 return this._onceReturnValue; 15053 } 15054 else { 15055 return true; 15056 } 15057 }; 15058 15059 /** 15060 * Fetches the events object and creates one if required. 15061 * 15062 * @return {Object} The events storage object. 15063 * @api private 15064 */ 15065 proto._getEvents = function _getEvents() { 15066 return this._events || (this._events = {}); 15067 }; 15068 15069 /** 15070 * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version. 15071 * 15072 * @return {Function} Non conflicting EventEmitter class. 15073 */ 15074 EventEmitter.noConflict = function noConflict() { 15075 exports.EventEmitter = originalGlobalValue; 15076 return EventEmitter; 15077 }; 15078 15079 // Expose the class either via AMD, CommonJS or the global object 15080 if (typeof define === 'function' && define.amd) { 15081 define('eventEmitter/EventEmitter',[],function () { 15082 return EventEmitter; 15083 }); 15084 } 15085 else if (typeof module === 'object' && module.exports){ 15086 module.exports = EventEmitter; 15087 } 15088 else { 15089 this.EventEmitter = EventEmitter; 15090 } 15091}.call(this)); 15092 15093/*! 15094 * eventie v1.0.4 15095 * event binding helper 15096 * eventie.bind( elem, 'click', myFn ) 15097 * eventie.unbind( elem, 'click', myFn ) 15098 */ 15099 15100/*jshint browser: true, undef: true, unused: true */ 15101/*global define: false */ 15102 15103( function( window ) { 15104 15105 15106 15107var docElem = document.documentElement; 15108 15109var bind = function() {}; 15110 15111function getIEEvent( obj ) { 15112 var event = window.event; 15113 // add event.target 15114 event.target = event.target || event.srcElement || obj; 15115 return event; 15116} 15117 15118if ( docElem.addEventListener ) { 15119 bind = function( obj, type, fn ) { 15120 obj.addEventListener( type, fn, false ); 15121 }; 15122} else if ( docElem.attachEvent ) { 15123 bind = function( obj, type, fn ) { 15124 obj[ type + fn ] = fn.handleEvent ? 15125 function() { 15126 var event = getIEEvent( obj ); 15127 fn.handleEvent.call( fn, event ); 15128 } : 15129 function() { 15130 var event = getIEEvent( obj ); 15131 fn.call( obj, event ); 15132 }; 15133 obj.attachEvent( "on" + type, obj[ type + fn ] ); 15134 }; 15135} 15136 15137var unbind = function() {}; 15138 15139if ( docElem.removeEventListener ) { 15140 unbind = function( obj, type, fn ) { 15141 obj.removeEventListener( type, fn, false ); 15142 }; 15143} else if ( docElem.detachEvent ) { 15144 unbind = function( obj, type, fn ) { 15145 obj.detachEvent( "on" + type, obj[ type + fn ] ); 15146 try { 15147 delete obj[ type + fn ]; 15148 } catch ( err ) { 15149 // can't delete window object properties 15150 obj[ type + fn ] = undefined; 15151 } 15152 }; 15153} 15154 15155var eventie = { 15156 bind: bind, 15157 unbind: unbind 15158}; 15159 15160// transport 15161if ( typeof define === 'function' && define.amd ) { 15162 // AMD 15163 define( 'eventie/eventie',eventie ); 15164} else { 15165 // browser global 15166 window.eventie = eventie; 15167} 15168 15169})( this ); 15170 15171/*! 15172 * imagesLoaded v3.1.4 15173 * JavaScript is all like "You images are done yet or what?" 15174 * MIT License 15175 */ 15176 15177( function( window, factory ) { 15178 // universal module definition 15179 15180 /*global define: false, module: false, require: false */ 15181 15182 if ( typeof define === 'function' && define.amd ) { 15183 // AMD 15184 define( 'imagesloaded',[ 15185 'eventEmitter/EventEmitter', 15186 'eventie/eventie' 15187 ], function( EventEmitter, eventie ) { 15188 return factory( window, EventEmitter, eventie ); 15189 }); 15190 } else if ( typeof exports === 'object' ) { 15191 // CommonJS 15192 module.exports = factory( 15193 window, 15194 require('eventEmitter'), 15195 require('eventie') 15196 ); 15197 } else { 15198 // browser global 15199 window.imagesLoaded = factory( 15200 window, 15201 window.EventEmitter, 15202 window.eventie 15203 ); 15204 } 15205 15206})( this, 15207
15208// -------------------------- factory -------------------------- // 15209 15210function factory( window, EventEmitter, eventie ) { 15211 15212 15213 15214var $ = window.jQuery; 15215var console = window.console; 15216var hasConsole = typeof console !== 'undefined'; 15217 15218// -------------------------- helpers -------------------------- // 15219 15220// extend objects 15221function extend( a, b ) { 15222 for ( var prop in b ) { 15223 a[ prop ] = b[ prop ]; 15224 } 15225 return a; 15226} 15227 15228var objToString = Object.prototype.toString; 15229function isArray( obj ) { 15230 return objToString.call( obj ) === '[object Array]'; 15231} 15232 15233// turn element or nodeList into an array 15234function makeArray( obj ) { 15235 var ary = []; 15236 if ( isArray( obj ) ) { 15237 // use object if already an array 15238 ary = obj; 15239 } else if ( typeof obj.length === 'number' ) { 15240 // convert nodeList to array 15241 for ( var i=0, len = obj.length; i < len; i++ ) { 15242 ary.push( obj[i] ); 15243 } 15244 } else { 15245 // array of single index 15246 ary.push( obj ); 15247 } 15248 return ary; 15249} 15250 15251 // -------------------------- imagesLoaded -------------------------- // 15252 15253 /** 15254 * @param {Array, Element, NodeList, String} elem 15255 * @param {Object or Function} options - if function, use as callback 15256 * @param {Function} onAlways - callback function 15257 */ 15258 function ImagesLoaded( elem, options, onAlways ) { 15259 // coerce ImagesLoaded() without new, to be new ImagesLoaded() 15260 if ( !( this instanceof ImagesLoaded ) ) { 15261 return new ImagesLoaded( elem, options ); 15262 } 15263 // use elem as selector string 15264 if ( typeof elem === 'string' ) { 15265 elem = document.querySelectorAll( elem ); 15266 } 15267 15268 this.elements = makeArray( elem ); 15269 this.options = extend( {}, this.options ); 15270 15271 if ( typeof options === 'function' ) { 15272 onAlways = options; 15273 } else { 15274 extend( this.options, options ); 15275 } 15276 15277 if ( onAlways ) { 15278 this.on( 'always', onAlways ); 15279 } 15280 15281 this.getImages(); 15282 15283 if ( $ ) { 15284 // add jQuery Deferred object 15285 this.jqDeferred = new $.Deferred(); 15286 } 15287 15288 // HACK check async to allow time to bind listeners 15289 var _this = this; 15290 setTimeout( function() { 15291 _this.check(); 15292 }); 15293 } 15294 15295 ImagesLoaded.prototype = new EventEmitter(); 15296 15297 ImagesLoaded.prototype.options = {}; 15298 15299 ImagesLoaded.prototype.getImages = function() { 15300 this.images = []; 15301 15302 // filter & find items if we have an item selector 15303 for ( var i=0, len = this.elements.length; i < len; i++ ) { 15304 var elem = this.elements[i]; 15305 // filter siblings 15306 if ( elem.nodeName === 'IMG' ) { 15307 this.addImage( elem ); 15308 } 15309 // find children 15310 var childElems = elem.querySelectorAll('img'); 15311 // concat childElems to filterFound array 15312 for ( var j=0, jLen = childElems.length; j < jLen; j++ ) { 15313 var img = childElems[j]; 15314 this.addImage( img ); 15315 } 15316 } 15317 }; 15318 15319 /** 15320 * @param {Image} img 15321 */ 15322 ImagesLoaded.prototype.addImage = function( img ) { 15323 var loadingImage = new LoadingImage( img ); 15324 this.images.push( loadingImage ); 15325 }; 15326 15327 ImagesLoaded.prototype.check = function() { 15328 var _this = this; 15329 var checkedCount = 0; 15330 var length = this.images.length; 15331 this.hasAnyBroken = false; 15332 // complete if no images 15333 if ( !length ) { 15334 this.complete(); 15335 return; 15336 } 15337 15338 function onConfirm( image, message ) { 15339 if ( _this.options.debug && hasConsole ) { 15340 console.log( 'confirm', image, message ); 15341 } 15342 15343 _this.progress( image ); 15344 checkedCount++; 15345 if ( checkedCount === length ) { 15346 _this.complete(); 15347 } 15348 return true; // bind once 15349 } 15350 15351 for ( var i=0; i < length; i++ ) { 15352 var loadingImage = this.images[i]; 15353 loadingImage.on( 'confirm', onConfirm ); 15354 loadingImage.check(); 15355 } 15356 }; 15357 15358 ImagesLoaded.prototype.progress = function( image ) { 15359 this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; 15360 // HACK - Chrome triggers event before object properties have changed. #83 15361 var _this = this; 15362 setTimeout( function() { 15363 _this.emit( 'progress', _this, image ); 15364 if ( _this.jqDeferred && _this.jqDeferred.notify ) { 15365 _this.jqDeferred.notify( _this, image ); 15366 } 15367 }); 15368 }; 15369 15370 ImagesLoaded.prototype.complete = function() { 15371 var eventName = this.hasAnyBroken ? 'fail' : 'done'; 15372 this.isComplete = true; 15373 var _this = this; 15374 // HACK - another setTimeout so that confirm happens after progress 15375 setTimeout( function() {
15376 _this.emit( eventName, _this ); 15377 _this.emit( 'always', _this ); 15378 if ( _this.jqDeferred ) { 15379 var jqMethod = _this.hasAnyBroken ? 'reject' : 'resolve'; 15380 _this.jqDeferred[ jqMethod ]( _this ); 15381 } 15382 }); 15383 }; 15384 15385 // -------------------------- jquery -------------------------- // 15386 15387 if ( $ ) { 15388 $.fn.imagesLoaded = function( options, callback ) { 15389 var instance = new ImagesLoaded( this, options, callback ); 15390 return instance.jqDeferred.promise( $(this) ); 15391 }; 15392 } 15393 15394 15395 // -------------------------- -------------------------- // 15396 15397 function LoadingImage( img ) { 15398 this.img = img; 15399 } 15400 15401 LoadingImage.prototype = new EventEmitter(); 15402 15403 LoadingImage.prototype.check = function() { 15404 // first check cached any previous images that have same src 15405 var resource = cache[ this.img.src ] || new Resource( this.img.src ); 15406 if ( resource.isConfirmed ) { 15407 this.confirm( resource.isLoaded, 'cached was confirmed' ); 15408 return; 15409 } 15410 15411 // If complete is true and browser supports natural sizes, 15412 // try to check for image status manually. 15413 if ( this.img.complete && this.img.naturalWidth !== undefined ) { 15414 // report based on naturalWidth 15415 this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); 15416 return; 15417 } 15418 15419 // If none of the checks above matched, simulate loading on detached element. 15420 var _this = this; 15421 resource.on( 'confirm', function( resrc, message ) { 15422 _this.confirm( resrc.isLoaded, message ); 15423 return true; 15424 }); 15425 15426 resource.check(); 15427 }; 15428 15429 LoadingImage.prototype.confirm = function( isLoaded, message ) { 15430 this.isLoaded = isLoaded; 15431 this.emit( 'confirm', this, message ); 15432 }; 15433 15434 // -------------------------- Resource -------------------------- // 15435 15436 // Resource checks each src, only once 15437 // separate class from LoadingImage to prevent memory leaks. See #115 15438 15439 var cache = {}; 15440 15441 function Resource( src ) { 15442 this.src = src; 15443 // add to cache 15444 cache[ src ] = this; 15445 } 15446 15447 Resource.prototype = new EventEmitter(); 15448 15449 Resource.prototype.check = function() { 15450 // only trigger checking once 15451 if ( this.isChecked ) { 15452 return; 15453 } 15454 // simulate loading on detached element 15455 var proxyImage = new Image(); 15456 eventie.bind( proxyImage, 'load', this ); 15457 eventie.bind( proxyImage, 'error', this ); 15458 proxyImage.src = this.src; 15459 // set flag 15460 this.isChecked = true; 15461 }; 15462 15463 // ----- events ----- // 15464 15465 // trigger specified handler for event type 15466 Resource.prototype.handleEvent = function( event ) { 15467 var method = 'on' + event.type; 15468 if ( this[ method ] ) { 15469 this[ method ]( event ); 15470 } 15471 }; 15472 15473 Resource.prototype.onload = function( event ) { 15474 this.confirm( true, 'onload' ); 15475 this.unbindProxyEvents( event ); 15476 }; 15477 15478 Resource.prototype.onerror = function( event ) { 15479 this.confirm( false, 'onerror' ); 15480 this.unbindProxyEvents( event ); 15481 }; 15482 15483 // ----- confirm ----- // 15484 15485 Resource.prototype.confirm = function( isLoaded, message ) { 15486 this.isConfirmed = true; 15487 this.isLoaded = isLoaded; 15488 this.emit( 'confirm', this, message ); 15489 }; 15490 15491 Resource.prototype.unbindProxyEvents = function( event ) { 15492 eventie.unbind( event.target, 'load', this ); 15493 eventie.unbind( event.target, 'error', this ); 15494 }; 15495 15496 // ----- ----- // 15497 15498 return ImagesLoaded; 15499 15500}); 15501 15502define('core/masonry',[ 15503 'jquery', 15504 'lodash', 15505 'core/layout', 15506 'masonry', 15507 'imagesloaded', 15508 // 'animonscroll', 15509 'eventEmitter/EventEmitter' 15510], function ($, _, Layout, Masonry, ImagesLoaded, /*AnimOnScroll,*/ EventEmitter) { 15511 function Msnry() { 15512 } 15513 15514 Msnry.prototype = _.clone(EventEmitter.prototype); 15515 15516 var proto = Msnry.prototype; 15517 15518 var layout = new Layout(); 15519 15520 var msnry; 15521 15522 var $window = $(window); 15523 15524 var $masonry, 15525 masonryEl, 15526 $masonryItemsParents, 15527 $masonryItems; 15528 15529 function _init() { 15530 $masonry = $('.masonry'); 15531 $masonryItemsParents = []; 15532 $masonryItems = []; 15533 15534// Calculate gutter based on screen width 15535 var width = $(window).innerWidth(); 15536 if(layout.mobile){ 15537 $gutter = 0; 15538 } else if(width >= 1025 && width <= 1420) { 15539 // Scale gutter from 10px to 50px between 1025px-1780px 15540 $gutter = 20 + ((width - 1025) / (1780 - 1025)) * 40; 15541 } else { 15542 $gutter = 50; 15543 } 15544 15545 if (!$masonry.length) return; 15546 15547 masonryEl = $masonry.get(0); 15548 15549 $masonry.find('.item').each(function (i) { 15550 var $this = $(this); 15551 15552 $masonryItems[i] = $this; 15553 $masonryItemsParents[i] = $this.parent(); 15554 }); 15555 15556 if (!!window.msnry) window.msnry.destroy(); 15557 15558 msnry = window.msnry = new Masonry(masonryEl, {
15559 columnWidth : 10, 15560 gutter : $gutter, 15561 itemSelector : '.item', 15562 stamp : '.stamp', 15563 transitionDuration: 0//'0.4s' 15564 }); 15565 15566 15567 15568 if(layout.mobile && ($masonry.hasClass('list--projects') || $masonry.hasClass('list--news'))){ 15569 msnry.destroy(); 15570 return; 15571 }else { 15572 15573 } 15574 15575 msnry.on('layoutComplete', function () { 15576 proto.emitEvent('layoutComplete'); 15577 }); 15578 15579 _bindImagesLoaded(); 15580 } 15581 15582 function _bindImagesLoaded() { 15583 ImagesLoaded(msnry.element, function () { 15584 msnry.layout(); 15585 $masonry.css('visibility', 'visible'); 15586 15587 $window.scrollTop($window.scrollTop() + 1); 15588 }); 15589 } 15590 15591 function _position() { 15592 15593 $leftList = $('#list--projects1').children(); 15594 $rightList = $('#list--projects2').children(); 15595 15596 $leftList.each(function(index){ 15597 var $this = $(this); 15598 $(this).after($rightList.eq(index)); 15599 }); 15600 } 15601 15602 /*function _position() { 15603 15604 $leftList = $('#list--projects1').children(); 15605 $rightList = $('#list--projects2').children(); 15606 15607 if(!$rightList.length){ 15608 $rightList.each(function(index){ 15609 if(index % 2 === 0){ 15610 var $this = $(this); 15611 $(this).after($leftList.eq(index)); 15612 } 15613 }); 15614 }else { 15615 $leftList.each(function(index){ 15616 15617 }); 15618 } 15619 }*/ 15620 15621 /*function _movePositionItemsProjectMobile() { 15622 15623 $leftList = $('#list--projects1').children(); 15624 $rightList = $('#list--projects2'); 15625 15626 $leftList.each(function(index){ 15627 if(index%2 === 1) { 15628 var $this = $(this); 15629 console.log(index); 15630 $rightList.append($this); 15631 } 15632 15633 }); 15634 }*/ 15635 15636 function _layout() { 15637 15638 if (!!window.msnry) window.msnry.destroy(); 15639 if (!!window.msnry) window.msnry.reloadItems(); 15640 _init(); 15641 15642 if(layout.mobile && $masonry.hasClass('list--projects')){ 15643 //_movePositionItemsProjectMobile(); 15644 } 15645 15646 if($('.masonry').hasClass('about')) { 15647 $claim = $('.claim'); 15648 $cite = $claim.find('.i--cite'); 15649 15650 if(layout.mobile) { 15651 $claim.find('.i--content').before($cite); 15652 _init(); 15653 } else { 15654 $claim.find('.i--content').after($cite); 15655 _init(); 15656 } 15657 15658 } 15659 } 15660 15661 proto.on('layoutComplete', _.noop); 15662 15663 proto.init = _init; 15664 proto.layout = _layout; 15665 proto.position = _position; 15666 15667 return Msnry; 15668}); 15669define('core/pageload',[ 15670 'jquery', 15671 'lodash', 15672 'eventEmitter/EventEmitter', 15673 'core/layout', 15674 'core/masonry' 15675], function ($, _, EventEmitter, Layout, Masonry) { 15676 15677 function PageLoad() { 15678 } 15679 15680 var layout = new Layout(); 15681 var msnry = new Masonry(); 15682 15683 PageLoad.prototype = _.clone(EventEmitter.prototype); 15684 15685 var proto = PageLoad.prototype; 15686 15687 var history = window.history; 15688 var supportsHistory = !!history.pushState; 15689 15690 var changePageConfig, pageScrollTopConfig; 15691 15692 var $window = $(window), 15693 $content, 15694 $languages, 15695 $lastCurrentLink; 15696 15697 var _CSS_ANIMATION_DURATION = 500; 15698 15699 function _init() { 15700 $content = $('#content'); 15701 $languages = $('#languages'); 15702 15703 _.delay(function () { 15704 $content.addClass('end'); 15705 }, _CSS_ANIMATION_DURATION); 15706 15707 _bindLinks(); 15708 _bindPopState(); 15709 } 15710 15711 function _getPageNavObject($data) { 15712 var $dataNav = $data.find('#sidebar__nav'), 15713 $dataNavItems1 = $dataNav.find('.level--1'), 15714 $dataNavItems2 = $dataNavItems1.find('.level--2'); 15715 15716 var activeItemIndex1 = $dataNavItems1.index($dataNavItems1.children().filter('.current').parent()), 15717 activeItemIndex2 = $dataNavItems2.index($dataNavItems2.children().filter('.current').parent()); 15718 15719 return [activeItemIndex1, activeItemIndex2]; 15720 } 15721 15722 function _setPageData($data, rawData) { 15723 var pageTitle = $data.filter('title').get(0), 15724 assetsUrlNode = $data.filter('script#assetsUrl').get(0), 15725 classList = $data.filter('#container').get(0).classList; 15726 15727 if (!!pageTitle) window.document.title = pageTitle.innerHTML; 15728 if (!!assetsUrlNode) eval.call(window, assetsUrlNode.innerHTML); 15729 15730 window.document.getElementById('container').classList = classList; 15731 15732 // Extract HTML tag class attribute from raw response 15733 if (rawData && typeof rawData === 'string') { 15734 var htmlClassMatch = rawData.match(/<html[^>]*class=["']([^"']*)["']/i); 15735 if (htmlClassMatch && htmlClassMatch[1]) { 15736 window.document.documentElement.className = htmlClassMatch[1]; 15737 } 15738 } 15739 } 15740 15741 function _prepareDataToSendAnalyticks(currentLocation, context){ 15742 if(!$lastCurrentLink) $lastCurrentLink = '/'; 15743 15744 var detalis = currentLocation + '_' + $lastCurrentLink;
15745 $lastCurrentLink = currentLocation; 15746 15747 return [detalis, context]; 15748 } 15749 15750 function _gaPageViewSend(url){ 15751 try { 15752 window.ga('send', 'pageview', { page: url }); 15753 } catch(error) { 15754 console.log('GA send pageview error', error); 15755 } 15756 } 15757 15758 function _getPage(url, pathname, callback) { 15759 15760 _gaPageViewSend(pathname); 15761 15762 $ 15763 .ajax({ 15764 url: url, 15765 type: 'GET', 15766 beforeSend: function() { 15767 $('#loader').show(); 15768 }, 15769 15770 complete: function() { 15771 if(layout.mobile){ 15772 15773 } 15774 } 15775 }) 15776 .done(function (data) { 15777// console.log('_getPage success |', url); 15778 15779 var $data = $(data), 15780 $dataContent = $data.find('#content'); 15781 $dataLanguages = $data.find('#languages'); 15782 $items = $dataContent.find('.item'); 15783 15784 _setPageData($data, data); 15785 15786 var el = document.createElement('a'); 15787 el.href = url; 15788 15789 if(!layout.mobile && el.pathname === "/projekty/"){ 15790 15791 $leftList = $dataContent.find('#list--projects1').children(); 15792 $rightList = $dataContent.find('#list--projects2').children(); 15793 15794 $leftList.each(function(index){ 15795 var $this = $(this); 15796 $(this).after($rightList.eq(index)); 15797 //arr.push($this[0], $rightList.eq(index)[0]); 15798 }); 15799 15800 $items = $leftList; 15801 } 15802 15803 if(layout.mobile){ 15804 $items.each(function(){ 15805 $(this).css({ 15806 'opacity': 1 15807 }); 15808 }); 15809 15810 $content.removeClass('loading'); 15811 $content.css('opacity', '1'); 15812 15813 $content.html($dataContent.html()); 15814 $languages.html($dataLanguages.html()); 15815 15816 proto.emitEvent('getPageNav', _getPageNavObject($data)); 15817 proto.emitEvent('getPageDone'); 15818 15819 } else { 15820 15821 $content 15822 .removeClass('loading') 15823 .addClass('loaded'); 15824 15825 proto.emitEvent('getPageNav', _getPageNavObject($data)); 15826 var delay = 10; 15827 _.delay(function () { 15828 $items.each(function(index){ 15829 newDelay = (delay * index)/60; 15830 15831 $(this).addClass('content-animation'); 15832 }); 15833 15834 $content 15835 .removeClass('loaded') 15836 .html($dataContent.html()) 15837 .addClass('done'); 15838 15839 $languages.html($dataLanguages.html()) 15840 15841 _.delay(function () { 15842 $content 15843 .removeClass('done') 15844 .addClass('end'); 15845 15846 proto.emitEvent('getPageAnimationDone'); 15847 15848 var item = $(document).find('.item'); 15849 15850 }, _CSS_ANIMATION_DURATION); 15851 15852 if(pageScrollTopConfig) { 15853 _.delay(function(){ 15854 15855 var scrollTopOffset = $('.project').eq(pageScrollTopConfig.linkItemIndex).offset().top; 15856 $("html, body").stop().animate({ scrollTop: scrollTopOffset - 200 }, '500', 'swing'); 15857 pageScrollTopConfig = undefined; 15858 15859 }, 500); 15860 } 15861 15862 proto.emitEvent('getPageDone'); 15863 15864 if (typeof callback === 'function') callback.call(this); 15865 }, 200); 15866 } 15867 15868 15869 }) 15870 .fail(function () { 15871 //console.log('_getPage error |', url); 15872 15873 $content 15874 .removeClass('loading') 15875 .addClass('fail'); 15876 15877 _.delay(function () { 15878 $content 15879 .removeClass('fail') 15880 .addClass('end'); 15881 }, _CSS_ANIMATION_DURATION + 100); 15882 15883 proto.emitEvent('getPageFail'); 15884 }); 15885 } 15886 15887 var linkItem; 15888 15889 function _setHistory(url) { 15890 if (!supportsHistory) return; 15891 history.pushState({}, 'state', url); 15892 } 15893 15894 function _bindPopState() { 15895 15896 if (!supportsHistory) return; 15897 15898 $window.on('popstate', function (e) { 15899 15900 if(changePageConfig) { 15901 15902 pageScrollTopConfig = { 15903 scrollTopOnChange : changePageConfig.scrollTopOnChange, 15904 linkItemIndex: linkItem.closest('.project').index() 15905 }; 15906 15907 } 15908 15909 _getPage(window.location.href); 15910 changePageConfig = undefined; 15911 15912 }); 15913 15914 } 15915 15916 function _bindLinks() { 15917 $(document).on({ 15918 15919 click: function (e) { 15920 var $this = $(this); 15921 15922 15923 if($this.data('gaTarget')) proto.emitEvent('changePageEvt', _prepareDataToSendAnalyticks($this.data('gaTarget'), $this.data('gaContext'))); 15924 15925 if ($this.attr('target') === '_blank') return; 15926 if (!$this.attr('href') || $this.attr('href') === '') return; 15927 if (e.currentTarget.hostname !== window.location.hostname) return; 15928 if ($this.hasClass('no-trigger')) return; 15929 15930 if (/\/admin\//.test($this.attr('href'))) return; 15931 15932 $content.removeClass('end done fail').addClass('loading'); 15933
15934 var changePageConfigString = $this.data('changePageConfig'); 15935 if(changePageConfigString) { 15936 changePageConfig = JSON.parse(changePageConfigString.replace(/'/g, '"')); 15937 } else { 15938 changePageConfig = undefined; 15939 } 15940 15941 linkItem = $this; 15942 15943 e.preventDefault(); 15944 $(window).scrollTop(0); 15945 _getPage(e.currentTarget.href, e.currentTarget.pathname); 15946 _setHistory(e.currentTarget.href); 15947 15948 } 15949 }, 'a'); 15950 15951 } 15952 15953 proto.on('getPageDone', _.noop); 15954 proto.on('getPageFail', _.noop); 15955 proto.on('getPageNav', _.noop); 15956 proto.on('changePageEvt', _.noop); 15957 15958 proto.init = _init; 15959 15960 return PageLoad; 15961}); 15962define('core/cookies',[ 15963 'jquery', 15964], function ($) { 15965 15966 var $cookieButtonAgree, $cookieButtonDecline, $cookieBox; 15967 var cookieName = 'cookie-box'; 15968 var gtagCookieName = 'gtag-enabled'; 15969 15970 function Cookies() { 15971 15972 } 15973 15974 function _init(){ 15975 15976 $cookieButtonAgree = $('#cookie__box--button_agree'); 15977 $cookieButtonDecline = $('#cookie__box--button_decline'); 15978 $cookieBox = $('#cookie__box'); 15979 15980 var _isCookiesBoxAccepted = _checkCookie(cookieName); 15981 var _isGTagAccepted = _checkCookie(gtagCookieName); 15982 15983 if(_isCookiesBoxAccepted) { 15984 if ( _isGTagAccepted) { 15985 _setGTM(); 15986 }; 15987 return false; 15988 } else {; 15989 _showCookieBox(); 15990 15991 $cookieButtonDecline.on('click', () => { 15992 _setCookie(cookieName); 15993 _hideCookieBox(); 15994 }); 15995 15996 $cookieButtonAgree.on('click', () => { 15997 _setCookie(cookieName); 15998 _setCookie(gtagCookieName); 15999 _hideCookieBox(); 16000 _setGTM(); 16001 }); 16002 } 16003 } 16004 16005 function _setCookie(cookieName) { 16006 var now = new Date(); 16007 var time = now.getTime(); 16008 time += 3600 * 1000 * 24; 16009 now.setTime(time); 16010 document.cookie = cookieName + "=1; expires=" + now.toUTCString() + "; SameSite=None; Secure"; 16011 } 16012 16013 function _getCookie(cookieName) { 16014 var cookie = document.cookie.split('; ').find(row => row.startsWith(cookieName)); 16015 if (!cookie) { 16016 return ''; 16017 } 16018 const cookieSplit = cookie.split('='); 16019 return cookieSplit[1] || ''; 16020 } 16021 16022 function _showCookieBox(){ 16023 $cookieBox[0].classList.add('cookie-box--visible'); 16024// $cookieBox.show(); 16025 } 16026 16027 function _hideCookieBox(){ 16028 $cookieBox.fadeOut(); 16029 } 16030 16031 function _checkCookie(cookieName) { 16032 return _getCookie(cookieName) === '1'; 16033 } 16034 16035 function _setGTM() { 16036 window.gtag('consent', 'update', { 16037 'ad_storage': 'granted', 16038 'ad_user_data': 'granted', 16039 'ad_personalization': 'granted', 16040 'analytics_storage': 'granted' 16041 }); 16042 } 16043 16044 Cookies.prototype.init = _init; 16045 16046 return Cookies; 16047}); 16048define('modules/sidebarNav',[ 16049 'jquery', 16050 'lodash', 16051 'core/layout', 16052 'eventEmitter/EventEmitter' 16053], function ($, _, EventEmitter, Layout) { 16054 16055 function SidebarNav() {} 16056 16057 SidebarNav.prototype = _.clone(EventEmitter.prototype); 16058 16059 var layout = new Layout; 16060 16061 var proto = SidebarNav.prototype; 16062 16063 var $nav, 16064 $navItems1, 16065 $navItems2, 16066 $navAnchors, 16067 $mobileToggle; 16068 16069 function _init() { 16070 $nav = $('#sidebar__nav'); 16071 $navItems1 = $nav.find('.level--1'); 16072 $navItems2 = $nav.find('.level--2'); 16073 $navAnchors = $nav.find('a'); 16074 16075 $mobileToggle = $('.sidebar-toggle'); 16076 16077 $mobileBackTop = $('.backtotop'); 16078
16079 if (navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0) 16080 { 16081 $('.sidebar__nav').addClass('safari-browser'); 16082 } 16083 16084 if(typeof InstallTrigger !== 'undefined') 16085 { 16086 $('.sidebar__nav').addClass('firefox-browser'); 16087 } 16088 16089 $('#content').on({ 16090 click: function(){ 16091 16092 if($mobileToggle.next().is(':visible')){ 16093 $mobileToggle 16094 .prev() 16095 .prev() 16096 .removeClass('open') 16097 .next() 16098 .removeClass('open') 16099 .next() 16100 .removeClass('open') 16101 .next() 16102 .removeClass('open') 16103 .next() 16104 .removeClass('open'); 16105 16106 $('html').removeClass('menu-opened'); 16107 } 16108 16109 } 16110 }); 16111 16112 _bind(); 16113 } 16114 16115 function _clear() { 16116 $navItems1.removeClass('active'); 16117 $navAnchors.removeClass('current'); 16118 } 16119 16120 function _update(activeItemIndex1, activeItemIndex2) { 16121 _clear(); 16122 16123 if (activeItemIndex1 !== -1) { 16124 $navItems1.eq(activeItemIndex1).addClass('active').find('> a').addClass('current'); 16125 16126 if (activeItemIndex2 !== -1) { 16127 $navItems2.eq(activeItemIndex2).find('> a').addClass('current'); 16128 } 16129 } 16130 } 16131 16132 function _bind() { 16133 16134 $mobileToggle.on('click', function(){ 16135 var $this = $(this); 16136 16137 $this 16138 .prev() 16139 .prev() 16140 .toggleClass('open') 16141 .next() 16142 .toggleClass('open') 16143 .next() 16144 .toggleClass('open') 16145 .next() 16146 .toggleClass('open') 16147 .next() 16148 .toggleClass('open'); 16149 16150 $('html').toggleClass('menu-opened'); 16151 }); 16152 16153 $navAnchors.on('click', function(){ 16154 $mobileToggle 16155 .prev() 16156 .prev() 16157 .removeClass('open') 16158 .next() 16159 .removeClass('open') 16160 .next() 16161 .removeClass('open') 16162 .next() 16163 .removeClass('open') 16164 .next() 16165 .removeClass('open'); 16166 16167 $('html').removeClass('menu-opened'); 16168 }); 16169 16170 $('.logo--180').on('click', function(){ 16171 $mobileToggle 16172 .prev() 16173 .prev() 16174 .removeClass('open') 16175 .next() 16176 .removeClass('open') 16177 .next() 16178 .removeClass('open') 16179 .next() 16180 .removeClass('open') 16181 .next() 16182 .removeClass('open'); 16183 16184 $('html').removeClass('menu-opened'); 16185 }); 16186 16187 $mobileBackTop.on('click', function() { 16188 $("html, body").animate({scrollTop: 0}, 1000); 16189 }); 16190 } 16191 16192 proto.init = _init; 16193 proto.update = _update; 16194 16195 return SidebarNav; 16196}); 16197/** 16198 * bxSlider v4.2.1d
vendor: 67,521 bytes, lines 16198-17859
16198 16199 * Copyright 2013-2017 Steven Wanderski 16200 * Written while drinking Belgian ales and listening to jazz 16201 * Licensed under MIT (http://opensource.org/licenses/MIT) 16202 */ 16203 16204;(function($) { 16205 16206 var defaults = { 16207 16208 // GENERAL 16209 mode: 'horizontal', 16210 slideSelector: '', 16211 infiniteLoop: true, 16212 hideControlOnEnd: false, 16213 speed: 500, 16214 easing: null, 16215 slideMargin: 0, 16216 startSlide: 0, 16217 randomStart: false, 16218 captions: false, 16219 ticker: false, 16220 tickerHover: false, 16221 adaptiveHeight: false, 16222 adaptiveHeightSpeed: 500, 16223 video: false, 16224 useCSS: true, 16225 preloadImages: 'visible', 16226 responsive: true, 16227 slideZIndex: 50, 16228 wrapperClass: 'bx-wrapper', 16229 16230 // TOUCH 16231 touchEnabled: true, 16232 swipeThreshold: 50, 16233 oneToOneTouch: true, 16234 preventDefaultSwipeX: true, 16235 preventDefaultSwipeY: false, 16236 16237 // ACCESSIBILITY 16238 ariaLive: true, 16239 ariaHidden: true, 16240 16241 // KEYBOARD 16242 keyboardEnabled: false, 16243 16244 // PAGER 16245 pager: true, 16246 pagerType: 'full', 16247 pagerShortSeparator: ' / ', 16248 pagerSelector: null, 16249 buildPager: null, 16250 pagerCustom: null, 16251 16252 // CONTROLS 16253 controls: true, 16254 nextText: 'Next', 16255 prevText: 'Prev', 16256 nextSelector: null, 16257 prevSelector: null, 16258 autoControls: false, 16259 startText: 'Start', 16260 stopText: 'Stop', 16261 autoControlsCombine: false, 16262 autoControlsSelector: null, 16263 16264 // AUTO 16265 auto: false, 16266 pause: 4000, 16267 autoStart: true, 16268 autoDirection: 'next', 16269 stopAutoOnClick: false, 16270 autoHover: false, 16271 autoDelay: 0, 16272 autoSlideForOnePage: false, 16273 16274 // CAROUSEL 16275 minSlides: 1, 16276 maxSlides: 1, 16277 moveSlides: 0, 16278 slideWidth: 0, 16279 shrinkItems: false, 16280 16281 // CALLBACKS 16282 onSliderLoad: function() { return true; }, 16283 onSlideBefore: function() { return true; }, 16284 onSlideAfter: function() { return true; }, 16285 onSlideNext: function() { return true; }, 16286 onSlidePrev: function() { return true; }, 16287 onSliderResize: function() { return true; }, 16288 onAutoChange: function() { return true; } //calls when auto slides starts and stops 16289 }; 16290 16291 $.fn.bxSlider = function(options) { 16292 16293 if (this.length === 0) { 16294 return this; 16295 } 16296 16297 // support multiple elements 16298 if (this.length > 1) { 16299 this.each(function() { 16300 $(this).bxSlider(options); 16301 }); 16302 return this; 16303 } 16304 16305 // create a namespace to be used throughout the plugin 16306 var slider = {}, 16307 // set a reference to our slider element 16308 el = this, 16309 // get the original window dimens (thanks a lot IE) 16310 windowWidth = $(window).width(), 16311 windowHeight = $(window).height(); 16312 16313 // Return if slider is already initialized 16314 if ($(el).data('bxSlider')) { return; } 16315 16316 /** 16317 * =================================================================================== 16318 * = PRIVATE FUNCTIONS 16319 * =================================================================================== 16320 */ 16321 16322 /** 16323 * Initializes namespace settings to be used throughout plugin 16324 */ 16325 var init = function() { 16326 // Return if slider is already initialized 16327 if ($(el).data('bxSlider')) { return; } 16328 // merge user-supplied options with the defaults 16329 slider.settings = $.extend({}, defaults, options); 16330 // parse slideWidth setting 16331 slider.settings.slideWidth = parseInt(slider.settings.slideWidth); 16332 // store the original children 16333 slider.children = el.children(slider.settings.slideSelector); 16334 // check if actual number of slides is less than minSlides / maxSlides 16335 if (slider.children.length < slider.settings.minSlides) { slider.settings.minSlides = slider.children.length; } 16336 if (slider.children.length < slider.settings.maxSlides) { slider.settings.maxSlides = slider.children.length; } 16337 // if random start, set the startSlide setting to random number 16338 if (slider.settings.randomStart) { slider.settings.startSlide = Math.floor(Math.random() * slider.children.length); } 16339 // store active slide information 16340 slider.active = { index: slider.settings.startSlide }; 16341 // store if the slider is in carousel mode (displaying / moving multiple slides) 16342 slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1; 16343 // if carousel, force preloadImages = 'all' 16344 if (slider.carousel) { slider.settings.preloadImages = 'all'; } 16345 // calculate the min / max width thresholds based on min / max number of slides 16346 // used to setup and update carousel slides dimensions 16347 slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin); 16348 slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin); 16349 // store the current state of the slider (if currently animating, working is true) 16350 slider.working = false; 16351 // initialize the controls object 16352 slider.controls = {}; 16353 // initialize an auto interval 16354 slider.interval = null; 16355 // determine which property to use for transitions 16356 slider.animProp = slider.settings.mode === 'vertical' ? 'top' : 'left'; 16357 // determine if hardware acceleration can be used 16358 slider.usingCSS = slider.settings.useCSS && slider.settings.mode !== 'fade' && (function() { 16359 // create our test div element 16360 var div = document.createElement('div'), 16361 // css transition properties 16362 props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective']; 16363 // test for each property 16364 for (var i = 0; i < props.length; i++) { 16365 if (div.style[props[i]] !== undefined) { 16366 slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase(); 16367 slider.animProp = '-' + slider.cssPrefix + '-transform'; 16368 return true; 16369 } 16370 } 16371 return false; 16372 }()); 16373 // if vertical mode always make maxSlides and minSlides equal 16374 if (slider.settings.mode === 'vertical') { slider.settings.maxSlides = slider.settings.minSlides; } 16375 // save original style data 16376 el.data('origStyle', el.attr('style')); 16377 el.children(slider.settings.slideSelector).each(function() { 16378 $(this).data('origStyle', $(this).attr('style')); 16379 }); 16380 16381 // perform all DOM / CSS modifications 16382 setup(); 16383 }; 16384 16385 /** 16386 * Performs all DOM and CSS modifications 16387 */ 16388 var setup = function() { 16389 var preloadSelector = slider.children.eq(slider.settings.startSlide); // set the default preload selector (visible) 16390 16391 // wrap el in a wrapper 16392 el.wrap('<div class="' + slider.settings.wrapperClass + '"><div class="bx-viewport"></div></div>'); 16393 // store a namespace reference to .bx-viewport 16394 slider.viewport = el.parent(); 16395 16396 // add aria-live if the setting is enabled and ticker mode is disabled 16397 if (slider.settings.ariaLive && !slider.settings.ticker) { 16398 slider.viewport.attr('aria-live', 'polite'); 16399 } 16400 // add a loading div to display while images are loading 16401 slider.loader = $('<div class="bx-loading" />'); 16402 slider.viewport.prepend(slider.loader); 16403 // set el to a massive width, to hold any needed slides 16404 // also strip any margin and padding from el 16405 el.css({ 16406 width: slider.settings.mode === 'horizontal' ? (slider.children.length * 1000 + 215) + '%' : 'auto', 16407 position: 'relative' 16408 }); 16409 // if using CSS, add the easing property 16410 if (slider.usingCSS && slider.settings.easing) { 16411 el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing); 16412 // if not using CSS and no easing value was supplied, use the default JS animation easing (swing) 16413 } else if (!slider.settings.easing) { 16414 slider.settings.easing = 'swing'; 16415 } 16416 // make modifications to the viewport (.bx-viewport) 16417 slider.viewport.css({ 16418 width: '100%', 16419 overflow: 'hidden', 16420 position: 'relative' 16421 }); 16422 slider.viewport.parent().css({ 16423 maxWidth: getViewportMaxWidth() 16424 }); 16425 // apply css to all slider children 16426 slider.children.css({ 16427 // the float attribute is a reserved word in compressors like YUI compressor and need to be quoted #48 16428 'float': slider.settings.mode === 'horizontal' ? 'left' : 'none', 16429 listStyle: 'none', 16430 position: 'relative' 16431 }); 16432 // apply the calculated width after the float is applied to prevent scrollbar interference 16433 slider.children.css('width', getSlideWidth()); 16434 // if slideMargin is supplied, add the css 16435 if (slider.settings.mode === 'horizontal' && slider.settings.slideMargin > 0) { slider.children.css('marginRight', slider.settings.slideMargin); } 16436 if (slider.settings.mode === 'vertical' && slider.settings.slideMargin > 0) { slider.children.css('marginBottom', slider.settings.slideMargin); } 16437 // if "fade" mode, add positioning and z-index CSS 16438 if (slider.settings.mode === 'fade') { 16439 slider.children.css({ 16440 position: 'absolute', 16441 zIndex: 0, 16442 display: 'none' 16443 }); 16444 // prepare the z-index on the showing element 16445 slider.children.eq(slider.settings.startSlide).css({zIndex: slider.settings.slideZIndex, display: 'block'}); 16446 } 16447 // create an element to contain all slider controls (pager, start / stop, etc) 16448 slider.controls.el = $('<div class="bx-controls" />'); 16449 // if captions are requested, add them 16450 if (slider.settings.captions) { appendCaptions(); } 16451 // check if startSlide is last slide 16452 slider.active.last = slider.settings.startSlide === getPagerQty() - 1; 16453 // if video is true, set up the fitVids plugin 16454 if (slider.settings.video) { el.fitVids(); } 16455 //preloadImages 16456 if (slider.settings.preloadImages === 'none') { 16457 preloadSelector = null; 16458 } 16459 else if (slider.settings.preloadImages === 'all' || slider.settings.ticker) { 16460 preloadSelector = slider.children; 16461 } 16462 // only check for control addition if not in "ticker" mode 16463 if (!slider.settings.ticker) { 16464 // if controls are requested, add them 16465 if (slider.settings.controls) { appendControls(); } 16466 // if auto is true, and auto controls are requested, add them 16467 if (slider.settings.auto && slider.settings.autoControls) { appendControlsAuto(); } 16468 // if pager is requested, add it 16469 if (slider.settings.pager) { appendPager(); } 16470 // if any control option is requested, add the controls wrapper 16471 if (slider.settings.controls || slider.settings.autoControls || slider.settings.pager) { slider.viewport.after(slider.controls.el); } 16472 // if ticker mode, do not allow a pager 16473 } else { 16474 slider.settings.pager = false; 16475 } 16476 if (preloadSelector === null) { 16477 start(); 16478 } else { 16479 loadElements(preloadSelector, start); 16480 } 16481 }; 16482 16483 var loadElements = function(selector, callback) { 16484 var total = selector.find('img:not([src=""]), iframe').length, 16485 count = 0; 16486 if (total === 0) { 16487 callback(); 16488 return; 16489 } 16490 selector.find('img:not([src=""]), iframe').each(function() { 16491 $(this).one('load error', function() { 16492 if (++count === total) { callback(); } 16493 }).each(function() { 16494 if (this.complete || this.src == '') { $(this).trigger('load'); } 16495 }); 16496 }); 16497 }; 16498 16499 /** 16500 * Start the slider 16501 */ 16502 var start = function() { 16503 // if infinite loop, prepare additional slides 16504 if (slider.settings.infiniteLoop && slider.settings.mode !== 'fade' && !slider.settings.ticker) { 16505 var slice = slider.settings.mode === 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides, 16506 sliceAppend = slider.children.slice(0, slice).clone(true).addClass('bx-clone'), 16507 slicePrepend = slider.children.slice(-slice).clone(true).addClass('bx-clone'); 16508 if (slider.settings.ariaHidden) { 16509 sliceAppend.attr('aria-hidden', true); 16510 slicePrepend.attr('aria-hidden', true); 16511 } 16512 el.append(sliceAppend).prepend(slicePrepend); 16513 } 16514 // remove the loading DOM element 16515 slider.loader.remove(); 16516 // set the left / top position of "el" 16517 setSlidePosition(); 16518 // if "vertical" mode, always use adaptiveHeight to prevent odd behavior 16519 if (slider.settings.mode === 'vertical') { slider.settings.adaptiveHeight = true; } 16520 // set the viewport height 16521 slider.viewport.height(getViewportHeight()); 16522 // make sure everything is positioned just right (same as a window resize) 16523 el.redrawSlider(); 16524 // onSliderLoad callback 16525 slider.settings.onSliderLoad.call(el, slider.active.index); 16526 // slider has been fully initialized 16527 slider.initialized = true; 16528 // add the resize call to the window 16529 if (slider.settings.responsive) { $(window).on('resize', resizeWindow); } 16530 // if auto is true and has more than 1 page, start the show 16531 if (slider.settings.auto && slider.settings.autoStart && (getPagerQty() > 1 || slider.settings.autoSlideForOnePage)) { initAuto(); } 16532 // if ticker is true, start the ticker 16533 if (slider.settings.ticker) { initTicker(); } 16534 // if pager is requested, make the appropriate pager link active 16535 if (slider.settings.pager) { updatePagerActive(slider.settings.startSlide); } 16536 // check for any updates to the controls (like hideControlOnEnd updates) 16537 if (slider.settings.controls) { updateDirectionControls(); } 16538 // if touchEnabled is true, setup the touch events 16539 if (slider.settings.touchEnabled && !slider.settings.ticker) { initTouch(); } 16540 // if keyboardEnabled is true, setup the keyboard events 16541 if (slider.settings.keyboardEnabled && !slider.settings.ticker) { 16542 $(document).keydown(keyPress); 16543 } 16544 }; 16545 16546 /** 16547 * Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value 16548 */ 16549 var getViewportHeight = function() { 16550 var height = 0; 16551 // first determine which children (slides) should be used in our height calculation 16552 var children = $(); 16553 // if mode is not "vertical" and adaptiveHeight is false, include all children 16554 if (slider.settings.mode !== 'vertical' && !slider.settings.adaptiveHeight) { 16555 children = slider.children; 16556 } else { 16557 // if not carousel, return the single active child 16558 if (!slider.carousel) { 16559 children = slider.children.eq(slider.active.index); 16560 // if carousel, return a slice of children 16561 } else { 16562 // get the individual slide index 16563 var currentIndex = slider.settings.moveSlides === 1 ? slider.active.index : slider.active.index * getMoveBy(); 16564 // add the current slide to the children 16565 children = slider.children.eq(currentIndex); 16566 // cycle through the remaining "showing" slides 16567 for (i = 1; i <= slider.settings.maxSlides - 1; i++) { 16568 // if looped back to the start 16569 if (currentIndex + i >= slider.children.length) { 16570 children = children.add(slider.children.eq(i - 1)); 16571 } else { 16572 children = children.add(slider.children.eq(currentIndex + i)); 16573 } 16574 } 16575 } 16576 } 16577 // if "vertical" mode, calculate the sum of the heights of the children 16578 if (slider.settings.mode === 'vertical') { 16579 children.each(function(index) { 16580 height += $(this).outerHeight(); 16581 }); 16582 // add user-supplied margins 16583 if (slider.settings.slideMargin > 0) { 16584 height += slider.settings.slideMargin * (slider.settings.minSlides - 1); 16585 } 16586 // if not "vertical" mode, calculate the max height of the children 16587 } else { 16588 height = Math.max.apply(Math, children.map(function() { 16589 return $(this).outerHeight(false); 16590 }).get()); 16591 } 16592 16593 if (slider.viewport.css('box-sizing') === 'border-box') { 16594 height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')) + 16595 parseFloat(slider.viewport.css('border-top-width')) + parseFloat(slider.viewport.css('border-bottom-width')); 16596 } else if (slider.viewport.css('box-sizing') === 'padding-box') { 16597 height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')); 16598 } 16599 16600 return height; 16601 }; 16602 16603 /** 16604 * Returns the calculated width to be used for the outer wrapper / viewport 16605 */ 16606 var getViewportMaxWidth = function() { 16607 var width = '100%'; 16608 if (slider.settings.slideWidth > 0) { 16609 if (slider.settings.mode === 'horizontal') { 16610 width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin); 16611 } else { 16612 width = slider.settings.slideWidth; 16613 } 16614 } 16615 return width; 16616 }; 16617 16618 /** 16619 * Returns the calculated width to be applied to each slide 16620 */ 16621 var getSlideWidth = function() { 16622 var newElWidth = slider.settings.slideWidth, // start with any user-supplied slide width 16623 wrapWidth = slider.viewport.width(); // get the current viewport width 16624 // if slide width was not supplied, or is larger than the viewport use the viewport width 16625 if (slider.settings.slideWidth === 0 || 16626 (slider.settings.slideWidth > wrapWidth && !slider.carousel) || 16627 slider.settings.mode === 'vertical') { 16628 newElWidth = wrapWidth; 16629 // if carousel, use the thresholds to determine the width 16630 } else if (slider.settings.maxSlides > 1 && slider.settings.mode === 'horizontal') { 16631 if (wrapWidth > slider.maxThreshold) { 16632 return newElWidth; 16633 } else if (wrapWidth < slider.minThreshold) { 16634 newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides; 16635 } else if (slider.settings.shrinkItems) { 16636 newElWidth = Math.floor((wrapWidth + slider.settings.slideMargin) / (Math.ceil((wrapWidth + slider.settings.slideMargin) / (newElWidth + slider.settings.slideMargin))) - slider.settings.slideMargin); 16637 } 16638 } 16639 return newElWidth; 16640 }; 16641 16642 /** 16643 * Returns the number of slides currently visible in the viewport (includes partially visible slides) 16644 */ 16645 var getNumberSlidesShowing = function() { 16646 var slidesShowing = 1, 16647 childWidth = null; 16648 if (slider.settings.mode === 'horizontal' && slider.settings.slideWidth > 0) { 16649 // if viewport is smaller than minThreshold, return minSlides 16650 if (slider.viewport.width() < slider.minThreshold) { 16651 slidesShowing = slider.settings.minSlides; 16652 // if viewport is larger than maxThreshold, return maxSlides 16653 } else if (slider.viewport.width() > slider.maxThreshold) { 16654 slidesShowing = slider.settings.maxSlides; 16655 // if viewport is between min / max thresholds, divide viewport width by first child width 16656 } else { 16657 childWidth = slider.children.first().width() + slider.settings.slideMargin; 16658 slidesShowing = Math.floor((slider.viewport.width() + 16659 slider.settings.slideMargin) / childWidth) || 1; 16660 } 16661 // if "vertical" mode, slides showing will always be minSlides 16662 } else if (slider.settings.mode === 'vertical') { 16663 slidesShowing = slider.settings.minSlides; 16664 } 16665 return slidesShowing; 16666 }; 16667 16668 /** 16669 * Returns the number of pages (one full viewport of slides is one "page") 16670 */ 16671 var getPagerQty = function() { 16672 var pagerQty = 0, 16673 breakPoint = 0, 16674 counter = 0; 16675 // if moveSlides is specified by the user 16676 if (slider.settings.moveSlides > 0) { 16677 if (slider.settings.infiniteLoop) { 16678 pagerQty = Math.ceil(slider.children.length / getMoveBy()); 16679 } else { 16680 // when breakpoint goes above children length, counter is the number of pages 16681 while (breakPoint < slider.children.length) { 16682 ++pagerQty; 16683 breakPoint = counter + getNumberSlidesShowing(); 16684 counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing(); 16685 } 16686 return counter; 16687 } 16688 // if moveSlides is 0 (auto) divide children length by sides showing, then round up 16689 } else { 16690 pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing()); 16691 } 16692 return pagerQty; 16693 }; 16694 16695 /** 16696 * Returns the number of individual slides by which to shift the slider 16697 */ 16698 var getMoveBy = function() { 16699 // if moveSlides was set by the user and moveSlides is less than number of slides showing 16700 if (slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()) { 16701 return slider.settings.moveSlides; 16702 } 16703 // if moveSlides is 0 (auto) 16704 return getNumberSlidesShowing(); 16705 }; 16706 16707 /** 16708 * Sets the slider's (el) left or top position 16709 */ 16710 var setSlidePosition = function() { 16711 var position, lastChild, lastShowingIndex; 16712 // if last slide, not infinite loop, and number of children is larger than specified maxSlides 16713 if (slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop) { 16714 if (slider.settings.mode === 'horizontal') { 16715 // get the last child's position 16716 lastChild = slider.children.last(); 16717 position = lastChild.position(); 16718 // set the left position 16719 setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.outerWidth())), 'reset', 0); 16720 } else if (slider.settings.mode === 'vertical') { 16721 // get the last showing index's position 16722 lastShowingIndex = slider.children.length - slider.settings.minSlides; 16723 position = slider.children.eq(lastShowingIndex).position(); 16724 // set the top position 16725 setPositionProperty(-position.top, 'reset', 0); 16726 } 16727 // if not last slide 16728 } else { 16729 // get the position of the first showing slide 16730 position = slider.children.eq(slider.active.index * getMoveBy()).position(); 16731 // check for last slide 16732 if (slider.active.index === getPagerQty() - 1) { slider.active.last = true; } 16733 // set the respective position 16734 if (position !== undefined) { 16735 if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); } 16736 else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); } 16737 } 16738 } 16739 }; 16740 16741 /** 16742 * Sets the el's animating property position (which in turn will sometimes animate el). 16743 * If using CSS, sets the transform property. If not using CSS, sets the top / left property. 16744 * 16745 * @param value (int) 16746 * - the animating property's value 16747 * 16748 * @param type (string) 'slide', 'reset', 'ticker' 16749 * - the type of instance for which the function is being 16750 * 16751 * @param duration (int) 16752 * - the amount of time (in ms) the transition should occupy 16753 * 16754 * @param params (array) optional 16755 * - an optional parameter containing any variables that need to be passed in 16756 */ 16757 var setPositionProperty = function(value, type, duration, params) { 16758 var animateObj, propValue; 16759 // use CSS transform 16760 if (slider.usingCSS) { 16761 // determine the translate3d value 16762 propValue = slider.settings.mode === 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)'; 16763 // add the CSS transition-duration 16764 el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's'); 16765 if (type === 'slide') { 16766 // set the property value 16767 el.css(slider.animProp, propValue); 16768 if (duration !== 0) { 16769 // add a callback method - executes when CSS transition completes 16770 el.on('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) { 16771 //make sure it's the correct one 16772 if (!$(e.target).is(el)) { return; } 16773 // remove the callback 16774 el.off('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 16775 updateAfterSlideTransition(); 16776 }); 16777 } else { //duration = 0 16778 updateAfterSlideTransition(); 16779 } 16780 } else if (type === 'reset') { 16781 el.css(slider.animProp, propValue); 16782 } else if (type === 'ticker') { 16783 // make the transition use 'linear' 16784 el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear'); 16785 el.css(slider.animProp, propValue); 16786 if (duration !== 0) { 16787 el.on('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) { 16788 //make sure it's the correct one 16789 if (!$(e.target).is(el)) { return; } 16790 // remove the callback 16791 el.off('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 16792 // reset the position 16793 setPositionProperty(params.resetValue, 'reset', 0); 16794 // start the loop again 16795 tickerLoop(); 16796 }); 16797 } else { //duration = 0 16798 setPositionProperty(params.resetValue, 'reset', 0); 16799 tickerLoop(); 16800 } 16801 } 16802 // use JS animate 16803 } else { 16804 animateObj = {}; 16805 animateObj[slider.animProp] = value; 16806 if (type === 'slide') { 16807 el.animate(animateObj, duration, slider.settings.easing, function() { 16808 updateAfterSlideTransition(); 16809 }); 16810 } else if (type === 'reset') { 16811 el.css(slider.animProp, value); 16812 } else if (type === 'ticker') { 16813 el.animate(animateObj, duration, 'linear', function() { 16814 setPositionProperty(params.resetValue, 'reset', 0); 16815 // run the recursive loop after animation 16816 tickerLoop(); 16817 }); 16818 } 16819 } 16820 }; 16821 16822 /** 16823 * Populates the pager with proper amount of pages 16824 */ 16825 var populatePager = function() { 16826 var pagerHtml = '', 16827 linkContent = '', 16828 pagerQty = getPagerQty(); 16829 // loop through each pager item 16830 for (var i = 0; i < pagerQty; i++) { 16831 linkContent = ''; 16832 // if a buildPager function is supplied, use it to get pager link value, else use index + 1 16833 if (slider.settings.buildPager && $.isFunction(slider.settings.buildPager) || slider.settings.pagerCustom) { 16834 linkContent = slider.settings.buildPager(i); 16835 slider.pagerEl.addClass('bx-custom-pager'); 16836 } else { 16837 linkContent = i + 1; 16838 slider.pagerEl.addClass('bx-default-pager'); 16839 } 16840 // var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1; 16841 // add the markup to the string 16842 pagerHtml += '<div class="bx-pager-item"><a href="" data-slide-index="' + i + '" class="bx-pager-link">' + linkContent + '</a></div>'; 16843 } 16844 // populate the pager element with pager links 16845 slider.pagerEl.html(pagerHtml); 16846 }; 16847 16848 /** 16849 * Appends the pager to the controls element 16850 */ 16851 var appendPager = function() { 16852 if (!slider.settings.pagerCustom) { 16853 // create the pager DOM element 16854 slider.pagerEl = $('<div class="bx-pager" />'); 16855 // if a pager selector was supplied, populate it with the pager 16856 if (slider.settings.pagerSelector) { 16857 $(slider.settings.pagerSelector).html(slider.pagerEl); 16858 // if no pager selector was supplied, add it after the wrapper 16859 } else { 16860 slider.controls.el.addClass('bx-has-pager').append(slider.pagerEl); 16861 } 16862 // populate the pager 16863 populatePager(); 16864 } else { 16865 slider.pagerEl = $(slider.settings.pagerCustom); 16866 } 16867 // assign the pager click binding 16868 slider.pagerEl.on('click touchend', 'a', clickPagerBind); 16869 }; 16870 16871 /** 16872 * Appends prev / next controls to the controls element 16873 */ 16874 var appendControls = function() { 16875 slider.controls.next = $('<a class="bx-next" href="">' + slider.settings.nextText + '</a>'); 16876 slider.controls.prev = $('<a class="bx-prev" href="">' + slider.settings.prevText + '</a>'); 16877 // add click actions to the controls 16878 slider.controls.next.on('click touchend', clickNextBind); 16879 slider.controls.prev.on('click touchend', clickPrevBind); 16880 // if nextSelector was supplied, populate it 16881 if (slider.settings.nextSelector) { 16882 $(slider.settings.nextSelector).append(slider.controls.next); 16883 } 16884 // if prevSelector was supplied, populate it 16885 if (slider.settings.prevSelector) { 16886 $(slider.settings.prevSelector).append(slider.controls.prev); 16887 } 16888 // if no custom selectors were supplied 16889 if (!slider.settings.nextSelector && !slider.settings.prevSelector) { 16890 // add the controls to the DOM 16891 slider.controls.directionEl = $('<div class="bx-controls-direction" />'); 16892 // add the control elements to the directionEl 16893 slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next); 16894 // slider.viewport.append(slider.controls.directionEl); 16895 slider.controls.el.addClass('bx-has-controls-direction').append(slider.controls.directionEl); 16896 } 16897 }; 16898 16899 /** 16900 * Appends start / stop auto controls to the controls element 16901 */ 16902 var appendControlsAuto = function() { 16903 slider.controls.start = $('<div class="bx-controls-auto-item"><a class="bx-start" href="">' + slider.settings.startText + '</a></div>'); 16904 slider.controls.stop = $('<div class="bx-controls-auto-item"><a class="bx-stop" href="">' + slider.settings.stopText + '</a></div>'); 16905 // add the controls to the DOM 16906 slider.controls.autoEl = $('<div class="bx-controls-auto" />'); 16907 // on click actions to the controls 16908 slider.controls.autoEl.on('click', '.bx-start', clickStartBind); 16909 slider.controls.autoEl.on('click', '.bx-stop', clickStopBind); 16910 // if autoControlsCombine, insert only the "start" control 16911 if (slider.settings.autoControlsCombine) { 16912 slider.controls.autoEl.append(slider.controls.start); 16913 // if autoControlsCombine is false, insert both controls 16914 } else { 16915 slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop); 16916 } 16917 // if auto controls selector was supplied, populate it with the controls 16918 if (slider.settings.autoControlsSelector) { 16919 $(slider.settings.autoControlsSelector).html(slider.controls.autoEl); 16920 // if auto controls selector was not supplied, add it after the wrapper 16921 } else { 16922 slider.controls.el.addClass('bx-has-controls-auto').append(slider.controls.autoEl); 16923 } 16924 // update the auto controls 16925 updateAutoControls(slider.settings.autoStart ? 'stop' : 'start'); 16926 }; 16927 16928 /** 16929 * Appends image captions to the DOM 16930 */ 16931 var appendCaptions = function() { 16932 // cycle through each child 16933 slider.children.each(function(index) { 16934 // get the image title attribute 16935 var title = $(this).find('img:first').attr('title'); 16936 // append the caption 16937 if (title !== undefined && ('' + title).length) { 16938 $(this).append('<div class="bx-caption"><span>' + title + '</span></div>'); 16939 } 16940 }); 16941 }; 16942 16943 /** 16944 * Click next binding 16945 * 16946 * @param e (event) 16947 * - DOM event object 16948 */ 16949 var clickNextBind = function(e) { 16950 e.preventDefault(); 16951 if (slider.controls.el.hasClass('disabled')) { return; } 16952 // if auto show is running, stop it 16953 if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); } 16954 el.goToNextSlide(); 16955 }; 16956 16957 /** 16958 * Click prev binding 16959 * 16960 * @param e (event) 16961 * - DOM event object 16962 */ 16963 var clickPrevBind = function(e) { 16964 e.preventDefault(); 16965 if (slider.controls.el.hasClass('disabled')) { return; } 16966 // if auto show is running, stop it 16967 if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); } 16968 el.goToPrevSlide(); 16969 }; 16970 16971 /** 16972 * Click start binding 16973 * 16974 * @param e (event) 16975 * - DOM event object 16976 */ 16977 var clickStartBind = function(e) { 16978 el.startAuto(); 16979 e.preventDefault(); 16980 }; 16981 16982 /** 16983 * Click stop binding 16984 * 16985 * @param e (event) 16986 * - DOM event object 16987 */ 16988 var clickStopBind = function(e) { 16989 el.stopAuto(); 16990 e.preventDefault(); 16991 }; 16992 16993 /** 16994 * Click pager binding 16995 * 16996 * @param e (event) 16997 * - DOM event object 16998 */ 16999 var clickPagerBind = function(e) { 17000 var pagerLink, pagerIndex; 17001 e.preventDefault(); 17002 if (slider.controls.el.hasClass('disabled')) { 17003 return; 17004 } 17005 // if auto show is running, stop it 17006 if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); } 17007 pagerLink = $(e.currentTarget); 17008 if (pagerLink.attr('data-slide-index') !== undefined) { 17009 pagerIndex = parseInt(pagerLink.attr('data-slide-index')); 17010 // if clicked pager link is not active, continue with the goToSlide call 17011 if (pagerIndex !== slider.active.index) { el.goToSlide(pagerIndex); } 17012 } 17013 }; 17014 17015 /** 17016 * Updates the pager links with an active class 17017 * 17018 * @param slideIndex (int) 17019 * - index of slide to make active 17020 */ 17021 var updatePagerActive = function(slideIndex) { 17022 // if "short" pager type 17023 var len = slider.children.length; // nb of children 17024 if (slider.settings.pagerType === 'short') { 17025 if (slider.settings.maxSlides > 1) { 17026 len = Math.ceil(slider.children.length / slider.settings.maxSlides); 17027 } 17028 slider.pagerEl.html((slideIndex + 1) + slider.settings.pagerShortSeparator + len); 17029 return; 17030 } 17031 // remove all pager active classes 17032 slider.pagerEl.find('a').removeClass('active'); 17033 // apply the active class for all pagers 17034 slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); }); 17035 }; 17036 17037 /** 17038 * Performs needed actions after a slide transition 17039 */ 17040 var updateAfterSlideTransition = function() { 17041 // if infinite loop is true 17042 if (slider.settings.infiniteLoop) { 17043 var position = ''; 17044 // first slide 17045 if (slider.active.index === 0) { 17046 // set the new position 17047 position = slider.children.eq(0).position(); 17048 // carousel, last slide 17049 } else if (slider.active.index === getPagerQty() - 1 && slider.carousel) { 17050 position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position(); 17051 // last slide 17052 } else if (slider.active.index === slider.children.length - 1) { 17053 position = slider.children.eq(slider.children.length - 1).position(); 17054 } 17055 if (position) { 17056 if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); } 17057 else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); } 17058 } 17059 } 17060 // declare that the transition is complete 17061 slider.working = false; 17062 // onSlideAfter callback 17063 slider.settings.onSlideAfter.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index); 17064 }; 17065 17066 /** 17067 * Updates the auto controls state (either active, or combined switch) 17068 * 17069 * @param state (string) "start", "stop" 17070 * - the new state of the auto show 17071 */ 17072 var updateAutoControls = function(state) { 17073 // if autoControlsCombine is true, replace the current control with the new state 17074 if (slider.settings.autoControlsCombine) { 17075 slider.controls.autoEl.html(slider.controls[state]); 17076 // if autoControlsCombine is false, apply the "active" class to the appropriate control 17077 } else { 17078 slider.controls.autoEl.find('a').removeClass('active'); 17079 slider.controls.autoEl.find('a:not(.bx-' + state + ')').addClass('active'); 17080 } 17081 }; 17082 17083 /** 17084 * Updates the direction controls (checks if either should be hidden) 17085 */ 17086 var updateDirectionControls = function() { 17087 if (getPagerQty() === 1) { 17088 slider.controls.prev.addClass('disabled'); 17089 slider.controls.next.addClass('disabled'); 17090 } else if (!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd) { 17091 // if first slide 17092 if (slider.active.index === 0) { 17093 slider.controls.prev.addClass('disabled'); 17094 slider.controls.next.removeClass('disabled'); 17095 // if last slide 17096 } else if (slider.active.index === getPagerQty() - 1) { 17097 slider.controls.next.addClass('disabled'); 17098 slider.controls.prev.removeClass('disabled'); 17099 // if any slide in the middle 17100 } else { 17101 slider.controls.prev.removeClass('disabled'); 17102 slider.controls.next.removeClass('disabled'); 17103 } 17104 } 17105 }; 17106 /* auto start and stop functions */ 17107 var windowFocusHandler = function() { el.startAuto(); }; 17108 var windowBlurHandler = function() { el.stopAuto(); }; 17109 /** 17110 * Initializes the auto process 17111 */ 17112 var initAuto = function() { 17113 // if autoDelay was supplied, launch the auto show using a setTimeout() call 17114 if (slider.settings.autoDelay > 0) { 17115 setTimeout(el.startAuto, slider.settings.autoDelay); 17116 // if autoDelay was not supplied, start the auto show normally 17117 } else { 17118 el.startAuto(); 17119 17120 //add focus and blur events to ensure its running if timeout gets paused 17121 $(window).focus(windowFocusHandler).blur(windowBlurHandler); 17122 } 17123 // if autoHover is requested 17124 if (slider.settings.autoHover) { 17125 // on el hover 17126 el.hover(function() { 17127 // if the auto show is currently playing (has an active interval) 17128 if (slider.interval) { 17129 // stop the auto show and pass true argument which will prevent control update 17130 el.stopAuto(true); 17131 // create a new autoPaused value which will be used by the relative "mouseout" event 17132 slider.autoPaused = true; 17133 } 17134 }, function() { 17135 // if the autoPaused value was created be the prior "mouseover" event 17136 if (slider.autoPaused) { 17137 // start the auto show and pass true argument which will prevent control update 17138 el.startAuto(true); 17139 // reset the autoPaused value 17140 slider.autoPaused = null; 17141 } 17142 }); 17143 } 17144 }; 17145 17146 /** 17147 * Initializes the ticker process 17148 */ 17149 var initTicker = function() { 17150 var startPosition = 0, 17151 position, transform, value, idx, ratio, property, newSpeed, totalDimens; 17152 // if autoDirection is "next", append a clone of the entire slider 17153 if (slider.settings.autoDirection === 'next') { 17154 el.append(slider.children.clone().addClass('bx-clone')); 17155 // if autoDirection is "prev", prepend a clone of the entire slider, and set the left position 17156 } else { 17157 el.prepend(slider.children.clone().addClass('bx-clone')); 17158 position = slider.children.first().position(); 17159 startPosition = slider.settings.mode === 'horizontal' ? -position.left : -position.top; 17160 } 17161 setPositionProperty(startPosition, 'reset', 0); 17162 // do not allow controls in ticker mode 17163 slider.settings.pager = false; 17164 slider.settings.controls = false; 17165 slider.settings.autoControls = false; 17166 // if autoHover is requested 17167 if (slider.settings.tickerHover) { 17168 if (slider.usingCSS) { 17169 idx = slider.settings.mode === 'horizontal' ? 4 : 5; 17170 slider.viewport.hover(function() { 17171 transform = el.css('-' + slider.cssPrefix + '-transform'); 17172 value = parseFloat(transform.split(',')[idx]); 17173 setPositionProperty(value, 'reset', 0); 17174 }, function() { 17175 totalDimens = 0; 17176 slider.children.each(function(index) { 17177 totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true); 17178 }); 17179 // calculate the speed ratio (used to determine the new speed to finish the paused animation) 17180 ratio = slider.settings.speed / totalDimens; 17181 // determine which property to use 17182 property = slider.settings.mode === 'horizontal' ? 'left' : 'top'; 17183 // calculate the new speed 17184 newSpeed = ratio * (totalDimens - (Math.abs(parseInt(value)))); 17185 tickerLoop(newSpeed); 17186 }); 17187 } else { 17188 // on el hover 17189 slider.viewport.hover(function() { 17190 el.stop(); 17191 }, function() { 17192 // calculate the total width of children (used to calculate the speed ratio) 17193 totalDimens = 0; 17194 slider.children.each(function(index) { 17195 totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true); 17196 }); 17197 // calculate the speed ratio (used to determine the new speed to finish the paused animation) 17198 ratio = slider.settings.speed / totalDimens; 17199 // determine which property to use 17200 property = slider.settings.mode === 'horizontal' ? 'left' : 'top'; 17201 // calculate the new speed 17202 newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property))))); 17203 tickerLoop(newSpeed); 17204 }); 17205 } 17206 } 17207 // start the ticker loop 17208 tickerLoop(); 17209 }; 17210 17211 /** 17212 * Runs a continuous loop, news ticker-style 17213 */ 17214 var tickerLoop = function(resumeSpeed) { 17215 var speed = resumeSpeed ? resumeSpeed : slider.settings.speed, 17216 position = {left: 0, top: 0}, 17217 reset = {left: 0, top: 0}, 17218 animateProperty, resetValue, params; 17219 17220 // if "next" animate left position to last child, then reset left to 0 17221 if (slider.settings.autoDirection === 'next') { 17222 position = el.find('.bx-clone').first().position(); 17223 // if "prev" animate left position to 0, then reset left to first non-clone child 17224 } else { 17225 reset = slider.children.first().position(); 17226 } 17227 animateProperty = slider.settings.mode === 'horizontal' ? -position.left : -position.top; 17228 resetValue = slider.settings.mode === 'horizontal' ? -reset.left : -reset.top; 17229 params = {resetValue: resetValue}; 17230 setPositionProperty(animateProperty, 'ticker', speed, params); 17231 }; 17232 17233 /** 17234 * Check if el is on screen 17235 */ 17236 var isOnScreen = function(el) { 17237 var win = $(window), 17238 viewport = { 17239 top: win.scrollTop(), 17240 left: win.scrollLeft() 17241 }, 17242 bounds = el.offset(); 17243 17244 viewport.right = viewport.left + win.width(); 17245 viewport.bottom = viewport.top + win.height(); 17246 bounds.right = bounds.left + el.outerWidth(); 17247 bounds.bottom = bounds.top + el.outerHeight(); 17248 17249 return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom)); 17250 }; 17251 17252 /** 17253 * Initializes keyboard events 17254 */ 17255 var keyPress = function(e) { 17256 var activeElementTag = document.activeElement.tagName.toLowerCase(), 17257 tagFilters = 'input|textarea', 17258 p = new RegExp(activeElementTag,['i']), 17259 result = p.exec(tagFilters); 17260 17261 if (result == null && isOnScreen(el)) { 17262 if (e.keyCode === 39) { 17263 clickNextBind(e); 17264 return false; 17265 } else if (e.keyCode === 37) { 17266 clickPrevBind(e); 17267 return false; 17268 } 17269 } 17270 }; 17271 17272 /** 17273 * Initializes touch events 17274 */ 17275 var initTouch = function() { 17276 // initialize object to contain all touch values 17277 slider.touch = { 17278 start: {x: 0, y: 0}, 17279 end: {x: 0, y: 0} 17280 }; 17281 slider.viewport.on('touchstart MSPointerDown pointerdown', onTouchStart); 17282 17283 //for browsers that have implemented pointer events and fire a click after 17284 //every pointerup regardless of whether pointerup is on same screen location as pointerdown or not 17285 slider.viewport.on('click', '.bxslider a', function(e) { 17286 if (slider.viewport.hasClass('click-disabled')) { 17287 e.preventDefault(); 17288 slider.viewport.removeClass('click-disabled'); 17289 } 17290 }); 17291 }; 17292 17293 /** 17294 * Event handler for "touchstart" 17295 * 17296 * @param e (event) 17297 * - DOM event object 17298 */ 17299 var onTouchStart = function(e) { 17300 // watch only for left mouse, touch contact and pen contact 17301 // touchstart event object doesn`t have button property 17302 if (e.type !== 'touchstart' && e.button !== 0) { 17303 return; 17304 } 17305 e.preventDefault(); 17306 //disable slider controls while user is interacting with slides to avoid slider freeze that happens on touch devices when a slide swipe happens immediately after interacting with slider controls 17307 slider.controls.el.addClass('disabled'); 17308 17309 if (slider.working) { 17310 slider.controls.el.removeClass('disabled'); 17311 } else { 17312 // record the original position when touch starts 17313 slider.touch.originalPos = el.position(); 17314 var orig = e.originalEvent, 17315 touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig]; 17316 var chromePointerEvents = typeof PointerEvent === 'function'; 17317 if (chromePointerEvents) { 17318 if (orig.pointerId === undefined) { 17319 return; 17320 } 17321 } 17322 // record the starting touch x, y coordinates 17323 slider.touch.start.x = touchPoints[0].pageX; 17324 slider.touch.start.y = touchPoints[0].pageY; 17325 17326 if (slider.viewport.get(0).setPointerCapture) { 17327 slider.pointerId = orig.pointerId; 17328 slider.viewport.get(0).setPointerCapture(slider.pointerId); 17329 } 17330 // store original event data for click fixation 17331 slider.originalClickTarget = orig.originalTarget || orig.target; 17332 slider.originalClickButton = orig.button; 17333 slider.originalClickButtons = orig.buttons; 17334 slider.originalEventType = orig.type; 17335 // at this moment we don`t know what it is click or swipe 17336 slider.hasMove = false; 17337 // on a "touchmove" event to the viewport 17338 slider.viewport.on('touchmove MSPointerMove pointermove', onTouchMove); 17339 // on a "touchend" event to the viewport 17340 slider.viewport.on('touchend MSPointerUp pointerup', onTouchEnd); 17341 slider.viewport.on('MSPointerCancel pointercancel', onPointerCancel); 17342 } 17343 }; 17344 17345 /** 17346 * Cancel Pointer for Windows Phone 17347 * 17348 * @param e (event) 17349 * - DOM event object 17350 */ 17351 var onPointerCancel = function(e) { 17352 e.preventDefault(); 17353 /* onPointerCancel handler is needed to deal with situations when a touchend 17354 doesn't fire after a touchstart (this happens on windows phones only) */ 17355 setPositionProperty(slider.touch.originalPos.left, 'reset', 0); 17356 17357 //remove handlers 17358 slider.controls.el.removeClass('disabled'); 17359 slider.viewport.off('MSPointerCancel pointercancel', onPointerCancel); 17360 slider.viewport.off('touchmove MSPointerMove pointermove', onTouchMove); 17361 slider.viewport.off('touchend MSPointerUp pointerup', onTouchEnd); 17362 if (slider.viewport.get(0).releasePointerCapture) { 17363 slider.viewport.get(0).releasePointerCapture(slider.pointerId); 17364 } 17365 }; 17366 17367 /** 17368 * Event handler for "touchmove" 17369 * 17370 * @param e (event) 17371 * - DOM event object 17372 */ 17373 var onTouchMove = function(e) { 17374 var orig = e.originalEvent, 17375 touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig], 17376 // if scrolling on y axis, do not prevent default 17377 xMovement = Math.abs(touchPoints[0].pageX - slider.touch.start.x), 17378 yMovement = Math.abs(touchPoints[0].pageY - slider.touch.start.y), 17379 value = 0, 17380 change = 0; 17381 // this is swipe 17382 slider.hasMove = true; 17383 17384 // x axis swipe 17385 if ((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX) { 17386 e.preventDefault(); 17387 // y axis swipe 17388 } else if ((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY) { 17389 e.preventDefault(); 17390 } 17391 if (e.type !== 'touchmove') { 17392 e.preventDefault(); 17393 } 17394 17395 if (slider.settings.mode !== 'fade' && slider.settings.oneToOneTouch) { 17396 // if horizontal, drag along x axis 17397 if (slider.settings.mode === 'horizontal') { 17398 change = touchPoints[0].pageX - slider.touch.start.x; 17399 value = slider.touch.originalPos.left + change; 17400 // if vertical, drag along y axis 17401 } else { 17402 change = touchPoints[0].pageY - slider.touch.start.y; 17403 value = slider.touch.originalPos.top + change; 17404 } 17405 setPositionProperty(value, 'reset', 0); 17406 } 17407 }; 17408 17409 /** 17410 * Event handler for "touchend" 17411 * 17412 * @param e (event) 17413 * - DOM event object 17414 */ 17415 var onTouchEnd = function(e) { 17416 e.preventDefault(); 17417 slider.viewport.off('touchmove MSPointerMove pointermove', onTouchMove); 17418 //enable slider controls as soon as user stops interacing with slides 17419 slider.controls.el.removeClass('disabled'); 17420 var orig = e.originalEvent, 17421 touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig], 17422 value = 0, 17423 distance = 0; 17424 // record end x, y positions 17425 slider.touch.end.x = touchPoints[0].pageX; 17426 slider.touch.end.y = touchPoints[0].pageY; 17427 // if fade mode, check if absolute x distance clears the threshold 17428 if (slider.settings.mode === 'fade') { 17429 distance = Math.abs(slider.touch.start.x - slider.touch.end.x); 17430 if (distance >= slider.settings.swipeThreshold) { 17431 if (slider.touch.start.x > slider.touch.end.x) { 17432 el.goToNextSlide(); 17433 } else { 17434 el.goToPrevSlide(); 17435 } 17436 el.stopAuto(); 17437 } 17438 // not fade mode 17439 } else { 17440 // calculate distance and el's animate property 17441 if (slider.settings.mode === 'horizontal') { 17442 distance = slider.touch.end.x - slider.touch.start.x; 17443 value = slider.touch.originalPos.left; 17444 } else { 17445 distance = slider.touch.end.y - slider.touch.start.y; 17446 value = slider.touch.originalPos.top; 17447 } 17448 // if not infinite loop and first / last slide, do not attempt a slide transition 17449 if (!slider.settings.infiniteLoop && ((slider.active.index === 0 && distance > 0) || (slider.active.last && distance < 0))) { 17450 setPositionProperty(value, 'reset', 200); 17451 } else { 17452 // check if distance clears threshold 17453 if (Math.abs(distance) >= slider.settings.swipeThreshold) { 17454 if (distance < 0) { 17455 el.goToNextSlide(); 17456 } else { 17457 el.goToPrevSlide(); 17458 } 17459 el.stopAuto(); 17460 } else { 17461 // el.animate(property, 200); 17462 setPositionProperty(value, 'reset', 200); 17463 } 17464 } 17465 } 17466 slider.viewport.off('touchend MSPointerUp pointerup', onTouchEnd); 17467 17468 if (slider.viewport.get(0).releasePointerCapture) { 17469 slider.viewport.get(0).releasePointerCapture(slider.pointerId); 17470 } 17471 // if slider had swipe with left mouse, touch contact and pen contact 17472 if (slider.hasMove === false && (slider.originalClickButton === 0 || slider.originalEventType === 'touchstart')) { 17473 // trigger click event (fix for Firefox59 and PointerEvent standard compatibility) 17474 $(slider.originalClickTarget).trigger({ 17475 type: 'click', 17476 button: slider.originalClickButton, 17477 buttons: slider.originalClickButtons 17478 }); 17479 } 17480 }; 17481 17482 /** 17483 * Window resize event callback 17484 */ 17485 var resizeWindow = function(e) { 17486 // don't do anything if slider isn't initialized. 17487 if (!slider.initialized) { return; } 17488 // Delay if slider working. 17489 if (slider.working) { 17490 window.setTimeout(resizeWindow, 10); 17491 } else { 17492 // get the new window dimens (again, thank you IE) 17493 var windowWidthNew = $(window).width(), 17494 windowHeightNew = $(window).height(); 17495 // make sure that it is a true window resize 17496 // *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements 17497 // are resized. Can you just die already?* 17498 if (windowWidth !== windowWidthNew || windowHeight !== windowHeightNew) { 17499 // set the new window dimens 17500 windowWidth = windowWidthNew; 17501 windowHeight = windowHeightNew; 17502 // update all dynamic elements 17503 el.redrawSlider(); 17504 // Call user resize handler 17505 slider.settings.onSliderResize.call(el, slider.active.index); 17506 } 17507 } 17508 }; 17509 17510 /** 17511 * Adds an aria-hidden=true attribute to each element 17512 * 17513 * @param startVisibleIndex (int) 17514 * - the first visible element's index 17515 */ 17516 var applyAriaHiddenAttributes = function(startVisibleIndex) { 17517 var numberOfSlidesShowing = getNumberSlidesShowing(); 17518 // only apply attributes if the setting is enabled and not in ticker mode 17519 if (slider.settings.ariaHidden && !slider.settings.ticker) { 17520 // add aria-hidden=true to all elements 17521 slider.children.attr('aria-hidden', 'true'); 17522 // get the visible elements and change to aria-hidden=false 17523 slider.children.slice(startVisibleIndex, startVisibleIndex + numberOfSlidesShowing).attr('aria-hidden', 'false'); 17524 } 17525 }; 17526 17527 /** 17528 * Returns index according to present page range 17529 * 17530 * @param slideOndex (int) 17531 * - the desired slide index 17532 */ 17533 var setSlideIndex = function(slideIndex) { 17534 if (slideIndex < 0) { 17535 if (slider.settings.infiniteLoop) { 17536 return getPagerQty() - 1; 17537 }else { 17538 //we don't go to undefined slides 17539 return slider.active.index; 17540 } 17541 // if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop) 17542 } else if (slideIndex >= getPagerQty()) { 17543 if (slider.settings.infiniteLoop) { 17544 return 0; 17545 } else { 17546 //we don't move to undefined pages 17547 return slider.active.index; 17548 } 17549 // set active index to requested slide 17550 } else { 17551 return slideIndex; 17552 } 17553 }; 17554 17555 /** 17556 * =================================================================================== 17557 * = PUBLIC FUNCTIONS 17558 * =================================================================================== 17559 */ 17560 17561 /** 17562 * Performs slide transition to the specified slide 17563 * 17564 * @param slideIndex (int) 17565 * - the destination slide's index (zero-based) 17566 * 17567 * @param direction (string) 17568 * - INTERNAL USE ONLY - the direction of travel ("prev" / "next") 17569 */ 17570 el.goToSlide = function(slideIndex, direction) { 17571 // onSlideBefore, onSlideNext, onSlidePrev callbacks 17572 // Allow transition canceling based on returned value 17573 var performTransition = true, 17574 moveBy = 0, 17575 position = {left: 0, top: 0}, 17576 lastChild = null, 17577 lastShowingIndex, eq, value, requestEl; 17578 // store the old index 17579 slider.oldIndex = slider.active.index; 17580 //set new index 17581 slider.active.index = setSlideIndex(slideIndex); 17582 17583 // if plugin is currently in motion, ignore request 17584 if (slider.working || slider.active.index === slider.oldIndex) { return; } 17585 // declare that plugin is in motion 17586 slider.working = true; 17587 17588 performTransition = slider.settings.onSlideBefore.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index); 17589 17590 // If transitions canceled, reset and return 17591 if (typeof (performTransition) !== 'undefined' && !performTransition) { 17592 slider.active.index = slider.oldIndex; // restore old index 17593 slider.working = false; // is not in motion 17594 return; 17595 } 17596 17597 if (direction === 'next') { 17598 // Prevent canceling in future functions or lack there-of from negating previous commands to cancel 17599 if (!slider.settings.onSlideNext.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) { 17600 performTransition = false; 17601 } 17602 } else if (direction === 'prev') { 17603 // Prevent canceling in future functions or lack there-of from negating previous commands to cancel 17604 if (!slider.settings.onSlidePrev.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) { 17605 performTransition = false; 17606 } 17607 } 17608 17609 // check if last slide 17610 slider.active.last = slider.active.index >= getPagerQty() - 1; 17611 // update the pager with active class 17612 if (slider.settings.pager || slider.settings.pagerCustom) { updatePagerActive(slider.active.index); } 17613 // // check for direction control update 17614 if (slider.settings.controls) { updateDirectionControls(); } 17615 // if slider is set to mode: "fade" 17616 if (slider.settings.mode === 'fade') { 17617 // if adaptiveHeight is true and next height is different from current height, animate to the new height 17618 if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) { 17619 slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed); 17620 } 17621 // fade out the visible child and reset its z-index value 17622 slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0}); 17623 // fade in the newly requested slide 17624 slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex + 1).fadeIn(slider.settings.speed, function() { 17625 $(this).css('zIndex', slider.settings.slideZIndex); 17626 updateAfterSlideTransition(); 17627 }); 17628 // slider mode is not "fade" 17629 } else { 17630 // if adaptiveHeight is true and next height is different from current height, animate to the new height 17631 if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) { 17632 slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed); 17633 } 17634 // if carousel and not infinite loop 17635 if (!slider.settings.infiniteLoop && slider.carousel && slider.active.last) { 17636 if (slider.settings.mode === 'horizontal') { 17637 // get the last child position 17638 lastChild = slider.children.eq(slider.children.length - 1); 17639 position = lastChild.position(); 17640 // calculate the position of the last slide 17641 moveBy = slider.viewport.width() - lastChild.outerWidth(); 17642 } else { 17643 // get last showing index position 17644 lastShowingIndex = slider.children.length - slider.settings.minSlides; 17645 position = slider.children.eq(lastShowingIndex).position(); 17646 } 17647 // horizontal carousel, going previous while on first slide (infiniteLoop mode) 17648 } else if (slider.carousel && slider.active.last && direction === 'prev') { 17649 // get the last child position 17650 eq = slider.settings.moveSlides === 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides); 17651 lastChild = el.children('.bx-clone').eq(eq); 17652 position = lastChild.position(); 17653 // if infinite loop and "Next" is clicked on the last slide 17654 } else if (direction === 'next' && slider.active.index === 0) { 17655 // get the last clone position 17656 position = el.find('> .bx-clone').eq(slider.settings.maxSlides).position(); 17657 slider.active.last = false; 17658 // normal non-zero requests 17659 } else if (slideIndex >= 0) { 17660 //parseInt is applied to allow floats for slides/page 17661 requestEl = slideIndex * parseInt(getMoveBy()); 17662 position = slider.children.eq(requestEl).position(); 17663 } 17664 17665 /* If the position doesn't exist 17666 * (e.g. if you destroy the slider on a next click), 17667 * it doesn't throw an error. 17668 */ 17669 if (typeof (position) !== 'undefined') { 17670 value = slider.settings.mode === 'horizontal' ? -(position.left - moveBy) : -position.top; 17671 // plugin values to be animated 17672 setPositionProperty(value, 'slide', slider.settings.speed); 17673 } 17674 slider.working = false; 17675 } 17676 if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); } 17677 }; 17678 17679 /** 17680 * Transitions to the next slide in the show 17681 */ 17682 el.goToNextSlide = function() { 17683 // if infiniteLoop is false and last page is showing, disregard call 17684 if (!slider.settings.infiniteLoop && slider.active.last) { return; } 17685 if (slider.working === true){ return ;} 17686 var pagerIndex = parseInt(slider.active.index) + 1; 17687 el.goToSlide(pagerIndex, 'next'); 17688 }; 17689 17690 /** 17691 * Transitions to the prev slide in the show 17692 */ 17693 el.goToPrevSlide = function() { 17694 // if infiniteLoop is false and last page is showing, disregard call 17695 if (!slider.settings.infiniteLoop && slider.active.index === 0) { return; } 17696 if (slider.working === true){ return ;} 17697 var pagerIndex = parseInt(slider.active.index) - 1; 17698 el.goToSlide(pagerIndex, 'prev'); 17699 }; 17700 17701 /** 17702 * Starts the auto show 17703 * 17704 * @param preventControlUpdate (boolean) 17705 * - if true, auto controls state will not be updated 17706 */ 17707 el.startAuto = function(preventControlUpdate) { 17708 // if an interval already exists, disregard call 17709 if (slider.interval) { return; } 17710 // create an interval 17711 slider.interval = setInterval(function() { 17712 if (slider.settings.autoDirection === 'next') { 17713 el.goToNextSlide(); 17714 } else { 17715 el.goToPrevSlide(); 17716 } 17717 }, slider.settings.pause); 17718 //allback for when the auto rotate status changes 17719 slider.settings.onAutoChange.call(el, true); 17720 // if auto controls are displayed and preventControlUpdate is not true 17721 if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('stop'); } 17722 }; 17723 17724 /** 17725 * Stops the auto show 17726 * 17727 * @param preventControlUpdate (boolean) 17728 * - if true, auto controls state will not be updated 17729 */ 17730 el.stopAuto = function(preventControlUpdate) { 17731 // if slider is auto paused, just clear that state 17732 if (slider.autoPaused) slider.autoPaused = false; 17733 // if no interval exists, disregard call 17734 if (!slider.interval) { return; } 17735 // clear the interval 17736 clearInterval(slider.interval); 17737 slider.interval = null; 17738 //allback for when the auto rotate status changes 17739 slider.settings.onAutoChange.call(el, false); 17740 // if auto controls are displayed and preventControlUpdate is not true 17741 if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('start'); } 17742 }; 17743 17744 /** 17745 * Returns current slide index (zero-based) 17746 */ 17747 el.getCurrentSlide = function() { 17748 return slider.active.index; 17749 }; 17750 17751 /** 17752 * Returns current slide element 17753 */ 17754 el.getCurrentSlideElement = function() { 17755 return slider.children.eq(slider.active.index); 17756 }; 17757 17758 /** 17759 * Returns a slide element 17760 * @param index (int) 17761 * - The index (zero-based) of the element you want returned. 17762 */ 17763 el.getSlideElement = function(index) { 17764 return slider.children.eq(index); 17765 }; 17766 17767 /** 17768 * Returns number of slides in show 17769 */ 17770 el.getSlideCount = function() { 17771 return slider.children.length; 17772 }; 17773 17774 /** 17775 * Return slider.working variable 17776 */ 17777 el.isWorking = function() { 17778 return slider.working; 17779 }; 17780 17781 /** 17782 * Update all dynamic slider elements 17783 */ 17784 el.redrawSlider = function() { 17785 // resize all children in ratio to new screen size 17786 slider.children.add(el.find('.bx-clone')).outerWidth(getSlideWidth()); 17787 // adjust the height 17788 slider.viewport.css('height', getViewportHeight()); 17789 // update the slide position 17790 if (!slider.settings.ticker) { setSlidePosition(); } 17791 // if active.last was true before the screen resize, we want 17792 // to keep it last no matter what screen size we end on 17793 if (slider.active.last) { slider.active.index = getPagerQty() - 1; } 17794 // if the active index (page) no longer exists due to the resize, simply set the index as last 17795 if (slider.active.index >= getPagerQty()) { slider.active.last = true; } 17796 // if a pager is being displayed and a custom pager is not being used, update it 17797 if (slider.settings.pager && !slider.settings.pagerCustom) { 17798 populatePager(); 17799 updatePagerActive(slider.active.index); 17800 } 17801 if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); } 17802 }; 17803 17804 /** 17805 * Destroy the current instance of the slider (revert everything back to original state) 17806 */ 17807 el.destroySlider = function() { 17808 // don't do anything if slider has already been destroyed 17809 if (!slider.initialized) { return; } 17810 slider.initialized = false; 17811 $('.bx-clone', this).remove(); 17812 slider.children.each(function() { 17813 if ($(this).data('origStyle') !== undefined) { 17814 $(this).attr('style', $(this).data('origStyle')); 17815 } else { 17816 $(this).removeAttr('style'); 17817 } 17818 }); 17819 if ($(this).data('origStyle') !== undefined) { 17820 this.attr('style', $(this).data('origStyle')); 17821 } else { 17822 $(this).removeAttr('style'); 17823 } 17824 $(this).unwrap().unwrap(); 17825 if (slider.controls.el) { slider.controls.el.remove(); } 17826 if (slider.controls.next) { slider.controls.next.remove(); } 17827 if (slider.controls.prev) { slider.controls.prev.remove(); } 17828 if (slider.pagerEl && slider.settings.controls && !slider.settings.pagerCustom) { slider.pagerEl.remove(); } 17829 $('.bx-caption', this).remove(); 17830 if (slider.controls.autoEl) { slider.controls.autoEl.remove(); } 17831 clearInterval(slider.interval); 17832 if (slider.settings.responsive) { $(window).off('resize', resizeWindow); } 17833 if (slider.settings.keyboardEnabled) { $(document).off('keydown', keyPress); } 17834 //remove self reference in data 17835 $(this).removeData('bxSlider'); 17836 // remove global window handlers 17837 $(window).off('blur', windowBlurHandler).off('focus', windowFocusHandler); 17838 }; 17839 17840 /** 17841 * Reload the slider (revert all DOM changes, and re-initialize) 17842 */ 17843 el.reloadSlider = function(settings) { 17844 if (settings !== undefined) { options = settings; } 17845 el.destroySlider(); 17846 init(); 17847 //store reference to self in order to access public functions later 17848 $(el).data('bxSlider', this); 17849 }; 17850 17851 init(); 17852 17853 $(el).data('bxSlider', this); 17854 17855 // returns the current jQuery object 17856 return this; 17857 }; 17858 17859})(jQuery);
vendor: 10,708 bytes, lines 17860-18110
17860 17861define("bxslider", ["jquery"], function(){}); 17862 17863/* 17864 * jQuery FlexSlider v2.7.2 17865 * Copyright 2012 WooThemes 17866 * Contributing Author: Tyler Smith 17867 */ 17868; 17869(function ($) { 17870 17871 var focused = true; 17872 17873 //FlexSlider: Object Instance 17874 $.flexslider = function(el, options) { 17875 var slider = $(el); 17876 17877 // making variables public 17878 17879 //if rtl value was not passed and html is in rtl..enable it by default. 17880 if(typeof options.rtl=='undefined' && $('html').attr('dir')=='rtl'){ 17881 options.rtl=true; 17882 } 17883 slider.vars = $.extend({}, $.flexslider.defaults, options); 17884 17885 var namespace = slider.vars.namespace, 17886 msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture, 17887 touch = (( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch, 17888 // deprecating this idea, as devices are being released with both of these events 17889 eventType = "click touchend MSPointerUp keyup", 17890 watchedEvent = "", 17891 watchedEventClearTimer, 17892 vertical = slider.vars.direction === "vertical", 17893 reverse = slider.vars.reverse, 17894 carousel = (slider.vars.itemWidth > 0), 17895 fade = slider.vars.animation === "fade", 17896 asNav = slider.vars.asNavFor !== "", 17897 methods = {}; 17898 17899 // Store a reference to the slider object 17900 $.data(el, "flexslider", slider); 17901 17902 // Private slider methods 17903 methods = { 17904 init: function() { 17905 slider.animating = false; 17906 // Get current slide and make sure it is a number 17907 slider.currentSlide = parseInt( ( slider.vars.startAt ? slider.vars.startAt : 0), 10 ); 17908 if ( isNaN( slider.currentSlide ) ) { slider.currentSlide = 0; } 17909 slider.animatingTo = slider.currentSlide; 17910 slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last); 17911 slider.containerSelector = slider.vars.selector.substr(0,slider.vars.selector.search(' ')); 17912 slider.slides = $(slider.vars.selector, slider); 17913 slider.container = $(slider.containerSelector, slider); 17914 slider.count = slider.slides.length; 17915 // SYNC: 17916 slider.syncExists = $(slider.vars.sync).length > 0; 17917 // SLIDE: 17918 if (slider.vars.animation === "slide") { slider.vars.animation = "swing"; } 17919 slider.prop = (vertical) ? "top" : ( slider.vars.rtl ? "marginRight" : "marginLeft" ); 17920 slider.args = {}; 17921 // SLIDESHOW: 17922 slider.manualPause = false; 17923 slider.stopped = false; 17924 //PAUSE WHEN INVISIBLE 17925 slider.started = false; 17926 slider.startTimeout = null; 17927 // TOUCH/USECSS: 17928 slider.transitions = !slider.vars.video && !fade && slider.vars.useCSS && (function() { 17929 var obj = document.createElement('div'), 17930 props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective']; 17931 for (var i in props) { 17932 if ( obj.style[ props[i] ] !== undefined ) { 17933 slider.pfx = props[i].replace('Perspective','').toLowerCase(); 17934 slider.prop = "-" + slider.pfx + "-transform"; 17935 return true; 17936 } 17937 } 17938 return false; 17939 }()); 17940 slider.isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; 17941 slider.ensureAnimationEnd = ''; 17942 // CONTROLSCONTAINER: 17943 if (slider.vars.controlsContainer !== "") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer); 17944 // MANUAL: 17945 if (slider.vars.manualControls !== "") slider.manualControls = $(slider.vars.manualControls).length > 0 && $(slider.vars.manualControls); 17946 17947 // CUSTOM DIRECTION NAV: 17948 if (slider.vars.customDirectionNav !== "") slider.customDirectionNav = $(slider.vars.customDirectionNav).length === 2 && $(slider.vars.customDirectionNav); 17949 17950 // RANDOMIZE: 17951 if (slider.vars.randomize) { 17952 slider.slides.sort(function() { return (Math.round(Math.random())-0.5); }); 17953 slider.container.empty().append(slider.slides); 17954 } 17955 17956 slider.doMath(); 17957 17958 // INIT 17959 slider.setup("init"); 17960 17961 // CONTROLNAV: 17962 if (slider.vars.controlNav) { methods.controlNav.setup(); } 17963 17964 // DIRECTIONNAV: 17965 if (slider.vars.directionNav) { methods.directionNav.setup(); } 17966 17967 // KEYBOARD: 17968 if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) { 17969 $(document).bind('keyup', function(event) { 17970 var keycode = event.keyCode; 17971 if (!slider.animating && (keycode === 39 || keycode === 37)) { 17972 var target = (slider.vars.rtl? 17973 ((keycode === 37) ? slider.getTarget('next') : 17974 (keycode === 39) ? slider.getTarget('prev') : false) 17975 : 17976 ((keycode === 39) ? slider.getTarget('next') : 17977 (keycode === 37) ? slider.getTarget('prev') : false) 17978 ) 17979 ; 17980 slider.flexAnimate(target, slider.vars.pauseOnAction); 17981 } 17982 }); 17983 } 17984 // MOUSEWHEEL: 17985 if (slider.vars.mousewheel) { 17986 slider.bind('mousewheel', function(event, delta, deltaX, deltaY) { 17987 event.preventDefault(); 17988 var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev'); 17989 slider.flexAnimate(target, slider.vars.pauseOnAction); 17990 }); 17991 } 17992 17993 // PAUSEPLAY 17994 if (slider.vars.pausePlay) { methods.pausePlay.setup(); } 17995 17996 //PAUSE WHEN INVISIBLE 17997 if (slider.vars.slideshow && slider.vars.pauseInvisible) { methods.pauseInvisible.init(); } 17998 17999 // SLIDSESHOW 18000 if (slider.vars.slideshow) { 18001 if (slider.vars.pauseOnHover) { 18002 slider.hover(function() { 18003 if (!slider.manualPlay && !slider.manualPause) { slider.pause(); } 18004 }, function() { 18005 if (!slider.manualPause && !slider.manualPlay && !slider.stopped) { slider.play(); } 18006 }); 18007 } 18008 // initialize animation 18009 //If we're visible, or we don't use PageVisibility API 18010 if(!slider.vars.pauseInvisible || !methods.pauseInvisible.isHidden()) { 18011 (slider.vars.initDelay > 0) ? slider.startTimeout = setTimeout(slider.play, slider.vars.initDelay) : slider.play(); 18012 } 18013 } 18014 18015 // ASNAV: 18016 if (asNav) { methods.asNav.setup(); } 18017 18018 // TOUCH 18019 if (touch && slider.vars.touch) { methods.touch(); } 18020 18021 // FADE&&SMOOTHHEIGHT || SLIDE: 18022 if (!fade || (fade && slider.vars.smoothHeight)) { $(window).bind("resize orientationchange focus", methods.resize); } 18023 18024 slider.find("img").attr("draggable", "false"); 18025 18026 // API: start() Callback 18027 setTimeout(function(){ 18028 slider.vars.start(slider); 18029 }, 200); 18030 }, 18031 asNav: { 18032 setup: function() { 18033 slider.asNav = true; 18034 slider.animatingTo = Math.floor(slider.currentSlide/slider.move); 18035 slider.currentItem = slider.currentSlide; 18036 slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide"); 18037 if(!msGesture){ 18038 slider.slides.on(eventType, function(e){ 18039 e.preventDefault(); 18040 var $slide = $(this), 18041 target = $slide.index(); 18042 var posFromX; 18043 if(slider.vars.rtl){ 18044 posFromX = -1*($slide.offset().right - $(slider).scrollLeft()); // Find position of slide relative to right of slider container 18045 } 18046 else 18047 { 18048 posFromX = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container 18049 } 18050 if( posFromX <= 0 && $slide.hasClass( namespace + 'active-slide' ) ) { 18051 slider.flexAnimate(slider.getTarget("prev"), true); 18052 } else if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + "active-slide")) { 18053 slider.direction = (slider.currentItem < target) ? "next" : "prev"; 18054 slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true); 18055 } 18056 }); 18057 }else{ 18058 el._slider = slider; 18059 slider.slides.each(function (){ 18060 var that = this; 18061 that._gesture = new MSGesture(); 18062 that._gesture.target = that; 18063 that.addEventListener("MSPointerDown", function (e){ 18064 e.preventDefault(); 18065 if(e.currentTarget._gesture) { 18066 e.currentTarget._gesture.addPointer(e.pointerId); 18067 } 18068 }, false); 18069 that.addEventListener("MSGestureTap", function (e){ 18070 e.preventDefault(); 18071 var $slide = $(this), 18072 target = $slide.index(); 18073 if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) { 18074 slider.direction = (slider.currentItem < target) ? "next" : "prev"; 18075 slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true); 18076 } 18077 }); 18078 }); 18079 } 18080 } 18081 }, 18082 controlNav: { 18083 setup: function() { 18084 if (!slider.manualControls) { 18085 methods.controlNav.setupPaging(); 18086 } else { // MANUALCONTROLS: 18087 methods.controlNav.setupManual(); 18088 } 18089 }, 18090 setupPaging: function() { 18091 var type = (slider.vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging', 18092 j = 1, 18093 item, 18094 slide; 18095 18096 slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>'); 18097 18098 if (slider.pagingCount > 1) { 18099 for (var i = 0; i < slider.pagingCount; i++) { 18100 slide = slider.slides.eq(i); 18101 18102 if ( undefined === slide.attr( 'data-thumb-alt' ) ) { 18103 slide.attr( 'data-thumb-alt', '' ); 18104 } 18105 18106 item = $( '<a></a>' ).attr( 'href', '#' ).text( j ); 18107 if ( slider.vars.controlNav === "thumbnails" ) { 18108 item = $( '<img/>' ).attr( 'src', slide.attr( 'data-thumb' ) ); 18109 } 18110
18111 if ( '' !== slide.attr( 'data-thumb-alt' ) ) { 18112 item.attr( 'alt', slide.attr( 'data-thumb-alt' ) ); 18113 } 18114 18115 if ( 'thumbnails' === slider.vars.controlNav && true === slider.vars.thumbCaptions ) { 18116 var captn = slide.attr( 'data-thumbcaption' ); 18117 if ( '' !== captn && undefined !== captn ) { 18118 var caption = $('<span></span>' ).addClass( namespace + 'caption' ).text( captn ); 18119 item.append( caption ); 18120 } 18121 }
vendor: 46,117 bytes, lines 18122-19114
18122 18123 var liElement = $( '<li>' ); 18124 item.appendTo( liElement ); 18125 liElement.append( '</li>' ); 18126 18127 slider.controlNavScaffold.append(liElement); 18128 j++; 18129 18130 } 18131 } 18132 18133 // CONTROLSCONTAINER: 18134 (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold); 18135 methods.controlNav.set(); 18136 18137 methods.controlNav.active(); 18138 18139 slider.controlNavScaffold.delegate('a, img', eventType, function(event) { 18140 event.preventDefault(); 18141 18142 if (watchedEvent === "" || watchedEvent === event.type) { 18143 var $this = $(this), 18144 target = slider.controlNav.index($this); 18145 18146 if (!$this.hasClass(namespace + 'active')) { 18147 slider.direction = (target > slider.currentSlide) ? "next" : "prev"; 18148 slider.flexAnimate(target, slider.vars.pauseOnAction); 18149 } 18150 } 18151 18152 // setup flags to prevent event duplication 18153 if (watchedEvent === "") { 18154 watchedEvent = event.type; 18155 } 18156 methods.setToClearWatchedEvent(); 18157 18158 }); 18159 }, 18160 setupManual: function() { 18161 slider.controlNav = slider.manualControls; 18162 methods.controlNav.active(); 18163 18164 slider.controlNav.bind(eventType, function(event) { 18165 event.preventDefault(); 18166 18167 if (watchedEvent === "" || watchedEvent === event.type) { 18168 var $this = $(this), 18169 target = slider.controlNav.index($this); 18170 18171 if (!$this.hasClass(namespace + 'active')) { 18172 (target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev"; 18173 slider.flexAnimate(target, slider.vars.pauseOnAction); 18174 } 18175 } 18176 18177 // setup flags to prevent event duplication 18178 if (watchedEvent === "") { 18179 watchedEvent = event.type; 18180 } 18181 methods.setToClearWatchedEvent(); 18182 }); 18183 }, 18184 set: function() { 18185 var selector = (slider.vars.controlNav === "thumbnails") ? 'img' : 'a'; 18186 slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider); 18187 }, 18188 active: function() { 18189 slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active"); 18190 }, 18191 update: function(action, pos) { 18192 if (slider.pagingCount > 1 && action === "add") { 18193 slider.controlNavScaffold.append($('<li><a href="#">' + slider.count + '</a></li>')); 18194 } else if (slider.pagingCount === 1) { 18195 slider.controlNavScaffold.find('li').remove(); 18196 } else { 18197 slider.controlNav.eq(pos).closest('li').remove(); 18198 } 18199 methods.controlNav.set(); 18200 (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active(); 18201 } 18202 }, 18203 directionNav: { 18204 setup: function() { 18205 var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li class="' + namespace + 'nav-prev"><a class="' + namespace + 'prev" href="#">' + slider.vars.prevText + '</a></li><li class="' + namespace + 'nav-next"><a class="' + namespace + 'next" href="#">' + slider.vars.nextText + '</a></li></ul>'); 18206 18207 // CUSTOM DIRECTION NAV: 18208 if (slider.customDirectionNav) { 18209 slider.directionNav = slider.customDirectionNav; 18210 // CONTROLSCONTAINER: 18211 } else if (slider.controlsContainer) { 18212 $(slider.controlsContainer).append(directionNavScaffold); 18213 slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer); 18214 } else { 18215 slider.append(directionNavScaffold); 18216 slider.directionNav = $('.' + namespace + 'direction-nav li a', slider); 18217 } 18218 18219 methods.directionNav.update(); 18220 18221 slider.directionNav.bind(eventType, function(event) { 18222 event.preventDefault(); 18223 var target; 18224 18225 if (watchedEvent === "" || watchedEvent === event.type) { 18226 target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev'); 18227 slider.flexAnimate(target, slider.vars.pauseOnAction); 18228 } 18229 18230 // setup flags to prevent event duplication 18231 if (watchedEvent === "") { 18232 watchedEvent = event.type; 18233 } 18234 methods.setToClearWatchedEvent(); 18235 }); 18236 }, 18237 update: function() { 18238 var disabledClass = namespace + 'disabled'; 18239 if (slider.pagingCount === 1) { 18240 slider.directionNav.addClass(disabledClass).attr('tabindex', '-1'); 18241 } else if (!slider.vars.animationLoop) { 18242 if (slider.animatingTo === 0) { 18243 slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass).attr('tabindex', '-1'); 18244 } else if (slider.animatingTo === slider.last) { 18245 slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1'); 18246 } else { 18247 slider.directionNav.removeClass(disabledClass).removeAttr('tabindex'); 18248 } 18249 } else { 18250 slider.directionNav.removeClass(disabledClass).removeAttr('tabindex'); 18251 } 18252 } 18253 }, 18254 pausePlay: { 18255 setup: function() { 18256 var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a href="#"></a></div>'); 18257 18258 // CONTROLSCONTAINER: 18259 if (slider.controlsContainer) { 18260 slider.controlsContainer.append(pausePlayScaffold); 18261 slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer); 18262 } else { 18263 slider.append(pausePlayScaffold); 18264 slider.pausePlay = $('.' + namespace + 'pauseplay a', slider); 18265 } 18266 18267 methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play'); 18268 18269 slider.pausePlay.bind(eventType, function(event) { 18270 event.preventDefault(); 18271 18272 if (watchedEvent === "" || watchedEvent === event.type) { 18273 if ($(this).hasClass(namespace + 'pause')) { 18274 slider.manualPause = true; 18275 slider.manualPlay = false; 18276 slider.pause(); 18277 } else { 18278 slider.manualPause = false; 18279 slider.manualPlay = true; 18280 slider.play(); 18281 } 18282 } 18283 18284 // setup flags to prevent event duplication 18285 if (watchedEvent === "") { 18286 watchedEvent = event.type; 18287 } 18288 methods.setToClearWatchedEvent(); 18289 }); 18290 }, 18291 update: function(state) { 18292 (state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').html(slider.vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').html(slider.vars.pauseText); 18293 } 18294 }, 18295 touch: function() { 18296 var startX, 18297 startY, 18298 offset, 18299 cwidth, 18300 dx, 18301 startT, 18302 onTouchStart, 18303 onTouchMove, 18304 onTouchEnd, 18305 scrolling = false, 18306 localX = 0, 18307 localY = 0, 18308 accDx = 0; 18309 18310 if(!msGesture){ 18311 onTouchStart = function(e) { 18312 if (slider.animating) { 18313 e.preventDefault(); 18314 } else if ( ( window.navigator.msPointerEnabled ) || e.touches.length === 1 ) { 18315 slider.pause(); 18316 // CAROUSEL: 18317 cwidth = (vertical) ? slider.h : slider. w; 18318 startT = Number(new Date()); 18319 // CAROUSEL: 18320 18321 // Local vars for X and Y points. 18322 localX = e.touches[0].pageX; 18323 localY = e.touches[0].pageY; 18324 18325 offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 : 18326 (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) : 18327 (carousel && slider.currentSlide === slider.last) ? slider.limit : 18328 (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide : 18329 (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth; 18330 startX = (vertical) ? localY : localX; 18331 startY = (vertical) ? localX : localY; 18332 el.addEventListener('touchmove', onTouchMove, false); 18333 el.addEventListener('touchend', onTouchEnd, false); 18334 } 18335 }; 18336 18337 onTouchMove = function(e) { 18338 // Local vars for X and Y points. 18339 18340 localX = e.touches[0].pageX; 18341 localY = e.touches[0].pageY; 18342 18343 dx = (vertical) ? startX - localY : (slider.vars.rtl?-1:1)*(startX - localX); 18344 scrolling = (vertical) ? (Math.abs(dx) < Math.abs(localX - startY)) : (Math.abs(dx) < Math.abs(localY - startY)); 18345 var fxms = 500; 18346 18347 if ( ! scrolling || Number( new Date() ) - startT > fxms ) { 18348 e.preventDefault(); 18349 if (!fade && slider.transitions) { 18350 if (!slider.vars.animationLoop) { 18351 dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1); 18352 } 18353 slider.setProps(offset + dx, "setTouch"); 18354 } 18355 } 18356 }; 18357 18358 onTouchEnd = function(e) { 18359 // finish the touch by undoing the touch session 18360 el.removeEventListener('touchmove', onTouchMove, false); 18361 18362 if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) { 18363 var updateDx = (reverse) ? -dx : dx, 18364 target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev'); 18365 18366 if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) { 18367 slider.flexAnimate(target, slider.vars.pauseOnAction); 18368 } else { 18369 if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); } 18370 } 18371 } 18372 el.removeEventListener('touchend', onTouchEnd, false); 18373 18374 startX = null; 18375 startY = null; 18376 dx = null; 18377 offset = null; 18378 }; 18379 18380 el.addEventListener('touchstart', onTouchStart, false); 18381 }else{ 18382 el.style.msTouchAction = "none"; 18383 el._gesture = new MSGesture(); 18384 el._gesture.target = el; 18385 el.addEventListener("MSPointerDown", onMSPointerDown, false); 18386 el._slider = slider; 18387 el.addEventListener("MSGestureChange", onMSGestureChange, false); 18388 el.addEventListener("MSGestureEnd", onMSGestureEnd, false); 18389 18390 function onMSPointerDown(e){ 18391 e.stopPropagation(); 18392 if (slider.animating) { 18393 e.preventDefault(); 18394 }else{ 18395 slider.pause(); 18396 el._gesture.addPointer(e.pointerId); 18397 accDx = 0; 18398 cwidth = (vertical) ? slider.h : slider. w; 18399 startT = Number(new Date()); 18400 // CAROUSEL: 18401 18402 offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 : 18403 (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) : 18404 (carousel && slider.currentSlide === slider.last) ? slider.limit : 18405 (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide : 18406 (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth; 18407 } 18408 } 18409 18410 function onMSGestureChange(e) { 18411 e.stopPropagation(); 18412 var slider = e.target._slider; 18413 if(!slider){ 18414 return; 18415 } 18416 var transX = -e.translationX, 18417 transY = -e.translationY; 18418 18419 //Accumulate translations. 18420 accDx = accDx + ((vertical) ? transY : transX); 18421 dx = (slider.vars.rtl?-1:1)*accDx; 18422 scrolling = (vertical) ? (Math.abs(accDx) < Math.abs(-transX)) : (Math.abs(accDx) < Math.abs(-transY)); 18423 18424 if(e.detail === e.MSGESTURE_FLAG_INERTIA){ 18425 setImmediate(function (){ 18426 el._gesture.stop(); 18427 }); 18428 18429 return; 18430 } 18431 18432 if (!scrolling || Number(new Date()) - startT > 500) { 18433 e.preventDefault(); 18434 if (!fade && slider.transitions) { 18435 if (!slider.vars.animationLoop) { 18436 dx = accDx / ((slider.currentSlide === 0 && accDx < 0 || slider.currentSlide === slider.last && accDx > 0) ? (Math.abs(accDx) / cwidth + 2) : 1); 18437 } 18438 slider.setProps(offset + dx, "setTouch"); 18439 } 18440 } 18441 } 18442 18443 function onMSGestureEnd(e) { 18444 e.stopPropagation(); 18445 var slider = e.target._slider; 18446 if(!slider){ 18447 return; 18448 } 18449 if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) { 18450 var updateDx = (reverse) ? -dx : dx, 18451 target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev'); 18452 18453 if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) { 18454 slider.flexAnimate(target, slider.vars.pauseOnAction); 18455 } else { 18456 if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); } 18457 } 18458 } 18459 18460 startX = null; 18461 startY = null; 18462 dx = null; 18463 offset = null; 18464 accDx = 0; 18465 } 18466 } 18467 }, 18468 resize: function() { 18469 if (!slider.animating && slider.is(':visible')) { 18470 if (!carousel) { slider.doMath(); } 18471 18472 if (fade) { 18473 // SMOOTH HEIGHT: 18474 methods.smoothHeight(); 18475 } else if (carousel) { //CAROUSEL: 18476 slider.slides.width(slider.computedW); 18477 slider.update(slider.pagingCount); 18478 slider.setProps(); 18479 } 18480 else if (vertical) { //VERTICAL: 18481 slider.viewport.height(slider.h); 18482 slider.setProps(slider.h, "setTotal"); 18483 } else { 18484 // SMOOTH HEIGHT: 18485 if (slider.vars.smoothHeight) { methods.smoothHeight(); } 18486 slider.newSlides.width(slider.computedW); 18487 slider.setProps(slider.computedW, "setTotal"); 18488 } 18489 } 18490 }, 18491 smoothHeight: function(dur) { 18492 if (!vertical || fade) { 18493 var $obj = (fade) ? slider : slider.viewport; 18494 (dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).innerHeight()}, dur) : $obj.innerHeight(slider.slides.eq(slider.animatingTo).innerHeight()); 18495 } 18496 }, 18497 sync: function(action) { 18498 var $obj = $(slider.vars.sync).data("flexslider"), 18499 target = slider.animatingTo; 18500 18501 switch (action) { 18502 case "animate": $obj.flexAnimate(target, slider.vars.pauseOnAction, false, true); break; 18503 case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break; 18504 case "pause": $obj.pause(); break; 18505 } 18506 }, 18507 uniqueID: function($clone) { 18508 // Append _clone to current level and children elements with id attributes 18509 $clone.filter( '[id]' ).add($clone.find( '[id]' )).each(function() { 18510 var $this = $(this); 18511 $this.attr( 'id', $this.attr( 'id' ) + '_clone' ); 18512 }); 18513 return $clone; 18514 }, 18515 pauseInvisible: { 18516 visProp: null, 18517 init: function() { 18518 var visProp = methods.pauseInvisible.getHiddenProp(); 18519 if (visProp) { 18520 var evtname = visProp.replace(/[H|h]idden/,'') + 'visibilitychange'; 18521 document.addEventListener(evtname, function() { 18522 if (methods.pauseInvisible.isHidden()) { 18523 if(slider.startTimeout) { 18524 clearTimeout(slider.startTimeout); //If clock is ticking, stop timer and prevent from starting while invisible 18525 } else { 18526 slider.pause(); //Or just pause 18527 } 18528 } 18529 else { 18530 if(slider.started) { 18531 slider.play(); //Initiated before, just play 18532 } else { 18533 if (slider.vars.initDelay > 0) { 18534 setTimeout(slider.play, slider.vars.initDelay); 18535 } else { 18536 slider.play(); //Didn't init before: simply init or wait for it 18537 } 18538 } 18539 } 18540 }); 18541 } 18542 }, 18543 isHidden: function() { 18544 var prop = methods.pauseInvisible.getHiddenProp(); 18545 if (!prop) { 18546 return false; 18547 } 18548 return document[prop]; 18549 }, 18550 getHiddenProp: function() { 18551 var prefixes = ['webkit','moz','ms','o']; 18552 // if 'hidden' is natively supported just return it 18553 if ('hidden' in document) { 18554 return 'hidden'; 18555 } 18556 // otherwise loop over all the known prefixes until we find one 18557 for ( var i = 0; i < prefixes.length; i++ ) { 18558 if ((prefixes[i] + 'Hidden') in document) { 18559 return prefixes[i] + 'Hidden'; 18560 } 18561 } 18562 // otherwise it's not supported 18563 return null; 18564 } 18565 }, 18566 setToClearWatchedEvent: function() { 18567 clearTimeout(watchedEventClearTimer); 18568 watchedEventClearTimer = setTimeout(function() { 18569 watchedEvent = ""; 18570 }, 3000); 18571 } 18572 }; 18573 18574 // public methods 18575 slider.flexAnimate = function(target, pause, override, withSync, fromNav) { 18576 if (!slider.vars.animationLoop && target !== slider.currentSlide) { 18577 slider.direction = (target > slider.currentSlide) ? "next" : "prev"; 18578 } 18579 18580 if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev"; 18581 18582 if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(":visible")) { 18583 if (asNav && withSync) { 18584 var master = $(slider.vars.asNavFor).data('flexslider'); 18585 slider.atEnd = target === 0 || target === slider.count - 1; 18586 master.flexAnimate(target, true, false, true, fromNav); 18587 slider.direction = (slider.currentItem < target) ? "next" : "prev"; 18588 master.direction = slider.direction; 18589 18590 if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) { 18591 slider.currentItem = target; 18592 slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide"); 18593 target = Math.floor(target/slider.visible); 18594 } else { 18595 slider.currentItem = target; 18596 slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide"); 18597 return false; 18598 } 18599 } 18600 18601 slider.animating = true; 18602 slider.animatingTo = target; 18603 18604 // SLIDESHOW: 18605 if (pause) { slider.pause(); } 18606 18607 // API: before() animation Callback 18608 slider.vars.before(slider); 18609 18610 // SYNC: 18611 if (slider.syncExists && !fromNav) { methods.sync("animate"); } 18612 18613 // CONTROLNAV 18614 if (slider.vars.controlNav) { methods.controlNav.active(); } 18615 18616 // !CAROUSEL: 18617 // CANDIDATE: slide active class (for add/remove slide) 18618 if (!carousel) { slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide'); } 18619 18620 // INFINITE LOOP: 18621 // CANDIDATE: atEnd 18622 slider.atEnd = target === 0 || target === slider.last; 18623 18624 // DIRECTIONNAV: 18625 if (slider.vars.directionNav) { methods.directionNav.update(); } 18626 18627 if (target === slider.last) { 18628 // API: end() of cycle Callback 18629 slider.vars.end(slider); 18630 // SLIDESHOW && !INFINITE LOOP: 18631 if (!slider.vars.animationLoop) { slider.pause(); } 18632 } 18633 18634 // SLIDE: 18635 if (!fade) { 18636 var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW, 18637 margin, slideString, calcNext; 18638 18639 // INFINITE LOOP / REVERSE: 18640 if (carousel) { 18641 margin = slider.vars.itemMargin; 18642 calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo; 18643 slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext; 18644 } else if (slider.currentSlide === 0 && target === slider.count - 1 && slider.vars.animationLoop && slider.direction !== "next") { 18645 slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0; 18646 } else if (slider.currentSlide === slider.last && target === 0 && slider.vars.animationLoop && slider.direction !== "prev") { 18647 slideString = (reverse) ? 0 : (slider.count + 1) * dimension; 18648 } else { 18649 slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension; 18650 } 18651 slider.setProps(slideString, "", slider.vars.animationSpeed); 18652 if (slider.transitions) { 18653 if (!slider.vars.animationLoop || !slider.atEnd) { 18654 slider.animating = false; 18655 slider.currentSlide = slider.animatingTo; 18656 } 18657 18658 // Unbind previous transitionEnd events and re-bind new transitionEnd event 18659 slider.container.unbind("webkitTransitionEnd transitionend"); 18660 slider.container.bind("webkitTransitionEnd transitionend", function() { 18661 clearTimeout(slider.ensureAnimationEnd); 18662 slider.wrapup(dimension); 18663 }); 18664 18665 // Insurance for the ever-so-fickle transitionEnd event 18666 clearTimeout(slider.ensureAnimationEnd); 18667 slider.ensureAnimationEnd = setTimeout(function() { 18668 slider.wrapup(dimension); 18669 }, slider.vars.animationSpeed + 100); 18670 18671 } else { 18672 slider.container.animate(slider.args, slider.vars.animationSpeed, slider.vars.easing, function(){ 18673 slider.wrapup(dimension); 18674 }); 18675 } 18676 } else { // FADE: 18677 if (!touch) { 18678 slider.slides.eq(slider.currentSlide).css({"zIndex": 1}).animate({"opacity": 0}, slider.vars.animationSpeed, slider.vars.easing); 18679 slider.slides.eq(target).css({"zIndex": 2}).animate({"opacity": 1}, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup); 18680 } else { 18681 slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 }); 18682 slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 }); 18683 slider.wrapup(dimension); 18684 } 18685 } 18686 // SMOOTH HEIGHT: 18687 if (slider.vars.smoothHeight) { methods.smoothHeight(slider.vars.animationSpeed); } 18688 } 18689 }; 18690 slider.wrapup = function(dimension) { 18691 // SLIDE: 18692 if (!fade && !carousel) { 18693 if (slider.currentSlide === 0 && slider.animatingTo === slider.last && slider.vars.animationLoop) { 18694 slider.setProps(dimension, "jumpEnd"); 18695 } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && slider.vars.animationLoop) { 18696 slider.setProps(dimension, "jumpStart"); 18697 } 18698 } 18699 slider.animating = false; 18700 slider.currentSlide = slider.animatingTo; 18701 // API: after() animation Callback 18702 slider.vars.after(slider); 18703 }; 18704 18705 // SLIDESHOW: 18706 slider.animateSlides = function() { 18707 if (!slider.animating && focused ) { slider.flexAnimate(slider.getTarget("next")); } 18708 }; 18709 // SLIDESHOW: 18710 slider.pause = function() { 18711 clearInterval(slider.animatedSlides); 18712 slider.animatedSlides = null; 18713 slider.playing = false; 18714 // PAUSEPLAY: 18715 if (slider.vars.pausePlay) { methods.pausePlay.update("play"); } 18716 // SYNC: 18717 if (slider.syncExists) { methods.sync("pause"); } 18718 }; 18719 // SLIDESHOW: 18720 slider.play = function() { 18721 if (slider.playing) { clearInterval(slider.animatedSlides); } 18722 slider.animatedSlides = slider.animatedSlides || setInterval(slider.animateSlides, slider.vars.slideshowSpeed); 18723 slider.started = slider.playing = true; 18724 // PAUSEPLAY: 18725 if (slider.vars.pausePlay) { methods.pausePlay.update("pause"); } 18726 // SYNC: 18727 if (slider.syncExists) { methods.sync("play"); } 18728 }; 18729 // STOP: 18730 slider.stop = function () { 18731 slider.pause(); 18732 slider.stopped = true; 18733 }; 18734 slider.canAdvance = function(target, fromNav) { 18735 // ASNAV: 18736 var last = (asNav) ? slider.pagingCount - 1 : slider.last; 18737 return (fromNav) ? true : 18738 (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true : 18739 (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false : 18740 (target === slider.currentSlide && !asNav) ? false : 18741 (slider.vars.animationLoop) ? true : 18742 (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false : 18743 (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false : 18744 true; 18745 }; 18746 slider.getTarget = function(dir) { 18747 slider.direction = dir; 18748 if (dir === "next") { 18749 return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1; 18750 } else { 18751 return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1; 18752 } 18753 }; 18754 18755 // SLIDE: 18756 slider.setProps = function(pos, special, dur) { 18757 var target = (function() { 18758 var posCheck = (pos) ? pos : ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo, 18759 posCalc = (function() { 18760 if (carousel) { 18761 return (special === "setTouch") ? pos : 18762 (reverse && slider.animatingTo === slider.last) ? 0 : 18763 (reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) : 18764 (slider.animatingTo === slider.last) ? slider.limit : posCheck; 18765 } else { 18766 switch (special) { 18767 case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos; 18768 case "setTouch": return (reverse) ? pos : pos; 18769 case "jumpEnd": return (reverse) ? pos : slider.count * pos; 18770 case "jumpStart": return (reverse) ? slider.count * pos : pos; 18771 default: return pos; 18772 } 18773 } 18774 }()); 18775 18776 return (posCalc * ((slider.vars.rtl)?1:-1)) + "px"; 18777 }()); 18778 18779 if (slider.transitions) { 18780 if (slider.isFirefox) { 18781 target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + (parseInt(target)+'px') + ",0,0)"; 18782 } else { 18783 target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + ((slider.vars.rtl?-1:1)*parseInt(target)+'px') + ",0,0)"; 18784 } 18785 dur = (dur !== undefined) ? (dur/1000) + "s" : "0s"; 18786 slider.container.css("-" + slider.pfx + "-transition-duration", dur); 18787 slider.container.css("transition-duration", dur); 18788 } 18789 18790 slider.args[slider.prop] = target; 18791 if (slider.transitions || dur === undefined) { slider.container.css(slider.args); } 18792 18793 slider.container.css('transform',target); 18794 }; 18795 18796 slider.setup = function(type) { 18797 // SLIDE: 18798 if (!fade) { 18799 var sliderOffset, arr; 18800 18801 if (type === "init") { 18802 slider.viewport = $('<div class="' + namespace + 'viewport"></div>').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container); 18803 // INFINITE LOOP: 18804 slider.cloneCount = 0; 18805 slider.cloneOffset = 0; 18806 // REVERSE: 18807 if (reverse) { 18808 arr = $.makeArray(slider.slides).reverse(); 18809 slider.slides = $(arr); 18810 slider.container.empty().append(slider.slides); 18811 } 18812 } 18813 // INFINITE LOOP && !CAROUSEL: 18814 if (slider.vars.animationLoop && !carousel) { 18815 slider.cloneCount = 2; 18816 slider.cloneOffset = 1; 18817 // clear out old clones 18818 if (type !== "init") { slider.container.find('.clone').remove(); } 18819 slider.container.append(methods.uniqueID(slider.slides.first().clone().addClass('clone')).attr('aria-hidden', 'true')) 18820 .prepend(methods.uniqueID(slider.slides.last().clone().addClass('clone')).attr('aria-hidden', 'true')); 18821 } 18822 slider.newSlides = $(slider.vars.selector, slider); 18823 18824 sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset; 18825 // VERTICAL: 18826 if (vertical && !carousel) { 18827 slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%"); 18828 setTimeout(function(){ 18829 slider.newSlides.css({"display": "block"}); 18830 slider.doMath(); 18831 slider.viewport.height(slider.h); 18832 slider.setProps(sliderOffset * slider.h, "init"); 18833 }, (type === "init") ? 100 : 0); 18834 } else { 18835 slider.container.width((slider.count + slider.cloneCount) * 200 + "%"); 18836 slider.setProps(sliderOffset * slider.computedW, "init"); 18837 setTimeout(function(){ 18838 slider.doMath(); 18839 if(slider.vars.rtl){ 18840 if (slider.isFirefox) { 18841 slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "right", "display": "block"}); 18842 } else { 18843 slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"}); 18844 } 18845 18846 } 18847 else{ 18848 slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"}); 18849 } 18850 // SMOOTH HEIGHT: 18851 if (slider.vars.smoothHeight) { methods.smoothHeight(); } 18852 }, (type === "init") ? 100 : 0); 18853 } 18854 } else { // FADE: 18855 if(slider.vars.rtl){ 18856 slider.slides.css({"width": "100%", "float": 'right', "marginLeft": "-100%", "position": "relative"}); 18857 } 18858 else{ 18859 slider.slides.css({"width": "100%", "float": 'left', "marginRight": "-100%", "position": "relative"}); 18860 } 18861 if (type === "init") { 18862 if (!touch) { 18863 //slider.slides.eq(slider.currentSlide).fadeIn(slider.vars.animationSpeed, slider.vars.easing); 18864 if (slider.vars.fadeFirstSlide == false) { 18865 slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).css({"opacity": 1}); 18866 } else { 18867 slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).animate({"opacity": 1},slider.vars.animationSpeed,slider.vars.easing); 18868 } 18869 } else { 18870 slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + slider.vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2}); 18871 } 18872 } 18873 // SMOOTH HEIGHT: 18874 if (slider.vars.smoothHeight) { methods.smoothHeight(); } 18875 } 18876 // !CAROUSEL: 18877 // CANDIDATE: active slide 18878 if (!carousel) { slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide"); } 18879 18880 //FlexSlider: init() Callback 18881 slider.vars.init(slider); 18882 }; 18883 18884 slider.doMath = function() { 18885 var slide = slider.slides.first(), 18886 slideMargin = slider.vars.itemMargin, 18887 minItems = slider.vars.minItems, 18888 maxItems = slider.vars.maxItems; 18889 18890 slider.w = (slider.viewport===undefined) ? slider.width() : slider.viewport.width(); 18891 if (slider.isFirefox) { slider.w = slider.width(); } 18892 slider.h = slide.height(); 18893 slider.boxPadding = slide.outerWidth() - slide.width(); 18894 18895 // CAROUSEL: 18896 if (carousel) { 18897 slider.itemT = slider.vars.itemWidth + slideMargin; 18898 slider.itemM = slideMargin; 18899 slider.minW = (minItems) ? minItems * slider.itemT : slider.w; 18900 slider.maxW = (maxItems) ? (maxItems * slider.itemT) - slideMargin : slider.w; 18901 slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * (minItems - 1)))/minItems : 18902 (slider.maxW < slider.w) ? (slider.w - (slideMargin * (maxItems - 1)))/maxItems : 18903 (slider.vars.itemWidth > slider.w) ? slider.w : slider.vars.itemWidth; 18904 18905 slider.visible = Math.floor(slider.w/(slider.itemW)); 18906 slider.move = (slider.vars.move > 0 && slider.vars.move < slider.visible ) ? slider.vars.move : slider.visible; 18907 slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1); 18908 slider.last = slider.pagingCount - 1; 18909 slider.limit = (slider.pagingCount === 1) ? 0 : 18910 (slider.vars.itemWidth > slider.w) ? (slider.itemW * (slider.count - 1)) + (slideMargin * (slider.count - 1)) : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin; 18911 } else { 18912 slider.itemW = slider.w; 18913 slider.itemM = slideMargin; 18914 slider.pagingCount = slider.count; 18915 slider.last = slider.count - 1; 18916 } 18917 slider.computedW = slider.itemW - slider.boxPadding; 18918 slider.computedM = slider.itemM; 18919 }; 18920 18921 slider.update = function(pos, action) { 18922 slider.doMath(); 18923 18924 // update currentSlide and slider.animatingTo if necessary 18925 if (!carousel) { 18926 if (pos < slider.currentSlide) { 18927 slider.currentSlide += 1; 18928 } else if (pos <= slider.currentSlide && pos !== 0) { 18929 slider.currentSlide -= 1; 18930 } 18931 slider.animatingTo = slider.currentSlide; 18932 } 18933 18934 // update controlNav 18935 if (slider.vars.controlNav && !slider.manualControls) { 18936 if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) { 18937 methods.controlNav.update("add"); 18938 } else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) { 18939 if (carousel && slider.currentSlide > slider.last) { 18940 slider.currentSlide -= 1; 18941 slider.animatingTo -= 1; 18942 } 18943 methods.controlNav.update("remove", slider.last); 18944 } 18945 } 18946 // update directionNav 18947 if (slider.vars.directionNav) { methods.directionNav.update(); } 18948 18949 }; 18950 18951 slider.addSlide = function(obj, pos) { 18952 var $obj = $(obj); 18953 18954 slider.count += 1; 18955 slider.last = slider.count - 1; 18956 18957 // append new slide 18958 if (vertical && reverse) { 18959 (pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj); 18960 } else { 18961 (pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj); 18962 } 18963 18964 // update currentSlide, animatingTo, controlNav, and directionNav 18965 slider.update(pos, "add"); 18966 18967 // update slider.slides 18968 slider.slides = $(slider.vars.selector + ':not(.clone)', slider); 18969 // re-setup the slider to accomdate new slide 18970 slider.setup(); 18971 18972 //FlexSlider: added() Callback 18973 slider.vars.added(slider); 18974 }; 18975 slider.removeSlide = function(obj) { 18976 var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj; 18977 18978 // update count 18979 slider.count -= 1; 18980 slider.last = slider.count - 1; 18981 18982 // remove slide 18983 if (isNaN(obj)) { 18984 $(obj, slider.slides).remove(); 18985 } else { 18986 (vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove(); 18987 } 18988 18989 // update currentSlide, animatingTo, controlNav, and directionNav 18990 slider.doMath(); 18991 slider.update(pos, "remove"); 18992 18993 // update slider.slides 18994 slider.slides = $(slider.vars.selector + ':not(.clone)', slider); 18995 // re-setup the slider to accomdate new slide 18996 slider.setup(); 18997 18998 // FlexSlider: removed() Callback 18999 slider.vars.removed(slider); 19000 }; 19001 19002 //FlexSlider: Initialize 19003 methods.init(); 19004 }; 19005 19006 // Ensure the slider isn't focussed if the window loses focus. 19007 $( window ).blur( function ( e ) { 19008 focused = false; 19009 }).focus( function ( e ) { 19010 focused = true; 19011 }); 19012 19013 //FlexSlider: Default Settings 19014 $.flexslider.defaults = { 19015 namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin 19016 selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril 19017 animation: "fade", //String: Select your animation type, "fade" or "slide" 19018 easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported! 19019 direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical" 19020 reverse: false, //{NEW} Boolean: Reverse the animation direction 19021 animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end 19022 smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode 19023 startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide) 19024 slideshow: true, //Boolean: Animate slider automatically 19025 slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds 19026 animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds 19027 initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds 19028 randomize: false, //Boolean: Randomize slide order 19029 fadeFirstSlide: true, //Boolean: Fade in the first slide when animation type is "fade" 19030 thumbCaptions: false, //Boolean: Whether or not to put captions on thumbnails when using the "thumbnails" controlNav. 19031 19032 // Usability features 19033 pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended. 19034 pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering 19035 pauseInvisible: true, //{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage. 19036 useCSS: true, //{NEW} Boolean: Slider will use CSS3 transitions if available 19037 touch: true, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices 19038 video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches 19039 19040 // Primary Controls 19041 controlNav: true, //Boolean: Create navigation for paging control of each slide? Note: Leave true for manualControls usage 19042 directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false) 19043 prevText: "Previous", //String: Set the text for the "previous" directionNav item 19044 nextText: "Next", //String: Set the text for the "next" directionNav item 19045 19046 // Secondary Navigation 19047 keyboard: true, //Boolean: Allow slider navigating via keyboard left/right keys 19048 multipleKeyboard: false, //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present. 19049 mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel 19050 pausePlay: false, //Boolean: Create pause/play dynamic element 19051 pauseText: "Pause", //String: Set the text for the "pause" pausePlay item 19052 playText: "Play", //String: Set the text for the "play" pausePlay item 19053 19054 // Special properties 19055 controlsContainer: "", //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(".flexslider-container"). Property is ignored if given element is not found. 19056 manualControls: "", //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs. 19057 customDirectionNav: "", //{NEW} jQuery Object/Selector: Custom prev / next button. Must be two jQuery elements. In order to make the events work they have to have the classes "prev" and "next" (plus namespace) 19058 sync: "", //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care. 19059 asNavFor: "", //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider 19060 19061 // Carousel Options 19062 itemWidth: 0, //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding. 19063 itemMargin: 0, //{NEW} Integer: Margin between carousel items. 19064 minItems: 1, //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this. 19065 maxItems: 0, //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit. 19066 move: 0, //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items. 19067 allowOneSlide: true, //{NEW} Boolean: Whether or not to allow a slider comprised of a single slide 19068 19069 // Browser Specific 19070 isFirefox: false, // {NEW} Boolean: Set to true when Firefox is the browser used. 19071 19072 // Callback API 19073 start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide 19074 before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation 19075 after: function(){}, //Callback: function(slider) - Fires after each slider animation completes 19076 end: function(){}, //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous) 19077 added: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is added 19078 removed: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is removed 19079 init: function() {}, //{NEW} Callback: function(slider) - Fires after the slider is initially setup 19080 rtl: false //{NEW} Boolean: Whether or not to enable RTL mode 19081 }; 19082 19083 //FlexSlider: Plugin Function 19084 $.fn.flexslider = function(options) { 19085 if (options === undefined) { options = {}; } 19086 19087 if (typeof options === "object") { 19088 return this.each(function() { 19089 var $this = $(this), 19090 selector = (options.selector) ? options.selector : ".slides > li", 19091 $slides = $this.find(selector); 19092 19093 if ( ( $slides.length === 1 && options.allowOneSlide === false ) || $slides.length === 0 ) { 19094 $slides.fadeIn(400); 19095 if (options.start) { options.start($this); } 19096 } else if ($this.data('flexslider') === undefined) { 19097 new $.flexslider(this, options); 19098 } 19099 }); 19100 } else { 19101 // Helper strings to quickly perform functions on the slider 19102 var $slider = $(this).data('flexslider'); 19103 switch (options) { 19104 case "play": $slider.play(); break; 19105 case "pause": $slider.pause(); break; 19106 case "stop": $slider.stop(); break; 19107 case "next": $slider.flexAnimate($slider.getTarget("next"), true); break; 19108 case "prev": 19109 case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break; 19110 default: if (typeof options === "number") { $slider.flexAnimate(options, true); } 19111 } 19112 } 19113 }; 19114})(jQuery);
19115 19116define("flexslider", ["jquery"], function(){}); 19117 19118define('modules/projectSlider',[ 19119 'jquery', 19120 'lodash', 19121 'eventEmitter/EventEmitter', 19122 'bxslider', 19123 'flexslider', 19124 'core/masonry', 19125 'core/layout' 19126], function ($, _, EventEmitter) { 19127 19128 function ProjectSlider() {} 19129 19130 ProjectSlider.prototype = _.clone(EventEmitter.prototype); 19131 19132 var proto = ProjectSlider.prototype; 19133 19134 var slider; 19135 var sliderSelector; 19136 var videos; 19137 19138 function _init(_sliderSelector) { 19139 sliderSelector = _sliderSelector || '.p__slider'; 19140 19141 var $parent = $(sliderSelector), 19142 $slider = $parent.find('.slides'); 19143 19144 if (!$slider.length) return; 19145 19146 slider = $slider.bxSlider({ 19147 slideSelector: '.slide', 19148 infiniteLoop: false, 19149 //preventDefaultSwipeY: true, 19150 preventDefaultSwipeX: true, 19151 oneToOneTouch: false, 19152 pagerSelector: '.pagination', 19153 buildPager: function (slideIndex) { 19154 return '&#'+ (65 + slideIndex) +';'; 19155 }, 19156 onSliderLoad: function () { 19157 if ($slider.getSlideCount() <= 1) { 19158 $slider.destroySlider(); 19159 $parent.find(this.pagerSelector).remove(); 19160 } 19161 19162 videos = $slider.find('iframe'); 19163 19164 }, 19165 onSlideAfter: function(){ 19166 _stopAllVideos(videos); 19167 } 19168 }); 19169 19170 proto.slider = slider; 19171 } 19172 19173 function _run() { 19174 sliderSelector = '.news__slider'; 19175 var $parent = $(sliderSelector), 19176 $slider = $parent.find('.slides'); 19177 19178 slider = $parent.flexslider({ 19179 animation: "slide", 19180 smoothHeight: true 19181 }); 19182 19183 proto.slider = slider; 19184 } 19185 19186 function _stopAllVideos(videoCollection){ 19187 if(!videoCollection) return; 19188 videoCollection.each(function(key,val){ 19189 _vimeoMakeActrion('pause', $(val).attr('src').split('?')[0], $(val)); 19190 }); 19191 } 19192 19193 function _vimeoMakeActrion(action, url, element){ 19194 19195 if (url.substring(0, 5) != "http:"){ 19196 url = "http:" + url; 19197 } 19198 19199 var data = { method: action }; 19200 element[0].contentWindow.postMessage(JSON.stringify(data), url); 19201 19202 } 19203 19204 function _update() { 19205 slider.destroySlider(); 19206 $(slider).find('.pagination').empty(); 19207 19208 _.delay(function () { 19209 _init(sliderSelector); 19210 }, 1000); 19211 } 19212 19213 proto.init = _init; 19214 proto.run = _run; 19215 proto.update = _update; 19216 19217 return ProjectSlider; 19218}); 19219/** 19220 * Created by lrejmer on 2014-04-15. 19221 */ 19222 19223define('modules/newsList',[ 19224 'jquery', 19225 'lodash', 19226 'eventEmitter/EventEmitter', 19227 'core/layout', 19228 'core/masonry' 19229], function ($, _, EventEmitter, Layout) { 19230 19231 function NewsList() { 19232 } 19233 19234 NewsList.prototype = _.clone(EventEmitter.prototype); 19235 19236 var proto = NewsList.prototype; 19237 19238 var layout = new Layout(); 19239 19240 var $window, 19241 $el, 19242 $project, 19243 $newsProject, 19244 $items, 19245 $projects, 19246 $newsProjects, 19247 $socialItems, 19248 $instagram, 19249 $claim; 19250 19251 function _init() { 19252 _showProjectItems(); 19253 _setHeaderProjectMobile(); 19254 $el = $('#list--news'); 19255 19256 if (!$el.length) return; 19257 19258 $items = $el.find('.item'); 19259 19260 $socialItems = $items.filter('.facebook, .twitter'); 19261 $instagram = $items.filter('.instagram'); 19262 $claim = $items.filter('.claim'); 19263 19264 _setSocialItemsData(); 19265 _prepareItems(); 19266 _setHeaderNewsProjectMobile(); 19267 _resize(); 19268 19269 proto.emitEvent('afterInit'); 19270 } 19271 19272 function _setHeaderProjectMobile(){ 19273 $project = $('#list--projects'); 19274 19275 if(!$project.length) return; 19276 19277 $projects = $project.find('.item'); 19278 19279 if (layout.mobile) { 19280 19281 $projects.each(function(){ 19282 var visualProject = $(this).find('.i__visual'); 19283 $(this).append(visualProject); 19284 }); 19285 } 19286 } 19287 19288 function _setHeaderNewsProjectMobile(){ 19289 $newsProject = $('.news--projet'); 19290 19291 if(!$newsProject.length) return; 19292 19293 $newsProjects = $newsProject.find('.news'); 19294 19295 if (layout.mobile) { 19296 19297 $newsProjects.each(function(){ 19298 var visualProject = $(this).find('.i__visual'); 19299 $(this).append(visualProject); 19300 }); 19301 } 19302 } 19303 19304 function _movePositionItemsProject() { 19305 19306 $leftList = $('#list--projects1'); 19307 $rightList = $('#list--projects2'); 19308 19309 $leftList.each(function(index){ 19310 $this = $(this); 19311 19312 //console.log('item | ' + $this + 'indexItem |' + index); 19313 19314 }); 19315 19316 } 19317 19318 function _showProjectItems(){ 19319 if(layout.mobile){ 19320 19321 var projectsLeft = $('#list--projects1').find('.project'); 19322 var projectsRight = $('#list--projects2').find('.project'); 19323 19324 $(window).scroll(function() { 19325 if($(window).scrollTop() + $(window).height() >
19325 $(document).height() - 200) { 19326 _checkVisibleProject(); 19327 } 19328 }); 19329 19330 function _checkVisibleProject(){ 19331 19332 projectsLeft.filter(':visible:last') 19333 .nextAll(':lt(3)').addClass('project-visible'); 19334 19335 projectsRight.filter(':visible:last') 19336 .nextAll(':lt(3)').addClass('project-visible'); 19337 } 19338 } 19339 } 19340 19341 function _setSocialItemsData() { 19342 $socialItems.each(function () { 19343 var $this = $(this); 19344 19345 $this.data('position', $items.index($this)); 19346 }); 19347 } 19348 19349 function _prepareItems() { 19350 19351 $items = $el.find('.item'); 19352 $items.each(function(index, item) { 19353 19354 var $item = $(item); 19355 $item.attr('data-item-index', $item.index()); 19356 19357 }); 19358 19359 $socialItems = $items.filter('.facebook, .twitter'); 19360 $instagram = $items.filter('.instagram'); 19361 $claim = $items.filter('.claim'); 19362 19363 if (layout.mobile) { 19364 19365 var $body = $('body'); 19366 if($body.hasClass('news-inited')) return; 19367 19368 $('body').addClass('mobile news-inited'); 19369 19370 $sliderWrap = $('.news__slider'); 19371 $sliderCont = $('.news__slider .slides'); 19372 $socialItems.addClass('slide').removeClass('item'); 19373 19374 $sliderCont.prepend($socialItems); 19375 19376 $sliderWrap.before($claim); 19377 $claim.removeClass('item news').css('position', 'absolute'); 19378 19379 var projectNewsWrapper = '<div class="news--projet"><div id="list--projects1" class="mobile-list"></div><div id="list--projects2" class="mobile-list"></div></div>'; 19380 var instagramWrapper = '<div class="instagram-wrapper"></div>'; 19381 $sliderWrap.after(instagramWrapper); 19382 $sliderWrap.after(projectNewsWrapper); 19383 $projectNewsWrapper = $('.news--projet'); 19384 $instagramWrapper = $('.instagram-wrapper'); 19385 $projectNewsLeft = $projectNewsWrapper.find('#list--projects1'); 19386 $projectNewsRight = $projectNewsWrapper.find('#list--projects2'); 19387 $instagram.removeClass('facebook'); 19388 $instagramWrapper.append($instagram); 19389 19390 $('#list--news > .news').each(function(index){ 19391 $this = $(this); 19392 $this.removeClass('item'); 19393 // if(index%2 === 0){ 19394 $projectNewsLeft.append($this); 19395 //} else { 19396 // $projectNewsRight.append($this); 19397 //} 19398 }); 19399 19400 } 19401 else { 19402 19403 $('body').removeClass('mobile news-inited'); 19404 $socialItems.each(function () { 19405 var $this = $(this); 19406 $items.eq($this.data('position')).before($this); 19407 }); 19408 $claim.addClass('item'); 19409 } 19410 19411 $socialItems.each(function () { 19412 var $this = $(this), 19413 $height = $this.height(), 19414 $visual = $this.find('.i__visual'); 19415 19416 if (layout.mobile || $this.hasClass('vl')) { 19417 $this.prepend($visual); 19418 } 19419 else { 19420 $this.append($visual); 19421 } 19422 }); 19423 } 19424 19425 19426 function _reload() { 19427 _prepareItems(); 19428 } 19429 19430 19431 function _resize() { 19432 19433 $window = $(window); 19434 var widthWindow = $window.width(); 19435 19436 $window.resize(function(){ 19437 19438 var widthWindow2 = $window.width(); 19439 19440 if(widthWindow != widthWindow2){ 19441 $('#loader').show(); 19442 history.go(0); 19443 //_prepareItems(); 19444 } 19445 }); 19446 } 19447 19448 proto.on('afterInit', function () { 19449 19450 }); 19451 19452 proto.init = _init; 19453 proto.reload = _reload; 19454 19455 return NewsList; 19456}); 19457 19458/** 19459 * Created by lrejmer on 2014-04-07. 19460 */ 19461 19462define('modules/department',[ 19463 'jquery', 19464 'lodash', 19465 'eventEmitter/EventEmitter', 19466 'core/layout' 19467], function ($, _, EventEmitter, Layout) { 19468 19469 var _depName; 19470 19471 function Department(depName) { 19472 _depName = depName; 19473 } 19474 19475 Department.prototype = _.clone(EventEmitter.prototype); 19476 19477 var proto = Department.prototype; 19478 19479 var layout = new Layout(); 19480 19481 var $departments, 19482 $dep; 19483 19484 function _init() { 19485 $departments = $('.c--departments, .p__dep'); 19486 } 19487 19488 function _toggle(depSelector) { 19489 _init(); 19490 19491 depSelector = depSelector || '.dep--' + _depName; 19492 $dep = $departments.find(depSelector); 19493 if (!$dep.length) return; 19494 19495 var $details = $dep.find('.dep__details'), 19496 $wrapper = $details.find('.dep__details__wrapper'), 19497 $toggle = $dep.find('.dep__details__toggle'); 19498 19499 var _depHeight = parseInt($dep.height(), 10), 19500 _detailsHeight = 0; 19501 19502 if(layout.mobile){ 19503 19504 _detailsHeight = 0; 19505 $details.find('.dep__detail').each(function (i) { 19506 _detailsHeight += $(this).outerHeight(true); 19507 19508 }); 19509 _detailsHeight = _detailsHeight + 100; 19510 19511 } else{ 19512 19513 $details.find('.dep__detail').each(function () { 19514 _detailsHeight = Math.max(_detailsHeight, parseInt($(this).outerHeight(true), 10)); 19515 }); 19516 } 19517 19518 var _open = false;
19519 19520 $toggle.off('click').on({ 19521 'click': function (e) { 19522 var scrollPosition = $(window).scrollTop(); 19523 //console.log(scrollPosition); 19524 if (_open) { 19525 _open = false; 19526 19527 $dep 19528 .removeClass('open') 19529 .height(_depHeight); 19530 19531 $wrapper.height(0); 19532 19533 proto.emitEvent('toggle'); 19534 $(window).scrollTop(scrollPosition); 19535 e.preventDefault(); 19536 } 19537 else { 19538 _open = true; 19539 19540 $wrapper.height(_detailsHeight); 19541 19542 $dep 19543 .addClass('open') 19544 .height(_depHeight + _detailsHeight); 19545 19546 proto.emitEvent('toggle'); 19547 $(window).scrollTop(scrollPosition); 19548 e.preventDefault(); 19549 } 19550 } 19551 }); 19552 } 19553 19554 function _preperDep() { 19555 } 19556 19557 proto.on('toggle', _.noop); 19558 19559 proto.init = _init; 19560 proto.toggle = _toggle; 19561 19562 return Department; 19563}); 19564 19565define('modules/showMore',[ 19566 'jquery', 19567 'lodash', 19568 'eventEmitter/EventEmitter' 19569], function ($, _, EventEmitter) { 19570 19571 function ShowMore() {} 19572 19573 ShowMore.prototype = _.clone(EventEmitter.prototype); 19574 19575 var proto = ShowMore.prototype; 19576 19577 function _init() { 19578 $(document).off('click.showMore', '#showMore').on('click.showMore', '#showMore', function (e) { 19579 e.preventDefault(); 19580 e.stopPropagation(); 19581 19582 var scrollPosition = $(window).scrollTop(); 19583 19584 $('.c--project-details-crucial').addClass('c--project-details-crucial--show'); 19585 $(this).closest('.p__header.item').hide(); 19586 proto.emitEvent('show', [scrollPosition]); 19587 19588 $(window).scrollTop(scrollPosition); 19589 }); 19590 } 19591 19592 proto.on('show', _.noop); 19593 proto.init = _init; 19594 19595 return ShowMore; 19596}); 19597/** 19598 * Created by lrejmer on 2014-04-07. 19599 */ 19600 19601define('modules/instagramSlider',[ 19602 'jquery', 19603 'lodash', 19604 'eventEmitter/EventEmitter', 19605 'bxslider' 19606], function ($, _, EventEmitter) { 19607 19608 function InstagramSlider() {} 19609 19610 InstagramSlider.prototype = _.clone(EventEmitter.prototype); 19611 19612 var proto = InstagramSlider.prototype; 19613 19614 var slider, nextText, beforeText; 19615 19616 function _init(sliderSelector, cb) { 19617 sliderSelector = sliderSelector || '.i__slider'; 19618 var _this = this; 19619 var $slider = $(sliderSelector).find('.slides'); 19620 19621 if (!$slider.length) return; 19622 19623 if(!$('.content').hasClass('lang-en')){ 19624 19625 nextText = 'następne'; 19626 beforeText = 'poprzednie'; 19627 19628 } else { 19629 19630 nextText = 'next'; 19631 beforeText = 'before'; 19632 } 19633 19634 $.get("https://instagram.180app.com/", function( data ) { 19635 19636 data.map(function (elem) { 19637 19638 var $slide = $('<li class="slide"><div class="visual" style="width: 100%; height: 0; padding-top: 100%; background: url(' + elem + ') no-repeat center center; background-size: contain;"></div></li>'); 19639 var img = new Image(); 19640 19641 img.onerror = function () { 19642 19643 $slide.remove(); 19644 if (slider) { 19645 slider.reloadSlider(); 19646 } 19647 }; 19648 19649 $slider.append($slide); 19650 img.src = elem; 19651 19652 }); 19653 19654 slider = $slider.bxSlider({ 19655 slideSelector: '.slide', 19656 infiniteLoop: false, 19657 hideControlOnEnd: true, 19658 pager: false, 19659 controls: true, 19660 prevText: beforeText, 19661 nextText: nextText 19662 }); 19663 19664 _this.slider = slider; 19665 19666 if (typeof cb === 'function') { 19667 cb(); 19668 } 19669 19670 }); 19671 19672 } 19673 19674 proto.init = _init; 19675 19676 return InstagramSlider; 19677}); 19678/* 19679 The MIT License (MIT) 19680 19681 Copyright (c) 2014 Dirk Groenen 19682 19683 Permission is hereby granted, free of charge, to any person obtaining a copy of 19684 this software and associated documentation files (the "Software"), to deal in 19685 the Software without restriction, including without limitation the rights to 19686 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 19687 the Software, and to permit persons to whom the Software is furnished to do so, 19688 subject to the following conditions: 19689 19690 The above copyright notice and this permission notice shall be included in all 19691 copies or substantial portions of the Software. 19692 */ 19693 19694(function($){ 19695 $.fn.viewportChecker = function(useroptions){ 19696 // Define options and extend with user 19697 var options = { 19698 classToAdd: 'visible', 19699 classToRemove : 'invisible', 19700 classToAddForFullView : 'full-visible', 19701 removeClassAfterAnimation: false, 19702 offset: 100, 19703 repeat: false, 19704 invertBottomOffset: true, 19705 callbackFunction: function(elem, action){}, 19706 scrollHorizontal: false, 19707 scrollBox: window 19708 }; 19709 $.extend(options, useroptions); 19710 19711 // Cache the given element and height of the browser 19712 var $elem = this, 19713 boxSize = {height: $(options.scrollBox).height(), width: $(options.scrollBox).width()}; 19714 19715 /* 19716 * Main method that checks the elements and adds or removes the class(es) 19717 */ 19718 this.checkElements = function(){ 19719 var viewportStart, viewportEnd; 19720 19721 // Set some vars to check with 19722 if (!options.scrollHorizontal){ 19723 viewportStart = Math.max( 19724 $('html').scrollTop(), 19725 $('body').scrollTop(), 19726 $(window).scrollTop() 19727 ); 19728 viewportEnd = (viewportStart + boxSize.height); 19729 } 19730 else{ 19731 viewportStart = Math.max( 19732 $('html').scrollLeft(), 19733 $('body').scrollLeft(), 19734 $(window).scrollLeft() 19735 ); 19736 viewportEnd = (viewportStart + boxSize.width); 19737 } 19738 19739 // Loop through all given dom elements 19740 $elem.each(function(){ 19741 var $obj = $(this), 19742 objOptions = {}, 19743 attrOptions = {}; 19744 19745 // Get any individual attribution data 19746 if ($obj.data('vp-add-class')) 19747 attrOptions.classToAdd = $obj.data('vp-add-class'); 19748 if ($obj.data('vp-remove-class')) 19749 attrOptions.classToRemove = $obj.data('vp-remove-class'); 19750 if ($obj.data('vp-add-class-full-view')) 19751 attrOptions.classToAddForFullView = $obj.data('vp-add-class-full-view'); 19752 if ($obj.data('vp-keep-add-class')) 19753 attrOptions.removeClassAfterAnimation = $obj.data('vp-remove-after-animation'); 19754 if ($obj.data('vp-offset')) 19755 attrOptions.offset = $obj.data('vp-offset'); 19756 if ($obj.data('vp-repeat')) 19757 attrOptions.repeat = $obj.data('vp-repeat'); 19758 if ($obj.data('vp-scrollHorizontal')) 19759 attrOptions.scrollHorizontal = $obj.data('vp-scrollHorizontal'); 19760 if ($obj.data('vp-invertBottomOffset')) 19761 attrOptions.scrollHorizontal = $obj.data('vp-invertBottomOffset'); 19762 19763 // Extend objOptions with data attributes and default options 19764 $.extend(objOptions, options); 19765 $.extend(objOptions, attrOptions); 19766 19767 // If class already exists; quit 19768 if ($obj.data('vp-animated') && !objOptions.repeat){ 19769 return; 19770 } 19771 19772 // Check if the offset is percentage based 19773 if (String(objOptions.offset).indexOf("%") > 0) 19774 objOptions.offset = (parseInt(objOptions.offset) / 100) * boxSize.height; 19775 19776 // Get the raw start and end positions 19777 var rawStart = (!objOptions.scrollHorizontal) ? $obj.offset().top : $obj.offset().left, 19778 rawEnd = (!objOptions.scrollHorizontal) ? rawStart + $obj.height() : rawStart + $obj.width(); 19779 19780 // Add the defined offset 19781 var elemStart = Math.round( rawStart ) + objOptions.offset, 19782 elemEnd = (!objOptions.scrollHorizontal) ? elemStart + $obj.height() : elemStart + $obj.width(); 19783 19784 if (objOptions.invertBottomOffset) 19785 elemEnd -= (objOptions.offset * 2); 19786 19787 // Add class if in viewport 19788 if ((elemStart < viewportEnd) && (elemEnd > viewportStart)){ 19789 19790 // Remove class 19791 $obj.removeClass(objOptions.classToRemove); 19792 $obj.addClass(objOptions.classToAdd); 19793 19794 // Do the callback function. Callback wil send the jQuery object as parameter 19795 objOptions.callbackFunction($obj, "add"); 19796 19797 // Check if full element is in view 19798 if (rawEnd <= viewportEnd && rawStart >= viewportStart) 19799 $obj.addClass(objOptions.classToAddForFullView); 19800 else 19801 $obj.removeClass(objOptions.classToAddForFullView); 19802 19803 // Set element as already animated 19804 $obj.data('vp-animated', true); 19805 19806 if (objOptions.removeClassAfterAnimation) { 19807 $obj.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){ 19808 $obj.removeClass(objOptions.classToAdd); 19809 }); 19810 } 19811 19812 // Remove class if not in viewport and repeat is true 19813 } else if ($obj.hasClass(objOptions.classToAdd) && (objOptions.repeat)){ 19814 $obj.removeClass(objOptions.classToAdd + " " + objOptions.classToAddForFullView); 19815 19816 // Do the callback function. 19817 objOptions.callbackFunction($obj, "remove"); 19818 19819 // Remove already-animated-flag 19820 $obj.data('vp-animated', false); 19821 } 19822 }); 19823 }; 19824 19825 /** 19826 * Binding the correct event listener is still a tricky thing. 19827 * People have expierenced sloppy scrolling when both scroll and touch 19828 * events are added, but to make sure devices with both scroll and touch 19829 * are handles too we always have to add the window.scroll event 19830 *
19831 * @see https://github.com/dirkgroenen/jQuery-viewport-checker/issues/25 19832 * @see https://github.com/dirkgroenen/jQuery-viewport-checker/issues/27 19833 */ 19834 19835 // Select the correct events 19836 if( 'ontouchstart' in window || 'onmsgesturechange' in window ){ 19837 // Device with touchscreen 19838 $(document).bind("touchmove MSPointerMove pointermove", this.checkElements); 19839 } 19840 19841 // Always load on window load 19842 $(options.scrollBox).bind("load scroll", this.checkElements); 19843 19844 // On resize change the height var 19845 $(window).resize(function(e){ 19846 boxSize = {height: $(options.scrollBox).height(), width: $(options.scrollBox).width()}; 19847 $elem.checkElements(); 19848 }); 19849 19850 // trigger inital check if elements already visible 19851 this.checkElements(); 19852 19853 // Default jquery plugin behaviour 19854 return this; 19855 }; 19856})(jQuery); 19857 19858define("viewport", ["jquery"], function(){}); 19859 19860define('modules/itemLoad',[ 19861 'jquery', 19862 'lodash', 19863 'viewport', 19864 'core/layout' 19865], function ($, Layout) { 19866 19867 function ItemLoad() {} 19868 19869 19870 var proto = ItemLoad.prototype; 19871 19872 $.fn.visible = function(partial) { 19873 19874 var $t = $(this), 19875 $w = $(window), 19876 viewTop = $w.scrollTop(),
19877 viewBottom = viewTop + $w.height(), 19878 _top = $t.offset().top -100, 19879 _bottom = _top + $t.height(), 19880 compareTop = partial === true ? _bottom : _top, 19881 compareBottom = partial === true ? _top : _bottom; 19882 19883 return ((compareBottom <= viewBottom) && (compareTop >= viewTop)); 19884 } 19885 19886 function _run() { 19887 var layout = new Layout(); 19888 19889 var allMods = $('.item'); 19890 19891 var delay = 10; 19892 19893 allMods.each(function(index, el) { 19894 var el = $(el); 19895 19896 if (el.visible(true)) { 19897 19898 newDelay = (delay * index)/60; 19899 19900 el.css({ 19901 'opacity': 0, 19902 '-webkit-animation': 'showHalItem .5s ' + newDelay + 's 1 ease both', 19903 '-moz-animation': 'showHalItem .5s ' + newDelay + 's 1 ease both', 19904 '-ms-animation': 'showHalItem .5s ' + newDelay + 's 1 ease both', 19905 '-o-animation': 'showHalItem .5s ' + newDelay + 's 1 ease both', 19906 'animation': 'showHalItem .5s ' + newDelay + 's 1 ease both' 19907 19908 }); 19909 } 19910 }); 19911 } 19912 19913 proto.run = _run; 19914 19915 return ItemLoad; 19916}); 19917define('modules/trigerVideo',[ 19918 'jquery', 19919 'lodash' 19920], function ($, _) { 19921 19922 function Video() {} 19923 19924 var imageContainer, 19925 videoHTML; 19926 19927 var proto = Video.prototype; 19928 19929 function _init() { 19930 19931 _bind(); 19932 } 19933 19934 function _getContainer(_target) { 19935 imageContainer = _target; 19936 return imageContainer; 19937 } 19938 19939 function _prepareVideoContainer(_target) { 19940 $target = _target; 19941 $videoContent = $target.find('.hidden_video'); 19942 $videoHTML = $videoContent.html(); 19943 return $videoHTML; 19944 } 19945 19946 function _clear(){ 19947 $this.removeClass('video'); 19948 $this.find('.a__play').remove(); 19949 } 19950 19951 function _playVideo(){ 19952 19953 _vimeoMakeActrion('play', $('.a--visual').find('iframe').attr('src').split('?')[0], $('.a--visual').find('iframe')); 19954 19955 } 19956 19957 function _vimeoMakeActrion(action, url, element){ 19958 19959 if (url.substring(0, 5) != "http:"){ 19960 url = "http:" + url; 19961 } 19962 19963 var data = { method: action }; 19964 element[0].contentWindow.postMessage(JSON.stringify(data), url); 19965 19966 } 19967 19968 19969 function _bind() { 19970 $(document).on({ 19971 'click': function(e){ 19972 $this = $(this); 19973 19974 e.preventDefault(); 19975 19976 _getContainer($this); 19977 _prepareVideoContainer($this); 19978 $this.find('> img').remove(); 19979 $this.find('.c__ornament').remove(); 19980 $this.find('.hidden_video').removeClass('hidden_video'); 19981 19982 try{ 19983 ga('send', 'event', 'reel', 'play-clicked'); 19984 19985 } catch(error) { 19986 console.log('GA send event error: ', error); 19987 } 19988 19989 _clear(); 19990 19991 clearInterval(videoTimeout); 19992 19993 var videoTimeout = setTimeout(function(){ 19994 19995 _playVideo(); 19996 19997 }, 500); 19998 } 19999 }, '.video'); 20000 } 20001 20002 proto.init = _init; 20003 20004 return Video; 20005}); 20006define('modules/imagesPreloader',[ 20007 'jquery' 20008], function ($) { 20009 20010 function ImagePreloader(imgArray, imagesCollection) { 20011 //alert('l ' + imgArray.length) 20012 this._images = []; 20013 this._preLoaded = 0; 20014 this._preLoadedImages = []; 20015 20016 this.imagesCollection = imagesCollection; 20017 20018 this._init(imgArray); 20019 }; 20020 20021 ImagePreloader.prototype.preLoadImages = function() { 20022 var i = 0; 20023 for (; i < this._images.length; i++) { 20024 20025 this._preLoadImage(this._images[i]); 20026 20027 } 20028 } 20029 20030 ImagePreloader.prototype._init = function(imgArray) { 20031 20032 if(imgArray.length === 0) { 20033 20034 $("#loader").fadeOut(500, function() { 20035 $(this).hide(); 20036 }); 20037 20038 $(document).trigger('imagesLoaded', [true]); 20039 } 20040 20041 if (imgArray != null) { 20042 this._images = imgArray; 20043 20044 } 20045 this._preLoaded = 0; 20046 }; 20047 20048 ImagePreloader.prototype._preLoadImage = function(src) { 20049 var image = new Image(); 20050 var thePreloader = this; 20051 var self = this; 20052 var index = this._images.indexOf(src); 20053 20054 image.onload = function() { 20055 thePreloader._preLoaded += 1; 20056 20057 if(thePreloader._preLoaded == thePreloader._images.length) { 20058 thePreloader._onPreloadCompleted(); 20059 } 20060 }; 20061 20062 /* 20063 * Provide image loaded error 20064 * */ 20065 20066 image.onerror = function() { 20067 20068 thePreloader._preLoaded += 1; 20069 20070 $(thePreloader.imagesCollection[index]) 20071 .css('display','none') 20072 .after('<div class="image--error">' + 20073 '<?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <svg version="1.1" id="Warstwa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 322.4 128.2" style="enable-background:new 0 0 322.4 128.2;" xml:space="preserve"> <style type="text/css"> .st0{fill:#03241B;} .st1{fill:#E4201E;} .st2{fill:#FFFFFF;} </style> <title>Obszar roboczy 3 kopia 10</title> <path class="st0" d="M184.3,44.8v21.1c0,1.3-0.4,1.7-1.4,1.7s-1.4-0.4-1.4-1.7v-2.4h-5.1v2.7c0,5,2,6.4,6.6,6.4s6.5-1.4,6.5-6.4 V44.8H184.3z M199.3,44.8v20.5c0,1.9-0.4,2.3-1.5,2.3s-1.6-0.4-1.6-2.3V44.8H191v21.3c0,5.1,2.1,6.4,6.8,6.4s6.8-1.3,6.8-6.4V44.8 H199.3z M217.4,44.8V64l0,0l-4.6-19.1h-6.9V72h5.1l0-19l4.7,19h6.8V44.8H217.4z M237.4,52.4v-1.6c0-4.5-1.9-6.4-6.9-6.4 c-4.8,0-6.6,1.9-6.6,6.4v16.4c0,3.5,2,5.4,5.1,5.4c2.2,0,3.1-0.9,4.2-2.6l0.8,2h3.5V55.4h-6.8v4.9h1.5v5.9
20073c0,1.1-0.4,1.5-1.5,1.5 s-1.5-0.4-1.5-1.5V50.8c0-1.1,0.4-1.4,1.5-1.4s1.5,0.4,1.5,1.4v1.6H237.4z M249,55.1l-1.8,12.6l0,0.2l-1.7-12.8h-4.8l3.9,16.9h5.3 l3.9-16.9H249z M251.5,68.6V72h3.5v-3.4H251.5z M272.6,44.8l-0.8,6.9l-1.9,14.6l-2.7-21.5h-8.8V72h5.2l0.1-23.2l3.5,23.2h5.5 l3.5-23.2V72h5.3V44.8H272.6z M296.1,44.8v5.4h4.2v21.6h5.3V50.3h3.2v-5.4L296.1,44.8z M309.6,44.8v5.4h3.3v21.6h5.3V50.3h4.2v-5.4 L309.6,44.8z M294.2,44.8h-7.4L282.2,72h5.8l0.5-4.1h4l0.6,4.1h5.8L294.2,44.8z M289.1,62.3l1.4-12.8l1.3,12.8H289.1z"/> <path class="st0" d="M176.4,63.5v2.7c0,5,2,6.4,6.7,6.4s6.5-1.4,6.5-6.4V44.9h-5.3v21.1c0,1.2-0.4,1.7-1.4,1.7s-1.4-0.4-1.4-1.7 v-2.4H176.4z"/> <path class="st0" d="M204.5,44.9h-5.3v20.5c0,1.9-0.4,2.3-1.5,2.3s-1.5-0.4-1.5-2.3V44.9h-5.3v21.3c0,5.1,2.2,6.4,6.8,6.4 s6.8-1.3,6.8-6.4L204.5,44.9z"/> <polygon class="st0" points="217.4,64 217.3,64 212.7,44.9 205.8,44.9 205.8,72 210.9,72 210.9,53 211,53 215.7,72 222.5,72 222.5,44.9 217.4,44.9 "/> <polygon class="st0" points="240.7,55.2 244.6,72 249.9,72 253.7,55.2 249,55.2 247.3,67.9 247.2,67.9 245.5,55.2 "/> <rect x="251.5" y="68.6" class="st0" width="3.4" height="3.4"/> <polygon class="st0" points="267.2,44.9 258.4,44.9 258.4,72 263.6,72 263.6,48.8 263.7,48.8 267.1,72 272.7,72 276.1,48.8 276.2,48.8 276.2,72 281.4,72 281.4,44.9 272.6,44.9 270,66.4 269.9,66.4 "/> <polygon class="st0" points="296.1,44.9 308.9,44.9 308.9,50.3 305.7,50.3 305.7,71.9 300.3,71.9 300.3,50.3 296.1,50.3 "/> <polygon class="st0" points="309.7,44.9 322.4,44.9 322.4,50.3 318.2,50.3 318.2,71.9 312.9,71.9 312.9,50.3 309.7,50.3 "/> <path class="st0" d="M294.2,44.8h-7.3L282.2,72h5.8l0.5-4.1h4l0.6,4.1h5.8L294.2,44.8z M289.1,62.3l1.4-12.8l1.3,12.8H289.1z"/> <polygon class="st0" points="173.2,54 167.9,54 167.9,48.6 163.2,48.6 163.2,54 157.9,54 157.9,58.7 163.2,58.7 163.2,64 167.9,64 167.9,58.7 173.2,58.7 "/> <polygon class="st1" points="2.7,28 30,3.4 59.5,5.8 73.8,22.5 84.6,8.5 119.4,0 149.1,22.2 152.8,55.2 137.2,95.9 75.8,128.2 22.2,103 0,67.2 "/> <path class="st2" d="M102.8,47.6l8.4-9.4l12.3,11.5l-3.6,22.8l-9.8,2.6L102.8,47.6z M93.4,43l9.9-12.7l12.7-2.4l11.5,6.7l6,19.4 l-3.4,20.2l-8.9,11l-13.4,4.2L95.1,78.8L93.4,43z M60.9,45.4l10.4-6.3l6.7,7.2l-9.2,6.9L60.9,45.4z M60.3,71.6l7.6-7.9l10.3,7.6 l-10.5,8L60.3,71.6z M50.9,38.4l11.3-7.2L80,31.8l7.9,11.4l-2.6,10.6l-7,4.6l10.4,9.3l-4,16.1l-13,6.1L55.8,86l-7.7-13.9l1.6-11.3 l9.4-3.4l-8.9-5.5L50.9,38.4z M24.5,33.6L37.3,30l4.8,56.9l-12.7,2.9L24.5,33.6z"/> <path class="st1" d="M102.8,47.6l8.4-9.4l12.3,11.5l-3.6,22.8l-9.8,2.6L102.8,47.6z M60.9,45.4l10.4-6.3l6.7,7.2l-9.2,6.9L60.9,45.4 z M60.3,71.6l7.6-7.9l10.3,7.6l-10.5,8L60.3,71.6z"/> </svg>' + 20074 '</div>'); 20075 20076 if(thePreloader._preLoaded == thePreloader._images.length) { 20077 thePreloader._onPreloadCompleted(); 20078 } 20079 20080 }; 20081 20082 image.src = src; 20083 20084 this._preLoadedImages[this._preLoadedImages.length] = image; 20085 } 20086 20087 ImagePreloader.prototype.getPreloadedImages = function() { 20088 20089 return this._preLoadedImages; 20090 }; 20091 20092 ImagePreloader.prototype._onPreloadCompleted = function() { 20093 var thePreloader = this; 20094 20095 $("#loader").fadeOut(300, function() { 20096 $(this).hide(); 20097 }); 20098 20099 $(document).trigger('imagesLoaded', [true]); 20100 } 20101 20102 return ImagePreloader; 20103 20104}); 20105(function() { 20106 var root = (typeof exports === 'undefined' ? window : exports); 20107 var config = { 20108 // An option to choose a suffix for 2x images 20109 retinaImageSuffix : '@2x', 20110 20111 // Ensure Content-Type is an image before trying to load @2x image 20112 // https://github.com/imulus/retinajs/pull/45) 20113 check_mime_type: true, 20114 20115 // Resize high-resolution images to original image's pixel dimensions 20116 // https://github.com/imulus/retinajs/issues/8 20117 force_original_dimensions: true 20118 }; 20119 20120 function Retina() {} 20121 20122 root.Retina = Retina; 20123 20124 Retina.configure = function(options) { 20125 if (options === null) { 20126 options = {}; 20127 } 20128 20129 for (var prop in options) { 20130 if (options.hasOwnProperty(prop)) { 20131 config[prop] = options[prop]; 20132 } 20133 } 20134 }; 20135 20136 Retina.init = function(context) { 20137 if (context === null) { 20138 context = root; 20139 } 20140 20141 var existing_onload = context.onload || function(){}; 20142 20143 context.onload = function() { 20144 var images = document.getElementsByTagName('img'), retinaImages = [], i, image; 20145 for (i = 0; i < images.length; i += 1) { 20146 image = images[i]; 20147 if (!!!image.getAttributeNode('data-no-retina')) { 20148 retinaImages.push(new RetinaImage(image)); 20149 } 20150 } 20151 existing_onload(); 20152 }; 20153 }; 20154 20155 Retina.isRetina = function(){ 20156 var mediaQuery = '(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)'; 20157 20158 if (root.devicePixelRatio > 1) { 20159 return true; 20160 } 20161 20162 if (root.matchMedia && root.matchMedia(mediaQuery).matches) { 20163 return true; 20164 } 20165 20166 return false;
20167 }; 20168 20169 20170 var regexMatch = /\.\w+$/; 20171 function suffixReplace (match) { 20172 return config.retinaImageSuffix + match; 20173 } 20174 20175 function RetinaImagePath(path, at_2x_path) { 20176 this.path = path || ''; 20177 if (typeof at_2x_path !== 'undefined' && at_2x_path !== null) { 20178 this.at_2x_path = at_2x_path; 20179 this.perform_check = false; 20180 } else { 20181 if (undefined !== document.createElement) { 20182 var locationObject = document.createElement('a'); 20183 locationObject.href = this.path; 20184 locationObject.pathname = locationObject.pathname.replace(regexMatch, suffixReplace); 20185 this.at_2x_path = locationObject.href; 20186 } else { 20187 var parts = this.path.split('?'); 20188 parts[0] = parts[0].replace(regexMatch, suffixReplace); 20189 this.at_2x_path = parts.join('?'); 20190 } 20191 this.perform_check = true; 20192 } 20193 } 20194 20195 root.RetinaImagePath = RetinaImagePath; 20196 20197 RetinaImagePath.confirmed_paths = []; 20198 20199 RetinaImagePath.prototype.is_external = function() { 20200 return !!(this.path.match(/^https?\:/i) && !this.path.match('//' + document.domain) ); 20201 }; 20202 20203 RetinaImagePath.prototype.check_2x_variant = function(callback) { 20204 var http, that = this; 20205 if (this.is_external()) { 20206 return callback(false); 20207 } else if (!this.perform_check && typeof this.at_2x_path !== 'undefined' && this.at_2x_path !== null) { 20208 return callback(true); 20209 } else if (this.at_2x_path in RetinaImagePath.confirmed_paths) { 20210 return callback(true); 20211 } else { 20212 http = new XMLHttpRequest(); 20213 http.open('HEAD', this.at_2x_path); 20214 http.onreadystatechange = function() { 20215 if (http.readyState !== 4) { 20216 return callback(false); 20217 } 20218 20219 if (http.status >= 200 && http.status <= 399) { 20220 if (config.check_mime_type) { 20221 var type = http.getResponseHeader('Content-Type'); 20222 if (type === null || !type.match(/^image/i)) { 20223 return callback(false); 20224 } 20225 } 20226 20227 RetinaImagePath.confirmed_paths.push(that.at_2x_path); 20228 return callback(true); 20229 } else { 20230 return callback(false); 20231 } 20232 }; 20233 http.send(); 20234 } 20235 }; 20236 20237 20238 function RetinaImage(el) { 20239 this.el = el; 20240 this.path = new RetinaImagePath(this.el.getAttribute('src'), this.el.getAttribute('data-at2x')); 20241 var that = this; 20242 this.path.check_2x_variant(function(hasVariant) { 20243 if (hasVariant) { 20244 that.swap(); 20245 } 20246 }); 20247 } 20248 20249 root.RetinaImage = RetinaImage; 20250 20251 RetinaImage.prototype.swap = function(path) { 20252 if (typeof path === 'undefined') { 20253 path = this.path.at_2x_path; 20254 } 20255 20256 var that = this; 20257 function load() { 20258 if (! that.el.complete) { 20259 setTimeout(load, 5); 20260 } else { 20261 if (config.force_original_dimensions) { 20262 that.el.setAttribute('width', that.el.offsetWidth); 20263 that.el.setAttribute('height', that.el.offsetHeight); 20264 } 20265 20266 that.el.setAttribute('src', path); 20267 } 20268 } 20269 load(); 20270 }; 20271 20272 20273 if (Retina.isRetina()) { 20274 Retina.init(root); 20275 } 20276})(); 20277 20278define("retinajs", ["jquery"], function(){}); 20279 20280// Generated by CoffeeScript 1.3.3 20281(function() { 20282 var Instafeed, root; 20283 20284 Instafeed = (function() { 20285 20286 function Instafeed(params, context) { 20287 var option, value; 20288 this.options = { 20289 target: 'instafeed', 20290 get: 'popular', 20291 resolution: 'thumbnail', 20292 sortBy: 'none', 20293 links: true, 20294 mock: false, 20295 useHttp: false 20296 }; 20297 if (typeof params === 'object') { 20298 for (option in params) { 20299 value = params[option]; 20300 this.options[option] = value; 20301 } 20302 } 20303 this.context = context != null ? context : this; 20304 this.unique = this._genKey(); 20305 } 20306 20307 Instafeed.prototype.hasNext = function() { 20308 return typeof this.context.nextUrl === 'string' && this.context.nextUrl.length > 0; 20309 }; 20310 20311 Instafeed.prototype.next = function() { 20312 if (!this.hasNext()) { 20313 return false;
20314 } 20315 return this.run(this.context.nextUrl); 20316 }; 20317 20318 Instafeed.prototype.run = function(url) { 20319 var header, instanceName, script; 20320 if (typeof this.options.clientId !== 'string') { 20321 if (typeof this.options.accessToken !== 'string') { 20322 throw new Error("Missing clientId or accessToken."); 20323 } 20324 } 20325 if (typeof this.options.accessToken !== 'string') { 20326 if (typeof this.options.clientId !== 'string') { 20327 throw new Error("Missing clientId or accessToken."); 20328 } 20329 } 20330 if ((this.options.before != null) && typeof this.options.before === 'function') { 20331 this.options.before.call(this); 20332 } 20333 if (typeof document !== "undefined" && document !== null) { 20334 script = document.createElement('script'); 20335 script.id = 'instafeed-fetcher'; 20336 script.src = url || this._buildUrl(); 20337 header = document.getElementsByTagName('head'); 20338 header[0].appendChild(script); 20339 instanceName = "instafeedCache" + this.unique; 20340 window[instanceName] = new Instafeed(this.options, this); 20341 window[instanceName].unique = this.unique; 20342 } 20343 return true; 20344 }; 20345 20346 Instafeed.prototype.parse = function(response) { 20347 var anchor, fragment, header, htmlString, image, imageString, imageUrl, images, img, imgUrl, instanceName, node, reverse, sortSettings, tmpEl, _i, _j, _k, _len, _len1, _len2, _ref; 20348 if (typeof response !== 'object') { 20349 if ((this.options.error != null) && typeof this.options.error === 'function') { 20350 this.options.error.call(this, 'Invalid JSON data'); 20351 return false; 20352 } else { 20353 throw new Error('Invalid JSON response'); 20354 } 20355 } 20356 if (response.meta.code !== 200) { 20357 if ((this.options.error != null) && typeof this.options.error === 'function') { 20358 this.options.error.call(this, response.meta.error_message); 20359 return false; 20360 } else { 20361 throw new Error("Error from Instagram: " + response.meta.error_message); 20362 } 20363 } 20364 if (response.data.length === 0) { 20365 if ((this.options.error != null) && typeof this.options.error === 'function') { 20366 this.options.error.call(this, 'No images were returned from Instagram'); 20367 return false; 20368 } else { 20369 throw new Error('No images were returned from Instagram'); 20370 } 20371 } 20372 if ((this.options.success != null) && typeof this.options.success === 'function') { 20373 this.options.success.call(this, response); 20374 } 20375 this.context.nextUrl = ''; 20376 if (response.pagination != null) { 20377 this.context.nextUrl = response.pagination.next_url; 20378 } 20379 if (this.options.sortBy !== 'none') { 20380 if (this.options.sortBy === 'random') { 20381 sortSettings = ['', 'random']; 20382 } else { 20383 sortSettings = this.options.sortBy.split('-'); 20384 } 20385 reverse = sortSettings[0] === 'least' ? true : false; 20386 switch (sortSettings[1]) { 20387 case 'random': 20388 response.data.sort(function() { 20389 return 0.5 - Math.random(); 20390 }); 20391 break; 20392 case 'recent': 20393 response.data = this._sortBy(response.data, 'created_time', reverse); 20394 break; 20395 case 'liked': 20396 response.data = this._sortBy(response.data, 'likes.count', reverse); 20397 break; 20398 case 'commented': 20399 response.data = this._sortBy(response.data, 'comments.count', reverse); 20400 break; 20401 default: 20402 throw new Error("Invalid option for sortBy: '" + this.options.sortBy + "'."); 20403 } 20404 } 20405 if ((typeof document !== "undefined" && document !== null) && this.options.mock === false) { 20406 images = response.data; 20407 if (this.options.limit != null) { 20408 if (images.length > this.options.limit) { 20409 images = images.slice(0, this.options.limit + 1 || 9e9); 20410 } 20411 } 20412 fragment = document.createDocumentFragment(); 20413 if ((this.options.filter != null) && typeof this.options.filter === 'function') { 20414 images = this._filter(images, this.options.filter); 20415 } 20416 if ((this.options.template != null) && typeof this.options.template === 'string') { 20417 htmlString = ''; 20418 imageString = ''; 20419 imgUrl = ''; 20420 tmpEl = document.createElement('div'); 20421 for (_i = 0, _len = images.length; _i < _len; _i++) { 20422 image = images[_i]; 20423 imageUrl = image.images[this.options.resolution].url; 20424 if (!this.options.useHttp) { 20425 imageUrl = imageUrl.replace('http://', '//'); 20426 } 20427 imageString = this._makeTemplate(this.options.template, { 20428 model: image, 20429 id: image.id, 20430 link: image.link, 20431 image: imageUrl, 20432 caption: this._getObjectProperty(image, 'caption.text'),
20433 likes: image.likes.count, 20434 comments: image.comments.count, 20435 location: this._getObjectProperty(image, 'location.name') 20436 }); 20437 htmlString += imageString; 20438 } 20439 tmpEl.innerHTML = htmlString; 20440 _ref = [].slice.call(tmpEl.childNodes); 20441 for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { 20442 node = _ref[_j]; 20443 fragment.appendChild(node); 20444 } 20445 } else { 20446 for (_k = 0, _len2 = images.length; _k < _len2; _k++) { 20447 image = images[_k]; 20448 img = document.createElement('img'); 20449 imageUrl = image.images[this.options.resolution].url; 20450 if (!this.options.useHttp) { 20451 imageUrl = imageUrl.replace('http://', '//'); 20452 } 20453 img.src = imageUrl; 20454 if (this.options.links === true) { 20455 anchor = document.createElement('a'); 20456 anchor.href = image.link; 20457 anchor.appendChild(img); 20458 fragment.appendChild(anchor); 20459 } else { 20460 fragment.appendChild(img); 20461 } 20462 } 20463 } 20464 document.getElementById(this.options.target).appendChild(fragment); 20465 header = document.getElementsByTagName('head')[0]; 20466 header.removeChild(document.getElementById('instafeed-fetcher')); 20467 instanceName = "instafeedCache" + this.unique; 20468 window[instanceName] = void 0; 20469 try { 20470 delete window[instanceName]; 20471 } catch (e) { 20472 20473 } 20474 } 20475 if ((this.options.after != null) && typeof this.options.after === 'function') { 20476 this.options.after.call(this); 20477 } 20478 return true; 20479 }; 20480 20481 Instafeed.prototype._buildUrl = function() { 20482 var base, endpoint, final; 20483 base = "https://api.instagram.com/v1"; 20484 switch (this.options.get) { 20485 case "popular": 20486 endpoint = "media/popular"; 20487 break; 20488 case "tagged": 20489 if (typeof this.options.tagName !== 'string') { 20490 throw new Error("No tag name specified. Use the 'tagName' option."); 20491 } 20492 endpoint = "tags/" + this.options.tagName + "/media/recent"; 20493 break; 20494 case "location": 20495 if (typeof this.options.locationId !== 'number') { 20496 throw new Error("No location specified. Use the 'locationId' option."); 20497 } 20498 endpoint = "locations/" + this.options.locationId + "/media/recent"; 20499 break; 20500 case "user": 20501 if (typeof this.options.userId !== 'number') { 20502 throw new Error("No user specified. Use the 'userId' option."); 20503 } 20504 if (typeof this.options.accessToken !== 'string') { 20505 throw new Error("No access token. Use the 'accessToken' option."); 20506 } 20507 endpoint = "users/" + this.options.userId + "/media/recent"; 20508 break; 20509 default: 20510 throw new Error("Invalid option for get: '" + this.options.get + "'."); 20511 } 20512 final = "" + base + "/" + endpoint; 20513 if (this.options.accessToken != null) { 20514 final += "?access_token=" + this.options.accessToken; 20515 } else { 20516 final += "?client_id=" + this.options.clientId; 20517 } 20518 if (this.options.limit != null) { 20519 final += "&count=" + this.options.limit; 20520 } 20521 final += "&callback=instafeedCache" + this.unique + ".parse"; 20522 return final; 20523 }; 20524 20525 Instafeed.prototype._genKey = function() { 20526 var S4; 20527 S4 = function() { 20528 return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); 20529 }; 20530 return "" + (S4()) + (S4()) + (S4()) + (S4()); 20531 }; 20532 20533 Instafeed.prototype._makeTemplate = function(template, data) { 20534 var output, pattern, varName, varValue, _ref; 20535 pattern = /(?:\{{2})([\w\[\]\.]+)(?:\}{2})/; 20536 output = template; 20537 while (pattern.test(output)) { 20538 varName = output.match(pattern)[1]; 20539 varValue = (_ref = this._getObjectProperty(data, varName)) != null ? _ref : ''; 20540 output = output.replace(pattern, "" + varValue); 20541 } 20542 return output; 20543 }; 20544 20545 Instafeed.prototype._getObjectProperty = function(object, property) { 20546 var piece, pieces; 20547 property = property.replace(/\[(\w+)\]/g, '.$1'); 20548 pieces = property.split('.'); 20549 while (pieces.length) { 20550 piece = pieces.shift(); 20551 if ((object != null) && piece in object) { 20552 object = object[piece]; 20553 } else { 20554 return null; 20555 } 20556 } 20557 return object; 20558 }; 20559 20560 Instafeed.prototype._sortBy = function(data, property, reverse) { 20561 var sorter; 20562 sorter = function(a, b) { 20563 var valueA, valueB; 20564 valueA = this._getObjectProperty(a, property); 20565 valueB = this._getObjectProperty(b, property); 20566 if (reverse) { 20567 if (valueA > valueB) { 20568 return 1; 20569 } else { 20570 return -1; 20571 } 20572 } 20573 if (valueA < valueB) { 20574 return 1; 20575 } else { 20576 return -1; 20577 } 20578 }; 20579 data.sort(sorter.bind(this)); 20580 return data; 20581 }; 20582 20583 Instafeed.prototype._filter = function(images, filter) { 20584 var filteredImages, image, _fn, _i, _len; 20585 filteredImages = []; 20586 _fn = function(image) { 20587 if (filter(image)) { 20588 return filteredImages.push(image); 20589 } 20590 }; 20591 for (_i = 0, _len = images.length; _i < _len; _i++) { 20592 image = images[_i]; 20593 _fn(image); 20594 } 20595 return filteredImages; 20596 }; 20597 20598 return Instafeed; 20599 20600 })(); 20601 20602 root = typeof exports !== "undefined" && exports !== null ? exports : window; 20603 20604 root.Instafeed = Instafeed; 20605 20606}).call(this); 20607 20608define("instafeedjs", ["jquery"], function(){}); 20609 20610(function (root, factory) { 20611 if (typeof define === 'function' && define.amd) { 20612 // AMD. 20613 define('progressiveImages',['jquery', 'lodash'], factory); 20614 } else { 20615 // Browser globals. 20616 root.mylib = factory(root.$, root._); 20617 } 20618}(this, function($) {
vendor: 15,325 bytes, lines 20618-21053
20618 20619/** 20620 * @license almond 0.3.3 Copyright jQuery Foundation and other contributors. 20621 * Released under MIT license, http://github.com/requirejs/almond/LICENSE 20622 */ 20623//Going sloppy to avoid 'use strict' string cost, but strict practices should 20624//be followed. 20625/*global setTimeout: false */ 20626 20627var requirejs, require, define; 20628(function (undef) { 20629 var main, req, makeMap, handlers, 20630 defined = {}, 20631 waiting = {}, 20632 config = {}, 20633 defining = {}, 20634 hasOwn = Object.prototype.hasOwnProperty, 20635 aps = [].slice, 20636 jsSuffixRegExp = /\.js$/; 20637 20638 function hasProp(obj, prop) { 20639 return hasOwn.call(obj, prop); 20640 } 20641 20642 /** 20643 * Given a relative module name, like ./something, normalize it to 20644 * a real name that can be mapped to a path. 20645 * @param {String} name the relative name 20646 * @param {String} baseName a real name that the name arg is relative 20647 * to. 20648 * @returns {String} normalized name 20649 */ 20650 function normalize(name, baseName) { 20651 var nameParts, nameSegment, mapValue, foundMap, lastIndex, 20652 foundI, foundStarMap, starI, i, j, part, normalizedBaseParts, 20653 baseParts = baseName && baseName.split("/"), 20654 map = config.map, 20655 starMap = (map && map['*']) || {}; 20656 20657 //Adjust any relative paths. 20658 if (name) { 20659 name = name.split('/'); 20660 lastIndex = name.length - 1; 20661 20662 // If wanting node ID compatibility, strip .js from end 20663 // of IDs. Have to do this here, and not in nameToUrl 20664 // because node allows either .js or non .js to map 20665 // to same file. 20666 if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { 20667 name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); 20668 } 20669 20670 // Starts with a '.' so need the baseName 20671 if (name[0].charAt(0) === '.' && baseParts) { 20672 //Convert baseName to array, and lop off the last part, 20673 //so that . matches that 'directory' and not name of the baseName's 20674 //module. For instance, baseName of 'one/two/three', maps to 20675 //'one/two/three.js', but we want the directory, 'one/two' for 20676 //this normalization. 20677 normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); 20678 name = normalizedBaseParts.concat(name); 20679 } 20680 20681 //start trimDots 20682 for (i = 0; i < name.length; i++) { 20683 part = name[i]; 20684 if (part === '.') { 20685 name.splice(i, 1); 20686 i -= 1; 20687 } else if (part === '..') { 20688 // If at the start, or previous value is still .., 20689 // keep them so that when converted to a path it may 20690 // still work when converted to a path, even though 20691 // as an ID it is less than ideal. In larger point 20692 // releases, may be better to just kick out an error. 20693 if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') { 20694 continue; 20695 } else if (i > 0) { 20696 name.splice(i - 1, 2); 20697 i -= 2; 20698 } 20699 } 20700 } 20701 //end trimDots 20702 20703 name = name.join('/'); 20704 } 20705 20706 //Apply map config if available. 20707 if ((baseParts || starMap) && map) { 20708 nameParts = name.split('/'); 20709 20710 for (i = nameParts.length; i > 0; i -= 1) { 20711 nameSegment = nameParts.slice(0, i).join("/"); 20712 20713 if (baseParts) { 20714 //Find the longest baseName segment match in the config. 20715 //So, do joins on the biggest to smallest lengths of baseParts. 20716 for (j = baseParts.length; j > 0; j -= 1) { 20717 mapValue = map[baseParts.slice(0, j).join('/')]; 20718 20719 //baseName segment has config, find if it has one for 20720 //this name. 20721 if (mapValue) { 20722 mapValue = mapValue[nameSegment]; 20723 if (mapValue) { 20724 //Match, update name to the new value. 20725 foundMap = mapValue; 20726 foundI = i; 20727 break; 20728 } 20729 } 20730 } 20731 } 20732 20733 if (foundMap) { 20734 break; 20735 } 20736 20737 //Check for a star map match, but just hold on to it, 20738 //if there is a shorter segment match later in a matching 20739 //config, then favor over this star map. 20740 if (!foundStarMap && starMap && starMap[nameSegment]) { 20741 foundStarMap = starMap[nameSegment]; 20742 starI = i; 20743 } 20744 } 20745 20746 if (!foundMap && foundStarMap) { 20747 foundMap = foundStarMap; 20748 foundI = starI; 20749 } 20750 20751 if (foundMap) { 20752 nameParts.splice(0, foundI, foundMap); 20753 name = nameParts.join('/'); 20754 } 20755 } 20756 20757 return name; 20758 } 20759 20760 function makeRequire(relName, forceSync) { 20761 return function () { 20762 //A version of a require function that passes a moduleName 20763 //value for items that may need to 20764 //look up paths relative to the moduleName 20765 var args = aps.call(arguments, 0); 20766 20767 //If first arg is not require('string'), and there is only 20768 //one arg, it is the array form without a callback. Insert 20769 //a null so that the following concat is correct. 20770 if (typeof args[0] !== 'string' && args.length === 1) { 20771 args.push(null); 20772 } 20773 return req.apply(undef, args.concat([relName, forceSync])); 20774 }; 20775 } 20776 20777 function makeNormalize(relName) { 20778 return function (name) { 20779 return normalize(name, relName); 20780 }; 20781 } 20782 20783 function makeLoad(depName) { 20784 return function (value) { 20785 defined[depName] = value; 20786 }; 20787 } 20788 20789 function callDep(name) { 20790 if (hasProp(waiting, name)) { 20791 var args = waiting[name]; 20792 delete waiting[name]; 20793 defining[name] = true; 20794 main.apply(undef, args); 20795 } 20796 20797 if (!hasProp(defined, name) && !hasProp(defining, name)) { 20798 throw new Error('No ' + name); 20799 } 20800 return defined[name]; 20801 } 20802 20803 //Turns a plugin!resource to [plugin, resource] 20804 //with the plugin being undefined if the name 20805 //did not have a plugin prefix. 20806 function splitPrefix(name) { 20807 var prefix, 20808 index = name ? name.indexOf('!') : -1; 20809 if (index > -1) { 20810 prefix = name.substring(0, index); 20811 name = name.substring(index + 1, name.length); 20812 } 20813 return [prefix, name]; 20814 } 20815 20816 //Creates a parts array for a relName where first part is plugin ID, 20817 //second part is resource ID. Assumes relName has already been normalized. 20818 function makeRelParts(relName) { 20819 return relName ? splitPrefix(relName) : []; 20820 } 20821 20822 /** 20823 * Makes a name map, normalizing the name, and using a plugin 20824 * for normalization if necessary. Grabs a ref to plugin 20825 * too, as an optimization. 20826 */ 20827 makeMap = function (name, relParts) { 20828 var plugin, 20829 parts = splitPrefix(name), 20830 prefix = parts[0], 20831 relResourceName = relParts[1]; 20832 20833 name = parts[1]; 20834 20835 if (prefix) { 20836 prefix = normalize(prefix, relResourceName); 20837 plugin = callDep(prefix); 20838 } 20839 20840 //Normalize according 20841 if (prefix) { 20842 if (plugin && plugin.normalize) { 20843 name = plugin.normalize(name, makeNormalize(relResourceName)); 20844 } else { 20845 name = normalize(name, relResourceName); 20846 } 20847 } else { 20848 name = normalize(name, relResourceName); 20849 parts = splitPrefix(name); 20850 prefix = parts[0]; 20851 name = parts[1]; 20852 if (prefix) { 20853 plugin = callDep(prefix); 20854 } 20855 } 20856 20857 //Using ridiculous property names for space reasons 20858 return { 20859 f: prefix ? prefix + '!' + name : name, //fullName 20860 n: name, 20861 pr: prefix, 20862 p: plugin 20863 }; 20864 }; 20865 20866 function makeConfig(name) { 20867 return function () { 20868 return (config && config.config && config.config[name]) || {}; 20869 }; 20870 } 20871 20872 handlers = { 20873 require: function (name) { 20874 return makeRequire(name); 20875 }, 20876 exports: function (name) { 20877 var e = defined[name]; 20878 if (typeof e !== 'undefined') { 20879 return e; 20880 } else { 20881 return (defined[name] = {}); 20882 } 20883 }, 20884 module: function (name) { 20885 return { 20886 id: name, 20887 uri: '', 20888 exports: defined[name], 20889 config: makeConfig(name) 20890 }; 20891 } 20892 }; 20893 20894 main = function (name, deps, callback, relName) { 20895 var cjsModule, depName, ret, map, i, relParts, 20896 args = [], 20897 callbackType = typeof callback, 20898 usingExports; 20899 20900 //Use name if no relName 20901 relName = relName || name; 20902 relParts = makeRelParts(relName); 20903 20904 //Call the callback to define the module, if necessary. 20905 if (callbackType === 'undefined' || callbackType === 'function') { 20906 //Pull out the defined dependencies and pass the ordered 20907 //values to the callback. 20908 //Default to [require, exports, module] if no deps 20909 deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; 20910 for (i = 0; i < deps.length; i += 1) { 20911 map = makeMap(deps[i], relParts); 20912 depName = map.f; 20913 20914 //Fast path CommonJS standard dependencies. 20915 if (depName === "require") { 20916 args[i] = handlers.require(name); 20917 } else if (depName === "exports") { 20918 //CommonJS module spec 1.1 20919 args[i] = handlers.exports(name); 20920 usingExports = true; 20921 } else if (depName === "module") { 20922 //CommonJS module spec 1.1 20923 cjsModule = args[i] = handlers.module(name); 20924 } else if (hasProp(defined, depName) || 20925 hasProp(waiting, depName) || 20926 hasProp(defining, depName)) { 20927 args[i] = callDep(depName); 20928 } else if (map.p) { 20929 map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); 20930 args[i] = defined[depName]; 20931 } else { 20932 throw new Error(name + ' missing ' + depName); 20933 } 20934 } 20935 20936 ret = callback ? callback.apply(defined[name], args) : undefined; 20937 20938 if (name) { 20939 //If setting exports via "module" is in play, 20940 //favor that over return value and exports. After that, 20941 //favor a non-undefined return value over exports use. 20942 if (cjsModule && cjsModule.exports !== undef && 20943 cjsModule.exports !== defined[name]) { 20944 defined[name] = cjsModule.exports; 20945 } else if (ret !== undef || !usingExports) { 20946 //Use the return value from the function. 20947 defined[name] = ret; 20948 } 20949 } 20950 } else if (name) { 20951 //May just be an object definition for the module. Only 20952 //worry about defining if have a module name. 20953 defined[name] = callback; 20954 } 20955 }; 20956 20957 requirejs = require = req = function (deps, callback, relName, forceSync, alt) { 20958 if (typeof deps === "string") { 20959 if (handlers[deps]) { 20960 //callback in this case is really relName 20961 return handlers[deps](callback); 20962 } 20963 //Just return the module wanted. In this scenario, the 20964 //deps arg is the module name, and second arg (if passed) 20965 //is just the relName. 20966 //Normalize module name, if it contains . or .. 20967 return callDep(makeMap(deps, makeRelParts(callback)).f); 20968 } else if (!deps.splice) { 20969 //deps is a config object, not an array. 20970 config = deps; 20971 if (config.deps) { 20972 req(config.deps, config.callback); 20973 } 20974 if (!callback) { 20975 return; 20976 } 20977 20978 if (callback.splice) { 20979 //callback is an array, which means it is a dependency list. 20980 //Adjust args if there are dependencies 20981 deps = callback; 20982 callback = relName; 20983 relName = null; 20984 } else { 20985 deps = undef; 20986 } 20987 } 20988 20989 //Support require(['a']) 20990 callback = callback || function () {}; 20991 20992 //If relName is a function, it is an errback handler, 20993 //so remove it. 20994 if (typeof relName === 'function') { 20995 relName = forceSync; 20996 forceSync = alt; 20997 } 20998 20999 //Simulate async callback; 21000 if (forceSync) { 21001 main(undef, deps, callback, relName); 21002 } else { 21003 //Using a non-zero value because of concern for what old browsers 21004 //do, and latest browsers "upgrade" to 4 if lower value is used: 21005 //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: 21006 //If want a value immediately, use require('id') instead -- something 21007 //that works in almond on the global level, but not guaranteed and 21008 //unlikely to work in other AMD implementations. 21009 setTimeout(function () { 21010 main(undef, deps, callback, relName); 21011 }, 4); 21012 } 21013 21014 return req; 21015 }; 21016 21017 /** 21018 * Just drops the config on the floor, but returns req in case 21019 * the config return value is used. 21020 */ 21021 req.config = function (cfg) { 21022 return req(cfg); 21023 }; 21024 21025 /** 21026 * Expose module registry for debugging and tooling 21027 */ 21028 requirejs._defined = defined; 21029 21030 define = function (name, deps, callback) { 21031 if (typeof name !== 'string') { 21032 throw new Error('See almond README: incorrect module build, no module name'); 21033 } 21034 21035 //This module may not have dependencies 21036 if (!deps.splice) { 21037 //deps is not an array, so probably means 21038 //an object literal or factory function for 21039 //the value. Adjust args. 21040 callback = deps; 21041 deps = []; 21042 } 21043 21044 if (!hasProp(defined, name) && !hasProp(waiting, name)) { 21045 waiting[name] = [name, deps, callback]; 21046 } 21047 }; 21048 21049 define.amd = { 21050 jQuery: true 21051 }; 21052}()); 21053
21054define("node_modules/almond/almond", function(){}); 21055 21056/** 21057 * Created by asiulik on 2017-03-06. 21058 */ 21059define('src/config',[], function () { 21060 21061 var config = {}; 21062 21063 config.IMAGE_STRATEGY = 'image'; 21064 config.LINK_STRATEGY = 'href'; 21065 config.POSTER_STRATEGY = 'poster'; 21066 config.BACKGROUND_STRATEGY = 'background'; 21067 21068 config.avalaibleStrategy = [ 21069 config.IMAGE_STRATEGY, 21070 config.BACKGROUND_STRATEGY, 21071 config.POSTER_STRATEGY, 21072 config.LINK_STRATEGY 21073 ]; 21074 21075 config.attrNameSlug = 'progressive-image-src'; 21076 config.positionAttrSlug = 'focus-image-config'; 21077 config.progressiveImageVisibleClass = 'progressive__image--visible'; 21078 config.isLazyLoadStrategy = false; 21079 21080 config.breakpoints = ["none", "w360", "w480", "w768", "w768@2x", "w1280", "w1280@2x", "w1920", "w2560", "w3840"]; 21081 21082 return config; 21083 21084}); 21085/** 21086 * Created by asiulik on 2017-03-06. 21087 */ 21088 21089define('src/utils/inViewport',[], function(){ 21090 21091 return function isElementInViewport(element, fullyInView){ 21092 21093 var pageTop = $(window).scrollTop(); 21094 var pageBottom = pageTop + $(window).height(); 21095 var elementTop = $(element).offset().top; 21096 var elementBottom = elementTop + parseInt($(element).css('height')); 21097 21098 if (fullyInView === true) { 21099 return ((pageTop < elementTop) && (pageBottom > elementBottom)); 21100 } else { 21101 return ((elementTop <= pageBottom) && (elementBottom >= pageTop)); 21102 } 21103 21104 } 21105 21106}); 21107/** 21108 * Created by asiulik on 2017-03-06. 21109 */ 21110 21111define('src/utils/setBgImage',[], function(){ 21112 21113 return function setBgImage(element, src) { 21114 21115 if (element) { 21116 element.style.backgroundImage = 'url("' + src + '")'; 21117 return element; 21118 } 21119 21120 } 21121 21122}); 21123/** 21124 * Created by asiulik on 2017-03-06. 21125 */ 21126define('src/utils/getBreakpoint',[], function(){ 21127 21128 return function getBreakpoint(){ 21129 21130 return window.getComputedStyle(document.body, ":after") 21131 .getPropertyValue("content") 21132 .replace(/\"|\'/g, ""); 21133 21134 } 21135 21136}); 21137/** 21138 * Created by asiulik on 2017-03-06. 21139 */ 21140 21141define('src/utils/utils',[ 21142 './inViewport', 21143 './setBgImage', 21144 './getBreakpoint' 21145], function(isElementInView, setBgImage, getBreakpoint){ 21146 21147 return { 21148 isElementInView: isElementInView, 21149 setBgImage: setBgImage, 21150 getBreakpoint: getBreakpoint 21151 }; 21152 21153}); 21154 21155/** 21156 * Created by asiulik on 2017-03-06. 21157 */ 21158define('src/image',[ 21159 'jquery', 21160 'lodash', 21161 './config', 21162 './utils/utils' 21163], function ($, _, Config, Utils) { 21164 21165 function ProgressiveImage(el, options) { 21166 this.element = el; 21167 this.options = _.assign(this.options, options || {}); 21168 } 21169 21170 ProgressiveImage.prototype.options = { 21171 21172 /* 21173 * requestOnVisible make request when isElementInView return true value by currentBreakpoint 21174 * */ 21175 requestOnVisible: true, 21176 /* 21177 * supported breakpoints collection 21178 * */ 21179 breakpoints: Config.breakpoints, 21180 /* 21181 * isElementInView should return boolean true/false 21182 * */ 21183 isElementInView: function($element){ 21184 return Utils.isElementInView($element); 21185 } 21186 21187 }; 21188 21189 ProgressiveImage.prototype.createBreakpointConfig = function (breakpointObj, progressiveImageConfig) { 21190 21191 var arrFromAttr = progressiveImageConfig.split(','); 21192 21193 _.each(arrFromAttr, function (value) { 21194 21195 var splited = value.split(" "); 21196 21197 if (arrFromAttr[0] === 'none') 21198 isLazyLoadStrategy = true; 21199 21200 if (splited[0] === 'none') { 21201 breakpointObj['none'] = splited[1]; 21202 } else { 21203 let idx = 'w' + splited[2].substring(0, splited[2].length - 1) 21204 breakpointObj[idx] = splited[1]; 21205 } 21206 }); 21207 21208 return breakpointObj; 21209 21210 }; 21211 21212 ProgressiveImage.prototype.init = function () { 21213 21214 this.$element = $(this.element); 21215 this.breakpointsConfigObj = {}; 21216 21217 var _this = this; 21218 21219 this.breakpointsConfigObj.none = getUrl(this.element, this.options.strategy); 21220 21221 this.createBreakpointConfig(this.breakpointsConfigObj, this.element.getAttribute(Config.attrNameSlug)); 21222 21223 this.setPositionConfig(); 21224 21225 if (!this.options.requestOnVisible) { 21226 this.checkBreakpoint(); 21227 } 21228 21229 this.$element = $(this.element); 21230 21231 $(window).on('resize orientationchange', function () { 21232 _this.checkBreakpoint(); 21233 }); 21234 21235 this.checkViewportTh = function () { 21236 21237 if (_this.visible) return; 21238 21239 var isInViewport = _this.options.isElementInView(_this.$element); 21240 21241 if (isInViewport) { 21242 21243 _this.visible = true; 21244 _this.checkBreakpoint(); 21245 21246 } 21247 }; 21248 21249 this.checkViewportTh(); 21250 21251 $(window).on('scroll load', this.checkViewportTh); 21252 $(window).on('resize', this.checkViewportTh); 21253 21254 }; 21255 21256 ProgressiveImage.prototype.setPositionConfig = function () { 21257 21258 var _this = this; 21259 var arrBgPosition = this.element.getAttribute(Config.positionAttrSlug); 21260 21261 if (arrBgPosition) { 21262 21263 this.positionConfig = {}; 21264 21265 arrBgPosition.split(',').map(function (item) { 21266 21267 var configPair = item.split(' '); 21268 21269 _this.positionConfig[configPair[0]] = { 21270 x: configPair[1].split("/")[0], 21271 y: configPair[1].split("/")[1] 21272 }; 21273 }); 21274 } 21275 }; 21276 21277 ProgressiveImage.prototype.getAvailableBreakpoint = function (breakpointValue, breakpointsConfig, availableBreakpointsCollection) { 21278 21279 var breakpoint; 21280 var availableBreakpoints = availableBreakpointsCollection; 21281 21282 if (!breakpointsConfig[breakpointValue]) { 21283 for (var t = availableBreakpoints.indexOf(breakpointValue); t >= 0; t--) 21284 if ("undefined" != typeof breakpointsConfig[availableBreakpoints[t]]) { 21285 breakpoint = availableBreakpoints[t]; 21286 break 21287 } 21288 } else { 21289 breakpoint = breakpointValue; 21290 } 21291 21292 return breakpoint; 21293 21294 }; 21295 21296 ProgressiveImage.prototype.getImage = function (breakpointValue) { 21297 21298 var _this = this; 21299 21300 var breakpoint = this.getAvailableBreakpoint( 21301 breakpointValue, 21302 this.breakpointsConfigObj, 21303 this.options.breakpoints 21304 ); 21305 21306 var newImg = new Image; 21307 21308 if (_this.positionConfig) { 21309 var position = this.positionConfig[breakpoint] || this.positionConfig['none']; 21310 updatePosition(this.element, this.options.strategy, position); 21311 } 21312 21313 if (this.options.forceUpdate) { 21314 updateSrc(this.breakpointsConfigObj[breakpoint], _this.element, _this.options.strategy); 21315 } 21316 21317 newImg.src = this.breakpointsConfigObj[breakpoint]; 21318 21319 newImg.onload = function () { 21320 updateSrc(newImg.src, _this.element, _this.options.strategy); 21321 }; 21322 21323 }; 21324 21325 ProgressiveImage.prototype.checkBreakpoint = function () { 21326 21327 if (this.options.requestOnVisible && !this.visible) return; 21328
21329 if (this.currentBreakPoint !== getBreakpoint()) { 21330 this.currentBreakPoint = getBreakpoint(); 21331 this.getImage(this.currentBreakPoint); 21332 } 21333 21334 }; 21335 21336 ProgressiveImage.prototype.delete = function () { 21337 if (this.checkViewportTh) { 21338 $(window).off('scroll', this.checkViewportTh); 21339 $(window).off('resize', this.checkViewportTh); 21340 } 21341 }; 21342 21343 function updatePosition(element, strategy, position) { 21344 21345 if (!position) position = {}; 21346 21347 position.x = position.x || 0.5; 21348 position.y = position.y || 0.5; 21349 21350 if (strategy === Config.BACKGROUND_STRATEGY) { 21351 21352 element.style.backgroundPosition = 21353 _mapPositionToPercent(position.x) + ' ' + _mapPositionToPercent(position.y) 21354 } 21355 } 21356 21357 function getStrategyTypeByTagName(tagName) { 21358 21359 var strategy; 21360 21361 switch (tagName) { 21362 21363 case 'IMG': 21364 strategy = Config.IMAGE_STRATEGY; 21365 break; 21366 21367 case 'VIDEO': 21368 strategy = Config.POSTER_STRATEGY; 21369 break; 21370 21371 case 'A': 21372 strategy = Config.LINK_STRATEGY; 21373 break; 21374 21375 default: 21376 strategy = Config.BACKGROUND_STRATEGY; 21377 } 21378 21379 return strategy; 21380 21381 } 21382 21383 function updateSrc(src, element) { 21384 21385 var strategy = getStrategyTypeByTagName(element.tagName); 21386 21387 if (strategy === Config.IMAGE_STRATEGY) { 21388 element.src = src; 21389 } 21390 21391 if (strategy === Config.LINK_STRATEGY) { 21392 element.href = src; 21393 } 21394 21395 if (strategy === Config.POSTER_STRATEGY) { 21396 Utils.setBgImage(element, src); 21397 } 21398 21399 if (strategy === Config.BACKGROUND_STRATEGY) { 21400 Utils.setBgImage(element, src); 21401 } 21402 21403 return element; 21404 } 21405 21406 function getUrl(element, strategy) { 21407 21408 if (strategy === Config.IMAGE_STRATEGY) { 21409 return element.src; 21410 } 21411 21412 if (strategy === Config.BACKGROUND_STRATEGY) { 21413 var backgroundImage = element.style.backgroundImage; 21414 return backgroundImage.slice(4, -1).replace(/["|']/g, ""); 21415 } 21416 21417 throw new Error('Get url invalid strategy detected: ', strategy); 21418 } 21419 21420 function _mapPositionToPercent(value) { 21421 return value * 100 + '%'; 21422 } 21423 21424 function getBreakpoint() { 21425 return Utils.getBreakpoint(); 21426 } 21427 21428 return ProgressiveImage; 21429 21430}); 21431/** 21432 * Created by asiulik on 2017-03-02. 21433 */ 21434 21435define('src/images',[ 21436 'jquery', 21437 'lodash', 21438 './config', 21439 './image', 21440 './utils/utils' 21441], function ($, _, Config, ProgressiveImage, Utils){ 21442 21443 function Images(options) { 21444 this.globalOptions = options; 21445 } 21446 21447 Images.prototype.init = function () { 21448 21449 var progressiveItems = this.getProgressiveItems(document); 21450 21451 this.destroyItems(); 21452 21453 this.progressiveImages = []; 21454 21455 this.addItems(progressiveItems); 21456 21457 }; 21458 21459 Images.prototype.destroyItems = function(){ 21460 21461 if (this.progressiveImages && this.progressiveImages.length) { 21462 this.progressiveImages.forEach(function (image) { 21463 image.delete(); 21464 }) 21465 } 21466 21467 }; 21468 21469 Images.prototype.getProgressiveItems = function (container) { 21470 return container.querySelectorAll('[' + Config.attrNameSlug + ']'); 21471 }; 21472 21473 Images.prototype.addItems = function (collection) { 21474 21475 var _this = this; 21476 21477 [].forEach.call(collection, function (progressiveElement) { 21478 21479 var configString = $(progressiveElement).attr('progressive-image-src-config'); 21480 var config = configString ? JSON.parse(configString.replace(/'/g, '"')) : {}; 21481 21482 var prorgessiveItem = new ProgressiveImage(progressiveElement, _.assign(_this.globalOptions, config, { 21483 strategy: _this.getStrategyByTag(progressiveElement) 21484 })); 21485 21486 prorgessiveItem.init(_this.layout); 21487 _this.progressiveImages.push(prorgessiveItem) 21488 21489 }); 21490 21491 return this; 21492 21493 }; 21494 21495 Images.prototype.getStrategyByTag = function (element) { 21496 return element.tagName.toLowerCase() === 'image' ? 21497 Config.IMAGE_STRATEGY : Config.BACKGROUND_STRATEGY; 21498 }; 21499 21500 Images.prototype.checkBreak = function () { 21501 21502 [].forEach.call(this.progressiveImages, function (image) { 21503 image.checkBreakpoint(); 21504 }) 21505 21506 }; 21507 21508 return Images; 21509 21510}); 21511 21512 21513 21514 define('jquery', function() { 21515 return $; 21516 }); 21517 21518 define('lodash', function() { 21519 return _; 21520 }); 21521 21522 return require('src/images'); 21523 21524})); 21525 21526/** 21527 * Created by asiulik on 25.04.2017. 21528 */ 21529 21530define('modules/progressiveImages',['progressiveImages'], function(ProgressiveImages){ 21531 21532 function Images(){} 21533 21534 Images.prototype.init = function(){ 21535 21536 this.progressiveImages = new ProgressiveImages({}); 21537 21538 this.progressiveImages.init(); 21539 return this.progressiveImages; 21540 21541 }; 21542 21543 Images.prototype.getProgressiveInstace = function(){ 21544 return this.progressiveImages; 21545 }; 21546 21547 return Images; 21548 21549}); 21550 21551requirejs.config({ 21552// baseUrl: '../../lib/js', 21553 paths: { 21554 // Libraries 21555 lib: '../../lib/js', 21556 21557 // require plugins 21558 async: '../../lib/js/requirejs-plugins/src/async', 21559 goog: '../../lib/js/requirejs-plugins/src/goog', 21560 propertyParser: '../../lib/js/requirejs-plugins/src/propertyParser', 21561 21562 // 180tiger 21563 angular: '../../lib/js/angular/angular', 21564 'angular-route': '../../lib/js/angular-route/angular-route', 21565 'angular-resource': '../../lib/js/angular-resource/angular-resource', 21566 'angular-sanitize': '../../lib/js/angular-sanitize/angular-sanitize', 21567 'angular-slugify': '../../lib/js/angular-slugify/angular-slugify', 21568 'angular-ui-sortable': '../../lib/js/angular-ui-sortable/sortable', 21569 'angular-file-upload': '../../lib/js/ng-file-upload/angular-file-upload', 21570 angularAMD: '../../lib/js/angularAMD/angularAMD', 21571 ngload: '../../lib/js/angularAMD/ngload', 21572 'jquery-ui': '../../lib/js/jquery-ui/ui', 21573 'bootstrap': '../../lib/js/bootstrap-sass-official/assets/javascripts/bootstrap', 21574 21575 // proper deps 21576 jquery: '../../lib/js/jquery/dist/jquery',
21577 bxslider: '../../lib/js/bxslider-4/dist/jquery.bxslider', 21578 chosen: '../../lib/js/chosen/chosen.jquery', 21579 // lodash: '../../lib/js/lodash/dist/lodash.compat', 21580 lodash: '../../lib/js/lodash/dist/lodash.min', 21581 eventEmitter: '../../lib/js/eventEmitter', 21582 event: '../../lib/js/eventEmitter/EventEmitter', 21583 masonry: '../../lib/js/masonry/masonry', 21584 imagesloaded: '../../lib/js/imagesloaded-packaged/imagesloaded.pkgd', 21585 bridget: '../../lib/js/jquery-bridget/jquery.bridget', 21586 outlayer: '../../lib/js/outlayer', 21587 'fizzy-ui-utils': '../../lib/js/fizzy-ui-utils', 21588 'desandro-matches-selector': '../../lib/js/desandro-matches-selector', 21589 eventie: '../../lib/js/eventie', 21590 classie: '../../lib/js/classie/classie', 21591 'doc-ready': '../../lib/js/doc-ready', 21592 'get-style-property': '../../lib/js/get-style-property', 21593 'get-size': '../../lib/js/get-size', 21594 'matches-selector': '../../lib/js/matches-selector', 21595 progressiveImages: "../../lib/js/prorgessiveImages/progressiveImages", 21596 21597 //animonscroll: '../../lib/js/codrops-animonscroll/AnimOnScroll', 21598 21599 customScrollbar: '../../lib/js/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar', 21600 retinajs: '../../lib/js/retina.js/src/retina', 21601 21602 instafeedjs: "../../lib/js/instafeed.js/instafeed", 21603 flexslider: "../../lib/js/flexslider/jquery.flexslider", 21604 viewport: "../../lib/viewport", 21605 21606 // Shortcut 21607 assets: '../../assets' 21608 }, 21609 shim: { 21610 angularAMD: ['angular'], 21611 ngload: ['angularAMD'], 21612 21613 'angular-route': { 21614 deps: ['angular'] 21615 }, 21616 'angular-resource': { 21617 deps: ['angular'] 21618 }, 21619 'angular-sanitize': { 21620 deps: ['angular'] 21621 }, 21622 'angular-slugify': { 21623 deps: ['angular'] 21624 }, 21625 'angular-ui-sortable': { 21626 deps: ['jquery-ui/sortable', 'angular'] 21627 }, 21628 'angular-file-upload': { 21629 deps: ['angular'] 21630 }, 21631 21632 jquery: { 21633 exports: 'jquery' 21634 }, 21635 bxslider: { 21636 deps: ['jquery'] 21637 }, 21638 chosen: { 21639 deps: ['jquery'] 21640 }, 21641 'bootstrap': { 21642 deps: ['jquery'] 21643 }, 21644 customScrollbar: { 21645 deps: ['jquery'] 21646 }, 21647 retinajs: { 21648 deps: ['jquery'] 21649 }, 21650 flexslider: { 21651 deps: ['jquery'] 21652 }, 21653 instafeedjs: { 21654 deps: ['jquery'] 21655 }, 21656 viewport: { 21657 deps: ['jquery'] 21658 } 21659 } 21660}); 21661 21662require([ 21663 'jquery', 21664 'lodash', 21665 'core/layout', 21666 'core/pageload', 21667 'core/masonry', 21668 'core/cookies', 21669 'modules/sidebarNav', 21670 'modules/projectSlider', 21671 'modules/newsList', 21672 'modules/department', 21673 'modules/showMore', 21674 'modules/instagramSlider', 21675 'modules/itemLoad', 21676 'modules/trigerVideo', 21677 'modules/imagesPreloader', 21678 'retinajs', 21679 'instafeedjs', 21680 'modules/progressiveImages', 21681 'viewport' 21682], function ($, _, Layout, PageLoad, Masonry, Cookies, SidebarNav, ProjectSlider, NewsList, Department, ShowMore, InstagramSlider, ItemLoad, Video, ImagePreloader, RetinaJs, instafeed, ProgressiveImages) { 21683 21684 if (typeof window.console === 'undefined') { 21685 window.console = {}; 21686 console.log = _.noop; 21687 console.warn = _.noop; 21688 console.error = _.noop; 21689 } 21690 21691 var $window; 21692 21693 function main() { 21694 21695 // core 21696 var layout = new Layout(); 21697 var pageLoad = new PageLoad(); 21698 var msnry = new Masonry(); 21699 var cookies = new Cookies(); 21700 21701 // modules 21702 var sidebarNav = new SidebarNav(); 21703 var projectSlider = new ProjectSlider(); 21704 var newsList = new NewsList(); 21705 var techDepartment = new Department('technology'); 21706 var showMore = new ShowMore(); 21707 var instagramSlider = new InstagramSlider(); 21708 var itemLoad = new ItemLoad(); 21709 var video = new Video(); 21710 21711 var progressiveImages = new ProgressiveImages(); 21712 21713 progressiveImages.init(); 21714 21715 var ignoredImages = null; 21716 21717 imgPaths = []; 21718 21719 var imgs = $('body img'); 21720 21721 21722 21723 imgs.each(function () { 21724 var $this = $(this); 21725 imgPaths.push($this[0].src); 21726 }); 21727 21728 var pI = new ImagePreloader(imgPaths, imgs); 21729
21730 pI.preLoadImages(); 21731 21732 var instafeedConfig = { 21733 get: 'tagged', 21734 tagName: '180hb', 21735 clientId: 'd64a73d4ca044f8f8e43a2334144acb9', 21736 target: "instafeed", 21737 template: '<li class="slide"><img src="{{image}}" /></li>', 21738 resolution: "low_resolution", 21739 limit: 15, 21740 sortBy: "most-recent", 21741 filter: function (image) { 21742 var ignore = false; 21743 21744 _.forEach(ignoredImages, function (ingoredImage) { 21745 if (image.id == ingoredImage.id) { 21746 ignore = true; 21747 } 21748 }); 21749 21750 return !ignore; 21751 }, 21752 after: function () { 21753 instagramSlider.init(); 21754 msnry.init(); 21755 } 21756 }; 21757 21758 21759 // console.log(progressiveImages); 21760 21761 // var instafeedInit = function(data){ 21762 // var feed = new Instafeed(instafeedConfig); 21763 // 21764 // if ($("#instafeed").length > 0) { 21765 // // console.log('aaaa'); 21766 // feed.run(); 21767 // } else { 21768 // // console.log('bbbb'); 21769 // instagramSlider.init(); 21770 // msnry.layout(); 21771 // } 21772 // } 21773 21774 instagramSlider.init(null, function () { 21775 msnry.layout(); 21776 }); 21777 21778 layout.init(); 21779 21780 msnry.init(); 21781 21782 cookies.init(); 21783 21784 // $.get("/assets/copy/instagram.json", function( data ) { 21785 // ignoredImages = data; 21786 // instafeedInit(); 21787 // }); 21788 21789 pageLoad.init(); 21790 21791 newsList.init(); 21792 21793 sidebarNav.init(); 21794 projectSlider.init(); 21795 21796 projectSlider.run(); 21797 21798 techDepartment.toggle(); 21799 21800 showMore.init(); 21801 21802 video.init(); 21803 21804 if (layout.mobile) { 21805 21806 } else { 21807 msnry.position(); 21808 } 21809 21810 var random = Math.floor(Math.random() * (10 - 1 + 1)) + 1; 21811 $('body').addClass('elements-color-'+random); 21812 21813 if (layout.mobile) { 21814 $('body').addClass('mobile'); 21815 } else if (layout.tablet) { 21816 $('body').addClass('tablet'); 21817 } 21818 21819 if ($('.masonry').hasClass('about')) { 21820 $claim = $('.claim'); 21821 $cite = $claim.find('.i--cite'); 21822 21823 if (layout.mobile) { 21824 $claim.find('.i--content').before($cite); 21825 msnry.layout(); 21826 } else { 21827 $claim.find('.i--content').after($cite); 21828 } 21829 21830 } 21831 21832 if (layout.fullhd && ($('.masonry').hasClass('list--projects') || $('.masonry').hasClass('list--news') || $('.masonry').hasClass('competences') || $('.masonry').hasClass('about'))) { 21833 $('#container').removeClass('project-content'); 21834 $('#container').addClass('project-content'); 21835 } else { 21836 21837 $('#container').removeClass('project-content'); 21838 } 21839 21840 $('#careers').find('.career2').on('click', function () { 21841 if ($(this).is('.contact')) return; 21842 if($("body").hasClass('neos-backend')) return; 21843 21844 $content = $('#content'); 21845 21846 var href = $(this).find('.i__cont').attr('data-href'); 21847 21848 $ 21849 .ajax({ 21850 url: href, 21851 type: 'GET', 21852 beforeSend: function () { 21853 $('#loader').show(); 21854 } 21855 }).done(function (data) { 21856 21857 var $data = $(data), 21858 $dataContent = $data.find('#content'); 21859 21860 $content.html($dataContent.html()); 21861 21862 $(document).trigger('imagesLoaded', [true]); 21863 21864 $("#loader").fadeOut(500, function () { 21865 $(this).hide(); 21866 }); 21867 21868 history.pushState({}, '', href); 21869 21870 }).fail(function (error) { 21871 console.log('wystapil error: ', href); 21872 }); 21873 }); 21874 21875 msnry.init(); 21876 21877 21878 /*Animation*/ 21879 21880 $(document).on('imagesLoaded', function (msg) { 21881 21882 if (layout.tablet) {
21883 itemLoad.run(); 21884 } 21885 21886 if (!layout.desktop && !layout.fullhd) { 21887 return; 21888 } 21889 21890 itemLoad.run(); 21891 21892 $('.item').addClass("hide").viewportChecker({ 21893 classToAdd: 'visible animated fadeInUp', 21894 callbackFunction: function (elem) { 21895 21896 } 21897 }); 21898 21899 progressiveImages.init(); 21900 21901 }); 21902 21903 pageLoad.on('getPageDone', function () { 21904 imgPaths = []; 21905 21906 var imgs = $('body img'); 21907 21908 var randomColor = function(){ 21909 var random = Math.floor(Math.random() * (10 - 1 + 1)) + 1; 21910 $('body').removeClass(function (index, css) { 21911 return (css.match (/\belements-color-\S+/g) || []).join(' '); // removes anything that starts with "page-" 21912 }).addClass('elements-color-'+random); 21913 // return Math.floor(Math.random() * (10 - 1 + 1)) + 1; 21914 }; 21915 randomColor(); 21916 // $('body').addClass('elements-color-'+random()); 21917 21918 imgs.each(function () { 21919 var $this = $(this); 21920 imgPaths.push($this[0].src); 21921 }); 21922 21923 var pI = new ImagePreloader(imgPaths, imgs); 21924 pI.preLoadImages(); 21925 21926 newsList.init(); 21927 21928 projectSlider.init(); 21929 21930 projectSlider.run(); 21931 21932 techDepartment.toggle(); 21933 21934 // $.get( "/assets/copy/instagram.json", function( data ) { 21935 // ignoredImages = data; 21936 // // instafeedInit(); 21937 // }); 21938 21939 instagramSlider.init(); 21940 21941 video.init(); 21942 21943 msnry.layout(); 21944 21945 progressiveImages.init(); 21946 21947 21948 if ($('.masonry').hasClass('about')) { 21949 $claim = $('.claim'); 21950 $cite = $claim.find('.i--cite'); 21951 21952 if (layout.mobile) { 21953 $claim.find('.i--content').before($cite); 21954 msnry.layout(); 21955 } else { 21956 $claim.find('.i--content').after($cite); 21957 } 21958 21959 } 21960 21961 if (layout.fullhd && ($('.masonry').hasClass('list--projects') || $('.masonry').hasClass('list--news') || $('.masonry').hasClass('competences') || $('.masonry').hasClass('about'))) { 21962 $('#container').removeClass('project-content'); 21963 $('#container').addClass('project-content'); 21964 } else { 21965 21966 $('#container').removeClass('project-content'); 21967 } 21968 21969 $('#careers').find('.career2').on('click', function () { 21970 if ($(this).is('.contact')) return; 21971 21972 $content = $('#content'); 21973 21974 var href = $(this).find('.i__cont').attr('data-href'); 21975 21976 $.ajax({ 21977 url: href, 21978 type: 'GET', 21979 beforeSend: function () { 21980 $('#loader').show(); 21981 } 21982 }).done(function (data) { 21983 21984 var $data = $(data), 21985 $dataContent = $data.find('#content'); 21986 21987 $content.html($dataContent.html()); 21988 msnry.layout(); 21989 21990 $(document).trigger('imagesLoaded', [true]); 21991 21992 history.pushState({}, 'state', href); 21993 21994 $("#loader").fadeOut(500, function () { 21995 $(this).hide(); 21996 }); 21997 21998 }).fail(function (error) { 21999 console.log('wystapil error: ', error); 22000 }); 22001 }); 22002 runAccordions(); 22003 22004 }); 22005 22006 pageLoad.on('getPageNav', function (activeItemIndex1, activeItemIndex2) { 22007 sidebarNav.update(activeItemIndex1, activeItemIndex2); 22008 }); 22009 22010 pageLoad.on('getPageAnimationDone', function () { 22011 msnry.layout(); 22012 }); 22013 22014 pageLoad.on('changePageEvt', function (pathHistoryDetails, clickContext) { 22015 try { 22016 ga('send', 'event', clickContext, pathHistoryDetails); 22017 22018 } catch (error) { 22019 console.log('GA send event error: ', error); 22020 } 22021 runAccordions(); 22022 }); 22023 22024 msnry.on('layoutComplete', function () { 22025 22026 }); 22027 22028 newsList.on('afterInit', function () { 22029 msnry.layout(); 22030 }); 22031 22032 techDepartment.on('toggle', function () { 22033 msnry.layout(); 22034 }); 22035 22036 showMore.on('show', function (scrollPosition) {
22037 techDepartment.toggle(); 22038 msnry.layout(); 22039 $(window).scrollTop(scrollPosition); 22040 }); 22041 22042 layout.on('reload', function () { 22043 newsList.reload(); 22044 msnry.layout(); 22045 22046 if (layout.fullhd && ($('.masonry').hasClass('list--projects') || $('.masonry').hasClass('list--news') || $('.masonry').hasClass('competences') || $('.masonry').hasClass('about'))) { 22047 $('#container').removeClass('project-content'); 22048 $('#container').addClass('project-content'); 22049 } else { 22050 22051 $('#container').removeClass('project-content'); 22052 } 22053 22054 if ($('.masonry').hasClass('about')) { 22055 $claim = $('.claim'); 22056 $cite = $claim.find('.i--cite'); 22057 22058 if (layout.mobile) { 22059 $claim.find('.i--content').before($cite); 22060 msnry.layout(); 22061 } else { 22062 $claim.find('.i--content').after($cite); 22063 msnry.layout(); 22064 } 22065 } 22066 22067 }); 22068 runAccordions(); 22069 } 22070 function runAccordions(){ 22071 var acc = document.getElementsByClassName("accordion"); 22072 var i; 22073 var last; 22074 22075 for (i = 0; i < acc.length; i++) { 22076 22077 acc[i].addEventListener("click", function () { 22078 var activeParent = this.parentNode.classList.contains('active'); 22079 22080 if (activeParent) { 22081 this.parentNode.classList.remove('active'); 22082 } else { 22083 for (i = 0; i < acc.length; i++) { 22084 acc[i].parentElement.classList.remove('active') 22085 } 22086 22087 if (this.parentNode.classList.contains('active')) { 22088 this.parentNode.classList.remove('active'); 22089 } else { 22090 this.parentNode.classList.add('active'); 22091 } 22092 } 22093 }); 22094 } 22095 } 22096 var tiger; 22097 22098 function initTiger(callback) { 22099 22100 require(['tiger/app'], function (app) { 22101 tiger = window.tiger = app; 22102 }); 22103 22104 } 22105 22106 function init() { 22107 $(function () { 22108 $window = $(window); 22109 main(); 22110 }); 22111 } 22112 22113 if (!!window.initTiger) { 22114 initTiger(init); 22115 } 22116 else { 22117 init(); 22118 } 22119 22120}); 22121 22122define("main", function(){}); 22123
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.