vendor: 4,410 bytes, lines 1-182
1/*! 2 * jQuery JavaScript Library v1.12.3 3 * http://jquery.com/ 4 * 5 * Includes Sizzle.js 6 * http://sizzlejs.com/ 7 * 8 * Copyright jQuery Foundation and other contributors 9 * Released under the MIT license 10 * http://jquery.org/license 11 * 12 * Date: 2016-04-05T19:16Z 13 */ 14 15 16 17(function( global, factory ) { 18 19 if ( typeof module === "object" && typeof module.exports === "object" ) { 20 // For CommonJS and CommonJS-like environments where a proper `window` 21 // is present, execute the factory and get jQuery. 22 // For environments that do not have a `window` with a `document` 23 // (such as Node.js), expose a factory as module.exports. 24 // This accentuates the need for the creation of a real `window`. 25 // e.g. var jQuery = require("jquery")(window); 26 // See ticket #14549 for more info. 27 module.exports = global.document ? 28 factory( global, true ) : 29 function( w ) { 30 if ( !w.document ) { 31 throw new Error( "jQuery requires a window with a document" ); 32 } 33 return factory( w ); 34 }; 35 } else { 36 factory( global ); 37 } 38 39// Pass this if window is not defined yet 40}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 41 42// Support: Firefox 18+ 43// Can't be in strict mode, several libs including ASP.NET trace 44// the stack via arguments.caller.callee and Firefox dies if 45// you try to trace through "use strict" call chains. (#13335) 46//"use strict"; 47var deletedIds = []; 48 49var document = window.document; 50 51var slice = deletedIds.slice; 52 53var concat = deletedIds.concat; 54 55var push = deletedIds.push; 56 57var indexOf = deletedIds.indexOf; 58 59var class2type = {}; 60 61var toString = class2type.toString; 62 63var hasOwn = class2type.hasOwnProperty; 64 65var support = {}; 66 67 68 69var 70 version = "1.12.3", 71 72 // Define a local copy of jQuery 73 jQuery = function( selector, context ) { 74 75 // The jQuery object is actually just the init constructor 'enhanced' 76 // Need init if jQuery is called (just allow error to be thrown if not included) 77 return new jQuery.fn.init( selector, context ); 78 }, 79 80 // Support: Android<4.1, IE<9 81 // Make sure we trim BOM and NBSP 82 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, 83 84 // Matches dashed string for camelizing 85 rmsPrefix = /^-ms-/, 86 rdashAlpha = /-([\da-z])/gi, 87 88 // Used by jQuery.camelCase as callback to replace() 89 fcamelCase = function( all, letter ) { 90 return letter.toUpperCase(); 91 }; 92 93jQuery.fn = jQuery.prototype = { 94 95 // The current version of jQuery being used 96 jquery: version, 97 98 constructor: jQuery, 99 100 // Start with an empty selector 101 selector: "", 102 103 // The default length of a jQuery object is 0 104 length: 0, 105 106 toArray: function() { 107 return slice.call( this ); 108 }, 109 110 // Get the Nth element in the matched element set OR 111 // Get the whole matched element set as a clean array 112 get: function( num ) { 113 return num != null ? 114 115 // Return just the one element from the set 116 ( num < 0 ? this[ num + this.length ] : this[ num ] ) : 117 118 // Return all the elements in a clean array 119 slice.call( this ); 120 }, 121 122 // Take an array of elements and push it onto the stack 123 // (returning the new matched element set) 124 pushStack: function( elems ) { 125 126 // Build a new jQuery matched element set 127 var ret = jQuery.merge( this.constructor(), elems ); 128 129 // Add the old object onto the stack (as a reference) 130 ret.prevObject = this; 131 ret.context = this.context; 132 133 // Return the newly-formed element set 134 return ret; 135 }, 136 137 // Execute a callback for every element in the matched set. 138 each: function( callback ) { 139 return jQuery.each( this, callback ); 140 }, 141 142 map: function( callback ) { 143 return this.pushStack( jQuery.map( this, function( elem, i ) { 144 return callback.call( elem, i, elem ); 145 } ) ); 146 }, 147 148 slice: function() { 149 return this.pushStack( slice.apply( this, arguments ) ); 150 }, 151 152 first: function() { 153 return this.eq( 0 ); 154 }, 155 156 last: function() { 157 return this.eq( -1 ); 158 }, 159 160 eq: function( i ) { 161 var len = this.length, 162 j = +i + ( i < 0 ? len : 0 ); 163 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 164 }, 165 166 end: function() { 167 return this.prevObject || this.constructor(); 168 }, 169 170 // For internal use only. 171 // Behaves like an Array's method, not like a jQuery method. 172 push: push, 173 sort: deletedIds.sort, 174 splice: deletedIds.splice 175}; 176 177jQuery.extend = jQuery.fn.extend = function() { 178 var src, copyIsArray, copy, name, options, clone, 179 target = arguments[ 0 ] || {}, 180 i = 1, 181 length = arguments.length, 182 deep = false;
vendor: 8,863 bytes, lines 183-555
183 184 // Handle a deep copy situation 185 if ( typeof target === "boolean" ) { 186 deep = target; 187 188 // skip the boolean and the target 189 target = arguments[ i ] || {}; 190 i++; 191 } 192 193 // Handle case when target is a string or something (possible in deep copy) 194 if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { 195 target = {}; 196 } 197 198 // extend jQuery itself if only one argument is passed 199 if ( i === length ) { 200 target = this; 201 i--; 202 } 203 204 for ( ; i < length; i++ ) { 205 206 // Only deal with non-null/undefined values 207 if ( ( options = arguments[ i ] ) != null ) { 208 209 // Extend the base object 210 for ( name in options ) { 211 src = target[ name ]; 212 copy = options[ name ]; 213 214 // Prevent never-ending loop 215 if ( target === copy ) { 216 continue; 217 } 218 219 // Recurse if we're merging plain objects or arrays 220 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 221 ( copyIsArray = jQuery.isArray( copy ) ) ) ) { 222 223 if ( copyIsArray ) { 224 copyIsArray = false; 225 clone = src && jQuery.isArray( src ) ? src : []; 226 227 } else { 228 clone = src && jQuery.isPlainObject( src ) ? src : {}; 229 } 230 231 // Never move original objects, clone them 232 target[ name ] = jQuery.extend( deep, clone, copy ); 233 234 // Don't bring in undefined values 235 } else if ( copy !== undefined ) { 236 target[ name ] = copy; 237 } 238 } 239 } 240 } 241 242 // Return the modified object 243 return target; 244}; 245 246jQuery.extend( { 247 248 // Unique for each copy of jQuery on the page 249 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 250 251 // Assume jQuery is ready without the ready module 252 isReady: true, 253 254 error: function( msg ) { 255 throw new Error( msg ); 256 }, 257 258 noop: function() {}, 259 260 // See test/unit/core.js for details concerning isFunction. 261 // Since version 1.3, DOM methods and functions like alert 262 // aren't supported. They return false on IE (#2968). 263 isFunction: function( obj ) { 264 return jQuery.type( obj ) === "function"; 265 }, 266 267 isArray: Array.isArray || function( obj ) { 268 return jQuery.type( obj ) === "array"; 269 }, 270 271 isWindow: function( obj ) { 272 /* jshint eqeqeq: false */ 273 return obj != null && obj == obj.window; 274 }, 275 276 isNumeric: function( obj ) { 277 278 // parseFloat NaNs numeric-cast false positives (null|true|false|"") 279 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 280 // subtraction forces infinities to NaN 281 // adding 1 corrects loss of precision from parseFloat (#15100) 282 var realStringObj = obj && obj.toString(); 283 return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0; 284 }, 285 286 isEmptyObject: function( obj ) { 287 var name; 288 for ( name in obj ) { 289 return false; 290 } 291 return true; 292 }, 293 294 isPlainObject: function( obj ) { 295 var key; 296 297 // Must be an Object. 298 // Because of IE, we also have to check the presence of the constructor property. 299 // Make sure that DOM nodes and window objects don't pass through, as well 300 if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { 301 return false; 302 } 303 304 try { 305 306 // Not own constructor property must be Object 307 if ( obj.constructor && 308 !hasOwn.call( obj, "constructor" ) && 309 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { 310 return false; 311 } 312 } catch ( e ) { 313 314 // IE8,9 Will throw exceptions on certain host objects #9897 315 return false; 316 } 317 318 // Support: IE<9 319 // Handle iteration over inherited properties before own properties. 320 if ( !support.ownFirst ) { 321 for ( key in obj ) { 322 return hasOwn.call( obj, key ); 323 } 324 } 325 326 // Own properties are enumerated firstly, so to speed up, 327 // if last one is own, then all properties are own. 328 for ( key in obj ) {} 329 330 return key === undefined || hasOwn.call( obj, key ); 331 }, 332 333 type: function( obj ) { 334 if ( obj == null ) { 335 return obj + ""; 336 } 337 return typeof obj === "object" || typeof obj === "function" ? 338 class2type[ toString.call( obj ) ] || "object" : 339 typeof obj; 340 }, 341 342 // Workarounds based on findings by Jim Driscoll 343 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context 344 globalEval: function( data ) { 345 if ( data && jQuery.trim( data ) ) { 346 347 // We use execScript on Internet Explorer 348 // We use an anonymous function so that context is window 349 // rather than jQuery in Firefox 350 ( window.execScript || function( data ) { 351 window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation 352 } )( data ); 353 } 354 }, 355 356 // Convert dashed to camelCase; used by the css and data modules 357 // Microsoft forgot to hump their vendor prefix (#9572) 358 camelCase: function( string ) { 359 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 360 }, 361 362 nodeName: function( elem, name ) { 363 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 364 }, 365 366 each: function( obj, callback ) { 367 var length, i = 0; 368 369 if ( isArrayLike( obj ) ) { 370 length = obj.length; 371 for ( ; i < length; i++ ) { 372 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 373 break; 374 } 375 } 376 } else { 377 for ( i in obj ) { 378 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 379 break; 380 } 381 } 382 } 383 384 return obj; 385 }, 386 387 // Support: Android<4.1, IE<9 388 trim: function( text ) { 389 return text == null ? 390 "" : 391 ( text + "" ).replace( rtrim, "" ); 392 }, 393 394 // results is for internal usage only 395 makeArray: function( arr, results ) { 396 var ret = results || []; 397 398 if ( arr != null ) { 399 if ( isArrayLike( Object( arr ) ) ) { 400 jQuery.merge( ret, 401 typeof arr === "string" ? 402 [ arr ] : arr 403 ); 404 } else { 405 push.call( ret, arr ); 406 } 407 } 408 409 return ret; 410 }, 411 412 inArray: function( elem, arr, i ) { 413 var len; 414 415 if ( arr ) { 416 if ( indexOf ) { 417 return indexOf.call( arr, elem, i ); 418 } 419 420 len = arr.length; 421 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; 422 423 for ( ; i < len; i++ ) { 424 425 // Skip accessing in sparse arrays 426 if ( i in arr && arr[ i ] === elem ) { 427 return i; 428 } 429 } 430 } 431 432 return -1; 433 }, 434 435 merge: function( first, second ) { 436 var len = +second.length, 437 j = 0, 438 i = first.length; 439 440 while ( j < len ) { 441 first[ i++ ] = second[ j++ ]; 442 } 443 444 // Support: IE<9 445 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) 446 if ( len !== len ) { 447 while ( second[ j ] !== undefined ) { 448 first[ i++ ] = second[ j++ ]; 449 } 450 } 451 452 first.length = i; 453 454 return first; 455 }, 456 457 grep: function( elems, callback, invert ) { 458 var callbackInverse, 459 matches = [], 460 i = 0, 461 length = elems.length, 462 callbackExpect = !invert; 463 464 // Go through the array, only saving the items 465 // that pass the validator function 466 for ( ; i < length; i++ ) { 467 callbackInverse = !callback( elems[ i ], i ); 468 if ( callbackInverse !== callbackExpect ) { 469 matches.push( elems[ i ] ); 470 } 471 } 472 473 return matches; 474 }, 475 476 // arg is for internal usage only 477 map: function( elems, callback, arg ) { 478 var length, value, 479 i = 0, 480 ret = []; 481 482 // Go through the array, translating each of the items to their new values 483 if ( isArrayLike( elems ) ) { 484 length = elems.length; 485 for ( ; i < length; i++ ) { 486 value = callback( elems[ i ], i, arg ); 487 488 if ( value != null ) { 489 ret.push( value ); 490 } 491 } 492 493 // Go through every key on the object, 494 } else { 495 for ( i in elems ) { 496 value = callback( elems[ i ], i, arg ); 497 498 if ( value != null ) { 499 ret.push( value ); 500 } 501 } 502 } 503 504 // Flatten any nested arrays 505 return concat.apply( [], ret ); 506 }, 507 508 // A global GUID counter for objects 509 guid: 1, 510 511 // Bind a function to a context, optionally partially applying any 512 // arguments. 513 proxy: function( fn, context ) { 514 var args, proxy, tmp; 515 516 if ( typeof context === "string" ) { 517 tmp = fn[ context ]; 518 context = fn; 519 fn = tmp; 520 } 521 522 // Quick check to determine if target is callable, in the spec 523 // this throws a TypeError, but we will just return undefined. 524 if ( !jQuery.isFunction( fn ) ) { 525 return undefined; 526 } 527 528 // Simulated bind 529 args = slice.call( arguments, 2 ); 530 proxy = function() { 531 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 532 }; 533 534 // Set the guid of unique handler to the same of original handler, so it can be removed 535 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 536 537 return proxy; 538 }, 539 540 now: function() { 541 return +( new Date() ); 542 }, 543 544 // jQuery.support is not used in Core but other projects attach their 545 // properties to it so it needs to exist. 546 support: support 547} ); 548 549// JSHint would error on this code due to the Symbol not being defined in ES5. 550// Defining this global in .jshintrc would create a danger of using the global 551// unguarded in another place, it seems safer to just disable JSHint for these 552// three lines. 553/* jshint ignore: start */ 554if ( typeof Symbol === "function" ) { 555 jQuery.fn[ Symbol.iterator ] = deletedIds
vendor: 63,327 bytes, lines 555-2792
555[ Symbol.iterator ]; 556} 557/* jshint ignore: end */ 558 559// Populate the class2type map 560jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 561function( i, name ) { 562 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 563} ); 564 565function isArrayLike( obj ) { 566 567 // Support: iOS 8.2 (not reproducible in simulator) 568 // `in` check used to prevent JIT error (gh-2145) 569 // hasOwn isn't used here due to false negatives 570 // regarding Nodelist length in IE 571 var length = !!obj && "length" in obj && obj.length, 572 type = jQuery.type( obj ); 573 574 if ( type === "function" || jQuery.isWindow( obj ) ) { 575 return false; 576 } 577 578 return type === "array" || length === 0 || 579 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 580} 581var Sizzle = 582/*! 583 * Sizzle CSS Selector Engine v2.2.1 584 * http://sizzlejs.com/ 585 * 586 * Copyright jQuery Foundation and other contributors 587 * Released under the MIT license 588 * http://jquery.org/license 589 * 590 * Date: 2015-10-17 591 */ 592(function( window ) { 593 594var i, 595 support, 596 Expr, 597 getText, 598 isXML, 599 tokenize, 600 compile, 601 select, 602 outermostContext, 603 sortInput, 604 hasDuplicate, 605 606 // Local document vars 607 setDocument, 608 document, 609 docElem, 610 documentIsHTML, 611 rbuggyQSA, 612 rbuggyMatches, 613 matches, 614 contains, 615 616 // Instance-specific data 617 expando = "sizzle" + 1 * new Date(), 618 preferredDoc = window.document, 619 dirruns = 0, 620 done = 0, 621 classCache = createCache(), 622 tokenCache = createCache(), 623 compilerCache = createCache(), 624 sortOrder = function( a, b ) { 625 if ( a === b ) { 626 hasDuplicate = true; 627 } 628 return 0; 629 }, 630 631 // General-purpose constants 632 MAX_NEGATIVE = 1 << 31, 633 634 // Instance methods 635 hasOwn = ({}).hasOwnProperty, 636 arr = [], 637 pop = arr.pop, 638 push_native = arr.push, 639 push = arr.push, 640 slice = arr.slice, 641 // Use a stripped-down indexOf as it's faster than native 642 // http://jsperf.com/thor-indexof-vs-for/5 643 indexOf = function( list, elem ) { 644 var i = 0, 645 len = list.length; 646 for ( ; i < len; i++ ) { 647 if ( list[i] === elem ) { 648 return i; 649 } 650 } 651 return -1; 652 }, 653 654 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", 655 656 // Regular expressions 657 658 // http://www.w3.org/TR/css3-selectors/#whitespace 659 whitespace = "[\\x20\\t\\r\\n\\f]", 660 661 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier 662 identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", 663 664 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 665 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 666 // Operator (capture 2) 667 "*([*^$|!~]?=)" + whitespace + 668 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 669 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + 670 "*\\]", 671 672 pseudos = ":(" + identifier + ")(?:\\((" + 673 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 674 // 1. quoted (capture 3; capture 4 or capture 5) 675 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 676 // 2. simple (capture 6) 677 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 678 // 3. anything else (capture 2) 679 ".*" + 680 ")\\)|)", 681 682 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 683 rwhitespace = new RegExp( whitespace + "+", "g" ), 684 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), 685 686 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 687 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), 688 689 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), 690 691 rpseudo = new RegExp( pseudos ), 692 ridentifier = new RegExp( "^" + identifier + "$" ), 693 694 matchExpr = { 695 "ID": new RegExp( "^#(" + identifier + ")" ), 696 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 697 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 698 "ATTR": new RegExp( "^" + attributes ), 699 "PSEUDO": new RegExp( "^" + pseudos ), 700 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + 701 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + 702 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 703 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 704 // For use in libraries implementing .is() 705 // We use this for POS matching in `select` 706 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + 707 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 708 }, 709 710 rinputs = /^(?:input|select|textarea|button)$/i, 711 rheader = /^h\d$/i, 712 713 rnative = /^[^{]+\{\s*\[native \w/, 714 715 // Easily-parseable/retrievable ID or TAG or CLASS selectors 716 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 717 718 rsibling = /[+~]/, 719 rescape = /'|\\/g, 720 721 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 722 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), 723 funescape = function( _, escaped, escapedWhitespace ) { 724 var high = "0x" + escaped - 0x10000; 725 // NaN means non-codepoint 726 // Support: Firefox<24 727 // Workaround erroneous numeric interpretation of +"0x" 728 return high !== high || escapedWhitespace ? 729 escaped : 730 high < 0 ? 731 // BMP codepoint 732 String.fromCharCode( high + 0x10000 ) : 733 // Supplemental Plane codepoint (surrogate pair) 734 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 735 }, 736 737 // Used for iframes 738 // See setDocument() 739 // Removing the function wrapper causes a "Permission Denied" 740 // error in IE 741 unloadHandler = function() { 742 setDocument(); 743 }; 744 745// Optimize for push.apply( _, NodeList ) 746try { 747 push.apply( 748 (arr = slice.call( preferredDoc.childNodes )), 749 preferredDoc.childNodes 750 ); 751 // Support: Android<4.0 752 // Detect silently failing push.apply 753 arr[ preferredDoc.childNodes.length ].nodeType; 754} catch ( e ) { 755 push = { apply: arr.length ? 756 757 // Leverage slice if possible 758 function( target, els ) { 759 push_native.apply( target, slice.call(els) ); 760 } : 761 762 // Support: IE<9 763 // Otherwise append directly 764 function( target, els ) { 765 var j = target.length, 766 i = 0; 767 // Can't trust NodeList.length 768 while ( (target[j++] = els[i++]) ) {} 769 target.length = j - 1; 770 } 771 }; 772} 773 774function Sizzle( selector, context, results, seed ) { 775 var m, i, elem, nid, nidselect, match, groups, newSelector, 776 newContext = context && context.ownerDocument, 777 778 // nodeType defaults to 9, since context defaults to document 779 nodeType = context ? context.nodeType : 9; 780 781 results = results || []; 782 783 // Return early from calls with invalid selector or context 784 if ( typeof selector !== "string" || !selector || 785 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 786 787 return results; 788 } 789 790 // Try to shortcut find operations (as opposed to filters) in HTML documents 791 if ( !seed ) { 792 793 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { 794 setDocument( context ); 795 } 796 context = context || document; 797 798 if ( documentIsHTML ) { 799 800 // If the selector is sufficiently simple, try using a "get*By*" DOM method 801 // (excepting DocumentFragment context, where the methods don't exist) 802 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { 803 804 // ID selector 805 if ( (m = match[1]) ) { 806 807 // Document context 808 if ( nodeType === 9 ) { 809 if ( (elem = context.getElementById( m )) ) { 810 811 // Support: IE, Opera, Webkit 812 // TODO: identify versions 813 // getElementById can match elements by name instead of ID 814 if ( elem.id === m ) { 815 results.push( elem ); 816 return results; 817 } 818 } else { 819 return results; 820 } 821 822 // Element context 823 } else { 824 825 // Support: IE, Opera, Webkit 826 // TODO: identify versions 827 // getElementById can match elements by name instead of ID 828 if ( newContext && (elem = newContext.getElementById( m )) && 829 contains( context, elem ) && 830 elem.id === m ) { 831 832 results.push( elem ); 833 return results; 834 } 835 } 836 837 // Type selector 838 } else if ( match[2] ) { 839 push.apply( results, context.getElementsByTagName( selector ) ); 840 return results; 841 842 // Class selector 843 } else if ( (m = match[3]) && support.getElementsByClassName && 844 context.getElementsByClassName ) { 845 846 push.apply( results, context.getElementsByClassName( m ) ); 847 return results; 848 } 849 } 850 851 // Take advantage of querySelectorAll 852 if ( support.qsa && 853 !compilerCache[ selector + " " ] && 854 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { 855 856 if ( nodeType !== 1 ) { 857 newContext = context; 858 newSelector = selector; 859 860 // qSA looks outside Element context, which is not what we want 861 // Thanks to Andrew Dupont for this workaround technique 862 // Support: IE <=8 863 // Exclude object elements 864 } else if ( context.nodeName.toLowerCase() !== "object" ) { 865 866 // Capture the context ID, setting it first if necessary 867 if ( (nid = context.getAttribute( "id" )) ) { 868 nid = nid.replace( rescape, "\\$&" ); 869 } else { 870 context.setAttribute( "id", (nid = expando) ); 871 } 872 873 // Prefix every selector in the list 874 groups = tokenize( selector ); 875 i = groups.length; 876 nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']"; 877 while ( i-- ) { 878 groups[i] = nidselect + " " + toSelector( groups[i] ); 879 } 880 newSelector = groups.join( "," ); 881 882 // Expand context for sibling selectors 883 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 884 context; 885 } 886 887 if ( newSelector ) { 888 try { 889 push.apply( results, 890 newContext.querySelectorAll( newSelector ) 891 ); 892 return results; 893 } catch ( qsaError ) { 894 } finally { 895 if ( nid === expando ) { 896 context.removeAttribute( "id" ); 897 } 898 } 899 } 900 } 901 } 902 } 903 904 // All others 905 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 906} 907 908/** 909 * Create key-value caches of limited size 910 * @returns {function(string, object)} Returns the Object data after storing it on itself with 911 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 912 * deleting the oldest entry 913 */ 914function createCache() { 915 var keys = []; 916 917 function cache( key, value ) { 918 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 919 if ( keys.push( key + " " ) > Expr.cacheLength ) { 920 // Only keep the most recent entries 921 delete cache[ keys.shift() ]; 922 } 923 return (cache[ key + " " ] = value); 924 } 925 return cache; 926} 927 928/** 929 * Mark a function for special use by Sizzle 930 * @param {Function} fn The function to mark 931 */ 932function markFunction( fn ) { 933 fn[ expando ] = true; 934 return fn; 935} 936 937/** 938 * Support testing using an element 939 * @param {Function} fn Passed the created div and expects a boolean result 940 */ 941function assert( fn ) { 942 var div = document.createElement("div"); 943 944 try { 945 return !!fn( div ); 946 } catch (e) { 947 return false; 948 } finally { 949 // Remove from its parent by default 950 if ( div.parentNode ) { 951 div.parentNode.removeChild( div ); 952 } 953 // release memory in IE 954 div = null; 955 } 956} 957 958/** 959 * Adds the same handler for all of the specified attrs 960 * @param {String} attrs Pipe-separated list of attributes 961 * @param {Function} handler The method that will be applied 962 */ 963function addHandle( attrs, handler ) { 964 var arr = attrs.split("|"), 965 i = arr.length; 966 967 while ( i-- ) { 968 Expr.attrHandle[ arr[i] ] = handler; 969 } 970} 971 972/** 973 * Checks document order of two siblings 974 * @param {Element} a 975 * @param {Element} b 976 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 977 */ 978function siblingCheck( a, b ) { 979 var cur = b && a, 980 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 981 ( ~b.sourceIndex || MAX_NEGATIVE ) - 982 ( ~a.sourceIndex || MAX_NEGATIVE ); 983 984 // Use IE sourceIndex if available on both nodes 985 if ( diff ) { 986 return diff; 987 } 988 989 // Check if b follows a 990 if ( cur ) { 991 while ( (cur = cur.nextSibling) ) { 992 if ( cur === b ) { 993 return -1; 994 } 995 } 996 } 997 998 return a ? 1 : -1; 999} 1000 1001/** 1002 * Returns a function to use in pseudos for input types 1003 * @param {String} type 1004 */ 1005function createInputPseudo( type ) { 1006 return function( elem ) { 1007 var name = elem.nodeName.toLowerCase(); 1008 return name === "input" && elem.type === type; 1009 }; 1010} 1011 1012/** 1013 * Returns a function to use in pseudos for buttons 1014 * @param {String} type 1015 */ 1016function createButtonPseudo( type ) { 1017 return function( elem ) { 1018 var name = elem.nodeName.toLowerCase(); 1019 return (name === "input" || name === "button") && elem.type === type; 1020 }; 1021} 1022 1023/** 1024 * Returns a function to use in pseudos for positionals 1025 * @param {Function} fn 1026 */ 1027function createPositionalPseudo( fn ) { 1028 return markFunction(function( argument ) { 1029 argument = +argument; 1030 return markFunction(function( seed, matches ) { 1031 var j, 1032 matchIndexes = fn( [], seed.length, argument ), 1033 i = matchIndexes.length; 1034 1035 // Match elements found at the specified indexes 1036 while ( i-- ) { 1037 if ( seed[ (j = matchIndexes[i]) ] ) { 1038 seed[j] = !(matches[j] = seed[j]); 1039 } 1040 } 1041 }); 1042 }); 1043} 1044 1045/** 1046 * Checks a node for validity as a Sizzle context 1047 * @param {Element|Object=} context 1048 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1049 */ 1050function testContext( context ) { 1051 return context && typeof context.getElementsByTagName !== "undefined" && context; 1052} 1053 1054// Expose support vars for convenience 1055support = Sizzle.support = {}; 1056 1057/** 1058 * Detects XML nodes 1059 * @param {Element|Object} elem An element or a document 1060 * @returns {Boolean} True iff elem is a non-HTML XML node 1061 */ 1062isXML = Sizzle.isXML = function( elem ) { 1063 // documentElement is verified for cases where it doesn't yet exist 1064 // (such as loading iframes in IE - #4833) 1065 var documentElement = elem && (elem.ownerDocument || elem).documentElement; 1066 return documentElement ? documentElement.nodeName !== "HTML" : false; 1067}; 1068 1069/** 1070 * Sets document-related variables once based on the current document 1071 * @param {Element|Object} [doc] An element or document object to use to set the document 1072 * @returns {Object} Returns the current document 1073 */ 1074setDocument = Sizzle.setDocument = function( node ) { 1075 var hasCompare, parent, 1076 doc = node ? node.ownerDocument || node : preferredDoc; 1077 1078 // Return early if doc is invalid or already selected 1079 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { 1080 return document; 1081 } 1082 1083 // Update global variables 1084 document = doc; 1085 docElem = document.documentElement; 1086 documentIsHTML = !isXML( document ); 1087 1088 // Support: IE 9-11, Edge 1089 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 1090 if ( (parent = document.defaultView) && parent.top !== parent ) { 1091 // Support: IE 11 1092 if ( parent.addEventListener ) { 1093 parent.addEventListener( "unload", unloadHandler, false ); 1094 1095 // Support: IE 9 - 10 only 1096 } else if ( parent.attachEvent ) { 1097 parent.attachEvent( "onunload", unloadHandler ); 1098 } 1099 } 1100 1101 /* Attributes 1102 ---------------------------------------------------------------------- */ 1103 1104 // Support: IE<8 1105 // Verify that getAttribute really returns attributes and not properties 1106 // (excepting IE8 booleans) 1107 support.attributes = assert(function( div ) { 1108 div.className = "i"; 1109 return !div.getAttribute("className"); 1110 }); 1111 1112 /* getElement(s)By* 1113 ---------------------------------------------------------------------- */ 1114 1115 // Check if getElementsByTagName("*") returns only elements 1116 support.getElementsByTagName = assert(function( div ) { 1117 div.appendChild( document.createComment("") ); 1118 return !div.getElementsByTagName("*").length; 1119 }); 1120 1121 // Support: IE<9 1122 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 1123 1124 // Support: IE<10 1125 // Check if getElementById returns elements by name 1126 // The broken getElementById methods don't pick up programatically-set names, 1127 // so use a roundabout getElementsByName test 1128 support.getById = assert(function( div ) { 1129 docElem.appendChild( div ).id = expando; 1130 return !document.getElementsByName || !document.getElementsByName( expando ).length; 1131 }); 1132 1133 // ID find and filter 1134 if ( support.getById ) { 1135 Expr.find["ID"] = function( id, context ) { 1136 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1137 var m = context.getElementById( id ); 1138 return m ? [ m ] : []; 1139 } 1140 }; 1141 Expr.filter["ID"] = function( id ) { 1142 var attrId = id.replace( runescape, funescape ); 1143 return function( elem ) { 1144 return elem.getAttribute("id") === attrId; 1145 }; 1146 }; 1147 } else { 1148 // Support: IE6/7 1149 // getElementById is not reliable as a find shortcut 1150 delete Expr.find["ID"]; 1151 1152 Expr.filter["ID"] = function( id ) { 1153 var attrId = id.replace( runescape, funescape ); 1154 return function( elem ) { 1155 var node = typeof elem.getAttributeNode !== "undefined" && 1156 elem.getAttributeNode("id"); 1157 return node && node.value === attrId; 1158 }; 1159 }; 1160 } 1161 1162 // Tag 1163 Expr.find["TAG"] = support.getElementsByTagName ? 1164 function( tag, context ) { 1165 if ( typeof context.getElementsByTagName !== "undefined" ) { 1166 return context.getElementsByTagName( tag ); 1167 1168 // DocumentFragment nodes don't have gEBTN 1169 } else if ( support.qsa ) { 1170 return context.querySelectorAll( tag ); 1171 } 1172 } : 1173 1174 function( tag, context ) { 1175 var elem, 1176 tmp = [], 1177 i = 0, 1178 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 1179 results = context.getElementsByTagName( tag ); 1180 1181 // Filter out possible comments 1182 if ( tag === "*" ) { 1183 while ( (elem = results[i++]) ) { 1184 if ( elem.nodeType === 1 ) { 1185 tmp.push( elem ); 1186 } 1187 } 1188 1189 return tmp; 1190 } 1191 return results; 1192 }; 1193 1194 // Class 1195 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { 1196 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 1197 return context.getElementsByClassName( className ); 1198 } 1199 }; 1200 1201 /* QSA/matchesSelector 1202 ---------------------------------------------------------------------- */ 1203 1204 // QSA and matchesSelector support 1205 1206 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 1207 rbuggyMatches = []; 1208 1209 // qSa(:focus) reports false when true (Chrome 21) 1210 // We allow this because of a bug in IE8/9 that throws an error 1211 // whenever `document.activeElement` is accessed on an iframe 1212 // So, we allow :focus to pass through QSA all the time to avoid the IE error 1213 // See http://bugs.jquery.com/ticket/13378 1214 rbuggyQSA = []; 1215 1216 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { 1217 // Build QSA regex 1218 // Regex strategy adopted from Diego Perini 1219 assert(function( div ) { 1220 // Select is set to empty string on purpose 1221 // This is to test IE's treatment of not explicitly 1222 // setting a boolean content attribute, 1223 // since its presence should be enough 1224 // http://bugs.jquery.com/ticket/12359 1225 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" + 1226 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 1227 "<option selected=''></option></select>"; 1228 1229 // Support: IE8, Opera 11-12.16 1230 // Nothing should be selected when empty strings follow ^= or $= or *= 1231 // The test attribute must be unknown in Opera but "safe" for WinRT 1232 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 1233 if ( div.querySelectorAll("[msallowcapture^='']").length ) { 1234 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 1235 } 1236 1237 // Support: IE8 1238 // Boolean attributes and "value" are not treated correctly 1239 if ( !div.querySelectorAll("[selected]").length ) { 1240 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1241 } 1242 1243 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 1244 if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 1245 rbuggyQSA.push("~="); 1246 } 1247 1248 // Webkit/Opera - :checked should return selected option elements 1249 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1250 // IE8 throws error here and will not see later tests 1251 if ( !div.querySelectorAll(":checked").length ) { 1252 rbuggyQSA.push(":checked"); 1253 } 1254 1255 // Support: Safari 8+, iOS 8+ 1256 // https://bugs.webkit.org/show_bug.cgi?id=136851 1257 // In-page `selector#id sibing-combinator selector` fails 1258 if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { 1259 rbuggyQSA.push(".#.+[+~]"); 1260 } 1261 }); 1262 1263 assert(function( div ) { 1264 // Support: Windows 8 Native Apps 1265 // The type and name attributes are restricted during .innerHTML assignment 1266 var input = document.createElement("input"); 1267 input.setAttribute( "type", "hidden" ); 1268 div.appendChild( input ).setAttribute( "name", "D" ); 1269 1270 // Support: IE8 1271 // Enforce case-sensitivity of name attribute 1272 if ( div.querySelectorAll("[name=d]").length ) { 1273 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 1274 } 1275 1276 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 1277 // IE8 throws error here and will not see later tests 1278 if ( !div.querySelectorAll(":enabled").length ) { 1279 rbuggyQSA.push( ":enabled", ":disabled" ); 1280 } 1281 1282 // Opera 10-11 does not throw on post-comma invalid pseudos 1283 div.querySelectorAll("*,:x"); 1284 rbuggyQSA.push(",.*:"); 1285 }); 1286 } 1287 1288 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || 1289 docElem.webkitMatchesSelector || 1290 docElem.mozMatchesSelector || 1291 docElem.oMatchesSelector || 1292 docElem.msMatchesSelector) )) ) { 1293 1294 assert(function( div ) { 1295 // Check to see if it's possible to do matchesSelector 1296 // on a disconnected node (IE 9) 1297 support.disconnectedMatch = matches.call( div, "div" ); 1298 1299 // This should fail with an exception 1300 // Gecko does not error, returns false instead 1301 matches.call( div, "[s!='']:x" ); 1302 rbuggyMatches.push( "!=", pseudos ); 1303 }); 1304 } 1305 1306 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); 1307 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); 1308 1309 /* Contains 1310 ---------------------------------------------------------------------- */ 1311 hasCompare = rnative.test( docElem.compareDocumentPosition ); 1312 1313 // Element contains another 1314 // Purposefully self-exclusive 1315 // As in, an element does not contain itself 1316 contains = hasCompare || rnative.test( docElem.contains ) ? 1317 function( a, b ) { 1318 var adown = a.nodeType === 9 ? a.documentElement : a, 1319 bup = b && b.parentNode; 1320 return a === bup || !!( bup && bup.nodeType === 1 && ( 1321 adown.contains ? 1322 adown.contains( bup ) : 1323 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 1324 )); 1325 } : 1326 function( a, b ) { 1327 if ( b ) { 1328 while ( (b = b.parentNode) ) { 1329 if ( b === a ) { 1330 return true; 1331 } 1332 } 1333 } 1334 return false; 1335 }; 1336 1337 /* Sorting 1338 ---------------------------------------------------------------------- */ 1339 1340 // Document order sorting 1341 sortOrder = hasCompare ? 1342 function( a, b ) { 1343 1344 // Flag for duplicate removal 1345 if ( a === b ) { 1346 hasDuplicate = true; 1347 return 0; 1348 } 1349 1350 // Sort on method existence if only one input has compareDocumentPosition 1351 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1352 if ( compare ) { 1353 return compare; 1354 } 1355 1356 // Calculate position if both inputs belong to the same document 1357 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? 1358 a.compareDocumentPosition( b ) : 1359 1360 // Otherwise we know they are disconnected 1361 1; 1362 1363 // Disconnected nodes 1364 if ( compare & 1 || 1365 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { 1366 1367 // Choose the first element that is related to our preferred document 1368 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { 1369 return -1; 1370 } 1371 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { 1372 return 1; 1373 } 1374 1375 // Maintain original order 1376 return sortInput ? 1377 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1378 0; 1379 } 1380 1381 return compare & 4 ? -1 : 1; 1382 } : 1383 function( a, b ) { 1384 // Exit early if the nodes are identical 1385 if ( a === b ) { 1386 hasDuplicate = true; 1387 return 0; 1388 } 1389 1390 var cur, 1391 i = 0, 1392 aup = a.parentNode, 1393 bup = b.parentNode, 1394 ap = [ a ], 1395 bp = [ b ]; 1396 1397 // Parentless nodes are either documents or disconnected 1398 if ( !aup || !bup ) { 1399 return a === document ? -1 : 1400 b === document ? 1 : 1401 aup ? -1 : 1402 bup ? 1 : 1403 sortInput ? 1404 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1405 0; 1406 1407 // If the nodes are siblings, we can do a quick check 1408 } else if ( aup === bup ) { 1409 return siblingCheck( a, b ); 1410 } 1411 1412 // Otherwise we need full lists of their ancestors for comparison 1413 cur = a; 1414 while ( (cur = cur.parentNode) ) { 1415 ap.unshift( cur ); 1416 } 1417 cur = b; 1418 while ( (cur = cur.parentNode) ) { 1419 bp.unshift( cur ); 1420 } 1421 1422 // Walk down the tree looking for a discrepancy 1423 while ( ap[i] === bp[i] ) { 1424 i++; 1425 } 1426 1427 return i ? 1428 // Do a sibling check if the nodes have a common ancestor 1429 siblingCheck( ap[i], bp[i] ) : 1430 1431 // Otherwise nodes in our document sort first 1432 ap[i] === preferredDoc ? -1 : 1433 bp[i] === preferredDoc ? 1 : 1434 0; 1435 }; 1436 1437 return document; 1438}; 1439 1440Sizzle.matches = function( expr, elements ) { 1441 return Sizzle( expr, null, null, elements ); 1442}; 1443 1444Sizzle.matchesSelector = function( elem, expr ) { 1445 // Set document vars if needed 1446 if ( ( elem.ownerDocument || elem ) !== document ) { 1447 setDocument( elem ); 1448 } 1449 1450 // Make sure that attribute selectors are quoted 1451 expr = expr.replace( rattributeQuotes, "='$1']" ); 1452 1453 if ( support.matchesSelector && documentIsHTML && 1454 !compilerCache[ expr + " " ] && 1455 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 1456 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1457 1458 try { 1459 var ret = matches.call( elem, expr ); 1460 1461 // IE 9's matchesSelector returns false on disconnected nodes 1462 if ( ret || support.disconnectedMatch || 1463 // As well, disconnected nodes are said to be in a document 1464 // fragment in IE 9 1465 elem.document && elem.document.nodeType !== 11 ) { 1466 return ret; 1467 } 1468 } catch (e) {} 1469 } 1470 1471 return Sizzle( expr, document, null, [ elem ] ).length > 0; 1472}; 1473 1474Sizzle.contains = function( context, elem ) { 1475 // Set document vars if needed 1476 if ( ( context.ownerDocument || context ) !== document ) { 1477 setDocument( context ); 1478 } 1479 return contains( context, elem ); 1480}; 1481 1482Sizzle.attr = function( elem, name ) { 1483 // Set document vars if needed 1484 if ( ( elem.ownerDocument || elem ) !== document ) { 1485 setDocument( elem ); 1486 } 1487 1488 var fn = Expr.attrHandle[ name.toLowerCase() ], 1489 // Don't get fooled by Object.prototype properties (jQuery #13807) 1490 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1491 fn( elem, name, !documentIsHTML ) : 1492 undefined; 1493 1494 return val !== undefined ? 1495 val : 1496 support.attributes || !documentIsHTML ? 1497 elem.getAttribute( name ) : 1498 (val = elem.getAttributeNode(name)) && val.specified ? 1499 val.value : 1500 null; 1501}; 1502 1503Sizzle.error = function( msg ) { 1504 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1505}; 1506 1507/** 1508 * Document sorting and removing duplicates 1509 * @param {ArrayLike} results 1510 */ 1511Sizzle.uniqueSort = function( results ) { 1512 var elem, 1513 duplicates = [], 1514 j = 0, 1515 i = 0; 1516 1517 // Unless we *know* we can detect duplicates, assume their presence 1518 hasDuplicate = !support.detectDuplicates; 1519 sortInput = !support.sortStable && results.slice( 0 ); 1520 results.sort( sortOrder ); 1521 1522 if ( hasDuplicate ) { 1523 while ( (elem = results[i++]) ) { 1524 if ( elem === results[ i ] ) { 1525 j = duplicates.push( i ); 1526 } 1527 } 1528 while ( j-- ) { 1529 results.splice( duplicates[ j ], 1 ); 1530 } 1531 } 1532 1533 // Clear input after sorting to release objects 1534 // See https://github.com/jquery/sizzle/pull/225 1535 sortInput = null; 1536 1537 return results; 1538}; 1539 1540/** 1541 * Utility function for retrieving the text value of an array of DOM nodes 1542 * @param {Array|Element} elem 1543 */ 1544getText = Sizzle.getText = function( elem ) { 1545 var node, 1546 ret = "", 1547 i = 0, 1548 nodeType = elem.nodeType; 1549 1550 if ( !nodeType ) { 1551 // If no nodeType, this is expected to be an array 1552 while ( (node = elem[i++]) ) { 1553 // Do not traverse comment nodes 1554 ret += getText( node ); 1555 } 1556 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 1557 // Use textContent for elements 1558 // innerText usage removed for consistency of new lines (jQuery #11153) 1559 if ( typeof elem.textContent === "string" ) { 1560 return elem.textContent; 1561 } else { 1562 // Traverse its children 1563 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 1564 ret += getText( elem ); 1565 } 1566 } 1567 } else if ( nodeType === 3 || nodeType === 4 ) { 1568 return elem.nodeValue; 1569 } 1570 // Do not include comment or processing instruction nodes 1571 1572 return ret; 1573}; 1574 1575Expr = Sizzle.selectors = { 1576 1577 // Can be adjusted by the user 1578 cacheLength: 50, 1579 1580 createPseudo: markFunction, 1581 1582 match: matchExpr, 1583 1584 attrHandle: {}, 1585 1586 find: {}, 1587 1588 relative: { 1589 ">": { dir: "parentNode", first: true }, 1590 " ": { dir: "parentNode" }, 1591 "+": { dir: "previousSibling", first: true }, 1592 "~": { dir: "previousSibling" } 1593 }, 1594 1595 preFilter: { 1596 "ATTR": function( match ) { 1597 match[1] = match[1].replace( runescape, funescape ); 1598 1599 // Move the given value to match[3] whether quoted or unquoted 1600 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); 1601 1602 if ( match[2] === "~=" ) { 1603 match[3] = " " + match[3] + " "; 1604 } 1605 1606 return match.slice( 0, 4 ); 1607 }, 1608 1609 "CHILD": function( match ) { 1610 /* matches from matchExpr["CHILD"] 1611 1 type (only|nth|...) 1612 2 what (child|of-type) 1613 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1614 4 xn-component of xn+y argument ([+-]?\d*n|) 1615 5 sign of xn-component 1616 6 x of xn-component 1617 7 sign of y-component 1618 8 y of y-component 1619 */ 1620 match[1] = match[1].toLowerCase(); 1621 1622 if ( match[1].slice( 0, 3 ) === "nth" ) { 1623 // nth-* requires argument 1624 if ( !match[3] ) { 1625 Sizzle.error( match[0] ); 1626 } 1627 1628 // numeric x and y parameters for Expr.filter.CHILD 1629 // remember that false/true cast respectively to 0/1 1630 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); 1631 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); 1632 1633 // other types prohibit arguments 1634 } else if ( match[3] ) { 1635 Sizzle.error( match[0] ); 1636 } 1637 1638 return match; 1639 }, 1640 1641 "PSEUDO": function( match ) { 1642 var excess, 1643 unquoted = !match[6] && match[2]; 1644 1645 if ( matchExpr["CHILD"].test( match[0] ) ) { 1646 return null; 1647 } 1648 1649 // Accept quoted arguments as-is 1650 if ( match[3] ) { 1651 match[2] = match[4] || match[5] || ""; 1652 1653 // Strip excess characters from unquoted arguments 1654 } else if ( unquoted && rpseudo.test( unquoted ) && 1655 // Get excess from tokenize (recursively) 1656 (excess = tokenize( unquoted, true )) && 1657 // advance to the next closing parenthesis 1658 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { 1659 1660 // excess is a negative index 1661 match[0] = match[0].slice( 0, excess ); 1662 match[2] = unquoted.slice( 0, excess ); 1663 } 1664 1665 // Return only captures needed by the pseudo filter method (type and argument) 1666 return match.slice( 0, 3 ); 1667 } 1668 }, 1669 1670 filter: { 1671 1672 "TAG": function( nodeNameSelector ) { 1673 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1674 return nodeNameSelector === "*" ? 1675 function() { return true; } : 1676 function( elem ) { 1677 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 1678 }; 1679 }, 1680 1681 "CLASS": function( className ) { 1682 var pattern = classCache[ className + " " ]; 1683 1684 return pattern || 1685 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && 1686 classCache( className, function( elem ) { 1687 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); 1688 }); 1689 }, 1690 1691 "ATTR": function( name, operator, check ) { 1692 return function( elem ) { 1693 var result = Sizzle.attr( elem, name ); 1694 1695 if ( result == null ) { 1696 return operator === "!="; 1697 } 1698 if ( !operator ) { 1699 return true; 1700 } 1701 1702 result += ""; 1703 1704 return operator === "=" ? result === check : 1705 operator === "!=" ? result !== check : 1706 operator === "^=" ? check && result.indexOf( check ) === 0 : 1707 operator === "*=" ? check && result.indexOf( check ) > -1 : 1708 operator === "$=" ? check && result.slice( -check.length ) === check : 1709 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 1710 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 1711 false; 1712 }; 1713 }, 1714 1715 "CHILD": function( type, what, argument, first, last ) { 1716 var simple = type.slice( 0, 3 ) !== "nth", 1717 forward = type.slice( -4 ) !== "last", 1718 ofType = what === "of-type"; 1719 1720 return first === 1 && last === 0 ? 1721 1722 // Shortcut for :nth-*(n) 1723 function( elem ) { 1724 return !!elem.parentNode; 1725 } : 1726 1727 function( elem, context, xml ) { 1728 var cache, uniqueCache, outerCache, node, nodeIndex, start, 1729 dir = simple !== forward ? "nextSibling" : "previousSibling", 1730 parent = elem.parentNode, 1731 name = ofType && elem.nodeName.toLowerCase(), 1732 useCache = !xml && !ofType, 1733 diff = false; 1734 1735 if ( parent ) { 1736 1737 // :(first|last|only)-(child|of-type) 1738 if ( simple ) { 1739 while ( dir ) { 1740 node = elem; 1741 while ( (node = node[ dir ]) ) { 1742 if ( ofType ? 1743 node.nodeName.toLowerCase() === name : 1744 node.nodeType === 1 ) { 1745 1746 return false; 1747 } 1748 } 1749 // Reverse direction for :only-* (if we haven't yet done so) 1750 start = dir = type === "only" && !start && "nextSibling"; 1751 } 1752 return true; 1753 } 1754 1755 start = [ forward ? parent.firstChild : parent.lastChild ]; 1756 1757 // non-xml :nth-child(...) stores cache data on `parent` 1758 if ( forward && useCache ) { 1759 1760 // Seek `elem` from a previously-cached index 1761 1762 // ...in a gzip-friendly way 1763 node = parent; 1764 outerCache = node[ expando ] || (node[ expando ] = {}); 1765 1766 // Support: IE <9 only 1767 // Defend against cloned attroperties (jQuery gh-1709) 1768 uniqueCache = outerCache[ node.uniqueID ] || 1769 (outerCache[ node.uniqueID ] = {}); 1770 1771 cache = uniqueCache[ type ] || []; 1772 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1773 diff = nodeIndex && cache[ 2 ]; 1774 node = nodeIndex && parent.childNodes[ nodeIndex ]; 1775 1776 while ( (node = ++nodeIndex && node && node[ dir ] || 1777 1778 // Fallback to seeking `elem` from the start 1779 (diff = nodeIndex = 0) || start.pop()) ) { 1780 1781 // When found, cache indexes on `parent` and break 1782 if ( node.nodeType === 1 && ++diff && node === elem ) { 1783 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 1784 break; 1785 } 1786 } 1787 1788 } else { 1789 // Use previously-cached element index if available 1790 if ( useCache ) { 1791 // ...in a gzip-friendly way 1792 node = elem; 1793 outerCache = node[ expando ] || (node[ expando ] = {}); 1794 1795 // Support: IE <9 only 1796 // Defend against cloned attroperties (jQuery gh-1709) 1797 uniqueCache = outerCache[ node.uniqueID ] || 1798 (outerCache[ node.uniqueID ] = {}); 1799 1800 cache = uniqueCache[ type ] || []; 1801 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1802 diff = nodeIndex; 1803 } 1804 1805 // xml :nth-child(...) 1806 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 1807 if ( diff === false ) { 1808 // Use the same loop as above to seek `elem` from the start 1809 while ( (node = ++nodeIndex && node && node[ dir ] || 1810 (diff = nodeIndex = 0) || start.pop()) ) { 1811 1812 if ( ( ofType ? 1813 node.nodeName.toLowerCase() === name : 1814 node.nodeType === 1 ) && 1815 ++diff ) { 1816 1817 // Cache the index of each encountered element 1818 if ( useCache ) { 1819 outerCache = node[ expando ] || (node[ expando ] = {}); 1820 1821 // Support: IE <9 only 1822 // Defend against cloned attroperties (jQuery gh-1709) 1823 uniqueCache = outerCache[ node.uniqueID ] || 1824 (outerCache[ node.uniqueID ] = {}); 1825 1826 uniqueCache[ type ] = [ dirruns, diff ]; 1827 } 1828 1829 if ( node === elem ) { 1830 break; 1831 } 1832 } 1833 } 1834 } 1835 } 1836 1837 // Incorporate the offset, then check against cycle size 1838 diff -= last; 1839 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 1840 } 1841 }; 1842 }, 1843 1844 "PSEUDO": function( pseudo, argument ) { 1845 // pseudo-class names are case-insensitive 1846 // http://www.w3.org/TR/selectors/#pseudo-classes 1847 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 1848 // Remember that setFilters inherits from pseudos 1849 var args, 1850 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 1851 Sizzle.error( "unsupported pseudo: " + pseudo ); 1852 1853 // The user may use createPseudo to indicate that 1854 // arguments are needed to create the filter function 1855 // just as Sizzle does 1856 if ( fn[ expando ] ) { 1857 return fn( argument ); 1858 } 1859 1860 // But maintain support for old signatures 1861 if ( fn.length > 1 ) { 1862 args = [ pseudo, pseudo, "", argument ]; 1863 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 1864 markFunction(function( seed, matches ) { 1865 var idx, 1866 matched = fn( seed, argument ), 1867 i = matched.length; 1868 while ( i-- ) { 1869 idx = indexOf( seed, matched[i] ); 1870 seed[ idx ] = !( matches[ idx ] = matched[i] ); 1871 } 1872 }) : 1873 function( elem ) { 1874 return fn( elem, 0, args ); 1875 }; 1876 } 1877 1878 return fn; 1879 } 1880 }, 1881 1882 pseudos: { 1883 // Potentially complex pseudos 1884 "not": markFunction(function( selector ) { 1885 // Trim the selector passed to compile 1886 // to avoid treating leading and trailing 1887 // spaces as combinators 1888 var input = [], 1889 results = [], 1890 matcher = compile( selector.replace( rtrim, "$1" ) ); 1891 1892 return matcher[ expando ] ? 1893 markFunction(function( seed, matches, context, xml ) { 1894 var elem, 1895 unmatched = matcher( seed, null, xml, [] ), 1896 i = seed.length; 1897 1898 // Match elements unmatched by `matcher` 1899 while ( i-- ) { 1900 if ( (elem = unmatched[i]) ) { 1901 seed[i] = !(matches[i] = elem); 1902 } 1903 } 1904 }) : 1905 function( elem, context, xml ) { 1906 input[0] = elem; 1907 matcher( input, null, xml, results ); 1908 // Don't keep the element (issue #299) 1909 input[0] = null; 1910 return !results.pop(); 1911 }; 1912 }), 1913 1914 "has": markFunction(function( selector ) { 1915 return function( elem ) { 1916 return Sizzle( selector, elem ).length > 0; 1917 }; 1918 }), 1919 1920 "contains": markFunction(function( text ) { 1921 text = text.replace( runescape, funescape ); 1922 return function( elem ) { 1923 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; 1924 }; 1925 }), 1926 1927 // "Whether an element is represented by a :lang() selector 1928 // is based solely on the element's language value 1929 // being equal to the identifier C, 1930 // or beginning with the identifier C immediately followed by "-". 1931 // The matching of C against the element's language value is performed case-insensitively. 1932 // The identifier C does not have to be a valid language name." 1933 // http://www.w3.org/TR/selectors/#lang-pseudo 1934 "lang": markFunction( function( lang ) { 1935 // lang value must be a valid identifier 1936 if ( !ridentifier.test(lang || "") ) { 1937 Sizzle.error( "unsupported lang: " + lang ); 1938 } 1939 lang = lang.replace( runescape, funescape ).toLowerCase(); 1940 return function( elem ) { 1941 var elemLang; 1942 do { 1943 if ( (elemLang = documentIsHTML ? 1944 elem.lang : 1945 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { 1946 1947 elemLang = elemLang.toLowerCase(); 1948 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 1949 } 1950 } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); 1951 return false; 1952 }; 1953 }), 1954 1955 // Miscellaneous 1956 "target": function( elem ) { 1957 var hash = window.location && window.location.hash; 1958 return hash && hash.slice( 1 ) === elem.id; 1959 }, 1960 1961 "root": function( elem ) { 1962 return elem === docElem; 1963 }, 1964 1965 "focus": function( elem ) { 1966 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); 1967 }, 1968 1969 // Boolean properties 1970 "enabled": function( elem ) { 1971 return elem.disabled === false; 1972 }, 1973 1974 "disabled": function( elem ) { 1975 return elem.disabled === true; 1976 }, 1977 1978 "checked": function( elem ) { 1979 // In CSS3, :checked should return both checked and selected elements 1980 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1981 var nodeName = elem.nodeName.toLowerCase(); 1982 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); 1983 }, 1984 1985 "selected": function( elem ) { 1986 // Accessing this property makes selected-by-default 1987 // options in Safari work properly 1988 if ( elem.parentNode ) { 1989 elem.parentNode.selectedIndex; 1990 } 1991 1992 return elem.selected === true; 1993 }, 1994 1995 // Contents 1996 "empty": function( elem ) { 1997 // http://www.w3.org/TR/selectors/#empty-pseudo 1998 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 1999 // but not by others (comment: 8; processing instruction: 7; etc.) 2000 // nodeType < 6 works because attributes (2) do not appear as children 2001 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 2002 if ( elem.nodeType < 6 ) { 2003 return false; 2004 } 2005 } 2006 return true; 2007 }, 2008 2009 "parent": function( elem ) { 2010 return !Expr.pseudos["empty"]( elem ); 2011 }, 2012 2013 // Element/input types 2014 "header": function( elem ) { 2015 return rheader.test( elem.nodeName ); 2016 }, 2017 2018 "input": function( elem ) { 2019 return rinputs.test( elem.nodeName ); 2020 }, 2021 2022 "button": function( elem ) { 2023 var name = elem.nodeName.toLowerCase(); 2024 return name === "input" && elem.type === "button" || name === "button"; 2025 }, 2026 2027 "text": function( elem ) { 2028 var attr; 2029 return elem.nodeName.toLowerCase() === "input" && 2030 elem.type === "text" && 2031 2032 // Support: IE<8 2033 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 2034 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); 2035 }, 2036 2037 // Position-in-collection 2038 "first": createPositionalPseudo(function() { 2039 return [ 0 ]; 2040 }), 2041 2042 "last": createPositionalPseudo(function( matchIndexes, length ) { 2043 return [ length - 1 ]; 2044 }), 2045 2046 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { 2047 return [ argument < 0 ? argument + length : argument ]; 2048 }), 2049 2050 "even": createPositionalPseudo(function( matchIndexes, length ) { 2051 var i = 0; 2052 for ( ; i < length; i += 2 ) { 2053 matchIndexes.push( i ); 2054 } 2055 return matchIndexes; 2056 }), 2057 2058 "odd": createPositionalPseudo(function( matchIndexes, length ) { 2059 var i = 1; 2060 for ( ; i < length; i += 2 ) { 2061 matchIndexes.push( i ); 2062 } 2063 return matchIndexes; 2064 }), 2065 2066 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { 2067 var i = argument < 0 ? argument + length : argument; 2068 for ( ; --i >= 0; ) { 2069 matchIndexes.push( i ); 2070 } 2071 return matchIndexes; 2072 }), 2073 2074 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { 2075 var i = argument < 0 ? argument + length : argument; 2076 for ( ; ++i < length; ) { 2077 matchIndexes.push( i ); 2078 } 2079 return matchIndexes; 2080 }) 2081 } 2082}; 2083 2084Expr.pseudos["nth"] = Expr.pseudos["eq"]; 2085 2086// Add button/input type pseudos 2087for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 2088 Expr.pseudos[ i ] = createInputPseudo( i ); 2089} 2090for ( i in { submit: true, reset: true } ) { 2091 Expr.pseudos[ i ] = createButtonPseudo( i ); 2092} 2093 2094// Easy API for creating new setFilters 2095function setFilters() {} 2096setFilters.prototype = Expr.filters = Expr.pseudos; 2097Expr.setFilters = new setFilters(); 2098 2099tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 2100 var matched, match, tokens, type, 2101 soFar, groups, preFilters, 2102 cached = tokenCache[ selector + " " ]; 2103 2104 if ( cached ) { 2105 return parseOnly ? 0 : cached.slice( 0 ); 2106 } 2107 2108 soFar = selector; 2109 groups = []; 2110 preFilters = Expr.preFilter; 2111 2112 while ( soFar ) { 2113 2114 // Comma and first run 2115 if ( !matched || (match = rcomma.exec( soFar )) ) { 2116 if ( match ) { 2117 // Don't consume trailing commas as valid 2118 soFar = soFar.slice( match[0].length ) || soFar; 2119 } 2120 groups.push( (tokens = []) ); 2121 } 2122 2123 matched = false; 2124 2125 // Combinators 2126 if ( (match = rcombinators.exec( soFar )) ) { 2127 matched = match.shift(); 2128 tokens.push({ 2129 value: matched, 2130 // Cast descendant combinators to space 2131 type: match[0].replace( rtrim, " " ) 2132 }); 2133 soFar = soFar.slice( matched.length ); 2134 } 2135 2136 // Filters 2137 for ( type in Expr.filter ) { 2138 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || 2139 (match = preFilters[ type ]( match ))) ) { 2140 matched = match.shift(); 2141 tokens.push({ 2142 value: matched, 2143 type: type, 2144 matches: match 2145 }); 2146 soFar = soFar.slice( matched.length ); 2147 } 2148 } 2149 2150 if ( !matched ) { 2151 break; 2152 } 2153 } 2154 2155 // Return the length of the invalid excess 2156 // if we're just parsing 2157 // Otherwise, throw an error or return tokens 2158 return parseOnly ? 2159 soFar.length : 2160 soFar ? 2161 Sizzle.error( selector ) : 2162 // Cache the tokens 2163 tokenCache( selector, groups ).slice( 0 ); 2164}; 2165 2166function toSelector( tokens ) { 2167 var i = 0, 2168 len = tokens.length, 2169 selector = ""; 2170 for ( ; i < len; i++ ) { 2171 selector += tokens[i].value; 2172 } 2173 return selector; 2174} 2175 2176function addCombinator( matcher, combinator, base ) { 2177 var dir = combinator.dir, 2178 checkNonElements = base && dir === "parentNode", 2179 doneName = done++; 2180 2181 return combinator.first ? 2182 // Check against closest ancestor/preceding element 2183 function( elem, context, xml ) { 2184 while ( (elem = elem[ dir ]) ) { 2185 if ( elem.nodeType === 1 || checkNonElements ) { 2186 return matcher( elem, context, xml ); 2187 } 2188 } 2189 } : 2190 2191 // Check against all ancestor/preceding elements 2192 function( elem, context, xml ) { 2193 var oldCache, uniqueCache, outerCache, 2194 newCache = [ dirruns, doneName ]; 2195 2196 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2197 if ( xml ) { 2198 while ( (elem = elem[ dir ]) ) { 2199 if ( elem.nodeType === 1 || checkNonElements ) { 2200 if ( matcher( elem, context, xml ) ) { 2201 return true; 2202 } 2203 } 2204 } 2205 } else { 2206 while ( (elem = elem[ dir ]) ) { 2207 if ( elem.nodeType === 1 || checkNonElements ) { 2208 outerCache = elem[ expando ] || (elem[ expando ] = {}); 2209 2210 // Support: IE <9 only 2211 // Defend against cloned attroperties (jQuery gh-1709) 2212 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); 2213 2214 if ( (oldCache = uniqueCache[ dir ]) && 2215 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2216 2217 // Assign to newCache so results back-propagate to previous elements 2218 return (newCache[ 2 ] = oldCache[ 2 ]); 2219 } else { 2220 // Reuse newcache so results back-propagate to previous elements 2221 uniqueCache[ dir ] = newCache; 2222 2223 // A match means we're done; a fail means we have to keep checking 2224 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { 2225 return true; 2226 } 2227 } 2228 } 2229 } 2230 } 2231 }; 2232} 2233 2234function elementMatcher( matchers ) { 2235 return matchers.length > 1 ? 2236 function( elem, context, xml ) { 2237 var i = matchers.length; 2238 while ( i-- ) { 2239 if ( !matchers[i]( elem, context, xml ) ) { 2240 return false; 2241 } 2242 } 2243 return true; 2244 } : 2245 matchers[0]; 2246} 2247 2248function multipleContexts( selector, contexts, results ) { 2249 var i = 0, 2250 len = contexts.length; 2251 for ( ; i < len; i++ ) { 2252 Sizzle( selector, contexts[i], results ); 2253 } 2254 return results; 2255} 2256 2257function condense( unmatched, map, filter, context, xml ) { 2258 var elem, 2259 newUnmatched = [], 2260 i = 0, 2261 len = unmatched.length, 2262 mapped = map != null; 2263 2264 for ( ; i < len; i++ ) { 2265 if ( (elem = unmatched[i]) ) { 2266 if ( !filter || filter( elem, context, xml ) ) { 2267 newUnmatched.push( elem ); 2268 if ( mapped ) { 2269 map.push( i ); 2270 } 2271 } 2272 } 2273 } 2274 2275 return newUnmatched; 2276} 2277 2278function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 2279 if ( postFilter && !postFilter[ expando ] ) { 2280 postFilter = setMatcher( postFilter ); 2281 } 2282 if ( postFinder && !postFinder[ expando ] ) { 2283 postFinder = setMatcher( postFinder, postSelector ); 2284 } 2285 return markFunction(function( seed, results, context, xml ) { 2286 var temp, i, elem, 2287 preMap = [], 2288 postMap = [], 2289 preexisting = results.length, 2290 2291 // Get initial elements from seed or context 2292 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), 2293 2294 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2295 matcherIn = preFilter && ( seed || !selector ) ? 2296 condense( elems, preMap, preFilter, context, xml ) : 2297 elems, 2298 2299 matcherOut = matcher ? 2300 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 2301 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 2302 2303 // ...intermediate processing is necessary 2304 [] : 2305 2306 // ...otherwise use results directly 2307 results : 2308 matcherIn; 2309 2310 // Find primary matches 2311 if ( matcher ) { 2312 matcher( matcherIn, matcherOut, context, xml ); 2313 } 2314 2315 // Apply postFilter 2316 if ( postFilter ) { 2317 temp = condense( matcherOut, postMap ); 2318 postFilter( temp, [], context, xml ); 2319 2320 // Un-match failing elements by moving them back to matcherIn 2321 i = temp.length; 2322 while ( i-- ) { 2323 if ( (elem = temp[i]) ) { 2324 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); 2325 } 2326 } 2327 } 2328 2329 if ( seed ) { 2330 if ( postFinder || preFilter ) { 2331 if ( postFinder ) { 2332 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2333 temp = []; 2334 i = matcherOut.length; 2335 while ( i-- ) { 2336 if ( (elem = matcherOut[i]) ) { 2337 // Restore matcherIn since elem is not yet a final match 2338 temp.push( (matcherIn[i] = elem) ); 2339 } 2340 } 2341 postFinder( null, (matcherOut = []), temp, xml ); 2342 } 2343 2344 // Move matched elements from seed to results to keep them synchronized 2345 i = matcherOut.length; 2346 while ( i-- ) { 2347 if ( (elem = matcherOut[i]) && 2348 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { 2349 2350 seed[temp] = !(results[temp] = elem); 2351 } 2352 } 2353 } 2354 2355 // Add elements to results, through postFinder if defined 2356 } else { 2357 matcherOut = condense( 2358 matcherOut === results ? 2359 matcherOut.splice( preexisting, matcherOut.length ) : 2360 matcherOut 2361 ); 2362 if ( postFinder ) { 2363 postFinder( null, results, matcherOut, xml ); 2364 } else { 2365 push.apply( results, matcherOut ); 2366 } 2367 } 2368 }); 2369} 2370 2371function matcherFromTokens( tokens ) { 2372 var checkContext, matcher, j, 2373 len = tokens.length, 2374 leadingRelative = Expr.relative[ tokens[0].type ], 2375 implicitRelative = leadingRelative || Expr.relative[" "], 2376 i = leadingRelative ? 1 : 0, 2377 2378 // The foundational matcher ensures that elements are reachable from top-level context(s) 2379 matchContext = addCombinator( function( elem ) { 2380 return elem === checkContext; 2381 }, implicitRelative, true ), 2382 matchAnyContext = addCombinator( function( elem ) { 2383 return indexOf( checkContext, elem ) > -1; 2384 }, implicitRelative, true ), 2385 matchers = [ function( elem, context, xml ) { 2386 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 2387 (checkContext = context).nodeType ? 2388 matchContext( elem, context, xml ) : 2389 matchAnyContext( elem, context, xml ) ); 2390 // Avoid hanging onto element (issue #299) 2391 checkContext = null; 2392 return ret; 2393 } ]; 2394 2395 for ( ; i < len; i++ ) { 2396 if ( (matcher = Expr.relative[ tokens[i].type ]) ) { 2397 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; 2398 } else { 2399 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); 2400 2401 // Return special upon seeing a positional matcher 2402 if ( matcher[ expando ] ) { 2403 // Find the next relative operator (if any) for proper handling 2404 j = ++i; 2405 for ( ; j < len; j++ ) { 2406 if ( Expr.relative[ tokens[j].type ] ) { 2407 break; 2408 } 2409 } 2410 return setMatcher( 2411 i > 1 && elementMatcher( matchers ), 2412 i > 1 && toSelector( 2413 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2414 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) 2415 ).replace( rtrim, "$1" ), 2416 matcher, 2417 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2418 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), 2419 j < len && toSelector( tokens ) 2420 ); 2421 } 2422 matchers.push( matcher ); 2423 } 2424 } 2425 2426 return elementMatcher( matchers ); 2427} 2428 2429function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 2430 var bySet = setMatchers.length > 0, 2431 byElement = elementMatchers.length > 0, 2432 superMatcher = function( seed, context, xml, results, outermost ) { 2433 var elem, j, matcher, 2434 matchedCount = 0, 2435 i = "0", 2436 unmatched = seed && [], 2437 setMatched = [], 2438 contextBackup = outermostContext, 2439 // We must always have either seed elements or outermost context 2440 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), 2441 // Use integer dirruns iff this is the outermost matcher 2442 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), 2443 len = elems.length; 2444 2445 if ( outermost ) { 2446 outermostContext = context === document || context || outermost; 2447 } 2448 2449 // Add elements passing elementMatchers directly to results 2450 // Support: IE<9, Safari 2451 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 2452 for ( ; i !== len && (elem = elems[i]) != null; i++ ) { 2453 if ( byElement && elem ) { 2454 j = 0; 2455 if ( !context && elem.ownerDocument !== document ) { 2456 setDocument( elem ); 2457 xml = !documentIsHTML; 2458 } 2459 while ( (matcher = elementMatchers[j++]) ) { 2460 if ( matcher( elem, context || document, xml) ) { 2461 results.push( elem ); 2462 break; 2463 } 2464 } 2465 if ( outermost ) { 2466 dirruns = dirrunsUnique; 2467 } 2468 } 2469 2470 // Track unmatched elements for set filters 2471 if ( bySet ) { 2472 // They will have gone through all possible matchers 2473 if ( (elem = !matcher && elem) ) { 2474 matchedCount--; 2475 } 2476 2477 // Lengthen the array for every element, matched or not 2478 if ( seed ) { 2479 unmatched.push( elem ); 2480 } 2481 } 2482 } 2483 2484 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2485 // makes the latter nonnegative. 2486 matchedCount += i; 2487 2488 // Apply set filters to unmatched elements 2489 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2490 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2491 // no element matchers and no seed. 2492 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2493 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2494 // numerically zero. 2495 if ( bySet && i !== matchedCount ) { 2496 j = 0; 2497 while ( (matcher = setMatchers[j++]) ) { 2498 matcher( unmatched, setMatched, context, xml ); 2499 } 2500 2501 if ( seed ) { 2502 // Reintegrate element matches to eliminate the need for sorting 2503 if ( matchedCount > 0 ) { 2504 while ( i-- ) { 2505 if ( !(unmatched[i] || setMatched[i]) ) { 2506 setMatched[i] = pop.call( results ); 2507 } 2508 } 2509 } 2510 2511 // Discard index placeholder values to get only actual matches 2512 setMatched = condense( setMatched ); 2513 } 2514 2515 // Add matches to results 2516 push.apply( results, setMatched ); 2517 2518 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2519 if ( outermost && !seed && setMatched.length > 0 && 2520 ( matchedCount + setMatchers.length ) > 1 ) { 2521 2522 Sizzle.uniqueSort( results ); 2523 } 2524 } 2525 2526 // Override manipulation of globals by nested matchers 2527 if ( outermost ) { 2528 dirruns = dirrunsUnique; 2529 outermostContext = contextBackup; 2530 } 2531 2532 return unmatched; 2533 }; 2534 2535 return bySet ? 2536 markFunction( superMatcher ) : 2537 superMatcher; 2538} 2539 2540compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 2541 var i, 2542 setMatchers = [], 2543 elementMatchers = [], 2544 cached = compilerCache[ selector + " " ]; 2545 2546 if ( !cached ) { 2547 // Generate a function of recursive functions that can be used to check each element 2548 if ( !match ) { 2549 match = tokenize( selector ); 2550 } 2551 i = match.length; 2552 while ( i-- ) { 2553 cached = matcherFromTokens( match[i] ); 2554 if ( cached[ expando ] ) { 2555 setMatchers.push( cached ); 2556 } else { 2557 elementMatchers.push( cached ); 2558 } 2559 } 2560 2561 // Cache the compiled function 2562 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 2563 2564 // Save selector and tokenization 2565 cached.selector = selector; 2566 } 2567 return cached; 2568}; 2569 2570/** 2571 * A low-level selection function that works with Sizzle's compiled 2572 * selector functions 2573 * @param {String|Function} selector A selector or a pre-compiled 2574 * selector function built with Sizzle.compile 2575 * @param {Element} context 2576 * @param {Array} [results] 2577 * @param {Array} [seed] A set of elements to match against 2578 */ 2579select = Sizzle.select = function( selector, context, results, seed ) { 2580 var i, tokens, token, type, find, 2581 compiled = typeof selector === "function" && selector, 2582 match = !seed && tokenize( (selector = compiled.selector || selector) ); 2583 2584 results = results || []; 2585 2586 // Try to minimize operations if there is only one selector in the list and no seed 2587 // (the latter of which guarantees us context) 2588 if ( match.length === 1 ) { 2589 2590 // Reduce context if the leading compound selector is an ID 2591 tokens = match[0] = match[0].slice( 0 ); 2592 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && 2593 support.getById && context.nodeType === 9 && documentIsHTML && 2594 Expr.relative[ tokens[1].type ] ) { 2595 2596 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; 2597 if ( !context ) { 2598 return results; 2599 2600 // Precompiled matchers will still verify ancestry, so step up a level 2601 } else if ( compiled ) { 2602 context = context.parentNode; 2603 } 2604 2605 selector = selector.slice( tokens.shift().value.length ); 2606 } 2607 2608 // Fetch a seed set for right-to-left matching 2609 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; 2610 while ( i-- ) { 2611 token = tokens[i]; 2612 2613 // Abort if we hit a combinator 2614 if ( Expr.relative[ (type = token.type) ] ) { 2615 break; 2616 } 2617 if ( (find = Expr.find[ type ]) ) { 2618 // Search, expanding context for leading sibling combinators 2619 if ( (seed = find( 2620 token.matches[0].replace( runescape, funescape ), 2621 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context 2622 )) ) { 2623 2624 // If seed is empty or no tokens remain, we can return early 2625 tokens.splice( i, 1 ); 2626 selector = seed.length && toSelector( tokens ); 2627 if ( !selector ) { 2628 push.apply( results, seed ); 2629 return results; 2630 } 2631 2632 break; 2633 } 2634 } 2635 } 2636 } 2637 2638 // Compile and execute a filtering function if one is not provided 2639 // Provide `match` to avoid retokenization if we modified the selector above 2640 ( compiled || compile( selector, match ) )( 2641 seed, 2642 context, 2643 !documentIsHTML, 2644 results, 2645 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 2646 ); 2647 return results; 2648}; 2649 2650// One-time assignments 2651 2652// Sort stability 2653support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; 2654 2655// Support: Chrome 14-35+ 2656// Always assume duplicates if they aren't passed to the comparison function 2657support.detectDuplicates = !!hasDuplicate; 2658 2659// Initialize against the default document 2660setDocument(); 2661 2662// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 2663// Detached nodes confoundingly follow *each other* 2664support.sortDetached = assert(function( div1 ) { 2665 // Should return 1, but returns 4 (following) 2666 return div1.compareDocumentPosition( document.createElement("div") ) & 1; 2667}); 2668 2669// Support: IE<8 2670// Prevent attribute/property "interpolation" 2671// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 2672if ( !assert(function( div ) { 2673 div.innerHTML = "<a href='#'></a>"; 2674 return div.firstChild.getAttribute("href") === "#" ; 2675}) ) { 2676 addHandle( "type|href|height|width", function( elem, name, isXML ) { 2677 if ( !isXML ) { 2678 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 2679 } 2680 }); 2681} 2682 2683// Support: IE<9 2684// Use defaultValue in place of getAttribute("value") 2685if ( !support.attributes || !assert(function( div ) { 2686 div.innerHTML = "<input/>"; 2687 div.firstChild.setAttribute( "value", "" ); 2688 return div.firstChild.getAttribute( "value" ) === ""; 2689}) ) { 2690 addHandle( "value", function( elem, name, isXML ) { 2691 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 2692 return elem.defaultValue; 2693 } 2694 }); 2695} 2696 2697// Support: IE<9 2698// Use getAttributeNode to fetch booleans when getAttribute lies 2699if ( !assert(function( div ) { 2700 return div.getAttribute("disabled") == null; 2701}) ) { 2702 addHandle( booleans, function( elem, name, isXML ) { 2703 var val; 2704 if ( !isXML ) { 2705 return elem[ name ] === true ? name.toLowerCase() : 2706 (val = elem.getAttributeNode( name )) && val.specified ? 2707 val.value : 2708 null; 2709 } 2710 }); 2711} 2712 2713return Sizzle; 2714 2715})( window ); 2716 2717 2718 2719jQuery.find = Sizzle; 2720jQuery.expr = Sizzle.selectors; 2721jQuery.expr[ ":" ] = jQuery.expr.pseudos; 2722jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 2723jQuery.text = Sizzle.getText; 2724jQuery.isXMLDoc = Sizzle.isXML; 2725jQuery.contains = Sizzle.contains; 2726 2727 2728 2729var dir = function( elem, dir, until ) { 2730 var matched = [], 2731 truncate = until !== undefined; 2732 2733 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 2734 if ( elem.nodeType === 1 ) { 2735 if ( truncate && jQuery( elem ).is( until ) ) { 2736 break; 2737 } 2738 matched.push( elem ); 2739 } 2740 } 2741 return matched; 2742}; 2743 2744 2745var siblings = function( n, elem ) { 2746 var matched = []; 2747 2748 for ( ; n; n = n.nextSibling ) { 2749 if ( n.nodeType === 1 && n !== elem ) { 2750 matched.push( n ); 2751 } 2752 } 2753 2754 return matched; 2755}; 2756 2757 2758var rneedsContext = jQuery.expr.match.needsContext; 2759 2760var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ ); 2761 2762 2763 2764var risSimple = /^.[^:#\[\.,]*$/; 2765 2766// Implement the identical functionality for filter and not 2767function winnow( elements, qualifier, not ) { 2768 if ( jQuery.isFunction( qualifier ) ) { 2769 return jQuery.grep( elements, function( elem, i ) { 2770 /* jshint -W018 */ 2771 return !!qualifier.call( elem, i, elem ) !== not; 2772 } ); 2773 2774 } 2775 2776 if ( qualifier.nodeType ) { 2777 return jQuery.grep( elements, function( elem ) { 2778 return ( elem === qualifier ) !== not; 2779 } ); 2780 2781 } 2782 2783 if ( typeof qualifier === "string" ) { 2784 if ( risSimple.test( qualifier ) ) { 2785 return jQuery.filter( qualifier, elements, not ); 2786 } 2787 2788 qualifier = jQuery.filter( qualifier, elements ); 2789 } 2790 2791 return jQuery.grep( elements, function( elem ) { 2792 return (
2792jQuery.inArray( elem, qualifier ) > -1 ) !== not; 2793 } ); 2794} 2795 2796jQuery.filter = function( expr, elems, not ) { 2797 var elem = elems[ 0 ]; 2798 2799 if ( not ) { 2800 expr = ":not(" + expr + ")"; 2801 } 2802 2803 return elems.length === 1 && elem.nodeType === 1 ? 2804 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : 2805 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 2806 return elem.nodeType === 1; 2807 } ) ); 2808}; 2809 2810jQuery.fn.extend( { 2811 find: function( selector ) { 2812 var i, 2813 ret = [], 2814 self = this, 2815 len = self.length; 2816 2817 if ( typeof selector !== "string" ) {
vendor: 5,394 bytes, lines 2818-3020
2818 return this.pushStack( jQuery( selector ).filter( function() { 2819 for ( i = 0; i < len; i++ ) { 2820 if ( jQuery.contains( self[ i ], this ) ) { 2821 return true; 2822 } 2823 } 2824 } ) ); 2825 } 2826 2827 for ( i = 0; i < len; i++ ) { 2828 jQuery.find( selector, self[ i ], ret ); 2829 } 2830 2831 // Needed because $( selector, context ) becomes $( context ).find( selector ) 2832 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); 2833 ret.selector = this.selector ? this.selector + " " + selector : selector; 2834 return ret; 2835 }, 2836 filter: function( selector ) { 2837 return this.pushStack( winnow( this, selector || [], false ) ); 2838 }, 2839 not: function( selector ) { 2840 return this.pushStack( winnow( this, selector || [], true ) ); 2841 }, 2842 is: function( selector ) { 2843 return !!winnow( 2844 this, 2845 2846 // If this is a positional/relative selector, check membership in the returned set 2847 // so $("p:first").is("p:last") won't return true for a doc with two "p". 2848 typeof selector === "string" && rneedsContext.test( selector ) ? 2849 jQuery( selector ) : 2850 selector || [], 2851 false 2852 ).length; 2853 } 2854} ); 2855 2856 2857// Initialize a jQuery object 2858 2859 2860// A central reference to the root jQuery(document) 2861var rootjQuery, 2862 2863 // A simple way to check for HTML strings 2864 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 2865 // Strict HTML recognition (#11290: must start with <) 2866 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, 2867 2868 init = jQuery.fn.init = function( selector, context, root ) { 2869 var match, elem; 2870 2871 // HANDLE: $(""), $(null), $(undefined), $(false) 2872 if ( !selector ) { 2873 return this; 2874 } 2875 2876 // init accepts an alternate rootjQuery 2877 // so migrate can support jQuery.sub (gh-2101) 2878 root = root || rootjQuery; 2879 2880 // Handle HTML strings 2881 if ( typeof selector === "string" ) { 2882 if ( selector.charAt( 0 ) === "<" && 2883 selector.charAt( selector.length - 1 ) === ">" && 2884 selector.length >= 3 ) { 2885 2886 // Assume that strings that start and end with <> are HTML and skip the regex check 2887 match = [ null, selector, null ]; 2888 2889 } else { 2890 match = rquickExpr.exec( selector ); 2891 } 2892 2893 // Match html or make sure no context is specified for #id 2894 if ( match && ( match[ 1 ] || !context ) ) { 2895 2896 // HANDLE: $(html) -> $(array) 2897 if ( match[ 1 ] ) { 2898 context = context instanceof jQuery ? context[ 0 ] : context; 2899 2900 // scripts is true for back-compat 2901 // Intentionally let the error be thrown if parseHTML is not present 2902 jQuery.merge( this, jQuery.parseHTML( 2903 match[ 1 ], 2904 context && context.nodeType ? context.ownerDocument || context : document, 2905 true 2906 ) ); 2907 2908 // HANDLE: $(html, props) 2909 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 2910 for ( match in context ) { 2911 2912 // Properties of context are called as methods if possible 2913 if ( jQuery.isFunction( this[ match ] ) ) { 2914 this[ match ]( context[ match ] ); 2915 2916 // ...and otherwise set as attributes 2917 } else { 2918 this.attr( match, context[ match ] ); 2919 } 2920 } 2921 } 2922 2923 return this; 2924 2925 // HANDLE: $(#id) 2926 } else { 2927 elem = document.getElementById( match[ 2 ] ); 2928 2929 // Check parentNode to catch when Blackberry 4.6 returns 2930 // nodes that are no longer in the document #6963 2931 if ( elem && elem.parentNode ) { 2932 2933 // Handle the case where IE and Opera return items 2934 // by name instead of ID 2935 if ( elem.id !== match[ 2 ] ) { 2936 return rootjQuery.find( selector ); 2937 } 2938 2939 // Otherwise, we inject the element directly into the jQuery object 2940 this.length = 1; 2941 this[ 0 ] = elem; 2942 } 2943 2944 this.context = document; 2945 this.selector = selector; 2946 return this; 2947 } 2948 2949 // HANDLE: $(expr, $(...)) 2950 } else if ( !context || context.jquery ) { 2951 return ( context || root ).find( selector ); 2952 2953 // HANDLE: $(expr, context) 2954 // (which is just equivalent to: $(context).find(expr) 2955 } else { 2956 return this.constructor( context ).find( selector ); 2957 } 2958 2959 // HANDLE: $(DOMElement) 2960 } else if ( selector.nodeType ) { 2961 this.context = this[ 0 ] = selector; 2962 this.length = 1; 2963 return this; 2964 2965 // HANDLE: $(function) 2966 // Shortcut for document ready 2967 } else if ( jQuery.isFunction( selector ) ) { 2968 return typeof root.ready !== "undefined" ? 2969 root.ready( selector ) : 2970 2971 // Execute immediately if ready is not present 2972 selector( jQuery ); 2973 } 2974 2975 if ( selector.selector !== undefined ) { 2976 this.selector = selector.selector; 2977 this.context = selector.context; 2978 } 2979 2980 return jQuery.makeArray( selector, this ); 2981 }; 2982 2983// Give the init function the jQuery prototype for later instantiation 2984init.prototype = jQuery.fn; 2985 2986// Initialize central reference 2987rootjQuery = jQuery( document ); 2988 2989 2990var rparentsprev = /^(?:parents|prev(?:Until|All))/, 2991 2992 // methods guaranteed to produce a unique set when starting from a unique set 2993 guaranteedUnique = { 2994 children: true, 2995 contents: true, 2996 next: true, 2997 prev: true 2998 }; 2999 3000jQuery.fn.extend( { 3001 has: function( target ) { 3002 var i, 3003 targets = jQuery( target, this ), 3004 len = targets.length; 3005 3006 return this.filter( function() { 3007 for ( i = 0; i < len; i++ ) { 3008 if ( jQuery.contains( this, targets[ i ] ) ) { 3009 return true; 3010 } 3011 } 3012 } ); 3013 }, 3014 3015 closest: function( selectors, context ) { 3016 var cur, 3017 i = 0, 3018 l = this.length, 3019 matched = [], 3020 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
vendor: 12,881 bytes, lines 3021-3529
3021 jQuery( selectors, context || this.context ) : 3022 0; 3023 3024 for ( ; i < l; i++ ) { 3025 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 3026 3027 // Always skip document fragments 3028 if ( cur.nodeType < 11 && ( pos ? 3029 pos.index( cur ) > -1 : 3030 3031 // Don't pass non-elements to Sizzle 3032 cur.nodeType === 1 && 3033 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3034 3035 matched.push( cur ); 3036 break; 3037 } 3038 } 3039 } 3040 3041 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 3042 }, 3043 3044 // Determine the position of an element within 3045 // the matched set of elements 3046 index: function( elem ) { 3047 3048 // No argument, return index in parent 3049 if ( !elem ) { 3050 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 3051 } 3052 3053 // index in selector 3054 if ( typeof elem === "string" ) { 3055 return jQuery.inArray( this[ 0 ], jQuery( elem ) ); 3056 } 3057 3058 // Locate the position of the desired element 3059 return jQuery.inArray( 3060 3061 // If it receives a jQuery object, the first element is used 3062 elem.jquery ? elem[ 0 ] : elem, this ); 3063 }, 3064 3065 add: function( selector, context ) { 3066 return this.pushStack( 3067 jQuery.uniqueSort( 3068 jQuery.merge( this.get(), jQuery( selector, context ) ) 3069 ) 3070 ); 3071 }, 3072 3073 addBack: function( selector ) { 3074 return this.add( selector == null ? 3075 this.prevObject : this.prevObject.filter( selector ) 3076 ); 3077 } 3078} ); 3079 3080function sibling( cur, dir ) { 3081 do { 3082 cur = cur[ dir ]; 3083 } while ( cur && cur.nodeType !== 1 ); 3084 3085 return cur; 3086} 3087 3088jQuery.each( { 3089 parent: function( elem ) { 3090 var parent = elem.parentNode; 3091 return parent && parent.nodeType !== 11 ? parent : null; 3092 }, 3093 parents: function( elem ) { 3094 return dir( elem, "parentNode" ); 3095 }, 3096 parentsUntil: function( elem, i, until ) { 3097 return dir( elem, "parentNode", until ); 3098 }, 3099 next: function( elem ) { 3100 return sibling( elem, "nextSibling" ); 3101 }, 3102 prev: function( elem ) { 3103 return sibling( elem, "previousSibling" ); 3104 }, 3105 nextAll: function( elem ) { 3106 return dir( elem, "nextSibling" ); 3107 }, 3108 prevAll: function( elem ) { 3109 return dir( elem, "previousSibling" ); 3110 }, 3111 nextUntil: function( elem, i, until ) { 3112 return dir( elem, "nextSibling", until ); 3113 }, 3114 prevUntil: function( elem, i, until ) { 3115 return dir( elem, "previousSibling", until ); 3116 }, 3117 siblings: function( elem ) { 3118 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 3119 }, 3120 children: function( elem ) { 3121 return siblings( elem.firstChild ); 3122 }, 3123 contents: function( elem ) { 3124 return jQuery.nodeName( elem, "iframe" ) ? 3125 elem.contentDocument || elem.contentWindow.document : 3126 jQuery.merge( [], elem.childNodes ); 3127 } 3128}, function( name, fn ) { 3129 jQuery.fn[ name ] = function( until, selector ) { 3130 var ret = jQuery.map( this, fn, until ); 3131 3132 if ( name.slice( -5 ) !== "Until" ) { 3133 selector = until; 3134 } 3135 3136 if ( selector && typeof selector === "string" ) { 3137 ret = jQuery.filter( selector, ret ); 3138 } 3139 3140 if ( this.length > 1 ) { 3141 3142 // Remove duplicates 3143 if ( !guaranteedUnique[ name ] ) { 3144 ret = jQuery.uniqueSort( ret ); 3145 } 3146 3147 // Reverse order for parents* and prev-derivatives 3148 if ( rparentsprev.test( name ) ) { 3149 ret = ret.reverse(); 3150 } 3151 } 3152 3153 return this.pushStack( ret ); 3154 }; 3155} ); 3156var rnotwhite = ( /\S+/g ); 3157 3158 3159 3160// Convert String-formatted options into Object-formatted ones 3161function createOptions( options ) { 3162 var object = {}; 3163 jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { 3164 object[ flag ] = true; 3165 } ); 3166 return object; 3167} 3168 3169/* 3170 * Create a callback list using the following parameters: 3171 * 3172 * options: an optional list of space-separated options that will change how 3173 * the callback list behaves or a more traditional option object 3174 * 3175 * By default a callback list will act like an event callback list and can be 3176 * "fired" multiple times. 3177 * 3178 * Possible options: 3179 * 3180 * once: will ensure the callback list can only be fired once (like a Deferred) 3181 * 3182 * memory: will keep track of previous values and will call any callback added 3183 * after the list has been fired right away with the latest "memorized" 3184 * values (like a Deferred) 3185 * 3186 * unique: will ensure a callback can only be added once (no duplicate in the list) 3187 * 3188 * stopOnFalse: interrupt callings when a callback returns false 3189 * 3190 */ 3191jQuery.Callbacks = function( options ) { 3192 3193 // Convert options from String-formatted to Object-formatted if needed 3194 // (we check in cache first) 3195 options = typeof options === "string" ? 3196 createOptions( options ) : 3197 jQuery.extend( {}, options ); 3198 3199 var // Flag to know if list is currently firing 3200 firing, 3201 3202 // Last fire value for non-forgettable lists 3203 memory, 3204 3205 // Flag to know if list was already fired 3206 fired, 3207 3208 // Flag to prevent firing 3209 locked, 3210 3211 // Actual callback list 3212 list = [], 3213 3214 // Queue of execution data for repeatable lists 3215 queue = [], 3216 3217 // Index of currently firing callback (modified by add/remove as needed) 3218 firingIndex = -1, 3219 3220 // Fire callbacks 3221 fire = function() { 3222 3223 // Enforce single-firing 3224 locked = options.once; 3225 3226 // Execute callbacks for all pending executions, 3227 // respecting firingIndex overrides and runtime changes 3228 fired = firing = true; 3229 for ( ; queue.length; firingIndex = -1 ) { 3230 memory = queue.shift(); 3231 while ( ++firingIndex < list.length ) { 3232 3233 // Run callback and check for early termination 3234 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 3235 options.stopOnFalse ) { 3236 3237 // Jump to end and forget the data so .add doesn't re-fire 3238 firingIndex = list.length; 3239 memory = false; 3240 } 3241 } 3242 } 3243 3244 // Forget the data if we're done with it 3245 if ( !options.memory ) { 3246 memory = false; 3247 } 3248 3249 firing = false; 3250 3251 // Clean up if we're done firing for good 3252 if ( locked ) { 3253 3254 // Keep an empty list if we have data for future add calls 3255 if ( memory ) { 3256 list = []; 3257 3258 // Otherwise, this object is spent 3259 } else { 3260 list = ""; 3261 } 3262 } 3263 }, 3264 3265 // Actual Callbacks object 3266 self = { 3267 3268 // Add a callback or a collection of callbacks to the list 3269 add: function() { 3270 if ( list ) { 3271 3272 // If we have memory from a past run, we should fire after adding 3273 if ( memory && !firing ) { 3274 firingIndex = list.length - 1; 3275 queue.push( memory ); 3276 } 3277 3278 ( function add( args ) { 3279 jQuery.each( args, function( _, arg ) { 3280 if ( jQuery.isFunction( arg ) ) { 3281 if ( !options.unique || !self.has( arg ) ) { 3282 list.push( arg ); 3283 } 3284 } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { 3285 3286 // Inspect recursively 3287 add( arg ); 3288 } 3289 } ); 3290 } )( arguments ); 3291 3292 if ( memory && !firing ) { 3293 fire(); 3294 } 3295 } 3296 return this; 3297 }, 3298 3299 // Remove a callback from the list 3300 remove: function() { 3301 jQuery.each( arguments, function( _, arg ) { 3302 var index; 3303 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 3304 list.splice( index, 1 ); 3305 3306 // Handle firing indexes 3307 if ( index <= firingIndex ) { 3308 firingIndex--; 3309 } 3310 } 3311 } ); 3312 return this; 3313 }, 3314 3315 // Check if a given callback is in the list. 3316 // If no argument is given, return whether or not list has callbacks attached. 3317 has: function( fn ) { 3318 return fn ? 3319 jQuery.inArray( fn, list ) > -1 : 3320 list.length > 0; 3321 }, 3322 3323 // Remove all callbacks from the list 3324 empty: function() { 3325 if ( list ) { 3326 list = []; 3327 } 3328 return this; 3329 }, 3330 3331 // Disable .fire and .add 3332 // Abort any current/pending executions 3333 // Clear all callbacks and values 3334 disable: function() { 3335 locked = queue = []; 3336 list = memory = ""; 3337 return this; 3338 }, 3339 disabled: function() { 3340 return !list; 3341 }, 3342 3343 // Disable .fire 3344 // Also disable .add unless we have memory (since it would have no effect) 3345 // Abort any pending executions 3346 lock: function() { 3347 locked = true; 3348 if ( !memory ) { 3349 self.disable(); 3350 } 3351 return this; 3352 }, 3353 locked: function() { 3354 return !!locked; 3355 }, 3356 3357 // Call all callbacks with the given context and arguments 3358 fireWith: function( context, args ) { 3359 if ( !locked ) { 3360 args = args || []; 3361 args = [ context, args.slice ? args.slice() : args ]; 3362 queue.push( args ); 3363 if ( !firing ) { 3364 fire(); 3365 } 3366 } 3367 return this; 3368 }, 3369 3370 // Call all the callbacks with the given arguments 3371 fire: function() { 3372 self.fireWith( this, arguments ); 3373 return this; 3374 }, 3375 3376 // To know if the callbacks have already been called at least once 3377 fired: function() { 3378 return !!fired; 3379 } 3380 }; 3381 3382 return self; 3383}; 3384 3385 3386jQuery.extend( { 3387 3388 Deferred: function( func ) { 3389 var tuples = [ 3390 3391 // action, add listener, listener list, final state 3392 [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ], 3393 [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ], 3394 [ "notify", "progress", jQuery.Callbacks( "memory" ) ] 3395 ], 3396 state = "pending", 3397 promise = { 3398 state: function() { 3399 return state; 3400 }, 3401 always: function() { 3402 deferred.done( arguments ).fail( arguments ); 3403 return this; 3404 }, 3405 then: function( /* fnDone, fnFail, fnProgress */ ) { 3406 var fns = arguments; 3407 return jQuery.Deferred( function( newDefer ) { 3408 jQuery.each( tuples, function( i, tuple ) { 3409 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; 3410 3411 // deferred[ done | fail | progress ] for forwarding actions to newDefer 3412 deferred[ tuple[ 1 ] ]( function() { 3413 var returned = fn && fn.apply( this, arguments ); 3414 if ( returned && jQuery.isFunction( returned.promise ) ) { 3415 returned.promise() 3416 .progress( newDefer.notify ) 3417 .done( newDefer.resolve ) 3418 .fail( newDefer.reject ); 3419 } else { 3420 newDefer[ tuple[ 0 ] + "With" ]( 3421 this === promise ? newDefer.promise() : this, 3422 fn ? [ returned ] : arguments 3423 ); 3424 } 3425 } ); 3426 } ); 3427 fns = null; 3428 } ).promise(); 3429 }, 3430 3431 // Get a promise for this deferred 3432 // If obj is provided, the promise aspect is added to the object 3433 promise: function( obj ) { 3434 return obj != null ? jQuery.extend( obj, promise ) : promise; 3435 } 3436 }, 3437 deferred = {}; 3438 3439 // Keep pipe for back-compat 3440 promise.pipe = promise.then; 3441 3442 // Add list-specific methods 3443 jQuery.each( tuples, function( i, tuple ) { 3444 var list = tuple[ 2 ], 3445 stateString = tuple[ 3 ]; 3446 3447 // promise[ done | fail | progress ] = list.add 3448 promise[ tuple[ 1 ] ] = list.add; 3449 3450 // Handle state 3451 if ( stateString ) { 3452 list.add( function() { 3453 3454 // state = [ resolved | rejected ] 3455 state = stateString; 3456 3457 // [ reject_list | resolve_list ].disable; progress_list.lock 3458 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); 3459 } 3460 3461 // deferred[ resolve | reject | notify ] 3462 deferred[ tuple[ 0 ] ] = function() { 3463 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments ); 3464 return this; 3465 }; 3466 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 3467 } ); 3468 3469 // Make the deferred a promise 3470 promise.promise( deferred ); 3471 3472 // Call given func if any 3473 if ( func ) { 3474 func.call( deferred, deferred ); 3475 } 3476 3477 // All done! 3478 return deferred; 3479 }, 3480 3481 // Deferred helper 3482 when: function( subordinate /* , ..., subordinateN */ ) { 3483 var i = 0, 3484 resolveValues = slice.call( arguments ), 3485 length = resolveValues.length, 3486 3487 // the count of uncompleted subordinates 3488 remaining = length !== 1 || 3489 ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, 3490 3491 // the master Deferred. 3492 // If resolveValues consist of only a single Deferred, just use that. 3493 deferred = remaining === 1 ? subordinate : jQuery.Deferred(), 3494 3495 // Update function for both resolve and progress values 3496 updateFunc = function( i, contexts, values ) { 3497 return function( value ) { 3498 contexts[ i ] = this; 3499 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 3500 if ( values === progressValues ) { 3501 deferred.notifyWith( contexts, values ); 3502 3503 } else if ( !( --remaining ) ) { 3504 deferred.resolveWith( contexts, values ); 3505 } 3506 }; 3507 }, 3508 3509 progressValues, progressContexts, resolveContexts; 3510 3511 // add listeners to Deferred subordinates; treat others as resolved 3512 if ( length > 1 ) { 3513 progressValues = new Array( length ); 3514 progressContexts = new Array( length ); 3515 resolveContexts = new Array( length ); 3516 for ( ; i < length; i++ ) { 3517 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { 3518 resolveValues[ i ].promise() 3519 .progress( updateFunc( i, progressContexts, progressValues ) ) 3520 .done( updateFunc( i, resolveContexts, resolveValues ) ) 3521 .fail( deferred.reject ); 3522 } else { 3523 --remaining; 3524 } 3525 } 3526 } 3527 3528 // if we're not waiting on anything, resolve the master 3529 if ( !remaining ) {
vendor: 2,149 bytes, lines 3530-3629
3530 deferred.resolveWith( resolveContexts, resolveValues ); 3531 } 3532 3533 return deferred.promise(); 3534 } 3535} ); 3536 3537 3538// The deferred used on DOM ready 3539var readyList; 3540 3541jQuery.fn.ready = function( fn ) { 3542 3543 // Add the callback 3544 jQuery.ready.promise().done( fn ); 3545 3546 return this; 3547}; 3548 3549jQuery.extend( { 3550 3551 // Is the DOM ready to be used? Set to true once it occurs. 3552 isReady: false, 3553 3554 // A counter to track how many items to wait for before 3555 // the ready event fires. See #6781 3556 readyWait: 1, 3557 3558 // Hold (or release) the ready event 3559 holdReady: function( hold ) { 3560 if ( hold ) { 3561 jQuery.readyWait++; 3562 } else { 3563 jQuery.ready( true ); 3564 } 3565 }, 3566 3567 // Handle when the DOM is ready 3568 ready: function( wait ) { 3569 3570 // Abort if there are pending holds or we're already ready 3571 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 3572 return; 3573 } 3574 3575 // Remember that the DOM is ready 3576 jQuery.isReady = true; 3577 3578 // If a normal DOM Ready event fired, decrement, and wait if need be 3579 if ( wait !== true && --jQuery.readyWait > 0 ) { 3580 return; 3581 } 3582 3583 // If there are functions bound, to execute 3584 readyList.resolveWith( document, [ jQuery ] ); 3585 3586 // Trigger any bound ready events 3587 if ( jQuery.fn.triggerHandler ) { 3588 jQuery( document ).triggerHandler( "ready" ); 3589 jQuery( document ).off( "ready" ); 3590 } 3591 } 3592} ); 3593 3594/** 3595 * Clean-up method for dom ready events 3596 */ 3597function detach() { 3598 if ( document.addEventListener ) { 3599 document.removeEventListener( "DOMContentLoaded", completed ); 3600 window.removeEventListener( "load", completed ); 3601 3602 } else { 3603 document.detachEvent( "onreadystatechange", completed ); 3604 window.detachEvent( "onload", completed ); 3605 } 3606} 3607 3608/** 3609 * The ready event handler and self cleanup method 3610 */ 3611function completed() { 3612 3613 // readyState === "complete" is good enough for us to call the dom ready in oldIE 3614 if ( document.addEventListener || 3615 window.event.type === "load" || 3616 document.readyState === "complete" ) { 3617 3618 detach(); 3619 jQuery.ready(); 3620 } 3621} 3622 3623jQuery.ready.promise = function( obj ) { 3624 if ( !readyList ) { 3625 3626 readyList = jQuery.Deferred(); 3627 3628 // Catch cases where $(document).ready() is called 3629 // after the browser event has already occurred.
3630 // Support: IE6-10 3631 // Older IE sometimes signals "interactive" too soon 3632 if ( document.readyState === "complete" || 3633 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 3634 3635 // Handle it asynchronously to allow scripts the opportunity to delay ready 3636 window.setTimeout( jQuery.ready ); 3637 3638 // Standards-based browsers support DOMContentLoaded 3639 } else if ( document.addEventListener ) { 3640 3641 // Use the handy event callback 3642 document.addEventListener( "DOMContentLoaded", completed ); 3643 3644 // A fallback to window.onload, that will always work 3645 window.addEventListener( "load", completed ); 3646 3647 // If IE event model is used 3648 } else { 3649 3650 // Ensure firing before onload, maybe late but safe also for iframes 3651 document.attachEvent( "onreadystatechange", completed ); 3652 3653 // A fallback to window.onload, that will always work 3654 window.attachEvent( "onload", completed ); 3655 3656 // If IE and not a frame 3657 // continually check to see if the document is ready 3658 var top = false; 3659 3660 try { 3661 top = window.frameElement == null && document.documentElement; 3662 } catch ( e ) {} 3663 3664 if ( top && top.doScroll ) { 3665 ( function doScrollCheck() { 3666 if ( !jQuery.isReady ) { 3667 3668 try { 3669 3670 // Use the trick by Diego Perini 3671 // http://javascript.nwbox.com/IEContentLoaded/ 3672 top.doScroll( "left" ); 3673 } catch ( e ) { 3674 return window.setTimeout( doScrollCheck, 50 ); 3675 } 3676 3677 // detach all dom ready events 3678 detach(); 3679 3680 // and execute any waiting functions 3681 jQuery.ready(); 3682 } 3683 } )(); 3684 } 3685 } 3686 } 3687 return readyList.promise( obj ); 3688}; 3689 3690// Kick off the DOM ready check even if the user does not 3691jQuery.ready.promise(); 3692 3693 3694 3695 3696// Support: IE<9 3697// Iteration over object's inherited properties before its own 3698var i; 3699for ( i in jQuery( support ) ) { 3700 break; 3701} 3702support.ownFirst = i === "0"; 3703 3704// Note: most support tests are defined in their respective modules. 3705// false until the test is run 3706support.inlineBlockNeedsLayout = false; 3707 3708// Execute ASAP in case we need to set body.style.zoom 3709jQuery( function() { 3710 3711 // Minified: var a,b,c,d 3712 var val, div, body, container; 3713 3714 body = document.getElementsByTagName( "body" )[ 0 ]; 3715 if ( !body || !body.style ) { 3716 3717 // Return for frameset docs that don't have a body 3718 return; 3719 } 3720 3721 // Setup 3722 div = document.createElement( "div" ); 3723 container = document.createElement( "div" ); 3724 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; 3725 body.appendChild( container ).appendChild( div ); 3726 3727 if ( typeof div.style.zoom !== "undefined" ) { 3728 3729 // Support: IE<8 3730 // Check if natively block-level elements act like inline-block 3731 // elements when setting their display to 'inline' and giving 3732 // them layout 3733 div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1"; 3734 3735 support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; 3736 if ( val ) { 3737 3738 // Prevent IE 6 from affecting layout for positioned elements #11048 3739 // Prevent IE from shrinking the body in IE 7 mode #12869 3740 // Support: IE<8 3741 body.style.zoom = 1; 3742 } 3743 } 3744 3745 body.removeChild( container ); 3746} ); 3747 3748 3749( function() { 3750 var div = document.createElement( "div" ); 3751 3752 // Support: IE<9 3753 support.deleteExpando = true; 3754 try { 3755 delete div.test; 3756 } catch ( e ) { 3757 support.deleteExpando = false; 3758 } 3759 3760 // Null elements to avoid leaks in IE. 3761 div = null; 3762} )(); 3763var acceptData = function( elem ) { 3764 var noData = jQuery.noData[ ( elem.nodeName + " " ).toLowerCase() ], 3765 nodeType = +elem.nodeType || 1; 3766 3767 // Do not set data on non-element DOM nodes because it will not be cleared (#8335). 3768 return nodeType !== 1 && nodeType !== 9 ? 3769 false : 3770 3771 // Nodes accept data unless otherwise specified; rejection can be conditional 3772 !noData || noData !== true && elem.getAttribute( "classid" ) === noData; 3773}; 3774 3775 3776 3777 3778var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 3779 rmultiDash = /([A-Z])/g; 3780 3781function dataAttr( elem, key, data ) { 3782 3783 // If nothing was found internally, try to fetch any 3784 // data from the HTML5 data-* attribute 3785 if ( data === undefined && elem.nodeType === 1 ) { 3786 3787 var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); 3788 3789 data = elem.getAttribute( name ); 3790 3791 if ( typeof data === "string" ) { 3792 try { 3793 data = data === "true" ? true :
vendor: 11,186 bytes, lines 3794-4258
3794 data === "false" ? false : 3795 data === "null" ? null : 3796 3797 // Only convert to a number if it doesn't change the string 3798 +data + "" === data ? +data : 3799 rbrace.test( data ) ? jQuery.parseJSON( data ) : 3800 data; 3801 } catch ( e ) {} 3802 3803 // Make sure we set the data so it isn't changed later 3804 jQuery.data( elem, key, data ); 3805 3806 } else { 3807 data = undefined; 3808 } 3809 } 3810 3811 return data; 3812} 3813 3814// checks a cache object for emptiness 3815function isEmptyDataObject( obj ) { 3816 var name; 3817 for ( name in obj ) { 3818 3819 // if the public data object is empty, the private is still empty 3820 if ( name === "data" && jQuery.isEmptyObject( obj[ name ] ) ) { 3821 continue; 3822 } 3823 if ( name !== "toJSON" ) { 3824 return false; 3825 } 3826 } 3827 3828 return true; 3829} 3830 3831function internalData( elem, name, data, pvt /* Internal Use Only */ ) { 3832 if ( !acceptData( elem ) ) { 3833 return; 3834 } 3835 3836 var ret, thisCache, 3837 internalKey = jQuery.expando, 3838 3839 // We have to handle DOM nodes and JS objects differently because IE6-7 3840 // can't GC object references properly across the DOM-JS boundary 3841 isNode = elem.nodeType, 3842 3843 // Only DOM nodes need the global jQuery cache; JS object data is 3844 // attached directly to the object so GC can occur automatically 3845 cache = isNode ? jQuery.cache : elem, 3846 3847 // Only defining an ID for JS objects if its cache already exists allows 3848 // the code to shortcut on the same path as a DOM node with no cache 3849 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; 3850 3851 // Avoid doing any more work than we need to when trying to get data on an 3852 // object that has no data at all 3853 if ( ( !id || !cache[ id ] || ( !pvt && !cache[ id ].data ) ) && 3854 data === undefined && typeof name === "string" ) { 3855 return; 3856 } 3857 3858 if ( !id ) { 3859 3860 // Only DOM nodes need a new unique ID for each element since their data 3861 // ends up in the global cache 3862 if ( isNode ) { 3863 id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; 3864 } else { 3865 id = internalKey; 3866 } 3867 } 3868 3869 if ( !cache[ id ] ) { 3870 3871 // Avoid exposing jQuery metadata on plain JS objects when the object 3872 // is serialized using JSON.stringify 3873 cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; 3874 } 3875 3876 // An object can be passed to jQuery.data instead of a key/value pair; this gets 3877 // shallow copied over onto the existing cache 3878 if ( typeof name === "object" || typeof name === "function" ) { 3879 if ( pvt ) { 3880 cache[ id ] = jQuery.extend( cache[ id ], name ); 3881 } else { 3882 cache[ id ].data = jQuery.extend( cache[ id ].data, name ); 3883 } 3884 } 3885 3886 thisCache = cache[ id ]; 3887 3888 // jQuery data() is stored in a separate object inside the object's internal data 3889 // cache in order to avoid key collisions between internal data and user-defined 3890 // data. 3891 if ( !pvt ) { 3892 if ( !thisCache.data ) { 3893 thisCache.data = {}; 3894 } 3895 3896 thisCache = thisCache.data; 3897 } 3898 3899 if ( data !== undefined ) { 3900 thisCache[ jQuery.camelCase( name ) ] = data; 3901 } 3902 3903 // Check for both converted-to-camel and non-converted data property names 3904 // If a data property was specified 3905 if ( typeof name === "string" ) { 3906 3907 // First Try to find as-is property data 3908 ret = thisCache[ name ]; 3909 3910 // Test for null|undefined property data 3911 if ( ret == null ) { 3912 3913 // Try to find the camelCased property 3914 ret = thisCache[ jQuery.camelCase( name ) ]; 3915 } 3916 } else { 3917 ret = thisCache; 3918 } 3919 3920 return ret; 3921} 3922 3923function internalRemoveData( elem, name, pvt ) { 3924 if ( !acceptData( elem ) ) { 3925 return; 3926 } 3927 3928 var thisCache, i, 3929 isNode = elem.nodeType, 3930 3931 // See jQuery.data for more information 3932 cache = isNode ? jQuery.cache : elem, 3933 id = isNode ? elem[ jQuery.expando ] : jQuery.expando; 3934 3935 // If there is already no cache entry for this object, there is no 3936 // purpose in continuing 3937 if ( !cache[ id ] ) { 3938 return; 3939 } 3940 3941 if ( name ) { 3942 3943 thisCache = pvt ? cache[ id ] : cache[ id ].data; 3944 3945 if ( thisCache ) { 3946 3947 // Support array or space separated string names for data keys 3948 if ( !jQuery.isArray( name ) ) { 3949 3950 // try the string as a key before any manipulation 3951 if ( name in thisCache ) { 3952 name = [ name ]; 3953 } else { 3954 3955 // split the camel cased version by spaces unless a key with the spaces exists 3956 name = jQuery.camelCase( name ); 3957 if ( name in thisCache ) { 3958 name = [ name ]; 3959 } else { 3960 name = name.split( " " ); 3961 } 3962 } 3963 } else { 3964 3965 // If "name" is an array of keys... 3966 // When data is initially created, via ("key", "val") signature, 3967 // keys will be converted to camelCase. 3968 // Since there is no way to tell _how_ a key was added, remove 3969 // both plain key and camelCase key. #12786 3970 // This will only penalize the array argument path. 3971 name = name.concat( jQuery.map( name, jQuery.camelCase ) ); 3972 } 3973 3974 i = name.length; 3975 while ( i-- ) { 3976 delete thisCache[ name[ i ] ]; 3977 } 3978 3979 // If there is no data left in the cache, we want to continue 3980 // and let the cache object itself get destroyed 3981 if ( pvt ? !isEmptyDataObject( thisCache ) : !jQuery.isEmptyObject( thisCache ) ) { 3982 return; 3983 } 3984 } 3985 } 3986 3987 // See jQuery.data for more information 3988 if ( !pvt ) { 3989 delete cache[ id ].data; 3990 3991 // Don't destroy the parent cache unless the internal data object 3992 // had been the only thing left in it 3993 if ( !isEmptyDataObject( cache[ id ] ) ) { 3994 return; 3995 } 3996 } 3997 3998 // Destroy the cache 3999 if ( isNode ) { 4000 jQuery.cleanData( [ elem ], true ); 4001 4002 // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) 4003 /* jshint eqeqeq: false */ 4004 } else if ( support.deleteExpando || cache != cache.window ) { 4005 /* jshint eqeqeq: true */ 4006 delete cache[ id ]; 4007 4008 // When all else fails, undefined 4009 } else { 4010 cache[ id ] = undefined; 4011 } 4012} 4013 4014jQuery.extend( { 4015 cache: {}, 4016 4017 // The following elements (space-suffixed to avoid Object.prototype collisions) 4018 // throw uncatchable exceptions if you attempt to set expando properties 4019 noData: { 4020 "applet ": true, 4021 "embed ": true, 4022 4023 // ...but Flash objects (which have this classid) *can* handle expandos 4024 "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 4025 }, 4026 4027 hasData: function( elem ) { 4028 elem = elem.nodeType ? jQuery.cache[ elem[ jQuery.expando ] ] : elem[ jQuery.expando ]; 4029 return !!elem && !isEmptyDataObject( elem ); 4030 }, 4031 4032 data: function( elem, name, data ) { 4033 return internalData( elem, name, data ); 4034 }, 4035 4036 removeData: function( elem, name ) { 4037 return internalRemoveData( elem, name ); 4038 }, 4039 4040 // For internal use only. 4041 _data: function( elem, name, data ) { 4042 return internalData( elem, name, data, true ); 4043 }, 4044 4045 _removeData: function( elem, name ) { 4046 return internalRemoveData( elem, name, true ); 4047 } 4048} ); 4049 4050jQuery.fn.extend( { 4051 data: function( key, value ) { 4052 var i, name, data, 4053 elem = this[ 0 ], 4054 attrs = elem && elem.attributes; 4055 4056 // Special expections of .data basically thwart jQuery.access, 4057 // so implement the relevant behavior ourselves 4058 4059 // Gets all values 4060 if ( key === undefined ) { 4061 if ( this.length ) { 4062 data = jQuery.data( elem ); 4063 4064 if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { 4065 i = attrs.length; 4066 while ( i-- ) { 4067 4068 // Support: IE11+ 4069 // The attrs elements can be null (#14894) 4070 if ( attrs[ i ] ) { 4071 name = attrs[ i ].name; 4072 if ( name.indexOf( "data-" ) === 0 ) { 4073 name = jQuery.camelCase( name.slice( 5 ) ); 4074 dataAttr( elem, name, data[ name ] ); 4075 } 4076 } 4077 } 4078 jQuery._data( elem, "parsedAttrs", true ); 4079 } 4080 } 4081 4082 return data; 4083 } 4084 4085 // Sets multiple values 4086 if ( typeof key === "object" ) { 4087 return this.each( function() { 4088 jQuery.data( this, key ); 4089 } ); 4090 } 4091 4092 return arguments.length > 1 ? 4093 4094 // Sets one value 4095 this.each( function() { 4096 jQuery.data( this, key, value ); 4097 } ) : 4098 4099 // Gets one value 4100 // Try to fetch any internally stored data first 4101 elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; 4102 }, 4103 4104 removeData: function( key ) { 4105 return this.each( function() { 4106 jQuery.removeData( this, key ); 4107 } ); 4108 } 4109} ); 4110 4111 4112jQuery.extend( { 4113 queue: function( elem, type, data ) { 4114 var queue; 4115 4116 if ( elem ) { 4117 type = ( type || "fx" ) + "queue"; 4118 queue = jQuery._data( elem, type ); 4119 4120 // Speed up dequeue by getting out quickly if this is just a lookup 4121 if ( data ) { 4122 if ( !queue || jQuery.isArray( data ) ) { 4123 queue = jQuery._data( elem, type, jQuery.makeArray( data ) ); 4124 } else { 4125 queue.push( data ); 4126 } 4127 } 4128 return queue || []; 4129 } 4130 }, 4131 4132 dequeue: function( elem, type ) { 4133 type = type || "fx"; 4134 4135 var queue = jQuery.queue( elem, type ), 4136 startLength = queue.length, 4137 fn = queue.shift(), 4138 hooks = jQuery._queueHooks( elem, type ), 4139 next = function() { 4140 jQuery.dequeue( elem, type ); 4141 }; 4142 4143 // If the fx queue is dequeued, always remove the progress sentinel 4144 if ( fn === "inprogress" ) { 4145 fn = queue.shift(); 4146 startLength--; 4147 } 4148 4149 if ( fn ) { 4150 4151 // Add a progress sentinel to prevent the fx queue from being 4152 // automatically dequeued 4153 if ( type === "fx" ) { 4154 queue.unshift( "inprogress" ); 4155 } 4156 4157 // clear up the last queue stop function 4158 delete hooks.stop; 4159 fn.call( elem, next, hooks ); 4160 } 4161 4162 if ( !startLength && hooks ) { 4163 hooks.empty.fire(); 4164 } 4165 }, 4166 4167 // not intended for public consumption - generates a queueHooks object, 4168 // or returns the current one 4169 _queueHooks: function( elem, type ) { 4170 var key = type + "queueHooks"; 4171 return jQuery._data( elem, key ) || jQuery._data( elem, key, { 4172 empty: jQuery.Callbacks( "once memory" ).add( function() { 4173 jQuery._removeData( elem, type + "queue" ); 4174 jQuery._removeData( elem, key ); 4175 } ) 4176 } ); 4177 } 4178} ); 4179 4180jQuery.fn.extend( { 4181 queue: function( type, data ) { 4182 var setter = 2; 4183 4184 if ( typeof type !== "string" ) { 4185 data = type; 4186 type = "fx"; 4187 setter--; 4188 } 4189 4190 if ( arguments.length < setter ) { 4191 return jQuery.queue( this[ 0 ], type ); 4192 } 4193 4194 return data === undefined ? 4195 this : 4196 this.each( function() { 4197 var queue = jQuery.queue( this, type, data ); 4198 4199 // ensure a hooks for this queue 4200 jQuery._queueHooks( this, type ); 4201 4202 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 4203 jQuery.dequeue( this, type ); 4204 } 4205 } ); 4206 }, 4207 dequeue: function( type ) { 4208 return this.each( function() { 4209 jQuery.dequeue( this, type ); 4210 } ); 4211 }, 4212 clearQueue: function( type ) { 4213 return this.queue( type || "fx", [] ); 4214 }, 4215 4216 // Get a promise resolved when queues of a certain type 4217 // are emptied (fx is the type by default) 4218 promise: function( type, obj ) { 4219 var tmp, 4220 count = 1, 4221 defer = jQuery.Deferred(), 4222 elements = this, 4223 i = this.length, 4224 resolve = function() { 4225 if ( !( --count ) ) { 4226 defer.resolveWith( elements, [ elements ] ); 4227 } 4228 }; 4229 4230 if ( typeof type !== "string" ) { 4231 obj = type; 4232 type = undefined; 4233 } 4234 type = type || "fx"; 4235 4236 while ( i-- ) { 4237 tmp = jQuery._data( elements[ i ], type + "queueHooks" ); 4238 if ( tmp && tmp.empty ) { 4239 count++; 4240 tmp.empty.add( resolve ); 4241 } 4242 } 4243 resolve(); 4244 return defer.promise( obj ); 4245 } 4246} ); 4247 4248 4249( function() { 4250 var shrinkWrapBlocksVal; 4251 4252 support.shrinkWrapBlocks = function() { 4253 if ( shrinkWrapBlocksVal != null ) { 4254 return shrinkWrapBlocksVal; 4255 } 4256 4257 // Will be changed later if needed. 4258 shrinkWrapBlocksVal = false;
vendor: 4,171 bytes, lines 4259-4407
4259 4260 // Minified: var b,c,d 4261 var div, body, container; 4262 4263 body = document.getElementsByTagName( "body" )[ 0 ]; 4264 if ( !body || !body.style ) { 4265 4266 // Test fired too early or in an unsupported environment, exit. 4267 return; 4268 } 4269 4270 // Setup 4271 div = document.createElement( "div" ); 4272 container = document.createElement( "div" ); 4273 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; 4274 body.appendChild( container ).appendChild( div ); 4275 4276 // Support: IE6 4277 // Check if elements with layout shrink-wrap their children 4278 if ( typeof div.style.zoom !== "undefined" ) { 4279 4280 // Reset CSS: box-sizing; display; margin; border 4281 div.style.cssText = 4282 4283 // Support: Firefox<29, Android 2.3 4284 // Vendor-prefix box-sizing 4285 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + 4286 "box-sizing:content-box;display:block;margin:0;border:0;" + 4287 "padding:1px;width:1px;zoom:1"; 4288 div.appendChild( document.createElement( "div" ) ).style.width = "5px"; 4289 shrinkWrapBlocksVal = div.offsetWidth !== 3; 4290 } 4291 4292 body.removeChild( container ); 4293 4294 return shrinkWrapBlocksVal; 4295 }; 4296 4297} )(); 4298var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 4299 4300var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 4301 4302 4303var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 4304 4305var isHidden = function( elem, el ) { 4306 4307 // isHidden might be called from jQuery#filter function; 4308 // in that case, element will be second argument 4309 elem = el || elem; 4310 return jQuery.css( elem, "display" ) === "none" || 4311 !jQuery.contains( elem.ownerDocument, elem ); 4312 }; 4313 4314 4315 4316function adjustCSS( elem, prop, valueParts, tween ) { 4317 var adjusted, 4318 scale = 1, 4319 maxIterations = 20, 4320 currentValue = tween ? 4321 function() { return tween.cur(); } : 4322 function() { return jQuery.css( elem, prop, "" ); }, 4323 initial = currentValue(), 4324 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 4325 4326 // Starting value computation is required for potential unit mismatches 4327 initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 4328 rcssNum.exec( jQuery.css( elem, prop ) ); 4329 4330 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 4331 4332 // Trust units reported by jQuery.css 4333 unit = unit || initialInUnit[ 3 ]; 4334 4335 // Make sure we update the tween properties later on 4336 valueParts = valueParts || []; 4337 4338 // Iteratively approximate from a nonzero starting point 4339 initialInUnit = +initial || 1; 4340 4341 do { 4342 4343 // If previous iteration zeroed out, double until we get *something*. 4344 // Use string for doubling so we don't accidentally see scale as unchanged below 4345 scale = scale || ".5"; 4346 4347 // Adjust and apply 4348 initialInUnit = initialInUnit / scale; 4349 jQuery.style( elem, prop, initialInUnit + unit ); 4350 4351 // Update scale, tolerating zero or NaN from tween.cur() 4352 // Break the loop if scale is unchanged or perfect, or if we've just had enough. 4353 } while ( 4354 scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations 4355 ); 4356 } 4357 4358 if ( valueParts ) { 4359 initialInUnit = +initialInUnit || +initial || 0; 4360 4361 // Apply relative offset (+=/-=) if specified 4362 adjusted = valueParts[ 1 ] ? 4363 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 4364 +valueParts[ 2 ]; 4365 if ( tween ) { 4366 tween.unit = unit; 4367 tween.start = initialInUnit; 4368 tween.end = adjusted; 4369 } 4370 } 4371 return adjusted; 4372} 4373 4374 4375// Multifunctional method to get and set values of a collection 4376// The value/s can optionally be executed if it's a function 4377var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 4378 var i = 0, 4379 length = elems.length, 4380 bulk = key == null; 4381 4382 // Sets many values 4383 if ( jQuery.type( key ) === "object" ) { 4384 chainable = true; 4385 for ( i in key ) { 4386 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 4387 } 4388 4389 // Sets one value 4390 } else if ( value !== undefined ) { 4391 chainable = true; 4392 4393 if ( !jQuery.isFunction( value ) ) { 4394 raw = true; 4395 } 4396 4397 if ( bulk ) { 4398 4399 // Bulk operations run against the entire set 4400 if ( raw ) { 4401 fn.call( elems, value ); 4402 fn = null; 4403 4404 // ...except when executing function values 4405 } else { 4406 bulk = fn; 4407 fn = function( elem, key, value ) {
4408 return bulk.call( jQuery( elem ), value ); 4409 }; 4410 } 4411 } 4412 4413 if ( fn ) { 4414 for ( ; i < length; i++ ) { 4415 fn( 4416 elems[ i ], 4417 key, 4418 raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) ) 4419 ); 4420 } 4421 } 4422 } 4423 4424 return chainable ? 4425 elems : 4426 4427 // Gets 4428 bulk ? 4429 fn.call( elems ) : 4430 length ? fn( elems[ 0 ], key ) : emptyGet; 4431}; 4432var rcheckableType = ( /^(?:checkbox|radio)$/i ); 4433 4434var rtagName = ( /<([\w:-]+)/ ); 4435 4436var rscriptType = ( /^$|\/(?:java|ecma)script/i ); 4437 4438var rleadingWhitespace = ( /^\s+/ ); 4439 4440var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" + 4441 "details|dialog|figcaption|figure|footer|header|hgroup|main|" + 4442 "mark|meter|nav|output|picture|progress|section|summary|template|time|video"; 4443 4444 4445 4446function createSafeFragment( document ) { 4447 var list = nodeNames.split( "|" ), 4448 safeFrag = document.createDocumentFragment(); 4449 4450 if ( safeFrag.createElement ) { 4451 while ( list.length ) { 4452 safeFrag.createElement( 4453 list.pop() 4454 ); 4455 } 4456 } 4457 return safeFrag; 4458} 4459 4460 4461( function() { 4462 var div = document.createElement( "div" ), 4463 fragment = document.createDocumentFragment(), 4464 input = document.createElement( "input" ); 4465 4466 // Setup 4467 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; 4468 4469 // IE strips leading whitespace when .innerHTML is used 4470 support.leadingWhitespace = div.firstChild.nodeType === 3; 4471 4472 // Make sure that tbody elements aren't automatically inserted 4473 // IE will insert them into empty tables 4474 support.tbody = !div.getElementsByTagName( "tbody" ).length; 4475 4476 // Make sure that link elements get serialized correctly by innerHTML 4477 // This requires a wrapper element in IE 4478 support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; 4479 4480 // Makes sure cloning an html5 element does not cause problems 4481 // Where outerHTML is undefined, this still works 4482 support.html5Clone = 4483 document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>"; 4484 4485 // Check if a disconnected checkbox will retain its checked 4486 // value of true after appended to the DOM (IE6/7) 4487 input.type = "checkbox"; 4488 input.checked = true; 4489 fragment.appendChild( input ); 4490 support.appendChecked = input.checked; 4491 4492 // Make sure textarea (and checkbox) defaultValue is properly cloned 4493 // Support: IE6-IE11+ 4494 div.innerHTML = "<textarea>x</textarea>"; 4495 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 4496 4497 // #11217 - WebKit loses check when the name is after the checked attribute 4498 fragment.appendChild( div ); 4499 4500 // Support: Windows Web Apps (WWA) 4501 // `name` and `type` must use .setAttribute for WWA (#14901) 4502 input = document.createElement( "input" ); 4503 input.setAttribute( "type", "radio" ); 4504 input.setAttribute( "checked", "checked" ); 4505 input.setAttribute( "name", "t" ); 4506 4507 div.appendChild( input ); 4508 4509 // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 4510 // old WebKit doesn't clone checked state correctly in fragments 4511 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 4512 4513 // Support: IE<9 4514 // Cloned elements keep attachEvent handlers, we use addEventListener on IE9+ 4515 support.noCloneEvent = !!div.addEventListener; 4516 4517 // Support: IE<9 4518 // Since attributes and properties are the same in IE, 4519 // cleanData must set properties to undefined rather than use removeAttribute 4520 div[ jQuery.expando ] = 1; 4521 support.attributes = !div.getAttribute( jQuery.expando ); 4522} )(); 4523 4524 4525// We have to close these tags to support XHTML (#13200) 4526var wrapMap = { 4527 option: [ 1, "<select multiple='multiple'>", "</select>" ], 4528 legend: [ 1, "<fieldset>", "</fieldset>" ], 4529 area: [ 1, "<map>", "</map>" ], 4530 4531 // Support: IE8 4532 param: [ 1, "<object>", "</object>" ], 4533 thead: [ 1, "<table>", "</table>" ], 4534 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 4535 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], 4536 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 4537 4538 // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, 4539 // unless wrapped in a div with non-breaking characters in front of it. 4540 _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] 4541}; 4542 4543// Support: IE8-IE9 4544wrapMap.optgroup = wrapMap.option; 4545 4546wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 4547wrapMap.th = wrapMap.td; 4548 4549 4550function getAll( context, tag ) { 4551 var elems, elem, 4552 i = 0, 4553 found = typeof context.getElementsByTagName !== "undefined" ? 4554 context.getElementsByTagName( tag || "*" ) : 4555 typeof context.querySelectorAll !== "undefined" ? 4556 context.querySelectorAll( tag || "*" ) : 4557 undefined; 4558 4559 if ( !found ) { 4560 for ( found = [], elems = context.childNodes || context; 4561 ( elem = elems[ i ] ) != null; 4562 i++ 4563 ) { 4564 if ( !tag || jQuery.nodeName( elem, tag ) ) { 4565 found.push( elem ); 4566 } else { 4567 jQuery.merge( found, getAll( elem, tag ) ); 4568 } 4569 } 4570 } 4571 4572 return tag === undefined || tag && jQuery.nodeName( context, tag ) ? 4573 jQuery.merge( [ context ], found ) : 4574 found; 4575} 4576 4577 4578// Mark scripts as having already been evaluated 4579function setGlobalEval( elems, refElements ) { 4580 var elem, 4581 i = 0; 4582 for ( ; ( elem = elems[ i ] ) != null; i++ ) { 4583 jQuery._data( 4584 elem, 4585 "globalEval", 4586 !refElements || jQuery._data( refElements[ i ], "globalEval" ) 4587 ); 4588 } 4589} 4590 4591
vendor: 45,546 bytes, lines 4592-6224
4592var rhtml = /<|&#?\w+;/, 4593 rtbody = /<tbody/i; 4594 4595function fixDefaultChecked( elem ) { 4596 if ( rcheckableType.test( elem.type ) ) { 4597 elem.defaultChecked = elem.checked; 4598 } 4599} 4600 4601function buildFragment( elems, context, scripts, selection, ignored ) { 4602 var j, elem, contains, 4603 tmp, tag, tbody, wrap, 4604 l = elems.length, 4605 4606 // Ensure a safe fragment 4607 safe = createSafeFragment( context ), 4608 4609 nodes = [], 4610 i = 0; 4611 4612 for ( ; i < l; i++ ) { 4613 elem = elems[ i ]; 4614 4615 if ( elem || elem === 0 ) { 4616 4617 // Add nodes directly 4618 if ( jQuery.type( elem ) === "object" ) { 4619 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 4620 4621 // Convert non-html into a text node 4622 } else if ( !rhtml.test( elem ) ) { 4623 nodes.push( context.createTextNode( elem ) ); 4624 4625 // Convert html into DOM nodes 4626 } else { 4627 tmp = tmp || safe.appendChild( context.createElement( "div" ) ); 4628 4629 // Deserialize a standard representation 4630 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 4631 wrap = wrapMap[ tag ] || wrapMap._default; 4632 4633 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 4634 4635 // Descend through wrappers to the right content 4636 j = wrap[ 0 ]; 4637 while ( j-- ) { 4638 tmp = tmp.lastChild; 4639 } 4640 4641 // Manually add leading whitespace removed by IE 4642 if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { 4643 nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[ 0 ] ) ); 4644 } 4645 4646 // Remove IE's autoinserted <tbody> from table fragments 4647 if ( !support.tbody ) { 4648 4649 // String was a <table>, *may* have spurious <tbody> 4650 elem = tag === "table" && !rtbody.test( elem ) ? 4651 tmp.firstChild : 4652 4653 // String was a bare <thead> or <tfoot> 4654 wrap[ 1 ] === "<table>" && !rtbody.test( elem ) ? 4655 tmp : 4656 0; 4657 4658 j = elem && elem.childNodes.length; 4659 while ( j-- ) { 4660 if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) && 4661 !tbody.childNodes.length ) { 4662 4663 elem.removeChild( tbody ); 4664 } 4665 } 4666 } 4667 4668 jQuery.merge( nodes, tmp.childNodes ); 4669 4670 // Fix #12392 for WebKit and IE > 9 4671 tmp.textContent = ""; 4672 4673 // Fix #12392 for oldIE 4674 while ( tmp.firstChild ) { 4675 tmp.removeChild( tmp.firstChild ); 4676 } 4677 4678 // Remember the top-level container for proper cleanup 4679 tmp = safe.lastChild; 4680 } 4681 } 4682 } 4683 4684 // Fix #11356: Clear elements from fragment 4685 if ( tmp ) { 4686 safe.removeChild( tmp ); 4687 } 4688 4689 // Reset defaultChecked for any radios and checkboxes 4690 // about to be appended to the DOM in IE 6/7 (#8060) 4691 if ( !support.appendChecked ) { 4692 jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); 4693 } 4694 4695 i = 0; 4696 while ( ( elem = nodes[ i++ ] ) ) { 4697 4698 // Skip elements already in the context collection (trac-4087) 4699 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 4700 if ( ignored ) { 4701 ignored.push( elem ); 4702 } 4703 4704 continue; 4705 } 4706 4707 contains = jQuery.contains( elem.ownerDocument, elem ); 4708 4709 // Append to fragment 4710 tmp = getAll( safe.appendChild( elem ), "script" ); 4711 4712 // Preserve script evaluation history 4713 if ( contains ) { 4714 setGlobalEval( tmp ); 4715 } 4716 4717 // Capture executables 4718 if ( scripts ) { 4719 j = 0; 4720 while ( ( elem = tmp[ j++ ] ) ) { 4721 if ( rscriptType.test( elem.type || "" ) ) { 4722 scripts.push( elem ); 4723 } 4724 } 4725 } 4726 } 4727 4728 tmp = null; 4729 4730 return safe; 4731} 4732 4733 4734( function() { 4735 var i, eventName, 4736 div = document.createElement( "div" ); 4737 4738 // Support: IE<9 (lack submit/change bubble), Firefox (lack focus(in | out) events) 4739 for ( i in { submit: true, change: true, focusin: true } ) { 4740 eventName = "on" + i; 4741 4742 if ( !( support[ i ] = eventName in window ) ) { 4743 4744 // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) 4745 div.setAttribute( eventName, "t" ); 4746 support[ i ] = div.attributes[ eventName ].expando === false; 4747 } 4748 } 4749 4750 // Null elements to avoid leaks in IE. 4751 div = null; 4752} )(); 4753 4754 4755var rformElems = /^(?:input|select|textarea)$/i, 4756 rkeyEvent = /^key/, 4757 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, 4758 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 4759 rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 4760 4761function returnTrue() { 4762 return true; 4763} 4764 4765function returnFalse() { 4766 return false; 4767} 4768 4769// Support: IE9 4770// See #13393 for more info 4771function safeActiveElement() { 4772 try { 4773 return document.activeElement; 4774 } catch ( err ) { } 4775} 4776 4777function on( elem, types, selector, data, fn, one ) { 4778 var origFn, type; 4779 4780 // Types can be a map of types/handlers 4781 if ( typeof types === "object" ) { 4782 4783 // ( types-Object, selector, data ) 4784 if ( typeof selector !== "string" ) { 4785 4786 // ( types-Object, data ) 4787 data = data || selector; 4788 selector = undefined; 4789 } 4790 for ( type in types ) { 4791 on( elem, type, selector, data, types[ type ], one ); 4792 } 4793 return elem; 4794 } 4795 4796 if ( data == null && fn == null ) { 4797 4798 // ( types, fn ) 4799 fn = selector; 4800 data = selector = undefined; 4801 } else if ( fn == null ) { 4802 if ( typeof selector === "string" ) { 4803 4804 // ( types, selector, fn ) 4805 fn = data; 4806 data = undefined; 4807 } else { 4808 4809 // ( types, data, fn ) 4810 fn = data; 4811 data = selector; 4812 selector = undefined; 4813 } 4814 } 4815 if ( fn === false ) { 4816 fn = returnFalse; 4817 } else if ( !fn ) { 4818 return elem; 4819 } 4820 4821 if ( one === 1 ) { 4822 origFn = fn; 4823 fn = function( event ) { 4824 4825 // Can use an empty set, since event contains the info 4826 jQuery().off( event ); 4827 return origFn.apply( this, arguments ); 4828 }; 4829 4830 // Use same guid so caller can remove using origFn 4831 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 4832 } 4833 return elem.each( function() { 4834 jQuery.event.add( this, types, fn, data, selector ); 4835 } ); 4836} 4837 4838/* 4839 * Helper functions for managing events -- not part of the public interface. 4840 * Props to Dean Edwards' addEvent library for many of the ideas. 4841 */ 4842jQuery.event = { 4843 4844 global: {}, 4845 4846 add: function( elem, types, handler, data, selector ) { 4847 var tmp, events, t, handleObjIn, 4848 special, eventHandle, handleObj, 4849 handlers, type, namespaces, origType, 4850 elemData = jQuery._data( elem ); 4851 4852 // Don't attach events to noData or text/comment nodes (but allow plain objects) 4853 if ( !elemData ) { 4854 return; 4855 } 4856 4857 // Caller can pass in an object of custom data in lieu of the handler 4858 if ( handler.handler ) { 4859 handleObjIn = handler; 4860 handler = handleObjIn.handler; 4861 selector = handleObjIn.selector; 4862 } 4863 4864 // Make sure that the handler has a unique ID, used to find/remove it later 4865 if ( !handler.guid ) { 4866 handler.guid = jQuery.guid++; 4867 } 4868 4869 // Init the element's event structure and main handler, if this is the first 4870 if ( !( events = elemData.events ) ) { 4871 events = elemData.events = {}; 4872 } 4873 if ( !( eventHandle = elemData.handle ) ) { 4874 eventHandle = elemData.handle = function( e ) { 4875 4876 // Discard the second event of a jQuery.event.trigger() and 4877 // when an event is called after a page has unloaded 4878 return typeof jQuery !== "undefined" && 4879 ( !e || jQuery.event.triggered !== e.type ) ? 4880 jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : 4881 undefined; 4882 }; 4883 4884 // Add elem as a property of the handle fn to prevent a memory leak 4885 // with IE non-native events 4886 eventHandle.elem = elem; 4887 } 4888 4889 // Handle multiple events separated by a space 4890 types = ( types || "" ).match( rnotwhite ) || [ "" ]; 4891 t = types.length; 4892 while ( t-- ) { 4893 tmp = rtypenamespace.exec( types[ t ] ) || []; 4894 type = origType = tmp[ 1 ]; 4895 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 4896 4897 // There *must* be a type, no attaching namespace-only handlers 4898 if ( !type ) { 4899 continue; 4900 } 4901 4902 // If event changes its type, use the special event handlers for the changed type 4903 special = jQuery.event.special[ type ] || {}; 4904 4905 // If selector defined, determine special event api type, otherwise given type 4906 type = ( selector ? special.delegateType : special.bindType ) || type; 4907 4908 // Update special based on newly reset type 4909 special = jQuery.event.special[ type ] || {}; 4910 4911 // handleObj is passed to all event handlers 4912 handleObj = jQuery.extend( { 4913 type: type, 4914 origType: origType, 4915 data: data, 4916 handler: handler, 4917 guid: handler.guid, 4918 selector: selector, 4919 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 4920 namespace: namespaces.join( "." ) 4921 }, handleObjIn ); 4922 4923 // Init the event handler queue if we're the first 4924 if ( !( handlers = events[ type ] ) ) { 4925 handlers = events[ type ] = []; 4926 handlers.delegateCount = 0; 4927 4928 // Only use addEventListener/attachEvent if the special events handler returns false 4929 if ( !special.setup || 4930 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 4931 4932 // Bind the global event handler to the element 4933 if ( elem.addEventListener ) { 4934 elem.addEventListener( type, eventHandle, false ); 4935 4936 } else if ( elem.attachEvent ) { 4937 elem.attachEvent( "on" + type, eventHandle ); 4938 } 4939 } 4940 } 4941 4942 if ( special.add ) { 4943 special.add.call( elem, handleObj ); 4944 4945 if ( !handleObj.handler.guid ) { 4946 handleObj.handler.guid = handler.guid; 4947 } 4948 } 4949 4950 // Add to the element's handler list, delegates in front 4951 if ( selector ) { 4952 handlers.splice( handlers.delegateCount++, 0, handleObj ); 4953 } else { 4954 handlers.push( handleObj ); 4955 } 4956 4957 // Keep track of which events have ever been used, for event optimization 4958 jQuery.event.global[ type ] = true; 4959 } 4960 4961 // Nullify elem to prevent memory leaks in IE 4962 elem = null; 4963 }, 4964 4965 // Detach an event or set of events from an element 4966 remove: function( elem, types, handler, selector, mappedTypes ) { 4967 var j, handleObj, tmp, 4968 origCount, t, events, 4969 special, handlers, type, 4970 namespaces, origType, 4971 elemData = jQuery.hasData( elem ) && jQuery._data( elem ); 4972 4973 if ( !elemData || !( events = elemData.events ) ) { 4974 return; 4975 } 4976 4977 // Once for each type.namespace in types; type may be omitted 4978 types = ( types || "" ).match( rnotwhite ) || [ "" ]; 4979 t = types.length; 4980 while ( t-- ) { 4981 tmp = rtypenamespace.exec( types[ t ] ) || []; 4982 type = origType = tmp[ 1 ]; 4983 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 4984 4985 // Unbind all events (on this namespace, if provided) for the element 4986 if ( !type ) { 4987 for ( type in events ) { 4988 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 4989 } 4990 continue; 4991 } 4992 4993 special = jQuery.event.special[ type ] || {}; 4994 type = ( selector ? special.delegateType : special.bindType ) || type; 4995 handlers = events[ type ] || []; 4996 tmp = tmp[ 2 ] && 4997 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 4998 4999 // Remove matching events 5000 origCount = j = handlers.length; 5001 while ( j-- ) { 5002 handleObj = handlers[ j ]; 5003 5004 if ( ( mappedTypes || origType === handleObj.origType ) && 5005 ( !handler || handler.guid === handleObj.guid ) && 5006 ( !tmp || tmp.test( handleObj.namespace ) ) && 5007 ( !selector || selector === handleObj.selector || 5008 selector === "**" && handleObj.selector ) ) { 5009 handlers.splice( j, 1 ); 5010 5011 if ( handleObj.selector ) { 5012 handlers.delegateCount--; 5013 } 5014 if ( special.remove ) { 5015 special.remove.call( elem, handleObj ); 5016 } 5017 } 5018 } 5019 5020 // Remove generic event handler if we removed something and no more handlers exist 5021 // (avoids potential for endless recursion during removal of special event handlers) 5022 if ( origCount && !handlers.length ) { 5023 if ( !special.teardown || 5024 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 5025 5026 jQuery.removeEvent( elem, type, elemData.handle ); 5027 } 5028 5029 delete events[ type ]; 5030 } 5031 } 5032 5033 // Remove the expando if it's no longer used 5034 if ( jQuery.isEmptyObject( events ) ) { 5035 delete elemData.handle; 5036 5037 // removeData also checks for emptiness and clears the expando if empty 5038 // so use it instead of delete 5039 jQuery._removeData( elem, "events" ); 5040 } 5041 }, 5042 5043 trigger: function( event, data, elem, onlyHandlers ) { 5044 var handle, ontype, cur, 5045 bubbleType, special, tmp, i, 5046 eventPath = [ elem || document ], 5047 type = hasOwn.call( event, "type" ) ? event.type : event, 5048 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 5049 5050 cur = tmp = elem = elem || document; 5051 5052 // Don't do events on text and comment nodes 5053 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 5054 return; 5055 } 5056 5057 // focus/blur morphs to focusin/out; ensure we're not firing them right now 5058 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 5059 return; 5060 } 5061 5062 if ( type.indexOf( "." ) > -1 ) { 5063 5064 // Namespaced trigger; create a regexp to match event type in handle() 5065 namespaces = type.split( "." ); 5066 type = namespaces.shift(); 5067 namespaces.sort(); 5068 } 5069 ontype = type.indexOf( ":" ) < 0 && "on" + type; 5070 5071 // Caller can pass in a jQuery.Event object, Object, or just an event type string 5072 event = event[ jQuery.expando ] ? 5073 event : 5074 new jQuery.Event( type, typeof event === "object" && event ); 5075 5076 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 5077 event.isTrigger = onlyHandlers ? 2 : 3; 5078 event.namespace = namespaces.join( "." ); 5079 event.rnamespace = event.namespace ? 5080 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 5081 null; 5082 5083 // Clean up the event in case it is being reused 5084 event.result = undefined; 5085 if ( !event.target ) { 5086 event.target = elem; 5087 } 5088 5089 // Clone any incoming data and prepend the event, creating the handler arg list 5090 data = data == null ? 5091 [ event ] : 5092 jQuery.makeArray( data, [ event ] ); 5093 5094 // Allow special events to draw outside the lines 5095 special = jQuery.event.special[ type ] || {}; 5096 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 5097 return; 5098 } 5099 5100 // Determine event propagation path in advance, per W3C events spec (#9951) 5101 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 5102 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { 5103 5104 bubbleType = special.delegateType || type; 5105 if ( !rfocusMorph.test( bubbleType + type ) ) { 5106 cur = cur.parentNode; 5107 } 5108 for ( ; cur; cur = cur.parentNode ) { 5109 eventPath.push( cur ); 5110 tmp = cur; 5111 } 5112 5113 // Only add window if we got to document (e.g., not plain obj or detached DOM) 5114 if ( tmp === ( elem.ownerDocument || document ) ) { 5115 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 5116 } 5117 } 5118 5119 // Fire handlers on the event path 5120 i = 0; 5121 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 5122 5123 event.type = i > 1 ? 5124 bubbleType : 5125 special.bindType || type; 5126 5127 // jQuery handler 5128 handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && 5129 jQuery._data( cur, "handle" ); 5130 5131 if ( handle ) { 5132 handle.apply( cur, data ); 5133 } 5134 5135 // Native handler 5136 handle = ontype && cur[ ontype ]; 5137 if ( handle && handle.apply && acceptData( cur ) ) { 5138 event.result = handle.apply( cur, data ); 5139 if ( event.result === false ) { 5140 event.preventDefault(); 5141 } 5142 } 5143 } 5144 event.type = type; 5145 5146 // If nobody prevented the default action, do it now 5147 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 5148 5149 if ( 5150 ( !special._default || 5151 special._default.apply( eventPath.pop(), data ) === false 5152 ) && acceptData( elem ) 5153 ) { 5154 5155 // Call a native DOM method on the target with the same name name as the event. 5156 // Can't use an .isFunction() check here because IE6/7 fails that test. 5157 // Don't do default actions on window, that's where global variables be (#6170) 5158 if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { 5159 5160 // Don't re-trigger an onFOO event when we call its FOO() method 5161 tmp = elem[ ontype ]; 5162 5163 if ( tmp ) { 5164 elem[ ontype ] = null; 5165 } 5166 5167 // Prevent re-triggering of the same event, since we already bubbled it above 5168 jQuery.event.triggered = type; 5169 try { 5170 elem[ type ](); 5171 } catch ( e ) { 5172 5173 // IE<9 dies on focus/blur to hidden element (#1486,#12518) 5174 // only reproducible on winXP IE8 native, not IE9 in IE8 mode 5175 } 5176 jQuery.event.triggered = undefined; 5177 5178 if ( tmp ) { 5179 elem[ ontype ] = tmp; 5180 } 5181 } 5182 } 5183 } 5184 5185 return event.result; 5186 }, 5187 5188 dispatch: function( event ) { 5189 5190 // Make a writable jQuery.Event from the native event object 5191 event = jQuery.event.fix( event ); 5192 5193 var i, j, ret, matched, handleObj, 5194 handlerQueue = [], 5195 args = slice.call( arguments ), 5196 handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], 5197 special = jQuery.event.special[ event.type ] || {}; 5198 5199 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5200 args[ 0 ] = event; 5201 event.delegateTarget = this; 5202 5203 // Call the preDispatch hook for the mapped type, and let it bail if desired 5204 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 5205 return; 5206 } 5207 5208 // Determine handlers 5209 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 5210 5211 // Run delegates first; they may want to stop propagation beneath us 5212 i = 0; 5213 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 5214 event.currentTarget = matched.elem; 5215 5216 j = 0; 5217 while ( ( handleObj = matched.handlers[ j++ ] ) && 5218 !event.isImmediatePropagationStopped() ) { 5219 5220 // Triggered event must either 1) have no namespace, or 2) have namespace(s) 5221 // a subset or equal to those in the bound event (both can have no namespace). 5222 if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { 5223 5224 event.handleObj = handleObj; 5225 event.data = handleObj.data; 5226 5227 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 5228 handleObj.handler ).apply( matched.elem, args ); 5229 5230 if ( ret !== undefined ) { 5231 if ( ( event.result = ret ) === false ) { 5232 event.preventDefault(); 5233 event.stopPropagation(); 5234 } 5235 } 5236 } 5237 } 5238 } 5239 5240 // Call the postDispatch hook for the mapped type 5241 if ( special.postDispatch ) { 5242 special.postDispatch.call( this, event ); 5243 } 5244 5245 return event.result; 5246 }, 5247 5248 handlers: function( event, handlers ) { 5249 var i, matches, sel, handleObj, 5250 handlerQueue = [], 5251 delegateCount = handlers.delegateCount, 5252 cur = event.target; 5253 5254 // Support (at least): Chrome, IE9 5255 // Find delegate handlers 5256 // Black-hole SVG <use> instance trees (#13180) 5257 // 5258 // Support: Firefox<=42+ 5259 // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343) 5260 if ( delegateCount && cur.nodeType && 5261 ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) { 5262 5263 /* jshint eqeqeq: false */ 5264 for ( ; cur != this; cur = cur.parentNode || this ) { 5265 /* jshint eqeqeq: true */ 5266 5267 // Don't check non-elements (#13208) 5268 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 5269 if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) { 5270 matches = []; 5271 for ( i = 0; i < delegateCount; i++ ) { 5272 handleObj = handlers[ i ]; 5273 5274 // Don't conflict with Object.prototype properties (#13203) 5275 sel = handleObj.selector + " "; 5276 5277 if ( matches[ sel ] === undefined ) { 5278 matches[ sel ] = handleObj.needsContext ? 5279 jQuery( sel, this ).index( cur ) > -1 : 5280 jQuery.find( sel, this, null, [ cur ] ).length; 5281 } 5282 if ( matches[ sel ] ) { 5283 matches.push( handleObj ); 5284 } 5285 } 5286 if ( matches.length ) { 5287 handlerQueue.push( { elem: cur, handlers: matches } ); 5288 } 5289 } 5290 } 5291 } 5292 5293 // Add the remaining (directly-bound) handlers 5294 if ( delegateCount < handlers.length ) { 5295 handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } ); 5296 } 5297 5298 return handlerQueue; 5299 }, 5300 5301 fix: function( event ) { 5302 if ( event[ jQuery.expando ] ) { 5303 return event; 5304 } 5305 5306 // Create a writable copy of the event object and normalize some properties 5307 var i, prop, copy, 5308 type = event.type, 5309 originalEvent = event, 5310 fixHook = this.fixHooks[ type ]; 5311 5312 if ( !fixHook ) { 5313 this.fixHooks[ type ] = fixHook = 5314 rmouseEvent.test( type ) ? this.mouseHooks : 5315 rkeyEvent.test( type ) ? this.keyHooks : 5316 {}; 5317 } 5318 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; 5319 5320 event = new jQuery.Event( originalEvent ); 5321 5322 i = copy.length; 5323 while ( i-- ) { 5324 prop = copy[ i ]; 5325 event[ prop ] = originalEvent[ prop ]; 5326 } 5327 5328 // Support: IE<9 5329 // Fix target property (#1925) 5330 if ( !event.target ) { 5331 event.target = originalEvent.srcElement || document; 5332 } 5333 5334 // Support: Safari 6-8+ 5335 // Target should not be a text node (#504, #13143) 5336 if ( event.target.nodeType === 3 ) { 5337 event.target = event.target.parentNode; 5338 } 5339 5340 // Support: IE<9 5341 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) 5342 event.metaKey = !!event.metaKey; 5343 5344 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; 5345 }, 5346 5347 // Includes some event props shared by KeyEvent and MouseEvent 5348 props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " + 5349 "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ), 5350 5351 fixHooks: {}, 5352 5353 keyHooks: { 5354 props: "char charCode key keyCode".split( " " ), 5355 filter: function( event, original ) { 5356 5357 // Add which for key events 5358 if ( event.which == null ) { 5359 event.which = original.charCode != null ? original.charCode : original.keyCode; 5360 } 5361 5362 return event; 5363 } 5364 }, 5365 5366 mouseHooks: { 5367 props: ( "button buttons clientX clientY fromElement offsetX offsetY " + 5368 "pageX pageY screenX screenY toElement" ).split( " " ), 5369 filter: function( event, original ) { 5370 var body, eventDoc, doc, 5371 button = original.button, 5372 fromElement = original.fromElement; 5373 5374 // Calculate pageX/Y if missing and clientX/Y available 5375 if ( event.pageX == null && original.clientX != null ) { 5376 eventDoc = event.target.ownerDocument || document; 5377 doc = eventDoc.documentElement; 5378 body = eventDoc.body; 5379 5380 event.pageX = original.clientX + 5381 ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - 5382 ( doc && doc.clientLeft || body && body.clientLeft || 0 ); 5383 event.pageY = original.clientY + 5384 ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - 5385 ( doc && doc.clientTop || body && body.clientTop || 0 ); 5386 } 5387 5388 // Add relatedTarget, if necessary 5389 if ( !event.relatedTarget && fromElement ) { 5390 event.relatedTarget = fromElement === event.target ? 5391 original.toElement : 5392 fromElement; 5393 } 5394 5395 // Add which for click: 1 === left; 2 === middle; 3 === right 5396 // Note: button is not normalized, so don't use it 5397 if ( !event.which && button !== undefined ) { 5398 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); 5399 } 5400 5401 return event; 5402 } 5403 }, 5404 5405 special: { 5406 load: { 5407 5408 // Prevent triggered image.load events from bubbling to window.load 5409 noBubble: true 5410 }, 5411 focus: { 5412 5413 // Fire native event if possible so blur/focus sequence is correct 5414 trigger: function() { 5415 if ( this !== safeActiveElement() && this.focus ) { 5416 try { 5417 this.focus(); 5418 return false; 5419 } catch ( e ) { 5420 5421 // Support: IE<9 5422 // If we error on focus to hidden element (#1486, #12518), 5423 // let .trigger() run the handlers 5424 } 5425 } 5426 }, 5427 delegateType: "focusin" 5428 }, 5429 blur: { 5430 trigger: function() { 5431 if ( this === safeActiveElement() && this.blur ) { 5432 this.blur(); 5433 return false; 5434 } 5435 }, 5436 delegateType: "focusout" 5437 }, 5438 click: { 5439 5440 // For checkbox, fire native event so checked state will be right 5441 trigger: function() { 5442 if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { 5443 this.click(); 5444 return false; 5445 } 5446 }, 5447 5448 // For cross-browser consistency, don't fire native .click() on links 5449 _default: function( event ) { 5450 return jQuery.nodeName( event.target, "a" ); 5451 } 5452 }, 5453 5454 beforeunload: { 5455 postDispatch: function( event ) { 5456 5457 // Support: Firefox 20+ 5458 // Firefox doesn't alert if the returnValue field is not set. 5459 if ( event.result !== undefined && event.originalEvent ) { 5460 event.originalEvent.returnValue = event.result; 5461 } 5462 } 5463 } 5464 }, 5465 5466 // Piggyback on a donor event to simulate a different one 5467 simulate: function( type, elem, event ) { 5468 var e = jQuery.extend( 5469 new jQuery.Event(), 5470 event, 5471 { 5472 type: type, 5473 isSimulated: true 5474 5475 // Previously, `originalEvent: {}` was set here, so stopPropagation call 5476 // would not be triggered on donor event, since in our own 5477 // jQuery.event.stopPropagation function we had a check for existence of 5478 // originalEvent.stopPropagation method, so, consequently it would be a noop. 5479 // 5480 // Guard for simulated events was moved to jQuery.event.stopPropagation function 5481 // since `originalEvent` should point to the original event for the 5482 // constancy with other events and for more focused logic 5483 } 5484 ); 5485 5486 jQuery.event.trigger( e, null, elem ); 5487 5488 if ( e.isDefaultPrevented() ) { 5489 event.preventDefault(); 5490 } 5491 } 5492}; 5493 5494jQuery.removeEvent = document.removeEventListener ? 5495 function( elem, type, handle ) { 5496 5497 // This "if" is needed for plain objects 5498 if ( elem.removeEventListener ) { 5499 elem.removeEventListener( type, handle ); 5500 } 5501 } : 5502 function( elem, type, handle ) { 5503 var name = "on" + type; 5504 5505 if ( elem.detachEvent ) { 5506 5507 // #8545, #7054, preventing memory leaks for custom events in IE6-8 5508 // detachEvent needed property on element, by name of that event, 5509 // to properly expose it to GC 5510 if ( typeof elem[ name ] === "undefined" ) { 5511 elem[ name ] = null; 5512 } 5513 5514 elem.detachEvent( name, handle ); 5515 } 5516 }; 5517 5518jQuery.Event = function( src, props ) { 5519 5520 // Allow instantiation without the 'new' keyword 5521 if ( !( this instanceof jQuery.Event ) ) { 5522 return new jQuery.Event( src, props ); 5523 } 5524 5525 // Event object 5526 if ( src && src.type ) { 5527 this.originalEvent = src; 5528 this.type = src.type; 5529 5530 // Events bubbling up the document may have been marked as prevented 5531 // by a handler lower down the tree; reflect the correct value. 5532 this.isDefaultPrevented = src.defaultPrevented || 5533 src.defaultPrevented === undefined && 5534 5535 // Support: IE < 9, Android < 4.0 5536 src.returnValue === false ? 5537 returnTrue : 5538 returnFalse; 5539 5540 // Event type 5541 } else { 5542 this.type = src; 5543 } 5544 5545 // Put explicitly provided properties onto the event object 5546 if ( props ) { 5547 jQuery.extend( this, props ); 5548 } 5549 5550 // Create a timestamp if incoming event doesn't have one 5551 this.timeStamp = src && src.timeStamp || jQuery.now(); 5552 5553 // Mark it as fixed 5554 this[ jQuery.expando ] = true; 5555}; 5556 5557// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5558// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5559jQuery.Event.prototype = { 5560 constructor: jQuery.Event, 5561 isDefaultPrevented: returnFalse, 5562 isPropagationStopped: returnFalse, 5563 isImmediatePropagationStopped: returnFalse, 5564 5565 preventDefault: function() { 5566 var e = this.originalEvent; 5567 5568 this.isDefaultPrevented = returnTrue; 5569 if ( !e ) { 5570 return; 5571 } 5572 5573 // If preventDefault exists, run it on the original event 5574 if ( e.preventDefault ) { 5575 e.preventDefault(); 5576 5577 // Support: IE 5578 // Otherwise set the returnValue property of the original event to false 5579 } else { 5580 e.returnValue = false; 5581 } 5582 }, 5583 stopPropagation: function() { 5584 var e = this.originalEvent; 5585 5586 this.isPropagationStopped = returnTrue; 5587 5588 if ( !e || this.isSimulated ) { 5589 return; 5590 } 5591 5592 // If stopPropagation exists, run it on the original event 5593 if ( e.stopPropagation ) { 5594 e.stopPropagation(); 5595 } 5596 5597 // Support: IE 5598 // Set the cancelBubble property of the original event to true 5599 e.cancelBubble = true; 5600 }, 5601 stopImmediatePropagation: function() { 5602 var e = this.originalEvent; 5603 5604 this.isImmediatePropagationStopped = returnTrue; 5605 5606 if ( e && e.stopImmediatePropagation ) { 5607 e.stopImmediatePropagation(); 5608 } 5609 5610 this.stopPropagation(); 5611 } 5612}; 5613 5614// Create mouseenter/leave events using mouseover/out and event-time checks 5615// so that event delegation works in jQuery. 5616// Do the same for pointerenter/pointerleave and pointerover/pointerout 5617// 5618// Support: Safari 7 only 5619// Safari sends mouseenter too often; see: 5620// https://code.google.com/p/chromium/issues/detail?id=470258 5621// for the description of the bug (it existed in older Chrome versions as well). 5622jQuery.each( { 5623 mouseenter: "mouseover", 5624 mouseleave: "mouseout", 5625 pointerenter: "pointerover", 5626 pointerleave: "pointerout" 5627}, function( orig, fix ) { 5628 jQuery.event.special[ orig ] = { 5629 delegateType: fix, 5630 bindType: fix, 5631 5632 handle: function( event ) { 5633 var ret, 5634 target = this, 5635 related = event.relatedTarget, 5636 handleObj = event.handleObj; 5637 5638 // For mouseenter/leave call the handler if related is outside the target. 5639 // NB: No relatedTarget if the mouse left/entered the browser window 5640 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 5641 event.type = handleObj.origType; 5642 ret = handleObj.handler.apply( this, arguments ); 5643 event.type = fix; 5644 } 5645 return ret; 5646 } 5647 }; 5648} ); 5649 5650// IE submit delegation 5651if ( !support.submit ) { 5652 5653 jQuery.event.special.submit = { 5654 setup: function() { 5655 5656 // Only need this for delegated form submit events 5657 if ( jQuery.nodeName( this, "form" ) ) { 5658 return false; 5659 } 5660 5661 // Lazy-add a submit handler when a descendant form may potentially be submitted 5662 jQuery.event.add( this, "click._submit keypress._submit", function( e ) { 5663 5664 // Node name check avoids a VML-related crash in IE (#9807) 5665 var elem = e.target, 5666 form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? 5667 5668 // Support: IE <=8 5669 // We use jQuery.prop instead of elem.form 5670 // to allow fixing the IE8 delegated submit issue (gh-2332) 5671 // by 3rd party polyfills/workarounds. 5672 jQuery.prop( elem, "form" ) : 5673 undefined; 5674 5675 if ( form && !jQuery._data( form, "submit" ) ) { 5676 jQuery.event.add( form, "submit._submit", function( event ) { 5677 event._submitBubble = true; 5678 } ); 5679 jQuery._data( form, "submit", true ); 5680 } 5681 } ); 5682 5683 // return undefined since we don't need an event listener 5684 }, 5685 5686 postDispatch: function( event ) { 5687 5688 // If form was submitted by the user, bubble the event up the tree 5689 if ( event._submitBubble ) { 5690 delete event._submitBubble; 5691 if ( this.parentNode && !event.isTrigger ) { 5692 jQuery.event.simulate( "submit", this.parentNode, event ); 5693 } 5694 } 5695 }, 5696 5697 teardown: function() { 5698 5699 // Only need this for delegated form submit events 5700 if ( jQuery.nodeName( this, "form" ) ) { 5701 return false; 5702 } 5703 5704 // Remove delegated handlers; cleanData eventually reaps submit handlers attached above 5705 jQuery.event.remove( this, "._submit" ); 5706 } 5707 }; 5708} 5709 5710// IE change delegation and checkbox/radio fix 5711if ( !support.change ) { 5712 5713 jQuery.event.special.change = { 5714 5715 setup: function() { 5716 5717 if ( rformElems.test( this.nodeName ) ) { 5718 5719 // IE doesn't fire change on a check/radio until blur; trigger it on click 5720 // after a propertychange. Eat the blur-change in special.change.handle. 5721 // This still fires onchange a second time for check/radio after blur. 5722 if ( this.type === "checkbox" || this.type === "radio" ) { 5723 jQuery.event.add( this, "propertychange._change", function( event ) { 5724 if ( event.originalEvent.propertyName === "checked" ) { 5725 this._justChanged = true; 5726 } 5727 } ); 5728 jQuery.event.add( this, "click._change", function( event ) { 5729 if ( this._justChanged && !event.isTrigger ) { 5730 this._justChanged = false; 5731 } 5732 5733 // Allow triggered, simulated change events (#11500) 5734 jQuery.event.simulate( "change", this, event ); 5735 } ); 5736 } 5737 return false; 5738 } 5739 5740 // Delegated event; lazy-add a change handler on descendant inputs 5741 jQuery.event.add( this, "beforeactivate._change", function( e ) { 5742 var elem = e.target; 5743 5744 if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "change" ) ) { 5745 jQuery.event.add( elem, "change._change", function( event ) { 5746 if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { 5747 jQuery.event.simulate( "change", this.parentNode, event ); 5748 } 5749 } ); 5750 jQuery._data( elem, "change", true ); 5751 } 5752 } ); 5753 }, 5754 5755 handle: function( event ) { 5756 var elem = event.target; 5757 5758 // Swallow native change events from checkbox/radio, we already triggered them above 5759 if ( this !== elem || event.isSimulated || event.isTrigger || 5760 ( elem.type !== "radio" && elem.type !== "checkbox" ) ) { 5761 5762 return event.handleObj.handler.apply( this, arguments ); 5763 } 5764 }, 5765 5766 teardown: function() { 5767 jQuery.event.remove( this, "._change" ); 5768 5769 return !rformElems.test( this.nodeName ); 5770 } 5771 }; 5772} 5773 5774// Support: Firefox 5775// Firefox doesn't have focus(in | out) events 5776// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 5777// 5778// Support: Chrome, Safari 5779// focus(in | out) events fire after focus & blur events, 5780// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 5781// Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857 5782if ( !support.focusin ) { 5783 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 5784 5785 // Attach a single capturing handler on the document while someone wants focusin/focusout 5786 var handler = function( event ) { 5787 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 5788 }; 5789 5790 jQuery.event.special[ fix ] = { 5791 setup: function() { 5792 var doc = this.ownerDocument || this, 5793 attaches = jQuery._data( doc, fix ); 5794 5795 if ( !attaches ) { 5796 doc.addEventListener( orig, handler, true ); 5797 } 5798 jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); 5799 }, 5800 teardown: function() { 5801 var doc = this.ownerDocument || this, 5802 attaches = jQuery._data( doc, fix ) - 1; 5803 5804 if ( !attaches ) { 5805 doc.removeEventListener( orig, handler, true ); 5806 jQuery._removeData( doc, fix ); 5807 } else { 5808 jQuery._data( doc, fix, attaches ); 5809 } 5810 } 5811 }; 5812 } ); 5813} 5814 5815jQuery.fn.extend( { 5816 5817 on: function( types, selector, data, fn ) { 5818 return on( this, types, selector, data, fn ); 5819 }, 5820 one: function( types, selector, data, fn ) { 5821 return on( this, types, selector, data, fn, 1 ); 5822 }, 5823 off: function( types, selector, fn ) { 5824 var handleObj, type; 5825 if ( types && types.preventDefault && types.handleObj ) { 5826 5827 // ( event ) dispatched jQuery.Event 5828 handleObj = types.handleObj; 5829 jQuery( types.delegateTarget ).off( 5830 handleObj.namespace ? 5831 handleObj.origType + "." + handleObj.namespace : 5832 handleObj.origType, 5833 handleObj.selector, 5834 handleObj.handler 5835 ); 5836 return this; 5837 } 5838 if ( typeof types === "object" ) { 5839 5840 // ( types-object [, selector] ) 5841 for ( type in types ) { 5842 this.off( type, selector, types[ type ] ); 5843 } 5844 return this; 5845 } 5846 if ( selector === false || typeof selector === "function" ) { 5847 5848 // ( types [, fn] ) 5849 fn = selector; 5850 selector = undefined; 5851 } 5852 if ( fn === false ) { 5853 fn = returnFalse; 5854 } 5855 return this.each( function() { 5856 jQuery.event.remove( this, types, fn, selector ); 5857 } ); 5858 }, 5859 5860 trigger: function( type, data ) { 5861 return this.each( function() { 5862 jQuery.event.trigger( type, data, this ); 5863 } ); 5864 }, 5865 triggerHandler: function( type, data ) { 5866 var elem = this[ 0 ]; 5867 if ( elem ) { 5868 return jQuery.event.trigger( type, data, elem, true ); 5869 } 5870 } 5871} ); 5872 5873 5874var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, 5875 rnoshimcache = new RegExp( "<(?:" + nodeNames + ")[\\s/>]", "i" ), 5876 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, 5877 5878 // Support: IE 10-11, Edge 10240+ 5879 // In IE/Edge using regex groups here causes severe slowdowns. 5880 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 5881 rnoInnerhtml = /<script|<style|<link/i, 5882 5883 // checked="checked" or checked 5884 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5885 rscriptTypeMasked = /^true\/(.*)/, 5886 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, 5887 safeFragment = createSafeFragment( document ), 5888 fragmentDiv = safeFragment.appendChild( document.createElement( "div" ) ); 5889 5890// Support: IE<8 5891// Manipulating tables requires a tbody 5892function manipulationTarget( elem, content ) { 5893 return jQuery.nodeName( elem, "table" ) && 5894 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? 5895 5896 elem.getElementsByTagName( "tbody" )[ 0 ] || 5897 elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) : 5898 elem; 5899} 5900 5901// Replace/restore the type attribute of script elements for safe DOM manipulation 5902function disableScript( elem ) { 5903 elem.type = ( jQuery.find.attr( elem, "type" ) !== null ) + "/" + elem.type; 5904 return elem; 5905} 5906function restoreScript( elem ) { 5907 var match = rscriptTypeMasked.exec( elem.type ); 5908 if ( match ) { 5909 elem.type = match[ 1 ]; 5910 } else { 5911 elem.removeAttribute( "type" ); 5912 } 5913 return elem; 5914} 5915 5916function cloneCopyEvent( src, dest ) { 5917 if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { 5918 return; 5919 } 5920 5921 var type, i, l, 5922 oldData = jQuery._data( src ), 5923 curData = jQuery._data( dest, oldData ), 5924 events = oldData.events; 5925 5926 if ( events ) { 5927 delete curData.handle; 5928 curData.events = {}; 5929 5930 for ( type in events ) { 5931 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 5932 jQuery.event.add( dest, type, events[ type ][ i ] ); 5933 } 5934 } 5935 } 5936 5937 // make the cloned public data object a copy from the original 5938 if ( curData.data ) { 5939 curData.data = jQuery.extend( {}, curData.data ); 5940 } 5941} 5942 5943function fixCloneNodeIssues( src, dest ) { 5944 var nodeName, e, data; 5945 5946 // We do not need to do anything for non-Elements 5947 if ( dest.nodeType !== 1 ) { 5948 return; 5949 } 5950 5951 nodeName = dest.nodeName.toLowerCase(); 5952 5953 // IE6-8 copies events bound via attachEvent when using cloneNode. 5954 if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { 5955 data = jQuery._data( dest ); 5956 5957 for ( e in data.events ) { 5958 jQuery.removeEvent( dest, e, data.handle ); 5959 } 5960 5961 // Event data gets referenced instead of copied if the expando gets copied too 5962 dest.removeAttribute( jQuery.expando ); 5963 } 5964 5965 // IE blanks contents when cloning scripts, and tries to evaluate newly-set text 5966 if ( nodeName === "script" && dest.text !== src.text ) { 5967 disableScript( dest ).text = src.text; 5968 restoreScript( dest ); 5969 5970 // IE6-10 improperly clones children of object elements using classid. 5971 // IE10 throws NoModificationAllowedError if parent is null, #12132. 5972 } else if ( nodeName === "object" ) { 5973 if ( dest.parentNode ) { 5974 dest.outerHTML = src.outerHTML; 5975 } 5976 5977 // This path appears unavoidable for IE9. When cloning an object 5978 // element in IE9, the outerHTML strategy above is not sufficient. 5979 // If the src has innerHTML and the destination does not, 5980 // copy the src.innerHTML into the dest.innerHTML. #10324 5981 if ( support.html5Clone && ( src.innerHTML && !jQuery.trim( dest.innerHTML ) ) ) { 5982 dest.innerHTML = src.innerHTML; 5983 } 5984 5985 } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 5986 5987 // IE6-8 fails to persist the checked state of a cloned checkbox 5988 // or radio button. Worse, IE6-7 fail to give the cloned element 5989 // a checked appearance if the defaultChecked value isn't also set 5990 5991 dest.defaultChecked = dest.checked = src.checked; 5992 5993 // IE6-7 get confused and end up setting the value of a cloned 5994 // checkbox/radio button to an empty string instead of "on" 5995 if ( dest.value !== src.value ) { 5996 dest.value = src.value; 5997 } 5998 5999 // IE6-8 fails to return the selected option to the default selected 6000 // state when cloning options 6001 } else if ( nodeName === "option" ) { 6002 dest.defaultSelected = dest.selected = src.defaultSelected; 6003 6004 // IE6-8 fails to set the defaultValue to the correct value when 6005 // cloning other types of input fields 6006 } else if ( nodeName === "input" || nodeName === "textarea" ) { 6007 dest.defaultValue = src.defaultValue; 6008 } 6009} 6010 6011function domManip( collection, args, callback, ignored ) { 6012 6013 // Flatten any nested arrays 6014 args = concat.apply( [], args ); 6015 6016 var first, node, hasScripts, 6017 scripts, doc, fragment, 6018 i = 0, 6019 l = collection.length, 6020 iNoClone = l - 1, 6021 value = args[ 0 ], 6022 isFunction = jQuery.isFunction( value ); 6023 6024 // We can't cloneNode fragments that contain checked, in WebKit 6025 if ( isFunction || 6026 ( l > 1 && typeof value === "string" && 6027 !support.checkClone && rchecked.test( value ) ) ) { 6028 return collection.each( function( index ) { 6029 var self = collection.eq( index ); 6030 if ( isFunction ) { 6031 args[ 0 ] = value.call( this, index, self.html() ); 6032 } 6033 domManip( self, args, callback, ignored ); 6034 } ); 6035 } 6036 6037 if ( l ) { 6038 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 6039 first = fragment.firstChild; 6040 6041 if ( fragment.childNodes.length === 1 ) { 6042 fragment = first; 6043 } 6044 6045 // Require either new content or an interest in ignored elements to invoke the callback 6046 if ( first || ignored ) { 6047 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 6048 hasScripts = scripts.length; 6049 6050 // Use the original fragment for the last item 6051 // instead of the first because it can end up 6052 // being emptied incorrectly in certain situations (#8070). 6053 for ( ; i < l; i++ ) { 6054 node = fragment; 6055 6056 if ( i !== iNoClone ) { 6057 node = jQuery.clone( node, true, true ); 6058 6059 // Keep references to cloned scripts for later restoration 6060 if ( hasScripts ) { 6061 6062 // Support: Android<4.1, PhantomJS<2 6063 // push.apply(_, arraylike) throws on ancient WebKit 6064 jQuery.merge( scripts, getAll( node, "script" ) ); 6065 } 6066 } 6067 6068 callback.call( collection[ i ], node, i ); 6069 } 6070 6071 if ( hasScripts ) { 6072 doc = scripts[ scripts.length - 1 ].ownerDocument; 6073 6074 // Reenable scripts 6075 jQuery.map( scripts, restoreScript ); 6076 6077 // Evaluate executable scripts on first document insertion 6078 for ( i = 0; i < hasScripts; i++ ) { 6079 node = scripts[ i ]; 6080 if ( rscriptType.test( node.type || "" ) && 6081 !jQuery._data( node, "globalEval" ) && 6082 jQuery.contains( doc, node ) ) { 6083 6084 if ( node.src ) { 6085 6086 // Optional AJAX dependency, but won't run scripts if not present 6087 if ( jQuery._evalUrl ) { 6088 jQuery._evalUrl( node.src ); 6089 } 6090 } else { 6091 jQuery.globalEval( 6092 ( node.text || node.textContent || node.innerHTML || "" ) 6093 .replace( rcleanScript, "" ) 6094 ); 6095 } 6096 } 6097 } 6098 } 6099 6100 // Fix #11809: Avoid leaking memory 6101 fragment = first = null; 6102 } 6103 } 6104 6105 return collection; 6106} 6107 6108function remove( elem, selector, keepData ) { 6109 var node, 6110 elems = selector ? jQuery.filter( selector, elem ) : elem, 6111 i = 0; 6112 6113 for ( ; ( node = elems[ i ] ) != null; i++ ) { 6114 6115 if ( !keepData && node.nodeType === 1 ) { 6116 jQuery.cleanData( getAll( node ) ); 6117 } 6118 6119 if ( node.parentNode ) { 6120 if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { 6121 setGlobalEval( getAll( node, "script" ) ); 6122 } 6123 node.parentNode.removeChild( node ); 6124 } 6125 } 6126 6127 return elem; 6128} 6129 6130jQuery.extend( { 6131 htmlPrefilter: function( html ) { 6132 return html.replace( rxhtmlTag, "<$1></$2>" ); 6133 }, 6134 6135 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 6136 var destElements, node, clone, i, srcElements, 6137 inPage = jQuery.contains( elem.ownerDocument, elem ); 6138 6139 if ( support.html5Clone || jQuery.isXMLDoc( elem ) || 6140 !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { 6141 6142 clone = elem.cloneNode( true ); 6143 6144 // IE<=8 does not properly clone detached, unknown element nodes 6145 } else { 6146 fragmentDiv.innerHTML = elem.outerHTML; 6147 fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); 6148 } 6149 6150 if ( ( !support.noCloneEvent || !support.noCloneChecked ) && 6151 ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { 6152 6153 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 6154 destElements = getAll( clone ); 6155 srcElements = getAll( elem ); 6156 6157 // Fix all IE cloning issues 6158 for ( i = 0; ( node = srcElements[ i ] ) != null; ++i ) { 6159 6160 // Ensure that the destination node is not null; Fixes #9587 6161 if ( destElements[ i ] ) { 6162 fixCloneNodeIssues( node, destElements[ i ] ); 6163 } 6164 } 6165 } 6166 6167 // Copy the events from the original to the clone 6168 if ( dataAndEvents ) { 6169 if ( deepDataAndEvents ) { 6170 srcElements = srcElements || getAll( elem ); 6171 destElements = destElements || getAll( clone ); 6172 6173 for ( i = 0; ( node = srcElements[ i ] ) != null; i++ ) { 6174 cloneCopyEvent( node, destElements[ i ] ); 6175 } 6176 } else { 6177 cloneCopyEvent( elem, clone ); 6178 } 6179 } 6180 6181 // Preserve script evaluation history 6182 destElements = getAll( clone, "script" ); 6183 if ( destElements.length > 0 ) { 6184 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 6185 } 6186 6187 destElements = srcElements = node = null; 6188 6189 // Return the cloned set 6190 return clone; 6191 }, 6192 6193 cleanData: function( elems, /* internal */ forceAcceptData ) { 6194 var elem, type, id, data, 6195 i = 0, 6196 internalKey = jQuery.expando, 6197 cache = jQuery.cache, 6198 attributes = support.attributes, 6199 special = jQuery.event.special; 6200 6201 for ( ; ( elem = elems[ i ] ) != null; i++ ) { 6202 if ( forceAcceptData || acceptData( elem ) ) { 6203 6204 id = elem[ internalKey ]; 6205 data = id && cache[ id ]; 6206 6207 if ( data ) { 6208 if ( data.events ) { 6209 for ( type in data.events ) { 6210 if ( special[ type ] ) { 6211 jQuery.event.remove( elem, type ); 6212 6213 // This is a shortcut to avoid jQuery.event.remove's overhead 6214 } else { 6215 jQuery.removeEvent( elem, type, data.handle ); 6216 } 6217 } 6218 } 6219 6220 // Remove cache only if it was not already removed by jQuery.event.remove 6221 if ( cache[ id ] ) { 6222 6223 delete cache[ id ]; 6224
6225 // Support: IE<9 6226 // IE does not allow us to delete expando properties from nodes 6227 // IE creates expando attributes along with the property 6228 // IE does not have a removeAttribute function on Document nodes 6229 if ( !attributes && typeof elem.removeAttribute !== "undefined" ) { 6230 elem.removeAttribute( internalKey ); 6231 6232 // Webkit & Blink performance suffers when deleting properties 6233 // from DOM nodes, so set to undefined instead 6234 // https://code.google.com/p/chromium/issues/detail?id=378607 6235 } else { 6236 elem[ internalKey ] = undefined; 6237 } 6238 6239 deletedIds.push( id ); 6240 } 6241 } 6242 } 6243 } 6244 } 6245} ); 6246 6247jQuery.fn.extend( { 6248 6249 // Keep domManip exposed until 3.0 (gh-2225) 6250 domManip: domManip, 6251 6252 detach: function( selector ) { 6253 return remove( this, selector, true ); 6254 }, 6255 6256 remove: function( selector ) { 6257 return remove( this, selector ); 6258 }, 6259 6260 text: function( value ) { 6261 return access( this, function( value ) { 6262 return value === undefined ? 6263 jQuery.text( this ) : 6264 this.empty().append( 6265 ( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value ) 6266 ); 6267 }, null, value, arguments.length ); 6268 }, 6269 6270 append: function() { 6271 return domManip( this, arguments, function( elem ) { 6272 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6273 var target = manipulationTarget( this, elem ); 6274 target.appendChild( elem ); 6275 } 6276 } ); 6277 }, 6278
vendor: 4,288 bytes, lines 6279-6452
6279 prepend: function() { 6280 return domManip( this, arguments, function( elem ) { 6281 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6282 var target = manipulationTarget( this, elem ); 6283 target.insertBefore( elem, target.firstChild ); 6284 } 6285 } ); 6286 }, 6287 6288 before: function() { 6289 return domManip( this, arguments, function( elem ) { 6290 if ( this.parentNode ) { 6291 this.parentNode.insertBefore( elem, this ); 6292 } 6293 } ); 6294 }, 6295 6296 after: function() { 6297 return domManip( this, arguments, function( elem ) { 6298 if ( this.parentNode ) { 6299 this.parentNode.insertBefore( elem, this.nextSibling ); 6300 } 6301 } ); 6302 }, 6303 6304 empty: function() { 6305 var elem, 6306 i = 0; 6307 6308 for ( ; ( elem = this[ i ] ) != null; i++ ) { 6309 6310 // Remove element nodes and prevent memory leaks 6311 if ( elem.nodeType === 1 ) { 6312 jQuery.cleanData( getAll( elem, false ) ); 6313 } 6314 6315 // Remove any remaining nodes 6316 while ( elem.firstChild ) { 6317 elem.removeChild( elem.firstChild ); 6318 } 6319 6320 // If this is a select, ensure that it displays empty (#12336) 6321 // Support: IE<9 6322 if ( elem.options && jQuery.nodeName( elem, "select" ) ) { 6323 elem.options.length = 0; 6324 } 6325 } 6326 6327 return this; 6328 }, 6329 6330 clone: function( dataAndEvents, deepDataAndEvents ) { 6331 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 6332 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 6333 6334 return this.map( function() { 6335 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 6336 } ); 6337 }, 6338 6339 html: function( value ) { 6340 return access( this, function( value ) { 6341 var elem = this[ 0 ] || {}, 6342 i = 0, 6343 l = this.length; 6344 6345 if ( value === undefined ) { 6346 return elem.nodeType === 1 ? 6347 elem.innerHTML.replace( rinlinejQuery, "" ) : 6348 undefined; 6349 } 6350 6351 // See if we can take a shortcut and just use innerHTML 6352 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 6353 ( support.htmlSerialize || !rnoshimcache.test( value ) ) && 6354 ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && 6355 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 6356 6357 value = jQuery.htmlPrefilter( value ); 6358 6359 try { 6360 for ( ; i < l; i++ ) { 6361 6362 // Remove element nodes and prevent memory leaks 6363 elem = this[ i ] || {}; 6364 if ( elem.nodeType === 1 ) { 6365 jQuery.cleanData( getAll( elem, false ) ); 6366 elem.innerHTML = value; 6367 } 6368 } 6369 6370 elem = 0; 6371 6372 // If using innerHTML throws an exception, use the fallback method 6373 } catch ( e ) {} 6374 } 6375 6376 if ( elem ) { 6377 this.empty().append( value ); 6378 } 6379 }, null, value, arguments.length ); 6380 }, 6381 6382 replaceWith: function() { 6383 var ignored = []; 6384 6385 // Make the changes, replacing each non-ignored context element with the new content 6386 return domManip( this, arguments, function( elem ) { 6387 var parent = this.parentNode; 6388 6389 if ( jQuery.inArray( this, ignored ) < 0 ) { 6390 jQuery.cleanData( getAll( this ) ); 6391 if ( parent ) { 6392 parent.replaceChild( elem, this ); 6393 } 6394 } 6395 6396 // Force callback invocation 6397 }, ignored ); 6398 } 6399} ); 6400 6401jQuery.each( { 6402 appendTo: "append", 6403 prependTo: "prepend", 6404 insertBefore: "before", 6405 insertAfter: "after", 6406 replaceAll: "replaceWith" 6407}, function( name, original ) { 6408 jQuery.fn[ name ] = function( selector ) { 6409 var elems, 6410 i = 0, 6411 ret = [], 6412 insert = jQuery( selector ), 6413 last = insert.length - 1; 6414 6415 for ( ; i <= last; i++ ) { 6416 elems = i === last ? this : this.clone( true ); 6417 jQuery( insert[ i ] )[ original ]( elems ); 6418 6419 // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() 6420 push.apply( ret, elems.get() ); 6421 } 6422 6423 return this.pushStack( ret ); 6424 }; 6425} ); 6426 6427 6428var iframe, 6429 elemdisplay = { 6430 6431 // Support: Firefox 6432 // We have to pre-define these values for FF (#10227) 6433 HTML: "block", 6434 BODY: "block" 6435 }; 6436 6437/** 6438 * Retrieve the actual display of a element 6439 * @param {String} name nodeName of the element 6440 * @param {Object} doc Document object 6441 */ 6442 6443// Called only from within defaultDisplay 6444function actualDisplay( name, doc ) { 6445 var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), 6446 6447 display = jQuery.css( elem[ 0 ], "display" ); 6448 6449 // We don't have any data stored on the element, 6450 // so use "detach" method as fast way to get rid of the element 6451 elem.detach(); 6452
6453 return display; 6454} 6455 6456/** 6457 * Try to determine the default display value of an element 6458 * @param {String} nodeName 6459 */ 6460function defaultDisplay( nodeName ) { 6461 var doc = document, 6462 display = elemdisplay[ nodeName ]; 6463 6464 if ( !display ) { 6465 display = actualDisplay( nodeName, doc ); 6466 6467 // If the simple way fails, read from inside an iframe 6468 if ( display === "none" || !display ) { 6469 6470 // Use the already-created iframe if possible 6471 iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) ) 6472 .appendTo( doc.documentElement ); 6473 6474 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse 6475 doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document; 6476 6477 // Support: IE 6478 doc.write(); 6479 doc.close(); 6480 6481 display = actualDisplay( nodeName, doc ); 6482 iframe.detach(); 6483 } 6484 6485 // Store the correct default display 6486 elemdisplay[ nodeName ] = display; 6487 } 6488 6489 return display; 6490} 6491var rmargin = ( /^margin/ ); 6492 6493var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 6494 6495var swap = function( elem, options, callback, args ) { 6496 var ret, name, 6497 old = {}; 6498 6499 // Remember the old values, and insert the new ones 6500 for ( name in options ) { 6501 old[ name ] = elem.style[ name ]; 6502 elem.style[ name ] = options[ name ]; 6503 } 6504 6505 ret = callback.apply( elem, args || [] ); 6506 6507 // Revert the old values 6508 for ( name in options ) { 6509 elem.style[ name ] = old[ name ]; 6510 } 6511 6512 return ret; 6513}; 6514 6515 6516var documentElement = document.documentElement; 6517 6518 6519 6520( function() { 6521 var pixelPositionVal, pixelMarginRightVal, boxSizingReliableVal, 6522 reliableHiddenOffsetsVal, reliableMarginRightVal, reliableMarginLeftVal, 6523 container = document.createElement( "div" ), 6524 div = document.createElement( "div" ); 6525 6526 // Finish early in limited (non-browser) environments 6527 if ( !div.style ) { 6528 return; 6529 } 6530 6531 div.style.cssText = "float:left;opacity:.5"; 6532 6533 // Support: IE<9 6534 // Make sure that element opacity exists (as opposed to filter) 6535 support.opacity = div.style.opacity === "0.5"; 6536 6537 // Verify style float existence 6538 // (IE uses styleFloat instead of cssFloat) 6539 support.cssFloat = !!div.style.cssFloat; 6540 6541 div.style.backgroundClip = "content-box"; 6542 div.cloneNode( true ).style.backgroundClip = ""; 6543 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6544 6545 container = document.createElement( "div" ); 6546 container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + 6547 "padding:0;margin-top:1px;position:absolute"; 6548 div.innerHTML = ""; 6549 container.appendChild( div ); 6550 6551 // Support: Firefox<29, Android 2.3 6552 // Vendor-prefix box-sizing 6553 support.boxSizing = div.style.boxSizing === "" || div.style.MozBoxSizing === "" || 6554 div.style.WebkitBoxSizing === ""; 6555 6556 jQuery.extend( support, { 6557 reliableHiddenOffsets: function() { 6558 if ( pixelPositionVal == null ) { 6559 computeStyleTests(); 6560 } 6561 return reliableHiddenOffsetsVal; 6562 }, 6563 6564 boxSizingReliable: function() { 6565 6566 // We're checking for pixelPositionVal here instead of boxSizingReliableVal 6567 // since that compresses better and they're computed together anyway. 6568 if ( pixelPositionVal == null ) { 6569 computeStyleTests(); 6570 } 6571 return boxSizingReliableVal; 6572 }, 6573 6574 pixelMarginRight: function() { 6575 6576 // Support: Android 4.0-4.3 6577 if ( pixelPositionVal == null ) { 6578 computeStyleTests(); 6579 } 6580 return pixelMarginRightVal; 6581 }, 6582 6583 pixelPosition: function() { 6584 if ( pixelPositionVal == null ) { 6585 computeStyleTests(); 6586 } 6587 return pixelPositionVal; 6588 }, 6589 6590 reliableMarginRight: function() { 6591 6592 // Support: Android 2.3 6593 if ( pixelPositionVal == null ) { 6594 computeStyleTests(); 6595 } 6596 return reliableMarginRightVal; 6597 }, 6598 6599 reliableMarginLeft: function() { 6600 6601 // Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37 6602 if ( pixelPositionVal == null ) { 6603 computeStyleTests(); 6604 } 6605 return reliableMarginLeftVal; 6606 } 6607 } ); 6608 6609 function computeStyleTests() { 6610 var contents, divStyle, 6611 documentElement = document.documentElement; 6612 6613 // Setup 6614 documentElement.appendChild( container ); 6615 6616 div.style.cssText = 6617 6618 // Support: Android 2.3 6619 // Vendor-prefix box-sizing 6620 "-webkit-box-sizing:border-box;box-sizing:border-box;" + 6621 "position:relative;display:block;" + 6622 "margin:auto;border:1px;padding:1px;" + 6623 "top:1%;width:50%"; 6624
6625 // Support: IE<9 6626 // Assume reasonable values in the absence of getComputedStyle 6627 pixelPositionVal = boxSizingReliableVal = reliableMarginLeftVal = false; 6628 pixelMarginRightVal = reliableMarginRightVal = true; 6629 6630 // Check for getComputedStyle so that this code is not run in IE<9. 6631 if ( window.getComputedStyle ) { 6632 divStyle = window.getComputedStyle( div ); 6633 pixelPositionVal = ( divStyle || {} ).top !== "1%"; 6634 reliableMarginLeftVal = ( divStyle || {} ).marginLeft === "2px"; 6635 boxSizingReliableVal = ( divStyle || { width: "4px" } ).width === "4px"; 6636 6637 // Support: Android 4.0 - 4.3 only 6638 // Some styles come back with percentage values, even though they shouldn't 6639 div.style.marginRight = "50%"; 6640 pixelMarginRightVal = ( divStyle || { marginRight: "4px" } ).marginRight === "4px"; 6641 6642 // Support: Android 2.3 only 6643 // Div with explicit width and no margin-right incorrectly 6644 // gets computed margin-right based on width of container (#3333) 6645 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 6646 contents = div.appendChild( document.createElement( "div" ) ); 6647 6648 // Reset CSS: box-sizing; display; margin; border; padding 6649 contents.style.cssText = div.style.cssText = 6650 6651 // Support: Android 2.3 6652 // Vendor-prefix box-sizing 6653 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + 6654 "box-sizing:content-box;display:block;margin:0;border:0;padding:0"; 6655 contents.style.marginRight = contents.style.width = "0"; 6656 div.style.width = "1px"; 6657 6658 reliableMarginRightVal = 6659 !parseFloat( ( window.getComputedStyle( contents ) || {} ).marginRight ); 6660 6661 div.removeChild( contents ); 6662 } 6663 6664 // Support: IE6-8 6665 // First check that getClientRects works as expected 6666 // Check if table cells still have offsetWidth/Height when they are set 6667 // to display:none and there are still other visible table cells in a 6668 // table row; if so, offsetWidth/Height are not reliable for use when 6669 // determining if an element has been hidden directly using 6670 // display:none (it is still safe to use offsets if a parent element is 6671 // hidden; don safety goggles and see bug #4512 for more information). 6672 div.style.display = "none"; 6673 reliableHiddenOffsetsVal = div.getClientRects().length === 0; 6674 if ( reliableHiddenOffsetsVal ) { 6675 div.style.display = ""; 6676 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; 6677 contents = div.getElementsByTagName( "td" ); 6678 contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none"; 6679 reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; 6680 if ( reliableHiddenOffsetsVal ) { 6681 contents[ 0 ].style.display = ""; 6682 contents[ 1 ].style.display = "none"; 6683 reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; 6684 } 6685 } 6686 6687 // Teardown 6688 documentElement.removeChild( container ); 6689 } 6690 6691} )(); 6692 6693 6694var getStyles, curCSS, 6695 rposition = /^(top|right|bottom|left)$/; 6696 6697if ( window.getComputedStyle ) { 6698 getStyles = function( elem ) { 6699 6700 // Support: IE<=11+, Firefox<=30+ (#15098, #14150) 6701 // IE throws on elements created in popups 6702 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6703 var view = elem.ownerDocument.defaultView; 6704 6705 if ( !view || !view.opener ) { 6706 view = window; 6707 } 6708 6709 return view.getComputedStyle( elem ); 6710 }; 6711 6712 curCSS = function( elem, name, computed ) { 6713 var width, minWidth, maxWidth, ret, 6714 style = elem.style; 6715 6716 computed = computed || getStyles( elem ); 6717 6718 // getPropertyValue is only needed for .css('filter') in IE9, see #12537 6719 ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined; 6720 6721 // Support: Opera 12.1x only 6722 // Fall back to style even without computed 6723 // computed is undefined for elems on document fragments 6724 if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) { 6725 ret = jQuery.style( elem, name ); 6726 } 6727 6728 if ( computed ) { 6729 6730 // A tribute to the "awesome hack by Dean Edwards" 6731 // Chrome < 17 and Safari 5.0 uses "computed value" 6732 // instead of "used value" for margin-right 6733 // Safari 5.1.7 (at least) returns percentage for a larger set of values, 6734 // but width seems to be reliably pixels 6735 // this is against the CSSOM draft spec: 6736 // http://dev.w3.org/csswg/cssom/#resolved-values 6737 if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { 6738 6739 // Remember the original values 6740 width = style.width; 6741 minWidth = style.minWidth; 6742 maxWidth = style.maxWidth; 6743 6744 // Put in the new values to get a computed value out 6745 style.minWidth = style.maxWidth = style.width = ret; 6746 ret = computed.width; 6747 6748 // Revert the changed values 6749 style.width = width; 6750 style.minWidth = minWidth; 6751 style.maxWidth = maxWidth; 6752 } 6753 } 6754
vendor: 4,152 bytes, lines 6755-6917
6755 // Support: IE 6756 // IE returns zIndex value as an integer. 6757 return ret === undefined ? 6758 ret : 6759 ret + ""; 6760 }; 6761} else if ( documentElement.currentStyle ) { 6762 getStyles = function( elem ) { 6763 return elem.currentStyle; 6764 }; 6765 6766 curCSS = function( elem, name, computed ) { 6767 var left, rs, rsLeft, ret, 6768 style = elem.style; 6769 6770 computed = computed || getStyles( elem ); 6771 ret = computed ? computed[ name ] : undefined; 6772 6773 // Avoid setting ret to empty string here 6774 // so we don't default to auto 6775 if ( ret == null && style && style[ name ] ) { 6776 ret = style[ name ]; 6777 } 6778 6779 // From the awesome hack by Dean Edwards 6780 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 6781 6782 // If we're not dealing with a regular pixel number 6783 // but a number that has a weird ending, we need to convert it to pixels 6784 // but not position css attributes, as those are 6785 // proportional to the parent element instead 6786 // and we can't measure the parent instead because it 6787 // might trigger a "stacking dolls" problem 6788 if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { 6789 6790 // Remember the original values 6791 left = style.left; 6792 rs = elem.runtimeStyle; 6793 rsLeft = rs && rs.left; 6794 6795 // Put in the new values to get a computed value out 6796 if ( rsLeft ) { 6797 rs.left = elem.currentStyle.left; 6798 } 6799 style.left = name === "fontSize" ? "1em" : ret; 6800 ret = style.pixelLeft + "px"; 6801 6802 // Revert the changed values 6803 style.left = left; 6804 if ( rsLeft ) { 6805 rs.left = rsLeft; 6806 } 6807 } 6808 6809 // Support: IE 6810 // IE returns zIndex value as an integer. 6811 return ret === undefined ? 6812 ret : 6813 ret + "" || "auto"; 6814 }; 6815} 6816 6817 6818 6819 6820function addGetHookIf( conditionFn, hookFn ) { 6821 6822 // Define the hook, we'll check on the first run if it's really needed. 6823 return { 6824 get: function() { 6825 if ( conditionFn() ) { 6826 6827 // Hook not needed (or it's not possible to use it due 6828 // to missing dependency), remove it. 6829 delete this.get; 6830 return; 6831 } 6832 6833 // Hook needed; redefine it so that the support test is not executed again. 6834 return ( this.get = hookFn ).apply( this, arguments ); 6835 } 6836 }; 6837} 6838 6839 6840var 6841 6842 ralpha = /alpha\([^)]*\)/i, 6843 ropacity = /opacity\s*=\s*([^)]*)/i, 6844 6845 // swappable if display is none or starts with table except 6846 // "table", "table-cell", or "table-caption" 6847 // see here for display values: 6848 // https://developer.mozilla.org/en-US/docs/CSS/display 6849 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6850 rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ), 6851 6852 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6853 cssNormalTransform = { 6854 letterSpacing: "0", 6855 fontWeight: "400" 6856 }, 6857 6858 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], 6859 emptyStyle = document.createElement( "div" ).style; 6860 6861 6862// return a css property mapped to a potentially vendor prefixed property 6863function vendorPropName( name ) { 6864 6865 // shortcut for names that are not vendor prefixed 6866 if ( name in emptyStyle ) { 6867 return name; 6868 } 6869 6870 // check for vendor prefixed names 6871 var capName = name.charAt( 0 ).toUpperCase() + name.slice( 1 ), 6872 i = cssPrefixes.length; 6873 6874 while ( i-- ) { 6875 name = cssPrefixes[ i ] + capName; 6876 if ( name in emptyStyle ) { 6877 return name; 6878 } 6879 } 6880} 6881 6882function showHide( elements, show ) { 6883 var display, elem, hidden, 6884 values = [], 6885 index = 0, 6886 length = elements.length; 6887 6888 for ( ; index < length; index++ ) { 6889 elem = elements[ index ]; 6890 if ( !elem.style ) { 6891 continue; 6892 } 6893 6894 values[ index ] = jQuery._data( elem, "olddisplay" ); 6895 display = elem.style.display; 6896 if ( show ) { 6897 6898 // Reset the inline display of this element to learn if it is 6899 // being hidden by cascaded rules or not 6900 if ( !values[ index ] && display === "none" ) { 6901 elem.style.display = ""; 6902 } 6903 6904 // Set elements which have been overridden with display: none 6905 // in a stylesheet to whatever the default browser style is 6906 // for such an element 6907 if ( elem.style.display === "" && isHidden( elem ) ) { 6908 values[ index ] = 6909 jQuery._data( elem, "olddisplay", defaultDisplay( elem.nodeName ) ); 6910 } 6911 } else { 6912 hidden = isHidden( elem ); 6913 6914 if ( display && display !== "none" || !hidden ) { 6915 jQuery._data( 6916 elem, 6917 "olddisplay",
vendor: 6,455 bytes, lines 6918-7142
6918 hidden ? display : jQuery.css( elem, "display" ) 6919 ); 6920 } 6921 } 6922 } 6923 6924 // Set the display of most of the elements in a second loop 6925 // to avoid the constant reflow 6926 for ( index = 0; index < length; index++ ) { 6927 elem = elements[ index ]; 6928 if ( !elem.style ) { 6929 continue; 6930 } 6931 if ( !show || elem.style.display === "none" || elem.style.display === "" ) { 6932 elem.style.display = show ? values[ index ] || "" : "none"; 6933 } 6934 } 6935 6936 return elements; 6937} 6938 6939function setPositiveNumber( elem, value, subtract ) { 6940 var matches = rnumsplit.exec( value ); 6941 return matches ? 6942 6943 // Guard against undefined "subtract", e.g., when used as in cssHooks 6944 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : 6945 value; 6946} 6947 6948function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { 6949 var i = extra === ( isBorderBox ? "border" : "content" ) ? 6950 6951 // If we already have the right measurement, avoid augmentation 6952 4 : 6953 6954 // Otherwise initialize for horizontal or vertical properties 6955 name === "width" ? 1 : 0, 6956 6957 val = 0; 6958 6959 for ( ; i < 4; i += 2 ) { 6960 6961 // both box models exclude margin, so add it if we want it 6962 if ( extra === "margin" ) { 6963 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); 6964 } 6965 6966 if ( isBorderBox ) { 6967 6968 // border-box includes padding, so remove it if we want content 6969 if ( extra === "content" ) { 6970 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6971 } 6972 6973 // at this point, extra isn't border nor margin, so remove border 6974 if ( extra !== "margin" ) { 6975 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6976 } 6977 } else { 6978 6979 // at this point, extra isn't content, so add padding 6980 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6981 6982 // at this point, extra isn't content nor padding, so add border 6983 if ( extra !== "padding" ) { 6984 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6985 } 6986 } 6987 } 6988 6989 return val; 6990} 6991 6992function getWidthOrHeight( elem, name, extra ) { 6993 6994 // Start with offset property, which is equivalent to the border-box value 6995 var valueIsBorderBox = true, 6996 val = name === "width" ? elem.offsetWidth : elem.offsetHeight, 6997 styles = getStyles( elem ), 6998 isBorderBox = support.boxSizing && 6999 jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 7000 7001 // Support: IE11 only 7002 // In IE 11 fullscreen elements inside of an iframe have 7003 // 100x too small dimensions (gh-1764). 7004 if ( document.msFullscreenElement && window.top !== window ) { 7005 7006 // Support: IE11 only 7007 // Running getBoundingClientRect on a disconnected node 7008 // in IE throws an error. 7009 if ( elem.getClientRects().length ) { 7010 val = Math.round( elem.getBoundingClientRect()[ name ] * 100 ); 7011 } 7012 } 7013 7014 // some non-html elements return undefined for offsetWidth, so check for null/undefined 7015 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 7016 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 7017 if ( val <= 0 || val == null ) { 7018 7019 // Fall back to computed then uncomputed css if necessary 7020 val = curCSS( elem, name, styles ); 7021 if ( val < 0 || val == null ) { 7022 val = elem.style[ name ]; 7023 } 7024 7025 // Computed unit is not pixels. Stop here and return. 7026 if ( rnumnonpx.test( val ) ) { 7027 return val; 7028 } 7029 7030 // we need the check for style in case a browser which returns unreliable values 7031 // for getComputedStyle silently falls back to the reliable elem.style 7032 valueIsBorderBox = isBorderBox && 7033 ( support.boxSizingReliable() || val === elem.style[ name ] ); 7034 7035 // Normalize "", auto, and prepare for extra 7036 val = parseFloat( val ) || 0; 7037 } 7038 7039 // use the active box-sizing model to add/subtract irrelevant styles 7040 return ( val + 7041 augmentWidthOrHeight( 7042 elem, 7043 name, 7044 extra || ( isBorderBox ? "border" : "content" ), 7045 valueIsBorderBox, 7046 styles 7047 ) 7048 ) + "px"; 7049} 7050 7051jQuery.extend( { 7052 7053 // Add in style property hooks for overriding the default 7054 // behavior of getting and setting a style property 7055 cssHooks: { 7056 opacity: { 7057 get: function( elem, computed ) { 7058 if ( computed ) { 7059 7060 // We should always get a number back from opacity 7061 var ret = curCSS( elem, "opacity" ); 7062 return ret === "" ? "1" : ret; 7063 } 7064 } 7065 } 7066 }, 7067 7068 // Don't automatically add "px" to these possibly-unitless properties 7069 cssNumber: { 7070 "animationIterationCount": true, 7071 "columnCount": true, 7072 "fillOpacity": true, 7073 "flexGrow": true, 7074 "flexShrink": true, 7075 "fontWeight": true, 7076 "lineHeight": true, 7077 "opacity": true, 7078 "order": true, 7079 "orphans": true, 7080 "widows": true, 7081 "zIndex": true, 7082 "zoom": true 7083 }, 7084 7085 // Add in properties whose names you wish to fix before 7086 // setting or getting the value 7087 cssProps: { 7088 7089 // normalize float css property 7090 "float": support.cssFloat ? "cssFloat" : "styleFloat" 7091 }, 7092 7093 // Get and set the style property on a DOM Node 7094 style: function( elem, name, value, extra ) { 7095 7096 // Don't set styles on text and comment nodes 7097 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 7098 return; 7099 } 7100 7101 // Make sure that we're working with the right name 7102 var ret, type, hooks, 7103 origName = jQuery.camelCase( name ), 7104 style = elem.style; 7105 7106 name = jQuery.cssProps[ origName ] || 7107 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); 7108 7109 // gets hook for the prefixed version 7110 // followed by the unprefixed version 7111 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 7112 7113 // Check if we're setting a value 7114 if ( value !== undefined ) { 7115 type = typeof value; 7116 7117 // Convert "+=" or "-=" to relative numbers (#7345) 7118 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 7119 value = adjustCSS( elem, name, ret ); 7120 7121 // Fixes bug #9237 7122 type = "number"; 7123 } 7124 7125 // Make sure that null and NaN values aren't set. See: #7116 7126 if ( value == null || value !== value ) { 7127 return; 7128 } 7129 7130 // If a number was passed in, add the unit (except for certain CSS properties) 7131 if ( type === "number" ) { 7132 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 7133 } 7134 7135 // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, 7136 // but it would mean to define eight 7137 // (for every problematic property) identical functions 7138 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 7139 style[ name ] = "inherit"; 7140 } 7141 7142 // If a hook was provided, use that value, otherwise just set the specified value
vendor: 4,586 bytes, lines 7143-7298
7143 if ( !hooks || !( "set" in hooks ) || 7144 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 7145 7146 // Support: IE 7147 // Swallow errors from 'invalid' CSS values (#5509) 7148 try { 7149 style[ name ] = value; 7150 } catch ( e ) {} 7151 } 7152 7153 } else { 7154 7155 // If a hook was provided get the non-computed value from there 7156 if ( hooks && "get" in hooks && 7157 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 7158 7159 return ret; 7160 } 7161 7162 // Otherwise just get the value from the style object 7163 return style[ name ]; 7164 } 7165 }, 7166 7167 css: function( elem, name, extra, styles ) { 7168 var num, val, hooks, 7169 origName = jQuery.camelCase( name ); 7170 7171 // Make sure that we're working with the right name 7172 name = jQuery.cssProps[ origName ] || 7173 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); 7174 7175 // gets hook for the prefixed version 7176 // followed by the unprefixed version 7177 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 7178 7179 // If a hook was provided get the computed value from there 7180 if ( hooks && "get" in hooks ) { 7181 val = hooks.get( elem, true, extra ); 7182 } 7183 7184 // Otherwise, if a way to get the computed value exists, use that 7185 if ( val === undefined ) { 7186 val = curCSS( elem, name, styles ); 7187 } 7188 7189 //convert "normal" to computed value 7190 if ( val === "normal" && name in cssNormalTransform ) { 7191 val = cssNormalTransform[ name ]; 7192 } 7193 7194 // Return, converting to number if forced or a qualifier was provided and val looks numeric 7195 if ( extra === "" || extra ) { 7196 num = parseFloat( val ); 7197 return extra === true || isFinite( num ) ? num || 0 : val; 7198 } 7199 return val; 7200 } 7201} ); 7202 7203jQuery.each( [ "height", "width" ], function( i, name ) { 7204 jQuery.cssHooks[ name ] = { 7205 get: function( elem, computed, extra ) { 7206 if ( computed ) { 7207 7208 // certain elements can have dimension info if we invisibly show them 7209 // however, it must have a current display style that would benefit from this 7210 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 7211 elem.offsetWidth === 0 ? 7212 swap( elem, cssShow, function() { 7213 return getWidthOrHeight( elem, name, extra ); 7214 } ) : 7215 getWidthOrHeight( elem, name, extra ); 7216 } 7217 }, 7218 7219 set: function( elem, value, extra ) { 7220 var styles = extra && getStyles( elem ); 7221 return setPositiveNumber( elem, value, extra ? 7222 augmentWidthOrHeight( 7223 elem, 7224 name, 7225 extra, 7226 support.boxSizing && 7227 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 7228 styles 7229 ) : 0 7230 ); 7231 } 7232 }; 7233} ); 7234 7235if ( !support.opacity ) { 7236 jQuery.cssHooks.opacity = { 7237 get: function( elem, computed ) { 7238 7239 // IE uses filters for opacity 7240 return ropacity.test( ( computed && elem.currentStyle ? 7241 elem.currentStyle.filter : 7242 elem.style.filter ) || "" ) ? 7243 ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : 7244 computed ? "1" : ""; 7245 }, 7246 7247 set: function( elem, value ) { 7248 var style = elem.style, 7249 currentStyle = elem.currentStyle, 7250 opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", 7251 filter = currentStyle && currentStyle.filter || style.filter || ""; 7252 7253 // IE has trouble with opacity if it does not have layout 7254 // Force it by setting the zoom level 7255 style.zoom = 1; 7256 7257 // if setting opacity to 1, and no other filters exist - 7258 // attempt to remove filter attribute #6652 7259 // if value === "", then remove inline opacity #12685 7260 if ( ( value >= 1 || value === "" ) && 7261 jQuery.trim( filter.replace( ralpha, "" ) ) === "" && 7262 style.removeAttribute ) { 7263 7264 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText 7265 // if "filter:" is present at all, clearType is disabled, we want to avoid this 7266 // style.removeAttribute is IE Only, but so apparently is this code path... 7267 style.removeAttribute( "filter" ); 7268 7269 // if there is no filter style applied in a css rule 7270 // or unset inline opacity, we are done 7271 if ( value === "" || currentStyle && !currentStyle.filter ) { 7272 return; 7273 } 7274 } 7275 7276 // otherwise, set new filter values 7277 style.filter = ralpha.test( filter ) ? 7278 filter.replace( ralpha, opacity ) : 7279 filter + " " + opacity; 7280 } 7281 }; 7282} 7283 7284jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, 7285 function( elem, computed ) { 7286 if ( computed ) { 7287 return swap( elem, { "display": "inline-block" }, 7288 curCSS, [ elem, "marginRight" ] ); 7289 } 7290 } 7291); 7292 7293jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 7294 function( elem, computed ) { 7295 if ( computed ) { 7296 return ( 7297 parseFloat( curCSS( elem, "marginLeft" ) ) || 7298
vendor: 4,625 bytes, lines 7299-7477
7299 // Support: IE<=11+ 7300 // Running getBoundingClientRect on a disconnected node in IE throws an error 7301 // Support: IE8 only 7302 // getClientRects() errors on disconnected elems 7303 ( jQuery.contains( elem.ownerDocument, elem ) ? 7304 elem.getBoundingClientRect().left - 7305 swap( elem, { marginLeft: 0 }, function() { 7306 return elem.getBoundingClientRect().left; 7307 } ) : 7308 0 7309 ) 7310 ) + "px"; 7311 } 7312 } 7313); 7314 7315// These hooks are used by animate to expand properties 7316jQuery.each( { 7317 margin: "", 7318 padding: "", 7319 border: "Width" 7320}, function( prefix, suffix ) { 7321 jQuery.cssHooks[ prefix + suffix ] = { 7322 expand: function( value ) { 7323 var i = 0, 7324 expanded = {}, 7325 7326 // assumes a single number if not a string 7327 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 7328 7329 for ( ; i < 4; i++ ) { 7330 expanded[ prefix + cssExpand[ i ] + suffix ] = 7331 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 7332 } 7333 7334 return expanded; 7335 } 7336 }; 7337 7338 if ( !rmargin.test( prefix ) ) { 7339 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 7340 } 7341} ); 7342 7343jQuery.fn.extend( { 7344 css: function( name, value ) { 7345 return access( this, function( elem, name, value ) { 7346 var styles, len, 7347 map = {}, 7348 i = 0; 7349 7350 if ( jQuery.isArray( name ) ) { 7351 styles = getStyles( elem ); 7352 len = name.length; 7353 7354 for ( ; i < len; i++ ) { 7355 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 7356 } 7357 7358 return map; 7359 } 7360 7361 return value !== undefined ? 7362 jQuery.style( elem, name, value ) : 7363 jQuery.css( elem, name ); 7364 }, name, value, arguments.length > 1 ); 7365 }, 7366 show: function() { 7367 return showHide( this, true ); 7368 }, 7369 hide: function() { 7370 return showHide( this ); 7371 }, 7372 toggle: function( state ) { 7373 if ( typeof state === "boolean" ) { 7374 return state ? this.show() : this.hide(); 7375 } 7376 7377 return this.each( function() { 7378 if ( isHidden( this ) ) { 7379 jQuery( this ).show(); 7380 } else { 7381 jQuery( this ).hide(); 7382 } 7383 } ); 7384 } 7385} ); 7386 7387 7388function Tween( elem, options, prop, end, easing ) { 7389 return new Tween.prototype.init( elem, options, prop, end, easing ); 7390} 7391jQuery.Tween = Tween; 7392 7393Tween.prototype = { 7394 constructor: Tween, 7395 init: function( elem, options, prop, end, easing, unit ) { 7396 this.elem = elem; 7397 this.prop = prop; 7398 this.easing = easing || jQuery.easing._default; 7399 this.options = options; 7400 this.start = this.now = this.cur(); 7401 this.end = end; 7402 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 7403 }, 7404 cur: function() { 7405 var hooks = Tween.propHooks[ this.prop ]; 7406 7407 return hooks && hooks.get ? 7408 hooks.get( this ) : 7409 Tween.propHooks._default.get( this ); 7410 }, 7411 run: function( percent ) { 7412 var eased, 7413 hooks = Tween.propHooks[ this.prop ]; 7414 7415 if ( this.options.duration ) { 7416 this.pos = eased = jQuery.easing[ this.easing ]( 7417 percent, this.options.duration * percent, 0, 1, this.options.duration 7418 ); 7419 } else { 7420 this.pos = eased = percent; 7421 } 7422 this.now = ( this.end - this.start ) * eased + this.start; 7423 7424 if ( this.options.step ) { 7425 this.options.step.call( this.elem, this.now, this ); 7426 } 7427 7428 if ( hooks && hooks.set ) { 7429 hooks.set( this ); 7430 } else { 7431 Tween.propHooks._default.set( this ); 7432 } 7433 return this; 7434 } 7435}; 7436 7437Tween.prototype.init.prototype = Tween.prototype; 7438 7439Tween.propHooks = { 7440 _default: { 7441 get: function( tween ) { 7442 var result; 7443 7444 // Use a property on the element directly when it is not a DOM element, 7445 // or when there is no matching style property that exists. 7446 if ( tween.elem.nodeType !== 1 || 7447 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 7448 return tween.elem[ tween.prop ]; 7449 } 7450 7451 // passing an empty string as a 3rd parameter to .css will automatically 7452 // attempt a parseFloat and fallback to a string if the parse fails 7453 // so, simple values such as "10px" are parsed to Float. 7454 // complex values such as "rotate(1rad)" are returned as is. 7455 result = jQuery.css( tween.elem, tween.prop, "" ); 7456 7457 // Empty strings, null, undefined and "auto" are converted to 0. 7458 return !result || result === "auto" ? 0 : result; 7459 }, 7460 set: function( tween ) { 7461 7462 // use step hook for back compat - use cssHook if its there - use .style if its 7463 // available and use plain properties where available 7464 if ( jQuery.fx.step[ tween.prop ] ) { 7465 jQuery.fx.step[ tween.prop ]( tween ); 7466 } else if ( tween.elem.nodeType === 1 && 7467 ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || 7468 jQuery.cssHooks[ tween.prop ] ) ) { 7469 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 7470 } else { 7471 tween.elem[ tween.prop ] = tween.now; 7472 } 7473 } 7474 } 7475}; 7476 7477// Support: IE <=9
vendor: 5,654 bytes, lines 7478-7694
7478// Panic based approach to setting things on disconnected nodes 7479 7480Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 7481 set: function( tween ) { 7482 if ( tween.elem.nodeType && tween.elem.parentNode ) { 7483 tween.elem[ tween.prop ] = tween.now; 7484 } 7485 } 7486}; 7487 7488jQuery.easing = { 7489 linear: function( p ) { 7490 return p; 7491 }, 7492 swing: function( p ) { 7493 return 0.5 - Math.cos( p * Math.PI ) / 2; 7494 }, 7495 _default: "swing" 7496}; 7497 7498jQuery.fx = Tween.prototype.init; 7499 7500// Back Compat <1.8 extension point 7501jQuery.fx.step = {}; 7502 7503 7504 7505 7506var 7507 fxNow, timerId, 7508 rfxtypes = /^(?:toggle|show|hide)$/, 7509 rrun = /queueHooks$/; 7510 7511// Animations created synchronously will run synchronously 7512function createFxNow() { 7513 window.setTimeout( function() { 7514 fxNow = undefined; 7515 } ); 7516 return ( fxNow = jQuery.now() ); 7517} 7518 7519// Generate parameters to create a standard animation 7520function genFx( type, includeWidth ) { 7521 var which, 7522 attrs = { height: type }, 7523 i = 0; 7524 7525 // if we include width, step value is 1 to do all cssExpand values, 7526 // if we don't include width, step value is 2 to skip over Left and Right 7527 includeWidth = includeWidth ? 1 : 0; 7528 for ( ; i < 4 ; i += 2 - includeWidth ) { 7529 which = cssExpand[ i ]; 7530 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 7531 } 7532 7533 if ( includeWidth ) { 7534 attrs.opacity = attrs.width = type; 7535 } 7536 7537 return attrs; 7538} 7539 7540function createTween( value, prop, animation ) { 7541 var tween, 7542 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 7543 index = 0, 7544 length = collection.length; 7545 for ( ; index < length; index++ ) { 7546 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 7547 7548 // we're done with this property 7549 return tween; 7550 } 7551 } 7552} 7553 7554function defaultPrefilter( elem, props, opts ) { 7555 /* jshint validthis: true */ 7556 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, 7557 anim = this, 7558 orig = {}, 7559 style = elem.style, 7560 hidden = elem.nodeType && isHidden( elem ), 7561 dataShow = jQuery._data( elem, "fxshow" ); 7562 7563 // handle queue: false promises 7564 if ( !opts.queue ) { 7565 hooks = jQuery._queueHooks( elem, "fx" ); 7566 if ( hooks.unqueued == null ) { 7567 hooks.unqueued = 0; 7568 oldfire = hooks.empty.fire; 7569 hooks.empty.fire = function() { 7570 if ( !hooks.unqueued ) { 7571 oldfire(); 7572 } 7573 }; 7574 } 7575 hooks.unqueued++; 7576 7577 anim.always( function() { 7578 7579 // doing this makes sure that the complete handler will be called 7580 // before this completes 7581 anim.always( function() { 7582 hooks.unqueued--; 7583 if ( !jQuery.queue( elem, "fx" ).length ) { 7584 hooks.empty.fire(); 7585 } 7586 } ); 7587 } ); 7588 } 7589 7590 // height/width overflow pass 7591 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { 7592 7593 // Make sure that nothing sneaks out 7594 // Record all 3 overflow attributes because IE does not 7595 // change the overflow attribute when overflowX and 7596 // overflowY are set to the same value 7597 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 7598 7599 // Set display property to inline-block for height/width 7600 // animations on inline elements that are having width/height animated 7601 display = jQuery.css( elem, "display" ); 7602 7603 // Test default display if display is currently "none" 7604 checkDisplay = display === "none" ? 7605 jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; 7606 7607 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { 7608 7609 // inline-level elements accept inline-block; 7610 // block-level elements need to be inline with layout 7611 if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) { 7612 style.display = "inline-block"; 7613 } else { 7614 style.zoom = 1; 7615 } 7616 } 7617 } 7618 7619 if ( opts.overflow ) { 7620 style.overflow = "hidden"; 7621 if ( !support.shrinkWrapBlocks() ) { 7622 anim.always( function() { 7623 style.overflow = opts.overflow[ 0 ]; 7624 style.overflowX = opts.overflow[ 1 ]; 7625 style.overflowY = opts.overflow[ 2 ]; 7626 } ); 7627 } 7628 } 7629 7630 // show/hide pass 7631 for ( prop in props ) { 7632 value = props[ prop ]; 7633 if ( rfxtypes.exec( value ) ) { 7634 delete props[ prop ]; 7635 toggle = toggle || value === "toggle"; 7636 if ( value === ( hidden ? "hide" : "show" ) ) { 7637 7638 // If there is dataShow left over from a stopped hide or show 7639 // and we are going to proceed with show, we should pretend to be hidden 7640 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 7641 hidden = true; 7642 } else { 7643 continue; 7644 } 7645 } 7646 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 7647 7648 // Any non-fx value stops us from restoring the original display value 7649 } else { 7650 display = undefined; 7651 } 7652 } 7653 7654 if ( !jQuery.isEmptyObject( orig ) ) { 7655 if ( dataShow ) { 7656 if ( "hidden" in dataShow ) { 7657 hidden = dataShow.hidden; 7658 } 7659 } else { 7660 dataShow = jQuery._data( elem, "fxshow", {} ); 7661 } 7662 7663 // store state if its toggle - enables .stop().toggle() to "reverse" 7664 if ( toggle ) { 7665 dataShow.hidden = !hidden; 7666 } 7667 if ( hidden ) { 7668 jQuery( elem ).show(); 7669 } else { 7670 anim.done( function() { 7671 jQuery( elem ).hide(); 7672 } ); 7673 } 7674 anim.done( function() { 7675 var prop; 7676 jQuery._removeData( elem, "fxshow" ); 7677 for ( prop in orig ) { 7678 jQuery.style( elem, prop, orig[ prop ] ); 7679 } 7680 } ); 7681 for ( prop in orig ) { 7682 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 7683 7684 if ( !( prop in dataShow ) ) { 7685 dataShow[ prop ] = tween.start; 7686 if ( hidden ) { 7687 tween.end = tween.start; 7688 tween.start = prop === "width" || prop === "height" ? 1 : 0; 7689 } 7690 } 7691 } 7692 7693 // If this is a noop like .hide().hide(), restore an overwritten display value 7694 } else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : dis
vendor: 10,851 bytes, lines 7694-8126
7694play ) === "inline" ) { 7695 style.display = display; 7696 } 7697} 7698 7699function propFilter( props, specialEasing ) { 7700 var index, name, easing, value, hooks; 7701 7702 // camelCase, specialEasing and expand cssHook pass 7703 for ( index in props ) { 7704 name = jQuery.camelCase( index ); 7705 easing = specialEasing[ name ]; 7706 value = props[ index ]; 7707 if ( jQuery.isArray( value ) ) { 7708 easing = value[ 1 ]; 7709 value = props[ index ] = value[ 0 ]; 7710 } 7711 7712 if ( index !== name ) { 7713 props[ name ] = value; 7714 delete props[ index ]; 7715 } 7716 7717 hooks = jQuery.cssHooks[ name ]; 7718 if ( hooks && "expand" in hooks ) { 7719 value = hooks.expand( value ); 7720 delete props[ name ]; 7721 7722 // not quite $.extend, this wont overwrite keys already present. 7723 // also - reusing 'index' from above because we have the correct "name" 7724 for ( index in value ) { 7725 if ( !( index in props ) ) { 7726 props[ index ] = value[ index ]; 7727 specialEasing[ index ] = easing; 7728 } 7729 } 7730 } else { 7731 specialEasing[ name ] = easing; 7732 } 7733 } 7734} 7735 7736function Animation( elem, properties, options ) { 7737 var result, 7738 stopped, 7739 index = 0, 7740 length = Animation.prefilters.length, 7741 deferred = jQuery.Deferred().always( function() { 7742 7743 // don't match elem in the :animated selector 7744 delete tick.elem; 7745 } ), 7746 tick = function() { 7747 if ( stopped ) { 7748 return false; 7749 } 7750 var currentTime = fxNow || createFxNow(), 7751 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 7752 7753 // Support: Android 2.3 7754 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 7755 temp = remaining / animation.duration || 0, 7756 percent = 1 - temp, 7757 index = 0, 7758 length = animation.tweens.length; 7759 7760 for ( ; index < length ; index++ ) { 7761 animation.tweens[ index ].run( percent ); 7762 } 7763 7764 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 7765 7766 if ( percent < 1 && length ) { 7767 return remaining; 7768 } else { 7769 deferred.resolveWith( elem, [ animation ] ); 7770 return false; 7771 } 7772 }, 7773 animation = deferred.promise( { 7774 elem: elem, 7775 props: jQuery.extend( {}, properties ), 7776 opts: jQuery.extend( true, { 7777 specialEasing: {}, 7778 easing: jQuery.easing._default 7779 }, options ), 7780 originalProperties: properties, 7781 originalOptions: options, 7782 startTime: fxNow || createFxNow(), 7783 duration: options.duration, 7784 tweens: [], 7785 createTween: function( prop, end ) { 7786 var tween = jQuery.Tween( elem, animation.opts, prop, end, 7787 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 7788 animation.tweens.push( tween ); 7789 return tween; 7790 }, 7791 stop: function( gotoEnd ) { 7792 var index = 0, 7793 7794 // if we are going to the end, we want to run all the tweens 7795 // otherwise we skip this part 7796 length = gotoEnd ? animation.tweens.length : 0; 7797 if ( stopped ) { 7798 return this; 7799 } 7800 stopped = true; 7801 for ( ; index < length ; index++ ) { 7802 animation.tweens[ index ].run( 1 ); 7803 } 7804 7805 // resolve when we played the last frame 7806 // otherwise, reject 7807 if ( gotoEnd ) { 7808 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7809 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 7810 } else { 7811 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 7812 } 7813 return this; 7814 } 7815 } ), 7816 props = animation.props; 7817 7818 propFilter( props, animation.opts.specialEasing ); 7819 7820 for ( ; index < length ; index++ ) { 7821 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 7822 if ( result ) { 7823 if ( jQuery.isFunction( result.stop ) ) { 7824 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 7825 jQuery.proxy( result.stop, result ); 7826 } 7827 return result; 7828 } 7829 } 7830 7831 jQuery.map( props, createTween, animation ); 7832 7833 if ( jQuery.isFunction( animation.opts.start ) ) { 7834 animation.opts.start.call( elem, animation ); 7835 } 7836 7837 jQuery.fx.timer( 7838 jQuery.extend( tick, { 7839 elem: elem, 7840 anim: animation, 7841 queue: animation.opts.queue 7842 } ) 7843 ); 7844 7845 // attach callbacks from options 7846 return animation.progress( animation.opts.progress ) 7847 .done( animation.opts.done, animation.opts.complete ) 7848 .fail( animation.opts.fail ) 7849 .always( animation.opts.always ); 7850} 7851 7852jQuery.Animation = jQuery.extend( Animation, { 7853 7854 tweeners: { 7855 "*": [ function( prop, value ) { 7856 var tween = this.createTween( prop, value ); 7857 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 7858 return tween; 7859 } ] 7860 }, 7861 7862 tweener: function( props, callback ) { 7863 if ( jQuery.isFunction( props ) ) { 7864 callback = props; 7865 props = [ "*" ]; 7866 } else { 7867 props = props.match( rnotwhite ); 7868 } 7869 7870 var prop, 7871 index = 0, 7872 length = props.length; 7873 7874 for ( ; index < length ; index++ ) { 7875 prop = props[ index ]; 7876 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 7877 Animation.tweeners[ prop ].unshift( callback ); 7878 } 7879 }, 7880 7881 prefilters: [ defaultPrefilter ], 7882 7883 prefilter: function( callback, prepend ) { 7884 if ( prepend ) { 7885 Animation.prefilters.unshift( callback ); 7886 } else { 7887 Animation.prefilters.push( callback ); 7888 } 7889 } 7890} ); 7891 7892jQuery.speed = function( speed, easing, fn ) { 7893 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 7894 complete: fn || !fn && easing || 7895 jQuery.isFunction( speed ) && speed, 7896 duration: speed, 7897 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing 7898 }; 7899 7900 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : 7901 opt.duration in jQuery.fx.speeds ? 7902 jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; 7903 7904 // normalize opt.queue - true/undefined/null -> "fx" 7905 if ( opt.queue == null || opt.queue === true ) { 7906 opt.queue = "fx"; 7907 } 7908 7909 // Queueing 7910 opt.old = opt.complete; 7911 7912 opt.complete = function() { 7913 if ( jQuery.isFunction( opt.old ) ) { 7914 opt.old.call( this ); 7915 } 7916 7917 if ( opt.queue ) { 7918 jQuery.dequeue( this, opt.queue ); 7919 } 7920 }; 7921 7922 return opt; 7923}; 7924 7925jQuery.fn.extend( { 7926 fadeTo: function( speed, to, easing, callback ) { 7927 7928 // show any hidden elements after setting opacity to 0 7929 return this.filter( isHidden ).css( "opacity", 0 ).show() 7930 7931 // animate to the value specified 7932 .end().animate( { opacity: to }, speed, easing, callback ); 7933 }, 7934 animate: function( prop, speed, easing, callback ) { 7935 var empty = jQuery.isEmptyObject( prop ), 7936 optall = jQuery.speed( speed, easing, callback ), 7937 doAnimation = function() { 7938 7939 // Operate on a copy of prop so per-property easing won't be lost 7940 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 7941 7942 // Empty animations, or finishing resolves immediately 7943 if ( empty || jQuery._data( this, "finish" ) ) { 7944 anim.stop( true ); 7945 } 7946 }; 7947 doAnimation.finish = doAnimation; 7948 7949 return empty || optall.queue === false ? 7950 this.each( doAnimation ) : 7951 this.queue( optall.queue, doAnimation ); 7952 }, 7953 stop: function( type, clearQueue, gotoEnd ) { 7954 var stopQueue = function( hooks ) { 7955 var stop = hooks.stop; 7956 delete hooks.stop; 7957 stop( gotoEnd ); 7958 }; 7959 7960 if ( typeof type !== "string" ) { 7961 gotoEnd = clearQueue; 7962 clearQueue = type; 7963 type = undefined; 7964 } 7965 if ( clearQueue && type !== false ) { 7966 this.queue( type || "fx", [] ); 7967 } 7968 7969 return this.each( function() { 7970 var dequeue = true, 7971 index = type != null && type + "queueHooks", 7972 timers = jQuery.timers, 7973 data = jQuery._data( this ); 7974 7975 if ( index ) { 7976 if ( data[ index ] && data[ index ].stop ) { 7977 stopQueue( data[ index ] ); 7978 } 7979 } else { 7980 for ( index in data ) { 7981 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 7982 stopQueue( data[ index ] ); 7983 } 7984 } 7985 } 7986 7987 for ( index = timers.length; index--; ) { 7988 if ( timers[ index ].elem === this && 7989 ( type == null || timers[ index ].queue === type ) ) { 7990 7991 timers[ index ].anim.stop( gotoEnd ); 7992 dequeue = false; 7993 timers.splice( index, 1 ); 7994 } 7995 } 7996 7997 // start the next in the queue if the last step wasn't forced 7998 // timers currently will call their complete callbacks, which will dequeue 7999 // but only if they were gotoEnd 8000 if ( dequeue || !gotoEnd ) { 8001 jQuery.dequeue( this, type ); 8002 } 8003 } ); 8004 }, 8005 finish: function( type ) { 8006 if ( type !== false ) { 8007 type = type || "fx"; 8008 } 8009 return this.each( function() { 8010 var index, 8011 data = jQuery._data( this ), 8012 queue = data[ type + "queue" ], 8013 hooks = data[ type + "queueHooks" ], 8014 timers = jQuery.timers, 8015 length = queue ? queue.length : 0; 8016 8017 // enable finishing flag on private data 8018 data.finish = true; 8019 8020 // empty the queue first 8021 jQuery.queue( this, type, [] ); 8022 8023 if ( hooks && hooks.stop ) { 8024 hooks.stop.call( this, true ); 8025 } 8026 8027 // look for any active animations, and finish them 8028 for ( index = timers.length; index--; ) { 8029 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 8030 timers[ index ].anim.stop( true ); 8031 timers.splice( index, 1 ); 8032 } 8033 } 8034 8035 // look for any animations in the old queue and finish them 8036 for ( index = 0; index < length; index++ ) { 8037 if ( queue[ index ] && queue[ index ].finish ) { 8038 queue[ index ].finish.call( this ); 8039 } 8040 } 8041 8042 // turn off finishing flag 8043 delete data.finish; 8044 } ); 8045 } 8046} ); 8047 8048jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { 8049 var cssFn = jQuery.fn[ name ]; 8050 jQuery.fn[ name ] = function( speed, easing, callback ) { 8051 return speed == null || typeof speed === "boolean" ? 8052 cssFn.apply( this, arguments ) : 8053 this.animate( genFx( name, true ), speed, easing, callback ); 8054 }; 8055} ); 8056 8057// Generate shortcuts for custom animations 8058jQuery.each( { 8059 slideDown: genFx( "show" ), 8060 slideUp: genFx( "hide" ), 8061 slideToggle: genFx( "toggle" ), 8062 fadeIn: { opacity: "show" }, 8063 fadeOut: { opacity: "hide" }, 8064 fadeToggle: { opacity: "toggle" } 8065}, function( name, props ) { 8066 jQuery.fn[ name ] = function( speed, easing, callback ) { 8067 return this.animate( props, speed, easing, callback ); 8068 }; 8069} ); 8070 8071jQuery.timers = []; 8072jQuery.fx.tick = function() { 8073 var timer, 8074 timers = jQuery.timers, 8075 i = 0; 8076 8077 fxNow = jQuery.now(); 8078 8079 for ( ; i < timers.length; i++ ) { 8080 timer = timers[ i ]; 8081 8082 // Checks the timer has not already been removed 8083 if ( !timer() && timers[ i ] === timer ) { 8084 timers.splice( i--, 1 ); 8085 } 8086 } 8087 8088 if ( !timers.length ) { 8089 jQuery.fx.stop(); 8090 } 8091 fxNow = undefined; 8092}; 8093 8094jQuery.fx.timer = function( timer ) { 8095 jQuery.timers.push( timer ); 8096 if ( timer() ) { 8097 jQuery.fx.start(); 8098 } else { 8099 jQuery.timers.pop(); 8100 } 8101}; 8102 8103jQuery.fx.interval = 13; 8104 8105jQuery.fx.start = function() { 8106 if ( !timerId ) { 8107 timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval ); 8108 } 8109}; 8110 8111jQuery.fx.stop = function() { 8112 window.clearInterval( timerId ); 8113 timerId = null; 8114}; 8115 8116jQuery.fx.speeds = { 8117 slow: 600, 8118 fast: 200, 8119 8120 // Default speed 8121 _default: 400 8122}; 8123 8124 8125// Based off of the plugin by Clint Helfers, with permission. 8126// http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
8127jQuery.fn.delay = function( time, type ) { 8128 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 8129 type = type || "fx"; 8130 8131 return this.queue( type, function( next, hooks ) { 8132 var timeout = window.setTimeout( next, time ); 8133 hooks.stop = function() { 8134 window.clearTimeout( timeout ); 8135 }; 8136 } ); 8137}; 8138 8139 8140( function() { 8141 var a, 8142 input = document.createElement( "input" ), 8143 div = document.createElement( "div" ), 8144 select = document.createElement( "select" ), 8145 opt = select.appendChild( document.createElement( "option" ) ); 8146 8147 // Setup 8148 div = document.createElement( "div" ); 8149 div.setAttribute( "className", "t" ); 8150 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; 8151 a = div.getElementsByTagName( "a" )[ 0 ]; 8152 8153 // Support: Windows Web Apps (WWA) 8154 // `type` must use .setAttribute for WWA (#14901) 8155 input.setAttribute( "type", "checkbox" ); 8156 div.appendChild( input ); 8157 8158 a = div.getElementsByTagName( "a" )[ 0 ]; 8159 8160 // First batch of tests. 8161 a.style.cssText = "top:1px"; 8162 8163 // Test setAttribute on camelCase class. 8164 // If it works, we need attrFixes when doing get/setAttribute (ie6/7)
vendor: 2,696 bytes, lines 8165-8266
8165 support.getSetAttribute = div.className !== "t"; 8166 8167 // Get the style information from getAttribute 8168 // (IE uses .cssText instead) 8169 support.style = /top/.test( a.getAttribute( "style" ) ); 8170 8171 // Make sure that URLs aren't manipulated 8172 // (IE normalizes it by default) 8173 support.hrefNormalized = a.getAttribute( "href" ) === "/a"; 8174 8175 // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) 8176 support.checkOn = !!input.value; 8177 8178 // Make sure that a selected-by-default option has a working selected property. 8179 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) 8180 support.optSelected = opt.selected; 8181 8182 // Tests for enctype support on a form (#6743) 8183 support.enctype = !!document.createElement( "form" ).enctype; 8184 8185 // Make sure that the options inside disabled selects aren't marked as disabled 8186 // (WebKit marks them as disabled) 8187 select.disabled = true; 8188 support.optDisabled = !opt.disabled; 8189 8190 // Support: IE8 only 8191 // Check if we can trust getAttribute("value") 8192 input = document.createElement( "input" ); 8193 input.setAttribute( "value", "" ); 8194 support.input = input.getAttribute( "value" ) === ""; 8195 8196 // Check if an input maintains its value after becoming a radio 8197 input.value = "t"; 8198 input.setAttribute( "type", "radio" ); 8199 support.radioValue = input.value === "t"; 8200} )(); 8201 8202 8203var rreturn = /\r/g, 8204 rspaces = /[\x20\t\r\n\f]+/g; 8205 8206jQuery.fn.extend( { 8207 val: function( value ) { 8208 var hooks, ret, isFunction, 8209 elem = this[ 0 ]; 8210 8211 if ( !arguments.length ) { 8212 if ( elem ) { 8213 hooks = jQuery.valHooks[ elem.type ] || 8214 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 8215 8216 if ( 8217 hooks && 8218 "get" in hooks && 8219 ( ret = hooks.get( elem, "value" ) ) !== undefined 8220 ) { 8221 return ret; 8222 } 8223 8224 ret = elem.value; 8225 8226 return typeof ret === "string" ? 8227 8228 // handle most common string cases 8229 ret.replace( rreturn, "" ) : 8230 8231 // handle cases where value is null/undef or number 8232 ret == null ? "" : ret; 8233 } 8234 8235 return; 8236 } 8237 8238 isFunction = jQuery.isFunction( value ); 8239 8240 return this.each( function( i ) { 8241 var val; 8242 8243 if ( this.nodeType !== 1 ) { 8244 return; 8245 } 8246 8247 if ( isFunction ) { 8248 val = value.call( this, i, jQuery( this ).val() ); 8249 } else { 8250 val = value; 8251 } 8252 8253 // Treat null/undefined as ""; convert numbers to string 8254 if ( val == null ) { 8255 val = ""; 8256 } else if ( typeof val === "number" ) { 8257 val += ""; 8258 } else if ( jQuery.isArray( val ) ) { 8259 val = jQuery.map( val, function( value ) { 8260 return value == null ? "" : value + ""; 8261 } ); 8262 } 8263 8264 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 8265 8266 // If set returns undefined, fall back to normal setting
vendor: 4,648 bytes, lines 8267-8457
8267 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 8268 this.value = val; 8269 } 8270 } ); 8271 } 8272} ); 8273 8274jQuery.extend( { 8275 valHooks: { 8276 option: { 8277 get: function( elem ) { 8278 var val = jQuery.find.attr( elem, "value" ); 8279 return val != null ? 8280 val : 8281 8282 // Support: IE10-11+ 8283 // option.text throws exceptions (#14686, #14858) 8284 // Strip and collapse whitespace 8285 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8286 jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " ); 8287 } 8288 }, 8289 select: { 8290 get: function( elem ) { 8291 var value, option, 8292 options = elem.options, 8293 index = elem.selectedIndex, 8294 one = elem.type === "select-one" || index < 0, 8295 values = one ? null : [], 8296 max = one ? index + 1 : options.length, 8297 i = index < 0 ? 8298 max : 8299 one ? index : 0; 8300 8301 // Loop through all the selected options 8302 for ( ; i < max; i++ ) { 8303 option = options[ i ]; 8304 8305 // oldIE doesn't update selected after form reset (#2551) 8306 if ( ( option.selected || i === index ) && 8307 8308 // Don't return options that are disabled or in a disabled optgroup 8309 ( support.optDisabled ? 8310 !option.disabled : 8311 option.getAttribute( "disabled" ) === null ) && 8312 ( !option.parentNode.disabled || 8313 !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { 8314 8315 // Get the specific value for the option 8316 value = jQuery( option ).val(); 8317 8318 // We don't need an array for one selects 8319 if ( one ) { 8320 return value; 8321 } 8322 8323 // Multi-Selects return an array 8324 values.push( value ); 8325 } 8326 } 8327 8328 return values; 8329 }, 8330 8331 set: function( elem, value ) { 8332 var optionSet, option, 8333 options = elem.options, 8334 values = jQuery.makeArray( value ), 8335 i = options.length; 8336 8337 while ( i-- ) { 8338 option = options[ i ]; 8339 8340 if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 ) { 8341 8342 // Support: IE6 8343 // When new option element is added to select box we need to 8344 // force reflow of newly added node in order to workaround delay 8345 // of initialization properties 8346 try { 8347 option.selected = optionSet = true; 8348 8349 } catch ( _ ) { 8350 8351 // Will be executed only in IE6 8352 option.scrollHeight; 8353 } 8354 8355 } else { 8356 option.selected = false; 8357 } 8358 } 8359 8360 // Force browsers to behave consistently when non-matching value is set 8361 if ( !optionSet ) { 8362 elem.selectedIndex = -1; 8363 } 8364 8365 return options; 8366 } 8367 } 8368 } 8369} ); 8370 8371// Radios and checkboxes getter/setter 8372jQuery.each( [ "radio", "checkbox" ], function() { 8373 jQuery.valHooks[ this ] = { 8374 set: function( elem, value ) { 8375 if ( jQuery.isArray( value ) ) { 8376 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 8377 } 8378 } 8379 }; 8380 if ( !support.checkOn ) { 8381 jQuery.valHooks[ this ].get = function( elem ) { 8382 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 8383 }; 8384 } 8385} ); 8386 8387 8388 8389 8390var nodeHook, boolHook, 8391 attrHandle = jQuery.expr.attrHandle, 8392 ruseDefault = /^(?:checked|selected)$/i, 8393 getSetAttribute = support.getSetAttribute, 8394 getSetInput = support.input; 8395 8396jQuery.fn.extend( { 8397 attr: function( name, value ) { 8398 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 8399 }, 8400 8401 removeAttr: function( name ) { 8402 return this.each( function() { 8403 jQuery.removeAttr( this, name ); 8404 } ); 8405 } 8406} ); 8407 8408jQuery.extend( { 8409 attr: function( elem, name, value ) { 8410 var ret, hooks, 8411 nType = elem.nodeType; 8412 8413 // Don't get/set attributes on text, comment and attribute nodes 8414 if ( nType === 3 || nType === 8 || nType === 2 ) { 8415 return; 8416 } 8417 8418 // Fallback to prop when attributes are not supported 8419 if ( typeof elem.getAttribute === "undefined" ) { 8420 return jQuery.prop( elem, name, value ); 8421 } 8422 8423 // All attributes are lowercase 8424 // Grab necessary hook if one is defined 8425 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8426 name = name.toLowerCase(); 8427 hooks = jQuery.attrHooks[ name ] || 8428 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); 8429 } 8430 8431 if ( value !== undefined ) { 8432 if ( value === null ) { 8433 jQuery.removeAttr( elem, name ); 8434 return; 8435 } 8436 8437 if ( hooks && "set" in hooks && 8438 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8439 return ret; 8440 } 8441 8442 elem.setAttribute( name, value + "" ); 8443 return value; 8444 } 8445 8446 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8447 return ret; 8448 } 8449 8450 ret = jQuery.find.attr( elem, name ); 8451 8452 // Non-existent attributes return null, we normalize to undefined 8453 return ret == null ? undefined : ret; 8454 }, 8455 8456 attrHooks: { 8457 type: {
vendor: 4,457 bytes, lines 8458-8624
8458 set: function( elem, value ) { 8459 if ( !support.radioValue && value === "radio" && 8460 jQuery.nodeName( elem, "input" ) ) { 8461 8462 // Setting the type on a radio button after the value resets the value in IE8-9 8463 // Reset value to default in case type is set after value during creation 8464 var val = elem.value; 8465 elem.setAttribute( "type", value ); 8466 if ( val ) { 8467 elem.value = val; 8468 } 8469 return value; 8470 } 8471 } 8472 } 8473 }, 8474 8475 removeAttr: function( elem, value ) { 8476 var name, propName, 8477 i = 0, 8478 attrNames = value && value.match( rnotwhite ); 8479 8480 if ( attrNames && elem.nodeType === 1 ) { 8481 while ( ( name = attrNames[ i++ ] ) ) { 8482 propName = jQuery.propFix[ name ] || name; 8483 8484 // Boolean attributes get special treatment (#10870) 8485 if ( jQuery.expr.match.bool.test( name ) ) { 8486 8487 // Set corresponding property to false 8488 if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { 8489 elem[ propName ] = false; 8490 8491 // Support: IE<9 8492 // Also clear defaultChecked/defaultSelected (if appropriate) 8493 } else { 8494 elem[ jQuery.camelCase( "default-" + name ) ] = 8495 elem[ propName ] = false; 8496 } 8497 8498 // See #9699 for explanation of this approach (setting first, then removal) 8499 } else { 8500 jQuery.attr( elem, name, "" ); 8501 } 8502 8503 elem.removeAttribute( getSetAttribute ? name : propName ); 8504 } 8505 } 8506 } 8507} ); 8508 8509// Hooks for boolean attributes 8510boolHook = { 8511 set: function( elem, value, name ) { 8512 if ( value === false ) { 8513 8514 // Remove boolean attributes when set to false 8515 jQuery.removeAttr( elem, name ); 8516 } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { 8517 8518 // IE<8 needs the *property* name 8519 elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); 8520 8521 } else { 8522 8523 // Support: IE<9 8524 // Use defaultChecked and defaultSelected for oldIE 8525 elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; 8526 } 8527 return name; 8528 } 8529}; 8530 8531jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { 8532 var getter = attrHandle[ name ] || jQuery.find.attr; 8533 8534 if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { 8535 attrHandle[ name ] = function( elem, name, isXML ) { 8536 var ret, handle; 8537 if ( !isXML ) { 8538 8539 // Avoid an infinite loop by temporarily removing this function from the getter 8540 handle = attrHandle[ name ]; 8541 attrHandle[ name ] = ret; 8542 ret = getter( elem, name, isXML ) != null ? 8543 name.toLowerCase() : 8544 null; 8545 attrHandle[ name ] = handle; 8546 } 8547 return ret; 8548 }; 8549 } else { 8550 attrHandle[ name ] = function( elem, name, isXML ) { 8551 if ( !isXML ) { 8552 return elem[ jQuery.camelCase( "default-" + name ) ] ? 8553 name.toLowerCase() : 8554 null; 8555 } 8556 }; 8557 } 8558} ); 8559 8560// fix oldIE attroperties 8561if ( !getSetInput || !getSetAttribute ) { 8562 jQuery.attrHooks.value = { 8563 set: function( elem, value, name ) { 8564 if ( jQuery.nodeName( elem, "input" ) ) { 8565 8566 // Does not return so that setAttribute is also used 8567 elem.defaultValue = value; 8568 } else { 8569 8570 // Use nodeHook if defined (#1954); otherwise setAttribute is fine 8571 return nodeHook && nodeHook.set( elem, value, name ); 8572 } 8573 } 8574 }; 8575} 8576 8577// IE6/7 do not support getting/setting some attributes with get/setAttribute 8578if ( !getSetAttribute ) { 8579 8580 // Use this for any attribute in IE6/7 8581 // This fixes almost every IE6/7 issue 8582 nodeHook = { 8583 set: function( elem, value, name ) { 8584 8585 // Set the existing or create a new attribute node 8586 var ret = elem.getAttributeNode( name ); 8587 if ( !ret ) { 8588 elem.setAttributeNode( 8589 ( ret = elem.ownerDocument.createAttribute( name ) ) 8590 ); 8591 } 8592 8593 ret.value = value += ""; 8594 8595 // Break association with cloned elements by also using setAttribute (#9646) 8596 if ( name === "value" || value === elem.getAttribute( name ) ) { 8597 return value; 8598 } 8599 } 8600 }; 8601 8602 // Some attributes are constructed with empty-string values when not defined 8603 attrHandle.id = attrHandle.name = attrHandle.coords = 8604 function( elem, name, isXML ) { 8605 var ret; 8606 if ( !isXML ) { 8607 return ( ret = elem.getAttributeNode( name ) ) && ret.value !== "" ? 8608 ret.value : 8609 null; 8610 } 8611 }; 8612 8613 // Fixing value retrieval on a button requires this module 8614 jQuery.valHooks.button = { 8615 get: function( elem, name ) { 8616 var ret = elem.getAttributeNode( name ); 8617 if ( ret && ret.specified ) { 8618 return ret.value; 8619 } 8620 }, 8621 set: nodeHook.set 8622 }; 8623 8624 // Set contenteditable to false on removals(#10429)
8625 // Setting to empty string throws an error as an invalid value 8626 jQuery.attrHooks.contenteditable = { 8627 set: function( elem, value, name ) { 8628 nodeHook.set( elem, value === "" ? false : value, name ); 8629 } 8630 }; 8631 8632 // Set width and height to auto instead of 0 on empty string( Bug #8150 ) 8633 // This is for removals 8634 jQuery.each( [ "width", "height" ], function( i, name ) { 8635 jQuery.attrHooks[ name ] = { 8636 set: function( elem, value ) { 8637 if ( value === "" ) { 8638 elem.setAttribute( name, "auto" ); 8639 return value; 8640 } 8641 } 8642 }; 8643 } ); 8644} 8645 8646if ( !support.style ) { 8647 jQuery.attrHooks.style = { 8648 get: function( elem ) { 8649 8650 // Return undefined in the case of empty string 8651 // Note: IE uppercases css property names, but if we were to .toLowerCase() 8652 // .cssText, that would destroy case sensitivity in URL's, like in "background" 8653 return elem.style.cssText || undefined; 8654 }, 8655 set: function( elem, value ) { 8656 return ( elem.style.cssText = value + "" ); 8657 } 8658 }; 8659} 8660 8661 8662 8663 8664var rfocusable = /^(?:input|select|textarea|button|object)$/i, 8665 rclickable = /^(?:a|area)$/i; 8666 8667jQuery.fn.extend( { 8668 prop: function( name, value ) { 8669 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 8670 }, 8671 8672 removeProp: function( name ) { 8673 name = jQuery.propFix[ name ] || name; 8674 return this.each( function() { 8675 8676 // try/catch handles cases where IE balks (such as removing a property on window) 8677 try { 8678 this[ name ] = undefined; 8679 delete this[ name ]; 8680 } catch ( e ) {} 8681 } ); 8682 } 8683} ); 8684 8685jQuery.extend( { 8686 prop: function( elem, name, value ) { 8687 var ret, hooks, 8688 nType = elem.nodeType; 8689 8690 // Don't get/set properties on text, comment and attribute nodes 8691 if ( nType === 3 || nType === 8 || nType === 2 ) { 8692 return; 8693 } 8694 8695 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8696 8697 // Fix name and attach hooks 8698 name = jQuery.propFix[ name ] || name; 8699 hooks = jQuery.propHooks[ name ]; 8700 } 8701 8702 if ( value !== undefined ) { 8703 if ( hooks && "set" in hooks && 8704 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8705 return ret; 8706 } 8707 8708 return ( elem[ name ] = value ); 8709 } 8710 8711 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8712 return ret; 8713 } 8714 8715 return elem[ name ]; 8716 }, 8717 8718 propHooks: { 8719 tabIndex: { 8720 get: function( elem ) { 8721 8722 // elem.tabIndex doesn't always return the 8723 // correct value when it hasn't been explicitly set 8724 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 8725 // Use proper attribute retrieval(#12072) 8726 var tabindex = jQuery.find.attr( elem, "tabindex" ); 8727 8728 return tabindex ? 8729 parseInt( tabindex, 10 ) : 8730 rfocusable.test( elem.nodeName ) || 8731 rclickable.test( elem.nodeName ) && elem.href ? 8732 0 : 8733 -1; 8734 } 8735 } 8736 }, 8737 8738 propFix: { 8739 "for": "htmlFor", 8740 "class": "className" 8741 } 8742} ); 8743 8744// Some attributes require a special call on IE 8745// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 8746if ( !support.hrefNormalized ) { 8747 8748 // href/src property should get the full normalized URL (#10299/#12915) 8749 jQuery.each( [ "href", "src" ], function( i, name ) { 8750 jQuery.propHooks[ name ] = { 8751 get: function( elem ) { 8752 return elem.getAttribute( name, 4 ); 8753 } 8754 }; 8755 } ); 8756} 8757 8758// Support: Safari, IE9+ 8759// Accessing the selectedIndex property 8760// forces the browser to respect setting selected 8761// on the option 8762// The getter ensures a default option is selected 8763// when in an optgroup 8764if ( !support.optSelected ) { 8765 jQuery.propHooks.selected = { 8766 get: function( elem ) { 8767 var parent = elem.parentNode; 8768 8769 if ( parent ) { 8770 parent.selectedIndex; 8771 8772 // Make sure that it also works with optgroups, see #5701 8773 if ( parent.parentNode ) { 8774 parent.parentNode.selectedIndex; 8775 } 8776 } 8777 return null; 8778 }, 8779 set: function( elem ) { 8780 var parent = elem.parentNode; 8781 if ( parent ) { 8782 parent.selectedIndex; 8783 8784 if ( parent.parentNode ) { 8785 parent.parentNode.selectedIndex; 8786 } 8787 } 8788 } 8789 }; 8790} 8791 8792jQuery.each( [ 8793 "tabIndex", 8794 "readOnly", 8795 "maxLength", 8796 "cellSpacing", 8797 "cellPadding", 8798 "rowSpan", 8799 "colSpan", 8800 "useMap", 8801 "frameBorder", 8802 "contentEditable" 8803], function() { 8804 jQuery.propFix[ this.toLowerCase() ] = this; 8805} ); 8806 8807// IE6/7 call enctype encoding 8808if ( !support.enctype ) { 8809 jQuery.propFix.enctype = "encoding"; 8810} 8811 8812 8813 8814 8815var rclass = /[\t\r\n\f]/g; 8816 8817function getClass( elem ) { 8818 return jQuery.attr( elem, "class" ) || ""; 8819} 8820 8821jQuery.fn.extend( { 8822 addClass: function( value ) { 8823 var classes, elem, cur, curValue, clazz, j, finalValue, 8824 i = 0; 8825 8826 if ( jQuery.isFunction( value ) ) { 8827 return this.each( function( j ) { 8828 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 8829 } ); 8830 } 8831 8832 if ( typeof value === "string" && value ) { 8833 classes = value.match( rnotwhite ) || []; 8834 8835 while ( ( elem = this[ i++ ] ) ) { 8836 curValue = getClass( elem ); 8837 cur = elem.nodeType === 1 && 8838 ( " " + curValue + " " ).replace( rclass, " " ); 8839 8840 if ( cur ) { 8841 j = 0; 8842 while ( ( clazz = classes[ j++ ] ) ) { 8843 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 8844 cur += clazz + " "; 8845 } 8846 } 8847 8848 // only assign if different to avoid unneeded rendering. 8849 finalValue = jQuery.trim( cur ); 8850 if ( curValue !== finalValue ) { 8851 jQuery.attr( elem, "class", finalValue ); 8852 } 8853 } 8854 } 8855 } 8856 8857 return this; 8858 }, 8859 8860 removeClass: function( value ) { 8861 var classes, elem, cur, curValue, clazz, j, finalValue, 8862 i = 0; 8863 8864 if ( jQuery.isFunction( value ) ) { 8865 return this.each( function( j ) { 8866 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 8867 } ); 8868 } 8869 8870 if ( !arguments.length ) { 8871 return this.attr( "class", "" ); 8872 } 8873 8874 if ( typeof value === "string" && value ) { 8875 classes = value.match( rnotwhite ) || []; 8876 8877 while ( ( elem = this[ i++ ] ) ) { 8878 curValue = getClass( elem ); 8879 8880 // This expression is here for better compressibility (see addClass) 8881 cur = elem.nodeType === 1 && 8882 ( " " + curValue + " " ).replace( rclass, " " ); 8883 8884 if ( cur ) { 8885 j = 0; 8886 while ( ( clazz = classes[ j++ ] ) ) { 8887
8888 // Remove *all* instances 8889 while ( cur.indexOf( " " + clazz + " " ) > -1 ) { 8890 cur = cur.replace( " " + clazz + " ", " " ); 8891 } 8892 } 8893 8894 // Only assign if different to avoid unneeded rendering. 8895 finalValue = jQuery.trim( cur ); 8896 if ( curValue !== finalValue ) { 8897 jQuery.attr( elem, "class", finalValue ); 8898 } 8899 } 8900 } 8901 } 8902 8903 return this; 8904 }, 8905 8906 toggleClass: function( value, stateVal ) { 8907 var type = typeof value; 8908 8909 if ( typeof stateVal === "boolean" && type === "string" ) { 8910 return stateVal ? this.addClass( value ) : this.removeClass( value ); 8911 } 8912 8913 if ( jQuery.isFunction( value ) ) { 8914 return this.each( function( i ) { 8915 jQuery( this ).toggleClass( 8916 value.call( this, i, getClass( this ), stateVal ), 8917 stateVal 8918 ); 8919 } ); 8920 } 8921 8922 return this.each( function() { 8923 var className, i, self, classNames; 8924 8925 if ( type === "string" ) { 8926 8927 // Toggle individual class names 8928 i = 0; 8929 self = jQuery( this ); 8930 classNames = value.match( rnotwhite ) || []; 8931 8932 while ( ( className = classNames[ i++ ] ) ) { 8933 8934 // Check each className given, space separated list 8935 if ( self.hasClass( className ) ) { 8936 self.removeClass( className ); 8937 } else { 8938 self.addClass( className ); 8939 } 8940 } 8941 8942 // Toggle whole class name 8943 } else if ( value === undefined || type === "boolean" ) { 8944 className = getClass( this ); 8945 if ( className ) { 8946 8947 // store className if set 8948 jQuery._data( this, "__className__", className ); 8949 } 8950 8951 // If the element has a class name or if we're passed "false", 8952 // then remove the whole classname (if there was one, the above saved it). 8953 // Otherwise bring back whatever was previously saved (if anything), 8954 // falling back to the empty string if nothing was stored. 8955 jQuery.attr( this, "class", 8956 className || value === false ? 8957 "" : 8958 jQuery._data( this, "__className__" ) || "" 8959 ); 8960 } 8961 } ); 8962 }, 8963 8964 hasClass: function( selector ) { 8965 var className, elem, 8966 i = 0; 8967 8968 className = " " + selector + " "; 8969 while ( ( elem = this[ i++ ] ) ) { 8970 if ( elem.nodeType === 1 && 8971 ( " " + getClass( elem ) + " " ).replace( rclass, " " ) 8972 .indexOf( className ) > -1 8973 ) { 8974 return true; 8975 } 8976 } 8977 8978 return false; 8979 } 8980} ); 8981 8982 8983 8984 8985// Return jQuery for attributes-only inclusion 8986 8987 8988jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " + 8989 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 8990 "change select submit keydown keypress keyup error contextmenu" ).split( " " ), 8991 function( i, name ) { 8992 8993 // Handle event binding 8994 jQuery.fn[ name ] = function( data, fn ) { 8995 return arguments.length > 0 ? 8996 this.on( name, null, data, fn ) : 8997 this.trigger( name ); 8998 }; 8999} ); 9000 9001jQuery.fn.extend( { 9002 hover: function( fnOver, fnOut ) { 9003 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 9004 } 9005} ); 9006 9007 9008var location = window.location; 9009 9010var nonce = jQuery.now(); 9011 9012var rquery = ( /\?/ ); 9013 9014 9015 9016var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g; 9017 9018jQuery.parseJSON = function( data ) { 9019 9020 // Attempt to parse using the native JSON parser first 9021 if ( window.JSON && window.JSON.parse ) { 9022 9023 // Support: Android 2.3 9024 // Workaround failure to string-cast null input 9025 return window.JSON.parse( data + "" ); 9026 } 9027 9028 var requireNonComma, 9029 depth = null, 9030 str = jQuery.trim( data + "" ); 9031 9032 // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains 9033 // after removing valid tokens 9034 return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) { 9035 9036 // Force termination if we see a misplaced comma 9037 if ( requireNonComma && comma ) { 9038 depth = 0; 9039 } 9040 9041 // Perform no more replacements after returning to outermost depth 9042 if ( depth === 0 ) { 9043 return token; 9044 } 9045 9046 // Commas must not follow "[", "{", or "," 9047 requireNonComma = open || comma; 9048 9049 // Determine new depth 9050 // array/object open ("[" or "{"): depth += true - false (increment) 9051 // array/object close ("]" or "}"): depth += false - true (decrement) 9052 // other cases ("," or primitive): depth += true - true (numeric cast) 9053 depth += !close - !open; 9054 9055 // Remove this token 9056 return ""; 9057 } ) ) ? 9058 ( Function( "return " + str ) )() : 9059 jQuery.error( "Invalid JSON: " + data ); 9060}; 9061 9062 9063// Cross-browser xml parsing
vendor: 10,393 bytes, lines 9064-9469
9064jQuery.parseXML = function( data ) { 9065 var xml, tmp; 9066 if ( !data || typeof data !== "string" ) { 9067 return null; 9068 } 9069 try { 9070 if ( window.DOMParser ) { // Standard 9071 tmp = new window.DOMParser(); 9072 xml = tmp.parseFromString( data, "text/xml" ); 9073 } else { // IE 9074 xml = new window.ActiveXObject( "Microsoft.XMLDOM" ); 9075 xml.async = "false"; 9076 xml.loadXML( data ); 9077 } 9078 } catch ( e ) { 9079 xml = undefined; 9080 } 9081 if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { 9082 jQuery.error( "Invalid XML: " + data ); 9083 } 9084 return xml; 9085}; 9086 9087 9088var 9089 rhash = /#.*$/, 9090 rts = /([?&])_=[^&]*/, 9091 9092 // IE leaves an \r character at EOL 9093 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, 9094 9095 // #7653, #8125, #8152: local protocol detection 9096 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 9097 rnoContent = /^(?:GET|HEAD)$/, 9098 rprotocol = /^\/\//, 9099 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/, 9100 9101 /* Prefilters 9102 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 9103 * 2) These are called: 9104 * - BEFORE asking for a transport 9105 * - AFTER param serialization (s.data is a string if s.processData is true) 9106 * 3) key is the dataType 9107 * 4) the catchall symbol "*" can be used 9108 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 9109 */ 9110 prefilters = {}, 9111 9112 /* Transports bindings 9113 * 1) key is the dataType 9114 * 2) the catchall symbol "*" can be used 9115 * 3) selection will start with transport dataType and THEN go to "*" if needed 9116 */ 9117 transports = {}, 9118 9119 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 9120 allTypes = "*/".concat( "*" ), 9121 9122 // Document location 9123 ajaxLocation = location.href, 9124 9125 // Segment location into parts 9126 ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; 9127 9128// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 9129function addToPrefiltersOrTransports( structure ) { 9130 9131 // dataTypeExpression is optional and defaults to "*" 9132 return function( dataTypeExpression, func ) { 9133 9134 if ( typeof dataTypeExpression !== "string" ) { 9135 func = dataTypeExpression; 9136 dataTypeExpression = "*"; 9137 } 9138 9139 var dataType, 9140 i = 0, 9141 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; 9142 9143 if ( jQuery.isFunction( func ) ) { 9144 9145 // For each dataType in the dataTypeExpression 9146 while ( ( dataType = dataTypes[ i++ ] ) ) { 9147 9148 // Prepend if requested 9149 if ( dataType.charAt( 0 ) === "+" ) { 9150 dataType = dataType.slice( 1 ) || "*"; 9151 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 9152 9153 // Otherwise append 9154 } else { 9155 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 9156 } 9157 } 9158 } 9159 }; 9160} 9161 9162// Base inspection function for prefilters and transports 9163function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 9164 9165 var inspected = {}, 9166 seekingTransport = ( structure === transports ); 9167 9168 function inspect( dataType ) { 9169 var selected; 9170 inspected[ dataType ] = true; 9171 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 9172 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 9173 if ( typeof dataTypeOrTransport === "string" && 9174 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 9175 9176 options.dataTypes.unshift( dataTypeOrTransport ); 9177 inspect( dataTypeOrTransport ); 9178 return false; 9179 } else if ( seekingTransport ) { 9180 return !( selected = dataTypeOrTransport ); 9181 } 9182 } ); 9183 return selected; 9184 } 9185 9186 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 9187} 9188 9189// A special extend for ajax options 9190// that takes "flat" options (not to be deep extended) 9191// Fixes #9887 9192function ajaxExtend( target, src ) { 9193 var deep, key, 9194 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 9195 9196 for ( key in src ) { 9197 if ( src[ key ] !== undefined ) { 9198 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 9199 } 9200 } 9201 if ( deep ) { 9202 jQuery.extend( true, target, deep ); 9203 } 9204 9205 return target; 9206} 9207 9208/* Handles responses to an ajax request: 9209 * - finds the right dataType (mediates between content-type and expected dataType) 9210 * - returns the corresponding response 9211 */ 9212function ajaxHandleResponses( s, jqXHR, responses ) { 9213 var firstDataType, ct, finalDataType, type, 9214 contents = s.contents, 9215 dataTypes = s.dataTypes; 9216 9217 // Remove auto dataType and get content-type in the process 9218 while ( dataTypes[ 0 ] === "*" ) { 9219 dataTypes.shift(); 9220 if ( ct === undefined ) { 9221 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 9222 } 9223 } 9224 9225 // Check if we're dealing with a known content-type 9226 if ( ct ) { 9227 for ( type in contents ) { 9228 if ( contents[ type ] && contents[ type ].test( ct ) ) { 9229 dataTypes.unshift( type ); 9230 break; 9231 } 9232 } 9233 } 9234 9235 // Check to see if we have a response for the expected dataType 9236 if ( dataTypes[ 0 ] in responses ) { 9237 finalDataType = dataTypes[ 0 ]; 9238 } else { 9239 9240 // Try convertible dataTypes 9241 for ( type in responses ) { 9242 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 9243 finalDataType = type; 9244 break; 9245 } 9246 if ( !firstDataType ) { 9247 firstDataType = type; 9248 } 9249 } 9250 9251 // Or just use first one 9252 finalDataType = finalDataType || firstDataType; 9253 } 9254 9255 // If we found a dataType 9256 // We add the dataType to the list if needed 9257 // and return the corresponding response 9258 if ( finalDataType ) { 9259 if ( finalDataType !== dataTypes[ 0 ] ) { 9260 dataTypes.unshift( finalDataType ); 9261 } 9262 return responses[ finalDataType ]; 9263 } 9264} 9265 9266/* Chain conversions given the request and the original response 9267 * Also sets the responseXXX fields on the jqXHR instance 9268 */ 9269function ajaxConvert( s, response, jqXHR, isSuccess ) { 9270 var conv2, current, conv, tmp, prev, 9271 converters = {}, 9272 9273 // Work with a copy of dataTypes in case we need to modify it for conversion 9274 dataTypes = s.dataTypes.slice(); 9275 9276 // Create converters map with lowercased keys 9277 if ( dataTypes[ 1 ] ) { 9278 for ( conv in s.converters ) { 9279 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 9280 } 9281 } 9282 9283 current = dataTypes.shift(); 9284 9285 // Convert to each sequential dataType 9286 while ( current ) { 9287 9288 if ( s.responseFields[ current ] ) { 9289 jqXHR[ s.responseFields[ current ] ] = response; 9290 } 9291 9292 // Apply the dataFilter if provided 9293 if ( !prev && isSuccess && s.dataFilter ) { 9294 response = s.dataFilter( response, s.dataType ); 9295 } 9296 9297 prev = current; 9298 current = dataTypes.shift(); 9299 9300 if ( current ) { 9301 9302 // There's only work to do if current dataType is non-auto 9303 if ( current === "*" ) { 9304 9305 current = prev; 9306 9307 // Convert response if prev dataType is non-auto and differs from current 9308 } else if ( prev !== "*" && prev !== current ) { 9309 9310 // Seek a direct converter 9311 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 9312 9313 // If none found, seek a pair 9314 if ( !conv ) { 9315 for ( conv2 in converters ) { 9316 9317 // If conv2 outputs current 9318 tmp = conv2.split( " " ); 9319 if ( tmp[ 1 ] === current ) { 9320 9321 // If prev can be converted to accepted input 9322 conv = converters[ prev + " " + tmp[ 0 ] ] || 9323 converters[ "* " + tmp[ 0 ] ]; 9324 if ( conv ) { 9325 9326 // Condense equivalence converters 9327 if ( conv === true ) { 9328 conv = converters[ conv2 ]; 9329 9330 // Otherwise, insert the intermediate dataType 9331 } else if ( converters[ conv2 ] !== true ) { 9332 current = tmp[ 0 ]; 9333 dataTypes.unshift( tmp[ 1 ] ); 9334 } 9335 break; 9336 } 9337 } 9338 } 9339 } 9340 9341 // Apply converter (if not an equivalence) 9342 if ( conv !== true ) { 9343 9344 // Unless errors are allowed to bubble, catch and return them 9345 if ( conv && s[ "throws" ] ) { // jscs:ignore requireDotNotation 9346 response = conv( response ); 9347 } else { 9348 try { 9349 response = conv( response ); 9350 } catch ( e ) { 9351 return { 9352 state: "parsererror", 9353 error: conv ? e : "No conversion from " + prev + " to " + current 9354 }; 9355 } 9356 } 9357 } 9358 } 9359 } 9360 } 9361 9362 return { state: "success", data: response }; 9363} 9364 9365jQuery.extend( { 9366 9367 // Counter for holding the number of active queries 9368 active: 0, 9369 9370 // Last-Modified header cache for next request 9371 lastModified: {}, 9372 etag: {}, 9373 9374 ajaxSettings: { 9375 url: ajaxLocation, 9376 type: "GET", 9377 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), 9378 global: true, 9379 processData: true, 9380 async: true, 9381 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9382 /* 9383 timeout: 0, 9384 data: null, 9385 dataType: null, 9386 username: null, 9387 password: null, 9388 cache: null, 9389 throws: false, 9390 traditional: false, 9391 headers: {}, 9392 */ 9393 9394 accepts: { 9395 "*": allTypes, 9396 text: "text/plain", 9397 html: "text/html", 9398 xml: "application/xml, text/xml", 9399 json: "application/json, text/javascript" 9400 }, 9401 9402 contents: { 9403 xml: /\bxml\b/, 9404 html: /\bhtml/, 9405 json: /\bjson\b/ 9406 }, 9407 9408 responseFields: { 9409 xml: "responseXML", 9410 text: "responseText", 9411 json: "responseJSON" 9412 }, 9413 9414 // Data converters 9415 // Keys separate source (or catchall "*") and destination types with a single space 9416 converters: { 9417 9418 // Convert anything to text 9419 "* text": String, 9420 9421 // Text to html (true = no transformation) 9422 "text html": true, 9423 9424 // Evaluate text as a json expression 9425 "text json": jQuery.parseJSON, 9426 9427 // Parse text as xml 9428 "text xml": jQuery.parseXML 9429 }, 9430 9431 // For options that shouldn't be deep extended: 9432 // you can add your own custom options here if 9433 // and when you create one that shouldn't be 9434 // deep extended (see ajaxExtend) 9435 flatOptions: { 9436 url: true, 9437 context: true 9438 } 9439 }, 9440 9441 // Creates a full fledged settings object into target 9442 // with both ajaxSettings and settings fields. 9443 // If target is omitted, writes into ajaxSettings. 9444 ajaxSetup: function( target, settings ) { 9445 return settings ? 9446 9447 // Building a settings object 9448 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 9449 9450 // Extending ajaxSettings 9451 ajaxExtend( jQuery.ajaxSettings, target ); 9452 }, 9453 9454 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 9455 ajaxTransport: addToPrefiltersOrTransports( transports ), 9456 9457 // Main method 9458 ajax: function( url, options ) { 9459 9460 // If url is an object, simulate pre-1.5 signature 9461 if ( typeof url === "object" ) { 9462 options = url; 9463 url = undefined; 9464 } 9465 9466 // Force options to be an object 9467 options = options || {}; 9468 9469 var
vendor: 5,146 bytes, lines 9470-9660
9470 9471 // Cross-domain detection vars 9472 parts, 9473 9474 // Loop variable 9475 i, 9476 9477 // URL without anti-cache param 9478 cacheURL, 9479 9480 // Response headers as string 9481 responseHeadersString, 9482 9483 // timeout handle 9484 timeoutTimer, 9485 9486 // To know if global events are to be dispatched 9487 fireGlobals, 9488 9489 transport, 9490 9491 // Response headers 9492 responseHeaders, 9493 9494 // Create the final options object 9495 s = jQuery.ajaxSetup( {}, options ), 9496 9497 // Callbacks context 9498 callbackContext = s.context || s, 9499 9500 // Context for global events is callbackContext if it is a DOM node or jQuery collection 9501 globalEventContext = s.context && 9502 ( callbackContext.nodeType || callbackContext.jquery ) ? 9503 jQuery( callbackContext ) : 9504 jQuery.event, 9505 9506 // Deferreds 9507 deferred = jQuery.Deferred(), 9508 completeDeferred = jQuery.Callbacks( "once memory" ), 9509 9510 // Status-dependent callbacks 9511 statusCode = s.statusCode || {}, 9512 9513 // Headers (they are sent all at once) 9514 requestHeaders = {}, 9515 requestHeadersNames = {}, 9516 9517 // The jqXHR state 9518 state = 0, 9519 9520 // Default abort message 9521 strAbort = "canceled", 9522 9523 // Fake xhr 9524 jqXHR = { 9525 readyState: 0, 9526 9527 // Builds headers hashtable if needed 9528 getResponseHeader: function( key ) { 9529 var match; 9530 if ( state === 2 ) { 9531 if ( !responseHeaders ) { 9532 responseHeaders = {}; 9533 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 9534 responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; 9535 } 9536 } 9537 match = responseHeaders[ key.toLowerCase() ]; 9538 } 9539 return match == null ? null : match; 9540 }, 9541 9542 // Raw string 9543 getAllResponseHeaders: function() { 9544 return state === 2 ? responseHeadersString : null; 9545 }, 9546 9547 // Caches the header 9548 setRequestHeader: function( name, value ) { 9549 var lname = name.toLowerCase(); 9550 if ( !state ) { 9551 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; 9552 requestHeaders[ name ] = value; 9553 } 9554 return this; 9555 }, 9556 9557 // Overrides response content-type header 9558 overrideMimeType: function( type ) { 9559 if ( !state ) { 9560 s.mimeType = type; 9561 } 9562 return this; 9563 }, 9564 9565 // Status-dependent callbacks 9566 statusCode: function( map ) { 9567 var code; 9568 if ( map ) { 9569 if ( state < 2 ) { 9570 for ( code in map ) { 9571 9572 // Lazy-add the new callback in a way that preserves old ones 9573 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 9574 } 9575 } else { 9576 9577 // Execute the appropriate callbacks 9578 jqXHR.always( map[ jqXHR.status ] ); 9579 } 9580 } 9581 return this; 9582 }, 9583 9584 // Cancel the request 9585 abort: function( statusText ) { 9586 var finalText = statusText || strAbort; 9587 if ( transport ) { 9588 transport.abort( finalText ); 9589 } 9590 done( 0, finalText ); 9591 return this; 9592 } 9593 }; 9594 9595 // Attach deferreds 9596 deferred.promise( jqXHR ).complete = completeDeferred.add; 9597 jqXHR.success = jqXHR.done; 9598 jqXHR.error = jqXHR.fail; 9599 9600 // Remove hash character (#7531: and string promotion) 9601 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) 9602 // Handle falsy url in the settings object (#10093: consistency with old signature) 9603 // We also use the url parameter if available 9604 s.url = ( ( url || s.url || ajaxLocation ) + "" ) 9605 .replace( rhash, "" ) 9606 .replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); 9607 9608 // Alias method option to type as per ticket #12004 9609 s.type = options.method || options.type || s.method || s.type; 9610 9611 // Extract dataTypes list 9612 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; 9613 9614 // A cross-domain request is in order when we have a protocol:host:port mismatch 9615 if ( s.crossDomain == null ) { 9616 parts = rurl.exec( s.url.toLowerCase() ); 9617 s.crossDomain = !!( parts && 9618 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || 9619 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !== 9620 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) ) 9621 ); 9622 } 9623 9624 // Convert data if not already a string 9625 if ( s.data && s.processData && typeof s.data !== "string" ) { 9626 s.data = jQuery.param( s.data, s.traditional ); 9627 } 9628 9629 // Apply prefilters 9630 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 9631 9632 // If request was aborted inside a prefilter, stop there 9633 if ( state === 2 ) { 9634 return jqXHR; 9635 } 9636 9637 // We can fire global events as of now if asked to 9638 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 9639 fireGlobals = jQuery.event && s.global; 9640 9641 // Watch for a new set of requests 9642 if ( fireGlobals && jQuery.active++ === 0 ) { 9643 jQuery.event.trigger( "ajaxStart" ); 9644 } 9645 9646 // Uppercase the type 9647 s.type = s.type.toUpperCase(); 9648 9649 // Determine if request has content 9650 s.hasContent = !rnoContent.test( s.type ); 9651 9652 // Save the URL in case we're toying with the If-Modified-Since 9653 // and/or If-None-Match header later on 9654 cacheURL = s.url; 9655 9656 // More options handling for requests with no content 9657 if ( !s.hasContent ) { 9658 9659 // If data is available, append data to url 9660 if ( s.data ) {
vendor: 8,244 bytes, lines 9661-10000
9661 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); 9662 9663 // #9682: remove data so that it's not used in an eventual retry 9664 delete s.data; 9665 } 9666 9667 // Add anti-cache in url if needed 9668 if ( s.cache === false ) { 9669 s.url = rts.test( cacheURL ) ? 9670 9671 // If there is already a '_' parameter, set its value 9672 cacheURL.replace( rts, "$1_=" + nonce++ ) : 9673 9674 // Otherwise add one to the end 9675 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++; 9676 } 9677 } 9678 9679 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9680 if ( s.ifModified ) { 9681 if ( jQuery.lastModified[ cacheURL ] ) { 9682 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 9683 } 9684 if ( jQuery.etag[ cacheURL ] ) { 9685 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 9686 } 9687 } 9688 9689 // Set the correct header, if data is being sent 9690 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 9691 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 9692 } 9693 9694 // Set the Accepts header for the server, depending on the dataType 9695 jqXHR.setRequestHeader( 9696 "Accept", 9697 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 9698 s.accepts[ s.dataTypes[ 0 ] ] + 9699 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9700 s.accepts[ "*" ] 9701 ); 9702 9703 // Check for headers option 9704 for ( i in s.headers ) { 9705 jqXHR.setRequestHeader( i, s.headers[ i ] ); 9706 } 9707 9708 // Allow custom headers/mimetypes and early abort 9709 if ( s.beforeSend && 9710 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { 9711 9712 // Abort if not done already and return 9713 return jqXHR.abort(); 9714 } 9715 9716 // aborting is no longer a cancellation 9717 strAbort = "abort"; 9718 9719 // Install callbacks on deferreds 9720 for ( i in { success: 1, error: 1, complete: 1 } ) { 9721 jqXHR[ i ]( s[ i ] ); 9722 } 9723 9724 // Get transport 9725 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 9726 9727 // If no transport, we auto-abort 9728 if ( !transport ) { 9729 done( -1, "No Transport" ); 9730 } else { 9731 jqXHR.readyState = 1; 9732 9733 // Send global event 9734 if ( fireGlobals ) { 9735 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 9736 } 9737 9738 // If request was aborted inside ajaxSend, stop there 9739 if ( state === 2 ) { 9740 return jqXHR; 9741 } 9742 9743 // Timeout 9744 if ( s.async && s.timeout > 0 ) { 9745 timeoutTimer = window.setTimeout( function() { 9746 jqXHR.abort( "timeout" ); 9747 }, s.timeout ); 9748 } 9749 9750 try { 9751 state = 1; 9752 transport.send( requestHeaders, done ); 9753 } catch ( e ) { 9754 9755 // Propagate exception as error if not done 9756 if ( state < 2 ) { 9757 done( -1, e ); 9758 9759 // Simply rethrow otherwise 9760 } else { 9761 throw e; 9762 } 9763 } 9764 } 9765 9766 // Callback for when everything is done 9767 function done( status, nativeStatusText, responses, headers ) { 9768 var isSuccess, success, error, response, modified, 9769 statusText = nativeStatusText; 9770 9771 // Called once 9772 if ( state === 2 ) { 9773 return; 9774 } 9775 9776 // State is "done" now 9777 state = 2; 9778 9779 // Clear timeout if it exists 9780 if ( timeoutTimer ) { 9781 window.clearTimeout( timeoutTimer ); 9782 } 9783 9784 // Dereference transport for early garbage collection 9785 // (no matter how long the jqXHR object will be used) 9786 transport = undefined; 9787 9788 // Cache response headers 9789 responseHeadersString = headers || ""; 9790 9791 // Set readyState 9792 jqXHR.readyState = status > 0 ? 4 : 0; 9793 9794 // Determine if successful 9795 isSuccess = status >= 200 && status < 300 || status === 304; 9796 9797 // Get response data 9798 if ( responses ) { 9799 response = ajaxHandleResponses( s, jqXHR, responses ); 9800 } 9801 9802 // Convert no matter what (that way responseXXX fields are always set) 9803 response = ajaxConvert( s, response, jqXHR, isSuccess ); 9804 9805 // If successful, handle type chaining 9806 if ( isSuccess ) { 9807 9808 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9809 if ( s.ifModified ) { 9810 modified = jqXHR.getResponseHeader( "Last-Modified" ); 9811 if ( modified ) { 9812 jQuery.lastModified[ cacheURL ] = modified; 9813 } 9814 modified = jqXHR.getResponseHeader( "etag" ); 9815 if ( modified ) { 9816 jQuery.etag[ cacheURL ] = modified; 9817 } 9818 } 9819 9820 // if no content 9821 if ( status === 204 || s.type === "HEAD" ) { 9822 statusText = "nocontent"; 9823 9824 // if not modified 9825 } else if ( status === 304 ) { 9826 statusText = "notmodified"; 9827 9828 // If we have data, let's convert it 9829 } else { 9830 statusText = response.state; 9831 success = response.data; 9832 error = response.error; 9833 isSuccess = !error; 9834 } 9835 } else { 9836 9837 // We extract error from statusText 9838 // then normalize statusText and status for non-aborts 9839 error = statusText; 9840 if ( status || !statusText ) { 9841 statusText = "error"; 9842 if ( status < 0 ) { 9843 status = 0; 9844 } 9845 } 9846 } 9847 9848 // Set data for the fake xhr object 9849 jqXHR.status = status; 9850 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9851 9852 // Success/Error 9853 if ( isSuccess ) { 9854 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 9855 } else { 9856 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 9857 } 9858 9859 // Status-dependent callbacks 9860 jqXHR.statusCode( statusCode ); 9861 statusCode = undefined; 9862 9863 if ( fireGlobals ) { 9864 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 9865 [ jqXHR, s, isSuccess ? success : error ] ); 9866 } 9867 9868 // Complete 9869 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 9870 9871 if ( fireGlobals ) { 9872 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 9873 9874 // Handle the global AJAX counter 9875 if ( !( --jQuery.active ) ) { 9876 jQuery.event.trigger( "ajaxStop" ); 9877 } 9878 } 9879 } 9880 9881 return jqXHR; 9882 }, 9883 9884 getJSON: function( url, data, callback ) { 9885 return jQuery.get( url, data, callback, "json" ); 9886 }, 9887 9888 getScript: function( url, callback ) { 9889 return jQuery.get( url, undefined, callback, "script" ); 9890 } 9891} ); 9892 9893jQuery.each( [ "get", "post" ], function( i, method ) { 9894 jQuery[ method ] = function( url, data, callback, type ) { 9895 9896 // shift arguments if data argument was omitted 9897 if ( jQuery.isFunction( data ) ) { 9898 type = type || callback; 9899 callback = data; 9900 data = undefined; 9901 } 9902 9903 // The url can be an options object (which then must have .url) 9904 return jQuery.ajax( jQuery.extend( { 9905 url: url, 9906 type: method, 9907 dataType: type, 9908 data: data, 9909 success: callback 9910 }, jQuery.isPlainObject( url ) && url ) ); 9911 }; 9912} ); 9913 9914 9915jQuery._evalUrl = function( url ) { 9916 return jQuery.ajax( { 9917 url: url, 9918 9919 // Make this explicit, since user can override this through ajaxSetup (#11264) 9920 type: "GET", 9921 dataType: "script", 9922 cache: true, 9923 async: false, 9924 global: false, 9925 "throws": true 9926 } ); 9927}; 9928 9929 9930jQuery.fn.extend( { 9931 wrapAll: function( html ) { 9932 if ( jQuery.isFunction( html ) ) { 9933 return this.each( function( i ) { 9934 jQuery( this ).wrapAll( html.call( this, i ) ); 9935 } ); 9936 } 9937 9938 if ( this[ 0 ] ) { 9939 9940 // The elements to wrap the target around 9941 var wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 9942 9943 if ( this[ 0 ].parentNode ) { 9944 wrap.insertBefore( this[ 0 ] ); 9945 } 9946 9947 wrap.map( function() { 9948 var elem = this; 9949 9950 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { 9951 elem = elem.firstChild; 9952 } 9953 9954 return elem; 9955 } ).append( this ); 9956 } 9957 9958 return this; 9959 }, 9960 9961 wrapInner: function( html ) { 9962 if ( jQuery.isFunction( html ) ) { 9963 return this.each( function( i ) { 9964 jQuery( this ).wrapInner( html.call( this, i ) ); 9965 } ); 9966 } 9967 9968 return this.each( function() { 9969 var self = jQuery( this ), 9970 contents = self.contents(); 9971 9972 if ( contents.length ) { 9973 contents.wrapAll( html ); 9974 9975 } else { 9976 self.append( html ); 9977 } 9978 } ); 9979 }, 9980 9981 wrap: function( html ) { 9982 var isFunction = jQuery.isFunction( html ); 9983 9984 return this.each( function( i ) { 9985 jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); 9986 } ); 9987 }, 9988 9989 unwrap: function() { 9990 return this.parent().each( function() { 9991 if ( !jQuery.nodeName( this, "body" ) ) { 9992 jQuery( this ).replaceWith( this.childNodes ); 9993 } 9994 } ).end(); 9995 } 9996} ); 9997 9998 9999function getDisplay( elem ) { 10000 return elem.style && elem.style.display || jQuery.css( elem, "dis
10000play" ); 10001} 10002 10003function filterHidden( elem ) { 10004 while ( elem && elem.nodeType === 1 ) { 10005 if ( getDisplay( elem ) === "none" || elem.type === "hidden" ) { 10006 return true; 10007 } 10008 elem = elem.parentNode; 10009 } 10010 return false; 10011} 10012 10013jQuery.expr.filters.hidden = function( elem ) { 10014 10015 // Support: Opera <= 12.12 10016 // Opera reports offsetWidths and offsetHeights less than zero on some elements 10017 return support.reliableHiddenOffsets() ? 10018 ( elem.offsetWidth <= 0 && elem.offsetHeight <= 0 && 10019 !elem.getClientRects().length ) : 10020 filterHidden( elem ); 10021}; 10022 10023jQuery.expr.filters.visible = function( elem ) { 10024 return !jQuery.expr.filters.hidden( elem ); 10025}; 10026 10027 10028 10029 10030var r20 = /%20/g, 10031 rbracket = /\[\]$/, 10032 rCRLF = /\r?\n/g, 10033 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 10034 rsubmittable = /^(?:input|select|textarea|keygen)/i; 10035 10036function buildParams( prefix, obj, traditional, add ) { 10037 var name; 10038 10039 if ( jQuery.isArray( obj ) ) { 10040 10041 // Serialize array item. 10042 jQuery.each( obj, function( i, v ) { 10043 if ( traditional || rbracket.test( prefix ) ) { 10044 10045 // Treat each array item as a scalar. 10046 add( prefix, v ); 10047 10048 } else { 10049 10050 // Item is non-scalar (array or object), encode its numeric index. 10051 buildParams( 10052 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 10053 v, 10054 traditional, 10055 add 10056 ); 10057 } 10058 } ); 10059 10060 } else if ( !traditional && jQuery.type( obj ) === "object" ) { 10061 10062 // Serialize object item. 10063 for ( name in obj ) { 10064 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 10065 } 10066 10067 } else { 10068 10069 // Serialize scalar item. 10070 add( prefix, obj ); 10071 } 10072} 10073 10074// Serialize an array of form elements or a set of 10075// key/values into a query string 10076jQuery.param = function( a, traditional ) { 10077 var prefix, 10078 s = [], 10079 add = function( key, value ) { 10080 10081 // If value is a function, invoke it and return its value 10082 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); 10083 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); 10084 }; 10085 10086 // Set traditional to true for jQuery <= 1.3.2 behavior. 10087 if ( traditional === undefined ) { 10088 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; 10089 } 10090 10091 // If an array was passed in, assume that it is an array of form elements. 10092 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 10093 10094 // Serialize the form elements 10095 jQuery.each( a, function() { 10096 add( this.name, this.value ); 10097 } ); 10098 10099 } else { 10100 10101 // If traditional, encode the "old" way (the way 1.3.2 or older 10102 // did it), otherwise encode params recursively. 10103 for ( prefix in a ) { 10104 buildParams( prefix, a[ prefix ], traditional, add ); 10105 } 10106 } 10107 10108 // Return the resulting serialization 10109 return s.join( "&" ).replace( r20, "+" ); 10110}; 10111 10112jQuery.fn.extend( { 10113 serialize: function() { 10114 return jQuery.param( this.serializeArray() ); 10115 }, 10116 serializeArray: function() { 10117 return this.map( function() { 10118 10119 // Can add propHook for "elements" to filter or add form elements 10120 var elements = jQuery.prop( this, "elements" ); 10121 return elements ? jQuery.makeArray( elements ) : this; 10122 } ) 10123 .filter( function() { 10124 var type = this.type; 10125 10126 // Use .is(":disabled") so that fieldset[disabled] works 10127 return this.name && !jQuery( this ).is( ":disabled" ) && 10128 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 10129 ( this.checked || !rcheckableType.test( type ) ); 10130 } ) 10131 .map( function( i, elem ) { 10132 var val = jQuery( this ).val(); 10133 10134 return val == null ? 10135 null : 10136 jQuery.isArray( val ) ? 10137 jQuery.map( val, function( val ) { 10138 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 10139 } ) : 10140 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 10141 } ).get(); 10142 } 10143} ); 10144 10145 10146// Create the request object 10147// (This is still attached to ajaxSettings for backward compatibility) 10148jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? 10149 10150 // Support: IE6-IE8 10151 function() { 10152 10153 // XHR cannot access local files, always use ActiveX for that case 10154 if ( this.isLocal ) { 10155 return createActiveXHR(); 10156 } 10157 10158 // Support: IE 9-11 10159 // IE seems to error on cross-domain PATCH requests when ActiveX XHR 10160 // is used. In IE 9+ always use the native XHR. 10161 // Note: this condition won't catch Edge as it doesn't define 10162 // document.documentMode but it also doesn't support ActiveX so it won't 10163 // reach this code. 10164 if ( document.documentMode > 8 ) { 10165 return createStandardXHR(); 10166 } 10167
vendor: 22,188 bytes, lines 10168-10978
10168 // Support: IE<9 10169 // oldIE XHR does not support non-RFC2616 methods (#13240) 10170 // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx 10171 // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9 10172 // Although this check for six methods instead of eight 10173 // since IE also does not support "trace" and "connect" 10174 return /^(get|post|head|put|delete|options)$/i.test( this.type ) && 10175 createStandardXHR() || createActiveXHR(); 10176 } : 10177 10178 // For all other browsers, use the standard XMLHttpRequest object 10179 createStandardXHR; 10180 10181var xhrId = 0, 10182 xhrCallbacks = {}, 10183 xhrSupported = jQuery.ajaxSettings.xhr(); 10184 10185// Support: IE<10 10186// Open requests must be manually aborted on unload (#5280) 10187// See https://support.microsoft.com/kb/2856746 for more info 10188if ( window.attachEvent ) { 10189 window.attachEvent( "onunload", function() { 10190 for ( var key in xhrCallbacks ) { 10191 xhrCallbacks[ key ]( undefined, true ); 10192 } 10193 } ); 10194} 10195 10196// Determine support properties 10197support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 10198xhrSupported = support.ajax = !!xhrSupported; 10199 10200// Create transport if the browser can provide an xhr 10201if ( xhrSupported ) { 10202 10203 jQuery.ajaxTransport( function( options ) { 10204 10205 // Cross domain only allowed if supported through XMLHttpRequest 10206 if ( !options.crossDomain || support.cors ) { 10207 10208 var callback; 10209 10210 return { 10211 send: function( headers, complete ) { 10212 var i, 10213 xhr = options.xhr(), 10214 id = ++xhrId; 10215 10216 // Open the socket 10217 xhr.open( 10218 options.type, 10219 options.url, 10220 options.async, 10221 options.username, 10222 options.password 10223 ); 10224 10225 // Apply custom fields if provided 10226 if ( options.xhrFields ) { 10227 for ( i in options.xhrFields ) { 10228 xhr[ i ] = options.xhrFields[ i ]; 10229 } 10230 } 10231 10232 // Override mime type if needed 10233 if ( options.mimeType && xhr.overrideMimeType ) { 10234 xhr.overrideMimeType( options.mimeType ); 10235 } 10236 10237 // X-Requested-With header 10238 // For cross-domain requests, seeing as conditions for a preflight are 10239 // akin to a jigsaw puzzle, we simply never set it to be sure. 10240 // (it can always be set on a per-request basis or even using ajaxSetup) 10241 // For same-domain requests, won't change header if already provided. 10242 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 10243 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 10244 } 10245 10246 // Set headers 10247 for ( i in headers ) { 10248 10249 // Support: IE<9 10250 // IE's ActiveXObject throws a 'Type Mismatch' exception when setting 10251 // request header to a null-value. 10252 // 10253 // To keep consistent with other XHR implementations, cast the value 10254 // to string and ignore `undefined`. 10255 if ( headers[ i ] !== undefined ) { 10256 xhr.setRequestHeader( i, headers[ i ] + "" ); 10257 } 10258 } 10259 10260 // Do send the request 10261 // This may raise an exception which is actually 10262 // handled in jQuery.ajax (so no try/catch here) 10263 xhr.send( ( options.hasContent && options.data ) || null ); 10264 10265 // Listener 10266 callback = function( _, isAbort ) { 10267 var status, statusText, responses; 10268 10269 // Was never called and is aborted or complete 10270 if ( callback && ( isAbort || xhr.readyState === 4 ) ) { 10271 10272 // Clean up 10273 delete xhrCallbacks[ id ]; 10274 callback = undefined; 10275 xhr.onreadystatechange = jQuery.noop; 10276 10277 // Abort manually if needed 10278 if ( isAbort ) { 10279 if ( xhr.readyState !== 4 ) { 10280 xhr.abort(); 10281 } 10282 } else { 10283 responses = {}; 10284 status = xhr.status; 10285 10286 // Support: IE<10 10287 // Accessing binary-data responseText throws an exception 10288 // (#11426) 10289 if ( typeof xhr.responseText === "string" ) { 10290 responses.text = xhr.responseText; 10291 } 10292 10293 // Firefox throws an exception when accessing 10294 // statusText for faulty cross-domain requests 10295 try { 10296 statusText = xhr.statusText; 10297 } catch ( e ) { 10298 10299 // We normalize with Webkit giving an empty statusText 10300 statusText = ""; 10301 } 10302 10303 // Filter status for non standard behaviors 10304 10305 // If the request is local and we have data: assume a success 10306 // (success with no data won't get notified, that's the best we 10307 // can do given current implementations) 10308 if ( !status && options.isLocal && !options.crossDomain ) { 10309 status = responses.text ? 200 : 404; 10310 10311 // IE - #1450: sometimes returns 1223 when it should be 204 10312 } else if ( status === 1223 ) { 10313 status = 204; 10314 } 10315 } 10316 } 10317 10318 // Call complete if needed 10319 if ( responses ) { 10320 complete( status, statusText, responses, xhr.getAllResponseHeaders() ); 10321 } 10322 }; 10323 10324 // Do send the request 10325 // `xhr.send` may raise an exception, but it will be 10326 // handled in jQuery.ajax (so no try/catch here) 10327 if ( !options.async ) { 10328 10329 // If we're in sync mode we fire the callback 10330 callback(); 10331 } else if ( xhr.readyState === 4 ) { 10332 10333 // (IE6 & IE7) if it's in cache and has been 10334 // retrieved directly we need to fire the callback 10335 window.setTimeout( callback ); 10336 } else { 10337 10338 // Register the callback, but delay it in case `xhr.send` throws 10339 // Add to the list of active xhr callbacks 10340 xhr.onreadystatechange = xhrCallbacks[ id ] = callback; 10341 } 10342 }, 10343 10344 abort: function() { 10345 if ( callback ) { 10346 callback( undefined, true ); 10347 } 10348 } 10349 }; 10350 } 10351 } ); 10352} 10353 10354// Functions to create xhrs 10355function createStandardXHR() { 10356 try { 10357 return new window.XMLHttpRequest(); 10358 } catch ( e ) {} 10359} 10360 10361function createActiveXHR() { 10362 try { 10363 return new window.ActiveXObject( "Microsoft.XMLHTTP" ); 10364 } catch ( e ) {} 10365} 10366 10367 10368 10369 10370// Install script dataType 10371jQuery.ajaxSetup( { 10372 accepts: { 10373 script: "text/javascript, application/javascript, " + 10374 "application/ecmascript, application/x-ecmascript" 10375 }, 10376 contents: { 10377 script: /\b(?:java|ecma)script\b/ 10378 }, 10379 converters: { 10380 "text script": function( text ) { 10381 jQuery.globalEval( text ); 10382 return text; 10383 } 10384 } 10385} ); 10386 10387// Handle cache's special case and global 10388jQuery.ajaxPrefilter( "script", function( s ) { 10389 if ( s.cache === undefined ) { 10390 s.cache = false; 10391 } 10392 if ( s.crossDomain ) { 10393 s.type = "GET"; 10394 s.global = false; 10395 } 10396} ); 10397 10398// Bind script tag hack transport 10399jQuery.ajaxTransport( "script", function( s ) { 10400 10401 // This transport only deals with cross domain requests 10402 if ( s.crossDomain ) { 10403 10404 var script, 10405 head = document.head || jQuery( "head" )[ 0 ] || document.documentElement; 10406 10407 return { 10408 10409 send: function( _, callback ) { 10410 10411 script = document.createElement( "script" ); 10412 10413 script.async = true; 10414 10415 if ( s.scriptCharset ) { 10416 script.charset = s.scriptCharset; 10417 } 10418 10419 script.src = s.url; 10420 10421 // Attach handlers for all browsers 10422 script.onload = script.onreadystatechange = function( _, isAbort ) { 10423 10424 if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { 10425 10426 // Handle memory leak in IE 10427 script.onload = script.onreadystatechange = null; 10428 10429 // Remove the script 10430 if ( script.parentNode ) { 10431 script.parentNode.removeChild( script ); 10432 } 10433 10434 // Dereference the script 10435 script = null; 10436 10437 // Callback if not abort 10438 if ( !isAbort ) { 10439 callback( 200, "success" ); 10440 } 10441 } 10442 }; 10443 10444 // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending 10445 // Use native DOM manipulation to avoid our domManip AJAX trickery 10446 head.insertBefore( script, head.firstChild ); 10447 }, 10448 10449 abort: function() { 10450 if ( script ) { 10451 script.onload( undefined, true ); 10452 } 10453 } 10454 }; 10455 } 10456} ); 10457 10458 10459 10460 10461var oldCallbacks = [], 10462 rjsonp = /(=)\?(?=&|$)|\?\?/; 10463 10464// Default jsonp settings 10465jQuery.ajaxSetup( { 10466 jsonp: "callback", 10467 jsonpCallback: function() { 10468 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); 10469 this[ callback ] = true; 10470 return callback; 10471 } 10472} ); 10473 10474// Detect, normalize options and install callbacks for jsonp requests 10475jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 10476 10477 var callbackName, overwritten, responseContainer, 10478 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 10479 "url" : 10480 typeof s.data === "string" && 10481 ( s.contentType || "" ) 10482 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 10483 rjsonp.test( s.data ) && "data" 10484 ); 10485 10486 // Handle iff the expected data type is "jsonp" or we have a parameter to set 10487 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 10488 10489 // Get callback name, remembering preexisting value associated with it 10490 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? 10491 s.jsonpCallback() : 10492 s.jsonpCallback; 10493 10494 // Insert callback into url or form data 10495 if ( jsonProp ) { 10496 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 10497 } else if ( s.jsonp !== false ) { 10498 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 10499 } 10500 10501 // Use data converter to retrieve json after script execution 10502 s.converters[ "script json" ] = function() { 10503 if ( !responseContainer ) { 10504 jQuery.error( callbackName + " was not called" ); 10505 } 10506 return responseContainer[ 0 ]; 10507 }; 10508 10509 // force json dataType 10510 s.dataTypes[ 0 ] = "json"; 10511 10512 // Install callback 10513 overwritten = window[ callbackName ]; 10514 window[ callbackName ] = function() { 10515 responseContainer = arguments; 10516 }; 10517 10518 // Clean-up function (fires after converters) 10519 jqXHR.always( function() { 10520 10521 // If previous value didn't exist - remove it 10522 if ( overwritten === undefined ) { 10523 jQuery( window ).removeProp( callbackName ); 10524 10525 // Otherwise restore preexisting value 10526 } else { 10527 window[ callbackName ] = overwritten; 10528 } 10529 10530 // Save back as free 10531 if ( s[ callbackName ] ) { 10532 10533 // make sure that re-using the options doesn't screw things around 10534 s.jsonpCallback = originalSettings.jsonpCallback; 10535 10536 // save the callback name for future use 10537 oldCallbacks.push( callbackName ); 10538 } 10539 10540 // Call if it was a function and we have a response 10541 if ( responseContainer && jQuery.isFunction( overwritten ) ) { 10542 overwritten( responseContainer[ 0 ] ); 10543 } 10544 10545 responseContainer = overwritten = undefined; 10546 } ); 10547 10548 // Delegate to script 10549 return "script"; 10550 } 10551} ); 10552 10553 10554 10555 10556// data: string of html 10557// context (optional): If specified, the fragment will be created in this context, 10558// defaults to document 10559// keepScripts (optional): If true, will include scripts passed in the html string 10560jQuery.parseHTML = function( data, context, keepScripts ) { 10561 if ( !data || typeof data !== "string" ) { 10562 return null; 10563 } 10564 if ( typeof context === "boolean" ) { 10565 keepScripts = context; 10566 context = false; 10567 } 10568 context = context || document; 10569 10570 var parsed = rsingleTag.exec( data ), 10571 scripts = !keepScripts && []; 10572 10573 // Single tag 10574 if ( parsed ) { 10575 return [ context.createElement( parsed[ 1 ] ) ]; 10576 } 10577 10578 parsed = buildFragment( [ data ], context, scripts ); 10579 10580 if ( scripts && scripts.length ) { 10581 jQuery( scripts ).remove(); 10582 } 10583 10584 return jQuery.merge( [], parsed.childNodes ); 10585}; 10586 10587 10588// Keep a copy of the old load method 10589var _load = jQuery.fn.load; 10590 10591/** 10592 * Load a url into a page 10593 */ 10594jQuery.fn.load = function( url, params, callback ) { 10595 if ( typeof url !== "string" && _load ) { 10596 return _load.apply( this, arguments ); 10597 } 10598 10599 var selector, type, response, 10600 self = this, 10601 off = url.indexOf( " " ); 10602 10603 if ( off > -1 ) { 10604 selector = jQuery.trim( url.slice( off, url.length ) ); 10605 url = url.slice( 0, off ); 10606 } 10607 10608 // If it's a function 10609 if ( jQuery.isFunction( params ) ) { 10610 10611 // We assume that it's the callback 10612 callback = params; 10613 params = undefined; 10614 10615 // Otherwise, build a param string 10616 } else if ( params && typeof params === "object" ) { 10617 type = "POST"; 10618 } 10619 10620 // If we have elements to modify, make the request 10621 if ( self.length > 0 ) { 10622 jQuery.ajax( { 10623 url: url, 10624 10625 // If "type" variable is undefined, then "GET" method will be used. 10626 // Make value of this field explicit since 10627 // user can override it through ajaxSetup method 10628 type: type || "GET", 10629 dataType: "html", 10630 data: params 10631 } ).done( function( responseText ) { 10632 10633 // Save response for use in complete callback 10634 response = arguments; 10635 10636 self.html( selector ? 10637 10638 // If a selector was specified, locate the right elements in a dummy div 10639 // Exclude scripts to avoid IE 'Permission Denied' errors 10640 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 10641 10642 // Otherwise use the full result 10643 responseText ); 10644 10645 // If the request succeeds, this function gets "data", "status", "jqXHR" 10646 // but they are ignored because response was set above. 10647 // If it fails, this function gets "jqXHR", "status", "error" 10648 } ).always( callback && function( jqXHR, status ) { 10649 self.each( function() { 10650 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 10651 } ); 10652 } ); 10653 } 10654 10655 return this; 10656}; 10657 10658 10659 10660 10661// Attach a bunch of functions for handling common AJAX events 10662jQuery.each( [ 10663 "ajaxStart", 10664 "ajaxStop", 10665 "ajaxComplete", 10666 "ajaxError", 10667 "ajaxSuccess", 10668 "ajaxSend" 10669], function( i, type ) { 10670 jQuery.fn[ type ] = function( fn ) { 10671 return this.on( type, fn ); 10672 }; 10673} ); 10674 10675 10676 10677 10678jQuery.expr.filters.animated = function( elem ) { 10679 return jQuery.grep( jQuery.timers, function( fn ) { 10680 return elem === fn.elem; 10681 } ).length; 10682}; 10683 10684 10685 10686 10687 10688/** 10689 * Gets a window from an element 10690 */ 10691function getWindow( elem ) { 10692 return jQuery.isWindow( elem ) ? 10693 elem : 10694 elem.nodeType === 9 ? 10695 elem.defaultView || elem.parentWindow : 10696 false; 10697} 10698 10699jQuery.offset = { 10700 setOffset: function( elem, options, i ) { 10701 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10702 position = jQuery.css( elem, "position" ), 10703 curElem = jQuery( elem ), 10704 props = {}; 10705 10706 // set position first, in-case top/left are set even on static elem 10707 if ( position === "static" ) { 10708 elem.style.position = "relative"; 10709 } 10710 10711 curOffset = curElem.offset(); 10712 curCSSTop = jQuery.css( elem, "top" ); 10713 curCSSLeft = jQuery.css( elem, "left" ); 10714 calculatePosition = ( position === "absolute" || position === "fixed" ) && 10715 jQuery.inArray( "auto", [ curCSSTop, curCSSLeft ] ) > -1; 10716 10717 // need to be able to calculate position if either top or left 10718 // is auto and position is either absolute or fixed 10719 if ( calculatePosition ) { 10720 curPosition = curElem.position(); 10721 curTop = curPosition.top; 10722 curLeft = curPosition.left; 10723 } else { 10724 curTop = parseFloat( curCSSTop ) || 0; 10725 curLeft = parseFloat( curCSSLeft ) || 0; 10726 } 10727 10728 if ( jQuery.isFunction( options ) ) { 10729 10730 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 10731 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 10732 } 10733 10734 if ( options.top != null ) { 10735 props.top = ( options.top - curOffset.top ) + curTop; 10736 } 10737 if ( options.left != null ) { 10738 props.left = ( options.left - curOffset.left ) + curLeft; 10739 } 10740 10741 if ( "using" in options ) { 10742 options.using.call( elem, props ); 10743 } else { 10744 curElem.css( props ); 10745 } 10746 } 10747}; 10748 10749jQuery.fn.extend( { 10750 offset: function( options ) { 10751 if ( arguments.length ) { 10752 return options === undefined ? 10753 this : 10754 this.each( function( i ) { 10755 jQuery.offset.setOffset( this, options, i ); 10756 } ); 10757 } 10758 10759 var docElem, win, 10760 box = { top: 0, left: 0 }, 10761 elem = this[ 0 ], 10762 doc = elem && elem.ownerDocument; 10763 10764 if ( !doc ) { 10765 return; 10766 } 10767 10768 docElem = doc.documentElement; 10769 10770 // Make sure it's not a disconnected DOM node 10771 if ( !jQuery.contains( docElem, elem ) ) { 10772 return box; 10773 } 10774 10775 // If we don't have gBCR, just use 0,0 rather than error 10776 // BlackBerry 5, iOS 3 (original iPhone) 10777 if ( typeof elem.getBoundingClientRect !== "undefined" ) { 10778 box = elem.getBoundingClientRect(); 10779 } 10780 win = getWindow( doc ); 10781 return { 10782 top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), 10783 left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) 10784 }; 10785 }, 10786 10787 position: function() { 10788 if ( !this[ 0 ] ) { 10789 return; 10790 } 10791 10792 var offsetParent, offset, 10793 parentOffset = { top: 0, left: 0 }, 10794 elem = this[ 0 ]; 10795 10796 // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, 10797 // because it is its only offset parent 10798 if ( jQuery.css( elem, "position" ) === "fixed" ) { 10799 10800 // we assume that getBoundingClientRect is available when computed position is fixed 10801 offset = elem.getBoundingClientRect(); 10802 } else { 10803 10804 // Get *real* offsetParent 10805 offsetParent = this.offsetParent(); 10806 10807 // Get correct offsets 10808 offset = this.offset(); 10809 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { 10810 parentOffset = offsetParent.offset(); 10811 } 10812 10813 // Add offsetParent borders 10814 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); 10815 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); 10816 } 10817 10818 // Subtract parent offsets and element margins 10819 // note: when an element has margin: auto the offsetLeft and marginLeft 10820 // are the same in Safari causing offset.left to incorrectly be 0 10821 return { 10822 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 10823 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 10824 }; 10825 }, 10826 10827 offsetParent: function() { 10828 return this.map( function() { 10829 var offsetParent = this.offsetParent; 10830 10831 while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && 10832 jQuery.css( offsetParent, "position" ) === "static" ) ) { 10833 offsetParent = offsetParent.offsetParent; 10834 } 10835 return offsetParent || documentElement; 10836 } ); 10837 } 10838} ); 10839 10840// Create scrollLeft and scrollTop methods 10841jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 10842 var top = /Y/.test( prop ); 10843 10844 jQuery.fn[ method ] = function( val ) { 10845 return access( this, function( elem, method, val ) { 10846 var win = getWindow( elem ); 10847 10848 if ( val === undefined ) { 10849 return win ? ( prop in win ) ? win[ prop ] : 10850 win.document.documentElement[ method ] : 10851 elem[ method ]; 10852 } 10853 10854 if ( win ) { 10855 win.scrollTo( 10856 !top ? val : jQuery( win ).scrollLeft(), 10857 top ? val : jQuery( win ).scrollTop() 10858 ); 10859 10860 } else { 10861 elem[ method ] = val; 10862 } 10863 }, method, val, arguments.length, null ); 10864 }; 10865} ); 10866 10867// Support: Safari<7-8+, Chrome<37-44+ 10868// Add the top/left cssHooks using jQuery.fn.position 10869// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10870// getComputedStyle returns percent when specified for top/left/bottom/right 10871// rather than make the css module depend on the offset module, we just check for it here 10872jQuery.each( [ "top", "left" ], function( i, prop ) { 10873 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 10874 function( elem, computed ) { 10875 if ( computed ) { 10876 computed = curCSS( elem, prop ); 10877 10878 // if curCSS returns percentage, fallback to offset 10879 return rnumnonpx.test( computed ) ? 10880 jQuery( elem ).position()[ prop ] + "px" : 10881 computed; 10882 } 10883 } 10884 ); 10885} ); 10886 10887 10888// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10889jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 10890 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, 10891 function( defaultExtra, funcName ) { 10892 10893 // margin is only for outerHeight, outerWidth 10894 jQuery.fn[ funcName ] = function( margin, value ) { 10895 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 10896 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 10897 10898 return access( this, function( elem, type, value ) { 10899 var doc; 10900 10901 if ( jQuery.isWindow( elem ) ) { 10902 10903 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there 10904 // isn't a whole lot we can do. See pull request at this URL for discussion: 10905 // https://github.com/jquery/jquery/pull/764 10906 return elem.document.documentElement[ "client" + name ]; 10907 } 10908 10909 // Get document width or height 10910 if ( elem.nodeType === 9 ) { 10911 doc = elem.documentElement; 10912 10913 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10914 // whichever is greatest 10915 // unfortunately, this causes bug #3838 in IE6/8 only, 10916 // but there is currently no good, small way to fix it. 10917 return Math.max( 10918 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 10919 elem.body[ "offset" + name ], doc[ "offset" + name ], 10920 doc[ "client" + name ] 10921 ); 10922 } 10923 10924 return value === undefined ? 10925 10926 // Get width or height on the element, requesting but not forcing parseFloat 10927 jQuery.css( elem, type, extra ) : 10928 10929 // Set width or height on the element 10930 jQuery.style( elem, type, value, extra ); 10931 }, type, chainable ? margin : undefined, chainable, null ); 10932 }; 10933 } ); 10934} ); 10935 10936 10937jQuery.fn.extend( { 10938 10939 bind: function( types, data, fn ) { 10940 return this.on( types, null, data, fn ); 10941 }, 10942 unbind: function( types, fn ) { 10943 return this.off( types, null, fn ); 10944 }, 10945 10946 delegate: function( selector, types, data, fn ) { 10947 return this.on( types, selector, data, fn ); 10948 }, 10949 undelegate: function( selector, types, fn ) { 10950 10951 // ( namespace ) or ( selector, types [, fn] ) 10952 return arguments.length === 1 ? 10953 this.off( selector, "**" ) : 10954 this.off( types, selector || "**", fn ); 10955 } 10956} ); 10957 10958// The number of elements contained in the matched element set 10959jQuery.fn.size = function() { 10960 return this.length; 10961}; 10962 10963jQuery.fn.andSelf = jQuery.fn.addBack; 10964 10965 10966 10967 10968// Register as a named AMD module, since jQuery can be concatenated with other 10969// files that may use define, but not via a proper concatenation script that 10970// understands anonymous AMD modules. A named AMD is safest and most robust 10971// way to register. Lowercase jquery is used because AMD module names are 10972// derived from file names, and jQuery is normally delivered in a lowercase 10973// file name. Do this after creating the global so that if an AMD module wants 10974// to call noConflict to hide this version of jQuery, it will work. 10975 10976// Note that for maximum portability, libraries that are not jQuery should 10977// declare themselves as anonymous modules, and avoid setting a global if an 10978// AMD loader is present. jQuery is a special case. For more information, see
vendor: 8,940 bytes, lines 10979-11268
10979// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10980 10981if ( typeof define === "function" && define.amd ) { 10982 define( "jquery", [], function() { 10983 return jQuery; 10984 } ); 10985} 10986 10987 10988 10989var 10990 10991 // Map over jQuery in case of overwrite 10992 _jQuery = window.jQuery, 10993 10994 // Map over the $ in case of overwrite 10995 _$ = window.$; 10996 10997jQuery.noConflict = function( deep ) { 10998 if ( window.$ === jQuery ) { 10999 window.$ = _$; 11000 } 11001 11002 if ( deep && window.jQuery === jQuery ) { 11003 window.jQuery = _jQuery; 11004 } 11005 11006 return jQuery; 11007}; 11008 11009// Expose jQuery and $ identifiers, even in 11010// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 11011// and CommonJS for browser emulators (#13566) 11012if ( !noGlobal ) { 11013 window.jQuery = window.$ = jQuery; 11014} 11015 11016return jQuery; 11017})); 11018/** 11019* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 11020*/ 11021 11022;(function(window, document) { 11023/*jshint evil:true */ 11024 /** version */ 11025 var version = '3.7.3'; 11026 11027 /** Preset options */ 11028 var options = window.html5 || {}; 11029 11030 /** Used to skip problem elements */ 11031 var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; 11032 11033 /** Not all elements can be cloned in IE **/ 11034 var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; 11035 11036 /** Detect whether the browser supports default html5 styles */ 11037 var supportsHtml5Styles; 11038 11039 /** Name of the expando, to work with multiple documents or to re-shiv one document */ 11040 var expando = '_html5shiv'; 11041 11042 /** The id for the the documents expando */ 11043 var expanID = 0; 11044 11045 /** Cached data for each document */ 11046 var expandoData = {}; 11047 11048 /** Detect whether the browser supports unknown elements */ 11049 var supportsUnknownElements; 11050 11051 (function() { 11052 try { 11053 var a = document.createElement('a'); 11054 a.innerHTML = '<xyz></xyz>'; 11055 //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles 11056 supportsHtml5Styles = ('hidden' in a); 11057 11058 supportsUnknownElements = a.childNodes.length == 1 || (function() { 11059 // assign a false positive if unable to shiv 11060 (document.createElement)('a'); 11061 var frag = document.createDocumentFragment(); 11062 return ( 11063 typeof frag.cloneNode == 'undefined' || 11064 typeof frag.createDocumentFragment == 'undefined' || 11065 typeof frag.createElement == 'undefined' 11066 ); 11067 }()); 11068 } catch(e) { 11069 // assign a false positive if detection fails => unable to shiv 11070 supportsHtml5Styles = true; 11071 supportsUnknownElements = true; 11072 } 11073 11074 }()); 11075 11076 /*--------------------------------------------------------------------------*/ 11077 11078 /** 11079 * Creates a style sheet with the given CSS text and adds it to the document. 11080 * @private 11081 * @param {Document} ownerDocument The document. 11082 * @param {String} cssText The CSS text. 11083 * @returns {StyleSheet} The style element. 11084 */ 11085 function addStyleSheet(ownerDocument, cssText) { 11086 var p = ownerDocument.createElement('p'), 11087 parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; 11088 11089 p.innerHTML = 'x<style>' + cssText + '</style>'; 11090 return parent.insertBefore(p.lastChild, parent.firstChild); 11091 } 11092 11093 /** 11094 * Returns the value of `html5.elements` as an array. 11095 * @private 11096 * @returns {Array} An array of shived element node names. 11097 */ 11098 function getElements() { 11099 var elements = html5.elements; 11100 return typeof elements == 'string' ? elements.split(' ') : elements; 11101 } 11102 11103 /** 11104 * Extends the built-in list of html5 elements 11105 * @memberOf html5 11106 * @param {String|Array} newElements whitespace separated list or array of new element names to shiv 11107 * @param {Document} ownerDocument The context document. 11108 */ 11109 function addElements(newElements, ownerDocument) { 11110 var elements = html5.elements; 11111 if(typeof elements != 'string'){ 11112 elements = elements.join(' '); 11113 } 11114 if(typeof newElements != 'string'){ 11115 newElements = newElements.join(' '); 11116 } 11117 html5.elements = elements +' '+ newElements; 11118 shivDocument(ownerDocument); 11119 } 11120 11121 /** 11122 * Returns the data associated to the given document 11123 * @private 11124 * @param {Document} ownerDocument The document. 11125 * @returns {Object} An object of data. 11126 */ 11127 function getExpandoData(ownerDocument) { 11128 var data = expandoData[ownerDocument[expando]]; 11129 if (!data) { 11130 data = {}; 11131 expanID++; 11132 ownerDocument[expando] = expanID; 11133 expandoData[expanID] = data; 11134 } 11135 return data; 11136 } 11137 11138 /** 11139 * returns a shived element for the given nodeName and document 11140 * @memberOf html5 11141 * @param {String} nodeName name of the element 11142 * @param {Document|DocumentFragment} ownerDocument The context document. 11143 * @returns {Object} The shived element. 11144 */ 11145 function createElement(nodeName, ownerDocument, data){ 11146 if (!ownerDocument) { 11147 ownerDocument = document; 11148 } 11149 if(supportsUnknownElements){ 11150 return ownerDocument.createElement(nodeName); 11151 } 11152 if (!data) { 11153 data = getExpandoData(ownerDocument); 11154 } 11155 var node; 11156 11157 if (data.cache[nodeName]) { 11158 node = data.cache[nodeName].cloneNode(); 11159 } else if (saveClones.test(nodeName)) { 11160 node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); 11161 } else { 11162 node = data.createElem(nodeName); 11163 } 11164 11165 // Avoid adding some elements to fragments in IE < 9 because 11166 // * Attributes like `name` or `type` cannot be set/changed once an element 11167 // is inserted into a document/fragment 11168 // * Link elements with `src` attributes that are inaccessible, as with 11169 // a 403 response, will cause the tab/window to crash 11170 // * Script elements appended to fragments will execute when their `src` 11171 // or `text` property is set 11172 return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node; 11173 } 11174 11175 /** 11176 * returns a shived DocumentFragment for the given document 11177 * @memberOf html5 11178 * @param {Document} ownerDocument The context document. 11179 * @returns {Object} The shived DocumentFragment. 11180 */ 11181 function createDocumentFragment(ownerDocument, data){ 11182 if (!ownerDocument) { 11183 ownerDocument = document; 11184 } 11185 if(supportsUnknownElements){ 11186 return ownerDocument.createDocumentFragment(); 11187 } 11188 data = data || getExpandoData(ownerDocument); 11189 var clone = data.frag.cloneNode(), 11190 i = 0, 11191 elems = getElements(), 11192 l = elems.length; 11193 for(;i<l;i++){ 11194 clone.createElement(elems[i]); 11195 } 11196 return clone; 11197 } 11198 11199 /** 11200 * Shivs the `createElement` and `createDocumentFragment` methods of the document. 11201 * @private 11202 * @param {Document|DocumentFragment} ownerDocument The document. 11203 * @param {Object} data of the document. 11204 */ 11205 function shivMethods(ownerDocument, data) { 11206 if (!data.cache) { 11207 data.cache = {}; 11208 data.createElem = ownerDocument.createElement; 11209 data.createFrag = ownerDocument.createDocumentFragment; 11210 data.frag = data.createFrag(); 11211 } 11212 11213 11214 ownerDocument.createElement = function(nodeName) { 11215 //abort shiv 11216 if (!html5.shivMethods) { 11217 return data.createElem(nodeName); 11218 } 11219 return createElement(nodeName, ownerDocument, data); 11220 }; 11221 11222 ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' + 11223 'var n=f.cloneNode(),c=n.createElement;' + 11224 'h.shivMethods&&(' + 11225 // unroll the `createElement` calls 11226 getElements().join().replace(/[\w\-:]+/g, function(nodeName) { 11227 data.createElem(nodeName); 11228 data.frag.createElement(nodeName); 11229 return 'c("' + nodeName + '")'; 11230 }) + 11231 ');return n}' 11232 )(html5, data.frag); 11233 } 11234 11235 /*--------------------------------------------------------------------------*/ 11236 11237 /** 11238 * Shivs the given document. 11239 * @memberOf html5 11240 * @param {Document} ownerDocument The document to shiv. 11241 * @returns {Document} The shived document. 11242 */ 11243 function shivDocument(ownerDocument) { 11244 if (!ownerDocument) { 11245 ownerDocument = document; 11246 } 11247 var data = getExpandoData(ownerDocument); 11248 11249 if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) { 11250 data.hasCSS = !!addStyleSheet(ownerDocument, 11251 // corrects block display not defined in IE6/7/8/9 11252 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' + 11253 // adds styling not present in IE6/7/8/9 11254 'mark{background:#FF0;color:#000}' + 11255 // hides non-rendered elements 11256 'template{display:none}' 11257 ); 11258 } 11259 if (!supportsUnknownElements) { 11260 shivMethods(ownerDocument, data); 11261 } 11262 return ownerDocument; 11263 } 11264 11265 /*--------------------------------------------------------------------------*/ 11266 11267 /** 11268 * The `html5` object is exposed so that more elements can be shived and
11269 * existing shiving can be detected on iframes. 11270 * @type Object 11271 * @example 11272 * 11273 * // options can be changed before the script is included 11274 * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false }; 11275 */ 11276 var html5 = { 11277 11278 /** 11279 * An array or space separated string of node names of the elements to shiv. 11280 * @memberOf html5 11281 * @type Array|String 11282 */ 11283 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video', 11284 11285 /** 11286 * current version of html5shiv 11287 */ 11288 'version': version, 11289 11290 /** 11291 * A flag to indicate that the HTML5 style sheet should be inserted. 11292 * @memberOf html5 11293 * @type Boolean 11294 */ 11295 'shivCSS': (options.shivCSS !== false), 11296 11297 /** 11298 * Is equal to true if a browser supports creating unknown/HTML5 elements 11299 * @memberOf html5 11300 * @type boolean 11301 */ 11302 'supportsUnknownElements': supportsUnknownElements, 11303 11304 /** 11305 * A flag to indicate that the document's `createElement` and `createDocumentFragment` 11306 * methods should be overwritten. 11307 * @memberOf html5 11308 * @type Boolean 11309 */ 11310 'shivMethods': (options.shivMethods !== false), 11311 11312 /** 11313 * A string to describe the type of `html5` object ("default" or "default print"). 11314 * @memberOf html5
11315 * @type String 11316 */ 11317 'type': 'default', 11318 11319 // shivs the document according to the specified `html5` object options 11320 'shivDocument': shivDocument, 11321 11322 //creates a shived element 11323 createElement: createElement, 11324 11325 //creates a shived documentFragment 11326 createDocumentFragment: createDocumentFragment, 11327 11328 //extends list of elements 11329 addElements: addElements 11330 }; 11331 11332 /*--------------------------------------------------------------------------*/ 11333 11334 // expose html5 11335 window.html5 = html5; 11336 11337 // shiv the document 11338 shivDocument(document); 11339 11340 if(typeof module == 'object' && module.exports){ 11341 module.exports = html5; 11342 } 11343 11344}(typeof window !== "undefined" ? window : this, document)); 11345/*! VelocityJS.org (1.1.0). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */ 11346 11347/************************* 11348 Velocity jQuery Shim 11349*************************/ 11350 11351/*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */ 11352 11353/* This file contains the jQuery functions that Velocity relies on, thereby removing Velocity's dependency on a full copy of jQuery, and allowing it to work in any environment. */ 11354/* These shimmed functions are only used if jQuery isn't present. If both this shim and jQuery are loaded, Velocity defaults to jQuery proper. */ 11355/* Browser support: Using this shim instead of jQuery proper removes support for IE8. */ 11356 11357 11358;(function (window) { 11359 /*************** 11360 Setup 11361 ***************/ 11362 11363 /* If jQuery is already loaded, there's no point in loading this shim. */ 11364 if (window.jQuery) { 11365 return; 11366 } 11367 11368 /* jQuery base. */ 11369 var $ = function (selector, context) { 11370 return new $.fn.init(selector, context); 11371 }; 11372 11373 /******************** 11374 Private Methods 11375 ********************/ 11376 11377 /* jQuery */ 11378 $.isWindow = function (obj) { 11379 /* jshint eqeqeq: false */ 11380 return obj != null && obj == obj.window; 11381 }; 11382 11383 /* jQuery */ 11384 $.type = function (obj) { 11385 if (obj == null) { 11386 return obj + ""; 11387 } 11388 11389 return typeof obj === "object" || typeof obj === "function" ? 11390 class2type[toString.call(obj)] || "object" : 11391 typeof obj; 11392 }; 11393 11394 /* jQuery */ 11395 $.isArray = Array.isArray || function (obj) { 11396 return $.type(obj) === "array"; 11397 }; 11398 11399 /* jQuery */ 11400 function isArraylike (obj) { 11401 var length = obj.length, 11402 type = $.type(obj); 11403 11404 if (type === "function" || $.isWindow(obj)) { 11405 return false; 11406 } 11407 11408 if (obj.nodeType === 1 && length) { 11409 return true; 11410 } 11411 11412 return type === "array" || length === 0 || typeof length === "number" && length > 0 && (length - 1) in obj; 11413 } 11414 11415 /*************** 11416 $ Methods 11417 ***************/ 11418 11419 /* jQuery: Support removed for IE<9. */ 11420 $.isPlainObject = function (obj) { 11421 var key; 11422 11423 if (!obj || $.type(obj) !== "object" || obj.nodeType || $.isWindow(obj)) { 11424 return false; 11425 } 11426 11427 try { 11428 if (obj.constructor && 11429 !hasOwn.call(obj, "constructor") && 11430 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) { 11431 return false; 11432 } 11433 } catch (e) { 11434 return false; 11435 } 11436 11437 for (key in obj) {} 11438 11439 return key === undefined || hasOwn.call(obj, key); 11440 }; 11441 11442 /* jQuery */ 11443 $.each = function(obj, callback, args) { 11444 var value, 11445 i = 0, 11446 length = obj.length, 11447 isArray = isArraylike(obj); 11448 11449 if (args) { 11450 if (isArray) { 11451 for (; i < length; i++) { 11452 value = callback.apply(obj[i], args); 11453 11454 if (value === false) { 11455 break; 11456 } 11457 } 11458 } else { 11459 for (i in obj) { 11460 value = callback.apply(obj[i], args); 11461 11462 if (value === false) { 11463 break; 11464 } 11465 } 11466 } 11467 11468 } else { 11469 if (isArray) { 11470 for (; i < length; i++) { 11471 value = callback.call(obj[i], i, obj[i]); 11472 11473 if (value === false) { 11474 break; 11475 } 11476 } 11477 } else { 11478 for (i in obj) { 11479 value = callback.call(obj[i], i, obj[i]); 11480 11481 if (value === false) { 11482 break; 11483 } 11484 } 11485 } 11486 } 11487 11488 return obj; 11489 }; 11490 11491 /* Custom */ 11492 $.data = function (node, key, value) { 11493 /* $.getData() */ 11494 if (value === undefined) { 11495 var id = node[$.expando],
vendor: 5,528 bytes, lines 11496-11695
11496 store = id && cache[id]; 11497 11498 if (key === undefined) { 11499 return store; 11500 } else if (store) { 11501 if (key in store) { 11502 return store[key]; 11503 } 11504 } 11505 /* $.setData() */ 11506 } else if (key !== undefined) { 11507 var id = node[$.expando] || (node[$.expando] = ++$.uuid); 11508 11509 cache[id] = cache[id] || {}; 11510 cache[id][key] = value; 11511 11512 return value; 11513 } 11514 }; 11515 11516 /* Custom */ 11517 $.removeData = function (node, keys) { 11518 var id = node[$.expando], 11519 store = id && cache[id]; 11520 11521 if (store) { 11522 $.each(keys, function(_, key) { 11523 delete store[key]; 11524 }); 11525 } 11526 }; 11527 11528 /* jQuery */ 11529 $.extend = function () { 11530 var src, copyIsArray, copy, name, options, clone, 11531 target = arguments[0] || {}, 11532 i = 1, 11533 length = arguments.length, 11534 deep = false; 11535 11536 if (typeof target === "boolean") { 11537 deep = target; 11538 11539 target = arguments[i] || {}; 11540 i++; 11541 } 11542 11543 if (typeof target !== "object" && $.type(target) !== "function") { 11544 target = {}; 11545 } 11546 11547 if (i === length) { 11548 target = this; 11549 i--; 11550 } 11551 11552 for (; i < length; i++) { 11553 if ((options = arguments[i]) != null) { 11554 for (name in options) { 11555 src = target[name]; 11556 copy = options[name]; 11557 11558 if (target === copy) { 11559 continue; 11560 } 11561 11562 if (deep && copy && ($.isPlainObject(copy) || (copyIsArray = $.isArray(copy)))) { 11563 if (copyIsArray) { 11564 copyIsArray = false; 11565 clone = src && $.isArray(src) ? src : []; 11566 11567 } else { 11568 clone = src && $.isPlainObject(src) ? src : {}; 11569 } 11570 11571 target[name] = $.extend(deep, clone, copy); 11572 11573 } else if (copy !== undefined) { 11574 target[name] = copy; 11575 } 11576 } 11577 } 11578 } 11579 11580 return target; 11581 }; 11582 11583 /* jQuery 1.4.3 */ 11584 $.queue = function (elem, type, data) { 11585 function $makeArray (arr, results) { 11586 var ret = results || []; 11587 11588 if (arr != null) { 11589 if (isArraylike(Object(arr))) { 11590 /* $.merge */ 11591 (function(first, second) { 11592 var len = +second.length, 11593 j = 0, 11594 i = first.length; 11595 11596 while (j < len) { 11597 first[i++] = second[j++]; 11598 } 11599 11600 if (len !== len) { 11601 while (second[j] !== undefined) { 11602 first[i++] = second[j++]; 11603 } 11604 } 11605 11606 first.length = i; 11607 11608 return first; 11609 })(ret, typeof arr === "string" ? [arr] : arr); 11610 } else { 11611 [].push.call(ret, arr); 11612 } 11613 } 11614 11615 return ret; 11616 } 11617 11618 if (!elem) { 11619 return; 11620 } 11621 11622 type = (type || "fx") + "queue"; 11623 11624 var q = $.data(elem, type); 11625 11626 if (!data) { 11627 return q || []; 11628 } 11629 11630 if (!q || $.isArray(data)) { 11631 q = $.data(elem, type, $makeArray(data)); 11632 } else { 11633 q.push(data); 11634 } 11635 11636 return q; 11637 }; 11638 11639 /* jQuery 1.4.3 */ 11640 $.dequeue = function (elems, type) { 11641 /* Custom: Embed element iteration. */ 11642 $.each(elems.nodeType ? [ elems ] : elems, function(i, elem) { 11643 type = type || "fx"; 11644 11645 var queue = $.queue(elem, type), 11646 fn = queue.shift(); 11647 11648 if (fn === "inprogress") { 11649 fn = queue.shift(); 11650 } 11651 11652 if (fn) { 11653 if (type === "fx") { 11654 queue.unshift("inprogress"); 11655 } 11656 11657 fn.call(elem, function() { 11658 $.dequeue(elem, type); 11659 }); 11660 } 11661 }); 11662 }; 11663 11664 /****************** 11665 $.fn Methods 11666 ******************/ 11667 11668 /* jQuery */ 11669 $.fn = $.prototype = { 11670 init: function (selector) { 11671 /* Just return the element wrapped inside an array; don't proceed with the actual jQuery node wrapping process. */ 11672 if (selector.nodeType) { 11673 this[0] = selector; 11674 11675 return this; 11676 } else { 11677 throw new Error("Not a DOM node."); 11678 } 11679 }, 11680 11681 offset: function () { 11682 /* jQuery altered code: Dropped disconnected DOM node checking. */ 11683 var box = this[0].getBoundingClientRect ? this[0].getBoundingClientRect() : { top: 0, left: 0 }; 11684 11685 return { 11686 top: box.top + (window.pageYOffset || document.scrollTop || 0) - (document.clientTop || 0), 11687 left: box.left + (window.pageXOffset || document.scrollLeft || 0) - (document.clientLeft || 0) 11688 }; 11689 }, 11690 11691 position: function () { 11692 /* jQuery */ 11693 function offsetParent() { 11694 var offsetParent = this.offsetParent || document; 11695
11696 while (offsetParent && (!offsetParent.nodeType.toLowerCase === "html" && offsetParent.style.position === "static")) { 11697 offsetParent = offsetParent.offsetParent; 11698 } 11699 11700 return offsetParent || document; 11701 } 11702 11703 /* Zepto */ 11704 var elem = this[0], 11705 offsetParent = offsetParent.apply(elem), 11706 offset = this.offset(), 11707 parentOffset = /^(?:body|html)$/i.test(offsetParent.nodeName) ? { top: 0, left: 0 } : $(offsetParent).offset() 11708 11709 offset.top -= parseFloat(elem.style.marginTop) || 0; 11710 offset.left -= parseFloat(elem.style.marginLeft) || 0; 11711 11712 if (offsetParent.style) { 11713 parentOffset.top += parseFloat(offsetParent.style.borderTopWidth) || 0 11714 parentOffset.left += parseFloat(offsetParent.style.borderLeftWidth) || 0 11715 } 11716 11717 return { 11718 top: offset.top - parentOffset.top, 11719 left: offset.left - parentOffset.left 11720 }; 11721 } 11722 }; 11723 11724 /********************** 11725 Private Variables 11726 **********************/ 11727 11728 /* For $.data() */ 11729 var cache = {}; 11730 $.expando = "velocity" + (new Date().getTime()); 11731 $.uuid = 0; 11732 11733 /* For $.queue() */ 11734 var class2type = {}, 11735 hasOwn = class2type.hasOwnProperty, 11736 toString = class2type.toString; 11737 11738 var types = "Boolean Number String Function Array Date RegExp Object Error".split(" "); 11739 for (var i = 0; i < types.length; i++) { 11740 class2type["[object " + types[i] + "]"] = types[i].toLowerCase(); 11741 } 11742 11743 /* Makes $(node) possible, without having to call init. */ 11744 $.fn.init.prototype = $.fn; 11745 11746 /* Globalize Velocity onto the window, and assign its Utilities property. */ 11747 window.Velocity = { Utilities: $ }; 11748})(window); 11749 11750/****************** 11751 Velocity.js 11752******************/ 11753 11754;(function (factory) { 11755 /* CommonJS module. */ 11756 if (typeof module === "object" && typeof module.exports === "object") { 11757 module.exports = factory(); 11758 /* AMD module. */ 11759 } else if (typeof define === "function" && define.amd) { 11760 define(factory); 11761 /* Browser globals. */ 11762 } else { 11763 factory(); 11764 } 11765}(function() { 11766return function (global, window, document, undefined) { 11767 11768 /*************** 11769 Summary 11770 ***************/ 11771 11772 /* 11773 - CSS: CSS stack that works independently from the rest of Velocity. 11774 - animate(): Core animation method that iterates over the targeted elements and queues the incoming call onto each element individually. 11775 - Pre-Queueing: Prepare the element for animation by instantiating its data cache and processing the call's options. 11776 - Queueing: The logic that runs once the call has reached its point of execution in the element's $.queue() stack. 11777 Most logic is placed here to avoid risking it becoming stale (if the element's properties have changed). 11778 - Pushing: Consolidation of the tween data followed by its push onto the global in-progress calls container. 11779 - tick(): The single requestAnimationFrame loop responsible for tweening all in-progress calls. 11780 - completeCall(): Handles the cleanup process for each Velocity call. 11781 */ 11782 11783 /********************* 11784 Helper Functions 11785 *********************/ 11786 11787 /* IE detection. Gist: https://gist.github.com/julianshapiro/9098609 */ 11788 var IE = (function() { 11789 if (document.documentMode) { 11790 return document.documentMode; 11791 } else { 11792 for (var i = 7; i > 4; i--) { 11793 var div = document.createElement("div"); 11794 11795 div.innerHTML = "<!--[if IE " + i + "]><span></span><![endif]-->"; 11796 11797 if (div.getElementsByTagName("span").length) { 11798 div = null; 11799 11800 return i; 11801 } 11802 } 11803 } 11804 11805 return undefined; 11806 })(); 11807 11808 /* rAF shim. Gist: https://gist.github.com/julianshapiro/9497513 */ 11809 var rAFShim = (function() { 11810 var timeLast = 0; 11811 11812 return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { 11813 var timeCurrent = (new Date()).getTime(), 11814 timeDelta; 11815 11816 /* Dynamically set delay on a per-tick basis to match 60fps. */ 11817 /* Technique by Erik Moller. MIT license: https://gist.github.com/paulirish/1579671 */ 11818 timeDelta = Math.max(0, 16 - (timeCurrent - timeLast)); 11819 timeLast = timeCurrent + timeDelta; 11820 11821 return setTimeout(function() { callback(timeCurrent + timeDelta); }, timeDelta); 11822 }; 11823 })(); 11824 11825 /* Array compacting. Copyright Lo-Dash. MIT License: https://github.com/lodash/lodash/blob/master/LICENSE.txt */ 11826 function compactSparseArray (array) { 11827 var index = -1, 11828 length = array ? array.length : 0, 11829 result = []; 11830 11831 while (++index < length) { 11832 var value = array[index]; 11833 11834 if (value) { 11835 result.push(value); 11836 } 11837 } 11838 11839 return result; 11840 } 11841 11842 function sanitizeElements (elements) { 11843 /* Unwrap jQuery/Zepto objects. */ 11844 if (Type.isWrapped(elements)) { 11845 elements = [].slice.call(elements); 11846 /* Wrap a single element in an array so that $.each() can iterate with the element instead of its node's children. */ 11847 } else if (Type.isNode(elements)) { 11848 elements = [ elements ]; 11849 } 11850 11851 return elements; 11852 } 11853 11854 var Type = { 11855 isString: function (variable) { 11856 return (typeof variable === "string"); 11857 }, 11858 isArray: Array.isArray || function (variable) { 11859 return Object.prototype.toString.call(variable) === "[object Array]"; 11860 }, 11861 isFunction: function (variable) { 11862 return Object.prototype.toString.call(variable) === "[object Function]"; 11863 }, 11864 isNode: function (variable) { 11865 return variable && variable.nodeType; 11866 }, 11867 /* Copyright Martin Bohm. MIT License: https://gist.github.com/Tomalak/818a78a226a0738eaade */ 11868 isNodeList: function (variable) { 11869 return typeof variable === "object" && 11870 /^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(variable)) && 11871 variable.length !== undefined && 11872 (variable.length === 0 || (typeof variable[0] === "object" && variable[0].nodeType > 0)); 11873 }, 11874 /* Determine if variable is a wrapped jQuery or Zepto element. */ 11875 isWrapped: function (variable) { 11876 return variable && (variable.jquery || (window.Zepto && window.Zepto.zepto.isZ(variable))); 11877 }, 11878 isSVG: function (variable) { 11879 return window.SVGElement && (variable instanceof window.SVGElement); 11880 }, 11881 isEmptyObject: function (variable) { 11882 for (var name in variable) { 11883 return false;
vendor: 44,538 bytes, lines 11884-12741
11884 } 11885 11886 return true; 11887 } 11888 }; 11889 11890 /***************** 11891 Dependencies 11892 *****************/ 11893 11894 var $, 11895 isJQuery = false; 11896 11897 if (global.fn && global.fn.jquery) { 11898 $ = global; 11899 isJQuery = true; 11900 } else { 11901 $ = window.Velocity.Utilities; 11902 } 11903 11904 if (IE <= 8 && !isJQuery) { 11905 throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity."); 11906 } else if (IE <= 7) { 11907 /* Revert to jQuery's $.animate(), and lose Velocity's extra features. */ 11908 jQuery.fn.velocity = jQuery.fn.animate; 11909 11910 /* Now that $.fn.velocity is aliased, abort this Velocity declaration. */ 11911 return; 11912 } 11913 11914 /***************** 11915 Constants 11916 *****************/ 11917 11918 var DURATION_DEFAULT = 400, 11919 EASING_DEFAULT = "swing"; 11920 11921 /************* 11922 State 11923 *************/ 11924 11925 /* Note: The global object also doubles as a publicly-accessible data store for the purposes of unit testing. */ 11926 /* Note: Alias the lowercase and uppercase variants of "velocity" to minimize user confusion due to the lowercase nature of the $.fn extension. */ 11927 var Velocity = { 11928 /* Container for page-wide Velocity state data. */ 11929 State: { 11930 /* Detect mobile devices to determine if mobileHA should be turned on. */ 11931 isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), 11932 /* The mobileHA option's behavior changes on older Android devices (Gingerbread, versions 2.3.3-2.3.7). */ 11933 isAndroid: /Android/i.test(navigator.userAgent), 11934 isGingerbread: /Android 2\.3\.[3-7]/i.test(navigator.userAgent), 11935 isChrome: window.chrome, 11936 isFirefox: /Firefox/i.test(navigator.userAgent), 11937 /* Create a cached element for re-use when checking for CSS property prefixes. */ 11938 prefixElement: document.createElement("div"), 11939 /* Cache every prefix match to avoid repeating lookups. */ 11940 prefixMatches: {}, 11941 /* Cache the anchor used for animating window scrolling. */ 11942 scrollAnchor: null, 11943 /* Cache the property names associated with the scroll anchor. */ 11944 scrollPropertyLeft: null, 11945 scrollPropertyTop: null, 11946 /* Keep track of whether our RAF tick is running. */ 11947 isTicking: false, 11948 /* Container for every in-progress call to Velocity. */ 11949 calls: [] 11950 }, 11951 /* Velocity's custom CSS stack. Made global for unit testing. */ 11952 CSS: { /* Defined below. */ }, 11953 /* Defined by Velocity's optional jQuery shim. */ 11954 Utilities: $, 11955 /* Container for the user's custom animation redirects that are referenced by name in place of a properties map object. */ 11956 Redirects: { /* Manually registered by the user. */ }, 11957 Easings: { /* Defined below. */ }, 11958 /* Attempt to use ES6 Promises by default. Users can override this with a third-party promises library. */ 11959 Promise: window.Promise, 11960 /* Page-wide option defaults, which can be overriden by the user. */ 11961 defaults: { 11962 queue: "", 11963 duration: DURATION_DEFAULT, 11964 easing: EASING_DEFAULT, 11965 begin: undefined, 11966 complete: undefined, 11967 progress: undefined, 11968 display: undefined, 11969 visibility: undefined, 11970 loop: false, 11971 delay: false, 11972 mobileHA: true, 11973 /* Set to false to prevent property values from being cached between consecutive Velocity-initiated chain calls. */ 11974 _cacheValues: true 11975 }, 11976 /* A design goal of Velocity is to cache data wherever possible in order to avoid DOM requerying. 11977 Accordingly, each element has a data cache instantiated on it. */ 11978 init: function (element) { 11979 $.data(element, "velocity", { 11980 /* Store whether this is an SVG element, since its properties are retrieved and updated differently than standard HTML elements. */ 11981 isSVG: Type.isSVG(element), 11982 /* Keep track of whether the element is currently being animated by Velocity. 11983 This is used to ensure that property values are not transferred between non-consecutive (stale) calls. */ 11984 isAnimating: false, 11985 /* A reference to the element's live computedStyle object. Learn more here: https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle */ 11986 computedStyle: null, 11987 /* Tween data is cached for each animation on the element so that data can be passed across calls -- 11988 in particular, end values are used as subsequent start values in consecutive Velocity calls. */ 11989 tweensContainer: null, 11990 /* The full root property values of each CSS hook being animated on this element are cached so that: 11991 1) Concurrently-animating hooks sharing the same root can have their root values' merged into one while tweening. 11992 2) Post-hook-injection root values can be transferred over to consecutively chained Velocity calls as starting root values. */ 11993 rootPropertyValueCache: {}, 11994 /* A cache for transform updates, which must be manually flushed via CSS.flushTransformCache(). */ 11995 transformCache: {} 11996 }); 11997 }, 11998 /* A parallel to jQuery's $.css(), used for getting/setting Velocity's hooked CSS properties. */ 11999 hook: null, /* Defined below. */ 12000 /* Velocity-wide animation time remapping for testing purposes. */ 12001 mock: false, 12002 version: { major: 1, minor: 1, patch: 0 }, 12003 /* Set to 1 or 2 (most verbose) to output debug info to console. */ 12004 debug: false 12005 }; 12006 12007 /* Retrieve the appropriate scroll anchor and property name for the browser: https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY */ 12008 if (window.pageYOffset !== undefined) { 12009 Velocity.State.scrollAnchor = window; 12010 Velocity.State.scrollPropertyLeft = "pageXOffset"; 12011 Velocity.State.scrollPropertyTop = "pageYOffset"; 12012 } else { 12013 Velocity.State.scrollAnchor = document.documentElement || document.body.parentNode || document.body; 12014 Velocity.State.scrollPropertyLeft = "scrollLeft"; 12015 Velocity.State.scrollPropertyTop = "scrollTop"; 12016 } 12017 12018 /* Shorthand alias for jQuery's $.data() utility. */ 12019 function Data (element) { 12020 /* Hardcode a reference to the plugin name. */ 12021 var response = $.data(element, "velocity"); 12022 12023 /* jQuery <=1.4.2 returns null instead of undefined when no match is found. We normalize this behavior. */ 12024 return response === null ? undefined : response; 12025 }; 12026 12027 /************** 12028 Easing 12029 **************/ 12030 12031 /* Step easing generator. */ 12032 function generateStep (steps) { 12033 return function (p) { 12034 return Math.round(p * steps) * (1 / steps); 12035 }; 12036 } 12037 12038 /* Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */ 12039 function generateBezier (mX1, mY1, mX2, mY2) { 12040 var NEWTON_ITERATIONS = 4, 12041 NEWTON_MIN_SLOPE = 0.001, 12042 SUBDIVISION_PRECISION = 0.0000001, 12043 SUBDIVISION_MAX_ITERATIONS = 10, 12044 kSplineTableSize = 11, 12045 kSampleStepSize = 1.0 / (kSplineTableSize - 1.0), 12046 float32ArraySupported = "Float32Array" in window; 12047 12048 /* Must contain four arguments. */ 12049 if (arguments.length !== 4) { 12050 return false; 12051 } 12052 12053 /* Arguments must be numbers. */ 12054 for (var i = 0; i < 4; ++i) { 12055 if (typeof arguments[i] !== "number" || isNaN(arguments[i]) || !isFinite(arguments[i])) { 12056 return false; 12057 } 12058 } 12059 12060 /* X values must be in the [0, 1] range. */ 12061 mX1 = Math.min(mX1, 1); 12062 mX2 = Math.min(mX2, 1); 12063 mX1 = Math.max(mX1, 0); 12064 mX2 = Math.max(mX2, 0); 12065 12066 var mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); 12067 12068 function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; } 12069 function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; } 12070 function C (aA1) { return 3.0 * aA1; } 12071 12072 function calcBezier (aT, aA1, aA2) { 12073 return ((A(aA1, aA2)*aT + B(aA1, aA2))*aT + C(aA1))*aT; 12074 } 12075 12076 function getSlope (aT, aA1, aA2) { 12077 return 3.0 * A(aA1, aA2)*aT*aT + 2.0 * B(aA1, aA2) * aT + C(aA1); 12078 } 12079 12080 function newtonRaphsonIterate (aX, aGuessT) { 12081 for (var i = 0; i < NEWTON_ITERATIONS; ++i) { 12082 var currentSlope = getSlope(aGuessT, mX1, mX2); 12083 12084 if (currentSlope === 0.0) return aGuessT; 12085 12086 var currentX = calcBezier(aGuessT, mX1, mX2) - aX; 12087 aGuessT -= currentX / currentSlope; 12088 } 12089 12090 return aGuessT; 12091 } 12092 12093 function calcSampleValues () { 12094 for (var i = 0; i < kSplineTableSize; ++i) { 12095 mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2); 12096 } 12097 } 12098 12099 function binarySubdivide (aX, aA, aB) { 12100 var currentX, currentT, i = 0; 12101 12102 do { 12103 currentT = aA + (aB - aA) / 2.0; 12104 currentX = calcBezier(currentT, mX1, mX2) - aX; 12105 if (currentX > 0.0) { 12106 aB = currentT; 12107 } else { 12108 aA = currentT; 12109 } 12110 } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS); 12111 12112 return currentT; 12113 } 12114 12115 function getTForX (aX) { 12116 var intervalStart = 0.0, 12117 currentSample = 1, 12118 lastSample = kSplineTableSize - 1; 12119 12120 for (; currentSample != lastSample && mSampleValues[currentSample] <= aX; ++currentSample) { 12121 intervalStart += kSampleStepSize; 12122 } 12123 12124 --currentSample; 12125 12126 var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample+1] - mSampleValues[currentSample]), 12127 guessForT = intervalStart + dist * kSampleStepSize, 12128 initialSlope = getSlope(guessForT, mX1, mX2); 12129 12130 if (initialSlope >= NEWTON_MIN_SLOPE) { 12131 return newtonRaphsonIterate(aX, guessForT); 12132 } else if (initialSlope == 0.0) { 12133 return guessForT; 12134 } else { 12135 return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize); 12136 } 12137 } 12138 12139 var _precomputed = false; 12140 12141 function precompute() { 12142 _precomputed = true; 12143 if (mX1 != mY1 || mX2 != mY2) calcSampleValues(); 12144 } 12145 12146 var f = function (aX) { 12147 if (!_precomputed) precompute(); 12148 if (mX1 === mY1 && mX2 === mY2) return aX; 12149 if (aX === 0) return 0; 12150 if (aX === 1) return 1; 12151 12152 return calcBezier(getTForX(aX), mY1, mY2); 12153 }; 12154 12155 f.getControlPoints = function() { return [{ x: mX1, y: mY1 }, { x: mX2, y: mY2 }]; }; 12156 12157 var str = "generateBezier(" + [mX1, mY1, mX2, mY2] + ")"; 12158 f.toString = function () { return str; }; 12159 12160 return f; 12161 } 12162 12163 /* Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */ 12164 /* Given a tension, friction, and duration, a simulation at 60FPS will first run without a defined duration in order to calculate the full path. A second pass 12165 then adjusts the time delta -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */ 12166 var generateSpringRK4 = (function () { 12167 function springAccelerationForState (state) { 12168 return (-state.tension * state.x) - (state.friction * state.v); 12169 } 12170 12171 function springEvaluateStateWithDerivative (initialState, dt, derivative) { 12172 var state = { 12173 x: initialState.x + derivative.dx * dt, 12174 v: initialState.v + derivative.dv * dt, 12175 tension: initialState.tension, 12176 friction: initialState.friction 12177 }; 12178 12179 return { dx: state.v, dv: springAccelerationForState(state) }; 12180 } 12181 12182 function springIntegrateState (state, dt) { 12183 var a = { 12184 dx: state.v, 12185 dv: springAccelerationForState(state) 12186 }, 12187 b = springEvaluateStateWithDerivative(state, dt * 0.5, a), 12188 c = springEvaluateStateWithDerivative(state, dt * 0.5, b), 12189 d = springEvaluateStateWithDerivative(state, dt, c), 12190 dxdt = 1.0 / 6.0 * (a.dx + 2.0 * (b.dx + c.dx) + d.dx), 12191 dvdt = 1.0 / 6.0 * (a.dv + 2.0 * (b.dv + c.dv) + d.dv); 12192 12193 state.x = state.x + dxdt * dt; 12194 state.v = state.v + dvdt * dt; 12195 12196 return state; 12197 } 12198 12199 return function springRK4Factory (tension, friction, duration) { 12200 12201 var initState = { 12202 x: -1, 12203 v: 0, 12204 tension: null, 12205 friction: null 12206 }, 12207 path = [0], 12208 time_lapsed = 0, 12209 tolerance = 1 / 10000, 12210 DT = 16 / 1000, 12211 have_duration, dt, last_state; 12212 12213 tension = parseFloat(tension) || 500; 12214 friction = parseFloat(friction) || 20; 12215 duration = duration || null; 12216 12217 initState.tension = tension; 12218 initState.friction = friction; 12219 12220 have_duration = duration !== null; 12221 12222 /* Calculate the actual time it takes for this animation to complete with the provided conditions. */ 12223 if (have_duration) { 12224 /* Run the simulation without a duration. */ 12225 time_lapsed = springRK4Factory(tension, friction); 12226 /* Compute the adjusted time delta. */ 12227 dt = time_lapsed / duration * DT; 12228 } else { 12229 dt = DT; 12230 } 12231 12232 while (true) { 12233 /* Next/step function .*/ 12234 last_state = springIntegrateState(last_state || initState, dt); 12235 /* Store the position. */ 12236 path.push(1 + last_state.x); 12237 time_lapsed += 16; 12238 /* If the change threshold is reached, break. */ 12239 if (!(Math.abs(last_state.x) > tolerance && Math.abs(last_state.v) > tolerance)) { 12240 break; 12241 } 12242 } 12243 12244 /* If duration is not defined, return the actual time required for completing this animation. Otherwise, return a closure that holds the 12245 computed path and returns a snapshot of the position according to a given percentComplete. */ 12246 return !have_duration ? time_lapsed : function(percentComplete) { return path[ (percentComplete * (path.length - 1)) | 0 ]; }; 12247 }; 12248 }()); 12249 12250 /* jQuery easings. */ 12251 Velocity.Easings = { 12252 linear: function(p) { return p; }, 12253 swing: function(p) { return 0.5 - Math.cos( p * Math.PI ) / 2 }, 12254 /* Bonus "spring" easing, which is a less exaggerated version of easeInOutElastic. */ 12255 spring: function(p) { return 1 - (Math.cos(p * 4.5 * Math.PI) * Math.exp(-p * 6)); } 12256 }; 12257 12258 /* CSS3 and Robert Penner easings. */ 12259 $.each( 12260 [ 12261 [ "ease", [ 0.25, 0.1, 0.25, 1.0 ] ], 12262 [ "ease-in", [ 0.42, 0.0, 1.00, 1.0 ] ], 12263 [ "ease-out", [ 0.00, 0.0, 0.58, 1.0 ] ], 12264 [ "ease-in-out", [ 0.42, 0.0, 0.58, 1.0 ] ], 12265 [ "easeInSine", [ 0.47, 0, 0.745, 0.715 ] ], 12266 [ "easeOutSine", [ 0.39, 0.575, 0.565, 1 ] ], 12267 [ "easeInOutSine", [ 0.445, 0.05, 0.55, 0.95 ] ], 12268 [ "easeInQuad", [ 0.55, 0.085, 0.68, 0.53 ] ], 12269 [ "easeOutQuad", [ 0.25, 0.46, 0.45, 0.94 ] ], 12270 [ "easeInOutQuad", [ 0.455, 0.03, 0.515, 0.955 ] ], 12271 [ "easeInCubic", [ 0.55, 0.055, 0.675, 0.19 ] ], 12272 [ "easeOutCubic", [ 0.215, 0.61, 0.355, 1 ] ], 12273 [ "easeInOutCubic", [ 0.645, 0.045, 0.355, 1 ] ], 12274 [ "easeInQuart", [ 0.895, 0.03, 0.685, 0.22 ] ], 12275 [ "easeOutQuart", [ 0.165, 0.84, 0.44, 1 ] ], 12276 [ "easeInOutQuart", [ 0.77, 0, 0.175, 1 ] ], 12277 [ "easeInQuint", [ 0.755, 0.05, 0.855, 0.06 ] ], 12278 [ "easeOutQuint", [ 0.23, 1, 0.32, 1 ] ], 12279 [ "easeInOutQuint", [ 0.86, 0, 0.07, 1 ] ], 12280 [ "easeInExpo", [ 0.95, 0.05, 0.795, 0.035 ] ], 12281 [ "easeOutExpo", [ 0.19, 1, 0.22, 1 ] ], 12282 [ "easeInOutExpo", [ 1, 0, 0, 1 ] ], 12283 [ "easeInCirc", [ 0.6, 0.04, 0.98, 0.335 ] ], 12284 [ "easeOutCirc", [ 0.075, 0.82, 0.165, 1 ] ], 12285 [ "easeInOutCirc", [ 0.785, 0.135, 0.15, 0.86 ] ] 12286 ], function(i, easingArray) { 12287 Velocity.Easings[easingArray[0]] = generateBezier.apply(null, easingArray[1]); 12288 }); 12289 12290 /* Determine the appropriate easing type given an easing input. */ 12291 function getEasing(value, duration) { 12292 var easing = value; 12293 12294 /* The easing option can either be a string that references a pre-registered easing, 12295 or it can be a two-/four-item array of integers to be converted into a bezier/spring function. */ 12296 if (Type.isString(value)) { 12297 /* Ensure that the easing has been assigned to jQuery's Velocity.Easings object. */ 12298 if (!Velocity.Easings[value]) { 12299 easing = false; 12300 } 12301 } else if (Type.isArray(value) && value.length === 1) { 12302 easing = generateStep.apply(null, value); 12303 } else if (Type.isArray(value) && value.length === 2) { 12304 /* springRK4 must be passed the animation's duration. */ 12305 /* Note: If the springRK4 array contains non-numbers, generateSpringRK4() returns an easing 12306 function generated with default tension and friction values. */ 12307 easing = generateSpringRK4.apply(null, value.concat([ duration ])); 12308 } else if (Type.isArray(value) && value.length === 4) { 12309 /* Note: If the bezier array contains non-numbers, generateBezier() returns false. */ 12310 easing = generateBezier.apply(null, value); 12311 } else { 12312 easing = false; 12313 } 12314 12315 /* Revert to the Velocity-wide default easing type, or fall back to "swing" (which is also jQuery's default) 12316 if the Velocity-wide default has been incorrectly modified. */ 12317 if (easing === false) { 12318 if (Velocity.Easings[Velocity.defaults.easing]) { 12319 easing = Velocity.defaults.easing; 12320 } else { 12321 easing = EASING_DEFAULT; 12322 } 12323 } 12324 12325 return easing; 12326 } 12327 12328 /***************** 12329 CSS Stack 12330 *****************/ 12331 12332 /* The CSS object is a highly condensed and performant CSS stack that fully replaces jQuery's. 12333 It handles the validation, getting, and setting of both standard CSS properties and CSS property hooks. */ 12334 /* Note: A "CSS" shorthand is aliased so that our code is easier to read. */ 12335 var CSS = Velocity.CSS = { 12336 12337 /************* 12338 RegEx 12339 *************/ 12340 12341 RegEx: { 12342 isHex: /^#([A-f\d]{3}){1,2}$/i, 12343 /* Unwrap a property value's surrounding text, e.g. "rgba(4, 3, 2, 1)" ==> "4, 3, 2, 1" and "rect(4px 3px 2px 1px)" ==> "4px 3px 2px 1px". */ 12344 valueUnwrap: /^[A-z]+\((.*)\)$/i, 12345 wrappedValueAlreadyExtracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/, 12346 /* Split a multi-value property into an array of subvalues, e.g. "rgba(4, 3, 2, 1) 4px 3px 2px 1px" ==> [ "rgba(4, 3, 2, 1)", "4px", "3px", "2px", "1px" ]. */ 12347 valueSplit: /([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/ig 12348 }, 12349 12350 /************ 12351 Lists 12352 ************/ 12353 12354 Lists: { 12355 colors: [ "fill", "stroke", "stopColor", "color", "backgroundColor", "borderColor", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "outlineColor" ], 12356 transformsBase: [ "translateX", "translateY", "scale", "scaleX", "scaleY", "skewX", "skewY", "rotateZ" ], 12357 transforms3D: [ "transformPerspective", "translateZ", "scaleZ", "rotateX", "rotateY" ] 12358 }, 12359 12360 /************ 12361 Hooks 12362 ************/ 12363 12364 /* Hooks allow a subproperty (e.g. "boxShadowBlur") of a compound-value CSS property 12365 (e.g. "boxShadow: X Y Blur Spread Color") to be animated as if it were a discrete property. */ 12366 /* Note: Beyond enabling fine-grained property animation, hooking is necessary since Velocity only 12367 tweens properties with single numeric values; unlike CSS transitions, Velocity does not interpolate compound-values. */ 12368 Hooks: { 12369 /******************** 12370 Registration 12371 ********************/ 12372 12373 /* Templates are a concise way of indicating which subproperties must be individually registered for each compound-value CSS property. */ 12374 /* Each template consists of the compound-value's base name, its constituent subproperty names, and those subproperties' default values. */ 12375 templates: { 12376 "textShadow": [ "Color X Y Blur", "black 0px 0px 0px" ], 12377 /* Todo: Add support for inset boxShadows. (webkit places it last whereas IE places it first.) */ 12378 "boxShadow": [ "Color X Y Blur Spread", "black 0px 0px 0px 0px" ], 12379 "clip": [ "Top Right Bottom Left", "0px 0px 0px 0px" ], 12380 "backgroundPosition": [ "X Y", "0% 0%" ], 12381 "transformOrigin": [ "X Y Z", "50% 50% 0px" ], 12382 "perspectiveOrigin": [ "X Y", "50% 50%" ] 12383 }, 12384 12385 /* A "registered" hook is one that has been converted from its template form into a live, 12386 tweenable property. It contains data to associate it with its root property. */ 12387 registered: { 12388 /* Note: A registered hook looks like this ==> textShadowBlur: [ "textShadow", 3 ], 12389 which consists of the subproperty's name, the associated root property's name, 12390 and the subproperty's position in the root's value. */ 12391 }, 12392 /* Convert the templates into individual hooks then append them to the registered object above. */ 12393 register: function () { 12394 /* Color hooks registration: Colors are defaulted to white -- as opposed to black -- since colors that are 12395 currently set to "transparent" default to their respective template below when color-animated, 12396 and white is typically a closer match to transparent than black is. An exception is made for text ("color"), 12397 which is almost always set closer to black than white. */ 12398 for (var i = 0; i < CSS.Lists.colors.length; i++) { 12399 var rgbComponents = (CSS.Lists.colors[i] === "color") ? "0 0 0 1" : "255 255 255 1"; 12400 CSS.Hooks.templates[CSS.Lists.colors[i]] = [ "Red Green Blue Alpha", rgbComponents ]; 12401 } 12402 12403 var rootProperty, 12404 hookTemplate, 12405 hookNames; 12406 12407 /* In IE, color values inside compound-value properties are positioned at the end the value instead of at the beginning. 12408 Thus, we re-arrange the templates accordingly. */ 12409 if (IE) { 12410 for (rootProperty in CSS.Hooks.templates) { 12411 hookTemplate = CSS.Hooks.templates[rootProperty]; 12412 hookNames = hookTemplate[0].split(" "); 12413 12414 var defaultValues = hookTemplate[1].match(CSS.RegEx.valueSplit); 12415 12416 if (hookNames[0] === "Color") { 12417 /* Reposition both the hook's name and its default value to the end of their respective strings. */ 12418 hookNames.push(hookNames.shift()); 12419 defaultValues.push(defaultValues.shift()); 12420 12421 /* Replace the existing template for the hook's root property. */ 12422 CSS.Hooks.templates[rootProperty] = [ hookNames.join(" "), defaultValues.join(" ") ]; 12423 } 12424 } 12425 } 12426 12427 /* Hook registration. */ 12428 for (rootProperty in CSS.Hooks.templates) { 12429 hookTemplate = CSS.Hooks.templates[rootProperty]; 12430 hookNames = hookTemplate[0].split(" "); 12431 12432 for (var i in hookNames) { 12433 var fullHookName = rootProperty + hookNames[i], 12434 hookPosition = i; 12435 12436 /* For each hook, register its full name (e.g. textShadowBlur) with its root property (e.g. textShadow) 12437 and the hook's position in its template's default value string. */ 12438 CSS.Hooks.registered[fullHookName] = [ rootProperty, hookPosition ]; 12439 } 12440 } 12441 }, 12442 12443 /***************************** 12444 Injection and Extraction 12445 *****************************/ 12446 12447 /* Look up the root property associated with the hook (e.g. return "textShadow" for "textShadowBlur"). */ 12448 /* Since a hook cannot be set directly (the browser won't recognize it), style updating for hooks is routed through the hook's root property. */ 12449 getRoot: function (property) { 12450 var hookData = CSS.Hooks.registered[property]; 12451 12452 if (hookData) { 12453 return hookData[0]; 12454 } else { 12455 /* If there was no hook match, return the property name untouched. */ 12456 return property; 12457 } 12458 }, 12459 /* Convert any rootPropertyValue, null or otherwise, into a space-delimited list of hook values so that 12460 the targeted hook can be injected or extracted at its standard position. */ 12461 cleanRootPropertyValue: function(rootProperty, rootPropertyValue) { 12462 /* If the rootPropertyValue is wrapped with "rgb()", "clip()", etc., remove the wrapping to normalize the value before manipulation. */ 12463 if (CSS.RegEx.valueUnwrap.test(rootPropertyValue)) { 12464 rootPropertyValue = rootPropertyValue.match(CSS.RegEx.valueUnwrap)[1]; 12465 } 12466 12467 /* If rootPropertyValue is a CSS null-value (from which there's inherently no hook value to extract), 12468 default to the root's default value as defined in CSS.Hooks.templates. */ 12469 /* Note: CSS null-values include "none", "auto", and "transparent". They must be converted into their 12470 zero-values (e.g. textShadow: "none" ==> textShadow: "0px 0px 0px black") for hook manipulation to proceed. */ 12471 if (CSS.Values.isCSSNullValue(rootPropertyValue)) { 12472 rootPropertyValue = CSS.Hooks.templates[rootProperty][1]; 12473 } 12474 12475 return rootPropertyValue; 12476 }, 12477 /* Extracted the hook's value from its root property's value. This is used to get the starting value of an animating hook. */ 12478 extractValue: function (fullHookName, rootPropertyValue) { 12479 var hookData = CSS.Hooks.registered[fullHookName]; 12480 12481 if (hookData) { 12482 var hookRoot = hookData[0], 12483 hookPosition = hookData[1]; 12484 12485 rootPropertyValue = CSS.Hooks.cleanRootPropertyValue(hookRoot, rootPropertyValue); 12486 12487 /* Split rootPropertyValue into its constituent hook values then grab the desired hook at its standard position. */ 12488 return rootPropertyValue.toString().match(CSS.RegEx.valueSplit)[hookPosition]; 12489 } else { 12490 /* If the provided fullHookName isn't a registered hook, return the rootPropertyValue that was passed in. */ 12491 return rootPropertyValue; 12492 } 12493 }, 12494 /* Inject the hook's value into its root property's value. This is used to piece back together the root property 12495 once Velocity has updated one of its individually hooked values through tweening. */ 12496 injectValue: function (fullHookName, hookValue, rootPropertyValue) { 12497 var hookData = CSS.Hooks.registered[fullHookName]; 12498 12499 if (hookData) { 12500 var hookRoot = hookData[0], 12501 hookPosition = hookData[1], 12502 rootPropertyValueParts, 12503 rootPropertyValueUpdated; 12504 12505 rootPropertyValue = CSS.Hooks.cleanRootPropertyValue(hookRoot, rootPropertyValue); 12506 12507 /* Split rootPropertyValue into its individual hook values, replace the targeted value with hookValue, 12508 then reconstruct the rootPropertyValue string. */ 12509 rootPropertyValueParts = rootPropertyValue.toString().match(CSS.RegEx.valueSplit); 12510 rootPropertyValueParts[hookPosition] = hookValue; 12511 rootPropertyValueUpdated = rootPropertyValueParts.join(" "); 12512 12513 return rootPropertyValueUpdated; 12514 } else { 12515 /* If the provided fullHookName isn't a registered hook, return the rootPropertyValue that was passed in. */ 12516 return rootPropertyValue; 12517 } 12518 } 12519 }, 12520 12521 /******************* 12522 Normalizations 12523 *******************/ 12524 12525 /* Normalizations standardize CSS property manipulation by pollyfilling browser-specific implementations (e.g. opacity) 12526 and reformatting special properties (e.g. clip, rgba) to look like standard ones. */ 12527 Normalizations: { 12528 /* Normalizations are passed a normalization target (either the property's name, its extracted value, or its injected value), 12529 the targeted element (which may need to be queried), and the targeted property value. */ 12530 registered: { 12531 clip: function (type, element, propertyValue) { 12532 switch (type) { 12533 case "name": 12534 return "clip"; 12535 /* Clip needs to be unwrapped and stripped of its commas during extraction. */ 12536 case "extract": 12537 var extracted; 12538 12539 /* If Velocity also extracted this value, skip extraction. */ 12540 if (CSS.RegEx.wrappedValueAlreadyExtracted.test(propertyValue)) { 12541 extracted = propertyValue; 12542 } else { 12543 /* Remove the "rect()" wrapper. */ 12544 extracted = propertyValue.toString().match(CSS.RegEx.valueUnwrap); 12545 12546 /* Strip off commas. */ 12547 extracted = extracted ? extracted[1].replace(/,(\s+)?/g, " ") : propertyValue; 12548 } 12549 12550 return extracted; 12551 /* Clip needs to be re-wrapped during injection. */ 12552 case "inject": 12553 return "rect(" + propertyValue + ")"; 12554 } 12555 }, 12556 12557 blur: function(type, element, propertyValue) { 12558 switch (type) { 12559 case "name": 12560 return "-webkit-filter"; 12561 case "extract": 12562 var extracted = parseFloat(propertyValue); 12563 12564 /* If extracted is NaN, meaning the value isn't already extracted. */ 12565 if (!(extracted || extracted === 0)) { 12566 var blurComponent = propertyValue.toString().match(/blur\(([0-9]+[A-z]+)\)/i); 12567 12568 /* If the filter string had a blur component, return just the blur value and unit type. */ 12569 if (blurComponent) { 12570 extracted = blurComponent[1]; 12571 /* If the component doesn't exist, default blur to 0. */ 12572 } else { 12573 extracted = 0; 12574 } 12575 } 12576 12577 return extracted; 12578 /* Blur needs to be re-wrapped during injection. */ 12579 case "inject": 12580 /* For the blur effect to be fully de-applied, it needs to be set to "none" instead of 0. */ 12581 if (!parseFloat(propertyValue)) { 12582 return "none"; 12583 } else { 12584 return "blur(" + propertyValue + ")"; 12585 } 12586 } 12587 }, 12588 12589 /* <=IE8 do not support the standard opacity property. They use filter:alpha(opacity=INT) instead. */ 12590 opacity: function (type, element, propertyValue) { 12591 if (IE <= 8) { 12592 switch (type) { 12593 case "name": 12594 return "filter"; 12595 case "extract": 12596 /* <=IE8 return a "filter" value of "alpha(opacity=\d{1,3})". 12597 Extract the value and convert it to a decimal value to match the standard CSS opacity property's formatting. */ 12598 var extracted = propertyValue.toString().match(/alpha\(opacity=(.*)\)/i); 12599 12600 if (extracted) { 12601 /* Convert to decimal value. */ 12602 propertyValue = extracted[1] / 100; 12603 } else { 12604 /* When extracting opacity, default to 1 since a null value means opacity hasn't been set. */ 12605 propertyValue = 1; 12606 } 12607 12608 return propertyValue; 12609 case "inject": 12610 /* Opacified elements are required to have their zoom property set to a non-zero value. */ 12611 element.style.zoom = 1; 12612 12613 /* Setting the filter property on elements with certain font property combinations can result in a 12614 highly unappealing ultra-bolding effect. There's no way to remedy this throughout a tween, but dropping the 12615 value altogether (when opacity hits 1) at leasts ensures that the glitch is gone post-tweening. */ 12616 if (parseFloat(propertyValue) >= 1) { 12617 return ""; 12618 } else { 12619 /* As per the filter property's spec, convert the decimal value to a whole number and wrap the value. */ 12620 return "alpha(opacity=" + parseInt(parseFloat(propertyValue) * 100, 10) + ")"; 12621 } 12622 } 12623 /* With all other browsers, normalization is not required; return the same values that were passed in. */ 12624 } else { 12625 switch (type) { 12626 case "name": 12627 return "opacity"; 12628 case "extract": 12629 return propertyValue; 12630 case "inject": 12631 return propertyValue; 12632 } 12633 } 12634 } 12635 }, 12636 12637 /***************************** 12638 Batched Registrations 12639 *****************************/ 12640 12641 /* Note: Batched normalizations extend the CSS.Normalizations.registered object. */ 12642 register: function () { 12643 12644 /***************** 12645 Transforms 12646 *****************/ 12647 12648 /* Transforms are the subproperties contained by the CSS "transform" property. Transforms must undergo normalization 12649 so that they can be referenced in a properties map by their individual names. */ 12650 /* Note: When transforms are "set", they are actually assigned to a per-element transformCache. When all transform 12651 setting is complete complete, CSS.flushTransformCache() must be manually called to flush the values to the DOM. 12652 Transform setting is batched in this way to improve performance: the transform style only needs to be updated 12653 once when multiple transform subproperties are being animated simultaneously. */ 12654 /* Note: IE9 and Android Gingerbread have support for 2D -- but not 3D -- transforms. Since animating unsupported 12655 transform properties results in the browser ignoring the *entire* transform string, we prevent these 3D values 12656 from being normalized for these browsers so that tweening skips these properties altogether 12657 (since it will ignore them as being unsupported by the browser.) */ 12658 if (!(IE <= 9) && !Velocity.State.isGingerbread) { 12659 /* Note: Since the standalone CSS "perspective" property and the CSS transform "perspective" subproperty 12660 share the same name, the latter is given a unique token within Velocity: "transformPerspective". */ 12661 CSS.Lists.transformsBase = CSS.Lists.transformsBase.concat(CSS.Lists.transforms3D); 12662 } 12663 12664 for (var i = 0; i < CSS.Lists.transformsBase.length; i++) { 12665 /* Wrap the dynamically generated normalization function in a new scope so that transformName's value is 12666 paired with its respective function. (Otherwise, all functions would take the final for loop's transformName.) */ 12667 (function() { 12668 var transformName = CSS.Lists.transformsBase[i]; 12669 12670 CSS.Normalizations.registered[transformName] = function (type, element, propertyValue) { 12671 switch (type) { 12672 /* The normalized property name is the parent "transform" property -- the property that is actually set in CSS. */ 12673 case "name": 12674 return "transform"; 12675 /* Transform values are cached onto a per-element transformCache object. */ 12676 case "extract": 12677 /* If this transform has yet to be assigned a value, return its null value. */ 12678 if (Data(element) === undefined || Data(element).transformCache[transformName] === undefined) { 12679 /* Scale CSS.Lists.transformsBase default to 1 whereas all other transform properties default to 0. */ 12680 return /^scale/i.test(transformName) ? 1 : 0; 12681 /* When transform values are set, they are wrapped in parentheses as per the CSS spec. 12682 Thus, when extracting their values (for tween calculations), we strip off the parentheses. */ 12683 } else { 12684 return Data(element).transformCache[transformName].replace(/[()]/g, ""); 12685 } 12686 case "inject": 12687 var invalid = false; 12688 12689 /* If an individual transform property contains an unsupported unit type, the browser ignores the *entire* transform property. 12690 Thus, protect users from themselves by skipping setting for transform values supplied with invalid unit types. */ 12691 /* Switch on the base transform type; ignore the axis by removing the last letter from the transform's name. */ 12692 switch (transformName.substr(0, transformName.length - 1)) { 12693 /* Whitelist unit types for each transform. */ 12694 case "translate": 12695 invalid = !/(%|px|em|rem|vw|vh|\d)$/i.test(propertyValue); 12696 break; 12697 /* Since an axis-free "scale" property is supported as well, a little hack is used here to detect it by chopping off its last letter. */ 12698 case "scal": 12699 case "scale": 12700 /* Chrome on Android has a bug in which scaled elements blur if their initial scale 12701 value is below 1 (which can happen with forcefeeding). Thus, we detect a yet-unset scale property 12702 and ensure that its first value is always 1. More info: http://stackoverflow.com/questions/10417890/css3-animations-with-transform-causes-blurred-elements-on-webkit/10417962#10417962 */ 12703 if (Velocity.State.isAndroid && Data(element).transformCache[transformName] === undefined && propertyValue < 1) { 12704 propertyValue = 1; 12705 } 12706 12707 invalid = !/(\d)$/i.test(propertyValue); 12708 break; 12709 case "skew": 12710 invalid = !/(deg|\d)$/i.test(propertyValue); 12711 break; 12712 case "rotate": 12713 invalid = !/(deg|\d)$/i.test(propertyValue); 12714 break; 12715 } 12716 12717 if (!invalid) { 12718 /* As per the CSS spec, wrap the value in parentheses. */ 12719 Data(element).transformCache[transformName] = "(" + propertyValue + ")"; 12720 } 12721 12722 /* Although the value is set on the transformCache object, return the newly-updated value for the calling code to process as normal. */ 12723 return Data(element).transformCache[transformName]; 12724 } 12725 }; 12726 })(); 12727 } 12728 12729 /************* 12730 Colors 12731 *************/ 12732 12733 /* Since Velocity only animates a single numeric value per property, color animation is achieved by hooking the individual RGBA components of CSS color properties. 12734 Accordingly, color values must be normalized (e.g. "#ff0000", "red", and "rgb(255, 0, 0)" ==> "255 0 0 1") so that their components can be injected/extracted by CSS.Hooks logic. */ 12735 for (var i = 0; i < CSS.Lists.colors.length; i++) { 12736 /* Wrap the dynamically generated normalization function in a new scope so that colorName's value is paired with its respective function. 12737 (Otherwise, all functions would take the final for loop's colorName.) */ 12738 (function () { 12739 var colorName = CSS.Lists.colors[i]; 12740 12741 /* Note: In IE<=8, which support rgb but not rgba, c
12741olor properties are reverted to rgb by stripping off the alpha component. */ 12742 CSS.Normalizations.registered[colorName] = function(type, element, propertyValue) { 12743 switch (type) { 12744 case "name": 12745 return colorName; 12746 /* Convert all color values into the rgb format. (Old IE can return hex values and color names instead of rgb/rgba.) */ 12747 case "extract": 12748 var extracted; 12749 12750 /* If the color is already in its hookable form (e.g. "255 255 255 1") due to having been previously extracted, skip extraction. */ 12751 if (CSS.RegEx.wrappedValueAlreadyExtracted.test(propertyValue)) { 12752 extracted = propertyValue; 12753 } else { 12754 var converted, 12755 colorNames = { 12756 black: "rgb(0, 0, 0)", 12757 blue: "rgb(0, 0, 255)", 12758 gray: "rgb(128, 128, 128)", 12759 green: "rgb(0, 128, 0)", 12760 red: "rgb(255, 0, 0)", 12761 white: "rgb(255, 255, 255)" 12762 }; 12763 12764 /* Convert color names to rgb. */ 12765 if (/^[A-z]+$/i.test(propertyValue)) { 12766 if (colorNames[propertyValue] !== undefined) { 12767 converted = colorNames[propertyValue] 12768 } else { 12769 /* If an unmatched color name is provided, default to black. */ 12770 converted = colorNames.black; 12771 } 12772 /* Convert hex values to rgb. */ 12773 } else if (CSS.RegEx.isHex.test(propertyValue)) { 12774 converted = "rgb(" + CSS.Values.hexToRgb(propertyValue).join(" ") + ")"; 12775 /* If the provided color doesn't match any of the accepted color formats, default to black. */ 12776 } else if (!(/^rgba?\(/i.test(propertyValue))) { 12777 converted = colorNames.black; 12778 } 12779 12780 /* Remove the surrounding "rgb/rgba()" string then replace commas with spaces and strip 12781 repeated spaces (in case the value included spaces to begin with). */ 12782 extracted = (converted || propertyValue).toString().match(CSS.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g, " "); 12783 } 12784 12785 /* So long as this isn't <=IE8, add a fourth (alpha) component if it's missing and default it to 1 (visible). */ 12786 if (!(IE <= 8) && extracted.split(" ").length === 3) { 12787 extracted += " 1"; 12788 } 12789 12790 return extracted; 12791 case "inject": 12792 /* If this is IE<=8 and an alpha component exists, strip it off. */ 12793 if (IE <= 8) { 12794 if (propertyValue.split(" ").length === 4) { 12795 propertyValue = propertyValue.split(/\s+/).slice(0, 3).join(" "); 12796 } 12797 /* Otherwise, add a fourth (alpha) component if it's missing and default it to 1 (visible). */ 12798 } else if (propertyValue.split(" ").length === 3) { 12799 propertyValue += " 1"; 12800 } 12801 12802 /* Re-insert the browser-appropriate wrapper("rgb/rgba()"), insert commas, and strip off decimal units 12803 on all values but the fourth (R, G, and B only accept whole numbers). */ 12804 return (IE <= 8 ? "rgb" : "rgba") + "(" + propertyValue.replace(/\s+/g, ",").replace(/\.(\d)+(?=,)/g, "") + ")"; 12805 } 12806 }; 12807 })(); 12808 } 12809 } 12810 }, 12811 12812 /************************ 12813 CSS Property Names 12814 ************************/ 12815 12816 Names: {
vendor: 22,963 bytes, lines 12817-13177
12817 /* Camelcase a property name into its JavaScript notation (e.g. "background-color" ==> "backgroundColor"). 12818 Camelcasing is used to normalize property names between and across calls. */ 12819 camelCase: function (property) { 12820 return property.replace(/-(\w)/g, function (match, subMatch) { 12821 return subMatch.toUpperCase(); 12822 }); 12823 }, 12824 12825 /* For SVG elements, some properties (namely, dimensional ones) are GET/SET via the element's HTML attributes (instead of via CSS styles). */ 12826 SVGAttribute: function (property) { 12827 var SVGAttributes = "width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2"; 12828 12829 /* Certain browsers require an SVG transform to be applied as an attribute. (Otherwise, application via CSS is preferable due to 3D support.) */ 12830 if (IE || (Velocity.State.isAndroid && !Velocity.State.isChrome)) { 12831 SVGAttributes += "|transform"; 12832 } 12833 12834 return new RegExp("^(" + SVGAttributes + ")$", "i").test(property); 12835 }, 12836 12837 /* Determine whether a property should be set with a vendor prefix. */ 12838 /* If a prefixed version of the property exists, return it. Otherwise, return the original property name. 12839 If the property is not at all supported by the browser, return a false flag. */ 12840 prefixCheck: function (property) { 12841 /* If this property has already been checked, return the cached value. */ 12842 if (Velocity.State.prefixMatches[property]) { 12843 return [ Velocity.State.prefixMatches[property], true ]; 12844 } else { 12845 var vendors = [ "", "Webkit", "Moz", "ms", "O" ]; 12846 12847 for (var i = 0, vendorsLength = vendors.length; i < vendorsLength; i++) { 12848 var propertyPrefixed; 12849 12850 if (i === 0) { 12851 propertyPrefixed = property; 12852 } else { 12853 /* Capitalize the first letter of the property to conform to JavaScript vendor prefix notation (e.g. webkitFilter). */ 12854 propertyPrefixed = vendors[i] + property.replace(/^\w/, function(match) { return match.toUpperCase(); }); 12855 } 12856 12857 /* Check if the browser supports this property as prefixed. */ 12858 if (Type.isString(Velocity.State.prefixElement.style[propertyPrefixed])) { 12859 /* Cache the match. */ 12860 Velocity.State.prefixMatches[property] = propertyPrefixed; 12861 12862 return [ propertyPrefixed, true ]; 12863 } 12864 } 12865 12866 /* If the browser doesn't support this property in any form, include a false flag so that the caller can decide how to proceed. */ 12867 return [ property, false ]; 12868 } 12869 } 12870 }, 12871 12872 /************************ 12873 CSS Property Values 12874 ************************/ 12875 12876 Values: { 12877 /* Hex to RGB conversion. Copyright Tim Down: http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb */ 12878 hexToRgb: function (hex) { 12879 var shortformRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, 12880 longformRegex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, 12881 rgbParts; 12882 12883 hex = hex.replace(shortformRegex, function (m, r, g, b) { 12884 return r + r + g + g + b + b; 12885 }); 12886 12887 rgbParts = longformRegex.exec(hex); 12888 12889 return rgbParts ? [ parseInt(rgbParts[1], 16), parseInt(rgbParts[2], 16), parseInt(rgbParts[3], 16) ] : [ 0, 0, 0 ]; 12890 }, 12891 12892 isCSSNullValue: function (value) { 12893 /* The browser defaults CSS values that have not been set to either 0 or one of several possible null-value strings. 12894 Thus, we check for both falsiness and these special strings. */ 12895 /* Null-value checking is performed to default the special strings to 0 (for the sake of tweening) or their hook 12896 templates as defined as CSS.Hooks (for the sake of hook injection/extraction). */ 12897 /* Note: Chrome returns "rgba(0, 0, 0, 0)" for an undefined color whereas IE returns "transparent". */ 12898 return (value == 0 || /^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(value)); 12899 }, 12900 12901 /* Retrieve a property's default unit type. Used for assigning a unit type when one is not supplied by the user. */ 12902 getUnitType: function (property) { 12903 if (/^(rotate|skew)/i.test(property)) { 12904 return "deg"; 12905 } else if (/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(property)) { 12906 /* The above properties are unitless. */ 12907 return ""; 12908 } else { 12909 /* Default to px for all other properties. */ 12910 return "px"; 12911 } 12912 }, 12913 12914 /* HTML elements default to an associated display type when they're not set to display:none. */ 12915 /* Note: This function is used for correctly setting the non-"none" display value in certain Velocity redirects, such as fadeIn/Out. */ 12916 getDisplayType: function (element) { 12917 var tagName = element && element.tagName.toString().toLowerCase(); 12918 12919 if (/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(tagName)) { 12920 return "inline"; 12921 } else if (/^(li)$/i.test(tagName)) { 12922 return "list-item"; 12923 } else if (/^(tr)$/i.test(tagName)) { 12924 return "table-row"; 12925 /* Default to "block" when no match is found. */ 12926 } else { 12927 return "block"; 12928 } 12929 }, 12930 12931 /* The class add/remove functions are used to temporarily apply a "velocity-animating" class to elements while they're animating. */ 12932 addClass: function (element, className) { 12933 if (element.classList) { 12934 element.classList.add(className); 12935 } else { 12936 element.className += (element.className.length ? " " : "") + className; 12937 } 12938 }, 12939 12940 removeClass: function (element, className) { 12941 if (element.classList) { 12942 element.classList.remove(className); 12943 } else { 12944 element.className = element.className.toString().replace(new RegExp("(^|\\s)" + className.split(" ").join("|") + "(\\s|$)", "gi"), " "); 12945 } 12946 } 12947 }, 12948 12949 /**************************** 12950 Style Getting & Setting 12951 ****************************/ 12952 12953 /* The singular getPropertyValue, which routes the logic for all normalizations, hooks, and standard CSS properties. */ 12954 getPropertyValue: function (element, property, rootPropertyValue, forceStyleLookup) { 12955 /* Get an element's computed property value. */ 12956 /* Note: Retrieving the value of a CSS property cannot simply be performed by checking an element's 12957 style attribute (which only reflects user-defined values). Instead, the browser must be queried for a property's 12958 *computed* value. You can read more about getComputedStyle here: https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle */ 12959 function computePropertyValue (element, property) { 12960 /* When box-sizing isn't set to border-box, height and width style values are incorrectly computed when an 12961 element's scrollbars are visible (which expands the element's dimensions). Thus, we defer to the more accurate 12962 offsetHeight/Width property, which includes the total dimensions for interior, border, padding, and scrollbar. 12963 We subtract border and padding to get the sum of interior + scrollbar. */ 12964 var computedValue = 0; 12965 12966 /* IE<=8 doesn't support window.getComputedStyle, thus we defer to jQuery, which has an extensive array 12967 of hacks to accurately retrieve IE8 property values. Re-implementing that logic here is not worth bloating the 12968 codebase for a dying browser. The performance repercussions of using jQuery here are minimal since 12969 Velocity is optimized to rarely (and sometimes never) query the DOM. Further, the $.css() codepath isn't that slow. */ 12970 if (IE <= 8) { 12971 computedValue = $.css(element, property); /* GET */ 12972 /* All other browsers support getComputedStyle. The returned live object reference is cached onto its 12973 associated element so that it does not need to be refetched upon every GET. */ 12974 } else { 12975 /* Browsers do not return height and width values for elements that are set to display:"none". Thus, we temporarily 12976 toggle display to the element type's default value. */ 12977 var toggleDisplay = false; 12978 12979 if (/^(width|height)$/.test(property) && CSS.getPropertyValue(element, "display") === 0) { 12980 toggleDisplay = true; 12981 CSS.setPropertyValue(element, "display", CSS.Values.getDisplayType(element)); 12982 } 12983 12984 function revertDisplay () { 12985 if (toggleDisplay) { 12986 CSS.setPropertyValue(element, "display", "none"); 12987 } 12988 } 12989 12990 if (!forceStyleLookup) { 12991 if (property === "height" && CSS.getPropertyValue(element, "boxSizing").toString().toLowerCase() !== "border-box") { 12992 var contentBoxHeight = element.offsetHeight - (parseFloat(CSS.getPropertyValue(element, "borderTopWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "borderBottomWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingTop")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingBottom")) || 0); 12993 revertDisplay(); 12994 12995 return contentBoxHeight; 12996 } else if (property === "width" && CSS.getPropertyValue(element, "boxSizing").toString().toLowerCase() !== "border-box") { 12997 var contentBoxWidth = element.offsetWidth - (parseFloat(CSS.getPropertyValue(element, "borderLeftWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "borderRightWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingLeft")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingRight")) || 0); 12998 revertDisplay(); 12999 13000 return contentBoxWidth; 13001 } 13002 } 13003 13004 var computedStyle; 13005 13006 /* For elements that Velocity hasn't been called on directly (e.g. when Velocity queries the DOM on behalf 13007 of a parent of an element its animating), perform a direct getComputedStyle lookup since the object isn't cached. */ 13008 if (Data(element) === undefined) { 13009 computedStyle = window.getComputedStyle(element, null); /* GET */ 13010 /* If the computedStyle object has yet to be cached, do so now. */ 13011 } else if (!Data(element).computedStyle) { 13012 computedStyle = Data(element).computedStyle = window.getComputedStyle(element, null); /* GET */ 13013 /* If computedStyle is cached, use it. */ 13014 } else { 13015 computedStyle = Data(element).computedStyle; 13016 } 13017 13018 /* IE and Firefox do not return a value for the generic borderColor -- they only return individual values for each border side's color. 13019 As a polyfill for querying individual border side colors, just return the top border's color. */ 13020 if ((IE || Velocity.State.isFirefox) && property === "borderColor") { 13021 property = "borderTopColor"; 13022 } 13023 13024 /* IE9 has a bug in which the "filter" property must be accessed from computedStyle using the getPropertyValue method 13025 instead of a direct property lookup. The getPropertyValue method is slower than a direct lookup, which is why we avoid it by default. */ 13026 if (IE === 9 && property === "filter") { 13027 computedValue = computedStyle.getPropertyValue(property); /* GET */ 13028 } else { 13029 computedValue = computedStyle[property]; 13030 } 13031 13032 /* Fall back to the property's style value (if defined) when computedValue returns nothing, 13033 which can happen when the element hasn't been painted. */ 13034 if (computedValue === "" || computedValue === null) { 13035 computedValue = element.style[property]; 13036 } 13037 13038 revertDisplay(); 13039 } 13040 13041 /* For top, right, bottom, and left (TRBL) values that are set to "auto" on elements of "fixed" or "absolute" position, 13042 defer to jQuery for converting "auto" to a numeric value. (For elements with a "static" or "relative" position, "auto" has the same 13043 effect as being set to 0, so no conversion is necessary.) */ 13044 /* An example of why numeric conversion is necessary: When an element with "position:absolute" has an untouched "left" 13045 property, which reverts to "auto", left's value is 0 relative to its parent element, but is often non-zero relative 13046 to its *containing* (not parent) element, which is the nearest "position:relative" ancestor or the viewport (and always the viewport in the case of "position:fixed"). */ 13047 if (computedValue === "auto" && /^(top|right|bottom|left)$/i.test(property)) { 13048 var position = computePropertyValue(element, "position"); /* GET */ 13049 13050 /* For absolute positioning, jQuery's $.position() only returns values for top and left; 13051 right and bottom will have their "auto" value reverted to 0. */ 13052 /* Note: A jQuery object must be created here since jQuery doesn't have a low-level alias for $.position(). 13053 Not a big deal since we're currently in a GET batch anyway. */ 13054 if (position === "fixed" || (position === "absolute" && /top|left/i.test(property))) { 13055 /* Note: jQuery strips the pixel unit from its returned values; we re-add it here to conform with computePropertyValue's behavior. */ 13056 computedValue = $(element).position()[property] + "px"; /* GET */ 13057 } 13058 } 13059 13060 return computedValue; 13061 } 13062 13063 var propertyValue; 13064 13065 /* If this is a hooked property (e.g. "clipLeft" instead of the root property of "clip"), 13066 extract the hook's value from a normalized rootPropertyValue using CSS.Hooks.extractValue(). */ 13067 if (CSS.Hooks.registered[property]) { 13068 var hook = property, 13069 hookRoot = CSS.Hooks.getRoot(hook); 13070 13071 /* If a cached rootPropertyValue wasn't passed in (which Velocity always attempts to do in order to avoid requerying the DOM), 13072 query the DOM for the root property's value. */ 13073 if (rootPropertyValue === undefined) { 13074 /* Since the browser is now being directly queried, use the official post-prefixing property name for this lookup. */ 13075 rootPropertyValue = CSS.getPropertyValue(element, CSS.Names.prefixCheck(hookRoot)[0]); /* GET */ 13076 } 13077 13078 /* If this root has a normalization registered, peform the associated normalization extraction. */ 13079 if (CSS.Normalizations.registered[hookRoot]) { 13080 rootPropertyValue = CSS.Normalizations.registered[hookRoot]("extract", element, rootPropertyValue); 13081 } 13082 13083 /* Extract the hook's value. */ 13084 propertyValue = CSS.Hooks.extractValue(hook, rootPropertyValue); 13085 13086 /* If this is a normalized property (e.g. "opacity" becomes "filter" in <=IE8) or "translateX" becomes "transform"), 13087 normalize the property's name and value, and handle the special case of transforms. */ 13088 /* Note: Normalizing a property is mutually exclusive from hooking a property since hook-extracted values are strictly 13089 numerical and therefore do not require normalization extraction. */ 13090 } else if (CSS.Normalizations.registered[property]) { 13091 var normalizedPropertyName, 13092 normalizedPropertyValue; 13093 13094 normalizedPropertyName = CSS.Normalizations.registered[property]("name", element); 13095 13096 /* Transform values are calculated via normalization extraction (see below), which checks against the element's transformCache. 13097 At no point do transform GETs ever actually query the DOM; initial stylesheet values are never processed. 13098 This is because parsing 3D transform matrices is not always accurate and would bloat our codebase; 13099 thus, normalization extraction defaults initial transform values to their zero-values (e.g. 1 for scaleX and 0 for translateX). */ 13100 if (normalizedPropertyName !== "transform") { 13101 normalizedPropertyValue = computePropertyValue(element, CSS.Names.prefixCheck(normalizedPropertyName)[0]); /* GET */ 13102 13103 /* If the value is a CSS null-value and this property has a hook template, use that zero-value template so that hooks can be extracted from it. */ 13104 if (CSS.Values.isCSSNullValue(normalizedPropertyValue) && CSS.Hooks.templates[property]) { 13105 normalizedPropertyValue = CSS.Hooks.templates[property][1]; 13106 } 13107 } 13108 13109 propertyValue = CSS.Normalizations.registered[property]("extract", element, normalizedPropertyValue); 13110 } 13111 13112 /* If a (numeric) value wasn't produced via hook extraction or normalization, query the DOM. */ 13113 if (!/^[\d-]/.test(propertyValue)) { 13114 /* For SVG elements, dimensional properties (which SVGAttribute() detects) are tweened via 13115 their HTML attribute values instead of their CSS style values. */ 13116 if (Data(element) && Data(element).isSVG && CSS.Names.SVGAttribute(property)) { 13117 /* Since the height/width attribute values must be set manually, they don't reflect computed values. 13118 Thus, we use use getBBox() to ensure we always get values for elements with undefined height/width attributes. */ 13119 if (/^(height|width)$/i.test(property)) { 13120 propertyValue = element.getBBox()[property]; 13121 /* Otherwise, access the attribute value directly. */ 13122 } else { 13123 propertyValue = element.getAttribute(property); 13124 } 13125 } else { 13126 propertyValue = computePropertyValue(element, CSS.Names.prefixCheck(property)[0]); /* GET */ 13127 } 13128 } 13129 13130 /* Since property lookups are for animation purposes (which entails computing the numeric delta between start and end values), 13131 convert CSS null-values to an integer of value 0. */ 13132 if (CSS.Values.isCSSNullValue(propertyValue)) { 13133 propertyValue = 0; 13134 } 13135 13136 if (Velocity.debug >= 2) console.log("Get " + property + ": " + propertyValue); 13137 13138 return propertyValue; 13139 }, 13140 13141 /* The singular setPropertyValue, which routes the logic for all normalizations, hooks, and standard CSS properties. */ 13142 setPropertyValue: function(element, property, propertyValue, rootPropertyValue, scrollData) { 13143 var propertyName = property; 13144 13145 /* In order to be subjected to call options and element queueing, scroll animation is routed through Velocity as if it were a standard CSS property. */ 13146 if (property === "scroll") { 13147 /* If a container option is present, scroll the container instead of the browser window. */ 13148 if (scrollData.container) { 13149 scrollData.container["scroll" + scrollData.direction] = propertyValue; 13150 /* Otherwise, Velocity defaults to scrolling the browser window. */ 13151 } else { 13152 if (scrollData.direction === "Left") { 13153 window.scrollTo(propertyValue, scrollData.alternateValue); 13154 } else { 13155 window.scrollTo(scrollData.alternateValue, propertyValue); 13156 } 13157 } 13158 } else { 13159 /* Transforms (translateX, rotateZ, etc.) are applied to a per-element transformCache object, which is manually flushed via flushTransformCache(). 13160 Thus, for now, we merely cache transforms being SET. */ 13161 if (CSS.Normalizations.registered[property] && CSS.Normalizations.registered[property]("name", element) === "transform") { 13162 /* Perform a normalization injection. */ 13163 /* Note: The normalization logic handles the transformCache updating. */ 13164 CSS.Normalizations.registered[property]("inject", element, propertyValue); 13165 13166 propertyName = "transform"; 13167 propertyValue = Data(element).transformCache[property]; 13168 } else { 13169 /* Inject hooks. */ 13170 if (CSS.Hooks.registered[property]) { 13171 var hookName = property, 13172 hookRoot = CSS.Hooks.getRoot(property); 13173 13174 /* If a cached rootPropertyValue was not provided, query the DOM for the hookRoot's current value. */ 13175 rootPropertyValue = rootPropertyValue || CSS.getPropertyValue(element, hookRoot); /* GET */ 13176 13177 propertyValue = CSS.Hooks.injectValue(ho
13177okName, propertyValue, rootPropertyValue); 13178 property = hookRoot; 13179 } 13180 13181 /* Normalize names and values. */ 13182 if (CSS.Normalizations.registered[property]) { 13183 propertyValue = CSS.Normalizations.registered[property]("inject", element, propertyValue); 13184 property = CSS.Normalizations.registered[property]("name", element); 13185 } 13186 13187 /* Assign the appropriate vendor prefix before performing an official style update. */ 13188 propertyName = CSS.Names.prefixCheck(property)[0]; 13189 13190 /* A try/catch is used for IE<=8, which throws an error when "invalid" CSS values are set, e.g. a negative width. 13191 Try/catch is avoided for other browsers since it incurs a performance overhead. */ 13192 if (IE <= 8) { 13193 try { 13194 element.style[propertyName] = propertyValue; 13195 } catch (error) { if (Velocity.debug) console.log("Browser does not support [" + propertyValue + "] for [" + propertyName + "]"); } 13196 /* SVG elements have their dimensional properties (width, height, x, y, cx, etc.) applied directly as attributes instead of as styles. */ 13197 /* Note: IE8 does not support SVG elements, so it's okay that we skip it for SVG animation. */ 13198 } else if (Data(element) && Data(element).isSVG && CSS.Names.SVGAttribute(property)) { 13199 /* Note: For SVG attributes, vendor-prefixed property names are never used. */ 13200 /* Note: Not all CSS properties can be animated via attributes, but the browser won't throw an error for unsupported properties. */ 13201 element.setAttribute(property, propertyValue); 13202 } else { 13203 element.style[propertyName] = propertyValue; 13204 } 13205 13206 if (Velocity.debug >= 2) console.log("Set " + property + " (" + propertyName + "): " + propertyValue); 13207 } 13208 } 13209 13210 /* Return the normalized property name and value in case the caller wants to know how these values were modified before being applied to the DOM. */ 13211 return [ propertyName, propertyValue ]; 13212 }, 13213 13214 /* To increase performance by batching transform updates into a single SET, transforms are not directly applied to an element until flushTransformCache() is called. */ 13215 /* Note: Velocity applies transform properties in the same order that they are chronogically introduced to the element's CSS styles. */ 13216 flushTransformCache: function(element) { 13217 var transformString = ""; 13218 13219 /* Certain browsers require that SVG transforms be applied as an attribute. However, the SVG transform attribute takes a modified version of CSS's transform string 13220 (units are dropped and, except for skewX/Y, subproperties are merged into their master property -- e.g. scaleX and scaleY are merged into scale(X Y). */ 13221 if ((IE || (Velocity.State.isAndroid && !Velocity.State.isChrome)) && Data(element).isSVG) { 13222 /* Since transform values are stored in their parentheses-wrapped form, we use a helper function to strip out their numeric values. 13223 Further, SVG transform properties only take unitless (representing pixels) values, so it's okay that parseFloat() strips the unit suffixed to the float value. */ 13224 function getTransformFloat (transformProperty) { 13225 return parseFloat(CSS.getPropertyValue(element, transformProperty)); 13226 } 13227 13228 /* Create an object to organize all the transforms that we'll apply to the SVG element. To keep the logic simple, 13229 we process *all* transform properties -- even those that may not be explicitly applied (since they default to their zero-values anyway). */ 13230 var SVGTransforms = { 13231 translate: [ getTransformFloat("translateX"), getTransformFloat("translateY") ], 13232 skewX: [ getTransformFloat("skewX") ], skewY: [ getTransformFloat("skewY") ],
vendor: 6,513 bytes, lines 13233-13362
13233 /* If the scale property is set (non-1), use that value for the scaleX and scaleY values 13234 (this behavior mimics the result of animating all these properties at once on HTML elements). */ 13235 scale: getTransformFloat("scale") !== 1 ? [ getTransformFloat("scale"), getTransformFloat("scale") ] : [ getTransformFloat("scaleX"), getTransformFloat("scaleY") ], 13236 /* Note: SVG's rotate transform takes three values: rotation degrees followed by the X and Y values 13237 defining the rotation's origin point. We ignore the origin values (default them to 0). */ 13238 rotate: [ getTransformFloat("rotateZ"), 0, 0 ] 13239 }; 13240 13241 /* Iterate through the transform properties in the user-defined property map order. 13242 (This mimics the behavior of non-SVG transform animation.) */ 13243 $.each(Data(element).transformCache, function(transformName) { 13244 /* Except for with skewX/Y, revert the axis-specific transform subproperties to their axis-free master 13245 properties so that they match up with SVG's accepted transform properties. */ 13246 if (/^translate/i.test(transformName)) { 13247 transformName = "translate"; 13248 } else if (/^scale/i.test(transformName)) { 13249 transformName = "scale"; 13250 } else if (/^rotate/i.test(transformName)) { 13251 transformName = "rotate"; 13252 } 13253 13254 /* Check that we haven't yet deleted the property from the SVGTransforms container. */ 13255 if (SVGTransforms[transformName]) { 13256 /* Append the transform property in the SVG-supported transform format. As per the spec, surround the space-delimited values in parentheses. */ 13257 transformString += transformName + "(" + SVGTransforms[transformName].join(" ") + ")" + " "; 13258 13259 /* After processing an SVG transform property, delete it from the SVGTransforms container so we don't 13260 re-insert the same master property if we encounter another one of its axis-specific properties. */ 13261 delete SVGTransforms[transformName]; 13262 } 13263 }); 13264 } else { 13265 var transformValue, 13266 perspective; 13267 13268 /* Transform properties are stored as members of the transformCache object. Concatenate all the members into a string. */ 13269 $.each(Data(element).transformCache, function(transformName) { 13270 transformValue = Data(element).transformCache[transformName]; 13271 13272 /* Transform's perspective subproperty must be set first in order to take effect. Store it temporarily. */ 13273 if (transformName === "transformPerspective") { 13274 perspective = transformValue; 13275 return true; 13276 } 13277 13278 /* IE9 only supports one rotation type, rotateZ, which it refers to as "rotate". */ 13279 if (IE === 9 && transformName === "rotateZ") { 13280 transformName = "rotate"; 13281 } 13282 13283 transformString += transformName + transformValue + " "; 13284 }); 13285 13286 /* If present, set the perspective subproperty first. */ 13287 if (perspective) { 13288 transformString = "perspective" + perspective + " " + transformString; 13289 } 13290 } 13291 13292 CSS.setPropertyValue(element, "transform", transformString); 13293 } 13294 }; 13295 13296 /* Register hooks and normalizations. */ 13297 CSS.Hooks.register(); 13298 CSS.Normalizations.register(); 13299 13300 /* Allow hook setting in the same fashion as jQuery's $.css(). */ 13301 Velocity.hook = function (elements, arg2, arg3) { 13302 var value = undefined; 13303 13304 elements = sanitizeElements(elements); 13305 13306 $.each(elements, function(i, element) { 13307 /* Initialize Velocity's per-element data cache if this element hasn't previously been animated. */ 13308 if (Data(element) === undefined) { 13309 Velocity.init(element); 13310 } 13311 13312 /* Get property value. If an element set was passed in, only return the value for the first element. */ 13313 if (arg3 === undefined) { 13314 if (value === undefined) { 13315 value = Velocity.CSS.getPropertyValue(element, arg2); 13316 } 13317 /* Set property value. */ 13318 } else { 13319 /* sPV returns an array of the normalized propertyName/propertyValue pair used to update the DOM. */ 13320 var adjustedSet = Velocity.CSS.setPropertyValue(element, arg2, arg3); 13321 13322 /* Transform properties don't automatically set. They have to be flushed to the DOM. */ 13323 if (adjustedSet[0] === "transform") { 13324 Velocity.CSS.flushTransformCache(element); 13325 } 13326 13327 value = adjustedSet; 13328 } 13329 }); 13330 13331 return value; 13332 }; 13333 13334 /***************** 13335 Animation 13336 *****************/ 13337 13338 var animate = function() { 13339 13340 /****************** 13341 Call Chain 13342 ******************/ 13343 13344 /* Logic for determining what to return to the call stack when exiting out of Velocity. */ 13345 function getChain () { 13346 /* If we are using the utility function, attempt to return this call's promise. If no promise library was detected, 13347 default to null instead of returning the targeted elements so that utility function's return value is standardized. */ 13348 if (isUtility) { 13349 return promiseData.promise || null; 13350 /* Otherwise, if we're using $.fn, return the jQuery-/Zepto-wrapped element set. */ 13351 } else { 13352 return elementsWrapped; 13353 } 13354 } 13355 13356 /************************* 13357 Arguments Assignment 13358 *************************/ 13359 13360 /* To allow for expressive CoffeeScript code, Velocity supports an alternative syntax in which "properties" and "options" 13361 objects are defined on a container object that's passed in as Velocity's sole argument. */ 13362 /* Note: Some browsers automatically populate arguments with a "properties" object. We detect it by checking for its default "n
13362ames" property. */ 13363 var syntacticSugar = (arguments[0] && (($.isPlainObject(arguments[0].properties) && !arguments[0].properties.names) || Type.isString(arguments[0].properties))), 13364 /* Whether Velocity was called via the utility function (as opposed to on a jQuery/Zepto object). */ 13365 isUtility, 13366 /* When Velocity is called via the utility function ($.Velocity()/Velocity()), elements are explicitly 13367 passed in as the first parameter. Thus, argument positioning varies. We normalize them here. */ 13368 elementsWrapped, 13369 argumentIndex; 13370 13371 var elements, 13372 propertiesMap, 13373 options; 13374 13375 /* Detect jQuery/Zepto elements being animated via the $.fn method. */ 13376 if (Type.isWrapped(this)) { 13377 isUtility = false; 13378 13379 argumentIndex = 0; 13380 elements = this; 13381 elementsWrapped = this; 13382 /* Otherwise, raw elements are being animated via the utility function. */ 13383 } else { 13384 isUtility = true; 13385 13386 argumentIndex = 1; 13387 elements = syntacticSugar ? arguments[0].elements : arguments[0]; 13388 } 13389 13390 elements = sanitizeElements(elements); 13391 13392 if (!elements) { 13393 return; 13394 } 13395 13396 if (syntacticSugar) { 13397 propertiesMap = arguments[0].properties; 13398 options = arguments[0].options; 13399 } else { 13400 propertiesMap = arguments[argumentIndex]; 13401 options = arguments[argumentIndex + 1]; 13402 } 13403 13404 /* The length of the element set (in the form of a nodeList or an array of elements) is defaulted to 1 in case a 13405 single raw DOM element is passed in (which doesn't contain a length property). */ 13406 var elementsLength = elements.length, 13407 elementsIndex = 0; 13408 13409 /*************************** 13410 Argument Overloading 13411 ***************************/ 13412 13413 /* Support is included for jQuery's argument overloading: $.animate(propertyMap [, duration] [, easing] [, complete]). 13414 Overloading is detected by checking for the absence of an object being passed into options. */ 13415 /* Note: The stop action does not accept animation options, and is therefore excluded from this check. */ 13416 if (propertiesMap !== "stop" && !$.isPlainObject(options)) { 13417 /* The utility function shifts all arguments one position to the right, so we adjust for that offset. */ 13418 var startingArgumentPosition = argumentIndex + 1; 13419 13420 options = {}; 13421 13422 /* Iterate through all options arguments */ 13423 for (var i = startingArgumentPosition; i < arguments.length; i++) { 13424 /* Treat a number as a duration. Parse it out. */ 13425 /* Note: The following RegEx will return true if passed an array with a number as its first item. 13426 Thus, arrays are skipped from this check. */ 13427 if (!Type.isArray(arguments[i]) && (/^(fast|normal|slow)$/i.test(arguments[i]) || /^\d/.test(arguments[i]))) { 13428 options.duration = arguments[i]; 13429 /* Treat strings and arrays as easings. */ 13430 } else if (Type.isString(arguments[i]) || Type.isArray(arguments[i])) { 13431 options.easing = arguments[i]; 13432 /* Treat a function as a complete callback. */ 13433 } else if (Type.isFunction(arguments[i])) { 13434 options.complete = arguments[i]; 13435 } 13436 } 13437 } 13438 13439 /*************** 13440 Promises 13441 ***************/ 13442 13443 var promiseData = { 13444 promise: null, 13445 resolver: null, 13446 rejecter: null 13447 }; 13448 13449 /* If this call was made via the utility function (which is the default method of invocation when jQuery/Zepto are not being used), and if 13450 promise support was detected, create a promise object for this call and store references to its resolver and rejecter methods. The resolve 13451 method is used when a call completes naturally or is prematurely stopped by the user. In both cases, completeCall() handles the associated 13452 call cleanup and promise resolving logic. The reject method is used when an invali
13452d set of arguments is passed into a Velocity call. */ 13453 /* Note: Velocity employs a call-based queueing architecture, which means that stopping an animating element actually stops the full call that 13454 triggered it -- not that one element exclusively. Similarly, there is one promise per call, and all elements targeted by a Velocity call are 13455 grouped together for the purposes of resolving and rejecting a promise. */ 13456 if (isUtility && Velocity.Promise) { 13457 promiseData.promise = new Velocity.Promise(function (resolve, reject) { 13458 promiseData.resolver = resolve; 13459 promiseData.rejecter = reject; 13460 }); 13461 } 13462 13463 /********************* 13464 Action Detection 13465 *********************/ 13466 13467 /* Velocity's behavior is categorized into "actions": Elements can either be specially scrolled into view, 13468 or they can be started, stopped, or reversed. If a literal or referenced properties map is passed in as Velocity's 13469 first argument, the associated action is "start". Alternatively, "scroll", "reverse", or "stop" can be passed in instead of a properties map. */ 13470 var action; 13471 13472 switch (propertiesMap) { 13473 case "scroll": 13474 action = "scroll"; 13475 break; 13476 13477 case "reverse": 13478 action = "reverse"; 13479 break; 13480 13481 case "stop": 13482 /******************* 13483 Action: Stop 13484 *******************/ 13485 13486 /* Clear the currently-active delay on each targeted element. */ 13487 $.each(elements, function(i, element) { 13488 if (Data(element) && Data(element).delayTimer) { 13489 /* Stop the timer from triggering its cached next() function. */ 13490 clearTimeout(Data(element).delayTimer.setTimeout); 13491 13492 /* Manually call the next() function so that the subsequent queue items can progress. */ 13493 if (Data(element).delayTimer.next) { 13494 Data(element).delayTimer.next(); 13495 } 13496 13497 delete Data(element).delayTimer; 13498 } 13499 }); 13500 13501 var callsToStop = []; 13502 13503 /* When the stop action is triggered, the elements' currently active call is immediately stopped. The active call might have 13504 been applied to multiple elements, in which case all of the call's elements will be subjected to stopping. When an element 13505 is stopped, the next item in its animation queue is immediately triggered. */ 13506 /* An additional argument may be passed in to clear an element's remaining queued calls. Either true (which defaults to the "fx" queue) 13507 or a custom queue string can be passed in. */ 13508 /* Note: The stop command runs prior to Queueing since its behavior is intended to take effect *immediately*, 13509 regardless of the element's current queue state. */ 13510 13511 /* Iterate through every active call. */ 13512 $.each(Velocity.State.calls, function(i, activeCall) { 13513 /* Inactive calls are set to false by the logic inside completeCall(). Skip them. */ 13514 if (activeCall) { 13515 /* Iterate through the active call's targeted elements. */ 13516 $.each(activeCall[1], function(k, activeElement) { 13517 var queueName = Type.isString(options) ? options : ""; 13518 13519 if (options !== undefined && activeCall[2].queue !== queueName) { 13520 return true; 13521 } 13522 13523 /* Iterate through the calls targeted by the stop command. */ 13524 $.each(elements, function(l, element) { 13525 /* Check that this call was applied to the target element. */ 13526 if (element === activeElement) { 13527 /* Optionally clear the remaining queued calls. */ 13528 if (options !== undefined) { 13529 /* Iterate through the items in the element's queue. */ 13530 $.each($.queue(element, queueName), function(_, item) { 13531 /* The queue array can contain an "inprogress" string, which we skip. */ 13532 if (Type.isFunction(item)) { 13533 /* Pass the item's callback a flag indicating that we want to abort from the queue call. 13534 (Specifically, the queue will resolve the call's associated promise then abort.) */ 13535 item(null, true); 13536 } 13537 }); 13538 13539 /* Clearing the $.queue() array is achieved by resetting it to []. */ 13540 $.queue(element, queueName, []); 13541 } 13542 13543 if (Data(element) && queueName === "") { 13544 /* Since "reverse" uses cached start values (the previous call's endValues), 13545 these values must be changed to reflect the final value that the elements were actually tweened to. */ 13546 $.each(Data(element).tweensContainer, function(m, activeTween) { 13547 activeTween.endValue = activeTween.currentValue; 13548 }); 13549 } 13550 13551 callsToStop.push(i); 13552 } 13553 }); 13554 }); 13555 } 13556 }); 13557 13558 /* Prematurely call completeCall() on each matched active call, passing an additional flag to indicate 13559 that the complete callback and display:none setting should be skipped since we're completing prematurely. */ 13560 $.each(callsToStop, function(i, j) { 13561 completeCall(j, true); 13562 }); 13563 13564 if (promiseData.promise) { 13565 /* Immediately resolve the promise associated with this stop call since stop runs synchronously. */ 13566 promiseData.resolver(elements); 13567 } 13568 13569 /* Since we're stopping, and not proceeding with queueing, exit out of Velocity. */ 13570 return getChain(); 13571 13572 default: 13573 /* Treat a non-empty plain object as a literal properties map. */ 13574 if ($.isPlainObject(propertiesMap) && !Type.isEmptyObject(propertiesMap)) { 13575 action = "start"; 13576 13577 /**************** 13578 Redirects 13579 ****************/ 13580 13581 /* Check if a string matches a registered redirect (see Redirects above). */ 13582 } else if (Type.isString(propertiesMap) && Velocity.Redirects[propertiesMap]) { 13583 var opts = $.extend({}, options), 13584 durationOriginal = opts.duration, 13585 delayOriginal = opts.delay || 0; 13586 13587 /* If the backwards option was passed in, reverse the element set so that elements animate from the last to the first. */ 13588 if (opts.backwards === true) { 13589 elements = $.extend(true, [], elements).reverse(); 13590 } 13591 13592 /* Individually trigger the redirect for each element in the set to prevent users from having to handle iteration logic in their redirect. */ 13593 $.each(elements, function(elementIndex, element) { 13594 /* If the stagger option was passed in, successively delay each element by the stagger value (in ms). Retain the original delay value. */ 13595 if (parseFloat(opts.stagger)) {
vendor: 18,569 bytes, lines 13596-13902
13596 opts.delay = delayOriginal + (parseFloat(opts.stagger) * elementIndex); 13597 } else if (Type.isFunction(opts.stagger)) { 13598 opts.delay = delayOriginal + opts.stagger.call(element, elementIndex, elementsLength); 13599 } 13600 13601 /* If the drag option was passed in, successively increase/decrease (depending on the presense of opts.backwards) 13602 the duration of each element's animation, using floors to prevent producing very short durations. */ 13603 if (opts.drag) { 13604 /* Default the duration of UI pack effects (callouts and transitions) to 1000ms instead of the usual default duration of 400ms. */ 13605 opts.duration = parseFloat(durationOriginal) || (/^(callout|transition)/.test(propertiesMap) ? 1000 : DURATION_DEFAULT); 13606 13607 /* For each element, take the greater duration of: A) animation completion percentage relative to the original duration, 13608 B) 75% of the original duration, or C) a 200ms fallback (in case duration is already set to a low value). 13609 The end result is a baseline of 75% of the redirect's duration that increases/decreases as the end of the element set is approached. */ 13610 opts.duration = Math.max(opts.duration * (opts.backwards ? 1 - elementIndex/elementsLength : (elementIndex + 1) / elementsLength), opts.duration * 0.75, 200); 13611 } 13612 13613 /* Pass in the call's opts object so that the redirect can optionally extend it. It defaults to an empty object instead of null to 13614 reduce the opts checking logic required inside the redirect. */ 13615 Velocity.Redirects[propertiesMap].call(element, element, opts || {}, elementIndex, elementsLength, elements, promiseData.promise ? promiseData : undefined); 13616 }); 13617 13618 /* Since the animation logic resides within the redirect's own code, abort the remainder of this call. 13619 (The performance overhead up to this point is virtually non-existant.) */ 13620 /* Note: The jQuery call chain is kept intact by returning the complete element set. */ 13621 return getChain(); 13622 } else { 13623 var abortError = "Velocity: First argument (" + propertiesMap + ") was not a property map, a known action, or a registered redirect. Aborting."; 13624 13625 if (promiseData.promise) { 13626 promiseData.rejecter(new Error(abortError)); 13627 } else { 13628 console.log(abortError); 13629 } 13630 13631 return getChain(); 13632 } 13633 } 13634 13635 /************************** 13636 Call-Wide Variables 13637 **************************/ 13638 13639 /* A container for CSS unit conversion ratios (e.g. %, rem, and em ==> px) that is used to cache ratios across all elements 13640 being animated in a single Velocity call. Calculating unit ratios necessitates DOM querying and updating, and is therefore 13641 avoided (via caching) wherever possible. This container is call-wide instead of page-wide to avoid the risk of using stale 13642 conversion metrics across Velocity animations that are not immediately consecutively chained. */ 13643 var callUnitConversionData = { 13644 lastParent: null, 13645 lastPosition: null, 13646 lastFontSize: null, 13647 lastPercentToPxWidth: null, 13648 lastPercentToPxHeight: null, 13649 lastEmToPx: null, 13650 remToPx: null, 13651 vwToPx: null, 13652 vhToPx: null 13653 }; 13654 13655 /* A container for all the ensuing tween data and metadata associated with this call. This container gets pushed to the page-wide 13656 Velocity.State.calls array that is processed during animation ticking. */ 13657 var call = []; 13658 13659 /************************ 13660 Element Processing 13661 ************************/ 13662 13663 /* Element processing consists of three parts -- data processing that cannot go stale and data processing that *can* go stale (i.e. third-party style modifications): 13664 1) Pre-Queueing: Element-wide variables, including the element's data storage, are instantiated. Call options are prepared. If triggered, the Stop action is executed. 13665 2) Queueing: The logic that runs once this call has reached its point of execution in the element's $.queue() stack. Most logic is placed here to avoid risking it becoming stale. 13666 3) Pushing: Consolidation of the tween data followed by its push onto the global in-progress calls container. 13667 */ 13668 13669 function processElement () { 13670 13671 /************************* 13672 Part I: Pre-Queueing 13673 *************************/ 13674 13675 /*************************** 13676 Element-Wide Variables 13677 ***************************/ 13678 13679 var element = this, 13680 /* The runtime opts object is the extension of the current call's options and Velocity's page-wide option defaults. */ 13681 opts = $.extend({}, Velocity.defaults, options), 13682 /* A container for the processed data associated with each property in the propertyMap. 13683 (Each property in the map produces its own "tween".) */ 13684 tweensContainer = {}, 13685 elementUnitConversionData; 13686 13687 /****************** 13688 Element Init 13689 ******************/ 13690 13691 if (Data(element) === undefined) { 13692 Velocity.init(element); 13693 } 13694 13695 /****************** 13696 Option: Delay 13697 ******************/ 13698 13699 /* Since queue:false doesn't respect the item's existing queue, we avoid injecting its delay here (it's set later on). */ 13700 /* Note: Velocity rolls its own delay function since jQuery doesn't have a utility alias for $.fn.delay() 13701 (and thus requires jQuery element creation, which we avoid since its overhead includes DOM querying). */ 13702 if (parseFloat(opts.delay) && opts.queue !== false) { 13703 $.queue(element, opts.queue, function(next) { 13704 /* This is a flag used to indicate to the upcoming completeCall() function that this queue entry was initiated by Velocity. See completeCall() for further details. */ 13705 Velocity.velocityQueueEntryFlag = true; 13706 13707 /* The ensuing queue item (which is assigned to the "next" argument that $.queue() automatically passes in) will be triggered after a setTimeout delay. 13708 The setTimeout is stored so that it can be subjected to clearTimeout() if this animation is prematurely stopped via Velocity's "stop" command. */ 13709 Data(element).delayTimer = { 13710 setTimeout: setTimeout(next, parseFloat(opts.delay)), 13711 next: next 13712 }; 13713 }); 13714 } 13715 13716 /********************* 13717 Option: Duration 13718 *********************/ 13719 13720 /* Support for jQuery's named durations. */ 13721 switch (opts.duration.toString().toLowerCase()) { 13722 case "fast": 13723 opts.duration = 200; 13724 break; 13725 13726 case "normal": 13727 opts.duration = DURATION_DEFAULT; 13728 break; 13729 13730 case "slow": 13731 opts.duration = 600; 13732 break; 13733 13734 default: 13735 /* Remove the potential "ms" suffix and default to 1 if the user is attempting to set a duration of 0 (in order to produce an immediate style change). */ 13736 opts.duration = parseFloat(opts.duration) || 1; 13737 } 13738 13739 /************************ 13740 Global Option: Mock 13741 ************************/ 13742 13743 if (Velocity.mock !== false) { 13744 /* In mock mode, all animations are forced to 1ms so that they occur immediately upon the next rAF tick. 13745 Alternatively, a multiplier can be passed in to time remap all delays and durations. */ 13746 if (Velocity.mock === true) { 13747 opts.duration = opts.delay = 1; 13748 } else { 13749 opts.duration *= parseFloat(Velocity.mock) || 1; 13750 opts.delay *= parseFloat(Velocity.mock) || 1; 13751 } 13752 } 13753 13754 /******************* 13755 Option: Easing 13756 *******************/ 13757 13758 opts.easing = getEasing(opts.easing, opts.duration); 13759 13760 /********************** 13761 Option: Callbacks 13762 **********************/ 13763 13764 /* Callbacks must functions. Otherwise, default to null. */ 13765 if (opts.begin && !Type.isFunction(opts.begin)) { 13766 opts.begin = null; 13767 } 13768 13769 if (opts.progress && !Type.isFunction(opts.progress)) { 13770 opts.progress = null; 13771 } 13772 13773 if (opts.complete && !Type.isFunction(opts.complete)) { 13774 opts.complete = null; 13775 } 13776 13777 /********************************* 13778 Option: Display & Visibility 13779 *********************************/ 13780 13781 /* Refer to Velocity's documentation (VelocityJS.org/#displayAndVisibility) for a description of the display and visibility options' behavior. */ 13782 /* Note: We strictly check for undefined instead of falsiness because display accepts an empty string value. */ 13783 if (opts.display !== undefined && opts.display !== null) { 13784 opts.display = opts.display.toString().toLowerCase(); 13785 13786 /* Users can pass in a special "auto" value to instruct Velocity to set the element to its default display value. */ 13787 if (opts.display === "auto") { 13788 opts.display = Velocity.CSS.Values.getDisplayType(element); 13789 } 13790 } 13791 13792 if (opts.visibility !== undefined && opts.visibility !== null) { 13793 opts.visibility = opts.visibility.toString().toLowerCase(); 13794 } 13795 13796 /********************** 13797 Option: mobileHA 13798 **********************/ 13799 13800 /* When set to true, and if this is a mobile device, mobileHA automatically enables hardware acceleration (via a null transform hack) 13801 on animating elements. HA is removed from the element at the completion of its animation. */ 13802 /* Note: Android Gingerbread doesn't support HA. If a null transform hack (mobileHA) is in fact set, it will prevent other tranform subproperties from taking effect. */ 13803 /* Note: You can read more about the use of mobileHA in Velocity's documentation: VelocityJS.org/#mobileHA. */ 13804 opts.mobileHA = (opts.mobileHA && Velocity.State.isMobile && !Velocity.State.isGingerbread); 13805 13806 /*********************** 13807 Part II: Queueing 13808 ***********************/ 13809 13810 /* When a set of elements is targeted by a Velocity call, the set is broken up and each element has the current Velocity call individually queued onto it. 13811 In this way, each element's existing queue is respected; some elements may already be animating and accordingly should not have this current Velocity call triggered immediately. */ 13812 /* In each queue, tween data is processed for each animating property then pushed onto the call-wide calls array. When the last element in the set has had its tweens processed, 13813 the call array is pushed to Velocity.State.calls for live processing by the requestAnimationFrame tick. */ 13814 function buildQueue (next) { 13815 13816 /******************* 13817 Option: Begin 13818 *******************/ 13819 13820 /* The begin callback is fired once per call -- not once per elemenet -- and is passed the full raw DOM element set as both its context and its first argument. */ 13821 if (opts.begin && elementsIndex === 0) { 13822 /* We throw callbacks in a setTimeout so that thrown errors don't halt the execution of Velocity itself. */ 13823 try { 13824 opts.begin.call(elements, elements); 13825 } catch (error) { 13826 setTimeout(function() { throw error; }, 1); 13827 } 13828 } 13829 13830 /***************************************** 13831 Tween Data Construction (for Scroll) 13832 *****************************************/ 13833 13834 /* Note: In order to be subjected to chaining and animation options, scroll's tweening is routed through Velocity as if it were a standard CSS property animation. */ 13835 if (action === "scroll") { 13836 /* The scroll action uniquely takes an optional "offset" option -- specified in pixels -- that offsets the targeted scroll position. */ 13837 var scrollDirection = (/^x$/i.test(opts.axis) ? "Left" : "Top"), 13838 scrollOffset = parseFloat(opts.offset) || 0, 13839 scrollPositionCurrent, 13840 scrollPositionCurrentAlternate, 13841 scrollPositionEnd; 13842 13843 /* Scroll also uniquely takes an optional "container" option, which indicates the parent element that should be scrolled -- 13844 as opposed to the browser window itself. This is useful for scrolling toward an element that's inside an overflowing parent element. */ 13845 if (opts.container) { 13846 /* Ensure that either a jQuery object or a raw DOM element was passed in. */ 13847 if (Type.isWrapped(opts.container) || Type.isNode(opts.container)) { 13848 /* Extract the raw DOM element from the jQuery wrapper. */ 13849 opts.container = opts.container[0] || opts.container; 13850 /* Note: Unlike other properties in Velocity, the browser's scroll position is never cached since it so frequently changes 13851 (due to the user's natural interaction with the page). */ 13852 scrollPositionCurrent = opts.container["scroll" + scrollDirection]; /* GET */ 13853 13854 /* $.position() values are relative to the container's currently viewable area (without taking into account the container's true dimensions 13855 -- say, for example, if the container was not overflowing). Thus, the scroll end value is the sum of the child element's position *and* 13856 the scroll container's current scroll position. */ 13857 /* Note: jQuery does not offer a utility alias for $.position(), so we have to incur jQuery object conversion here. 13858 This syncs up with an ensuing batch of GETs, so it fortunately does not trigger layout thrashing. */ 13859 scrollPositionEnd = (scrollPositionCurrent + $(element).position()[scrollDirection.toLowerCase()]) + scrollOffset; /* GET */ 13860 /* If a value other than a jQuery object or a raw DOM element was passed in, default to null so that this option is ignored. */ 13861 } else { 13862 opts.container = null; 13863 } 13864 } else { 13865 /* If the window itself is being scrolled -- not a containing element -- perform a live scroll position lookup using 13866 the appropriate cached property names (which differ based on browser type). */ 13867 scrollPositionCurrent = Velocity.State.scrollAnchor[Velocity.State["scrollProperty" + scrollDirection]]; /* GET */ 13868 /* When scrolling the browser window, cache the alternate axis's current value since window.scrollTo() doesn't let us change only one value at a time. */ 13869 scrollPositionCurrentAlternate = Velocity.State.scrollAnchor[Velocity.State["scrollProperty" + (scrollDirection === "Left" ? "Top" : "Left")]]; /* GET */ 13870 13871 /* Unlike $.position(), $.offset() values are relative to the browser window's true dimensions -- not merely its currently viewable area -- 13872 and therefore end values do not need to be compounded onto current values. */ 13873 scrollPositionEnd = $(element).offset()[scrollDirection.toLowerCase()] + scrollOffset; /* GET */ 13874 } 13875 13876 /* Since there's only one format that scroll's associated tweensContainer can take, we create it manually. */ 13877 tweensContainer = { 13878 scroll: { 13879 rootPropertyValue: false, 13880 startValue: scrollPositionCurrent, 13881 currentValue: scrollPositionCurrent, 13882 endValue: scrollPositionEnd, 13883 unitType: "", 13884 easing: opts.easing, 13885 scrollData: { 13886 container: opts.container, 13887 direction: scrollDirection, 13888 alternateValue: scrollPositionCurrentAlternate 13889 } 13890 }, 13891 element: element 13892 }; 13893 13894 if (Velocity.debug) console.log("tweensContainer (scroll): ", tweensContainer.scroll, element); 13895 13896 /****************************************** 13897 Tween Data Construction (for Reverse) 13898 ******************************************/ 13899 13900 /* Reverse acts like a "start" action in that a property map is animated toward. The only difference is 13901 that the property map used for reverse is the inverse of the map used in the previous call. Thus, we manipulate 13902 the previous call to construct our new map: use the previous map's end values as our new map's start values. Copy over all other data. */
13903 /* Note: Reverse can be directly called via the "reverse" parameter, or it can be indirectly triggered via the loop option. (Loops are composed of multiple reverses.) */ 13904 /* Note: Reverse calls do not need to be consecutively chained onto a currently-animating element in order to operate on cached values; 13905 there is no harm to reverse being called on a potentially stale data cache since reverse's behavior is simply defined 13906 as reverting to the element's values as they were prior to the previous *Velocity* call. */ 13907 } else if (action === "reverse") { 13908 /* Abort if there is no prior animation data to reverse to. */ 13909 if (!Data(element).tweensContainer) { 13910 /* Dequeue the element so that this queue entry releases itself immediately, allowing subsequent queue entries to run. */ 13911 $.dequeue(element, opts.queue); 13912 13913 return; 13914 } else { 13915 /********************* 13916 Options Parsing 13917 *********************/ 13918 13919 /* If the element was hidden via the display option in the previous call, 13920 revert display to "auto" prior to reversal so that the element is visible again. */ 13921 if (Data(element).opts.display === "none") { 13922 Data(element).opts.display = "auto"; 13923 } 13924 13925 if (Data(element).opts.visibility === "hidden") { 13926 Data(element).opts.visibility = "visible"; 13927 } 13928 13929 /* If the loop option was set in the previous call, disable it so that "reverse" calls aren't recursively generated. 13930 Further, remove the previous call's callback options; typically, users do not want these to be refired. */ 13931 Data(element).opts.loop = false; 13932 Data(element).opts.begin = null; 13933 Data(element).opts.complete = null; 13934 13935 /* Since we're extending an opts object that has already been extended with the defaults options object, 13936 we remove non-explicitly-defined properties that are auto-assigned values. */ 13937 if (!options.easing) { 13938 delete opts.easing; 13939 } 13940 13941 if (!options.duration) { 13942 delete opts.duration; 13943 } 13944 13945 /* The opts object used for reversal is an extension of the options object optionally passed into this 13946 reverse call plus the options used in the previous Velocity call. */ 13947 opts = $.extend({}, Data(element).opts, opts); 13948 13949 /************************************* 13950 Tweens Container Reconstruction 13951 *************************************/ 13952 13953 /* Create a deepy copy (indicated via the true flag) of the previous call's tweensContainer. */ 13954 var lastTweensContainer = $.extend(true, {}, Data(element).tweensContainer); 13955 13956 /* Manipulate the previous tweensContainer by replacing its end values and currentValues with its start values. */ 13957 for (var lastTween in lastTweensContainer) { 13958 /* In addition to tween data, tweensContainers contain an element property that we ignore here. */ 13959 if (lastTween !== "element") { 13960 var lastStartValue = lastTweensContainer[lastTween].startValue; 13961 13962 lastTweensContainer[lastTween].startValue = lastTweensContainer[lastTween].currentValue = lastTweensContainer[lastTween].endValue; 13963 lastTweensContainer[lastTween].endValue = lastStartValue; 13964 13965 /* Easing is the only option that embeds into the individual tween data (since it can be defined on a per-property basis). 13966 Accordingly, every property's easing value must be updated when an options object is passed in with a reverse call. 13967 The side effect of this extensibility is that all per-property easing values are forcefully reset to the new value. */ 13968 if (!Type.isEmptyObject(options)) { 13969 lastTweensContainer[lastTween].easing = opts.easing; 13970 } 13971 13972 if (Velocity.debug) console.log("reverse tweensContainer (" + lastTween + "): " + JSON.stringify(lastTweensContainer[lastTween]), element); 13973 } 13974 } 13975 13976 tweensContainer = lastTweensContainer; 13977 } 13978 13979 /***************************************** 13980 Tween Data Construction (for Start) 13981 *****************************************/ 13982 13983 } else if (action === "start") { 13984 13985 /************************* 13986 Value Transferring 13987 *************************/ 13988 13989 /* If this queue entry follows a previous Velocity-initiated queue entry *and* if this entry was created 13990 while the element was in the process of being animated by Velocity, then this current call is safe to use 13991 the end values from the prior call as its start values. Velocity attempts to perform this value transfer 13992 process whenever possible in order to avoid requerying the DOM. */ 13993 /* If values aren't transferred from a prior call and start values were not forcefed by the user (more on this below), 13994 then the DOM is queried for the element's current values as a last resort. */ 13995 /* Note: Conversely, animation reversal (and looping) *always* perform inter-call value transfers; they never requery the DOM. */ 13996 var lastTweensContainer; 13997 13998 /* The per-element isAnimating flag is used to indicate whether it's safe (i.e. the data isn't stale) 13999 to transfer over end values to use as start values. If it's set to true and there is a previous 14000 Velocity call to pull values from, do so. */ 14001 if (Data(element).tweensContainer && Data(element).isAnimating === true) { 14002 lastTweensContainer = Data(element).tweensContainer; 14003 } 14004 14005 /*************************** 14006 Tween Data Calculation 14007 ***************************/ 14008 14009 /* This function parses property data and defaults endValue, easing, and startValue as appropriate. */ 14010 /* Property map values can either take the form of 1) a single value representing the end value, 14011 or 2) an array in the form of [ endValue, [, easing] [, startValue] ]. 14012 The optional third parameter is a forcefed startValue to be used instead of querying the DOM for 14013 the element's current value. Read Velocity's docmentation to learn more about forcefeeding: VelocityJS.org/#forcefeeding */ 14014 function parsePropertyValue (valueData, skipResolvingEasing) { 14015 var endValue = undefined, 14016 easing = undefined, 14017 startValue = undefined; 14018 14019 /* Handle the array format, which can be structured as one of three potential overloads: 14020 A) [ endValue, easing, startValue ], B) [ endValue, easing ], or C) [ endValue, startValue ] */ 14021 if (Type.isArray(valueData)) { 14022 /* endValue is always the first item in the array. Don't bother validating endValue's value now 14023 since the ensuing property cycling logic does that. */ 14024 endValue = valueData[0]; 14025 14026 /* Two-item array format: If the second item is a number, function, or hex string, treat it as a 14027 start value since easings can only be non-hex strings or arrays. */ 14028 if ((!Type.isArray(valueData[1]) && /^[\d-]/.test(valueData[1])) || Type.isFunction(valueData[1]) || CSS.RegEx.isHex.test(valueData[1])) { 14029 startValue = valueData[1]; 14030 /* Two or three-item array: If the second item is a non-hex string or an array, treat it as an easing. */ 14031 } else if ((Type.isString(valueData[1]) && !CSS.RegEx.isHex.test(valueData[1])) || Type.isArray(valueData[1])) { 14032 easing = skipResolvingEasing ? valueData[1] : getEasing(valueData[1], opts.duration); 14033 14034 /* Don't bother validating startValue's value now since the ensuing property cycling logic inherently does that. */ 14035 if (valueData[2] !== undefined) { 14036 startValue = valueData[2]; 14037 } 14038 } 14039 /* Handle the single-value format. */ 14040 } else { 14041 endValue = valueData; 14042 } 14043 14044 /* Default to the call's easing if a per-property easing type was not defined. */ 14045 if (!skipResolvingEasing) { 14046 easing = easing || opts.easing; 14047 } 14048 14049 /* If functions were passed in as values, pass the function the current element as its context, 14050 plus the element's index and the element set's size as arguments. Then, assign the returned value. */
14051 if (Type.isFunction(endValue)) { 14052 endValue = endValue.call(element, elementsIndex, elementsLength); 14053 } 14054 14055 if (Type.isFunction(startValue)) { 14056 startValue = startValue.call(element, elementsIndex, elementsLength); 14057 } 14058 14059 /* Allow startValue to be left as undefined to indicate to the ensuing code that its value was not forcefed. */ 14060 return [ endValue || 0, easing, startValue ]; 14061 } 14062 14063 /* Cycle through each property in the map, looking for shorthand color properties (e.g. "color" as opposed to "colorRed"). Inject the corresponding 14064 colorRed, colorGreen, and colorBlue RGB component tweens into the propertiesMap (which Velocity understands) and remove the shorthand property. */ 14065 $.each(propertiesMap, function(property, value) { 14066 /* Find shorthand color properties that have been passed a hex string. */ 14067 if (RegExp("^" + CSS.Lists.colors.join("$|^") + "$").test(property)) { 14068 /* Parse the value data for each shorthand. */ 14069 var valueData = parsePropertyValue(value, true), 14070 endValue = valueData[0], 14071 easing = valueData[1], 14072 startValue = valueData[2]; 14073 14074 if (CSS.RegEx.isHex.test(endValue)) { 14075 /* Convert the hex strings into their RGB component arrays. */ 14076 var colorComponents = [ "Red", "Green", "Blue" ], 14077 endValueRGB = CSS.Values.hexToRgb(endValue), 14078 startValueRGB = startValue ? CSS.Values.hexToRgb(startValue) : undefined; 14079 14080 /* Inject the RGB component tweens into propertiesMap. */ 14081 for (var i = 0; i < colorComponents.length; i++) { 14082 var dataArray = [ endValueRGB[i] ]; 14083 14084 if (easing) { 14085 dataArray.push(easing); 14086 } 14087 14088 if (startValueRGB !== undefined) { 14089 dataArray.push(startValueRGB[i]); 14090 } 14091 14092 propertiesMap[property + colorComponents[i]] = dataArray; 14093 } 14094 14095 /* Remove the intermediary shorthand property entry now that we've processed it. */ 14096 delete propertiesMap[property]; 14097 } 14098 } 14099 }); 14100 14101 /* Create a tween out of each property, and append its associated data to tweensContainer. */ 14102 for (var property in propertiesMap) { 14103 14104 /************************** 14105 Start Value Sourcing 14106 **************************/ 14107 14108 /* Parse out endValue, easing, and startValue from the property's data. */ 14109 var valueData = parsePropertyValue(propertiesMap[property]), 14110 endValue = valueData[0], 14111 easing = valueData[1], 14112 startValue = valueData[2]; 14113 14114 /* Now that the original property name's format has been used for the parsePropertyValue() lookup above, 14115 we force the property to its camelCase styling to normalize it for manipulation. */ 14116 property = CSS.Names.camelCase(property); 14117 14118 /* In case this property is a hook, there are circumstances where we will intend to work on the hook's root property and not the hooked subproperty. */ 14119 var rootProperty = CSS.Hooks.getRoot(property), 14120 rootPropertyValue = false;
vendor: 9,779 bytes, lines 14121-14258
14121 14122 /* Properties that are not supported by the browser (and do not have an associated normalization) will 14123 inherently produce no style changes when set, so they are skipped in order to decrease animation tick overhead. 14124 Property support is determined via prefixCheck(), which returns a false flag when no supported is detected. */ 14125 /* Note: Since SVG elements have some of their properties directly applied as HTML attributes, 14126 there is no way to check for their explicit browser support, and so we skip skip this check for them. */ 14127 if (!Data(element).isSVG && CSS.Names.prefixCheck(rootProperty)[1] === false && CSS.Normalizations.registered[rootProperty] === undefined) { 14128 if (Velocity.debug) console.log("Skipping [" + rootProperty + "] due to a lack of browser support."); 14129 14130 continue; 14131 } 14132 14133 /* If the display option is being set to a non-"none" (e.g. "block") and opacity (filter on IE<=8) is being 14134 animated to an endValue of non-zero, the user's intention is to fade in from invisible, thus we forcefeed opacity 14135 a startValue of 0 if its startValue hasn't already been sourced by value transferring or prior forcefeeding. */ 14136 if (((opts.display !== undefined && opts.display !== null && opts.display !== "none") || (opts.visibility !== undefined && opts.visibility !== "hidden")) && /opacity|filter/.test(property) && !startValue && endValue !== 0) { 14137 startValue = 0; 14138 } 14139 14140 /* If values have been transferred from the previous Velocity call, extract the endValue and rootPropertyValue 14141 for all of the current call's properties that were *also* animated in the previous call. */ 14142 /* Note: Value transferring can optionally be disabled by the user via the _cacheValues option. */ 14143 if (opts._cacheValues && lastTweensContainer && lastTweensContainer[property]) { 14144 if (startValue === undefined) { 14145 startValue = lastTweensContainer[property].endValue + lastTweensContainer[property].unitType; 14146 } 14147 14148 /* The previous call's rootPropertyValue is extracted from the element's data cache since that's the 14149 instance of rootPropertyValue that gets freshly updated by the tweening process, whereas the rootPropertyValue 14150 attached to the incoming lastTweensContainer is equal to the root property's value prior to any tweening. */ 14151 rootPropertyValue = Data(element).rootPropertyValueCache[rootProperty]; 14152 /* If values were not transferred from a previous Velocity call, query the DOM as needed. */ 14153 } else { 14154 /* Handle hooked properties. */ 14155 if (CSS.Hooks.registered[property]) { 14156 if (startValue === undefined) { 14157 rootPropertyValue = CSS.getPropertyValue(element, rootProperty); /* GET */ 14158 /* Note: The following getPropertyValue() call does not actually trigger a DOM query; 14159 getPropertyValue() will extract the hook from rootPropertyValue. */ 14160 startValue = CSS.getPropertyValue(element, property, rootPropertyValue); 14161 /* If startValue is already defined via forcefeeding, do not query the DOM for the root property's value; 14162 just grab rootProperty's zero-value template from CSS.Hooks. This overwrites the element's actual 14163 root property value (if one is set), but this is acceptable since the primary reason users forcefeed is 14164 to avoid DOM queries, and thus we likewise avoid querying the DOM for the root property's value. */ 14165 } else { 14166 /* Grab this hook's zero-value template, e.g. "0px 0px 0px black". */ 14167 rootPropertyValue = CSS.Hooks.templates[rootProperty][1]; 14168 } 14169 /* Handle non-hooked properties that haven't already been defined via forcefeeding. */ 14170 } else if (startValue === undefined) { 14171 startValue = CSS.getPropertyValue(element, property); /* GET */ 14172 } 14173 } 14174 14175 /************************** 14176 Value Data Extraction 14177 **************************/ 14178 14179 var separatedValue, 14180 endValueUnitType, 14181 startValueUnitType, 14182 operator = false; 14183 14184 /* Separates a property value into its numeric value and its unit type. */ 14185 function separateValue (property, value) { 14186 var unitType, 14187 numericValue; 14188 14189 numericValue = (value || "0") 14190 .toString() 14191 .toLowerCase() 14192 /* Match the unit type at the end of the value. */ 14193 .replace(/[%A-z]+$/, function(match) { 14194 /* Grab the unit type. */ 14195 unitType = match; 14196 14197 /* Strip the unit type off of value. */ 14198 return ""; 14199 }); 14200 14201 /* If no unit type was supplied, assign one that is appropriate for this property (e.g. "deg" for rotateZ or "px" for width). */ 14202 if (!unitType) { 14203 unitType = CSS.Values.getUnitType(property); 14204 } 14205 14206 return [ numericValue, unitType ]; 14207 } 14208 14209 /* Separate startValue. */ 14210 separatedValue = separateValue(property, startValue); 14211 startValue = separatedValue[0]; 14212 startValueUnitType = separatedValue[1]; 14213 14214 /* Separate endValue, and extract a value operator (e.g. "+=", "-=") if one exists. */ 14215 separatedValue = separateValue(property, endValue); 14216 endValue = separatedValue[0].replace(/^([+-\/*])=/, function(match, subMatch) { 14217 operator = subMatch; 14218 14219 /* Strip the operator off of the value. */ 14220 return ""; 14221 }); 14222 endValueUnitType = separatedValue[1]; 14223 14224 /* Parse float values from endValue and startValue. Default to 0 if NaN is returned. */ 14225 startValue = parseFloat(startValue) || 0; 14226 endValue = parseFloat(endValue) || 0; 14227 14228 /*************************************** 14229 Property-Specific Value Conversion 14230 ***************************************/ 14231 14232 /* Custom support for properties that don't actually accept the % unit type, but where pollyfilling is trivial and relatively foolproof. */ 14233 if (endValueUnitType === "%") { 14234 /* A %-value fontSize/lineHeight is relative to the parent's fontSize (as opposed to the parent's dimensions), 14235 which is identical to the em unit's behavior, so we piggyback off of that. */ 14236 if (/^(fontSize|lineHeight)$/.test(property)) { 14237 /* Convert % into an em decimal value. */ 14238 endValue = endValue / 100; 14239 endValueUnitType = "em"; 14240 /* For scaleX and scaleY, convert the value into its decimal format and strip off the unit type. */ 14241 } else if (/^scale/.test(property)) { 14242 endValue = endValue / 100; 14243 endValueUnitType = ""; 14244 /* For RGB components, take the defined percentage of 255 and strip off the unit type. */ 14245 } else if (/(Red|Green|Blue)$/i.test(property)) { 14246 endValue = (endValue / 100) * 255; 14247 endValueUnitType = ""; 14248 } 14249 } 14250 14251 /*************************** 14252 Unit Ratio Calculation 14253 ***************************/ 14254 14255 /* When queried, the browser returns (most) CSS property values in pixels. Therefore, if an endValue with a unit type of 14256 %, em, or rem is animated toward, startValue must be converted from pixels into the same unit type as endValue in order 14257 for value manipulation logic (increment/decrement) to proceed. Further, if the startValue was forcefed or transferred 14258 from a previous call, startValue may al
14258so not be in pixels. Unit conversion logic therefore consists of two steps: 14259 1) Calculating the ratio of %/em/rem/vh/vw relative to pixels 14260 2) Converting startValue into the same unit of measurement as endValue based on these ratios. */ 14261 /* Unit conversion ratios are calculated by inserting a sibling node next to the target node, copying over its position property, 14262 setting values with the target unit type then comparing the returned pixel value. */ 14263 /* Note: Even if only one of these unit types is being animated, all unit ratios are calculated at once since the overhead 14264 of batching the SETs and GETs together upfront outweights the potential overhead 14265 of layout thrashing caused by re-querying for uncalculated ratios for subsequently-processed properties. */ 14266 /* Todo: Shift this logic into the calls' first tick instance so that it's synced with RAF. */ 14267 function calculateUnitRatios () { 14268 14269 /************************ 14270 Same Ratio Checks 14271 ************************/ 14272 14273 /* The properties below are used to determine whether the element differs sufficiently from this call's 14274 previously iterated element to also differ in its unit conversion ratios. If the properties match up with those 14275 of the prior element, the prior element's conversion ratios are used. Like most optimizations in Velocity, 14276 this is done to minimize DOM querying. */ 14277 var sameRatioIndicators = { 14278 myParent: element.parentNode || document.body, /* GET */ 14279 position: CSS.getPropertyValue(element, "position"), /* GET */ 14280 fontSize: CSS.getPropertyValue(element, "fontSize") /* GET */ 14281 }, 14282 /* Determine if the same % ratio can be used. % is based on the element's position value and its parent's width and height dimensions. */ 14283 samePercentRatio = ((sameRatioIndicators.position === callUnitConversionData.lastPosition) && (sameRatioIndicators.myParent === callUnitConversionData.lastParent)), 14284 /* Determine if the same em ratio can be used. em is relative to the element's fontSize. */ 14285 sameEmRatio = (sameRatioIndicators.fontSize === callUnitConversionData.lastFontSize); 14286 14287 /* Store these ratio indicators call-wide for the next element to compare against. */ 14288 callUnitConversionData.lastParent = sameRatioIndicators.myParent; 14289 callUnitConversionData.lastPosition = sameRatioIndicators.position; 14290 callUnitConversionData.lastFontSize = sameRatioIndicators.fontSize; 14291 14292 /*************************** 14293 Element-Specific Units 14294 ***************************/ 14295 14296 /* Note: IE8 rounds to the nearest pixel when returning CSS values, thus we perform conversions using a measurement 14297 of 100 (instead of 1) to give our ratios a precision of at least 2 decimal values. */ 14298 var measurement = 100, 14299 unitRatios = {}; 14300 14301 if (!sameEmRatio || !samePercentRatio) { 14302 var dummy = Data(element).isSVG ? document.createElementNS("http://www.w3.org/2000/svg", "rect") : document.createElement("div"); 14303 14304 Velocity.init(dummy); 14305 sameRatioIndicators.myParent.appendChild(dummy); 14306 14307 /* To accurately and consistently calculate conversion ratios, the element's cascaded overflow and box-sizing are stripped. 14308 Similarly, since width/height can be artificially constrained by their min-/max- equivalents, these are controlled for as well. */ 14309 /* Note: Overflow must be also be c
vendor: 5,082 bytes, lines 14309-14372
14309ontrolled for per-axis since the overflow property overwrites its per-axis values. */ 14310 $.each([ "overflow", "overflowX", "overflowY" ], function(i, property) { 14311 Velocity.CSS.setPropertyValue(dummy, property, "hidden"); 14312 }); 14313 Velocity.CSS.setPropertyValue(dummy, "position", sameRatioIndicators.position); 14314 Velocity.CSS.setPropertyValue(dummy, "fontSize", sameRatioIndicators.fontSize); 14315 Velocity.CSS.setPropertyValue(dummy, "boxSizing", "content-box"); 14316 14317 /* width and height act as our proxy properties for measuring the horizontal and vertical % ratios. */ 14318 $.each([ "minWidth", "maxWidth", "width", "minHeight", "maxHeight", "height" ], function(i, property) { 14319 Velocity.CSS.setPropertyValue(dummy, property, measurement + "%"); 14320 }); 14321 /* paddingLeft arbitrarily acts as our proxy property for the em ratio. */ 14322 Velocity.CSS.setPropertyValue(dummy, "paddingLeft", measurement + "em"); 14323 14324 /* Divide the returned value by the measurement to get the ratio between 1% and 1px. Default to 1 since working with 0 can produce Infinite. */ 14325 unitRatios.percentToPxWidth = callUnitConversionData.lastPercentToPxWidth = (parseFloat(CSS.getPropertyValue(dummy, "width", null, true)) || 1) / measurement; /* GET */ 14326 unitRatios.percentToPxHeight = callUnitConversionData.lastPercentToPxHeight = (parseFloat(CSS.getPropertyValue(dummy, "height", null, true)) || 1) / measurement; /* GET */ 14327 unitRatios.emToPx = callUnitConversionData.lastEmToPx = (parseFloat(CSS.getPropertyValue(dummy, "paddingLeft")) || 1) / measurement; /* GET */ 14328 14329 sameRatioIndicators.myParent.removeChild(dummy); 14330 } else { 14331 unitRatios.emToPx = callUnitConversionData.lastEmToPx; 14332 unitRatios.percentToPxWidth = callUnitConversionData.lastPercentToPxWidth; 14333 unitRatios.percentToPxHeight = callUnitConversionData.lastPercentToPxHeight; 14334 } 14335 14336 /*************************** 14337 Element-Agnostic Units 14338 ***************************/ 14339 14340 /* Whereas % and em ratios are determined on a per-element basis, the rem unit only needs to be checked 14341 once per call since it's exclusively dependant upon document.body's fontSize. If this is the first time 14342 that calculateUnitRatios() is being run during this call, remToPx will still be set to its default value of null, 14343 so we calculate it now. */ 14344 if (callUnitConversionData.remToPx === null) { 14345 /* Default to browsers' default fontSize of 16px in the case of 0. */ 14346 callUnitConversionData.remToPx = parseFloat(CSS.getPropertyValue(document.body, "fontSize")) || 16; /* GET */ 14347 } 14348 14349 /* Similarly, viewport units are %-relative to the window's inner dimensions. */ 14350 if (callUnitConversionData.vwToPx === null) { 14351 callUnitConversionData.vwToPx = parseFloat(window.innerWidth) / 100; /* GET */ 14352 callUnitConversionData.vhToPx = parseFloat(window.innerHeight) / 100; /* GET */ 14353 } 14354 14355 unitRatios.remToPx = callUnitConversionData.remToPx; 14356 unitRatios.vwToPx = callUnitConversionData.vwToPx; 14357 unitRatios.vhToPx = callUnitConversionData.vhToPx; 14358 14359 if (Velocity.debug >= 1) console.log("Unit ratios: " + JSON.stringify(unitRatios), element); 14360 14361 return unitRatios; 14362 } 14363 14364 /******************** 14365 Unit Conversion 14366 ********************/ 14367 14368 /* The * and / operators, which are not passed in with an associated unit, inherently use startValue's unit. Skip value and unit conversion. */ 14369 if (/[\/*]/.test(operator)) { 14370 endValueUnitType = startValueUnitType; 14371 /* If startValue and endValue differ in unit type, convert startValue into the same unit type as endValue so that if endValueUnitType 14372 is a relative unit (%, em, rem), the values set during tweening will continue to be accurately relative even if the metrics they depen
14372d 14373 on are dynamically changing during the course of the animation. Conversely, if we always normalized into px and used px for setting values, the px ratio 14374 would become stale if the original unit being animated toward was relative and the underlying metrics change during the animation. */ 14375 /* Since 0 is 0 in any unit type, no conversion is necessary when startValue is 0 -- we just start at 0 with endValueUnitType. */ 14376 } else if ((startValueUnitType !== endValueUnitType) && startValue !== 0) { 14377 /* Unit conversion is also skipped when endValue is 0, but *startValueUnitType* must be used for tween values to remain accurate. */ 14378 /* Note: Skipping unit conversion here means that if endValueUnitType was originally a relative unit, the animation won't relatively 14379 match the underlying metrics if they change, but this is acceptable since we're animating toward invisibility instead of toward visibility, 14380 which remains past the point of the animation's completion. */ 14381 if (endValue === 0) { 14382 endValueUnitType = startValueUnitType; 14383 } else { 14384 /* By this point, we cannot avoid unit conversion (it's undesirable since it causes layout thrashing). 14385 If we haven't already, we trigger calculateUnitRatios(), which runs once per element per call. */ 14386 elementUnitConversionData = elementUnitConversionData || calculateUnitRatios(); 14387 14388 /* The following RegEx matches CSS properties that have their % values measured relative to the x-axis. */ 14389 /* Note: W3C spec mandates that all of margin and padding's properties (even top and bottom) are %-relative to the *width* of the parent element. */ 14390 var axis = (/margin|padding|left|right|width|text|word|letter/i.test(property) || /X$/.test(property) || property === "x") ? "x" : "y"; 14391 14392 /* In order to avoid generating n^2 bespoke conversion functions, unit conversion is a two-step process: 14393 1) Convert startValue into pixels. 2) Convert this new pixel value into endValue's unit type. */ 14394 switch (startValueUnitType) { 14395 case "%": 14396 /* Note: translateX and translateY are the only properties that are %-relative to an element's own dimensions -- not its parent's dimensions. 14397 Velocity does not include a special conversion process to account for this behavior. Therefore, animating translateX/Y from a % value 14398 to a non-% value will produce an incorrect start value. Fortunately, this sort of cross-unit conversion is rarely done by users in practice. */ 14399 startValue *= (axis === "x" ? elementUnitConversionData.percentToPxWidth : elementUnitConversionData.percentToPxHeight); 14400 break; 14401 14402 case "px": 14403 /* px acts as our midpoint in the unit conversion process; do nothing. */ 14404 break; 14405 14406 default: 14407 startValue *= elementUnitConversionData[startValueUnitType + "ToPx"]; 14408 } 14409 14410 /* Invert the px ratios to convert into to the target unit. */ 14411 switch (endValueUnitType) { 14412 case "%": 14413 startValue *= 1 / (axis === "x" ? elementUnitConversionData.percentToPxWidth : elementUnitConversionData.percentToPxHeight); 14414 break; 14415 14416 case "px": 14417 /* startValue is already in px, do nothing; we're done. */ 14418 break; 14419 14420 default: 14421 startValue *= 1 / elementUnitConversionData[endValueUnitType + "ToPx"]; 14422 } 14423 } 14424 } 14425 14426 /********************* 14427 Relative Values 14428 *********************/ 14429 14430 /* Operator logic must be performed last since it requires unit-normalized start and end values. */ 14431 /* Note: Relative *percent values* do not behave how most people think; while one would expect "+=50%" 14432 to increase the property 1.5x its current value, it in fact increases the percent units in absolute terms: 14433 50 points is added on top of the current % value. */ 14434 switch (operator) { 14435 case "+": 14436 endValue = startValue + endValue; 14437 break; 14438 14439 case "-": 14440 endValue = startValue - endValue; 14441 break; 14442 14443 case "*": 14444 endValue = startValue * endValue; 14445 break; 14446 14447 case "/": 14448 endValue = startValue / endValue; 14449 break; 14450 } 14451 14452 /************************** 14453 tweensContainer Push 14454 **************************/ 14455 14456 /* Construct the per-property tween object, and push it to the element's tweensContainer. */ 14457 tweensContainer[property] = { 14458 rootPropertyValue: rootPropertyValue, 14459 startValue: startValue, 14460 currentValue: startValue, 14461 endValue: endValue, 14462 unitType: endValueUnitType, 14463 easing: easing 14464 }; 14465 14466 if (Velocity.debug) console.log("tweensContainer (" + property + "): " + JSON.stringify(tweensContainer[property]), element); 14467 } 14468 14469 /* Along with its property data, store a reference to the element itself onto tweensContainer. */ 14470 tweensContainer.element = element; 14471 } 14472 14473 /***************** 14474 Call Push 14475 *****************/ 14476 14477 /* Note: tweensContainer can be empty if all of the properties in this call's property map were skipped due to not 14478 being supported by the browser. The element property is used for checking that the tweensContainer has been appended to. */ 14479 if (tweensContainer.element) { 14480 /* Apply the "velocity-animating" indicator class. */ 14481 CSS.Values.addClass(element, "velocity-animating"); 14482 14483 /* The call array houses the tweensContainers for each element being animated in the current call. */ 14484 call.push(tweensContainer); 14485 14486 /* Store the tweensContainer and options if we're working on the default effects queue, so that they can be used by the reverse command. */ 14487 if (opts.queue === "") { 14488 Data(element).tweensContainer = tweensContainer; 14489 Data(element).opts = opts; 14490 } 14491 14492 /* Switch on the element's animating flag. */ 14493 Data(element).isAnimating = true; 14494 14495 /* Once the final element in this call's element set has been processed, push the call array onto 14496 Velocity.State.calls for the animation tick to immediately begin processing. */ 14497 if (elementsIndex === elementsLength - 1) { 14498 /* To speed up iterating over this array, it is compacted (falsey items -- calls that have completed -- are removed) 14499 when its length has ballooned to a point that can impact tick performance. This only becomes necessary when animation 14500 has been continuous with many elements over a long period of time; whenever all active calls are completed, completeCall() clears Velocity.State.calls. */ 14501 if (Velocity.State.calls.length > 10000) { 14502 Velocity.State.calls = compactSparseArray(Velocity.State.calls); 14503 } 14504 14505 /* Add the current call plus its associated metadata (the element set and the call's options) onto the global call container. 14506 Anything on this call container is subjected to tick() processing. */ 14507 Velocity.State.calls.push([ call, elements, opts, null, promiseData.resolver ]); 14508 14509 /* If the animation tick isn't running, start it. (Velocity shuts it off when there are no active calls to process.) */ 14510 if (Velocity.State.isTicking === false) { 14511 Velocity.State.isTicking = true; 14512 14513 /* Start the tick loop. */ 14514 tick(); 14515 } 14516 } else { 14517 elementsIndex++; 14518 } 14519 } 14520 } 14521 14522 /* When the queue option is set to false, the call skips the element's queue and fires immediately. */ 14523 if (opts.queue === false) { 14524 /* Since this buildQueue call doesn't respect the element's existing queue (which is where a delay option would have been appended), 14525 we manually inject the delay property here with an explicit setTimeout. */ 14526 if (opts.delay) { 14527 setTimeout(buildQueue, opts.delay); 14528 } else { 14529 buildQueue(); 14530 } 14531 /* Otherwise, the call undergoes element queueing as normal. */ 14532 /* Note: To interoperate with jQuery, Velocity uses jQuery's own $.queue() stack for queuing logic. */ 14533 } else { 14534 $.queue(element, opts.queue, function(next, clearQueue) { 14535 /* If the clearQueue flag was passed in by the stop command, resolve this call's promise. (Promises can only be resolved once, 14536 so it's fine if this is repeatedly triggered for each element in the associated call.) */ 14537 if (clearQueue === true) { 14538 if (promiseData.promise) { 14539 promiseData.resolver(elements); 14540 } 14541 14542 /* Do not continue with animation queueing. */ 14543 return true; 14544 } 14545 14546 /* This flag indicates to the upcoming completeCall() function that this queue entry was initiated by Velocity. 14547 See completeCall() for further details. */ 14548 Velocity.velocityQueueEntryFlag = true; 14549 14550 buildQueue(next); 14551 }); 14552 } 14553 14554 /********************* 14555 Auto-Dequeuing 14556 *********************/ 14557 14558 /* As per jQuery's $.queue() behavior, to fire the first non-custom-queue entry on an element, the element 14559 must be dequeued if its queue stack consists *solely* of the current call. (This can be determined by checking 14560 for the "inprogress" item that jQuery prepends to active queue stack arrays.) Regardless, whenever the element's 14561 queue is further appended with additional items -- including $.delay()'s or even $.animate() calls, the queue's 14562 first entry is automatically fired. This behavior contrasts that of custom queues, which never auto-fire. */ 14563 /* Note: When an element set is being subjected to a non-parallel Velocity call, the animation will not begin until 14564 each one of the elements in the set has reached the end of its individually pre-existing queue chain. */ 14565 /* Note: Unfortunately, most people don't fully grasp jQuery's powerful, yet quirky, $.queue() function. 14566 Lean more here: http://stackoverflow.com/questions/1058158/can-somebody-explain-jquery-queue-to-me */ 14567 if ((opts.queue === "" || opts.queue === "fx") && $.queue(element)[0] !== "inprogress") { 14568 $.dequeue(element); 14569 } 14570 } 14571 14572 /************************** 14573 Element Set Iteration 14574 **************************/ 14575 14576 /* If the "nodeType" property exists on the elements variable, we're animating a single element. 14577 Place it in an array so that $.each() can iterate over it. */ 14578 $.each(elements, function(i, element) { 14579 /* Ensure each element in a set has a nodeType (is a real element) to avoid throwing errors. */ 14580 if (Type.isNode(element)) { 14581 processElement.call(element); 14582 } 14583 }); 14584 14585 /****************** 14586 Option: Loop 14587 ******************/ 14588 14589 /* The loop option accepts an integer indicating how many times the element should loop between the values in the 14590 current call's properties map and the element's property values prior to this call. */ 14591 /* Note: The loop option's logic is performed here -- after element processing -- because the current call needs 14592 to undergo its queue insertion prior to the loop option generating its series of constituent "reverse" calls, 14593 which chain after the current call. Two reverse calls (two "alternations") constitute one loop. */ 14594 var opts = $.extend({}, Velocity.defaults, options), 14595 reverseCallsCount; 14596 14597 opts.loop = parseInt(opts.loop); 14598 reverseCallsCount = (opts.loop * 2) - 1; 14599 14600 if (opts.loop) {
14601 /* Double the loop count to convert it into its appropriate number of "reverse" calls. 14602 Subtract 1 from the resulting value since the current call is included in the total alternation count. */ 14603 for (var x = 0; x < reverseCallsCount; x++) { 14604 /* Since the logic for the reverse action occurs inside Queueing and therefore this call's options object 14605 isn't parsed until then as well, the current call's delay option must be explicitly passed into the reverse 14606 call so that the delay logic that occurs inside *Pre-Queueing* can process it. */ 14607 var reverseOptions = { 14608 delay: opts.delay, 14609 progress: opts.progress 14610 }; 14611 14612 /* If a complete callback was passed into this call, transfer it to the loop redirect's final "reverse" call 14613 so that it's triggered when the entire redirect is complete (and not when the very first animation is complete). */ 14614 if (x === reverseCallsCount - 1) { 14615 reverseOptions.display = opts.display; 14616 reverseOptions.visibility = opts.visibility; 14617 reverseOptions.complete = opts.complete; 14618 } 14619 14620 animate(elements, "reverse", reverseOptions); 14621 } 14622 } 14623 14624 /*************** 14625 Chaining 14626 ***************/ 14627 14628 /* Return the elements back to the call chain, with wrapped elements taking precedence in case Velocity was called via the $.fn. extension. */ 14629 return getChain(); 14630 }; 14631 14632 /* Turn Velocity into the animation function, extended with the pre-existing Velocity object. */ 14633 Velocity = $.extend(animate, Velocity); 14634 /* For legacy support, also expose the literal animate method. */ 14635 Velocity.animate = animate; 14636 14637 /************** 14638 Timing 14639 **************/ 14640 14641 /* Ticker function. */ 14642 var ticker = window.requestAnimationFrame || rAFShim; 14643 14644 /* Inactive browser tabs pause rAF, which results in all active animations immediately sprinting to their completion states when the tab refocuses. 14645 To get around this, we dynamically switch rAF to setTimeout (which the browser *doesn't* pause) when the tab loses focus. We skip this for mobile 14646 devices to avoid wasting battery power on inactive tabs. */ 14647 /* Note: Tab focus detection doesn't work on older versions of IE, but that's okay since they don't support rAF to begin with. */ 14648 if (!Velocity.State.isMobile && document.hidden !== undefined) { 14649 document.addEventListener("visibilitychange", function() { 14650 /* Reassign the rAF function (which the global tick() function uses) based on the tab's focus state. */ 14651 if (document.hidden) { 14652 ticker = function(callback) { 14653 /* The tick function needs a truthy first argument in order to pass its internal timestamp check. */ 14654 return setTimeout(function() { callback(true) }, 16); 14655 }; 14656 14657 /* The rAF loop has been paused by the browser, so we manually restart the tick. */ 14658 tick(); 14659 } else { 14660 ticker = window.requestAnimationFrame || rAFShim; 14661 } 14662 }); 14663 } 14664 14665 /************ 14666 Tick 14667 ************/ 14668 14669 /* Note: All calls to Velocity are pushed to the Velocity.State.calls array, which is fully iterated through upon each tick. */ 14670 function tick (timestamp) { 14671 /* An empty timestamp argument indicates that this is the first tick occurence since ticking was turned on. 14672 We leverage this metadata to fully ignore the first tick pass since RAF's initial pass is fired whenever 14673 the browser's next tick sync time occurs, which results in the first elements subjected to Velocity 14674 calls being animated out of sync with any elements animated immediately thereafter. In short, we ignore 14675 the first RAF tick pass so that elements being immediately consecutively animated -- instead of simultaneously animated 14676 by the same Velocity call -- are properly batched into the same initial RAF tick and consequently remain in sync thereafter. */ 14677 if (timestamp) { 14678 /* We ignore RAF's high resolution timestamp since it can be significantly offset when the browser is 14679 under high stress; we opt for choppiness over allowing the browser to drop huge chunks of frames. */ 14680 var timeCurrent = (new Date).getTime(); 14681 14682 /******************** 14683 Call Iteration 14684 ********************/ 14685 14686 /* Iterate through each active call. */ 14687 for (var i = 0, callsLength = Velocity.State.calls.length; i < callsLength; i++) { 14688 /* When a Velocity call is completed, its Velocity.State.calls entry is set to false. Continue on to the next call. */ 14689 if (!Velocity.State.calls[i]) { 14690 continue; 14691 } 14692 14693 /************************ 14694 Call-Wide Variables 14695 ************************/ 14696 14697 var callContainer = Velocity.State.calls[i], 14698 call = callContainer[0], 14699 opts = callContainer[2], 14700 timeStart = callContainer[3], 14701 firstTick = !!timeStart; 14702 14703 /* If timeStart is undefined, then this is the first time that this call has been processed by tick(). 14704 We assign timeStart now so that its value is as close to the real animation start time as possible. 14705 (Conversely, had timeStart been defined when this call was added to Velocity.State.calls, the delay 14706 between that time and now would cause the first few frames of the tween to be skipped since 14707 percentComplete is calculated relative to timeStart.) */ 14708 /* Further, subtract 16ms (the approximate resolution of RAF) from the current time value so that the 14709 first tick iteration isn't wasted by animating at 0% tween completion, which would produce the 14710 same style value as the element's current value. */ 14711 if (!timeStart) { 14712 timeStart = Velocity.State.calls[i][3] = timeCurrent - 16; 14713 } 14714 14715 /* The tween's completion percentage is relative to the tween's start time, not the tween's start value 14716 (which would result in unpredictable tween durations since JavaScript's timers are not particularly accurate). 14717 Accordingly, we ensure that percentComplete does not exceed 1. */ 14718 var percentComplete = Math.min((timeCurrent - timeStart) / opts.duration, 1); 14719 14720 /********************** 14721 Element Iteration 14722 **********************/ 14723 14724 /* For every call, iterate through each of the elements in its set. */ 14725 for (var j = 0, callLength = call.length; j < callLength; j++) { 14726 var tweensContainer = call[j], 14727 element = tweensContainer.element; 14728 14729 /* Check to see if this element has been deleted midway through the animation by checking for the 14730 continued existence of its data cache. If it's gone, skip animating this element. */ 14731 if (!Data(element)) { 14732 continue; 14733 } 14734 14735 var transformPropertyExists = false;
14736 14737 /********************************** 14738 Display & Visibility Toggling 14739 **********************************/ 14740 14741 /* If the display option is set to non-"none", set it upfront so that the element can become visible before tweening begins. 14742 (Otherwise, display's "none" value is set in completeCall() once the animation has completed.) */ 14743 if (opts.display !== undefined && opts.display !== null && opts.display !== "none") { 14744 if (opts.display === "flex") { 14745 var flexValues = [ "-webkit-box", "-moz-box", "-ms-flexbox", "-webkit-flex" ]; 14746 14747 $.each(flexValues, function(i, flexValue) { 14748 CSS.setPropertyValue(element, "display", flexValue); 14749 }); 14750 } 14751 14752 CSS.setPropertyValue(element, "display", opts.display); 14753 } 14754 14755 /* Same goes with the visibility option, but its "none" equivalent is "hidden". */ 14756 if (opts.visibility !== undefined && opts.visibility !== "hidden") { 14757 CSS.setPropertyValue(element, "visibility", opts.visibility); 14758 } 14759 14760 /************************ 14761 Property Iteration 14762 ************************/ 14763 14764 /* For every element, iterate through each property. */ 14765 for (var property in tweensContainer) { 14766 /* Note: In addition to property tween data, tweensContainer contains a reference to its associated element. */ 14767 if (property !== "element") { 14768 var tween = tweensContainer[property], 14769 currentValue, 14770 /* Easing can either be a pre-genereated function or a string that references a pre-registered easing 14771 on the Velocity.Easings object. In either case, return the appropriate easing *function*. */ 14772 easing = Type.isString(tween.easing) ? Velocity.Easings[tween.easing] : tween.easing; 14773 14774 /****************************** 14775 Current Value Calculation 14776 ******************************/ 14777 14778 /* If this is the last tick pass (if we've reached 100% completion for this tween), 14779 ensure that currentValue is explicitly set to its target endValue so that it's not subjected to any rounding. */ 14780 if (percentComplete === 1) { 14781 currentValue = tween.endValue; 14782 /* Otherwise, calculate currentValue based on the current delta from startValue. */ 14783 } else { 14784 currentValue = tween.startValue + ((tween.endValue - tween.startValue) * easing(percentComplete)); 14785 14786 /* If no value change is occurring, don't proceed with DOM updating. */ 14787 if (!firstTick && (currentValue === tween.currentValue)) { 14788 continue; 14789 } 14790 } 14791 14792 tween.currentValue = currentValue; 14793 14794 /****************** 14795 Hooks: Part I 14796 ******************/ 14797 14798 /* For hooked properties, the newly-updated rootPropertyValueCache is cached onto the element so that it can be used 14799 for subsequent hooks in this call that are associated with the same root property. If we didn't cache the updated 14800 rootPropertyValue, each subsequent update to the root property in this tick pass would reset the previous hook's 14801 updates to rootPropertyValue prior to injection. A nice performance byproduct of rootPropertyValue caching is that 14802 subsequently chained animations using the same hookRoot but a different hook can use this cached rootPropertyValue. */ 14803 if (CSS.Hooks.registered[property]) { 14804 var hookRoot = CSS.Hooks.getRoot(property), 14805 rootPropertyValueCache = Data(element).rootPropertyValueCache[hookRoot]; 14806 14807 if (rootPropertyValueCache) { 14808 tween.rootPropertyValue = rootPropertyValueCache; 14809 } 14810 } 14811 14812 /***************** 14813 DOM Update 14814 *****************/ 14815 14816 /* setPropertyValue() returns an array of the property name and property value post any normalization that may have been performed. */ 14817 /* Note: To solve an IE<=8 positioning bug, the unit type is dropped when setting a property value of 0. */ 14818 var adjustedSetData = CSS.setPropertyValue(element, /* SET */ 14819 property, 14820 tween.currentValue + (parseFloat(currentValue) === 0 ? "" : tween.unitType), 14821 tween.rootPropertyValue, 14822 tween.scrollData); 14823 14824 /******************* 14825 Hooks: Part II 14826 *******************/ 14827 14828 /* Now that we have the hook's updated rootPropertyValue (the post-processed value provided by adjustedSetData), cache it onto the element. */ 14829 if (CSS.Hooks.registered[property]) { 14830 /* Since adjustedSetData contains
vendor: 4,410 bytes, lines 14830-14919
14830normalized data ready for DOM updating, the rootPropertyValue needs to be re-extracted from its normalized form. ?? */ 14831 if (CSS.Normalizations.registered[hookRoot]) { 14832 Data(element).rootPropertyValueCache[hookRoot] = CSS.Normalizations.registered[hookRoot]("extract", null, adjustedSetData[1]); 14833 } else { 14834 Data(element).rootPropertyValueCache[hookRoot] = adjustedSetData[1]; 14835 } 14836 } 14837 14838 /*************** 14839 Transforms 14840 ***************/ 14841 14842 /* Flag whether a transform property is being animated so that flushTransformCache() can be triggered once this tick pass is complete. */ 14843 if (adjustedSetData[0] === "transform") { 14844 transformPropertyExists = true; 14845 } 14846 } 14847 } 14848 14849 /**************** 14850 mobileHA 14851 ****************/ 14852 14853 /* If mobileHA is enabled, set the translate3d transform to null to force hardware acceleration. 14854 It's safe to override this property since Velocity doesn't actually support its animation (hooks are used in its place). */ 14855 if (opts.mobileHA) { 14856 /* Don't set the null transform hack if we've already done so. */ 14857 if (Data(element).transformCache.translate3d === undefined) { 14858 /* All entries on the transformCache object are later concatenated into a single transform string via flushTransformCache(). */ 14859 Data(element).transformCache.translate3d = "(0px, 0px, 0px)"; 14860 14861 transformPropertyExists = true; 14862 } 14863 } 14864 14865 if (transformPropertyExists) { 14866 CSS.flushTransformCache(element); 14867 } 14868 } 14869 14870 /* The non-"none" display value is only applied to an element once -- when its associated call is first ticked through. 14871 Accordingly, it's set to false so that it isn't re-processed by this call in the next tick. */ 14872 if (opts.display !== undefined && opts.display !== "none") { 14873 Velocity.State.calls[i][2].display = false; 14874 } 14875 if (opts.visibility !== undefined && opts.visibility !== "hidden") { 14876 Velocity.State.calls[i][2].visibility = false; 14877 } 14878 14879 14880 /* Pass the elements and the timing data (percentComplete, msRemaining, and timeStart) into the progress callback. */ 14881 if (opts.progress) { 14882 opts.progress.call(callContainer[1], 14883 callContainer[1], 14884 percentComplete, 14885 Math.max(0, (timeStart + opts.duration) - timeCurrent), 14886 timeStart); 14887 } 14888 14889 /* If this call has finished tweening, pass its index to completeCall() to handle call cleanup. */ 14890 if (percentComplete === 1) { 14891 completeCall(i); 14892 } 14893 } 14894 } 14895 14896 /* Note: completeCall() sets the isTicking flag to false when the last call on Velocity.State.calls has completed. */ 14897 if (Velocity.State.isTicking) { 14898 ticker(tick); 14899 } 14900 } 14901 14902 /********************** 14903 Call Completion 14904 **********************/ 14905 14906 /* Note: Unlike tick(), which processes all active calls at once, call completion is handled on a per-call basis. */ 14907 function completeCall (callIndex, isStopped) { 14908 /* Ensure the call exists. */ 14909 if (!Velocity.State.calls[callIndex]) { 14910 return false; 14911 } 14912 14913 /* Pull the metadata from the call. */ 14914 var call = Velocity.State.calls[callIndex][0], 14915 elements = Velocity.State.calls[callIndex][1], 14916 opts = Velocity.State.calls[callIndex][2], 14917 resolver = Velocity.State.calls[callIndex][4]; 14918 14919 var remainingCallsExist = false;
14920 14921 /************************* 14922 Element Finalization 14923 *************************/ 14924 14925 for (var i = 0, callLength = call.length; i < callLength; i++) { 14926 var element = call[i].element; 14927 14928 /* If the user set display to "none" (intending to hide the element), set it now that the animation has completed. */ 14929 /* Note: display:none isn't set when calls are manually stopped (via Velocity("stop"). */ 14930 /* Note: Display gets ignored with "reverse" calls and infinite loops, since this behavior would be undesirable. */ 14931 if (!isStopped && !opts.loop) { 14932 if (opts.display === "none") { 14933 CSS.setPropertyValue(element, "display", opts.display); 14934 } 14935 14936 if (opts.visibility === "hidden") { 14937 CSS.setPropertyValue(element, "visibility", opts.visibility); 14938 } 14939 } 14940 14941 /* If the element's queue is empty (if only the "inprogress" item is left at position 0) or if its queue is about to run 14942 a non-Velocity-initiated entry, turn off the isAnimating flag. A non-Velocity-initiatied queue entry's logic might alter 14943 an element's CSS values and thereby cause Velocity's cached value data to go stale. To detect if a queue entry was initiated by Velocity, 14944 we check for the existence of our special Velocity.queueEntryFlag declaration, which minifiers won't rename since the flag 14945 is assigned to jQuery's global $ object and thus exists out of Velocity's own scope. */ 14946 if (opts.loop !== true && ($.queue(element)[1] === undefined || !/\.velocityQueueEntryFlag/i.test($.queue(element)[1]))) { 14947 /* The element may have been deleted. Ensure that its data cache still exists before acting on it. */ 14948 if (Data(element)) { 14949 Data(element).isAnimating = false; 14950 /* Clear the element's rootPropertyValueCache, which will become stale. */ 14951 Data(element).rootPropertyValueCache = {}; 14952 14953 var transformHAPropertyExists = false; 14954 /* If any 3D transform subproperty is at its default value (regardless of unit type), remove it. */ 14955 $.each(CSS.Lists.transforms3D, function(i, transformName) { 14956 var defaultValue = /^scale/.test(transformName) ? 1 : 0, 14957 currentValue = Data(element).transformCache[transformName]; 14958 14959 if (Data(element).transformCache[transformName] !== undefined && new RegExp("^\\(" + defaultValue + "[^.]").test(currentValue)) { 14960 transformHAPropertyExists = true; 14961 14962 delete Data(element).transformCache[transformName]; 14963 } 14964 }); 14965 14966 /* Mobile devices have hardware acceleration removed at the end of the animation in order to avoid hogging the GPU's memory. */ 14967 if (opts.mobileHA) { 14968 transformHAPropertyExists = true; 14969 delete Data(element).transformCache.translate3d; 14970 } 14971 14972 /* Flush the subproperty removals to the DOM. */ 14973 if (transformHAPropertyExists) { 14974 CSS.flushTransformCache(element); 14975 } 14976 14977 /* Remove the "velocity-animating" indicator class. */ 14978 CSS.Values.removeClass(element, "velocity-animating"); 14979 } 14980 } 14981 14982 /********************* 14983 Option: Complete 14984 *********************/ 14985 14986 /* Complete is fired once per call (not once per element) and is passed the full raw DOM element set as both its context and its first argument. */ 14987 /* Note: Callbacks aren't fired when calls are manually stopped (via Velocity("stop"). */ 14988 if (!isStopped && opts.complete && !opts.loop && (i === callLength - 1)) { 14989 /* We throw callbacks in a setTimeout so that thrown errors don't halt the execution of Velocity itself. */ 14990 try { 14991 opts.complete.call(elements, elements); 14992 } catch (error) { 14993 setTimeout(function() { throw error; }, 1); 14994 } 14995 } 14996 14997 /********************** 14998 Promise Resolving 14999 **********************/ 15000 15001 /* Note: Infinite loops don't return promises. */ 15002 if (resolver && opts.loop !== true) { 15003 resolver(elements); 15004 } 15005 15006 /**************************** 15007 Option: Loop (Infinite) 15008 ****************************/ 15009 15010 if (opts.loop === true && !isStopped) { 15011 /* If a rotateX/Y/Z property is being animated to 360 deg with loop:true, swap tween start/end values to enable 15012 continuous iterative rotation looping. (Otherise, the element would just rotate back and forth.) */ 15013 $.each(Data(element).tweensContainer, function(propertyName, tweenContainer) { 15014 if (/^rotate/.test(propertyName) && parseFloat(tweenContainer.endValue) === 360) { 15015 tweenContainer.endValue = 0; 15016 tweenContainer.startValue = 360; 15017 } 15018 }); 15019 15020 Velocity(element, "reverse", { loop: true, delay: opts.delay }); 15021 } 15022 15023 /*************** 15024 Dequeueing 15025 ***************/ 15026 15027 /* Fire the next call in the queue so long as this call's queue wasn't set to false (to trigger a parallel animation), 15028 which would have already caused the next call to fire. Note: Even if the end of the animation queue has been reached, 15029 $.dequeue() must still be called in order to completely clear jQuery's animation queue. */ 15030 if (opts.queue !== false) { 15031 $.dequeue(element, opts.queue); 15032 } 15033 } 15034 15035 /************************ 15036 Calls Array Cleanup 15037 ************************/ 15038 15039 /* Since this call is complete, set it to false so that the rAF tick skips it. This array is later compacted via compactSparseArray(). 15040 (For performance reasons, the call is set to false instead of being deleted from the array: http://www.html5rocks.com/en/tutorials/speed/v8/) */ 15041 Velocity.State.calls[callIndex] = false;
15042 15043 /* Iterate through the calls array to determine if this was the final in-progress animation. 15044 If so, set a flag to end ticking and clear the calls array. */ 15045 for (var j = 0, callsLength = Velocity.State.calls.length; j < callsLength; j++) { 15046 if (Velocity.State.calls[j] !== false) { 15047 remainingCallsExist = true; 15048 15049 break; 15050 } 15051 } 15052 15053 if (remainingCallsExist === false) { 15054 /* tick() will detect this flag upon its next iteration and subsequently turn itself off. */ 15055 Velocity.State.isTicking = false; 15056 15057 /* Clear the calls array so that its length is reset. */ 15058 delete Velocity.State.calls; 15059 Velocity.State.calls = []; 15060 } 15061 } 15062 15063 /****************** 15064 Frameworks 15065 ******************/ 15066 15067 /* Both jQuery and Zepto allow their $.fn object to be extended to allow wrapped elements to be subjected to plugin calls. 15068 If either framework is loaded, register a "velocity" extension pointing to Velocity's core animate() method. Velocity 15069 also registers itself onto a global container (window.jQuery || window.Zepto || window) so that certain features are 15070 accessible beyond just a per-element scope. This master object contains an .animate() method, which is later assigned to $.fn 15071 (if jQuery or Zepto are present). Accordingly, Velocity can both act on wrapped DOM elements and stand alone for targeting raw DOM elements. */ 15072 global.Velocity = Velocity; 15073 15074 if (global !== window) { 15075 /* Assign the element function to Velocity's core animate() method. */ 15076 global.fn.velocity = animate; 15077 /* Assign the object function's defaults to Velocity's global defaults object. */ 15078 global.fn.velocity.defaults = Velocity.defaults; 15079 } 15080 15081 /*********************** 15082 Packaged Redirects 15083 ***********************/ 15084 15085 /* slideUp, slideDown */ 15086 $.each([ "Down", "Up" ], function(i, direction) { 15087 Velocity.Redirects["slide" + direction] = function (element, options, elementsIndex, elementsSize, elements, promiseData) { 15088 var opts = $.extend({}, options), 15089 begin = opts.begin, 15090 complete = opts.complete, 15091 computedValues = { height: "", marginTop: "", marginBottom: "", paddingTop: "", paddingBottom: "" }, 15092 inlineValues = {}; 15093 15094 if (opts.display === undefined) { 15095 /* Show the element before slideDown begins and hide the element after slideUp completes. */ 15096 /* Note: Inline elements cannot have dimensions animated, so they're reverted to inline-block. */ 15097 opts.display = (direction === "Down" ? (Velocity.CSS.Values.getDisplayType(element) === "inline" ? "inline-block" : "block") : "none"); 15098 } 15099 15100 opts.begin = function() { 15101 /* If the user passed in a begin callback, fire it now. */ 15102 begin && begin.call(elements, elements); 15103 15104 /* Cache the elements' original vertical dimensional property values so that we can animate back to them. */ 15105 for (var property in computedValues) { 15106 /* Cache all inline values, we reset to upon animation completion. */ 15107 inlineValues[property] = element.style[property]; 15108 15109 /* For slideDown, use forcefeeding to animate all vertical properties from 0. For slideUp, 15110 use forcefeeding to start from computed values and animate down to 0. */ 15111 var propertyValue = Velocity.CSS.getPropertyValue(element, property); 15112 computedValues[property] = (direction === "Down") ? [ propertyValue, 0 ] : [ 0, propertyValue ]; 15113 } 15114 15115 /* Force vertical overflow content to clip so that sliding works as expected. */ 15116 inlineValues.overflow = element.style.overflow; 15117 element.style.overflow = "hidden"; 15118 } 15119 15120 opts.complete = function() { 15121 /* Reset element to its pre-slide inline values once its slide animation is complete. */ 15122 for (var property in inlineValues) { 15123 element.style[property] = inlineValues[property]; 15124 } 15125 15126 /* If the user passed in a complete callback, fire it now. */ 15127 complete && complete.call(elements, elements); 15128 promiseData && promiseData.resolver(elements); 15129 }; 15130 15131 Velocity(element, computedValues, opts); 15132 }; 15133 }); 15134 15135 /* fadeIn, fadeOut */ 15136 $.each([ "In", "Out" ], function(i, direction) { 15137 Velocity.Redirects["fade" + direction] = function (element, options, elementsIndex, elementsSize, elements, promiseData) { 15138 var opts = $.extend({}, options), 15139 propertiesMap = { opacity: (direction === "In") ? 1 : 0 },
vendor: 9,481 bytes, lines 15140-15535
15140 originalComplete = opts.complete; 15141 15142 /* Since redirects are triggered individually for each element in the animated set, avoid repeatedly triggering 15143 callbacks by firing them only when the final element has been reached. */ 15144 if (elementsIndex !== elementsSize - 1) { 15145 opts.complete = opts.begin = null; 15146 } else { 15147 opts.complete = function() { 15148 if (originalComplete) { 15149 originalComplete.call(elements, elements); 15150 } 15151 15152 promiseData && promiseData.resolver(elements); 15153 } 15154 } 15155 15156 /* If a display was passed in, use it. Otherwise, default to "none" for fadeOut or the element-specific default for fadeIn. */ 15157 /* Note: We allow users to pass in "null" to skip display setting altogether. */ 15158 if (opts.display === undefined) { 15159 opts.display = (direction === "In" ? "auto" : "none"); 15160 } 15161 15162 Velocity(this, propertiesMap, opts); 15163 }; 15164 }); 15165 15166 return Velocity; 15167}((window.jQuery || window.Zepto || window), window, document); 15168})); 15169 15170/****************** 15171 Known Issues 15172******************/ 15173 15174/* The CSS spec mandates that the translateX/Y/Z transforms are %-relative to the element itself -- not its parent. 15175Velocity, however, doesn't make this distinction. Thus, converting to or from the % unit with these subproperties 15176will produce an inaccurate conversion value. The same issue exists with the cx/cy attributes of SVG circles and ellipses. */ 15177; 15178/** 15179 * CssUserAgent (cssua.js) v2.1.31 15180 * http://cssuseragent.org 15181 * 15182 * Copyright (c)2006-2015 Stephen M. McKamey. 15183 * Licensed under The MIT License. 15184 */ 15185/*jshint smarttabs:true, regexp:false, browser:true */ 15186 15187/** 15188 * @type {Object} 15189 */ 15190 15191var cssua = ( 15192 15193/** 15194 * @param html {Object} root DOM element 15195 * @param userAgent {string} browser userAgent string 15196 * @return {Object} 15197 */ 15198function(html, userAgent, sa) { 15199 'use strict'; 15200 15201 /** 15202 * @const 15203 * @type {string} 15204 */ 15205 var PREFIX = ' ua-'; 15206 15207 /** 15208 * @const 15209 * @type {RegExp} 15210 */ 15211 var R_Platform = /\s*([\-\w ]+)[\s\/\:]([\d_]+\b(?:[\-\._\/]\w+)*)/; 15212 15213 /** 15214 * @const 15215 * @type {RegExp} 15216 */ 15217 var R_Version = /([\w\-\.]+[\s\/][v]?[\d_]+\b(?:[\-\._\/]\w+)*)/g; 15218 15219 /** 15220 * @const 15221 * @type {RegExp} 15222 */ 15223 var R_BlackBerry = /\b(?:(blackberry\w*|bb10)|(rim tablet os))(?:\/(\d+\.\d+(?:\.\w+)*))?/; 15224 15225 /** 15226 * @const 15227 * @type {RegExp} 15228 */ 15229 var R_Silk = /\bsilk-accelerated=true\b/; 15230 15231 /** 15232 * @const 15233 * @type {RegExp} 15234 */ 15235 var R_FluidApp = /\bfluidapp\b/; 15236 15237 /** 15238 * @const 15239 * @type {RegExp} 15240 */ 15241 var R_desktop = /(\bwindows\b|\bmacintosh\b|\blinux\b|\bunix\b)/; 15242 15243 /** 15244 * @const 15245 * @type {RegExp} 15246 */ 15247 var R_mobile = /(\bandroid\b|\bipad\b|\bipod\b|\bwindows phone\b|\bwpdesktop\b|\bxblwp7\b|\bzunewp7\b|\bwindows ce\b|\bblackberry\w*|\bbb10\b|\brim tablet os\b|\bmeego|\bwebos\b|\bpalm|\bsymbian|\bj2me\b|\bdocomo\b|\bpda\b|\bchtml\b|\bmidp\b|\bcldc\b|\w*?mobile\w*?|\w*?phone\w*?)/; 15248 15249 /** 15250 * @const 15251 * @type {RegExp} 15252 */ 15253 var R_game = /(\bxbox\b|\bplaystation\b|\bnintendo\s+\w+)/; 15254 15255 /** 15256 * The root CssUserAgent 15257 * @type {Object} 15258 */ 15259 var cssua = { 15260 15261 parse: 15262 /** 15263 * @param uaStr {string} 15264 * @return {Object} 15265 */ 15266 function(uaStr, sa) { 15267 15268 /** 15269 * @type {Object} 15270 */ 15271 var ua = {}; 15272 if (sa) { 15273 ua.standalone = sa; 15274 } 15275 15276 uaStr = (''+uaStr).toLowerCase(); 15277 if (!uaStr) { 15278 return ua; 15279 } 15280 15281 var i, count, raw = uaStr.split(/[()]/); 15282 for (var j=0, rawCount=raw.length; j<rawCount; j++) { 15283 if (j%2) { 15284 // inside parens covers platform identifiers 15285 var platforms = raw[j].split(';'); 15286 for (i=0, count=platforms.length; i<count; i++) { 15287 if (R_Platform.exec(platforms[i])) { 15288 var key = RegExp.$1.split(' ').join('_'), 15289 val = RegExp.$2; 15290 15291 // if duplicate entries favor highest version 15292 if ((!ua[key] || parseFloat(ua[key]) < parseFloat(val))) { 15293 ua[key] = val; 15294 } 15295 } 15296 } 15297 15298 } else { 15299 // outside parens covers most version identifiers 15300 var uas = raw[j].match(R_Version); 15301 if (uas) { 15302 for (i=0, count=uas.length; i<count; i++) { 15303 var parts = uas[i].split(/[\/\s]+/); 15304 if (parts.length && parts[0] !== 'mozilla') { 15305 ua[parts[0].split(' ').join('_')] = parts.slice(1).join('-'); 15306 } 15307 } 15308 } 15309 } 15310 } 15311 15312 if (R_mobile.exec(uaStr)) { 15313 // mobile device indicators 15314 ua.mobile = RegExp.$1; 15315 if (R_BlackBerry.exec(uaStr)) { 15316 delete ua[ua.mobile]; 15317 ua.blackberry = ua.version || RegExp.$3 || RegExp.$2 || RegExp.$1; 15318 if (RegExp.$1) { 15319 // standardize non-tablet blackberry 15320 ua.mobile = 'blackberry'; 15321 } else if (ua.version === '0.0.1') { 15322 // fix playbook 1.0 quirk 15323 ua.blackberry = '7.1.0.0'; 15324 } 15325 } 15326 15327 } else if (R_game.exec(uaStr)) { 15328 // game console indicators 15329 ua.game = RegExp.$1; 15330 var game = ua.game.split(' ').join('_'); 15331 15332 if (ua.version && !ua[game]) { 15333 ua[game] = ua.version; 15334 } 15335 15336 } else if (R_desktop.exec(uaStr)) { 15337 // desktop OS indicators 15338 ua.desktop = RegExp.$1; 15339 } 15340 15341 // platform naming standardizations 15342 if (ua.intel_mac_os_x) { 15343 ua.mac_os_x = ua.intel_mac_os_x.split('_').join('.'); 15344 delete ua.intel_mac_os_x; 15345 15346 } else if (ua.cpu_iphone_os) { 15347 ua.ios = ua.cpu_iphone_os.split('_').join('.'); 15348 delete ua.cpu_iphone_os; 15349 15350 } else if (ua.cpu_os) { 15351 ua.ios = ua.cpu_os.split('_').join('.'); 15352 delete ua.cpu_os; 15353 15354 } else if (ua.mobile === 'iphone' && !ua.ios) { 15355 ua.ios = '1'; 15356 } 15357 15358 // UA naming standardizations 15359 if (ua.opera && ua.version) { 15360 ua.opera = ua.version; 15361 // version/XXX refers to opera 15362 delete ua.blackberry; 15363 15364 } else if (R_Silk.exec(uaStr)) { 15365 ua.silk_accelerated = true; 15366 15367 } else if (R_FluidApp.exec(uaStr)) { 15368 ua.fluidapp = ua.version; 15369 } 15370 15371 if (ua.edge) { 15372 delete ua.applewebkit; 15373 delete ua.safari; 15374 delete ua.chrome; 15375 delete ua.android; 15376 } 15377 15378 if (ua.applewebkit) { 15379 ua.webkit = ua.applewebkit; 15380 delete ua.applewebkit; 15381 15382 if (ua.opr) { 15383 ua.opera = ua.opr; 15384 delete ua.opr; 15385 delete ua.chrome; 15386 } 15387 15388 if (ua.safari) { 15389 if (ua.chrome || ua.crios || ua.fxios || ua.opera || ua.silk || ua.fluidapp || ua.phantomjs || (ua.mobile && !ua.ios)) { 15390 delete ua.safari; 15391 15392 if (ua.vivaldi) { 15393 delete ua.chrome; 15394 } 15395 15396 } else if (ua.version && !ua.rim_tablet_os) { 15397 ua.safari = ua.version; 15398 15399 } else { 15400 ua.safari = ({ 15401 '419': '2.0.4', 15402 '417': '2.0.3', 15403 '416': '2.0.2', 15404 '412': '2.0', 15405 '312': '1.3', 15406 '125': '1.2', 15407 '85': '1.0' 15408 })[parseInt(ua.safari, 10)] || ua.safari; 15409 } 15410 } 15411 15412 } else if (ua.msie || ua.trident) { 15413 if (!ua.opera) { 15414 // standardize Internet Explorer 15415 ua.ie = ua.msie || ua.rv; 15416 } 15417 delete ua.msie; 15418 delete ua.android; 15419 15420 if (ua.windows_phone_os) { 15421 // standardize window phone 15422 ua.windows_phone = ua.windows_phone_os; 15423 delete ua.windows_phone_os; 15424 15425 } else if (ua.mobile === 'wpdesktop' || ua.mobile === 'xblwp7' || ua.mobile === 'zunewp7') { 15426 ua.mobile = 'windows desktop'; 15427 ua.windows_phone = (+ua.ie < 9) ? '7.0' : (+ua.ie < 10) ? '7.5' : '8.0'; 15428 delete ua.windows_nt; 15429 } 15430 15431 } else if (ua.gecko || ua.firefox) { 15432 ua.gecko = ua.rv; 15433 } 15434 15435 if (ua.rv) { 15436 delete ua.rv; 15437 } 15438 if (ua.version) { 15439 delete ua.version; 15440 } 15441 15442 return ua; 15443 }, 15444 15445 format: 15446 /** 15447 * @param ua {Object} 15448 * @return {string} 15449 */ 15450 function (ua) { 15451 /** 15452 * @param b {string} browser key 15453 * @param v {string} browser value 15454 * @return {string} formatted CSS classes 15455 */ 15456 function format(b, v) { 15457 b = b.split('.').join('-'); 15458 15459 /** 15460 * @type {string} 15461 */ 15462 var css = PREFIX+b; 15463 if (typeof v === 'string') { 15464 v = v.split(' ').join('_').split('.').join('-'); 15465 var i = v.indexOf('-'); 15466 while (i > 0) { 15467 // loop through chopping last '-' to end off 15468 // concat result onto return string 15469 css += PREFIX+b+'-'+v.substring(0, i); 15470 i = v.indexOf('-', i+1); 15471 } 15472 css += PREFIX+b+'-'+v; 15473 } 15474 return css; 15475 } 15476 15477 /** 15478 * @type {string} 15479 */ 15480 var uaCss = ''; 15481 for (var b in ua) { 15482 if (b && ua.hasOwnProperty(b)) { 15483 uaCss += format(b, ua[b]); 15484 } 15485 } 15486 15487 // user-agent classNames 15488 return uaCss; 15489 }, 15490 15491 encode: 15492 /** 15493 * Encodes parsed userAgent object as a compact URI-Encoded key-value collection 15494 * @param ua {Object} 15495 * @return {string} 15496 */ 15497 function(ua) { 15498 var query = ''; 15499 for (var b in ua) { 15500 if (b && ua.hasOwnProperty(b)) { 15501 if (query) { 15502 query += '&'; 15503 } 15504 query += encodeURIComponent(b)+'='+encodeURIComponent(ua[b]); 15505 } 15506 } 15507 return query; 15508 } 15509 }; 15510 15511 /** 15512 * @const 15513 * @type {Object} 15514 */ 15515 cssua.userAgent = cssua.ua = cssua.parse(userAgent, sa); 15516 15517 /** 15518 * @const 15519 * @type {string} 15520 */ 15521 var ua = cssua.format(cssua.ua)+' js'; 15522 15523 // append CSS classes to HTML node 15524 if (html.className) { 15525 html.className = html.className.replace(/\bno-js\b/g, '') + ua; 15526 15527 } else { 15528 html.className = ua.substr(1); 15529 } 15530 15531 return cssua; 15532 15533})(document.documentElement, navigator.userAgent, navigator.standalone); 15534/** 15535 * Owl carousel
15536 * @version 2.0.0 15537 * @author Bartosz Wojciechowski 15538 * @license The MIT License (MIT) 15539 * @todo Lazy Load Icon 15540 * @todo prevent animationend bubling 15541 * @todo itemsScaleUp 15542 * @todo Test Zepto 15543 * @todo stagePadding calculate wrong active classes 15544 */ 15545 15546;(function($, window, document, undefined) { 15547 15548 var drag, state, e; 15549 15550 /** 15551 * Template for status information about drag and touch events. 15552 * @private 15553 */ 15554 drag = { 15555 start: 0, 15556 startX: 0, 15557 startY: 0, 15558 current: 0, 15559 currentX: 0, 15560 currentY: 0, 15561 offsetX: 0, 15562 offsetY: 0, 15563 distance: null, 15564 startTime: 0, 15565 endTime: 0, 15566 updatedX: 0, 15567 targetEl: null 15568 }; 15569 15570 /** 15571 * Template for some status informations. 15572 * @private 15573 */ 15574 state = { 15575 isTouch: false, 15576 isScrolling: false, 15577 isSwiping: false, 15578 direction: false, 15579 inMotion: false 15580 }; 15581 15582 /** 15583 * Event functions references. 15584 * @private 15585 */ 15586 e = { 15587 _onDragStart: null, 15588 _onDragMove: null, 15589 _onDragEnd: null, 15590 _transitionEnd: null, 15591 _resizer: null, 15592 _responsiveCall: null, 15593 _goToLoop: null, 15594 _checkVisibile: null 15595 }; 15596 15597 /** 15598 * Creates a carousel. 15599 * @class The Owl Carousel. 15600 * @public 15601 * @param {HTMLElement|jQuery} element - The element to create the carousel for. 15602 * @param {Object} [options] - The options 15603 */ 15604 function Owl(element, options) { 15605 15606 /** 15607 * Current settings for the carousel. 15608 * @public 15609 */ 15610 this.settings = null; 15611 15612 /** 15613 * Current options set by the caller including defaults. 15614 * @public 15615 */ 15616 this.options = $.extend({}, Owl.Defaults, options); 15617 15618 /** 15619 * Plugin element. 15620 * @public 15621 */ 15622 this.$element = $(element); 15623 15624 /** 15625 * Caches informations about drag and touch events. 15626 */ 15627 this.drag = $.extend({}, drag); 15628 15629 /** 15630 * Caches some status informations. 15631 * @protected 15632 */ 15633 this.state = $.extend({}, state); 15634 15635 /** 15636 * @protected 15637 * @todo Must be documented 15638 */ 15639 this.e = $.extend({}, e); 15640 15641 /** 15642 * References to the running plugins of this carousel. 15643 * @protected 15644 */ 15645 this._plugins = {}; 15646 15647 /** 15648 * Currently suppressed events to prevent them from beeing retriggered. 15649 * @protected 15650 */ 15651 this._supress = {}; 15652 15653 /** 15654 * Absolute current position. 15655 * @protected 15656 */ 15657 this._current = null; 15658 15659 /** 15660 * Animation speed in milliseconds. 15661 * @protected 15662 */ 15663 this._speed = null; 15664 15665 /** 15666 * Coordinates of all items in pixel. 15667 * @todo The name of this member is missleading. 15668 * @protected 15669 */ 15670 this._coordinates = []; 15671 15672 /** 15673 * Current breakpoint. 15674 * @todo Real media queries would be nice. 15675 * @protected 15676 */ 15677 this._breakpoint = null; 15678 15679 /** 15680 * Current width of the plugin element. 15681 */ 15682 this._width = null; 15683 15684 /** 15685 * All real items. 15686 * @protected 15687 */ 15688 this._items = []; 15689 15690 /** 15691 * All cloned items. 15692 * @protected 15693 */ 15694 this._clones = []; 15695 15696 /** 15697 * Merge values of all items. 15698 * @todo Maybe this could be part of a plugin. 15699 * @protected 15700 */ 15701 this._mergers = []; 15702 15703 /** 15704 * Invalidated parts within the update process. 15705 * @protected 15706 */ 15707 this._invalidated = {}; 15708 15709 /** 15710 * Ordered list of workers for the update process. 15711 * @protected 15712 */ 15713 this._pipe = []; 15714 15715 $.each(Owl.Plugins, $.proxy(function(key, plugin) { 15716 this._plugins[key[0].toLowerCase() + key.slice(1)] 15717 = new plugin(this); 15718 }, this)); 15719 15720 $.each(Owl.Pipe, $.proxy(function(priority, worker) { 15721 this._pipe.push({ 15722 'filter': worker.filter, 15723 'run': $.proxy(worker.run, this) 15724 }); 15725 }, this)); 15726 15727 this.setup(); 15728 this.initialize(); 15729 } 15730 15731 /** 15732 * Default options for the carousel. 15733 * @public 15734 */ 15735 Owl.Defaults = { 15736 items: 4, 15737 loop: false, 15738 center: false, 15739 15740 mouseDrag: true, 15741 touchDrag: true, 15742 pullDrag: true, 15743 freeDrag: false, 15744 15745 margin: 0, 15746 stagePadding: 0, 15747 15748 merge: false, 15749 mergeFit: true, 15750 autoWidth: false, 15751 15752 startPosition: 0, 15753 rtl: false, 15754 15755 smartSpeed: 100, 15756 fluidSpeed: false, 15757 dragEndSpeed: false, 15758 15759 responsive: {}, 15760 responsiveRefreshRate: 200, 15761 responsiveBaseElement: window, 15762 responsiveClass: false, 15763 15764 fallbackEasing: 'swing', 15765 15766 info: false, 15767 15768 nestedItemSelector: false, 15769 itemElement: 'div', 15770 stageElement: 'div', 15771 15772 // Classes and Names 15773 themeClass: 'owl-theme', 15774 baseClass: 'owl-carousel', 15775 itemClass: 'owl-item', 15776 centerClass: 'center', 15777 activeClass: 'active' 15778 }; 15779 15780 /** 15781 * Enumeration for width. 15782 * @public 15783 * @readonly 15784 * @enum {String} 15785 */ 15786 Owl.Width = { 15787 Default: 'default', 15788 Inner: 'inner', 15789 Outer: 'outer' 15790 }; 15791 15792 /** 15793 * Contains all registered plugins. 15794 * @public 15795 */ 15796 Owl.Plugins = {}; 15797 15798 /** 15799 * Update pipe. 15800 */ 15801 Owl.Pipe = [ { 15802 filter: [ 'width', 'items', 'settings' ], 15803 run: function(cache) { 15804 cache.current = this._items && this._items[this.relative(this._current)]; 15805 } 15806 }, { 15807 filter: [ 'items', 'settings' ], 15808 run: function() { 15809 var cached = this._clones, 15810 clones = this.$stage.children('.cloned'); 15811 15812 if (clones.length !== cached.length || (!this.settings.loop && cached.length > 0)) { 15813 this.$stage.children('.cloned').remove(); 15814 this._clones = []; 15815 } 15816 } 15817 }, { 15818 filter: [ 'items', 'settings' ], 15819 run: function() { 15820 var i, n, 15821 clones = this._clones, 15822 items = this._items, 15823 delta = this.settings.loop ? clones.length - Math.max(this.settings.items * 2, 4) : 0; 15824 15825 for (i = 0, n = Math.abs(delta / 2); i < n; i++) { 15826 if (delta > 0) { 15827 this.$stage.children().eq(items.length + clones.length - 1).remove(); 15828 clones.pop(); 15829 this.$stage.children().eq(0).remove(); 15830 clones.pop(); 15831 } else { 15832 clones.push(clones.length / 2); 15833 this.$stage.append(items[clones[clones.length - 1]].clone().addClass('cloned')); 15834 clones.push(items.length - 1 - (clones.length - 1) / 2); 15835 this.$stage.prepend(items[clones[clones.length - 1]].clone().addClass('cloned')); 15836 } 15837 } 15838 } 15839 }, { 15840 filter: [ 'width', 'items', 'settings' ], 15841 run: function() { 15842 var rtl = (this.settings.rtl ? 1 : -1), 15843 width = (this.width() / this.settings.items).toFixed(3), 15844 coordinate = 0, merge, i, n; 15845 15846 this._coordinates = []; 15847 for (i = 0, n = this._clones.length + this._items.length; i < n; i++) { 15848 merge = this._mergers[this.relative(i)]; 15849 merge = (this.settings.mergeFit && Math.min(merge, this.settings.items)) || merge; 15850 coordinate += (this.settings.autoWidth ? this._items[this.relative(i)].width() + this.settings.margin : width * merge) * rtl; 15851 15852 this._coordinates.push(coordinate); 15853 } 15854 } 15855 }, { 15856 filter: [ 'width', 'items', 'settings' ], 15857 run: function() { 15858 var i, n, width = (this.width() / this.settings.items).toFixed(3), css = { 15859 'width': Math.abs(this._coordinates[this._coordinates.length - 1]) + this.settings.stagePadding * 2, 15860 'padding-left': this.settings.stagePadding || '', 15861 'padding-right': this.settings.stagePadding || '' 15862 }; 15863 15864 this.$stage.css(css); 15865 15866 css = { 'width': this.settings.autoWidth ? 'auto' : width - this.settings.margin }; 15867 css[this.settings.rtl ? 'margin-left' : 'margin-right'] = this.settings.margin; 15868 15869 if (!this.settings.autoWidth && $.grep(this._mergers, function(v) { return v > 1 }).length > 0) { 15870 for (i = 0, n = this._coordinates.length; i < n; i++) { 15871 css.width = Math.abs(this._coordinates[i]) - Math.abs(this._coordinates[i - 1] || 0) - this.settings.margin; 15872 this.$stage.children().eq(i).css(css); 15873 } 15874 } else { 15875 this.$stage.children().css(css); 15876 } 15877 } 15878 }, { 15879 filter: [ 'width', 'items', 'settings' ], 15880 run: function(cache) { 15881 cache.current && this.reset(this.$stage.children().index(cache.current)); 15882 } 15883 }, { 15884 filter: [ 'position' ], 15885 run: function() { 15886 this.animate(this.coordinates(this._current)); 15887 } 15888 }, { 15889 filter: [ 'width', 'position', 'items', 'settings' ], 15890 run: function() { 15891 var rtl = this.settings.rtl ? 1 : -1, 15892 padding = this.settings.stagePadding * 2, 15893 begin = this.coordinates(this.current()) + padding, 15894 end = begin + this.width() * rtl, 15895 inner, outer, matches = [], i, n; 15896 15897 for (i = 0, n = this._coordinates.length; i < n; i++) { 15898 inner = this._coordinates[i - 1] || 0; 15899 outer = Math.abs(this._coordinates[i]) + padding * rtl; 15900 15901 if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end))) 15902 || (this.op(outer, '<', begin) && this.op(outer, '>', end))) { 15903 matches.push(i); 15904 } 15905 } 15906 15907 this.$stage.children('.' + this.settings.activeClass).removeClass(this.settings.activeClass); 15908 this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass(this.settings.activeClass); 15909 15910 if (this.settings.center) { 15911 this.$stage.children('.' + this.settings.centerClass).removeClass(this.settings.centerClass); 15912 this.$stage.children().eq(this.current()).addClass(this.settings.centerClass); 15913 } 15914 } 15915 } ]; 15916 15917 /** 15918 * Initializes the carousel. 15919 * @protected 15920 */ 15921 Owl.prototype.initialize = function() { 15922 this.trigger('initialize'); 15923 15924 this.$element 15925 .addClass(this.settings.baseClass) 15926 .addClass(this.settings.themeClass) 15927 .toggleClass('owl-rtl', this.settings.rtl); 15928 15929 // check support 15930 this.browserSupport(); 15931 15932 if (this.settings.autoWidth && this.state.imagesLoaded !== true) { 15933 var imgs, nestedSelector, width; 15934 imgs = this.$element.find('img'); 15935 nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined; 15936 width = this.$element.children(nestedSelector).width(); 15937 15938 if (imgs.length && width <= 0) { 15939 this.preloadAutoWidthImages(imgs); 15940 return false;
15941 } 15942 } 15943 15944 this.$element.addClass('owl-loading'); 15945 15946 // create stage 15947 this.$stage = $('<' + this.settings.stageElement + ' class="owl-stage"/>') 15948 .wrap('<div class="owl-stage-outer">'); 15949 15950 // append stage 15951 this.$element.append(this.$stage.parent()); 15952 15953 // append content 15954 this.replace(this.$element.children().not(this.$stage.parent())); 15955 15956 // set view width 15957 this._width = this.$element.width(); 15958 15959 // update view 15960 this.refresh(); 15961 15962 this.$element.removeClass('owl-loading').addClass('owl-loaded'); 15963 15964 // attach generic events 15965 this.eventsCall(); 15966 15967 // attach generic events 15968 this.internalEvents(); 15969 15970 // attach custom control events 15971 this.addTriggerableEvents(); 15972 15973 this.trigger('initialized'); 15974 }; 15975 15976 /** 15977 * Setups the current settings. 15978 * @todo Remove responsive classes. Why should adaptive designs be brought into IE8? 15979 * @todo Support for media queries by using `matchMedia` would be nice. 15980 * @public 15981 */ 15982 Owl.prototype.setup = function() { 15983 var viewport = this.viewport(), 15984 overwrites = this.options.responsive, 15985 match = -1, 15986 settings = null; 15987 15988 if (!overwrites) { 15989 settings = $.extend({}, this.options); 15990 } else { 15991 $.each(overwrites, function(breakpoint) { 15992 if (breakpoint <= viewport && breakpoint > match) { 15993 match = Number(breakpoint); 15994 } 15995 }); 15996 15997 settings = $.extend({}, this.options, overwrites[match]); 15998 delete settings.responsive; 15999 16000 // responsive class 16001 if (settings.responsiveClass) { 16002 this.$element.attr('class', function(i, c) { 16003 return c.replace(/\b owl-responsive-\S+/g, ''); 16004 }).addClass('owl-responsive-' + match); 16005 } 16006 } 16007 16008 if (this.settings === null || this._breakpoint !== match) { 16009 this.trigger('change', { property: { name: 'settings', value: settings } }); 16010 this._breakpoint = match; 16011 this.settings = settings; 16012 this.invalidate('settings'); 16013 this.trigger('changed', { property: { name: 'settings', value: this.settings } }); 16014 } 16015 }; 16016 16017 /** 16018 * Updates option logic if necessery. 16019 * @protected 16020 */ 16021 Owl.prototype.optionsLogic = function() { 16022 // Toggle Center class 16023 this.$element.toggleClass('owl-center', this.settings.center); 16024 16025 // if items number is less than in body 16026 if (this.settings.loop && this._items.length < this.settings.items) { 16027 this.settings.loop = false; 16028 } 16029 16030 if (this.settings.autoWidth) { 16031 this.settings.stagePadding = false; 16032 this.settings.merge = false; 16033 } 16034 }; 16035 16036 /** 16037 * Prepares an item before add. 16038 * @todo Rename event parameter `content` to `item`. 16039 * @protected 16040 * @returns {jQuery|HTMLElement} - The item container. 16041 */ 16042 Owl.prototype.prepare = function(item) { 16043 var event = this.trigger('prepare', { content: item }); 16044 16045 if (!event.data) { 16046 event.data = $('<' + this.settings.itemElement + '/>') 16047 .addClass(this.settings.itemClass).append(item) 16048 } 16049 16050 this.trigger('prepared', { content: event.data }); 16051 16052 return event.data; 16053 }; 16054 16055 /** 16056 * Updates the view. 16057 * @public 16058 */ 16059 Owl.prototype.update = function() { 16060 var i = 0, 16061 n = this._pipe.length, 16062 filter = $.proxy(function(p) { return this[p] }, this._invalidated), 16063 cache = {}; 16064 16065 while (i < n) { 16066 if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) { 16067 this._pipe[i].run(cache); 16068 } 16069 i++; 16070 } 16071 16072 this._invalidated = {}; 16073 }; 16074 16075 /** 16076 * Gets the width of the view. 16077 * @public 16078 * @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return. 16079 * @returns {Number} - The width of the view in pixel. 16080 */ 16081 Owl.prototype.width = function(dimension) { 16082 dimension = dimension || Owl.Width.Default; 16083 switch (dimension) { 16084 case Owl.Width.Inner: 16085 case Owl.Width.Outer: 16086 return this._width; 16087 default: 16088 return this._width - this.settings.stagePadding * 2 + this.settings.margin; 16089 } 16090 }; 16091 16092 /** 16093 * Refreshes the carousel primarily for adaptive purposes. 16094 * @public 16095 */ 16096 Owl.prototype.refresh = function() { 16097 if (this._items.length === 0) { 16098 return false; 16099 } 16100 16101 var start = new Date().getTime(); 16102 16103 this.trigger('refresh'); 16104 16105 this.setup(); 16106 16107 this.optionsLogic(); 16108 16109 // hide and show methods helps here to set a proper widths, 16110 // this prevents scrollbar to be calculated in stage width 16111 this.$stage.addClass('owl-refresh'); 16112 16113 this.update(); 16114 16115 this.$stage.removeClass('owl-refresh'); 16116 16117 this.state.orientation = window.orientation; 16118 16119 this.watchVisibility(); 16120 16121 this.trigger('refreshed'); 16122 }; 16123 16124 /** 16125 * Save internal event references and add event based functions. 16126 * @protected 16127 */ 16128 Owl.prototype.eventsCall = function() { 16129 // Save events references 16130 this.e._onDragStart = $.proxy(function(e) { 16131 this.onDragStart(e); 16132 }, this); 16133 this.e._onDragMove = $.proxy(function(e) { 16134 this.onDragMove(e); 16135 }, this); 16136 this.e._onDragEnd = $.proxy(function(e) { 16137 this.onDragEnd(e); 16138 }, this); 16139 this.e._onResize = $.proxy(function(e) { 16140 this.onResize(e); 16141 }, this); 16142 this.e._transitionEnd = $.proxy(function(e) { 16143 this.transitionEnd(e); 16144 }, this); 16145 this.e._preventClick = $.proxy(function(e) { 16146 this.preventClick(e); 16147 }, this); 16148 }; 16149 16150 /** 16151 * Checks window `resize` event. 16152 * @protected 16153 */ 16154 Owl.prototype.onThrottledResize = function() { 16155 window.clearTimeout(this.resizeTimer); 16156 this.resizeTimer = window.setTimeout(this.e._onResize, this.settings.responsiveRefreshRate); 16157 }; 16158 16159 /** 16160 * Checks window `resize` event. 16161 * @protected 16162 */ 16163 Owl.prototype.onResize = function() { 16164 if (!this._items.length) { 16165 return false;
16166 } 16167 16168 if (this._width === this.$element.width()) { 16169 return false; 16170 } 16171 16172 if (this.trigger('resize').isDefaultPrevented()) { 16173 return false; 16174 } 16175 16176 this._width = this.$element.width(); 16177 16178 this.invalidate('width'); 16179 16180 this.refresh(); 16181 16182 this.trigger('resized'); 16183 }; 16184 16185 /** 16186 * Checks for touch/mouse drag event type and add run event handlers. 16187 * @protected 16188 */ 16189 Owl.prototype.eventsRouter = function(event) { 16190 var type = event.type; 16191 16192 if (type === "mousedown" || type === "touchstart") { 16193 this.onDragStart(event); 16194 } else if (type === "mousemove" || type === "touchmove") { 16195 this.onDragMove(event); 16196 } else if (type === "mouseup" || type === "touchend") { 16197 this.onDragEnd(event); 16198 } else if (type === "touchcancel") { 16199 this.onDragEnd(event); 16200 } 16201 }; 16202 16203 /** 16204 * Checks for touch/mouse drag options and add necessery event handlers. 16205 * @protected 16206 */ 16207 Owl.prototype.internalEvents = function() { 16208 var isTouch = isTouchSupport(), 16209 isTouchIE = isTouchSupportIE(); 16210 16211 if (this.settings.mouseDrag){ 16212 this.$stage.on('mousedown', $.proxy(function(event) { this.eventsRouter(event) }, this)); 16213 this.$stage.on('dragstart', function() { return false }); 16214 this.$stage.get(0).onselectstart = function() { return false }; 16215 } else { 16216 this.$element.addClass('owl-text-select-on'); 16217 } 16218 16219 if (this.settings.touchDrag && !isTouchIE){ 16220 this.$stage.on('touchstart touchcancel', $.proxy(function(event) { this.eventsRouter(event) }, this)); 16221 } 16222 16223 // catch transitionEnd event 16224 if (this.transitionEndVendor) { 16225 this.on(this.$stage.get(0), this.transitionEndVendor, this.e._transitionEnd, false); 16226 } 16227 16228 // responsive 16229 if (this.settings.responsive !== false) { 16230 this.on(window, 'resize', $.proxy(this.onThrottledResize, this)); 16231 } 16232 }; 16233 16234 /** 16235 * Handles touchstart/mousedown event. 16236 * @protected 16237 * @param {Event} event - The event arguments. 16238 */ 16239 Owl.prototype.onDragStart = function(event) { 16240 var ev, isTouchEvent, pageX, pageY, animatedPos; 16241 16242 ev = event.originalEvent || event || window.event; 16243 16244 // prevent right click 16245 if (ev.which === 3 || this.state.isTouch) { 16246 return false; 16247 } 16248 16249 if (ev.type === 'mousedown') { 16250 this.$stage.addClass('owl-grab'); 16251 } 16252 16253 this.trigger('drag'); 16254 this.drag.startTime = new Date().getTime(); 16255 this.speed(0); 16256 this.state.isTouch = true; 16257 this.state.isScrolling = false; 16258 this.state.isSwiping = false; 16259 this.drag.distance = 0; 16260 16261 pageX = getTouches(ev).x; 16262 pageY = getTouches(ev).y; 16263 16264 // get stage position left 16265 this.drag.offsetX = this.$stage.position().left; 16266 this.drag.offsetY = this.$stage.position().top; 16267 16268 if (this.settings.rtl) { 16269 this.drag.offsetX = this.$stage.position().left + this.$stage.width() - this.width() 16270 + this.settings.margin; 16271 } 16272 16273 // catch position // ie to fix 16274 if (this.state.inMotion && this.support3d) { 16275 animatedPos = this.getTransformProperty(); 16276 this.drag.offsetX = animatedPos; 16277 this.animate(animatedPos); 16278 this.state.inMotion = true; 16279 } else if (this.state.inMotion && !this.support3d) { 16280 this.state.inMotion = false; 16281 return false; 16282 } 16283 16284 this.drag.startX = pageX - this.drag.offsetX; 16285 this.drag.startY = pageY - this.drag.offsetY; 16286 16287 this.drag.start = pageX - this.drag.startX; 16288 this.drag.targetEl = ev.target || ev.srcElement; 16289 this.drag.updatedX = this.drag.start; 16290 16291 // to do/check 16292 // prevent links and images dragging; 16293 if (this.drag.targetEl.tagName === "IMG" || this.drag.targetEl.tagName === "A") { 16294 this.drag.targetEl.draggable = false; 16295 } 16296 16297 $(document).on('mousemove.owl.dragEvents mouseup.owl.dragEvents touchmove.owl.dragEvents touchend.owl.dragEvents', $.proxy(function(event) {this.eventsRouter(event)},this)); 16298 }; 16299 16300 /** 16301 * Handles the touchmove/mousemove events. 16302 * @todo Simplify 16303 * @protected 16304 * @param {Event} event - The event arguments. 16305 */ 16306 Owl.prototype.onDragMove = function(event) { 16307 var ev, isTouchEvent, pageX, pageY, minValue, maxValue, pull; 16308 16309 if (!this.state.isTouch) { 16310 return; 16311 } 16312 16313 if (this.state.isScrolling) { 16314 return; 16315 } 16316 16317 ev = event.originalEvent || event || window.event; 16318 16319 pageX = getTouches(ev).x; 16320 pageY = getTouches(ev).y; 16321 16322 // Drag Direction 16323 this.drag.currentX = pageX - this.drag.startX; 16324 this.drag.currentY = pageY - this.drag.startY; 16325 this.drag.distance = this.drag.currentX - this.drag.offsetX; 16326 16327 // Check move direction 16328 if (this.drag.distance < 0) { 16329 this.state.direction = this.settings.rtl ? 'right' : 'left'; 16330 } else if (this.drag.distance > 0) { 16331 this.state.direction = this.settings.rtl ? 'left' : 'right'; 16332 } 16333 // Loop 16334 if (this.settings.loop) { 16335 if (this.op(this.drag.currentX, '>', this.coordinates(this.minimum())) && this.state.direction === 'right') { 16336 this.drag.currentX -= (this.settings.center && this.coordinates(0)) - this.coordinates(this._items.length); 16337 } else if (this.op(this.drag.currentX, '<', this.coordinates(this.maximum())) && this.state.direction === 'left') { 16338 this.drag.currentX += (this.settings.center && this.coordinates(0)) - this.coordinates(this._items.length); 16339 } 16340 } else { 16341 // pull 16342 minValue = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum()); 16343 maxValue = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum()); 16344 pull = this.settings.pullDrag ? this.drag.distance / 5 : 0; 16345 this.drag.currentX = Math.max(Math.min(this.drag.currentX, minValue + pull), maxValue + pull); 16346 } 16347 16348 // Lock browser if swiping horizontal 16349 16350 if ((this.drag.distance > 8 || this.drag.distance < -8)) { 16351 if (ev.preventDefault !== undefined) { 16352 ev.preventDefault(); 16353 } else { 16354 ev.returnValue = false;
16355 } 16356 this.state.isSwiping = true; 16357 } 16358 16359 this.drag.updatedX = this.drag.currentX; 16360 16361 // Lock Owl if scrolling 16362 if ((this.drag.currentY > 16 || this.drag.currentY < -16) && this.state.isSwiping === false) { 16363 this.state.isScrolling = true; 16364 this.drag.updatedX = this.drag.start; 16365 } 16366 16367 this.animate(this.drag.updatedX); 16368 }; 16369 16370 /** 16371 * Handles the touchend/mouseup events. 16372 * @protected 16373 */ 16374 Owl.prototype.onDragEnd = function(event) { 16375 var compareTimes, distanceAbs, closest; 16376 16377 if (!this.state.isTouch) { 16378 return; 16379 } 16380 16381 if (event.type === 'mouseup') { 16382 this.$stage.removeClass('owl-grab'); 16383 } 16384 16385 this.trigger('dragged'); 16386 16387 // prevent links and images dragging; 16388 this.drag.targetEl.removeAttribute("draggable"); 16389 16390 // remove drag event listeners 16391 16392 this.state.isTouch = false; 16393 this.state.isScrolling = false; 16394 this.state.isSwiping = false; 16395 16396 // to check 16397 if (this.drag.distance === 0 && this.state.inMotion !== true) { 16398 this.state.inMotion = false; 16399 return false; 16400 } 16401 16402 // prevent clicks while scrolling 16403 16404 this.drag.endTime = new Date().getTime(); 16405 compareTimes = this.drag.endTime - this.drag.startTime; 16406 distanceAbs = Math.abs(this.drag.distance); 16407 16408 // to test 16409 if (distanceAbs > 3 || compareTimes > 300) { 16410 this.removeClick(this.drag.targetEl); 16411 } 16412 16413 closest = this.closest(this.drag.updatedX); 16414 16415 this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed); 16416 this.current(closest); 16417 this.invalidate('position'); 16418 this.update(); 16419 16420 // if pullDrag is off then fire transitionEnd event manually when stick 16421 // to border 16422 if (!this.settings.pullDrag && this.drag.updatedX === this.coordinates(closest)) { 16423 this.transitionEnd(); 16424 } 16425 16426 this.drag.distance = 0; 16427 16428 $(document).off('.owl.dragEvents'); 16429 }; 16430 16431 /** 16432 * Attaches `preventClick` to disable link while swipping. 16433 * @protected 16434 * @param {HTMLElement} [target] - The target of the `click` event. 16435 */ 16436 Owl.prototype.removeClick = function(target) { 16437 this.drag.targetEl = target; 16438 $(target).on('click.preventClick', this.e._preventClick); 16439 // to make sure click is removed: 16440 window.setTimeout(function() { 16441 $(target).off('click.preventClick'); 16442 }, 300); 16443 }; 16444 16445 /** 16446 * Suppresses click event. 16447 * @protected 16448 * @param {Event} ev - The event arguments. 16449 */ 16450 Owl.prototype.preventClick = function(ev) { 16451 if (ev.preventDefault) { 16452 ev.preventDefault(); 16453 } else { 16454 ev.returnValue = false; 16455 } 16456 if (ev.stopPropagation) { 16457 ev.stopPropagation(); 16458 } 16459 $(ev.target).off('click.preventClick'); 16460 }; 16461 16462 /** 16463 * Catches stage position while animate (only CSS3). 16464 * @protected 16465 * @returns 16466 */ 16467 Owl.prototype.getTransformProperty = function() { 16468 var transform, matrix3d; 16469 16470 transform = window.getComputedStyle(this.$stage.get(0), null).getPropertyValue(this.vendorName + 'transform'); 16471 // var transform = this.$stage.css(this.vendorName + 'transform') 16472 transform = transform.replace(/matrix(3d)?\(|\)/g, '').split(','); 16473 matrix3d = transform.length === 16; 16474 16475 return matrix3d !== true ? transform[4] : transform[12]; 16476 }; 16477 16478 /** 16479 * Gets absolute position of the closest item for a coordinate. 16480 * @todo Setting `freeDrag` makes `closest` not reusable. See #165. 16481 * @protected 16482 * @param {Number} coordinate - The coordinate in pixel. 16483 * @return {Number} - The absolute position of the closest item. 16484 */ 16485 Owl.prototype.closest = function(coordinate) { 16486 var position = -1, pull = 30, width = this.width(), coordinates = this.coordinates(); 16487 16488 if (!this.settings.freeDrag) { 16489 // check closest item 16490 $.each(coordinates, $.proxy(function(index, value) { 16491 if (coordinate > value - pull && coordinate < value + pull) { 16492 position = index; 16493 } else if (this.op(coordinate, '<', value) 16494 && this.op(coordinate, '>', coordinates[index + 1] || value - width)) { 16495 position = this.state.direction === 'left' ? index + 1 : index; 16496 } 16497 return position === -1; 16498 }, this)); 16499 } 16500 16501 if (!this.settings.loop) { 16502 // non loop boundries 16503 if (this.op(coordinate, '>', coordinates[this.minimum()])) { 16504 position = coordinate = this.minimum(); 16505 } else if (this.op(coordinate, '<', coordinates[this.maximum()])) { 16506 position = coordinate = this.maximum(); 16507 } 16508 } 16509 16510 return position; 16511 }; 16512 16513 /** 16514 * Animates the stage. 16515 * @public 16516 * @param {Number} coordinate - The coordinate in pixels. 16517 */ 16518 Owl.prototype.animate = function(coordinate) { 16519 this.trigger('translate'); 16520 this.state.inMotion = this.speed() > 0; 16521 16522 if (this.support3d) { 16523 this.$stage.css({ 16524 transform: 'translate3d(' + coordinate + 'px' + ',0px, 0px)', 16525 transition: (this.speed() / 1000) + 's' 16526 }); 16527 } else if (this.state.isTouch) { 16528 this.$stage.css({ 16529 left: coordinate + 'px' 16530 }); 16531 } else { 16532 this.$stage.animate({ 16533 left: coordinate 16534 }, this.speed() / 1000, this.settings.fallbackEasing, $.proxy(function() { 16535 if (this.state.inMotion) { 16536 this.transitionEnd(); 16537 } 16538 }, this)); 16539 } 16540 }; 16541 16542 /** 16543 * Sets the absolute position of the current item. 16544 * @public 16545 * @param {Number} [position] - The new absolute position or nothing to leave it unchanged. 16546 * @returns {Number} - The absolute position of the current item. 16547 */ 16548 Owl.prototype.current = function(position) { 16549 if (position === undefined) { 16550 return this._current; 16551 } 16552 16553 if (this._items.length === 0) { 16554 return undefined; 16555 } 16556 16557 position = this.normalize(position); 16558 16559 if (this._current !== position) { 16560 var event = this.trigger('change', { property: { name: 'position', value: position } }); 16561 16562 if (event.data !== undefined) { 16563 position = this.normalize(event.data); 16564 } 16565 16566 this._current = position; 16567 16568 this.invalidate('position'); 16569 16570 this.trigger('changed', { property: { name: 'position', value: this._current } }); 16571 } 16572 16573 return this._current; 16574 }; 16575 16576 /** 16577 * Invalidates the given part of the update routine. 16578 * @param {String}
16578 part - The part to invalidate. 16579 */ 16580 Owl.prototype.invalidate = function(part) { 16581 this._invalidated[part] = true; 16582 } 16583 16584 /** 16585 * Resets the absolute position of the current item. 16586 * @public 16587 * @param {Number} position - The absolute position of the new item. 16588 */ 16589 Owl.prototype.reset = function(position) { 16590 position = this.normalize(position); 16591 16592 if (position === undefined) { 16593 return; 16594 } 16595 16596 this._speed = 0; 16597 this._current = position; 16598 16599 this.suppress([ 'translate', 'translated' ]); 16600 16601 this.animate(this.coordinates(position)); 16602 16603 this.release([ 'translate', 'translated' ]); 16604 }; 16605 16606 /** 16607 * Normalizes an absolute or a relative position for an item. 16608 * @public 16609 * @param {Number} position - The absolute or relative position to normalize. 16610 * @param {Boolean} [relative=false] - Whether the given position is relative or not. 16611 * @returns {Number} - The normalized position. 16612 */ 16613 Owl.prototype.normalize = function(position, relative) { 16614 var n = (relative ? this._items.length : this._items.length + this._clones.length); 16615 16616 if (!$.isNumeric(position) || n < 1) { 16617 return undefined; 16618 } 16619 16620 if (this._clones.length) { 16621 position = ((position % n) + n) % n; 16622 } else { 16623 position = Math.max(this.minimum(relative), Math.min(this.maximum(relative), position)); 16624 } 16625 16626 return position; 16627 }; 16628 16629 /** 16630 * Converts an absolute position for an item into a relative position. 16631 * @public 16632 * @param {Number} position - The absolute position to convert. 16633 * @returns {Number} - The converted position. 16634 */ 16635 Owl.prototype.relative = function(position) { 16636 position = this.normalize(position); 16637 position = position - this._clones.length / 2; 16638 return this.normalize(position, true); 16639 }; 16640 16641 /** 16642 * Gets the maximum position for an item. 16643 * @public 16644 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position. 16645 * @returns {Number} 16646 */ 16647 Owl.prototype.maximum = function(relative) { 16648 var maximum, width, i = 0, coordinate, 16649 settings = this.settings; 16650 16651 if (relative) { 16652 return this._items.length - 1; 16653 } 16654 16655 if (!settings.loop && settings.center) { 16656 maximum = this._items.length - 1; 16657 } else if (!settings.loop && !settings.center) { 16658 maximum = this._items.length - settings.items; 16659 } else if (settings.loop || settings.center) { 16660 maximum = this._items.length + settings.items; 16661 } else if (settings.autoWidth || settings.merge) { 16662 revert = settings.rtl ? 1 : -1; 16663 width = this.$stage.width() - this.$element.width(); 16664 while (coordinate = this.coordinates(i)) { 16665 if (coordinate * revert >= width) { 16666 break; 16667 } 16668 maximum = ++i; 16669 } 16670 } else { 16671 throw 'Can not detect maximum absolute position.' 16672 } 16673 16674 return maximum; 16675 }; 16676 16677 /** 16678 * Gets the minimum position for an item. 16679 * @public 16680 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position. 16681 * @returns {Number} 16682 */ 16683 Owl.prototype.minimum = function(relative) { 16684 if (relative) { 16685 return 0; 16686 } 16687 16688 return this._clones.length / 2; 16689 }; 16690 16691 /** 16692 * Gets an item at the specified relative position. 16693 * @public 16694 * @param {Number} [position] - The relative position of the item. 16695 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given. 16696 */ 16697 Owl.prototype.items = function(position) { 16698 if (position === undefined) { 16699 return this._items.slice(); 16700 } 16701 16702 position = this.normalize(position, true); 16703 return this._items[position]; 16704 }; 16705 16706 /** 16707 * Gets an item at the specified relative position. 16708 * @public 16709 * @param {Number} [position] - The relative position of the item. 16710 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given. 16711 */ 16712 Owl.prototype.mergers = function(position) { 16713 if (position === undefined) { 16714 return this._mergers.slice(); 16715 } 16716 16717 position = this.normalize(position, true); 16718 return this._mergers[position]; 16719 }; 16720 16721 /** 16722 * Gets the absolute positions of clones for an item. 16723 * @public 16724 * @param {Number} [position] - The relative position of the item. 16725 * @returns {Array.<Number>} - The absolute positions of clones for the item or all if no position was given. 16726 */ 16727 Owl.prototype.clones = function(position) { 16728 var odd = this._clones.length / 2, 16729 even = odd + this._items.length, 16730 map = function(index) { return index % 2 === 0 ? even + index / 2 : odd
16730- (index + 1) / 2 }; 16731 16732 if (position === undefined) { 16733 return $.map(this._clones, function(v, i) { return map(i) }); 16734 } 16735 16736 return $.map(this._clones, function(v, i) { return v === position ? map(i) : null }); 16737 }; 16738 16739 /** 16740 * Sets the current animation speed. 16741 * @public 16742 * @param {Number} [speed] - The animation speed in milliseconds or nothing to leave it unchanged. 16743 * @returns {Number} - The current animation speed in milliseconds. 16744 */ 16745 Owl.prototype.speed = function(speed) { 16746 if (speed !== undefined) { 16747 this._speed = speed; 16748 } 16749 16750 return this._speed; 16751 }; 16752 16753 /** 16754 * Gets the coordinate of an item. 16755 * @todo The name of this method is missleanding. 16756 * @public 16757 * @param {Number} position - The absolute position of the item within `minimum()` and `maximum()`. 16758 * @returns {Number|Array.<Number>} - The coordinate of the item in pixel or all coordinates. 16759 */ 16760 Owl.prototype.coordinates = function(position) { 16761 var coordinate = null; 16762 16763 if (position === undefined) { 16764 return $.map(this._coordinates, $.proxy(function(coordinate, index) { 16765 return this.coordinates(index); 16766 }, this)); 16767 } 16768 16769 if (this.settings.center) { 16770 coordinate = this._coordinates[position]; 16771 coordinate += (this.width() - coordinate + (this._coordinates[position - 1] || 0)) / 2 * (this.settings.rtl ? -1 : 1); 16772 } else { 16773 coordinate = this._coordinates[position - 1] || 0; 16774 } 16775 16776 return coordinate; 16777 }; 16778 16779 /** 16780 * Calculates the speed for a translation. 16781 * @protected 16782 * @param {Number} from - The absolute position of the start item. 16783 * @param {Number} to - The absolute position of the target item. 16784 * @param {Number} [factor=undefined] - The time factor in milliseconds. 16785 * @returns {Number} - The time in milliseconds for the translation. 16786 */ 16787 Owl.prototype.duration = function(from, to, factor) { 16788 return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed)); 16789 }; 16790 16791 /** 16792 * Slides to the specified item. 16793 * @public 16794 * @param {Number} position - The position of the item. 16795 * @param {Number} [speed] - The time in milliseconds for the transition. 16796 */ 16797 Owl.prototype.to = function(position, speed) { 16798 if (this.settings.loop) { 16799 var distance = position - this.relative(this.current()), 16800 revert = this.current(), 16801 before = this.current(), 16802 after = this.current() + distance, 16803 direction = before - after < 0 ? true : false, 16804 items = this._clones.length + this._items.length; 16805 16806 if (after < this.settings.items && direction === false) { 16807 revert = before + this._items.length; 16808 this.reset(revert); 16809 } else if (after >= items - this.settings.items && direction === true) { 16810 revert = before - this._items.length; 16811 this.reset(revert); 16812 } 16813 window.clearTimeout(this.e._goToLoop); 16814 this.e._goToLoop = window.setTimeout($.proxy(function() { 16815 this.speed(this.duration(this.current(), revert + distance, speed)); 16816 this.current(revert + distance); 16817 this.update(); 16818 }, this), 30); 16819 } else { 16820 this.speed(this.duration(this.current(), position, speed)); 16821 this.current(position); 16822 this.update(); 16823 } 16824 }; 16825 16826 /** 16827 * Slides to the next item. 16828 * @public 16829 * @param {Number} [speed] - The time in milliseconds for the transition. 16830 */ 16831 Owl.prototype.next = function(speed) { 16832 speed = speed || false; 16833 this.to(this.relative(this.current()) + 1, speed); 16834 }; 16835 16836 /** 16837 * Slides to the previous item. 16838 * @public 16839 * @param {Number} [speed] - The time in milliseconds for the transition. 16840 */ 16841 Owl.prototype.prev = function(speed) { 16842 speed = speed || false; 16843 this.to(this.relative(this.current()) - 1, speed); 16844 }; 16845 16846 /** 16847 * Handles the end of an animation. 16848 * @protected 16849 * @param {Event} event - The event arguments. 16850 */ 16851 Owl.prototype.transitionEnd = function(event) { 16852 16853 // if css2 animation then event object is undefined 16854 if (event !== undefined) { 16855 event.stopPropagation(); 16856 16857 // Catch only owl-stage transitionEnd event 16858 if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) { 16859 return false; 16860 } 16861 } 16862 16863 this.state.inMotion = false; 16864 this.trigger('translated'); 16865 }; 16866 16867 /** 16868 * Gets viewport width. 16869 * @protected 16870 * @return {Number} - The width in pixel. 16871 */ 16872 Owl.prototype.viewport = function() { 16873 var width; 16874 if (this.options.responsiveBaseElement !== window) { 16875 width = $(this.options.responsiveBaseElement).width(); 16876 } else if (window.innerWidth) { 16877 width = window.innerWidth; 16878 } else if (document.documentElement && document.documentElement.clientWidth) { 16879 width = document.documentElement.clientWidth; 16880 } else { 16881 throw 'Can not detect viewport width.'; 16882 } 16883 return width; 16884 }; 16885 16886 /** 16887 * Replaces the current content. 16888 * @public 16889 * @param {HTMLElement|jQuery|String} content - The new content. 16890 */ 16891 Owl.prototype.replace = function(content) { 16892 this.$stage.empty(); 16893 this._items = []; 16894 16895 if (content) { 16896 content = (content instanceof jQuery) ? content : $(content); 16897 } 16898 16899 if (this.settings.nestedItemSelector) { 16900 content = content.find('.' + this.settings.nestedItemSelector); 16901 } 16902 16903 content.filter(function() { 16904 return this.nodeType === 1; 16905 }).each($.proxy(function(index, item) { 16906 item = this.prepare(item); 16907 this.$stage.append(item); 16908 this._items.push(item); 16909 this._mergers.push(item.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1); 16910 }, this)); 16911 16912 this.reset($.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0); 16913 16914 this.invalidate('items'); 16915 }; 16916 16917 /** 16918 * Adds an item. 16919 * @todo Use `item` instead of `content` for the event arguments. 16920 * @public 16921 * @param {HTMLElement|jQuery|String} content - The item content to add. 16922 * @param {Number} [position] - The relative position at which to insert the item otherwise the item will be added to the end. 16923 */ 16924 Owl.prototype.add = function(content, position) { 16925 position = position === undefined ? this._items.length : this.normalize(position, true); 16926 16927 this.trigger('add', { content: content, position: position }); 16928 16929 if (this._items.length === 0 || position === this._items.length) { 16930 this.$stage.append(content); 16931 this._items.push(content); 16932 this._mergers.push(content.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1); 16933 } else { 16934 this._items[position].before(content); 16935 this._items.splice(position, 0, content); 16936 this._mergers.splice(position, 0, content.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1); 16937 } 16938 16939 this.invalidate('items'); 16940 16941 this.trigger('added', { content: content, position: position }); 16942 }; 16943 16944 /** 16945 * Removes an item by its position. 16946 * @todo Use `item` instead of `content` for the event arguments. 16947 * @public 16948 * @param {Number} position - The relative position of the item to remove. 16949 */ 16950 Owl.prototype.remove = function(position) { 16951 position = this.normalize(position, true); 16952 16953 if (position === undefined) { 16954 return; 16955 } 16956
16957 this.trigger('remove', { content: this._items[position], position: position }); 16958 16959 this._items[position].remove(); 16960 this._items.splice(position, 1); 16961 this._mergers.splice(position, 1); 16962 16963 this.invalidate('items'); 16964 16965 this.trigger('removed', { content: null, position: position }); 16966 }; 16967 16968 /** 16969 * Adds triggerable events. 16970 * @protected 16971 */ 16972 Owl.prototype.addTriggerableEvents = function() { 16973 var handler = $.proxy(function(callback, event) { 16974 return $.proxy(function(e) { 16975 if (e.relatedTarget !== this) { 16976 this.suppress([ event ]); 16977 callback.apply(this, [].slice.call(arguments, 1)); 16978 this.release([ event ]); 16979 } 16980 }, this); 16981 }, this); 16982 16983 $.each({ 16984 'next': this.next, 16985 'prev': this.prev, 16986 'to': this.to, 16987 'destroy': this.destroy, 16988 'refresh': this.refresh, 16989 'replace': this.replace, 16990 'add': this.add, 16991 'remove': this.remove 16992 }, $.proxy(function(event, callback) { 16993 this.$element.on(event + '.owl.carousel', handler(callback, event + '.owl.carousel')); 16994 }, this)); 16995 16996 }; 16997 16998 /** 16999 * Watches the visibility of the carousel element. 17000 * @protected 17001 */ 17002 Owl.prototype.watchVisibility = function() { 17003 17004 // test on zepto 17005 if (!isElVisible(this.$element.get(0))) { 17006 this.$element.addClass('owl-hidden'); 17007 window.clearInterval(this.e._checkVisibile); 17008 this.e._checkVisibile = window.setInterval($.proxy(checkVisible, this), 500); 17009 } 17010 17011 function isElVisible(el) { 17012 return el.offsetWidth > 0 && el.offsetHeight > 0; 17013 } 17014 17015 function checkVisible() { 17016 if (isElVisible(this.$element.get(0))) { 17017 this.$element.removeClass('owl-hidden'); 17018 this.refresh(); 17019 window.clearInterval(this.e._checkVisibile); 17020 } 17021 } 17022 }; 17023 17024 /** 17025 * Preloads images with auto width. 17026 * @protected 17027 * @todo Still to test 17028 */ 17029 Owl.prototype.preloadAutoWidthImages = function(imgs) { 17030 var loaded, that, $el, img; 17031 17032 loaded = 0; 17033 that = this; 17034 imgs.each(function(i, el) { 17035 $el = $(el); 17036 img = new Image(); 17037 17038 img.onload = function() { 17039 loaded++; 17040 $el.attr('src', img.src); 17041 $el.css('opacity', 1); 17042 if (loaded >= imgs.length) { 17043 that.state.imagesLoaded = true; 17044 that.initialize(); 17045 } 17046 }; 17047 17048 img.src = $el.attr('src') || $el.attr('data-src') || $el.attr('data-src-retina'); 17049 }); 17050 }; 17051 17052 /** 17053 * Destroys the carousel. 17054 * @public 17055 */ 17056 Owl.prototype.destroy = function() { 17057 17058 if (this.$element.hasClass(this.settings.themeClass)) { 17059 this.$element.removeClass(this.settings.themeClass); 17060 } 17061 17062 if (this.settings.responsive !== false) { 17063 $(window).off('resize.owl.carousel'); 17064 } 17065 17066 if (this.transitionEndVendor) { 17067 this.off(this.$stage.get(0), this.transitionEndVendor, this.e._transitionEnd); 17068 } 17069 17070 for ( var i in this._plugins) { 17071 this._plugins[i].destroy(); 17072 } 17073 17074 if (this.settings.mouseDrag || this.settings.touchDrag) { 17075 this.$stage.off('mousedown touchstart touchcancel'); 17076 $(document).off('.owl.dragEvents'); 17077 this.$stage.get(0).onselectstart = function() {}; 17078 this.$stage.off('dragstart', function() { return false }); 17079 } 17080 17081 // remove event handlers in the ".owl.carousel" namespace 17082 this.$element.off('.owl'); 17083 17084 this.$stage.children('.cloned').remove(); 17085 this.e = null; 17086 this.$element.removeData('owlCarousel'); 17087 17088 this.$stage.children().contents().unwrap(); 17089 this.$stage.children().unwrap(); 17090 this.$stage.unwrap(); 17091 }; 17092 17093 /** 17094 * Operators to calculate right-to-left and left-to-right. 17095 * @protected 17096 * @param {Number} [a] - The left side operand. 17097 * @param {String} [o] - The operator. 17098 * @param {Number} [b] - The right side operand. 17099 */ 17100 Owl.prototype.op = function(a, o, b) { 17101 var rtl = this.settings.rtl; 17102 switch (o) { 17103 case '<': 17104 return rtl ? a > b : a < b; 17105 case '>': 17106 return rtl ? a < b : a > b; 17107 case '>=': 17108 return rtl ? a <= b : a >= b; 17109 case '<=': 17110 return rtl ? a >= b : a <= b; 17111 default: 17112 break; 17113 } 17114 }; 17115 17116 /** 17117 * Attaches to an internal event. 17118 * @protected 17119 * @param {HTMLElement} element - The event source. 17120 * @param {String} event - The event name. 17121 * @param {Function} listener - The event handler to attach. 17122 * @param {Boolean} capture - Wether the event should be handled at the capturing p
17122hase or not. 17123 */ 17124 Owl.prototype.on = function(element, event, listener, capture) { 17125 if (element.addEventListener) { 17126 element.addEventListener(event, listener, capture); 17127 } else if (element.attachEvent) { 17128 element.attachEvent('on' + event, listener); 17129 } 17130 }; 17131 17132 /** 17133 * Detaches from an internal event. 17134 * @protected 17135 * @param {HTMLElement} element - The event source. 17136 * @param {String} event - The event name. 17137 * @param {Function} listener - The attached event handler to detach. 17138 * @param {Boolean} capture - Wether the attached event handler was registered as a capturing listener or not. 17139 */ 17140 Owl.prototype.off = function(element, event, listener, capture) { 17141 if (element.removeEventListener) { 17142 element.removeEventListener(event, listener, capture); 17143 } else if (element.detachEvent) { 17144 element.detachEvent('on' + event, listener); 17145 } 17146 }; 17147 17148 /** 17149 * Triggers an public event. 17150 * @protected 17151 * @param {String} name - The event name. 17152 * @param {*} [data=null] - The event data. 17153 * @param {String} [namespace=.owl.carousel] - The event namespace. 17154 * @returns {Event} - The event arguments. 17155 */ 17156 Owl.prototype.trigger = function(name, data, namespace) { 17157 var status = { 17158 item: { count: this._items.length, index: this.current() } 17159 }, handler = $.camelCase( 17160 $.grep([ 'on', name, namespace ], function(v) { return v }) 17161 .join('-').toLowerCase() 17162 ), event = $.Event( 17163 [ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(), 17164 $.extend({ relatedTarget: this }, status, data) 17165 ); 17166 17167 if (!this._supress[name]) { 17168 $.each(this._plugins, function(name, plugin) { 17169 if (plugin.onTrigger) { 17170 plugin.onTrigger(event); 17171 } 17172 }); 17173 17174 this.$element.trigger(event); 17175 17176 if (this.settings && typeof this.settings[handler] === 'function') { 17177 this.settings[handler].apply(this, event); 17178 } 17179 } 17180 17181 return event; 17182 }; 17183 17184 /** 17185 * Suppresses events. 17186 * @protected 17187 * @param {Array.<String>} events - The events to suppress. 17188 */ 17189 Owl.prototype.suppress = function(events) { 17190 $.each(events, $.proxy(function(index, event) { 17191 this._supress[event] = true; 17192 }, this)); 17193 } 17194 17195 /** 17196 * Releases suppressed events. 17197 * @protected 17198 * @param {Array.<String>} events - The events to release. 17199 */ 17200 Owl.prototype.release = function(events) { 17201 $.each(events, $.proxy(function(index, event) { 17202 delete this._supress[event]; 17203 }, this)); 17204 } 17205 17206 /** 17207 * Checks the availability of some browser features. 17208 * @protected 17209 */ 17210 Owl.prototype.browserSupport = function() { 17211 this.support3d = isPerspective(); 17212 17213 if (this.support3d) { 17214 this.transformVendor = isTransform(); 17215 17216 // take transitionend event name by detecting transition 17217 var endVendors = [ 'transitionend', 'webkitTransitionEnd', 'transitionend', 'oTransitionEnd' ]; 17218 this.transitionEndVendor = endVendors[isTransition()]; 17219 17220 // take vendor name from transform name 17221 this.vendorName = this.transformVendor.replace(/Transform/i, ''); 17222 this.vendorName = this.vendorName !== '' ? '-' + this.vendorName.toLowerCase() + '-' : ''; 17223 } 17224 17225 this.state.orientation = window.orientation; 17226 }; 17227 17228 /** 17229 * Get touch/drag coordinats. 17230 * @private 17231 * @param {event} - mousedown/touchstart event 17232 * @returns {object} - Contains X and Y of current mouse/touch position 17233 */ 17234 17235 function getTouches(event) { 17236 if (event.touches !== undefined) { 17237 return { 17238 x: event.touches[0].pageX, 17239 y: event.touches[0].pageY 17240 }; 17241 } 17242 17243 if (event.touches === undefined) { 17244 if (event.pageX !== undefined) { 17245 return { 17246 x: event.pageX, 17247 y: event.pageY 17248 }; 17249 } 17250 17251 if (event.pageX === undefined) { 17252 return { 17253 x: event.clientX, 17254 y: event.clientY 17255 }; 17256 } 17257 } 17258 } 17259 17260 /** 17261 * Checks for CSS support. 17262 * @private 17263 * @param {Array} array - The CSS properties to check for. 17264 * @returns {Array} - Contains the supported CSS property name and its index or `false`. 17265 */ 17266 function isStyleSupported(array) { 17267 var p, s, fake = document.createElement('div'), list = array; 17268 for (p in list) { 17269 s = list[p]; 17270 if (typeof fake.style[s] !== 'undefined') { 17271 fake = null; 17272 return [ s, p ]; 17273 } 17274 } 17275 return [ false ]; 17276 } 17277 17278 /** 17279 * Checks for CSS transition support. 17280 * @private 17281 * @todo Realy bad design 17282 * @returns {Number} 17283 */ 17284 function isTransition() { 17285 return isStyleSupported([ 'transition', 'WebkitTransition', 'MozTransition', 'OTransition' ])[1]; 17286 } 17287 17288 /** 17289 * Checks for CSS transform support. 17290 * @private 17291 * @returns {String} The supported property name or false. 17292 */ 17293 function isTransform() { 17294 return isStyleSupported([ 'transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform' ])[0]; 17295 } 17296 17297 /** 17298 * Checks for CSS perspective support. 17299 * @private 17300 * @returns {String} The supported property name or false. 17301 */ 17302 function isPerspective() { 17303 return isStyleSupported([ 'perspective', 'webkitPerspective', 'MozPerspective', 'OPerspective', 'MsPerspective' ])[0]; 17304 } 17305 17306 /** 17307 * Checks wether touch is supported or not. 17308 * @private 17309 * @returns {Boolean} 17310 */ 17311 function isTouchSupport() { 17312 return 'ontouchstart' in window || !!(navigator.msMaxTouchPoints); 17313 } 17314 17315 /** 17316 * Checks wether touch is supported or not for IE. 17317 * @private 17318 * @returns {Boolean} 17319 */ 17320 function isTouchSupportIE() { 17321 return window.navigator.msPointerEnabled; 17322 } 17323 17324 /** 17325 * The jQuery Plugin for the Owl Carousel
17326 * @public 17327 */ 17328 $.fn.owlCarousel = function(options) { 17329 return this.each(function() { 17330 if (!$(this).data('owlCarousel')) { 17331 $(this).data('owlCarousel', new Owl(this, options)); 17332 } 17333 }); 17334 }; 17335 17336 /** 17337 * The constructor for the jQuery Plugin 17338 * @public 17339 */ 17340 $.fn.owlCarousel.Constructor = Owl; 17341 17342})(window.Zepto || window.jQuery, window, document); 17343 17344/** 17345 * Lazy Plugin 17346 * @version 2.0.0 17347 * @author Bartosz Wojciechowski 17348 * @license The MIT License (MIT) 17349 */ 17350;(function($, window, document, undefined) { 17351 17352 /** 17353 * Creates the lazy plugin. 17354 * @class The Lazy Plugin 17355 * @param {Owl} carousel - The Owl Carousel 17356 */ 17357 var Lazy = function(carousel) { 17358 17359 /** 17360 * Reference to the core. 17361 * @protected 17362 * @type {Owl} 17363 */ 17364 this._core = carousel; 17365 17366 /** 17367 * Already loaded items. 17368 * @protected 17369 * @type {Array.<jQuery>} 17370 */ 17371 this._loaded = []; 17372 17373 /** 17374 * Event handlers. 17375 * @protected 17376 * @type {Object} 17377 */ 17378 this._handlers = { 17379 'initialized.owl.carousel change.owl.carousel': $.proxy(function(e) { 17380 if (!e.namespace) { 17381 return; 17382 } 17383 17384 if (!this._core.settings || !this._core.settings.lazyLoad) { 17385 return; 17386 } 17387 17388 if ((e.property && e.property.name == 'position') || e.type == 'initialized') { 17389 var settings = this._core.settings, 17390 n = (settings.center && Math.ceil(settings.items / 2) || settings.items), 17391 i = ((settings.center && n * -1) || 0), 17392 position = ((e.property && e.property.value) || this._core.current()) + i, 17393 clones = this._core.clones().length, 17394 load = $.proxy(function(i, v) { this.load(v) }, this); 17395 17396 while (i++ < n) { 17397 this.load(clones / 2 + this._core.relative(position)); 17398 clones && $.each(this._core.clones(this._core.relative(position++)), load); 17399 } 17400 } 17401 }, this) 17402 }; 17403 17404 // set the default options 17405 this._core.options = $.extend({}, Lazy.Defaults, this._core.options); 17406 17407 // register event handler 17408 this._core.$element.on(this._handlers); 17409 } 17410 17411 /** 17412 * Default options. 17413 * @public 17414 */ 17415 Lazy.Defaults = { 17416 lazyLoad: false 17417 } 17418 17419 /** 17420 * Loads all resources of an item at the specified position. 17421 * @param {Number} position - The absolute position of the item. 17422 * @protected 17423 */ 17424 Lazy.prototype.load = function(position) { 17425 var $item = this._core.$stage.children().eq(position), 17426 $elements = $item && $item.find('.owl-lazy'); 17427 17428 if (!$elements || $.inArray($item.get(0), this._loaded) > -1) { 17429 return; 17430 } 17431 17432 $elements.each($.proxy(function(index, element) { 17433 var $element = $(element), image, 17434 url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src'); 17435 17436 this._core.trigger('load', { element: $element, url: url }, 'lazy'); 17437 17438 if ($element.is('img')) { 17439 $element.one('load.owl.lazy', $.proxy(function() { 17440 $element.css('opacity', 1); 17441 this._core.trigger('loaded', { element: $element, url: url }, 'lazy'); 17442 }, this)).attr('src', url); 17443 } else { 17444 image = new Image(); 17445 image.onload = $.proxy(function() { 17446 $element.css({ 17447 'background-image': 'url(' + url + ')', 17448 'opacity': '1' 17449 }); 17450 this._core.trigger('loaded', { element: $element, url: url }, 'lazy'); 17451 }, this); 17452 image.src = url; 17453 } 17454 }, this)); 17455 17456 this._loaded.push($item.get(0)); 17457 } 17458 17459 /** 17460 * Destroys the plugin. 17461 * @public 17462 */ 17463 Lazy.prototype.destroy = function() { 17464 var handler, property; 17465 17466 for (handler in this.handlers) { 17467 this._core.$element.off(handler, this.handlers[handler]); 17468 } 17469 for (property in Object.getOwnPropertyNames(this)) { 17470 typeof this[property] != 'function' && (this[property] = null); 17471 } 17472 } 17473 17474 $.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy; 17475 17476})(window.Zepto || window.jQuery, window, document); 17477 17478/** 17479 * AutoHeight Plugin 17480 * @version 2.0.0 17481 * @author Bartosz Wojciechowski 17482 * @license The MIT License (MIT) 17483 */ 17484;(function($, window, document, undefined) { 17485 17486 /** 17487 * Creates the auto height plugin. 17488 * @class The Auto Height Plugin 17489 * @param {Owl} carousel - The Owl Carousel 17490 */ 17491 var AutoHeight = function(carousel) { 17492 /** 17493 * Reference to the core. 17494 * @protected 17495 * @type {Owl} 17496 */ 17497 this._core = carousel; 17498 17499 /** 17500 * All event handlers. 17501 * @protected 17502 * @type {Object} 17503 */ 17504 this._handlers = { 17505 'initialized.owl.carousel': $.proxy(function() { 17506 if (this._core.settings.autoHeight) { 17507 this.update(); 17508 } 17509 }, this), 17510 'changed.owl.carousel': $.proxy(function(e) { 17511 if (this._core.settings.autoHeight && e.property.name == 'position'){ 17512 this.update(); 17513 } 17514 }, this), 17515 'loaded.owl.lazy': $.proxy(function(e) { 17516 if (this._core.settings.autoHeight && e.element.closest('.' + this._core.settings.itemClass) 17517 === this._core.$stage.children().eq(this._core.current())) { 17518 this.update(); 17519 } 17520 }, this) 17521 }; 17522 17523 // set default options 17524 this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options); 17525 17526 // register event handlers 17527 this._core.$element.on(this._handlers); 17528 }; 17529 17530 /** 17531 * Default options. 17532 * @public 17533 */ 17534 AutoHeight.Defaults = { 17535 autoHeight: false, 17536 autoHeightClass: 'owl-height' 17537 }; 17538 17539 /** 17540 * Updates the view. 17541 */ 17542 AutoHeight.prototype.update = function() { 17543 this._core.$stage.parent() 17544 .height(this._core.$stage.children().eq(this._core.current()).height()) 17545 .addClass(this._core.settings.autoHeightClass); 17546 }; 17547 17548 AutoHeight.prototype.destroy = function() { 17549 var handler, property; 17550 17551 for (handler in this._handlers) { 17552 this._core.$element.off(handler, this._handlers[handler]); 17553 } 17554 for (property in Object.getOwnPropertyNames(this)) { 17555 typeof this[property] != 'function' && (this[property] = null); 17556 } 17557 }; 17558 17559 $.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight; 17560 17561})(window.Zepto || window.jQuery, window, document); 17562 17563/** 17564 * Video Plugin 17565 * @version 2.0.0 17566 * @author Bartosz Wojciechowski 17567 * @license The MIT License (MIT) 17568 */ 17569;(function($, window, document, undefined) { 17570 17571 /** 17572 * Creates the video plugin. 17573 * @class The Video Plugin 17574 * @param {Owl} carousel - The Owl Carousel
vendor: 5,485 bytes, lines 17575-17788
17575 */ 17576 var Video = function(carousel) { 17577 /** 17578 * Reference to the core. 17579 * @protected 17580 * @type {Owl} 17581 */ 17582 this._core = carousel; 17583 17584 /** 17585 * Cache all video URLs. 17586 * @protected 17587 * @type {Object} 17588 */ 17589 this._videos = {}; 17590 17591 /** 17592 * Current playing item. 17593 * @protected 17594 * @type {jQuery} 17595 */ 17596 this._playing = null; 17597 17598 /** 17599 * Whether this is in fullscreen or not. 17600 * @protected 17601 * @type {Boolean} 17602 */ 17603 this._fullscreen = false; 17604 17605 /** 17606 * All event handlers. 17607 * @protected 17608 * @type {Object} 17609 */ 17610 this._handlers = { 17611 'resize.owl.carousel': $.proxy(function(e) { 17612 if (this._core.settings.video && !this.isInFullScreen()) { 17613 e.preventDefault(); 17614 } 17615 }, this), 17616 'refresh.owl.carousel changed.owl.carousel': $.proxy(function(e) { 17617 if (this._playing) { 17618 this.stop(); 17619 } 17620 }, this), 17621 'prepared.owl.carousel': $.proxy(function(e) { 17622 var $element = $(e.content).find('.owl-video'); 17623 if ($element.length) { 17624 $element.css('display', 'none'); 17625 this.fetch($element, $(e.content)); 17626 } 17627 }, this) 17628 }; 17629 17630 // set default options 17631 this._core.options = $.extend({}, Video.Defaults, this._core.options); 17632 17633 // register event handlers 17634 this._core.$element.on(this._handlers); 17635 17636 this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) { 17637 this.play(e); 17638 }, this)); 17639 }; 17640 17641 /** 17642 * Default options. 17643 * @public 17644 */ 17645 Video.Defaults = { 17646 video: false, 17647 videoHeight: false, 17648 videoWidth: false 17649 }; 17650 17651 /** 17652 * Gets the video ID and the type (YouTube/Vimeo only). 17653 * @protected 17654 * @param {jQuery} target - The target containing the video data. 17655 * @param {jQuery} item - The item containing the video. 17656 */ 17657 Video.prototype.fetch = function(target, item) { 17658 17659 var type = target.attr('data-vimeo-id') ? 'vimeo' : 'youtube', 17660 id = target.attr('data-vimeo-id') || target.attr('data-youtube-id'), 17661 width = target.attr('data-width') || this._core.settings.videoWidth, 17662 height = target.attr('data-height') || this._core.settings.videoHeight, 17663 url = target.attr('href'); 17664 17665 if (url) { 17666 id = url.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/); 17667 17668 if (id[3].indexOf('youtu') > -1) { 17669 type = 'youtube'; 17670 } else if (id[3].indexOf('vimeo') > -1) { 17671 type = 'vimeo'; 17672 } else { 17673 throw new Error('Video URL not supported.'); 17674 } 17675 id = id[6]; 17676 } else { 17677 throw new Error('Missing video URL.'); 17678 } 17679 17680 this._videos[url] = { 17681 type: type, 17682 id: id, 17683 width: width, 17684 height: height 17685 }; 17686 17687 item.attr('data-video', url); 17688 17689 this.thumbnail(target, this._videos[url]); 17690 }; 17691 17692 /** 17693 * Creates video thumbnail. 17694 * @protected 17695 * @param {jQuery} target - The target containing the video data. 17696 * @param {Object} info - The video info object. 17697 * @see `fetch` 17698 */ 17699 Video.prototype.thumbnail = function(target, video) { 17700 17701 var tnLink, 17702 icon, 17703 path, 17704 dimensions = video.width && video.height ? 'style="width:' + video.width + 'px;height:' + video.height + 'px;"' : '', 17705 customTn = target.find('img'), 17706 srcType = 'src', 17707 lazyClass = '', 17708 settings = this._core.settings, 17709 create = function(path) { 17710 icon = '<div class="owl-video-play-icon"></div>'; 17711 17712 if (settings.lazyLoad) { 17713 tnLink = '<div class="owl-video-tn ' + lazyClass + '" ' + srcType + '="' + path + '"></div>'; 17714 } else { 17715 tnLink = '<div class="owl-video-tn" style="opacity:1;background-image:url(' + path + ')"></div>'; 17716 } 17717 target.after(tnLink); 17718 target.after(icon); 17719 }; 17720 17721 // wrap video content into owl-video-wrapper div 17722 target.wrap('<div class="owl-video-wrapper"' + dimensions + '></div>'); 17723 17724 if (this._core.settings.lazyLoad) { 17725 srcType = 'data-src'; 17726 lazyClass = 'owl-lazy'; 17727 } 17728 17729 // custom thumbnail 17730 if (customTn.length) { 17731 create(customTn.attr(srcType)); 17732 customTn.remove(); 17733 return false; 17734 } 17735 17736 if (video.type === 'youtube') { 17737 path = "http://img.youtube.com/vi/" + video.id + "/hqdefault.jpg"; 17738 create(path); 17739 } else if (video.type === 'vimeo') { 17740 $.ajax({ 17741 type: 'GET', 17742 url: 'http://vimeo.com/api/v2/video/' + video.id + '.json', 17743 jsonp: 'callback', 17744 dataType: 'jsonp', 17745 success: function(data) { 17746 path = data[0].thumbnail_large; 17747 create(path); 17748 } 17749 }); 17750 } 17751 }; 17752 17753 /** 17754 * Stops the current video. 17755 * @public 17756 */ 17757 Video.prototype.stop = function() { 17758 this._core.trigger('stop', null, 'video'); 17759 this._playing.find('.owl-video-frame').remove(); 17760 this._playing.removeClass('owl-video-playing'); 17761 this._playing = null; 17762 }; 17763 17764 /** 17765 * Starts the current video. 17766 * @public 17767 * @param {Event} ev - The event arguments. 17768 */ 17769 Video.prototype.play = function(ev) { 17770 this._core.trigger('play', null, 'video'); 17771 17772 if (this._playing) { 17773 this.stop(); 17774 } 17775 17776 var target = $(ev.target || ev.srcElement), 17777 item = target.closest('.' + this._core.settings.itemClass), 17778 video = this._videos[item.attr('data-video')], 17779 width = video.width || '100%', 17780 height = video.height || this._core.$stage.height(), 17781 html, wrap; 17782 17783 if (video.type === 'youtube') { 17784 html = '<iframe width="' + width + '" height="' + height + '" src="http://www.youtube.com/embed/' 17785 + video.id + '?autoplay=1&v=' + video.id + '" frameborder="0" allowfullscreen></iframe>'; 17786 } else if (video.type === 'vimeo') { 17787 html = '<iframe src="http://player.vimeo.com/video/' + video.id + '?autoplay=1" width="' + width 17788 + '" height="' + height
17789 + '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'; 17790 } 17791 17792 item.addClass('owl-video-playing'); 17793 this._playing = item; 17794 17795 wrap = $('<div style="height:' + height + 'px; width:' + width + 'px" class="owl-video-frame">' 17796 + html + '</div>'); 17797 target.after(wrap); 17798 }; 17799 17800 /** 17801 * Checks whether an video is currently in full screen mode or not. 17802 * @todo Bad style because looks like a readonly method but changes members. 17803 * @protected 17804 * @returns {Boolean} 17805 */ 17806 Video.prototype.isInFullScreen = function() { 17807 17808 // if Vimeo Fullscreen mode 17809 var element = document.fullscreenElement || document.mozFullScreenElement 17810 || document.webkitFullscreenElement; 17811 17812 if (element && $(element).parent().hasClass('owl-video-frame')) { 17813 this._core.speed(0); 17814 this._fullscreen = true; 17815 } 17816 17817 if (element && this._fullscreen && this._playing) { 17818 return false; 17819 } 17820 17821 // comming back from fullscreen 17822 if (this._fullscreen) { 17823 this._fullscreen = false; 17824 return false; 17825 } 17826 17827 // check full screen mode and window orientation 17828 if (this._playing) { 17829 if (this._core.state.orientation !== window.orientation) { 17830 this._core.state.orientation = window.orientation; 17831 return false; 17832 } 17833 } 17834 17835 return true; 17836 }; 17837 17838 /** 17839 * Destroys the plugin. 17840 */ 17841 Video.prototype.destroy = function() { 17842 var handler, property; 17843 17844 this._core.$element.off('click.owl.video'); 17845 17846 for (handler in this._handlers) { 17847 this._core.$element.off(handler, this._handlers[handler]); 17848 } 17849 for (property in Object.getOwnPropertyNames(this)) { 17850 typeof this[property] != 'function' && (this[property] = null); 17851 } 17852 }; 17853 17854 $.fn.owlCarousel.Constructor.Plugins.Video = Video; 17855 17856})(window.Zepto || window.jQuery, window, document); 17857 17858/** 17859 * Animate Plugin 17860 * @version 2.0.0 17861 * @author Bartosz Wojciechowski 17862 * @license The MIT License (MIT) 17863 */ 17864;(function($, window, document, undefined) { 17865 17866 /** 17867 * Creates the animate plugin. 17868 * @class The Navigation Plugin 17869 * @param {Owl} scope - The Owl Carousel 17870 */ 17871 var Animate = function(scope) { 17872 this.core = scope; 17873 this.core.options = $.extend({}, Animate.Defaults, this.core.options); 17874 this.swapping = true; 17875 this.previous = undefined; 17876 this.next = undefined; 17877 17878 this.handlers = { 17879 'change.owl.carousel': $.proxy(function(e) { 17880 if (e.property.name == 'position') { 17881 this.previous = this.core.current(); 17882 this.next = e.property.value; 17883 } 17884 }, this), 17885 'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) { 17886 this.swapping = e.type == 'translated'; 17887 }, this), 17888 'translate.owl.carousel': $.proxy(function(e) { 17889 if (this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) { 17890 this.swap(); 17891 } 17892 }, this) 17893 }; 17894 17895 this.core.$element.on(this.handlers); 17896 }; 17897 17898 /** 17899 * Default options. 17900 * @public 17901 */ 17902 Animate.Defaults = { 17903 animateOut: false, 17904 animateIn: false 17905 }; 17906 17907 /** 17908 * Toggles the animation classes whenever an translations starts. 17909 * @protected 17910 * @returns {Boolean|undefined} 17911 */ 17912 Animate.prototype.swap = function() { 17913 17914 if (this.core.settings.items !== 1 || !this.core.support3d) { 17915 return; 17916 } 17917 17918 this.core.speed(0); 17919 17920 var left, 17921 clear = $.proxy(this.clear, this), 17922 previous = this.core.$stage.children().eq(this.previous), 17923 next = this.core.$stage.children().eq(this.next), 17924 incoming = this.core.settings.animateIn, 17925 outgoing = this.core.settings.animateOut; 17926 17927 if (this.core.current() === this.previous) { 17928 return; 17929 } 17930 17931 if (outgoing) { 17932 left = this.core.coordinates(this.previous) - this.core.coordinates(this.next); 17933 previous.css( { 'left': left + 'px' } ) 17934 .addClass('animated owl-animated-out') 17935 .addClass(outgoing) 17936 .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', clear); 17937 } 17938 17939 if (incoming) { 17940 next.addClass('animated owl-animated-in') 17941 .addClass(incoming) 17942 .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', clear); 17943 } 17944 }; 17945 17946 Animate.prototype.clear = function(e) { 17947 $(e.target).css( { 'left': '' } ) 17948 .removeClass('animated owl-animated-out owl-animated-in') 17949 .removeClass(this.core.settings.animateIn) 17950 .removeClass(this.core.settings.animateOut); 17951 this.core.transitionEnd(); 17952 } 17953 17954 /** 17955 * Destroys the plugin. 17956 * @public 17957 */ 17958 Animate.prototype.destroy = function() { 17959 var handler, property; 17960 17961 for (handler in this.handlers) { 17962 this.core.$element.off(handler, this.handlers[handler]); 17963 } 17964 for (property in Object.getOwnPropertyNames(this)) { 17965 typeof this[property] != 'function' && (this[property] = null); 17966 } 17967 }; 17968 17969 $.fn.owlCarousel.Constructor.Plugins.Animate = Animate; 17970 17971})(window.Zepto || window.jQuery, window, document); 17972 17973/** 17974 * Autoplay Plugin 17975 * @version 2.0.0 17976 * @author Bartosz Wojciechowski 17977 * @license The MIT License (MIT) 17978 */ 17979;(function($, window, document, undefined) { 17980 17981 /** 17982 * Creates the autoplay plugin. 17983 * @class The Autoplay Plugin 17984 * @param {Owl} scope - The Owl Carousel
17985 */ 17986 var Autoplay = function(scope) { 17987 this.core = scope; 17988 this.core.options = $.extend({}, Autoplay.Defaults, this.core.options); 17989 17990 this.handlers = { 17991 'translated.owl.carousel refreshed.owl.carousel': $.proxy(function() { 17992 this.autoplay(); 17993 }, this), 17994 'play.owl.autoplay': $.proxy(function(e, t, s) { 17995 this.play(t, s); 17996 }, this), 17997 'stop.owl.autoplay': $.proxy(function() { 17998 this.stop(); 17999 }, this), 18000 'mouseover.owl.autoplay': $.proxy(function() { 18001 if (this.core.settings.autoplayHoverPause) { 18002 this.pause(); 18003 } 18004 }, this), 18005 'mouseleave.owl.autoplay': $.proxy(function() { 18006 if (this.core.settings.autoplayHoverPause) { 18007 this.autoplay(); 18008 } 18009 }, this) 18010 }; 18011 18012 this.core.$element.on(this.handlers); 18013 }; 18014 18015 /** 18016 * Default options. 18017 * @public 18018 */ 18019 Autoplay.Defaults = { 18020 autoplay: false, 18021 autoplayTimeout: 5000, 18022 autoplayHoverPause: false, 18023 autoplaySpeed: false 18024 }; 18025 18026 /** 18027 * @protected 18028 * @todo Must be documented. 18029 */ 18030 Autoplay.prototype.autoplay = function() { 18031 if (this.core.settings.autoplay && !this.core.state.videoPlay) { 18032 window.clearInterval(this.interval); 18033 18034 this.interval = window.setInterval($.proxy(function() { 18035 this.play(); 18036 }, this), this.core.settings.autoplayTimeout); 18037 } else { 18038 window.clearInterval(this.interval); 18039 } 18040 }; 18041 18042 /** 18043 * Starts the autoplay. 18044 * @public 18045 * @param {Number} [timeout] - ... 18046 * @param {Number} [speed] - ... 18047 * @returns {Boolean|undefined} - ... 18048 * @todo Must be documented. 18049 */ 18050 Autoplay.prototype.play = function(timeout, speed) { 18051 // if tab is inactive - doesnt work in <IE10 18052 if (document.hidden === true) { 18053 return; 18054 } 18055 18056 if (this.core.state.isTouch || this.core.state.isScrolling 18057 || this.core.state.isSwiping || this.core.state.inMotion) { 18058 return; 18059 } 18060 18061 if (this.core.settings.autoplay === false) { 18062 window.clearInterval(this.interval); 18063 return; 18064 } 18065 18066 this.core.next(this.core.settings.autoplaySpeed); 18067 }; 18068 18069 /** 18070 * Stops the autoplay. 18071 * @public 18072 */ 18073 Autoplay.prototype.stop = function() { 18074 window.clearInterval(this.interval); 18075 }; 18076 18077 /** 18078 * Pauses the autoplay. 18079 * @public 18080 */ 18081 Autoplay.prototype.pause = function() { 18082 window.clearInterval(this.interval); 18083 }; 18084 18085 /** 18086 * Destroys the plugin. 18087 */ 18088 Autoplay.prototype.destroy = function() { 18089 var handler, property; 18090 18091 window.clearInterval(this.interval); 18092 18093 for (handler in this.handlers) { 18094 this.core.$element.off(handler, this.handlers[handler]); 18095 } 18096 for (property in Object.getOwnPropertyNames(this)) { 18097 typeof this[property] != 'function' && (this[property] = null); 18098 } 18099 }; 18100 18101 $.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay; 18102 18103})(window.Zepto || window.jQuery, window, document); 18104 18105/** 18106 * Navigation Plugin 18107 * @version 2.0.0 18108 * @author Artus Kolanowski 18109 * @license The MIT License (MIT) 18110 */ 18111;(function($, window, document, undefined) { 18112 'use strict'; 18113 18114 /** 18115 * Creates the navigation plugin. 18116 * @class The Navigation Plugin 18117 * @param {Owl} carousel - The Owl Carousel. 18118 */ 18119 var Navigation = function(carousel) { 18120 /** 18121 * Reference to the core. 18122 * @protected 18123 * @type {Owl} 18124 */ 18125 this._core = carousel; 18126 18127 /** 18128 * Indicates whether the plugin is initialized or not. 18129 * @protected 18130 * @type {Boolean} 18131 */ 18132 this._initialized = false; 18133 18134 /** 18135 * The current paging indexes. 18136 * @protected 18137 * @type {Array} 18138 */ 18139 this._pages = []; 18140 18141 /** 18142 * All DOM elements of the user interface. 18143 * @protected 18144 * @type {Object} 18145 */ 18146 this._controls = {}; 18147 18148 /** 18149 * Markup for an indicator. 18150 * @protected 18151 * @type {Array.<String>} 18152 */ 18153 this._templates = []; 18154 18155 /** 18156 * The carousel element. 18157 * @type {jQuery} 18158 */ 18159 this.$element = this._core.$element; 18160 18161 /** 18162 * Overridden methods of the carousel. 18163 * @protected 18164 * @type {Object} 18165 */ 18166 this._overrides = { 18167 next: this._core.next, 18168 prev: this._core.prev, 18169 to: this._core.to 18170 }; 18171 18172 /** 18173 * All event handlers. 18174 * @protected 18175 * @type {Object} 18176 */ 18177 this._handlers = { 18178 'prepared.owl.carousel': $.proxy(function(e) { 18179 if (this._core.settings.dotsData) { 18180 this._templates.push($(e.content).find('[data-dot]').andSelf('[data-dot]').attr('data-dot')); 18181 } 18182 }, this), 18183 'add.owl.carousel': $.proxy(function(e) { 18184 if (this._core.settings.dotsData) { 18185 this._templates.splice(e.position, 0, $(e.content).find('[data-dot]').andSelf('[data-dot]').attr('data-dot')); 18186 } 18187 }, this), 18188 'remove.owl.carousel prepared.owl.carousel': $.proxy(function(e) { 18189 if (this._core.settings.dotsData) { 18190 this._templates.splice(e.position, 1); 18191 } 18192 }, this), 18193 'change.owl.carousel': $.proxy(function(e) { 18194 if (e.property.name == 'position') { 18195 if (!this._core.state.revert && !this._core.settings.loop && this._core.settings.navRewind) { 18196 var current = this._core.current(), 18197 maximum = this._core.maximum(), 18198 minimum = this._core.minimum(); 18199 e.data = e.property.value > maximum 18200 ? current >= maximum ? minimum : maximum 18201 : e.property.value < minimum ? maximum : e.property.value; 18202 } 18203 } 18204 }, this), 18205 'changed.owl.carousel': $.proxy(function(e) { 18206 if (e.property.name == 'position') { 18207 this.draw(); 18208 } 18209 }, this), 18210 'refreshed.owl.carousel': $.proxy(function() { 18211 if (!this._initialized) { 18212 this.initialize(); 18213 this._initialized = true; 18214 } 18215 this._core.trigger('refresh', null, 'navigation'); 18216 this.update(); 18217 this.draw(); 18218 this._core.trigger('refreshed', null, 'navigation'); 18219 }, this) 18220 }; 18221 18222 // set default options 18223 this._core.options = $.extend({}, Navigation.Defaults, this._core.options); 18224 18225 // register event handlers 18226 this.$element.on(this._handlers); 18227 } 18228 18229 /** 18230 * Default options. 18231 * @public 18232 * @todo Rename `slideBy` to `navBy` 18233 */ 18234 Navigation.Defaults = { 18235 nav: false, 18236 navRewind: true, 18237 navText: [ 'prev', 'next' ], 18238 navSpeed: false, 18239 navElement: 'div', 18240 navContainer: false, 18241 navContainerClass: 'owl-nav', 18242 navClass: [ 'owl-prev', 'owl-next' ], 18243 slideBy: 1, 18244 dotClass: 'owl-dot', 18245 dotsClass: 'owl-dots', 18246 dots: true, 18247 dotsEach: false, 18248 dotData: false, 18249 dotsSpeed: false, 18250 dotsContainer: false,
18251 controlsClass: 'owl-controls' 18252 } 18253 18254 /** 18255 * Initializes the layout of the plugin and extends the carousel. 18256 * @protected 18257 */ 18258 Navigation.prototype.initialize = function() { 18259 var $container, override, 18260 options = this._core.settings; 18261 18262 // create the indicator template 18263 if (!options.dotsData) { 18264 this._templates = [ $('<div>') 18265 .addClass(options.dotClass) 18266 .append($('<span>')) 18267 .prop('outerHTML') ]; 18268 } 18269 18270 // create controls container if needed 18271 if (!options.navContainer || !options.dotsContainer) { 18272 this._controls.$container = $('<div>') 18273 .addClass(options.controlsClass) 18274 .appendTo(this.$element); 18275 } 18276 18277 // create DOM structure for absolute navigation 18278 this._controls.$indicators = options.dotsContainer ? $(options.dotsContainer) 18279 : $('<div>').hide().addClass(options.dotsClass).appendTo(this._controls.$container); 18280 18281 this._controls.$indicators.on('click', 'div', $.proxy(function(e) { 18282 var index = $(e.target).parent().is(this._controls.$indicators) 18283 ? $(e.target).index() : $(e.target).parent().index(); 18284 18285 e.preventDefault(); 18286 18287 this.to(index, options.dotsSpeed); 18288 }, this)); 18289 18290 // create DOM structure for relative navigation 18291 $container = options.navContainer ? $(options.navContainer) 18292 : $('<div>').addClass(options.navContainerClass).prependTo(this._controls.$container); 18293 18294 this._controls.$next = $('<' + options.navElement + '>'); 18295 this._controls.$previous = this._controls.$next.clone(); 18296 18297 this._controls.$previous 18298 .addClass(options.navClass[0]) 18299 .html(options.navText[0]) 18300 .hide() 18301 .prependTo($container) 18302 .on('click', $.proxy(function(e) { 18303 this.prev(options.navSpeed); 18304 }, this)); 18305 this._controls.$next 18306 .addClass(options.navClass[1]) 18307 .html(options.navText[1]) 18308 .hide() 18309 .appendTo($container) 18310 .on('click', $.proxy(function(e) { 18311 this.next(options.navSpeed); 18312 }, this)); 18313 18314 // override public methods of the carousel 18315 for (override in this._overrides) { 18316 this._core[override] = $.proxy(this[override], this); 18317 } 18318 } 18319 18320 /** 18321 * Destroys the plugin. 18322 * @protected 18323 */ 18324 Navigation.prototype.destroy = function() { 18325 var handler, control, property, override; 18326 18327 for (handler in this._handlers) { 18328 this.$element.off(handler, this._handlers[handler]); 18329 } 18330 for (control in this._controls) { 18331 this._controls[control].remove(); 18332 } 18333 for (override in this.overides) { 18334 this._core[override] = this._overrides[override]; 18335 } 18336 for (property in Object.getOwnPropertyNames(this)) { 18337 typeof this[property] != 'function' && (this[property] = null); 18338 } 18339 } 18340 18341 /** 18342 * Updates the internal state. 18343 * @protected 18344 */ 18345 Navigation.prototype.update = function() { 18346 var i, j, k, 18347 options = this._core.settings, 18348 lower = this._core.clones().length / 2, 18349 upper = lower + this._core.items().length, 18350 size = options.center || options.autoWidth || options.dotData 18351 ? 1 : options.dotsEach || options.items; 18352 18353 if (options.slideBy !== 'page') { 18354 options.slideBy = Math.min(options.slideBy, options.items); 18355 } 18356 18357 if (options.dots || options.slideBy == 'page') { 18358 this._pages = []; 18359 18360 for (i = lower, j = 0, k = 0; i < upper; i++) { 18361 if (j >= size || j === 0) { 18362 this._pages.push({ 18363 start: i - lower, 18364 end: i - lower + size - 1 18365 }); 18366 j = 0, ++k; 18367 } 18368 j += this._core.mergers(this._core.relative(i)); 18369 } 18370 } 18371 } 18372 18373 /** 18374 * Draws the user interface. 18375 * @todo The option `dotData` wont work. 18376 * @protected 18377 */ 18378 Navigation.prototype.draw = function() { 18379 var difference, i, html = '', 18380 options = this._core.settings, 18381 $items = this._core.$stage.children(), 18382 index = this._core.relative(this._core.current()); 18383 18384 if (options.nav && !options.loop && !options.navRewind) { 18385 this._controls.$previous.toggleClass('disabled', index <= 0); 18386 this._controls.$next.toggleClass('disabled', index >= this._core.maximum()); 18387 } 18388 18389 this._controls.$previous.toggle(options.nav); 18390 this._controls.$next.toggle(options.nav); 18391 18392 if (options.dots) { 18393 difference = this._pages.length - this._controls.$indicators.children().length; 18394 18395 if (options.dotData && difference !== 0) { 18396 for (i = 0; i < this._controls.$indicators.children().length; i++) { 18397 html += this._templates[this._core.relative(i)]; 18398 } 18399 this._controls.$indicators.html(html); 18400 } else if (difference > 0) { 18401 html = new Array(difference + 1).join(this._templates[0]); 18402 this._controls.$indicators.append(html); 18403 } else if (difference < 0) { 18404 this._controls.$indicators.children().slice(difference).remove(); 18405 } 18406 18407 this._controls.$indicators.find('.active').removeClass('active'); 18408 this._controls.$indicators.children().eq($.inArray(this.current(), this._pages)).addClass('active'); 18409 } 18410 18411 this._controls.$indicators.toggle(options.dots); 18412 } 18413 18414 /** 18415 * Extends event data. 18416 * @protected 18417 * @param {Event} event - The event object which gets thrown. 18418 */ 18419 Navigation.prototype.onTrigger = function(event) { 18420 var settings = this._core.settings; 18421 18422 event.page = { 18423 index: $.inArray(this.current(), this._pages), 18424 count: this._pages.length,
18425 size: settings && (settings.center || settings.autoWidth || settings.dotData 18426 ? 1 : settings.dotsEach || settings.items) 18427 }; 18428 } 18429 18430 /** 18431 * Gets the current page position of the carousel. 18432 * @protected 18433 * @returns {Number} 18434 */ 18435 Navigation.prototype.current = function() { 18436 var index = this._core.relative(this._core.current()); 18437 return $.grep(this._pages, function(o) { 18438 return o.start <= index && o.end >= index; 18439 }).pop(); 18440 } 18441 18442 /** 18443 * Gets the current succesor/predecessor position. 18444 * @protected 18445 * @returns {Number} 18446 */ 18447 Navigation.prototype.getPosition = function(successor) { 18448 var position, length, 18449 options = this._core.settings; 18450 18451 if (options.slideBy == 'page') { 18452 position = $.inArray(this.current(), this._pages); 18453 length = this._pages.length; 18454 successor ? ++position : --position; 18455 position = this._pages[((position % length) + length) % length].start; 18456 } else { 18457 position = this._core.relative(this._core.current()); 18458 length = this._core.items().length; 18459 successor ? position += options.slideBy : position -= options.slideBy; 18460 } 18461 return position; 18462 } 18463 18464 /** 18465 * Slides to the next item or page. 18466 * @public 18467 * @param {Number} [speed=false] - The time in milliseconds for the transition. 18468 */ 18469 Navigation.prototype.next = function(speed) { 18470 $.proxy(this._overrides.to, this._core)(this.getPosition(true), speed); 18471 } 18472 18473 /** 18474 * Slides to the previous item or page. 18475 * @public 18476 * @param {Number} [speed=false] - The time in milliseconds for the transition. 18477 */ 18478 Navigation.prototype.prev = function(speed) { 18479 $.proxy(this._overrides.to, this._core)(this.getPosition(false), speed); 18480 } 18481 18482 /** 18483 * Slides to the specified item or page. 18484 * @public 18485 * @param {Number} position - The position of the item or page. 18486 * @param {Number} [speed] - The time in milliseconds for the transition. 18487 * @param {Boolean} [standard=false] - Whether to use the standard behaviour or not. 18488 */ 18489 Navigation.prototype.to = function(position, speed, standard) { 18490 var length; 18491 18492 if (!standard) { 18493 length = this._pages.length; 18494 $.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed); 18495 } else { 18496 $.proxy(this._overrides.to, this._core)(position, speed); 18497 } 18498 } 18499 18500 $.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation; 18501 18502})(window.Zepto || window.jQuery, window, document); 18503 18504/** 18505 * Hash Plugin 18506 * @version 2.0.0 18507 * @author Artus Kolanowski 18508 * @license The MIT License (MIT) 18509 */ 18510;(function($, window, document, undefined) { 18511 'use strict'; 18512 18513 /** 18514 * Creates the hash plugin. 18515 * @class The Hash Plugin 18516 * @param {Owl} carousel - The Owl Carousel 18517 */ 18518 var Hash = function(carousel) { 18519 /** 18520 * Reference to the core. 18521 * @protected 18522 * @type {Owl} 18523 */ 18524 this._core = carousel; 18525 18526 /** 18527 * Hash table for the hashes. 18528 * @protected 18529 * @type {Object} 18530 */ 18531 this._hashes = {}; 18532 18533 /** 18534 * The carousel element. 18535 * @type {jQuery} 18536 */ 18537 this.$element = this._core.$element; 18538 18539 /** 18540 * All event handlers. 18541 * @protected 18542 * @type {Object} 18543 */ 18544 this._handlers = { 18545 'initialized.owl.carousel': $.proxy(function() { 18546 if (this._core.settings.startPosition == 'URLHash') { 18547 $(window).trigger('hashchange.owl.navigation'); 18548 } 18549 }, this), 18550 'prepared.owl.carousel': $.proxy(function(e) { 18551 var hash = $(e.content).find('[data-hash]').andSelf('[data-hash]').attr('data-hash'); 18552 this._hashes[hash] = e.content; 18553 }, this) 18554 }; 18555 18556 // set default options 18557 this._core.options = $.extend({}, Hash.Defaults, this._core.options); 18558 18559 // register the event handlers 18560 this.$element.on(this._handlers); 18561 18562 // register event listener for hash navigation 18563 $(window).on('hashchange.owl.navigation', $.proxy(function() { 18564 var hash = window.location.hash.substring(1), 18565 items = this._core.$stage.children(), 18566 position = this._hashes[hash] && items.index(this._hashes[hash]) || 0; 18567 18568 if (!hash) { 18569 return false; 18570 } 18571 18572 this._core.to(position, false, true); 18573 }, this)); 18574 } 18575 18576 /** 18577 * Default options. 18578 * @public 18579 */ 18580 Hash.Defaults = { 18581 URLhashListener: false 18582 } 18583 18584 /** 18585 * Destroys the plugin. 18586 * @public 18587 */ 18588 Hash.prototype.destroy = function() { 18589 var handler, property; 18590 18591 $(window).off('hashchange.owl.navigation'); 18592 18593 for (handler in this._handlers) { 18594 this._core.$element.off(handler, this._handlers[handler]); 18595 } 18596 for (property in Object.getOwnPropertyNames(this)) { 18597 typeof this[property] != 'function' && (this[property] = null); 18598 } 18599 } 18600 18601 $.fn.owlCarousel.Constructor.Plugins.Hash = Hash; 18602 18603})(window.Zepto || window.jQuery, window, document); 18604(function(){ 18605 if(parseInt(window.orientation)!=window.orientation) return; 18606 18607 var ios = /(iPad|iPhone|iPod)/g.test( navigator.userAgent ); 18608 var w = ios ? screen.width : window.innerWidth;
18609 var h = ios ? screen.height : window.innerHeight; 18610 18611 if(Math.min(h, w) >= 569){ 18612 $("meta[name=viewport]").attr('content', 'width=1240'); 18613 }else{ 18614 var switchViewport = function(){ 18615 $("meta[name=viewport]").attr('content', 'width=device-width'); 18616 }; 18617 18618 $(window).on('orientationchange', switchViewport); 18619 switchViewport(); 18620 } 18621})();
vendor: 19,136 bytes, lines 18621-19397
18621 18622!(function(root, factory) { 18623 if (typeof define === 'function' && define.amd) { 18624 define(['jquery'], function($) { 18625 return factory(root, $); 18626 }); 18627 } else if (typeof exports === 'object') { 18628 factory(root, require('jquery')); 18629 } else { 18630 factory(root, root.jQuery || root.Zepto); 18631 } 18632})(this, function(global, $) { 18633 18634 'use strict'; 18635 18636 /** 18637 * Name of the plugin 18638 * @private 18639 * @const 18640 * @type {String} 18641 */ 18642 var PLUGIN_NAME = 'remodal'; 18643 18644 /** 18645 * Namespace for CSS and events 18646 * @private 18647 * @const 18648 * @type {String} 18649 */ 18650 var NAMESPACE = global.REMODAL_GLOBALS && global.REMODAL_GLOBALS.NAMESPACE || PLUGIN_NAME; 18651 18652 /** 18653 * Animationstart event with vendor prefixes 18654 * @private 18655 * @const 18656 * @type {String} 18657 */ 18658 var ANIMATIONSTART_EVENTS = $.map( 18659 ['animationstart', 'webkitAnimationStart', 'MSAnimationStart', 'oAnimationStart'], 18660 18661 function(eventName) { 18662 return eventName + '.' + NAMESPACE; 18663 } 18664 18665 ).join(' '); 18666 18667 /** 18668 * Animationend event with vendor prefixes 18669 * @private 18670 * @const 18671 * @type {String} 18672 */ 18673 var ANIMATIONEND_EVENTS = $.map( 18674 ['animationend', 'webkitAnimationEnd', 'MSAnimationEnd', 'oAnimationEnd'], 18675 18676 function(eventName) { 18677 return eventName + '.' + NAMESPACE; 18678 } 18679 18680 ).join(' '); 18681 18682 /** 18683 * Default settings 18684 * @private 18685 * @const 18686 * @type {Object} 18687 */ 18688 var DEFAULTS = $.extend({ 18689 hashTracking: true, 18690 closeOnConfirm: true, 18691 closeOnCancel: true, 18692 closeOnEscape: true, 18693 closeOnOutsideClick: true, 18694 modifier: '', 18695 appendTo: null 18696 }, global.REMODAL_GLOBALS && global.REMODAL_GLOBALS.DEFAULTS); 18697 18698 /** 18699 * States of the Remodal 18700 * @private 18701 * @const 18702 * @enum {String} 18703 */ 18704 var STATES = { 18705 CLOSING: 'closing', 18706 CLOSED: 'closed', 18707 OPENING: 'opening', 18708 OPENED: 'opened' 18709 }; 18710 18711 /** 18712 * Reasons of the state change. 18713 * @private 18714 * @const 18715 * @enum {String} 18716 */ 18717 var STATE_CHANGE_REASONS = { 18718 CONFIRMATION: 'confirmation', 18719 CANCELLATION: 'cancellation' 18720 }; 18721 18722 /** 18723 * Is animation supported? 18724 * @private 18725 * @const 18726 * @type {Boolean} 18727 */ 18728 var IS_ANIMATION = (function() { 18729 var style = document.createElement('div').style; 18730 18731 return style.animationName !== undefined || 18732 style.WebkitAnimationName !== undefined || 18733 style.MozAnimationName !== undefined || 18734 style.msAnimationName !== undefined || 18735 style.OAnimationName !== undefined; 18736 })(); 18737 18738 /** 18739 * Is iOS? 18740 * @private 18741 * @const 18742 * @type {Boolean} 18743 */ 18744 var IS_IOS = /iPad|iPhone|iPod/.test(navigator.platform); 18745 18746 /** 18747 * Current modal 18748 * @private 18749 * @type {Remodal} 18750 */ 18751 var current; 18752 18753 /** 18754 * Scrollbar position 18755 * @private 18756 * @type {Number} 18757 */ 18758 var scrollTop; 18759 18760 /** 18761 * Returns an animation duration 18762 * @private 18763 * @param {jQuery} $elem 18764 * @returns {Number} 18765 */ 18766 function getAnimationDuration($elem) { 18767 if ( 18768 IS_ANIMATION && 18769 $elem.css('animation-name') === 'none' && 18770 $elem.css('-webkit-animation-name') === 'none' && 18771 $elem.css('-moz-animation-name') === 'none' && 18772 $elem.css('-o-animation-name') === 'none' && 18773 $elem.css('-ms-animation-name') === 'none' 18774 ) { 18775 return 0; 18776 } 18777 18778 var duration = $elem.css('animation-duration') || 18779 $elem.css('-webkit-animation-duration') || 18780 $elem.css('-moz-animation-duration') || 18781 $elem.css('-o-animation-duration') || 18782 $elem.css('-ms-animation-duration') || 18783 '0s'; 18784 18785 var delay = $elem.css('animation-delay') || 18786 $elem.css('-webkit-animation-delay') || 18787 $elem.css('-moz-animation-delay') || 18788 $elem.css('-o-animation-delay') || 18789 $elem.css('-ms-animation-delay') || 18790 '0s'; 18791 18792 var iterationCount = $elem.css('animation-iteration-count') || 18793 $elem.css('-webkit-animation-iteration-count') || 18794 $elem.css('-moz-animation-iteration-count') || 18795 $elem.css('-o-animation-iteration-count') || 18796 $elem.css('-ms-animation-iteration-count') || 18797 '1'; 18798 18799 var max; 18800 var len; 18801 var num; 18802 var i; 18803 18804 duration = duration.split(', '); 18805 delay = delay.split(', '); 18806 iterationCount = iterationCount.split(', '); 18807 18808 // The 'duration' size is the same as the 'delay' size 18809 for (i = 0, len = duration.length, max = Number.NEGATIVE_INFINITY; i < len; i++) { 18810 num = parseFloat(duration[i]) * parseInt(iterationCount[i], 10) + parseFloat(delay[i]); 18811 18812 if (num > max) { 18813 max = num; 18814 } 18815 } 18816 18817 return max; 18818 } 18819 18820 /** 18821 * Returns a scrollbar width 18822 * @private 18823 * @returns {Number} 18824 */ 18825 function getScrollbarWidth() { 18826 if ($(document).height() <= $(window).height()) { 18827 return 0; 18828 } 18829 18830 var outer = document.createElement('div'); 18831 var inner = document.createElement('div'); 18832 var widthNoScroll; 18833 var widthWithScroll; 18834 18835 outer.style.visibility = 'hidden'; 18836 outer.style.width = '100px'; 18837 document.body.appendChild(outer); 18838 18839 widthNoScroll = outer.offsetWidth; 18840 18841 // Force scrollbars 18842 outer.style.overflow = 'scroll'; 18843 18844 // Add inner div 18845 inner.style.width = '100%'; 18846 outer.appendChild(inner); 18847 18848 widthWithScroll = inner.offsetWidth; 18849 18850 // Remove divs 18851 outer.parentNode.removeChild(outer); 18852 18853 return widthNoScroll - widthWithScroll; 18854 } 18855 18856 /** 18857 * Locks the screen 18858 * @private 18859 */ 18860 function lockScreen() { 18861 if (IS_IOS) { 18862 return; 18863 } 18864 18865 var $html = $('html'); 18866 var lockedClass = namespacify('is-locked'); 18867 var paddingRight; 18868 var $body; 18869 18870 if (!$html.hasClass(lockedClass)) { 18871 $body = $(document.body); 18872 18873 // Zepto does not support '-=', '+=' in the `css` method 18874 paddingRight = parseInt($body.css('padding-right'), 10) + getScrollbarWidth(); 18875 18876 $body.css('padding-right', paddingRight + 'px'); 18877 $html.addClass(lockedClass); 18878 } 18879 } 18880 18881 /** 18882 * Unlocks the screen 18883 * @private 18884 */ 18885 function unlockScreen() { 18886 if (IS_IOS) { 18887 return; 18888 } 18889 18890 var $html = $('html'); 18891 var lockedClass = namespacify('is-locked'); 18892 var paddingRight; 18893 var $body; 18894 18895 if ($html.hasClass(lockedClass)) { 18896 $body = $(document.body); 18897 18898 // Zepto does not support '-=', '+=' in the `css` method 18899 paddingRight = parseInt($body.css('padding-right'), 10) - getScrollbarWidth(); 18900 18901 $body.css('padding-right', paddingRight + 'px'); 18902 $html.removeClass(lockedClass); 18903 } 18904 } 18905 18906 /** 18907 * Sets a state for an instance 18908 * @private 18909 * @param {Remodal} instance 18910 * @param {STATES} state 18911 * @param {Boolean} isSilent If true, Remodal does not trigger events 18912 * @param {String} Reason of a state change. 18913 */ 18914 function setState(instance, state, isSilent, reason) { 18915 18916 var newState = namespacify('is', state); 18917 var allStates = [namespacify('is', STATES.CLOSING), 18918 namespacify('is', STATES.OPENING), 18919 namespacify('is', STATES.CLOSED), 18920 namespacify('is', STATES.OPENED)].join(' '); 18921 18922 instance.$bg 18923 .removeClass(allStates) 18924 .addClass(newState); 18925 18926 instance.$overlay 18927 .removeClass(allStates) 18928 .addClass(newState); 18929 18930 instance.$wrapper 18931 .removeClass(allStates) 18932 .addClass(newState); 18933 18934 instance.$modal 18935 .removeClass(allStates) 18936 .addClass(newState); 18937 18938 instance.state = state; 18939 !isSilent && instance.$modal.trigger({ 18940 type: state, 18941 reason: reason 18942 }, [{ reason: reason }]); 18943 } 18944 18945 /** 18946 * Synchronizes with the animation 18947 * @param {Function} doBeforeAnimation 18948 * @param {Function} doAfterAnimation 18949 * @param {Remodal} instance 18950 */ 18951 function syncWithAnimation(doBeforeAnimation, doAfterAnimation, instance) { 18952 var runningAnimationsCount = 0; 18953 18954 var handleAnimationStart = function(e) { 18955 if (e.target !== this) { 18956 return; 18957 } 18958 18959 runningAnimationsCount++; 18960 }; 18961 18962 var handleAnimationEnd = function(e) { 18963 if (e.target !== this) { 18964 return; 18965 } 18966 18967 if (--runningAnimationsCount === 0) { 18968 18969 // Remove event listeners 18970 $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) { 18971 instance[elemName].off(ANIMATIONSTART_EVENTS + ' ' + ANIMATIONEND_EVENTS); 18972 }); 18973 18974 doAfterAnimation(); 18975 } 18976 }; 18977 18978 $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) { 18979 instance[elemName] 18980 .on(ANIMATIONSTART_EVENTS, handleAnimationStart) 18981 .on(ANIMATIONEND_EVENTS, handleAnimationEnd); 18982 }); 18983 18984 doBeforeAnimation(); 18985 18986 // If the animation is not supported by a browser or its duration is 0 18987 if ( 18988 getAnimationDuration(instance.$bg) === 0 && 18989 getAnimationDuration(instance.$overlay) === 0 && 18990 getAnimationDuration(instance.$wrapper) === 0 && 18991 getAnimationDuration(instance.$modal) === 0 18992 ) { 18993 18994 // Remove event listeners 18995 $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) { 18996 instance[elemName].off(ANIMATIONSTART_EVENTS + ' ' + ANIMATIONEND_EVENTS); 18997 }); 18998 18999 doAfterAnimation(); 19000 } 19001 } 19002 19003 /** 19004 * Closes immediately 19005 * @private 19006 * @param {Remodal} instance 19007 */ 19008 function halt(instance) { 19009 if (instance.state === STATES.CLOSED) { 19010 return; 19011 } 19012 19013 $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) { 19014 instance[elemName].off(ANIMATIONSTART_EVENTS + ' ' + ANIMATIONEND_EVENTS); 19015 }); 19016 19017 instance.$bg.removeClass(instance.settings.modifier); 19018 instance.$overlay.removeClass(instance.settings.modifier).hide(); 19019 instance.$wrapper.hide(); 19020 unlockScreen(); 19021 setState(instance, STATES.CLOSED, true); 19022 } 19023 19024 /** 19025 * Parses a string with options 19026 * @private 19027 * @param str 19028 * @returns {Object} 19029 */ 19030 function parseOptions(str) { 19031 var obj = {}; 19032 var arr; 19033 var len; 19034 var val; 19035 var i; 19036 19037 // Remove spaces before and after delimiters 19038 str = str.replace(/\s*:\s*/g, ':').replace(/\s*,\s*/g, ','); 19039 19040 // Parse a string 19041 arr = str.split(','); 19042 for (i = 0, len = arr.length; i < len; i++) { 19043 arr[i] = arr[i].split(':'); 19044 val = arr[i][1]; 19045 19046 // Convert a string value if it is like a boolean 19047 if (typeof val === 'string' || val instanceof String) { 19048 val = val === 'true' || (val === 'false' ? false : val); 19049 } 19050 19051 // Convert a string value if it is like a number 19052 if (typeof val === 'string' || val instanceof String) { 19053 val = !isNaN(val) ? +val : val; 19054 } 19055 19056 obj[arr[i][0]] = val; 19057 } 19058 19059 return obj; 19060 } 19061 19062 /** 19063 * Generates a string separated by dashes and prefixed with NAMESPACE 19064 * @private 19065 * @param {...String} 19066 * @returns {String} 19067 */ 19068 function namespacify() { 19069 var result = NAMESPACE; 19070 19071 for (var i = 0; i < arguments.length; ++i) { 19072 result += '-' + arguments[i]; 19073 } 19074 19075 return result; 19076 } 19077 19078 /** 19079 * Handles the hashchange event 19080 * @private 19081 * @listens hashchange 19082 */ 19083 function handleHashChangeEvent() { 19084 var id = location.hash.replace('#', ''); 19085 var instance; 19086 var $elem; 19087 19088 if (!id) { 19089 19090 // Check if we have currently opened modal and animation was completed 19091 if (current && current.state === STATES.OPENED && current.settings.hashTracking) { 19092 current.close(); 19093 } 19094 } else { 19095 19096 // Catch syntax error if your hash is bad 19097 try { 19098 $elem = $( 19099 '[data-' + PLUGIN_NAME + '-id="' + id + '"]' 19100 ); 19101 } catch (err) {} 19102 19103 if ($elem && $elem.length) { 19104 instance = $[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)]; 19105 19106 if (instance && instance.settings.hashTracking) { 19107 instance.open(); 19108 } 19109 } 19110 19111 } 19112 } 19113 19114 /** 19115 * Remodal constructor 19116 * @constructor 19117 * @param {jQuery} $modal 19118 * @param {Object} options 19119 */ 19120 function Remodal($modal, options) { 19121 var $body = $(document.body); 19122 var $appendTo = $body; 19123 var remodal = this; 19124 19125 remodal.settings = $.extend({}, DEFAULTS, options); 19126 remodal.index = $[PLUGIN_NAME].lookup.push(remodal) - 1; 19127 remodal.state = STATES.CLOSED; 19128 19129 remodal.$overlay = $('.' + namespacify('overlay')); 19130 19131 if (remodal.settings.appendTo !== null && remodal.settings.appendTo.length) { 19132 $appendTo = $(remodal.settings.appendTo); 19133 } 19134 19135 if (!remodal.$overlay.length) { 19136 remodal.$overlay = $('<div>').addClass(namespacify('overlay') + ' ' + namespacify('is', STATES.CLOSED)).hide(); 19137 $appendTo.append(remodal.$overlay); 19138 } 19139 19140 remodal.$bg = $('.' + namespacify('bg')).addClass(namespacify('is', STATES.CLOSED)); 19141 19142 remodal.$modal = $modal 19143 .addClass( 19144 NAMESPACE + ' ' + 19145 namespacify('is-initialized') + ' ' + 19146 remodal.settings.modifier + ' ' + 19147 namespacify('is', STATES.CLOSED)) 19148 .attr('tabindex', '-1'); 19149 19150 remodal.$wrapper = $('<div>') 19151 .addClass( 19152 namespacify('wrapper') + ' ' + 19153 remodal.settings.modifier + ' ' + 19154 namespacify('is', STATES.CLOSED)) 19155 .hide() 19156 .append(remodal.$modal); 19157 $appendTo.append(remodal.$wrapper); 19158 19159 // Add the event listener for the close button 19160 remodal.$wrapper.on('click.' + NAMESPACE, '[data-' + PLUGIN_NAME + '-action="close"]', function(e) { 19161 e.preventDefault(); 19162 19163 remodal.close(); 19164 }); 19165 19166 // Add the event listener for the cancel button 19167 remodal.$wrapper.on('click.' + NAMESPACE, '[data-' + PLUGIN_NAME + '-action="cancel"]', function(e) { 19168 e.preventDefault(); 19169 19170 remodal.$modal.trigger(STATE_CHANGE_REASONS.CANCELLATION); 19171 19172 if (remodal.settings.closeOnCancel) { 19173 remodal.close(STATE_CHANGE_REASONS.CANCELLATION); 19174 } 19175 }); 19176 19177 // Add the event listener for the confirm button 19178 remodal.$wrapper.on('click.' + NAMESPACE, '[data-' + PLUGIN_NAME + '-action="confirm"]', function(e) { 19179 e.preventDefault(); 19180 19181 remodal.$modal.trigger(STATE_CHANGE_REASONS.CONFIRMATION); 19182 19183 if (remodal.settings.closeOnConfirm) { 19184 remodal.close(STATE_CHANGE_REASONS.CONFIRMATION); 19185 } 19186 }); 19187 19188 // Add the event listener for the overlay 19189 remodal.$wrapper.on('click.' + NAMESPACE, function(e) { 19190 var $target = $(e.target); 19191 19192 if (!$target.hasClass(namespacify('wrapper'))) { 19193 return; 19194 } 19195 19196 if (remodal.settings.closeOnOutsideClick) { 19197 remodal.close(); 19198 } 19199 }); 19200 } 19201 19202 /** 19203 * Opens a modal window 19204 * @public 19205 */ 19206 Remodal.prototype.open = function() { 19207 var remodal = this; 19208 var id; 19209 19210 // Check if the animation was completed 19211 if (remodal.state === STATES.OPENING || remodal.state === STATES.CLOSING) { 19212 return; 19213 } 19214 19215 id = remodal.$modal.attr('data-' + PLUGIN_NAME + '-id'); 19216 19217 if (id && remodal.settings.hashTracking) { 19218 scrollTop = $(window).scrollTop(); 19219 location.hash = id; 19220 } 19221 19222 if (current && current !== remodal) { 19223 halt(current); 19224 } 19225 19226 current = remodal; 19227 lockScreen(); 19228 remodal.$bg.addClass(remodal.settings.modifier); 19229 remodal.$overlay.addClass(remodal.settings.modifier).show(); 19230 remodal.$wrapper.show().scrollTop(0); 19231 remodal.$modal.focus(); 19232 19233 syncWithAnimation( 19234 function() { 19235 setState(remodal, STATES.OPENING); 19236 }, 19237 19238 function() { 19239 setState(remodal, STATES.OPENED); 19240 }, 19241 19242 remodal); 19243 }; 19244 19245 /** 19246 * Closes a modal window 19247 * @public 19248 * @param {String} reason 19249 */ 19250 Remodal.prototype.close = function(reason) { 19251 var remodal = this; 19252 19253 // Check if the animation was completed 19254 if (remodal.state === STATES.OPENING || remodal.state === STATES.CLOSING || remodal.state === STATES.CLOSED) { 19255 return; 19256 } 19257 19258 if ( 19259 remodal.settings.hashTracking && 19260 remodal.$modal.attr('data-' + PLUGIN_NAME + '-id') === location.hash.substr(1) 19261 ) { 19262 location.hash = ''; 19263 $(window).scrollTop(scrollTop); 19264 } 19265 19266 syncWithAnimation( 19267 function() { 19268 setState(remodal, STATES.CLOSING, false, reason); 19269 }, 19270 19271 function() { 19272 remodal.$bg.removeClass(remodal.settings.modifier); 19273 remodal.$overlay.removeClass(remodal.settings.modifier).hide(); 19274 remodal.$wrapper.hide(); 19275 unlockScreen(); 19276 19277 setState(remodal, STATES.CLOSED, false, reason); 19278 }, 19279 19280 remodal); 19281 }; 19282 19283 /** 19284 * Returns a current state of a modal 19285 * @public 19286 * @returns {STATES} 19287 */ 19288 Remodal.prototype.getState = function() { 19289 return this.state; 19290 }; 19291 19292 /** 19293 * Destroys a modal 19294 * @public 19295 */ 19296 Remodal.prototype.destroy = function() { 19297 var lookup = $[PLUGIN_NAME].lookup; 19298 var instanceCount; 19299 19300 halt(this); 19301 this.$wrapper.remove(); 19302 19303 delete lookup[this.index]; 19304 instanceCount = $.grep(lookup, function(instance) { 19305 return !!instance; 19306 }).length; 19307 19308 if (instanceCount === 0) { 19309 this.$overlay.remove(); 19310 this.$bg.removeClass( 19311 namespacify('is', STATES.CLOSING) + ' ' + 19312 namespacify('is', STATES.OPENING) + ' ' + 19313 namespacify('is', STATES.CLOSED) + ' ' + 19314 namespacify('is', STATES.OPENED)); 19315 } 19316 }; 19317 19318 /** 19319 * Special plugin object for instances 19320 * @public 19321 * @type {Object} 19322 */ 19323 $[PLUGIN_NAME] = { 19324 lookup: [] 19325 }; 19326 19327 /** 19328 * Plugin constructor 19329 * @constructor 19330 * @param {Object} options 19331 * @returns {JQuery} 19332 */ 19333 $.fn[PLUGIN_NAME] = function(opts) { 19334 var instance; 19335 var $elem; 19336 19337 this.each(function(index, elem) { 19338 $elem = $(elem); 19339 19340 if ($elem.data(PLUGIN_NAME) == null) { 19341 instance = new Remodal($elem, opts); 19342 $elem.data(PLUGIN_NAME, instance.index); 19343 19344 if ( 19345 instance.settings.hashTracking && 19346 $elem.attr('data-' + PLUGIN_NAME + '-id') === location.hash.substr(1) 19347 ) { 19348 instance.open(); 19349 } 19350 } else { 19351 instance = $[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)]; 19352 } 19353 }); 19354 19355 return instance; 19356 }; 19357 19358 $(document).ready(function() { 19359 19360 // data-remodal-target opens a modal window with the special Id 19361 $(document).on('click', '[data-' + PLUGIN_NAME + '-target]', function(e) { 19362 e.preventDefault(); 19363 19364 var elem = e.currentTarget; 19365 var id = elem.getAttribute('data-' + PLUGIN_NAME + '-target'); 19366 var $target = $('[data-' + PLUGIN_NAME + '-id="' + id + '"]'); 19367 19368 $[PLUGIN_NAME].lookup[$target.data(PLUGIN_NAME)].open(); 19369 }); 19370 19371 // Auto initialization of modal windows 19372 // They should have the 'remodal' class attribute 19373 // Also you can write the `data-remodal-options` attribute to pass params into the modal 19374 $(document).find('.' + NAMESPACE).each(function(i, container) { 19375 var $container = $(container); 19376 var options = $container.data(PLUGIN_NAME + '-options'); 19377 19378 if (!options) { 19379 options = {}; 19380 } else if (typeof options === 'string' || options instanceof String) { 19381 options = parseOptions(options); 19382 } 19383 19384 $container[PLUGIN_NAME](options); 19385 }); 19386 19387 // Handles the keydown event 19388 $(document).on('keydown.' + NAMESPACE, function(e) { 19389 if (current && current.settings.closeOnEscape && current.state === STATES.OPENED && e.keyCode === 27) { 19390 current.close(); 19391 } 19392 }); 19393 19394 // Handles the hashchange event 19395 $(window).on('hashchange.' + NAMESPACE, handleHashChangeEvent); 19396 }); 19397});
19398$(function(){ 19399 19400 // $('a.js-target-scroll[href*="#"]:not([href="#"])').click(function() { 19401 $('a[href*="#"]:not([href="#"])').click(function() { 19402 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 19403 var target = $(this.hash); 19404 target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); 19405 if (target.length) { 19406 // $('body').animate({ 19407 // scrollTop: target.offset().top 19408 // }, 500); 19409 if (!cssua.ua.mobile || cssua.ua.mobile=='ipad') { 19410 if(target.hasClass('js-offset-target')){ 19411 target.velocity('scroll', {duration: 500, offset: -95}); 19412 }else{ 19413 target.velocity('scroll', {duration: 500, offset: -60}); 19414 } 19415 // return false; 19416 }else{ 19417 target.velocity('scroll', {duration: 500, offset: -60}); 19418 } 19419 } 19420 } 19421 }); 19422 19423 if(location.hash && $(location.hash).hasClass('js-offset-target')){ 19424 if(!cssua.ua.mobile || cssua.ua.mobile=='ipad'){ 19425 setTimeout(function(){ 19426 $(location.hash).velocity('scroll', {duration: 500, offset: -95}); 19427 }, 10); 19428 }else{ 19429 setTimeout(function(){ 19430 $(location.hash).velocity('scroll', {duration: 500, offset: -60}); 19431 }, 10); 19432 } 19433 } 19434 19435 // var scrollerShown = false; 19436 // $(window).scroll(function(evt){ 19437 // if(scrollerShown){ 19438 // if(window.pageYOffset<500) { 19439 // $('.totop').velocity("fadeOut", {duration: 500}); 19440 // scrollerShown = false; 19441 // } 19442 // }else if(window.pageYOffset>=500){ 19443 // scrollerShown = true; 19444 // $('.totop').velocity("fadeIn", {duration: 500}); 19445 // } 19446 // }); 19447 19448}); 19449$(function() { 19450 $('.js--m-menu').on('click', function(evt) { 19451 var target = $(evt.currentTarget); 19452 if(target.hasClass('nonactive')){ 19453 $('.header__nav').addClass('show').slideDown(); 19454 target.removeClass('nonactive').addClass('active'); 19455 evt.stopPropagation(); 19456 }else if (target.hasClass('active')) { 19457 $('.header__nav').removeClass('show').slideUp(); 19458 target.removeClass('active').addClass('nonactive'); 19459 } 19460 }); 19461 $('.subnav .nav__unit').on('click', function(){ 19462 $('.header__nav').removeClass('show').fadeOut(); 19463 $('.js--m-menu').removeClass('active').addClass('nonactive'); 19464 }); 19465 19466}); 19467$(function(){ 19468 $('.top__owl').owlCarousel({ 19469 loop:true, 19470 nav:false, 19471 items:1, 19472 lazyLoad: true, 19473 autoplay:true, 19474 autoplayTimeout:3500, 19475 autoplayHoverPause:true, 19476 animateOut: "fadeOut" 19477 }); 19478 19479 $('.js-top-station-owl').owlCarousel({ 19480 loop: true, 19481 nav: true, 19482 items: 6, 19483 margin: 10, 19484 navText: ["",""], 19485 responsive: { 19486 0: { 19487 items: 1, 19488 center: true 19489 }, 19490 568: { 19491 items: 6 19492 } 19493 } 19494 }); 19495 19496 $('.js--slider--with-thumb-nav').owlCarousel({ 19497 loop:true, 19498 nav:true, 19499 items:1, 19500 lazyLoad: true, 19501 autoplay:true, 19502 autoplayTimeout:3500, 19503 autoplayHoverPause:true, 19504 animateOut: "fadeOut", 19505 URLhashListener:true, 19506 startPosition: 'URLHash' 19507 }); 19508}); 19509$(function() { 19510 if(window.matchMedia('screen and (min-width: 569px)').matches){ 19511 if($('.contact-box').length){ 19512 $(window).on('load scroll resize', function(){ 19513 var wheight = $(window).height(); 19514 var bottom = $('footer').offset().top; 19515 var content = $('.contact-box').height(); 19516 var scroll = $(window).scrollTop(); 19517 if((scroll + wheight + content) > bottom + 130){ 19518 $('.contact-box').css({ 19519 'position': 'absolute', 19520 'bottom': 'auto', 19521 'top': bottom - content - 50 19522 }); 19523 } else { 19524 $('.contact-box').css({ 19525 'position': 'fixed', 19526 'bottom': '50px', 19527 'top': "auto" 19528 }); 19529 } 19530 }); 19531 } 19532 19533 } 19534}); 19535$(function () { 19536 $("#pagetop").hide(); 19537 19538 $(window).scroll(function () { 19539 if ($(this).scrollTop() > 100) { 19540 $('.pagetop-v2').fadeIn(); 19541 } else { 19542 $('.pagetop-v2').fadeOut(); 19543 } 19544 }); 19545 19546 // scroll body to 0px on click 19547 $('.pagetop-v2').click(function () { 19548 $('body,html').animate({ 19549 scrollTop: 0 19550 }, 800); 19551 return false;
19552 }); 19553}); 19554$(function () { 19555 if ($('.contact-box').length){ 19556 if(window.matchMedia('screen and (max-width: 568px)').matches){ 19557 $(window).scroll(function () { 19558 var docHeight = $(document).innerHeight(); 19559 var windowHeight = $(window).innerHeight(); 19560 var pageBottom = docHeight - windowHeight - 100; 19561 19562 if ($(this).scrollTop() > 50) { 19563 $('.mov-box').removeClass("hide-all").addClass("thumbonly"); 19564 if(pageBottom <= $(window).scrollTop()){ 19565 $('.mov-box').addClass("hide-all"); 19566 } 19567 }else{ 19568 $('.mov-box').removeClass("thumbonly").removeClass("hide-all"); 19569 } 19570 }); 19571 }else{ 19572 $(window).on('load scroll resize', function(){ 19573 var wheight = $(window).height(); 19574 var bottom = $('footer').offset().top; 19575 var content = $('.mov-box').height(); 19576 var scroll = $(window).scrollTop(); 19577 if((scroll + wheight + content) > bottom + 220){ 19578 $('.mov-box').css({ 19579 'position': 'absolute', 19580 'bottom': 'auto', 19581 'top': bottom - content - 60 19582 }); 19583 } else { 19584 $('.mov-box').css({ 19585 'position': 'fixed', 19586 'bottom': '105px', 19587 'top': "auto" 19588 }); 19589 } 19590 }); 19591 } 19592 } 19593}); 19594$(function(){ 19595 if(window.matchMedia('screen and (min-width: 569px)').matches){ 19596 if($('.follow-bar').length){ 19597 $(window).on('load scroll resize', function(){ 19598 var top = $('.follow-bar').offset().top - 95; 19599 var bottom = $('li.step04').offset().top; 19600 var content = $('.follow-tag').height(); 19601 var scroll = $(window).scrollTop(); 19602 if((scroll + content) > bottom){ 19603 $('.follow-tag').css({ 19604 'position': 'absolute', 19605 'top': "1085px" 19606 }); 19607 } else if(top < scroll){ 19608 $('.follow-tag').css({ 19609 'position': 'fixed', 19610 'top': '125px' 19611 }); 19612 } else { 19613 $('.follow-tag').css({ 19614 'position':'absolute', 19615 'top': "30px" 19616 }); 19617 } 19618 }); 19619 } 19620 } 19621}); 19622$(function(){ 19623 if(window.matchMedia('screen and (max-width: 568px)').matches){ 19624 $(".js--feature__header").on("click", function(evt){ 19625 var target = $(evt.currentTarget); 19626 19627 if(target.hasClass("active")){ 19628 target.removeClass("active"); 19629 target.siblings(".feature__body").slideUp(); 19630 }else{ 19631 target.addClass("active"); 19632 target.siblings(".feature__body").slideDown(); 19633 } 19634 }); 19635 19636 $("ul.feature-target-list li .js--close").on("click", function(evt){ 19637 var target = $(evt.currentTarget); 19638 target.parents(".feature__body").slideUp(); 19639 target.parents(".feature__body").siblings(".feature__header").removeClass("active"); 19640 }); 19641 } 19642}); 19643function initialize() { 19644 if(!document.getElementById("map")){ 19645 return; 19646 } 19647 19648 var latlng = new google.maps.LatLng(35.6652186, 139.7399067); 19649 var opts = { 19650 zoom: 15, 19651 center: latlng, 19652 mapTypeControl: true, 19653 mapTypeId: google.maps.MapTypeId.ROADMAP, 19654 scrollwheel: false, 19655 gestureHandling: 'cooperative' 19656 // ,draggable: false 19657 }; 19658 19659 var map = new google.maps.Map(document.getElementById("map"), opts); 19660 19661 // var styleOptions = [{ 19662 // 'stylers': [{ 19663 // 'gamma': 0.8 19664 // }, { 19665 // 'saturation': -100 19666 // }, { 19667 // 'lightness': 20 19668 // }] 19669 // }] 19670 // var styledMapOptions = { 19671 // name: 'accessmap' 19672 // } 19673 // var monoType = new google.maps.StyledMapType(styleOptions, styledMapOptions); 19674 // map.mapTypes.set('mono', monoType); 19675 // map.setMapTypeId('mono'); 19676 19677 // var image = ''; 19678 var image = '/images/v2/icon/map-marker.png'; 19679 var Marker = new google.maps.Marker({ 19680 position: latlng, 19681 map: map, 19682 icon: image 19683 }); 19684 19685 var contentString = 'リフォームステーション'; 19686 var infowindow = new google.maps.InfoWindow({ 19687 content: contentString 19688 }); 19689 //infowindow.open(map, lopanMarker); 19690 google.maps.event.addListener(Marker, 'click', function() { 19691 infowindow.open(map, Marker); 19692 }); 19693 19694} 19695 19696if(typeof(google)!="undefined"){ 19697 google.maps.event.addDomListener(window, 'load', initialize); 19698} 19699; 19700$(function() { 19701 $('.lp-map .pin').mouseenter(function(evt) { 19702 var targetClass = $(evt.currentTarget).data('pin-target'); 19703 var target = $("." + targetClass); 19704 19705 $('dl.map__st-list dd').hide(); 19706 target.fadeIn(); 19707 }); 19708 19709}); 19710$(function(){ 19711 if($('.news-list').length){ 19712 var now = new Date(); 19713 var current = [ 19714 now.getFullYear(), 19715 ("0" + (now.getMonth() + 1)).slice(-2), 19716 ("0" + now.getDate()).slice(-2), 19717 now.getHours(), 19718 now.getMinutes() 19719 ].join(''); 19720 19721 var feed_url = $('.news-list').data('feed-url') || "news/feed/"; 19722 var station_name = $('.news-list').data('station'); 19723 $.get(feed_url + '?'+current, function(data){ 19724 var ul = $('.news-list'); 19725 var date = ""; 19726 var contentItem = ""; 19727 ul.html(""); 19728 $('item', data).slice(0, 5).each(function(i, item){ 19729 var d = new Date($('pubDate', item).text()); 19730 date = [ 19731 d.getFullYear(), 19732 ("0" + (d.getMonth() + 1)).slice(-2), 19733 ("0" + d.getDate()).slice(-2) 19734 ].join( '.' ); 19735 19736 // $(item).children().each(function() { 19737 // if ($(this)[0].tagName == "content:encoded") { 19738 // contentItem = $(this).text(); 19739 // } 19740 // }); 19741 19742 var area = $('area', item).text(); 19743 if(station_name && area!="全店舗") area = station_name; 19744 19745 ul.append($("<li/>").append( 19746 "<a href='"+$('link', item).text()+"'>"+ 19747 "<span class='date'>"+date+"</span>"+ 19748 "<span class='label "+$('category', item).text()+"'>"+$('categoryLabel', item).text()+"</span>"+ 19749 "<span class='title'>"+$('title', item).text()+"</span>"+ 19750 "<span class='area'>"+area+"</span>"+ 19751 "</a>" 19752 )); 19753 }); 19754 }); 19755 } 19756}); 19757$(function(){ 19758 if($('.column-list').length){ 19759 var now = new Date(); 19760 var current = [ 19761 now.getFullYear(), 19762 ("0" + (now.getMonth() + 1)).slice(-2), 19763 ("0" + now.getDate()).slice(-2), 19764 now.getHours(), 19765 now.getMinutes() 19766 ].join(''); 19767 19768 var feed_url = $('.column-list').data('feed-url') || "column/feed/"; 19769 $.get(feed_url + '?'+current, function(data){ 19770 var ul = $('.column-list'); 19771 var date = ""; 19772 var contentItem = ""; 19773 ul.html(""); 19774 $('item', data).slice(0, 5).each(function(i, item){ 19775 19776 var d = new Date($('pubDate', item).text()); 19777 19778 date = [ 19779 d.getFullYear(), 19780 ("0" + (d.getMonth() + 1)).slice(-2), 19781 ("0" + d.getDate()).slice(-2) 19782 ].join( '.' ); 19783 19784 // $(item).children().each(function() { 19785 // if ($(this)[0].tagName == "content:encoded") { 19786 // contentItem = $(this).text(); 19787 // } 19788 // }); 19789 19790 var column = $('column', item).text(); 19791 19792 ul.append($("<li/>").append( 19793 "<a href='"+$('link', item).text()+"'>"+ 19794 "<span class='date'>"+date+"</span>"+ 19795 "<span class='label "+$('category', item).text()+"'>"+$('categoryLabel', item).text()+"</span>"+ 19796 "<span class='title'>"+$('title', item).text()+"</span>"+ 19797 "</a>" 19798 )); 19799 }); 19800 }); 19801 } 19802 }); 19803 19804$(function(){ 19805 if($('body.inquiry_body form').length){ 19806 var switchCategory = function(){ 19807 var category_val = $('input[name=category]:checked').val(); 19808 if(category_val==4){ 19809 // $('.inquiry_address_form').show(); 19810 $('.inquiry_zip').show(); 19811 $('.inquiry_add2').show(); 19812 $('.inquiry_require_tel').show(); 19813 }else{ 19814 // $('.inquiry_address_form').hide(); 19815 $('.inquiry_zip').hide(); 19816 $('.inquiry_add2').hide(); 19817 $('.inquiry_require_tel').hide(); 19818 } 19819 } 19820 19821 $('input[name=category]').on('change', switchCategory); 19822 switchCategory(); 19823 } 19824}); 19825$(function(){ 19826 if($('.js-example-list').length){ 19827 var now = new Date(); 19828 var current = [ 19829 now.getFullYear(), 19830 ("0" + (now.getMonth() + 1)).slice(-2), 19831 ("0" + now.getDate()).slice(-2), 19832 now.getHours(), 19833 now.getMinutes() 19834 ].join(''); 19835 19836 var feed_url = $('.js-example-list').data('feed-url') || "/example/feed/"; 19837 19838 $.get(feed_url + '?'+current, function(data){ 19839 var ul = $('.js-example-list'); 19840 var date = ""; 19841 var contentItem = ""; 19842 ul.html(""); 19843 $('item', data).slice(0, 5).each(function(i, item){ 19844 19845 var images = $('images', item).text(); 19846 19847 ul.append($("<li/>").append( 19848 "<a href='"+$('link', item).text()+"'>"+ 19849 "<span class='label "+$('category', item).text()+"'>"+$('categoryLabel', item).text()+"</span>"+ 19850 "<span class='title'>"+$('title', item).text()+"</span>"+ 19851 "</a>" 19852 )); 19853 }); 19854 }); 19855 } 19856}); 19857!function(i){"use strict";"function"==typeof define&&define.amd?define(["jquery"],i):"undefined"!=typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function(i){"use strict";var e=window.Slick||{};(e=function(){var e=0;return function(t,o){var s,n=this;n.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:i(t),appendDots:i(t),arrows:!0,asNavFor:null,prevArrow:'<button class="slick-prev" aria-label="Previous" type="button">Previous</button>',nextArrow:'<button class="slick-next" aria-label="Next" type="button">Next</button>',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(e,t){return i('<button type="button" />').text(t+1)},dots:!1,dotsClass:"slick-dots",draggable:!0,easing:"linear",edgeFriction:.35,fade:!1,focusOnSelect:!1,focusOnChange:!1,infinite:!0,initialSlide:0,lazyLoad:"ondemand",mobileFirst:!1,pauseOnHover:!0,pauseOnFocus:!0,pauseOnDotsHover:!1,respondTo:"window",responsive:null,rows:1,rtl:!1,slide:"",slidesPerRow:1,slidesToShow:1,slidesToScroll:1,speed:500,swipe:!0,swipeToSlide:!1,touchMove:!0,touchThreshold:5,useCSS:!0,useTransform:!0,variableWidth:!1,vertical:!1,verticalSwiping:!1,waitForAnimate:!0,zIndex:1e3},n.initials={animating:!1,dragging:!1,autoPlayTimer:null,currentDirection:0,currentLeft:null,currentSlide:0,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,scrolling:!1,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,
vendor: 6,594 bytes, line 19857
19857sliding:!1,slideOffset:0,swipeLeft:null,swiping:!1,$list:null,touchObject:{},transformsEnabled:!1,unslicked:!1},i.extend(n,n.initials),n.activeBreakpoint=null,n.animType=null,n.animProp=null,n.breakpoints=[],n.breakpointSettings=[],n.cssTransitions=!1,n.focussed=!1,n.interrupted=!1,n.hidden="hidden",n.paused=!0,n.positionProp=null,n.respondTo=null,n.rowCount=1,n.shouldClick=!0,n.$slider=i(t),n.$slidesCache=null,n.transformType=null,n.transitionType=null,n.visibilityChange="visibilitychange",n.windowWidth=0,n.windowTimer=null,s=i(t).data("slick")||{},n.options=i.extend({},n.defaults,o,s),n.currentSlide=n.options.initialSlide,n.originalSettings=n.options,void 0!==document.mozHidden?(n.hidden="mozHidden",n.visibilityChange="mozvisibilitychange"):void 0!==document.webkitHidden&&(n.hidden="webkitHidden",n.visibilityChange="webkitvisibilitychange"),n.autoPlay=i.proxy(n.autoPlay,n),n.autoPlayClear=i.proxy(n.autoPlayClear,n),n.autoPlayIterator=i.proxy(n.autoPlayIterator,n),n.changeSlide=i.proxy(n.changeSlide,n),n.clickHandler=i.proxy(n.clickHandler,n),n.selectHandler=i.proxy(n.selectHandler,n),n.setPosition=i.proxy(n.setPosition,n),n.swipeHandler=i.proxy(n.swipeHandler,n),n.dragHandler=i.proxy(n.dragHandler,n),n.keyHandler=i.proxy(n.keyHandler,n),n.instanceUid=e++,n.htmlExpr=/^(?:\s*(<[\w\W]+>)[^>]*)$/,n.registerBreakpoints(),n.init(!0)}}()).prototype.activateADA=function(){this.$slideTrack.find(".slick-active").attr({"aria-hidden":"false"}).find("a, input, button, select").attr({tabindex:"0"})},e.prototype.addSlide=e.prototype.slickAdd=function(e,t,o){var s=this;if("boolean"==typeof t)o=t,t=null;else if(t<0||t>=s.slideCount)return!1;s.unload(),"number"==typeof t?0===t&&0===s.$slides.length?i(e).appendTo(s.$slideTrack):o?i(e).insertBefore(s.$slides.eq(t)):i(e).insertAfter(s.$slides.eq(t)):!0===o?i(e).prependTo(s.$slideTrack):i(e).appendTo(s.$slideTrack),s.$slides=s.$slideTrack.children(this.options.slide),s.$slideTrack.children(this.options.slide).detach(),s.$slideTrack.append(s.$slides),s.$slides.each(function(e,t){i(t).attr("data-slick-index",e)}),s.$slidesCache=s.$slides,s.reinit()},e.prototype.animateHeight=function(){var i=this;if(1===i.options.slidesToShow&&!0===i.options.adaptiveHeight&&!1===i.options.vertical){var e=i.$slides.eq(i.currentSlide).outerHeight(!0);i.$list.animate({height:e},i.options.speed)}},e.prototype.animateSlide=function(e,t){var o={},s=this;s.animateHeight(),!0===s.options.rtl&&!1===s.options.vertical&&(e=-e),!1===s.transformsEnabled?!1===s.options.vertical?s.$slideTrack.animate({left:e},s.options.speed,s.options.easing,t):s.$slideTrack.animate({top:e},s.options.speed,s.options.easing,t):!1===s.cssTransitions?(!0===s.options.rtl&&(s.currentLeft=-s.currentLeft),i({animStart:s.currentLeft}).animate({animStart:e},{duration:s.options.speed,easing:s.options.easing,step:function(i){i=Math.ceil(i),!1===s.options.vertical?(o[s.animType]="translate("+i+"px, 0px)",s.$slideTrack.css(o)):(o[s.animType]="translate(0px,"+i+"px)",s.$slideTrack.css(o))},complete:function(){t&&t.call()}})):(s.applyTransition(),e=Math.ceil(e),!1===s.options.vertical?o[s.animType]="translate3d("+e+"px, 0px, 0px)":o[s.animType]="translate3d(0px,"+e+"px, 0px)",s.$slideTrack.css(o),t&&setTimeout(function(){s.disableTransition(),t.call()},s.options.speed))},e.prototype.getNavTarget=function(){var e=this,t=e.options.asNavFor;return t&&null!==t&&(t=i(t).not(e.$slider)),t},e.prototype.asNavFor=function(e){var t=this.getNavTarget();null!==t&&"object"==typeof t&&t.each(function(){var t=i(this).slick("getSlick");t.unslicked||t.slideHandler(e,!0)})},e.prototype.applyTransition=function(i){var e=this,t={};!1===e.options.fade?t[e.transitionType]=e.transformType+" "+e.options.speed+"ms "+e.options.cssEase:t[e.transitionType]="opacity "+e.options.speed+"ms "+e.options.cssEase,!1===e.options.fade?e.$slideTrack.css(t):e.$slides.eq(i).css(t)},e.prototype.autoPlay=function(){var i=this;i.autoPlayClear(),i.slideCount>i.options.slidesToShow&&(i.autoPlayTimer=setInterval(i.autoPlayIterator,i.options.autoplaySpeed))},e.prototype.autoPlayClear=function(){var i=this;i.autoPlayTimer&&clearInterval(i.autoPlayTimer)},e.prototype.autoPlayIterator=function(){var i=this,e=i.currentSlide+i.options.slidesToScroll;i.paused||i.interrupted||i.focussed||(!1===i.options.infinite&&(1===i.direction&&i.currentSlide+1===i.slideCount-1?i.direction=0:0===i.direction&&(e=i.currentSlide-i.options.slidesToScroll,i.currentSlide-1==0&&(i.direction=1))),i.slideHandler(e))},e.prototype.buildArrows=function(){var e=this;!0===e.options.arrows&&(e.$prevArrow=i(e.options.prevArrow).addClass("slick-arrow"),e.$nextArrow=i(e.options.nextArrow).addClass("slick-arrow"),e.slideCount>e.options.slidesToShow?(e.$prevArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"),e.$nextArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"),e.htmlExpr.test(e.options.prevArrow)&&e.$prevArrow.prependTo(e.options.appendArrows),e.htmlExpr.test(e.options.nextArrow)&&e.$nextArrow.appendTo(e.options.appendArrows),!0!==e.options.infinite&&e.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true")):e.$prevArrow.add(e.$nextArrow).addClass("slick-hidden").attr({"aria-disabled":"true",tabindex:"-1"}))},e.prototype.buildDots=function(){var e,t,o=this;if(!0===o.options.dots){for(o.$slider.addClass("slick-dotted"),t=i("<ul />").addClass(o.options.dotsClass),e=0;e<=o.getDotCount();e+=1)t.append(i("<li />").append(o.options.customPaging.call(this,o,e)));o.$dots=t.appendTo(o.options.appendDots),o.$dots.find("li").first().addClass("slick-active")}},e.prototype.buildOut=function(){var e=this;e.$slides=e.$slider.children(e.options.slide+":not(.slick-cloned)").addClass("slick-slide"),e.slideCount=e.$slides.length,e.$slides.each(function(e,t){i(t).attr("data-slick-index",e).data("originalStyling",i(t).attr("style")||"")}),e.$slider.addClass("slick-slider"),e.$slideTrack=0===e.slideCount?i('<div class="slick-track"/>').appendTo(e.$slider):e.$slides.wrapAll('<div class="slick-track"/>').parent(),e.$list=e.$slideTrack.wrap('<div class="slick-list"/>').parent(),e.$slideTrack.css("opacity",0),!0!==e.options.centerMode&&!0!==e.options.swipeToSlide||(e.options.slidesToScroll=1),i("img[data-lazy]",e.$slider).not("[src]").addClass("slick-loading"),e.setupInfinite(),e.buildArrows(),e.buildDots(),e.updateDots(),e.setSlideClasses("number"==typeof e.currentSlide?e.currentSlide:0),!0===e.options.draggable&&e.$list.addClass("draggable")},e.prototype.buildRows=function(){var i,e,t,o,s,n,r,l=this;if(o=document.createDocumentFragment(),n=l.$slider.children(),l.o
vendor: 3,442 bytes, line 19857
19857ptions.rows>1){for(r=l.options.slidesPerRow*l.options.rows,s=Math.ceil(n.length/r),i=0;i<s;i++){var d=document.createElement("div");for(e=0;e<l.options.rows;e++){var a=document.createElement("div");for(t=0;t<l.options.slidesPerRow;t++){var c=i*r+(e*l.options.slidesPerRow+t);n.get(c)&&a.appendChild(n.get(c))}d.appendChild(a)}o.appendChild(d)}l.$slider.empty().append(o),l.$slider.children().children().children().css({width:100/l.options.slidesPerRow+"%",display:"inline-block"})}},e.prototype.checkResponsive=function(e,t){var o,s,n,r=this,l=!1,d=r.$slider.width(),a=window.innerWidth||i(window).width();if("window"===r.respondTo?n=a:"slider"===r.respondTo?n=d:"min"===r.respondTo&&(n=Math.min(a,d)),r.options.responsive&&r.options.responsive.length&&null!==r.options.responsive){s=null;for(o in r.breakpoints)r.breakpoints.hasOwnProperty(o)&&(!1===r.originalSettings.mobileFirst?n<r.breakpoints[o]&&(s=r.breakpoints[o]):n>r.breakpoints[o]&&(s=r.breakpoints[o]));null!==s?null!==r.activeBreakpoint?(s!==r.activeBreakpoint||t)&&(r.activeBreakpoint=s,"unslick"===r.breakpointSettings[s]?r.unslick(s):(r.options=i.extend({},r.originalSettings,r.breakpointSettings[s]),!0===e&&(r.currentSlide=r.options.initialSlide),r.refresh(e)),l=s):(r.activeBreakpoint=s,"unslick"===r.breakpointSettings[s]?r.unslick(s):(r.options=i.extend({},r.originalSettings,r.breakpointSettings[s]),!0===e&&(r.currentSlide=r.options.initialSlide),r.refresh(e)),l=s):null!==r.activeBreakpoint&&(r.activeBreakpoint=null,r.options=r.originalSettings,!0===e&&(r.currentSlide=r.options.initialSlide),r.refresh(e),l=s),e||!1===l||r.$slider.trigger("breakpoint",[r,l])}},e.prototype.changeSlide=function(e,t){var o,s,n,r=this,l=i(e.currentTarget);switch(l.is("a")&&e.preventDefault(),l.is("li")||(l=l.closest("li")),n=r.slideCount%r.options.slidesToScroll!=0,o=n?0:(r.slideCount-r.currentSlide)%r.options.slidesToScroll,e.data.message){case"previous":s=0===o?r.options.slidesToScroll:r.options.slidesToShow-o,r.slideCount>r.options.slidesToShow&&r.slideHandler(r.currentSlide-s,!1,t);break;case"next":s=0===o?r.options.slidesToScroll:o,r.slideCount>r.options.slidesToShow&&r.slideHandler(r.currentSlide+s,!1,t);break;case"index":var d=0===e.data.index?0:e.data.index||l.index()*r.options.slidesToScroll;r.slideHandler(r.checkNavigable(d),!1,t),l.children().trigger("focus");break;default:return}},e.prototype.checkNavigable=function(i){var e,t;if(e=this.getNavigableIndexes(),t=0,i>e[e.length-1])i=e[e.length-1];else for(var o in e){if(i<e[o]){i=t;break}t=e[o]}return i},e.prototype.cleanUpEvents=function(){var e=this;e.options.dots&&null!==e.$dots&&(i("li",e.$dots).off("click.slick",e.changeSlide).off("mouseenter.slick",i.proxy(e.interrupt,e,!0)).off("mouseleave.slick",i.proxy(e.interrupt,e,!1)),!0===e.options.accessibility&&e.$dots.off("keydown.slick",e.keyHandler)),e.$slider.off("focus.slick blur.slick"),!0===e.options.arrows&&e.slideCount>e.options.slidesToShow&&(e.$prevArrow&&e.$prevArrow.off("click.slick",e.changeSlide),e.$nextArrow&&e.$nextArrow.off("click.slick",e.changeSlide),!0===e.options.accessibility&&(e.$prevArrow&&e.$prevArrow.off("keydown.slick",e.keyHandler),e.$nextArrow&&e.$nextArrow.off("keydown.slick",e.keyHandler))),e.$list.off("touchstart.slick mousedown.slick",e.swipeHandler),e.$list.off("touchmove.slick mousemove.slick",e.swipeHandler),e.$list.off("touchend.slick mouseup.slick",e.swipeHandler),e.$list.off("touchcancel.slick mouseleave.
19857slick",e.swipeHandler),e.$list.off("click.slick",e.clickHandler),i(document).off(e.visibilityChange,e.visibility),e.cleanUpSlideEvents(),!0===e.options.accessibility&&e.$list.off("keydown.slick",e.keyHandler),!0===e.options.focusOnSelect&&i(e.$slideTrack).children().off("click.slick",e.selectHandler),i(window).off("orientationchange.slick.slick-"+e.instanceUid,e.orientationChange),i(window).off("resize.slick.slick-"+e.instanceUid,e.resize),i("[draggable!=true]",e.$slideTrack).off("dragstart",e.preventDefault),i(window).off("load.slick.slick-"+e.instanceUid,e.setPosition)},e.prototype.cleanUpSlideEvents=function(){var e=this;e.$list.off("mouseenter.slick",i.proxy(e.interrupt,e,!0)),e.$list.off("mouseleave.slick",i.proxy(e.interrupt,e,!1))},e.prototype.cleanUpRows=function(){var i,e=this;e.options.rows>1&&((i=e.$slides.children().children()).removeAttr("style"),e.$slider.empty().append(i))},e.prototype.clickHandler=function(i){!1===this.shouldClick&&(i.stopImmediatePropagation(),i.stopPropagation(),i.preventDefault())},e.prototype.destroy=function(e){var t=this;t.autoPlayClear(),t.touchObject={},t.cleanUpEvents(),i(".slick-cloned",t.$slider).detach(),t.$dots&&t.$dots.remove(),t.$prevArrow&&t.$prevArrow.length&&(t.$prevArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display",""),t.htmlExpr.test(t.options.prevArrow)&&t.$prevArrow.remove()),t.$nextArrow&&t.$nextArrow.length&&(t.$nextArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display",""),t.htmlExpr.test(t.options.nextArrow)&&t.$nextArrow.remove()),t.$slides&&(t.$slides.removeClass("slick-slide slick-active slick-center slick-visible slick-current").removeAttr("aria-hidden").removeAttr("data-slick-index").each(function(){i(this).attr("style",i(this).data("originalStyling"))}),t.$slideTrack.children(this.options.slide).detach(),t.$slideTrack.detach(),t.$list.detach(),t.$slider.append(t.$slides)),t.cleanUpRows(),t.$slider.removeClass("slick-slider"),t.$slider.removeClass("slick-initialized"),t.$slider.removeClass("slick-dotted"),t.unslicked=!0,e||t.$slider.trigger("destroy",[t])},e.prototype.disableTransition=function(i){var e=this,t={};t[e.transitionType]="",!1===e.options.fade?e.$slideTrack.css(t):e.$slides.eq(i).css(t)},e.prototype.fadeSlide=function(i,e){var t=this;!1===t.cssTransitions?(t.$slides.eq(i).css({zIndex:t.options.zIndex}),t.$slides.eq(i).animate({opacity:1},t.options.speed,t.options.easing,e)):(t.applyTransition(i),t.$slides.eq(i).css({opacity:1,zIndex:t.options.zIndex}),e&&setTimeout(function(){t.disableTransition(i),e.call()},t.options.speed))},e.prototype.fadeSlideOut=function(i){var e=this;!1===e.cssTransitions?e.$slides.eq(i).animate({opacity:0,zIndex:e.options.zIndex-2},e.options.speed,e.options.easing):(e.applyTransition(i),e.$slides.eq(i).css({opacity:0,zIndex:e.options.zIndex-2}))},e.prototype.filterSlides=e.prototype.slickFilter=function(i){var e=this;null!==i&&(e.$slidesCache=e.$slides,e.unload(),e.$slideTrack.children(this.options.slide).detach(),e.$slidesCache.filter(i).appendTo(e.$slideTrack),e.reinit())},e.prototype.focusHandler=function(){var e=this;e.$slider.off("focus.slick blur.slick").on("focus.slick blur.slick","*",function(t){t.stopImmediatePropagation();var o=i(this);setTimeout(function(){e.options.pauseOnFocus&&(e.focussed=o.is(":focus"),e.autoPlay())},0)})},e.prototype.getCurrent=e.prototype.slickCurrentSlide=function(){return this.currentSlide},e.prototype.getDotCount=function(){var i=this,e=0,t=0,o=0;if(!0===i.options.infinite)if(i.slideCount<=i.options.slidesToShow)++o;else for(;e<i.slideCount;)++o,e=t+i.options.slidesToScroll,t+=i.options.slidesToScroll<=i.options.slidesToShow?i.options.slidesToScroll:i.options.slidesToShow;else if(!0===i.options.centerMode)o=i.slideCount;else if(i.options.asNavFor)for(;e<i.slideCount;)++o,e=t+i.options.slidesToScroll,t+=i.options.slidesToScroll<=i.options.slidesToShow?i.options.slidesToScroll:i.options.slidesToShow;else o=1+Math.ceil((i.slideCount-i.options.slidesToShow)/i.options.slidesToScroll);return o-1},e.prototype.getLeft=function(i){var e,t,o,s,n=this,r=0;return n.slideOffset=0,t=n.$slides.first().outerHeight(!0),!0===n.options.infinite?(n.slideCount>n.options.slidesToShow&&(n.slideOffset=n.slideWidth*n.options.slidesToShow*-1,s=-1,!0===n.options.vertical&&!0===n.options.centerMode&&(2===n.options.slidesToShow?s=-1.5:1===n.options.slidesToShow&&(s=-2)),r=t*n.options.slidesToShow*s),n.slideCount%n.options.slidesToScroll!=0&&i+n.options.slidesToScroll>n.slideCount&&n.slideCount>n.options.slidesToShow&&(i>n.slideCount?(n.slideOffset=(n.options.slidesToShow-(i-n.slideCount))*n.slideWidth*-1,r=(n.options.slidesToShow-(i-n.slideCount))*t*-1):(n.slideOffset=n.slideCount%n.options.slidesToScroll*n.slideWidth*-1,r=n.slideCount%n.options.slidesToScroll*t*-1))):i+n.options.slidesToShow>n.slideCount&&(n.slideOffset=(i+n.options.slidesToShow-n.slideCount)*n.slideWidth,r=(i+n.options.slidesToShow-n.slideCount)*t),n.slideCount<=n.options.slidesToShow&&(n.slideOffset=0,r=0),!0===n.options.centerMode&&n.slideCount<=n.options.slidesToShow?n.slideOffset=n.slideWidth*Math.floor(n.options.slidesToShow)/2-n.slideWidth*n.slideCount/2:!0===n.options.centerMode&&!0===n.options.infinite?n.slideOffset+=n.slideWidth*Math.floor(n.options.slidesToShow/2)-n.slideWidth:!0===n.options.centerMode&&(n.slideOffset=0,n.slideOffset+=n.slideWidth*Math.floor(n.options.slidesToShow/2)),e=!1===n.options.vertical?i*n.slideWidth*-1+n.slideOffset:i*t*-1+r,!0===n.options.variableWidth&&(o=n.slideCount<=n.options.slidesToShow||!1===n.options.infinite?n.$slideTrack.children(".slick-slide").eq(i):n.$slideTrack.children(".slick-slide").eq(i+n.options.slidesToShow),e=!0===n.options.rtl?o[0]?-1*(n.$slideTrack.width()-o[0].offsetLeft-o.width()):0:o[0]?-1*o[0].offsetLeft:0,!0===n.options.centerMode&&(o=n.slideCount<=n.options.slidesToShow||!1===n.options.infinite?n.$slideTrack.children(".slick-slide").eq(i):n.$slideTrack.children(".slick-slide").eq(i+n.options.slidesToShow+1),e=!0===n.options.rtl?o[0]?-1*(n.$slideTrack.width()-o[0].offsetLeft-o.width()):0:o[0]?-1*o[0].offsetLeft:0,e+=(n.$list.width()-o.outerWidth())/2)),e},e.prototype.getOption=e.prototype.slickGetOption=function(i){return this.options[i]},e.prototype.getNavigableIndexes=function(){var i,e=this,t=0,o=0,s=[];for(!1===e.options.infinite?i=e.slideCount:(t=-1*e.options.slidesToScroll,o=-1*e.options.slidesToScroll,i=2*e.slideCount);t<i;)s.push(t),t=o+e.options.slidesToScroll,o+=e.options.slidesToScroll<=e.options.slidesToShow?e.options.slidesToScroll:e.options.slidesToShow;return s},e.prototype.getSlick=function(){return this},e.prototype.getSlideCount=function(){var e,t,o=this;return t=!0===o.options.centerMode?o.slideWidth*Math.floor(o.options.slidesToShow/2):0,!0===o.options.swipeToSlide?(o.$slideTrack.find(".slick-slide").each(function(s,n){if(n.offsetLeft-t+i(n).outerWidth()/2>-1*o.swipeLeft)return e=n,!1}),Math.abs(i(e).attr("data-slick-index")-o.currentSlide)||1):o.options.slidesToScroll},e.prototype.goTo=e.prototype.slickGoTo=function(i,e){this.changeSlide({data:{message:"index",index:
19857parseInt(i)}},e)},e.prototype.init=function(e){var t=this;i(t.$slider).hasClass("slick-initialized")||(i(t.$slider).addClass("slick-initialized"),t.buildRows(),t.buildOut(),t.setProps(),t.startLoad(),t.loadSlider(),t.initializeEvents(),t.updateArrows(),t.updateDots(),t.checkResponsive(!0),t.focusHandler()),e&&t.$slider.trigger("init",[t]),!0===t.options.accessibility&&t.initADA(),t.options.autoplay&&(t.paused=!1,t.autoPlay())},e.prototype.initADA=function(){var e=this,t=Math.ceil(e.slideCount/e.options.slidesToShow),o=e.getNavigableIndexes().filter(function(i){return i>=0&&i<e.slideCount});e.$slides.add(e.$slideTrack.find(".slick-cloned")).attr({"aria-hidden":"true",tabindex:"-1"}).find("a, input, button, select").attr({tabindex:"-1"}),null!==e.$dots&&(e.$slides.not(e.$slideTrack.find(".slick-cloned")).each(function(t){var s=o.indexOf(t);i(this).attr({role:"tabpanel",id:"slick-slide"+e.instanceUid+t,tabindex:-1}),-1!==s&&i(this).attr({"aria-describedby":"slick-slide-control"+e.instanceUid+s})}),e.$dots.attr("role","tablist").find("li").each(function(s){var n=o[s];i(this).attr({role:"presentation"}),i(this).find("button").first().attr({role:"tab",id:"slick-slide-control"+e.instanceUid+s,"aria-controls":"slick-slide"+e.instanceUid+n,"aria-label":s+1+" of "+t,"aria-selected":null,tabindex:"-1"})}).eq(e.currentSlide).find("button").attr({"aria-selected":"true",tabindex:"0"}).end());for(var s=e.currentSlide,n=s+e.options.slidesToShow;s<n;s++)e.$slides.eq(s).attr("tabindex",0);e.activateADA()},e.prototype.initArrowEvents=function(){var i=this;!0===i.options.arrows&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.off("click.slick").on("click.slick",{message:"previous"},i.changeSlide),i.$nextArrow.off("click.slick").on("click.slick",{message:"next"},i.changeSlide),!0===i.options.accessibility&&(i.$prevArrow.on("keydown.slick",i.keyHandler),i.$nextArrow.on("keydown.slick",i.keyHandler)))},e.prototype.initDotEvents=function(){var e=this;!0===e.options.dots&&(i("li",e.$dots).on("click.slick",{message:"index"},e.changeSlide),!0===e.options.accessibility&&e.$dots.on("keydown.slick",e.keyHandler)),!0===e.options.dots&&!0===e.options.pauseOnDotsHover&&i("li",e.$dots).on("mouseenter.slick",i.proxy(e.interrupt,e,!0)).on("mouseleave.slick",i.proxy(e.interrupt,e,!1))},e.prototype.initSlideEvents=function(){var e=this;e.options.pauseOnHover&&(e.$list.on("mouseenter.slick",i.proxy(e.interrupt,e,!0)),e.$list.on("mouseleave.slick",i.proxy(e.interrupt,e,!1)))},e.prototype.initializeEvents=function(){var e=this;e.initArrowEvents(),e.initDotEvents(),e.initSlideEvents(),e.$list.on("touchstart.slick mousedown.slick",{action:"start"},e.swipeHandler),e.$list.on("touchmove.slick mousemove.slick",{action:"move"},e.swipeHandler),e.$list.on("touchend.slick mouseup.slick",{action:"end"}
19857,e.swipeHandler),e.$list.on("touchcancel.slick mouseleave.slick",{action:"end"},e.swipeHandler),e.$list.on("click.slick",e.clickHandler),i(document).on(e.visibilityChange,i.proxy(e.visibility,e)),!0===e.options.accessibility&&e.$list.on("keydown.slick",e.keyHandler),!0===e.options.focusOnSelect&&i(e.$slideTrack).children().on("click.slick",e.selectHandler),i(window).on("orientationchange.slick.slick-"+e.instanceUid,i.proxy(e.orientationChange,e)),i(window).on("resize.slick.slick-"+e.instanceUid,i.proxy(e.resize,e)),i("[draggable!=true]",e.$slideTrack).on("dragstart",e.preventDefault),i(window).on("load.slick.slick-"+e.instanceUid,e.setPosition),i(e.setPosition)},e.prototype.initUI=function(){var i=this;!0===i.options.arrows&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.show(),i.$nextArrow.show()),!0===i.options.dots&&i.slideCount>i.options.slidesToShow&&i.$dots.show()},e.prototype.keyHandler=function(i){var e=this;i.target.tagName.match("TEXTAREA|INPUT|SELECT")||(37===i.keyCode&&!0===e.options.accessibility?e.changeSlide({data:{message:!0===e.options.rtl?"next":"previous"}}):39===i.keyCode&&!0===e.options.accessibility&&e.changeSlide({data:{message:!0===e.options.rtl?"previous":"next"}}))},e.prototype.lazyLoad=function(){function e(e){i("img[data-lazy]",e).each(function(){var e=i(this),t=i(this).attr("data-lazy"),o=i(this).attr("data-srcset"),s=i(this).attr("data-sizes")||n.$slider.attr("data-sizes"),r=document.createElement("img");r.onload=function(){e.animate({opacity:0}
vendor: 5,619 bytes, line 19857
19857,100,function(){o&&(e.attr("srcset",o),s&&e.attr("sizes",s)),e.attr("src",t).animate({opacity:1},200,function(){e.removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading")}),n.$slider.trigger("lazyLoaded",[n,e,t])})},r.onerror=function(){e.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"),n.$slider.trigger("lazyLoadError",[n,e,t])},r.src=t})}var t,o,s,n=this;if(!0===n.options.centerMode?!0===n.options.infinite?s=(o=n.currentSlide+(n.options.slidesToShow/2+1))+n.options.slidesToShow+2:(o=Math.max(0,n.currentSlide-(n.options.slidesToShow/2+1)),s=n.options.slidesToShow/2+1+2+n.currentSlide):(o=n.options.infinite?n.options.slidesToShow+n.currentSlide:n.currentSlide,s=Math.ceil(o+n.options.slidesToShow),!0===n.options.fade&&(o>0&&o--,s<=n.slideCount&&s++)),t=n.$slider.find(".slick-slide").slice(o,s),"anticipated"===n.options.lazyLoad)for(var r=o-1,l=s,d=n.$slider.find(".slick-slide"),a=0;a<n.options.slidesToScroll;a++)r<0&&(r=n.slideCount-1),t=(t=t.add(d.eq(r))).add(d.eq(l)),r--,l++;e(t),n.slideCount<=n.options.slidesToShow?e(n.$slider.find(".slick-slide")):n.currentSlide>=n.slideCount-n.options.slidesToShow?e(n.$slider.find(".slick-cloned").slice(0,n.options.slidesToShow)):0===n.currentSlide&&e(n.$slider.find(".slick-cloned").slice(-1*n.options.slidesToShow))},e.prototype.loadSlider=function(){var i=this;i.setPosition(),i.$slideTrack.css({opacity:1}),i.$slider.removeClass("slick-loading"),i.initUI(),"progressive"===i.options.lazyLoad&&i.progressiveLazyLoad()},e.prototype.next=e.prototype.slickNext=function(){this.changeSlide({data:{message:"next"}})},e.prototype.orientationChange=function(){var i=this;i.checkResponsive(),i.setPosition()},e.prototype.pause=e.prototype.slickPause=function(){var i=this;i.autoPlayClear(),i.paused=!0},e.prototype.play=e.prototype.slickPlay=function(){var i=this;i.autoPlay(),i.options.autoplay=!0,i.paused=!1,i.focussed=!1,i.interrupted=!1},e.prototype.postSlide=function(e){var t=this;t.unslicked||(t.$slider.trigger("afterChange",[t,e]),t.animating=!1,t.slideCount>t.options.slidesToShow&&t.setPosition(),t.swipeLeft=null,t.options.autoplay&&t.autoPlay(),!0===t.options.accessibility&&(t.initADA(),t.options.focusOnChange&&i(t.$slides.get(t.currentSlide)).attr("tabindex",0).focus()))},e.prototype.prev=e.prototype.slickPrev=function(){this.changeSlide({data:{message:"previous"}})},e.prototype.preventDefault=function(i){i.preventDefault()},e.prototype.progressiveLazyLoad=function(e){e=e||1;var t,o,s,n,r,l=this,d=i("img[data-lazy]",l.$slider);d.length?(t=d.first(),o=t.attr("data-lazy"),s=t.attr("data-srcset"),n=t.attr("data-sizes")||l.$slider.attr("data-sizes"),(r=document.createElement("img")).onload=function(){s&&(t.attr("srcset",s),n&&t.attr("sizes",n)),t.attr("src",o).removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading"),!0===l.options.adaptiveHeight&&l.setPosition(),l.$slider.trigger("lazyLoaded",[l,t,o]),l.progressiveLazyLoad()},r.onerror=function(){e<3?setTimeout(function(){l.progressiveLazyLoad(e+1)},500):(t.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"),l.$slider.trigger("lazyLoadError",[l,t,o]),l.progressiveLazyLoad())},r.src=o):l.$slider.trigger("allImagesLoaded",[l])},e.prototype.refresh=function(e){var t,o,s=this;o=s.slideCount-s.options.slidesToShow,!s.options.infinite&&s.currentSlide>o&&(s.currentSlide=o),s.slideCount<=s.options.slidesToShow&&(s.currentSlide=0),t=s.currentSlide,s.destroy(!0),i.extend(s,s.initials,{currentSlide:t}),s.init(),e||s.changeSlide({data:{message:"index",index:t}},!1)},e.prototype.registerBreakpoints=function(){var e,t,o,s=this,n=s.options.responsive||null;if("array"===i.type(n)&&n.length){s.respondTo=s.options.respondTo||"window";for(e in n)if(o=s.breakpoints.length-1,n.hasOwnProperty(e)){for(t=n[e].breakpoint;o>=0;)s.breakpoints[o]&&s.breakpoints[o]===t&&s.breakpoints.splice(o,1),o--;s.breakpoints.push(t),s.breakpointSettings[t]=n[e].settings}s.breakpoints.sort(function(i,e){return s.options.mobileFirst?i-e:e-i})}},e.prototype.reinit=function(){var e=this;e.$slides=e.$slideTrack.children(e.options.slide).addClass("slick-slide"),e.slideCount=e.$slides.length,e.currentSlide>=e.slideCount&&0!==e.currentSlide&&(e.currentSlide=e.currentSlide-e.options.slidesToScroll),e.slideCount<=e.options.slidesToShow&&(e.currentSlide=0),e.registerBreakpoints(),e.setProps(),e.setupInfinite(),e.buildArrows(),e.updateArrows(),e.initArrowEvents(),e.buildDots(),e.updateDots(),e.initDotEvents(),e.cleanUpSlideEvents(),e.initSlideEvents(),e.checkResponsive(!1,!0),!0===e.options.focusOnSelect&&i(e.$slideTrack).children().on("click.slick",e.selectHandler),e.setSlideClasses("number"==typeof e.currentSlide?e.currentSlide:0),e.setPosition(),e.focusHandler(),e.paused=!e.options.autoplay,e.autoPlay(),e.$slider.trigger("reInit",[e])},e.prototype.resize=function(){var e=this;i(window).width()!==e.windowWidth&&(clearTimeout(e.windowDelay),e.windowDelay=window.setTimeout(function(){e.windowWidth=i(window).width(),e.checkResponsive(),e.unslicked||e.setPosition()},50))},e.prototype.removeSlide=e.prototype.slickRemove=function(i,e,t){var o=this;if(i="boolean"==typeof i?!0===(e=i)?0:o.slideCount-1:!0===e?--i:i,o.slideCount<1||i<0||i>o.slideCount-1)return!1;o.unload(),!0===t?o.$slideTrack.children().remove():o.$slideTrack.children(this.options.slide).eq(i).remove(),o.$slides=o.$slideTrack.children(this.options.slide),o.$slideTrack.children(this.options.slide).detach(),o.$slideTrack.append(o.$slides),o.$slidesCache=o.$slides,o.reinit()},e.prototype.setCSS=function(i){var e,t,o=this,s={};
19857!0===o.options.rtl&&(i=-i),e="left"==o.positionProp?Math.ceil(i)+"px":"0px",t="top"==o.positionProp?Math.ceil(i)+"px":"0px",s[o.positionProp]=i,!1===o.transformsEnabled?o.$slideTrack.css(s):(s={},!1===o.cssTransitions?(s[o.animType]="translate("+e+", "+t+")",o.$slideTrack.css(s)):(s[o.animType]="translate3d("+e+", "+t+", 0px)",o.$slideTrack.css(s)))},e.prototype.setDimensions=function(){var i=this;!1===i.options.vertical?!0===i.options.centerMode&&i.$list.css({padding:"0px "+i.options.centerPadding}):(i.$list.height(i.$slides.first().outerHeight(!0)*i.options.slidesToShow),!0===i.options.centerMode&&i.$list.css({padding:i.options.centerPadding+" 0px"})),i.listWidth=i.$list.width(),i.listHeight=i.$list.height(),!1===i.options.vertical&&!1===i.options.variableWidth?(i.slideWidth=Math.ceil(i.listWidth/i.options.slidesToShow),i.$slideTrack.width(Math.ceil(i.slideWidth*i.$slideTrack.children(".slick-slide").length))):!0===i.options.variableWidth?i.$slideTrack.width(5e3*i.slideCount):(i.slideWidth=Math.ceil(i.listWidth),i.$slideTrack.height(Math.ceil(i.$slides.first().outerHeight(!0)*i.$slideTrack.children(".slick-slide").length)));var e=i.$slides.first().outerWidth(!0)-i.$slides.first().width();!1===i.options.variableWidth&&i.$slideTrack.children(".slick-slide").width(i.slideWidth-e)},e.prototype.setFade=function(){var e,t=this;t.$slides.each(function(o,s){e=t.slideWidth*o*-1,!0===t.options.rtl?i(s).css({position:"relative",right:e,top:0,zIndex:t.options.zIndex-2,opacity:0}
19857):i(s).css({position:"relative",left:e,top:0,zIndex:t.options.zIndex-2,opacity:0})}),t.$slides.eq(t.currentSlide).css({zIndex:t.options.zIndex-1,opacity:1})},e.prototype.setHeight=function(){var i=this;if(1===i.options.slidesToShow&&!0===i.options.adaptiveHeight&&!1===i.options.vertical){var e=i.$slides.eq(i.currentSlide).outerHeight(!0);i.$list.css("height",e)}},e.prototype.setOption=e.prototype.slickSetOption=function(){var e,t,o,s,n,r=this,l=!1;if("object"===i.type(arguments[0])?(o=arguments[0],l=arguments[1],n="multiple"):"string"===i.type(arguments[0])&&(o=arguments[0],s=arguments[1],l=arguments[2],"responsive"===arguments[0]&&"array"===i.type(arguments[1])?n="responsive":void 0!==arguments[1]&&(n="single")),"single"===n)r.options[o]=s;else if("multiple"===n)i.each(o,function(i,e){r.options[i]=e});else if("responsive"===n)for(t in s)if("array"!==i.type(r.options.responsive))r.options.responsive=[s[t]];else{for(e=r.options.responsive.length-1;e>=0;)r.options.responsive[e].breakpoint===s[t].breakpoint&&r.options.responsive.splice(e,1),e--;r.options.responsive.push(s[t])}l&&(r.unload(),r.reinit())},e.prototype.setPosition=function(){var i=this;i.setDimensions(),i.setHeight(),!1===i.options.fade?i.setCSS(i.getLeft(i.currentSlide)):i.setFade(),i.$slider.trigger("setPosition",[i])},e.prototype.setProps=function(){var i=this,e=document.body.style;i.positionProp=!0===i.options.vertical?"top":"left","top"===i.positionProp?i.$slider.addClass("slick-vertical"):i.$slider.removeClass("slick-vertical"),void 0===e.WebkitTransition&&void 0===e.MozTransition&&void 0===e.msTransition||!0===i.options.useCSS&&(i.cssTransitions=!0),i.options.fade&&("number"==typeof i.options.zIndex?i.options.zIndex<3&&(i.options.zIndex=3):i.options.zIndex=i.defaults.zIndex),void 0!==e.OTransform&&(i.animType="OTransform",i.transformType="-o-transform",i.transitionType="OTransition",void 0===e.perspectiveProperty&&void 0===e.webkitPerspective&&(i.animType=!1)),void 0!==e.MozTransform&&(i.animType="MozTransform",i.transformType="-moz-transform",i.transitionType="MozTransition",void 0===e.perspectiveProperty&&void 0===e.MozPerspective&&(i.animType=!1)),void 0!==e.webkitTransform&&(i.animType="webkitTransform",i.transformType="-webkit-transform",i.transitionType="webkitTransition",void 0===e.perspectiveProperty&&void 0===e.webkitPerspective&&(i.animType=!1)),void 0!==e.msTransform&&(i.animType="msTransform",i.transformType="-ms-transform",i.transitionType="msTransition",void 0===e.msTransform&&(i.animType=!1)),void 0!==e.transform&&!1!==i.animType&&(i.animType="transform",i.transformType="transform",i.transitionType="transition"),i.transformsEnabled=i.options.useTransform&&null!==i.animType&&!1!==i.animType},e.prototype.setSlideClasses=function(i){var e,t,o,s,n=this;if(t=n.$slider.find(".slick-slide").removeClass("slick-active slick-center slick-current").attr("aria-hidden","true"),n.$slides.eq(i).addClass("slick-current"),!0===n.options.centerMode){var r=n.options.slidesToShow%2==0?1:0;e=Math.floor(n.options.slidesToShow/2),!0===n.options.infinite&&(i>=e&&i<=n.slideCount-1-e?n.$slides.slice(i-e+r,i+e+1).addClass("slick-active").attr("aria-hidden","false"):(o=n.options.slidesToShow+i,t.slice(o-e+1+r,o+e+2).addClass("slick-active").attr("aria-hidden","false")),0===i?t.eq(t.length-1-n.options.slidesToShow).addClass("slick-center"):i===n.slideCount-1&&t.eq(n.options.slidesToShow).addClass("slick-center")),n.$slides.eq(i).addClass("slick-center")}else i>=0&&i<=n.slideCount-n.options.slidesToShow?n.$slides.slice(i,i+n.options.slidesToShow).addClass("slick-active").attr("aria-hidden","false"):t.length<=n.options.slidesToShow?t.addClass("slick-active").attr("aria-hidden","false"):(s=n.slideCount%n.options.slidesToShow,o=!0===n.options.infinite?n.options.slidesToShow+i:i,n.options.slidesToShow==n.options.slidesToScroll&&n.slideCount-i<n.options.slidesToShow?t.slice(o-(n.options.slidesToShow-s),o+s).addClass("slick-active").attr("aria-hidden","false"):t.slice(o,o+n.options.slidesToShow).addClass("slick-active").attr("aria-hidden","false"));"ondemand"!==n.options.lazyLoad&&"anticipated"!==n.options.lazyLoad||n.lazyLoad()},e.prototype.setupInfinite=function(){var e,t,o,s=this;if(!0===s.options.fade&&(s.options.centerMode=!1),!0===s.options.infinite&&!1===s.options.fade&&(t=null,s.slideCount>s.options.slidesToShow)){for(o=!0===s.options.centerMode?s.options.slidesToShow+1:s.options.slidesToShow,e=s.slideCount;e>s.slideCount-o;e-=1)t=e-1,i(s.$slides[t]).clone(!0).attr("id","").attr("data-slick-index",t-s.slideCount).prependTo(s.$slideTrack).addClass("slick-cloned");for(e=0;e<o+s.slideCount;e+=1)t=e,i(s.$slides[t]).clone(!0).attr("id","").attr("data-slick-index",t+s.slideCount).appendTo(s.$slideTrack).addClass("slick-cloned");s.$slideTrack.find(".slick-cloned").find("[id]").each(function(){i(this).attr("id","")})}},e.prototype.interrupt=function(i){var e=this;i||e.autoPlay(),e.interrupted=i},e.prototype.selectHandler=function(e){var t=this,o=i(e.target).is(".slick-slide")?i(e.target):i(e.target).parents(".slick-slide"),s=parseInt(o.attr("data-slick-index"));s||(s=0),t.slideCount<=t.options.slidesToShow?t.slideHandler(s,!1,!0):t.slideHandler(s)},e.prototype.slideHandler=function(i,e,t){var o,s,n,r,l,d=null,a=this;if(e=e||!1,!(!0===a.animating&&!0===a.options.waitForAnimate||!0===a.options.fade&&a.currentSlide===i))if(!1===e&&a.asNavFor(i),o=i,d=a.getLeft(o),r=a.getLeft(a.currentSlide),a.currentLeft=null===a.swipeLeft?r:a.swipeLeft,!1===a.options.infinite&&!1===a.options.centerMode&&(i<0||i>a.getDotCount()*a.options.slidesToScroll))!1===a.options.fade&&(o=a.currentSlide,!0!==t?a.animateSlide(r,function(){a.postSlide(o)}):a.postSlide(o));else if(!1===a.options.infinite&&!0===a.options.centerMode&&(i<0||i>a.slideCount-a.options.slidesToScroll))!1===a.options.fade&&(o=a.currentSlide,!0!==t?a.animateSlide(r,function(){a.postSlide(o)}):a.postSlide(o));else{if(a.options.autoplay&&clearInterval(a.autoPlayTimer),s=o<0?a.slideCount%a.options.slidesToScroll!=0?a.slideCount-a.slideCount%a.options.slidesToScroll:a.slideCount+
19857o:o>=a.slideCount?a.slideCount%a.options.slidesToScroll!=0?0:o-a.slideCount:o,a.animating=!0,a.$slider.trigger("beforeChange",[a,a.currentSlide,s]),n=a.currentSlide,a.currentSlide=s,a.setSlideClasses(a.currentSlide),a.options.asNavFor&&(l=(l=a.getNavTarget()).slick("getSlick")).slideCount<=l.options.slidesToShow&&l.setSlideClasses(a.currentSlide),a.updateDots(),a.updateArrows(),!0===a.options.fade)return!0!==t?(a.fadeSlideOut(n),a.fadeSlide(s,function(){a.postSlide(s)})):a.postSlide(s),void a.animateHeight();!0!==t?a.animateSlide(d,function(){a.postSlide(s)}):a.postSlide(s)}},e.prototype.startLoad=function(){var i=this;!0===i.options.arrows&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.hide(),i.$nextArrow.hide()),!0===i.options.dots&&i.slideCount>i.options.slidesToShow&&i.$dots.hide(),i.$slider.addClass("slick-loading")},e.prototype.swipeDirection=function(){var i,e,t,o,s=this;return i=s.touchObject.startX-s.touchObject.curX,e=s.touchObject.startY-s.touchObject.curY,t=Math.atan2(e,i),(o=Math.round(180*t/Math.PI))<0&&(o=360-Math.abs(o)),o<=45&&o>=0?!1===s.options.rtl?"left":"right":o<=360&&o>=315?!1===s.options.rtl?"left":"right":o>=135&&o<=225?!1===s.options.rtl?"right":"left":!0===s.options.verticalSwiping?o>=35&&o<=135?"down":"up":"vertical"},e.prototype.swipeEnd=function(i){var e,t,o=this;if(o.dragging=!1,o.swiping=!1,o.scrolling)return o.scrolling=!1,!1;if(o.interrupted=!1,o.shouldClick=!(o.touchObject.swipeLength>10),void 0===o.touchObject.curX)return!1;if(!0===o.touchObject.edgeHit&&o.$slider.trigger("edge",[o,o.swipeDirection()]),o.touchObject.swipeLength>=o.touchObject.minSwipe){switch(t=o.swipeDirection()){case"left":case"down":e=o.options.swipeToSlide?o.checkNavigable(o.currentSlide+o.getSlideCount()):o.currentSlide+o.getSlideCount(),o.currentDirection=0;break;case"right":case"up":e=o.options.swipeToSlide?o.checkNavigable(o.currentSlide-o.getSlideCount()):o.currentSlide-o.getSlideCount(),o.currentDirection=1}"vertical"!=t&&(o.slideHandler(e),o.touchObject={},o.$slider.trigger("swipe",[o,t]))}else o.touchObject.startX!==o.touchObject.curX&&(o.slideHandler(o.currentSlide),o.touchObject={})},e.prototype.swipeHandler=function(i){var e=this;if(!(!1===e.options.swipe||"ontouchend"in document&&!1===e.options.swipe||!1===e.options.draggable&&-1!==i.type.indexOf("mouse")))switch(e.touchObject.fingerCount=i.originalEvent&&void 0!==i.originalEvent.touches?i.originalEvent.touches.length:1,e.touchObject.minSwipe=e.listWidth/e.options.touchThreshold,!0===e.options.verticalSwiping&&(e.touchObject.minSwipe=e.listHeight/e.options.touchThreshold),i.data.action){case"start":e.swipeStart(i);break;case"move":e.swipeMove(i);break;case"end":e.swipeEnd(i)}},e.prototype.swipeMove=function(i){var e,t,o,s,n,r,l=this;return n=void 0!==i.originalEvent?i.originalEvent.touches:null,!(!l.dragging||l.scrolling||n&&1!==n.length)&&(e=l.getLeft(l.currentSlide),l.touchObject.curX=void 0!==n?n[0].pageX:i.clientX,l.touchObject.curY=void 0!==n?n[0].pageY:i.clientY,l.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(l.touchObject.curX-l.touchObject.startX,2))),r=Math.round(Math.sqrt(Math.pow(l.touchObject.curY-l.touchObject.startY,2))),!l.options.verticalSwiping&&!l.swiping&&r>4?(l.scrolling=!0,!1):(!0===l.options.verticalSwiping&&(l.touchObject.swipeLength=r),t=l.swipeDirection(),void 0!==i.originalEvent&&l.touchObject.swipeLength>4&&(l.swiping=!0,i.preventDefault()),s=(!1===l.options.rtl?1:-1)*(l.touchObject.curX>l.touchObject.startX?1:-1),!0===l.options.verticalSwiping&&(s=l.touchObject.curY>l.touchObject.startY?1:-1),o=l.touchObject.swipeLength,l.touchObject.edgeHit=!1,!1===l.options.infinite&&(0===l.currentSlide&&"right"===t||l.currentSlide>=l.getDotCount()&&"left"===t)&&(o=l.touchObject.swipeLength*l.options.edgeFriction,l.touchObject.edgeHit=!0),!1===l.options.vertical?l.swipeLeft=e+o*s:l.swipeLeft=e+o*(l.$list.height()/l.listWidth)*s,!0===l.options.verticalSwiping&&(l.swipeLeft=e+o*s),!0!==l.options.fade&&!1!==l.options.touchMove&&(!0===l.animating?(l.swipeLeft=null,!1):void l.setCSS(l.swipeLeft))))},e.prototype.swipeStart=function(i){var e,t=this;if(t.interrupted=!0,1!==t.touchObject.fingerCount||t.slideCount<=t.options.slidesToShow)return t.touchObject={},!1;void 0!==i.originalEvent&&void 0!==i.originalEvent.touches&&(e=i.originalEvent.touches[0]),t.touchObject.startX=t.touchObject.curX=void 0!==e?e.pageX:i.clientX,t.touchObject.startY=t.touchObject.curY=void 0!==e?e.pageY:i.clientY,t.dragging=!0},e.prototype.unfilterSlides=e.prototype.slickUnfilter=function(){var i=this;null!==i.$slidesCache&&(i.unload(),i.$slideTrack.children(this.options.slide).detach(),i.$slidesCache.appendTo(i.$slideTrack),i.reinit())},e.prototype.unload=function(){var e=this;i(".slick-cloned",e.$slider).remove(),e.$dots&&e.$dots.remove(),e.$prevArrow&&e.htmlExpr.test(e.options.prevArrow)&&e.$prevArrow.remove(),e.$nextArrow&&e.htmlExpr.test(e.options.nextArrow)&&e.$nextArrow.remove(),e.$slides.removeClass("slick-slide slick-active slick-visible slick-current").attr("aria-hidden","true").css("width","")}
19857,e.prototype.unslick=function(i){var e=this;e.$slider.trigger("unslick",[e,i]),e.destroy()},e.prototype.updateArrows=function(){var i=this;Math.floor(i.options.slidesToShow/2),!0===i.options.arrows&&i.slideCount>i.options.slidesToShow&&!i.options.infinite&&(i.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false"),i.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false"),0===i.currentSlide?(i.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true"),i.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false")):i.currentSlide>=i.slideCount-i.options.slidesToShow&&!1===i.options.centerMode?(i.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true"),i.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")):i.currentSlide>=i.slideCount-1&&!0===i.options.centerMode&&(i.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true"),i.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")))},e.prototype.updateDots=function(){var i=this;null!==i.$dots&&(i.$dots.find("li").removeClass("slick-active").end(),i.$dots.find("li").eq(Math.floor(i.currentSlide/i.options.slidesToScroll)).addClass("slick-active"))},e.prototype.visibility=function(){var i=this;i.options.autoplay&&(document[i.hidden]?i.interrupted=!0:i.interrupted=!1)},i.fn.slick=function(){var i,t,o=this,s=arguments[0],n=Array.prototype.slice.call(arguments,1),r=o.length;for(i=0;i<r;i++)if("object"==typeof s||void 0===s?o[i].slick=new e(o[i],s):t=o[i].slick[s].apply(o[i].slick,n),void 0!==t)return t;return o}}); 19858 19859 19860 19861 19862//= owl.carousel2-2.2.1 19863 19864 19865 19866 19867 19868 19869 19870 19871 19872 19873 19874 19875 19876 19877 19878 19879 19880 19881 19882 19883 19884;
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.