vendor: 57,091 bytes, lines 1-1926
1/*! 2 * jQuery JavaScript Library v1.11.0 3 * http://jquery.com/ 4 * 5 * Includes Sizzle.js 6 * http://sizzlejs.com/ 7 * 8 * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors 9 * Released under the MIT license 10 * http://jquery.org/license 11 * 12 * Date: 2014-01-23T21:02Z 13 */ 14 15(function(global, factory) { 16 17 if (typeof module === "object" && typeof module.exports === "object") { 18 // For CommonJS and CommonJS-like environments where a proper window is present, 19 // execute the factory and get jQuery 20 // For environments that do not inherently posses a window with a document 21 // (such as Node.js), expose a jQuery-making factory as module.exports 22 // This accentuates the need for the creation of a real window 23 // e.g. var jQuery = require("jquery")(window); 24 // See ticket #14549 for more info 25 module.exports = global.document ? 26 factory(global, true) : 27 function(w) { 28 if (!w.document) { 29 throw new Error("jQuery requires a window with a document"); 30 } 31 return factory(w); 32 }; 33 } else { 34 factory(global); 35 } 36 37 // Pass this if window is not defined yet 38}(typeof window !== "undefined" ? window : this, function(window, noGlobal) { 39 40 // Can't do this because several apps including ASP.NET trace 41 // the stack via arguments.caller.callee and Firefox dies if 42 // you try to trace through "use strict" call chains. (#13335) 43 // Support: Firefox 18+ 44 // 45 46 var deletedIds = []; 47 48 var slice = deletedIds.slice; 49 50 var concat = deletedIds.concat; 51 52 var push = deletedIds.push; 53 54 var indexOf = deletedIds.indexOf; 55 56 var class2type = {}; 57 58 var toString = class2type.toString; 59 60 var hasOwn = class2type.hasOwnProperty; 61 62 var trim = "".trim; 63 64 var support = {}; 65 66 67 68 var 69 version = "1.11.0", 70 71 // Define a local copy of jQuery 72 jQuery = function(selector, context) { 73 // The jQuery object is actually just the init constructor 'enhanced' 74 // Need init if jQuery is called (just allow error to be thrown if not included) 75 return new jQuery.fn.init(selector, context); 76 }, 77 78 // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) 79 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, 80 81 // Matches dashed string for camelizing 82 rmsPrefix = /^-ms-/, 83 rdashAlpha = /-([\da-z])/gi, 84 85 // Used by jQuery.camelCase as callback to replace() 86 fcamelCase = function(all, letter) { 87 return letter.toUpperCase(); 88 }; 89 90 jQuery.fn = jQuery.prototype = { 91 // The current version of jQuery being used 92 jquery: version, 93 94 constructor: jQuery, 95 96 // Start with an empty selector 97 selector: "", 98 99 // The default length of a jQuery object is 0 100 length: 0, 101 102 toArray: function() { 103 return slice.call(this); 104 }, 105 106 // Get the Nth element in the matched element set OR 107 // Get the whole matched element set as a clean array 108 get: function(num) { 109 return num != null ? 110 111 // Return a 'clean' array 112 (num < 0 ? this[num + this.length] : this[num]) : 113 114 // Return just the object 115 slice.call(this); 116 }, 117 118 // Take an array of elements and push it onto the stack 119 // (returning the new matched element set) 120 pushStack: function(elems) { 121 122 // Build a new jQuery matched element set 123 var ret = jQuery.merge(this.constructor(), elems); 124 125 // Add the old object onto the stack (as a reference) 126 ret.prevObject = this; 127 ret.context = this.context; 128 129 // Return the newly-formed element set 130 return ret; 131 }, 132 133 // Execute a callback for every element in the matched set. 134 // (You can seed the arguments with an array of args, but this is 135 // only used internally.) 136 each: function(callback, args) { 137 return jQuery.each(this, callback, args); 138 }, 139 140 map: function(callback) { 141 return this.pushStack(jQuery.map(this, function(elem, i) { 142 return callback.call(elem, i, elem); 143 })); 144 }, 145 146 slice: function() { 147 return this.pushStack(slice.apply(this, arguments)); 148 }, 149 150 first: function() { 151 return this.eq(0); 152 }, 153 154 last: function() { 155 return this.eq(-1); 156 }, 157 158 eq: function(i) { 159 var len = this.length, 160 j = +i + (i < 0 ? len : 0); 161 return this.pushStack(j >= 0 && j < len ? [this[j]] : []); 162 }, 163 164 end: function() { 165 return this.prevObject || this.constructor(null); 166 }, 167 168 // For internal use only. 169 // Behaves like an Array's method, not like a jQuery method. 170 push: push, 171 sort: deletedIds.sort, 172 splice: deletedIds.splice 173 }; 174 175 jQuery.extend = jQuery.fn.extend = function() { 176 var src, copyIsArray, copy, name, options, clone, 177 target = arguments[0] || {}, 178 i = 1, 179 length = arguments.length, 180 deep = false; 181 182 // Handle a deep copy situation 183 if (typeof target === "boolean") { 184 deep = target; 185 186 // skip the boolean and the target 187 target = arguments[i] || {}; 188 i++; 189 } 190 191 // Handle case when target is a string or something (possible in deep copy) 192 if (typeof target !== "object" && !jQuery.isFunction(target)) { 193 target = {}; 194 } 195 196 // extend jQuery itself if only one argument is passed 197 if (i === length) { 198 target = this; 199 i--; 200 } 201 202 for (; i < length; i++) { 203 // Only deal with non-null/undefined values 204 if ((options = arguments[i]) != null) { 205 // Extend the base object 206 for (name in options) { 207 src = target[name]; 208 copy = options[name]; 209 210 // Prevent never-ending loop 211 if (target === copy) { 212 continue; 213 } 214 215 // Recurse if we're merging plain objects or arrays 216 if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) { 217 if (copyIsArray) { 218 copyIsArray = false; 219 clone = src && jQuery.isArray(src) ? src : []; 220 221 } else { 222 clone = src && jQuery.isPlainObject(src) ? src : {}; 223 } 224 225 // Never move original objects, clone them 226 target[name] = jQuery.extend(deep, clone, copy); 227 228 // Don't bring in undefined values 229 } else if (copy !== undefined) { 230 target[name] = copy; 231 } 232 } 233 } 234 } 235 236 // Return the modified object 237 return target; 238 }; 239 240 jQuery.extend({ 241 // Unique for each copy of jQuery on the page 242 expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""), 243 244 // Assume jQuery is ready without the ready module 245 isReady: true, 246 247 error: function(msg) { 248 throw new Error(msg); 249 }, 250 251 noop: function() {}, 252 253 // See test/unit/core.js for details concerning isFunction. 254 // Since version 1.3, DOM methods and functions like alert 255 // aren't supported. They return false on IE (#2968). 256 isFunction: function(obj) { 257 return jQuery.type(obj) === "function"; 258 }, 259 260 isArray: Array.isArray || function(obj) { 261 return jQuery.type(obj) === "array"; 262 }, 263 264 isWindow: function(obj) { 265 /* jshint eqeqeq: false */ 266 return obj != null && obj == obj.window; 267 }, 268 269 isNumeric: function(obj) { 270 // parseFloat NaNs numeric-cast false positives (null|true|false|"") 271 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 272 // subtraction forces infinities to NaN 273 return obj - parseFloat(obj) >= 0; 274 }, 275 276 isEmptyObject: function(obj) { 277 var name; 278 for (name in obj) { 279 return false; 280 } 281 return true; 282 }, 283 284 isPlainObject: function(obj) { 285 var key; 286 287 // Must be an Object. 288 // Because of IE, we also have to check the presence of the constructor property. 289 // Make sure that DOM nodes and window objects don't pass through, as well 290 if (!obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) { 291 return false; 292 } 293 294 try { 295 // Not own constructor property must be Object 296 if (obj.constructor && !hasOwn.call(obj, "constructor") && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) { 297 return false; 298 } 299 } catch (e) { 300 // IE8,9 Will throw exceptions on certain host objects #9897 301 return false; 302 } 303 304 // Support: IE<9 305 // Handle iteration over inherited properties before own properties. 306 if (support.ownLast) { 307 for (key in obj) { 308 return hasOwn.call(obj, key); 309 } 310 } 311 312 // Own properties are enumerated firstly, so to speed up, 313 // if last one is own, then all properties are own. 314 for (key in obj) {} 315 316 return key === undefined || hasOwn.call(obj, key); 317 }, 318 319 type: function(obj) { 320 if (obj == null) { 321 return obj + ""; 322 } 323 return typeof obj === "object" || typeof obj === "function" ? 324 class2type[toString.call(obj)] || "object" : 325 typeof obj; 326 }, 327 328 // Evaluates a script in a global context 329 // Workarounds based on findings by Jim Driscoll 330 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context 331 globalEval: function(data) { 332 if (data && jQuery.trim(data)) { 333 // We use execScript on Internet Explorer 334 // We use an anonymous function so that context is window 335 // rather than jQuery in Firefox 336 (window.execScript || function(data) { 337 window["eval"].call(window, data); 338 })(data); 339 } 340 }, 341 342 // Convert dashed to camelCase; used by the css and data modules 343 // Microsoft forgot to hump their vendor prefix (#9572) 344 camelCase: function(string) { 345 return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase); 346 }, 347 348 nodeName: function(elem, name) { 349 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 350 }, 351 352 // args is for internal usage only 353 each: function(obj, callback, args) { 354 var value, 355 i = 0, 356 length = obj.length, 357 isArray = isArraylike(obj); 358 359 if (args) { 360 if (isArray) { 361 for (; i < length; i++) { 362 value = callback.apply(obj[i], args); 363 364 if (value === false) { 365 break; 366 } 367 } 368 } else { 369 for (i in obj) { 370 value = callback.apply(obj[i], args); 371 372 if (value === false) { 373 break; 374 } 375 } 376 } 377 378 // A special, fast, case for the most common use of each 379 } else { 380 if (isArray) { 381 for (; i < length; i++) { 382 value = callback.call(obj[i], i, obj[i]); 383 384 if (value === false) { 385 break; 386 } 387 } 388 } else { 389 for (i in obj) { 390 value = callback.call(obj[i], i, obj[i]); 391 392 if (value === false) { 393 break; 394 } 395 } 396 } 397 } 398 399 return obj; 400 }, 401 402 // Use native String.trim function wherever possible 403 trim: trim && !trim.call("\uFEFF\xA0") ? function(text) { 404 return text == null ? 405 "" : 406 trim.call(text); 407 } : 408 409 // Otherwise use our own trimming functionality 410 411 function(text) { 412 return text == null ? 413 "" : 414 (text + "").replace(rtrim, ""); 415 }, 416 417 // results is for internal usage only 418 makeArray: function(arr, results) { 419 var ret = results || []; 420 421 if (arr != null) { 422 if (isArraylike(Object(arr))) { 423 jQuery.merge(ret, 424 typeof arr === "string" ? 425 [arr] : arr 426 ); 427 } else { 428 push.call(ret, arr); 429 } 430 } 431 432 return ret; 433 }, 434 435 inArray: function(elem, arr, i) { 436 var len; 437 438 if (arr) { 439 if (indexOf) { 440 return indexOf.call(arr, elem, i); 441 } 442 443 len = arr.length; 444 i = i ? i < 0 ? Math.max(0, len + i) : i : 0; 445 446 for (; i < len; i++) { 447 // Skip accessing in sparse arrays 448 if (i in arr && arr[i] === elem) { 449 return i; 450 } 451 } 452 } 453 454 return -1; 455 }, 456 457 merge: function(first, second) { 458 var len = +second.length, 459 j = 0, 460 i = first.length; 461 462 while (j < len) { 463 first[i++] = second[j++]; 464 } 465 466 // Support: IE<9 467 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) 468 if (len !== len) { 469 while (second[j] !== undefined) { 470 first[i++] = second[j++]; 471 } 472 } 473 474 first.length = i; 475 476 return first; 477 }, 478 479 grep: function(elems, callback, invert) { 480 var callbackInverse, 481 matches = [], 482 i = 0, 483 length = elems.length, 484 callbackExpect = !invert; 485 486 // Go through the array, only saving the items 487 // that pass the validator function 488 for (; i < length; i++) { 489 callbackInverse = !callback(elems[i], i); 490 if (callbackInverse !== callbackExpect) { 491 matches.push(elems[i]); 492 } 493 } 494 495 return matches; 496 }, 497 498 // arg is for internal usage only 499 map: function(elems, callback, arg) { 500 var value, 501 i = 0, 502 length = elems.length, 503 isArray = isArraylike(elems), 504 ret = []; 505 506 // Go through the array, translating each of the items to their new values 507 if (isArray) { 508 for (; i < length; i++) { 509 value = callback(elems[i], i, arg); 510 511 if (value != null) { 512 ret.push(value); 513 } 514 } 515 516 // Go through every key on the object, 517 } else { 518 for (i in elems) { 519 value = callback(elems[i], i, arg); 520 521 if (value != null) { 522 ret.push(value); 523 } 524 } 525 } 526 527 // Flatten any nested arrays 528 return concat.apply([], ret); 529 }, 530 531 // A global GUID counter for objects 532 guid: 1, 533 534 // Bind a function to a context, optionally partially applying any 535 // arguments. 536 proxy: function(fn, context) { 537 var args, proxy, tmp; 538 539 if (typeof context === "string") { 540 tmp = fn[context]; 541 context = fn; 542 fn = tmp; 543 } 544 545 // Quick check to determine if target is callable, in the spec 546 // this throws a TypeError, but we will just return undefined. 547 if (!jQuery.isFunction(fn)) { 548 return undefined; 549 } 550 551 // Simulated bind 552 args = slice.call(arguments, 2); 553 proxy = function() { 554 return fn.apply(context || this, args.concat(slice.call(arguments))); 555 }; 556 557 // Set the guid of unique handler to the same of original handler, so it can be removed 558 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 559 560 return proxy; 561 }, 562 563 now: function() { 564 return +(new Date()); 565 }, 566 567 // jQuery.support is not used in Core but other projects attach their 568 // properties to it so it needs to exist. 569 support: support 570 }); 571 572 // Populate the class2type map 573 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { 574 class2type["[object " + name + "]"] = name.toLowerCase(); 575 }); 576 577 function isArraylike(obj) { 578 var length = obj.length, 579 type = jQuery.type(obj); 580 581 if (type === "function" || jQuery.isWindow(obj)) { 582 return false; 583 } 584 585 if (obj.nodeType === 1 && length) { 586 return true; 587 } 588 589 return type === "array" || length === 0 || 590 typeof length === "number" && length > 0 && (length - 1) in obj; 591 } 592 var Sizzle = 593 /*! 594 * Sizzle CSS Selector Engine v1.10.16 595 * http://sizzlejs.com/ 596 * 597 * Copyright 2013 jQuery Foundation, Inc. and other contributors 598 * Released under the MIT license 599 * http://jquery.org/license 600 * 601 * Date: 2014-01-13 602 */ 603 (function(window) { 604 605 var i, 606 support, 607 Expr, 608 getText, 609 isXML, 610 compile, 611 outermostContext, 612 sortInput, 613 hasDuplicate, 614 615 // Local document vars 616 setDocument, 617 document, 618 docElem, 619 documentIsHTML, 620 rbuggyQSA, 621 rbuggyMatches, 622 matches, 623 contains, 624 625 // Instance-specific data 626 expando = "sizzle" + -(new Date()), 627 preferredDoc = window.document, 628 dirruns = 0, 629 done = 0, 630 classCache = createCache(), 631 tokenCache = createCache(), 632 compilerCache = createCache(), 633 sortOrder = function(a, b) { 634 if (a === b) { 635 hasDuplicate = true; 636 } 637 return 0; 638 }, 639 640 // General-purpose constants 641 strundefined = typeof undefined, 642 MAX_NEGATIVE = 1 << 31, 643 644 // Instance methods 645 hasOwn = ({}).hasOwnProperty, 646 arr = [], 647 pop = arr.pop, 648 push_native = arr.push, 649 push = arr.push, 650 slice = arr.slice, 651 // Use a stripped-down indexOf if we can't use a native one 652 indexOf = arr.indexOf || function(elem) { 653 var i = 0, 654 len = this.length; 655 for (; i < len; i++) { 656 if (this[i] === elem) { 657 return i; 658 } 659 } 660 return -1; 661 }, 662 663 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", 664 665 // Regular expressions 666 667 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace 668 whitespace = "[\\x20\\t\\r\\n\\f]", 669 // http://www.w3.org/TR/css3-syntax/#characters 670 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", 671 672 // Loosely modeled on CSS identifier characters 673 // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors 674 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier 675 identifier = characterEncoding.replace("w", "w#"), 676 677 // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors 678 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + 679 "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", 680 681 // Prefer arguments quoted, 682 // then not containing pseudos/brackets, 683 // then attribute selectors/non-parenthetical expressions, 684 // then anything else 685 // These preferences are here to reduce the number of selectors 686 // needing tokenize in the PSEUDO preFilter 687 pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace(3, 8) + ")*)|.*)\\)|)", 688 689 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 690 rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"), 691 692 rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), 693 rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"), 694 695 rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"), 696 697 rpseudo = new RegExp(pseudos), 698 ridentifier = new RegExp("^" + identifier + "$"), 699 700 matchExpr = { 701 "ID": new RegExp("^#(" + characterEncoding + ")"), 702 "CLASS": new RegExp("^\\.(" + characterEncoding + ")"), 703 "TAG": new RegExp("^(" + characterEncoding.replace("w", "w*") + ")"), 704 "ATTR": new RegExp("^" + attributes), 705 "PSEUDO": new RegExp("^" + pseudos), 706 "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + 707 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + 708 "*(\\d+)|))" + whitespace + "*\\)|)", "i"), 709 "bool": new RegExp("^(?:" + booleans + ")$", "i"), 710 // For use in libraries implementing .is() 711 // We use this for POS matching in `select` 712 "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + 713 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i") 714 }, 715 716 rinputs = /^(?:input|select|textarea|button)$/i, 717 rheader = /^h\d$/i, 718 719 rnative = /^[^{]+\{\s*\[native \w/, 720 721 // Easily-parseable/retrievable ID or TAG or CLASS selectors 722 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 723 724 rsibling = /[+~]/, 725 rescape = /'|\\/g, 726 727 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 728 runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"), 729 funescape = function(_, escaped, escapedWhitespace) { 730 var high = "0x" + escaped - 0x10000; 731 // NaN means non-codepoint 732 // Support: Firefox 733 // Workaround erroneous numeric interpretation of +"0x" 734 return high !== high || escapedWhitespace ? 735 escaped : 736 high < 0 ? 737 // BMP codepoint 738 String.fromCharCode(high + 0x10000) : 739 // Supplemental Plane codepoint (surrogate pair) 740 String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00); 741 }; 742 743 // Optimize for push.apply( _, NodeList ) 744 try { 745 push.apply( 746 (arr = slice.call(preferredDoc.childNodes)), 747 preferredDoc.childNodes 748 ); 749 // Support: Android<4.0 750 // Detect silently failing push.apply 751 arr[preferredDoc.childNodes.length].nodeType; 752 } catch (e) { 753 push = { 754 apply: arr.length ? 755 756 // Leverage slice if possible 757 758 function(target, els) { 759 push_native.apply(target, slice.call(els)); 760 } : 761 762 // Support: IE<9 763 // Otherwise append directly 764 765 function(target, els) { 766 var j = target.length, 767 i = 0; 768 // Can't trust NodeList.length 769 while ((target[j++] = els[i++])) {} 770 target.length = j - 1; 771 } 772 }; 773 } 774 775 function Sizzle(selector, context, results, seed) { 776 var match, elem, m, nodeType, 777 // QSA vars 778 i, groups, old, nid, newContext, newSelector; 779 780 if ((context ? context.ownerDocument || context : preferredDoc) !== document) { 781 setDocument(context); 782 } 783 784 context = context || document; 785 results = results || []; 786 787 if (!selector || typeof selector !== "string") { 788 return results; 789 } 790 791 if ((nodeType = context.nodeType) !== 1 && nodeType !== 9) { 792 return []; 793 } 794 795 if (documentIsHTML && !seed) { 796 797 // Shortcuts 798 if ((match = rquickExpr.exec(selector))) { 799 // Speed-up: Sizzle("#ID") 800 if ((m = match[1])) { 801 if (nodeType === 9) { 802 elem = context.getElementById(m); 803 // Check parentNode to catch when Blackberry 4.6 returns 804 // nodes that are no longer in the document (jQuery #6963) 805 if (elem && elem.parentNode) { 806 // Handle the case where IE, Opera, and Webkit return items 807 // by name instead of ID 808 if (elem.id === m) { 809 results.push(elem); 810 return results; 811 } 812 } else { 813 return results; 814 } 815 } else { 816 // Context is not a document 817 if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && 818 contains(context, elem) && elem.id === m) { 819 results.push(elem); 820 return results; 821 } 822 } 823 824 // Speed-up: Sizzle("TAG") 825 } else if (match[2]) { 826 push.apply(results, context.getElementsByTagName(selector)); 827 return results; 828 829 // Speed-up: Sizzle(".CLASS") 830 } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) { 831 push.apply(results, context.getElementsByClassName(m)); 832 return results; 833 } 834 } 835 836 // QSA path 837 if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) { 838 nid = old = expando; 839 newContext = context; 840 newSelector = nodeType === 9 && selector; 841 842 // qSA works strangely on Element-rooted queries 843 // We can work around this by specifying an extra ID on the root 844 // and working up from there (Thanks to Andrew Dupont for the technique) 845 // IE 8 doesn't work on object elements 846 if (nodeType === 1 && context.nodeName.toLowerCase() !== "object") { 847 groups = tokenize(selector); 848 849 if ((old = context.getAttribute("id"))) { 850 nid = old.replace(rescape, "\\$&"); 851 } else { 852 context.setAttribute("id", nid); 853 } 854 nid = "[id='" + nid + "'] "; 855 856 i = groups.length; 857 while (i--) { 858 groups[i] = nid + toSelector(groups[i]); 859 } 860 newContext = rsibling.test(selector) && testContext(context.parentNode) || context; 861 newSelector = groups.join(","); 862 } 863 864 if (newSelector) { 865 try { 866 push.apply(results, 867 newContext.querySelectorAll(newSelector) 868 ); 869 return results; 870 } catch (qsaError) {} finally { 871 if (!old) { 872 context.removeAttribute("id"); 873 } 874 } 875 } 876 } 877 } 878 879 // All others 880 return select(selector.replace(rtrim, "$1"), context, results, seed); 881 } 882 883 /** 884 * Create key-value caches of limited size 885 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with 886 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 887 * deleting the oldest entry 888 */ 889 890 function createCache() { 891 var keys = []; 892 893 function cache(key, value) { 894 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 895 if (keys.push(key + " ") > Expr.cacheLength) { 896 // Only keep the most recent entries 897 delete cache[keys.shift()]; 898 } 899 return (cache[key + " "] = value); 900 } 901 return cache; 902 } 903 904 /** 905 * Mark a function for special use by Sizzle 906 * @param {Function} fn The function to mark 907 */ 908 909 function markFunction(fn) { 910 fn[expando] = true; 911 return fn; 912 } 913 914 /** 915 * Support testing using an element 916 * @param {Function} fn Passed the created div and expects a boolean result 917 */ 918 919 function assert(fn) { 920 var div = document.createElement("div"); 921 922 try { 923 return !!fn(div); 924 } catch (e) { 925 return false; 926 } finally { 927 // Remove from its parent by default 928 if (div.parentNode) { 929 div.parentNode.removeChild(div); 930 } 931 // release memory in IE 932 div = null; 933 } 934 } 935 936 /** 937 * Adds the same handler for all of the specified attrs 938 * @param {String} attrs Pipe-separated list of attributes 939 * @param {Function} handler The method that will be applied 940 */ 941 942 function addHandle(attrs, handler) { 943 var arr = attrs.split("|"), 944 i = attrs.length; 945 946 while (i--) { 947 Expr.attrHandle[arr[i]] = handler; 948 } 949 } 950 951 /** 952 * Checks document order of two siblings 953 * @param {Element} a 954 * @param {Element} b 955 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 956 */ 957 958 function siblingCheck(a, b) { 959 var cur = b && a, 960 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 961 (~b.sourceIndex || MAX_NEGATIVE) - 962 (~a.sourceIndex || MAX_NEGATIVE); 963 964 // Use IE sourceIndex if available on both nodes 965 if (diff) { 966 return diff; 967 } 968 969 // Check if b follows a 970 if (cur) { 971 while ((cur = cur.nextSibling)) { 972 if (cur === b) { 973 return -1; 974 } 975 } 976 } 977 978 return a ? 1 : -1; 979 } 980 981 /** 982 * Returns a function to use in pseudos for input types 983 * @param {String} type 984 */ 985 986 function createInputPseudo(type) { 987 return function(elem) { 988 var name = elem.nodeName.toLowerCase(); 989 return name === "input" && elem.type === type; 990 }; 991 } 992 993 /** 994 * Returns a function to use in pseudos for buttons 995 * @param {String} type 996 */ 997 998 function createButtonPseudo(type) { 999 return function(elem) { 1000 var name = elem.nodeName.toLowerCase(); 1001 return (name === "input" || name === "button") && elem.type === type; 1002 }; 1003 } 1004 1005 /** 1006 * Returns a function to use in pseudos for positionals 1007 * @param {Function} fn 1008 */ 1009 1010 function createPositionalPseudo(fn) { 1011 return markFunction(function(argument) { 1012 argument = +argument; 1013 return markFunction(function(seed, matches) { 1014 var j, 1015 matchIndexes = fn([], seed.length, argument), 1016 i = matchIndexes.length; 1017 1018 // Match elements found at the specified indexes 1019 while (i--) { 1020 if (seed[(j = matchIndexes[i])]) { 1021 seed[j] = !(matches[j] = seed[j]); 1022 } 1023 } 1024 }); 1025 }); 1026 } 1027 1028 /** 1029 * Checks a node for validity as a Sizzle context 1030 * @param {Element|Object=} context 1031 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1032 */ 1033 1034 function testContext(context) { 1035 return context && typeof context.getElementsByTagName !== strundefined && context; 1036 } 1037 1038 // Expose support vars for convenience 1039 support = Sizzle.support = {}; 1040 1041 /** 1042 * Detects XML nodes 1043 * @param {Element|Object} elem An element or a document 1044 * @returns {Boolean} True iff elem is a non-HTML XML node 1045 */ 1046 isXML = Sizzle.isXML = function(elem) { 1047 // documentElement is verified for cases where it doesn't yet exist 1048 // (such as loading iframes in IE - #4833) 1049 var documentElement = elem && (elem.ownerDocument || elem).documentElement; 1050 return documentElement ? documentElement.nodeName !== "HTML" : false; 1051 }; 1052 1053 /** 1054 * Sets document-related variables once based on the current document 1055 * @param {Element|Object} [doc] An element or document object to use to set the document 1056 * @returns {Object} Returns the current document 1057 */ 1058 setDocument = Sizzle.setDocument = function(node) { 1059 var hasCompare, 1060 doc = node ? node.ownerDocument || node : preferredDoc, 1061 parent = doc.defaultView; 1062 1063 // If no document and documentElement is available, return 1064 if (doc === document || doc.nodeType !== 9 || !doc.documentElement) { 1065 return document; 1066 } 1067 1068 // Set our document 1069 document = doc; 1070 docElem = doc.documentElement; 1071 1072 // Support tests 1073 documentIsHTML = !isXML(doc); 1074 1075 // Support: IE>8 1076 // If iframe document is assigned to "document" variable and if iframe has been reloaded, 1077 // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 1078 // IE6-8 do not support the defaultView property so parent will be undefined 1079 if (parent && parent !== parent.top) { 1080 // IE11 does not have attachEvent, so all must suffer 1081 if (parent.addEventListener) { 1082 parent.addEventListener("unload", function() { 1083 setDocument(); 1084 }, false); 1085 } else if (parent.attachEvent) { 1086 parent.attachEvent("onunload", function() { 1087 setDocument(); 1088 }); 1089 } 1090 } 1091 1092 /* Attributes 1093 ---------------------------------------------------------------------- */ 1094 1095 // Support: IE<8 1096 // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) 1097 support.attributes = assert(function(div) { 1098 div.className = "i"; 1099 return !div.getAttribute("className"); 1100 }); 1101 1102 /* getElement(s)By* 1103 ---------------------------------------------------------------------- */ 1104 1105 // Check if getElementsByTagName("*") returns only elements 1106 support.getElementsByTagName = assert(function(div) { 1107 div.appendChild(doc.createComment("")); 1108 return !div.getElementsByTagName("*").length; 1109 }); 1110 1111 // Check if getElementsByClassName can be trusted 1112 support.getElementsByClassName = rnative.test(doc.getElementsByClassName) && assert(function(div) { 1113 div.innerHTML = "<div class='a'></div><div class='a i'></div>"; 1114 1115 // Support: Safari<4 1116 // Catch class over-caching 1117 div.firstChild.className = "i"; 1118 // Support: Opera<10 1119 // Catch gEBCN failure to find non-leading classes 1120 return div.getElementsByClassName("i").length === 2; 1121 }); 1122 1123 // Support: IE<10 1124 // Check if getElementById returns elements by name 1125 // The broken getElementById methods don't pick up programatically-set names, 1126 // so use a roundabout getElementsByName test 1127 support.getById = assert(function(div) { 1128 docElem.appendChild(div).id = expando; 1129 return !doc.getElementsByName || !doc.getElementsByName(expando).length; 1130 }); 1131 1132 // ID find and filter 1133 if (support.getById) { 1134 Expr.find["ID"] = function(id, context) { 1135 if (typeof context.getElementById !== strundefined && documentIsHTML) { 1136 var m = context.getElementById(id); 1137 // Check parentNode to catch when Blackberry 4.6 returns 1138 // nodes that are no longer in the document #6963 1139 return m && m.parentNode ? [m] : []; 1140 } 1141 }; 1142 Expr.filter["ID"] = function(id) { 1143 var attrId = id.replace(runescape, funescape); 1144 return function(elem) { 1145 return elem.getAttribute("id") === attrId; 1146 }; 1147 }; 1148 } else { 1149 // Support: IE6/7 1150 // getElementById is not reliable as a find shortcut 1151 delete Expr.find["ID"]; 1152 1153 Expr.filter["ID"] = function(id) { 1154 var attrId = id.replace(runescape, funescape); 1155 return function(elem) { 1156 var node = typeof elem.getAttributeNode !== strundefined && 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 !== strundefined) { 1166 return context.getElementsByTagName(tag); 1167 } 1168 } : 1169 function(tag, context) { 1170 var elem, 1171 tmp = [], 1172 i = 0, 1173 results = context.getElementsByTagName(tag); 1174 1175 // Filter out possible comments 1176 if (tag === "*") { 1177 while ((elem = results[i++])) { 1178 if (elem.nodeType === 1) { 1179 tmp.push(elem); 1180 } 1181 } 1182 1183 return tmp; 1184 } 1185 return results; 1186 }; 1187 1188 // Class 1189 Expr.find["CLASS"] = support.getElementsByClassName && function(className, context) { 1190 if (typeof context.getElementsByClassName !== strundefined && documentIsHTML) { 1191 return context.getElementsByClassName(className); 1192 } 1193 }; 1194 1195 /* QSA/matchesSelector 1196 ---------------------------------------------------------------------- */ 1197 1198 // QSA and matchesSelector support 1199 1200 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 1201 rbuggyMatches = []; 1202 1203 // qSa(:focus) reports false when true (Chrome 21) 1204 // We allow this because of a bug in IE8/9 that throws an error 1205 // whenever `document.activeElement` is accessed on an iframe 1206 // So, we allow :focus to pass through QSA all the time to avoid the IE error 1207 // See http://bugs.jquery.com/ticket/13378 1208 rbuggyQSA = []; 1209 1210 if ((support.qsa = rnative.test(doc.querySelectorAll))) { 1211 // Build QSA regex 1212 // Regex strategy adopted from Diego Perini 1213 assert(function(div) { 1214 // Select is set to empty string on purpose 1215 // This is to test IE's treatment of not explicitly 1216 // setting a boolean content attribute, 1217 // since its presence should be enough 1218 // http://bugs.jquery.com/ticket/12359 1219 div.innerHTML = "<select t=''><option selected=''></option></select>"; 1220 1221 // Support: IE8, Opera 10-12 1222 // Nothing should be selected when empty strings follow ^= or $= or *= 1223 if (div.querySelectorAll("[t^='']").length) { 1224 rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")"); 1225 } 1226 1227 // Support: IE8 1228 // Boolean attributes and "value" are not treated correctly 1229 if (!div.querySelectorAll("[selected]").length) { 1230 rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")"); 1231 } 1232 1233 // Webkit/Opera - :checked should return selected option elements 1234 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1235 // IE8 throws error here and will not see later tests 1236 if (!div.querySelectorAll(":checked").length) { 1237 rbuggyQSA.push(":checked"); 1238 } 1239 }); 1240 1241 assert(function(div) { 1242 // Support: Windows 8 Native Apps 1243 // The type and name attributes are restricted during .innerHTML assignment 1244 var input = doc.createElement("input"); 1245 input.setAttribute("type", "hidden"); 1246 div.appendChild(input).setAttribute("name", "D"); 1247 1248 // Support: IE8 1249 // Enforce case-sensitivity of name attribute 1250 if (div.querySelectorAll("[name=d]").length) { 1251 rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?="); 1252 } 1253 1254 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 1255 // IE8 throws error here and will not see later tests 1256 if (!div.querySelectorAll(":enabled").length) { 1257 rbuggyQSA.push(":enabled", ":disabled"); 1258 } 1259 1260 // Opera 10-11 does not throw on post-comma invalid pseudos 1261 div.querySelectorAll("*,:x"); 1262 rbuggyQSA.push(",.*:"); 1263 }); 1264 } 1265 1266 if ((support.matchesSelector = rnative.test((matches = docElem.webkitMatchesSelector || 1267 docElem.mozMatchesSelector || 1268 docElem.oMatchesSelector || 1269 docElem.msMatchesSelector)))) { 1270 1271 assert(function(div) { 1272 // Check to see if it's possible to do matchesSelector 1273 // on a disconnected node (IE 9) 1274 support.disconnectedMatch = matches.call(div, "div"); 1275 1276 // This should fail with an exception 1277 // Gecko does not error, returns false instead 1278 matches.call(div, "[s!='']:x"); 1279 rbuggyMatches.push("!=", pseudos); 1280 }); 1281 } 1282 1283 rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|")); 1284 rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|")); 1285 1286 /* Contains 1287 ---------------------------------------------------------------------- */ 1288 hasCompare = rnative.test(docElem.compareDocumentPosition); 1289 1290 // Element contains another 1291 // Purposefully does not implement inclusive descendent 1292 // As in, an element does not contain itself 1293 contains = hasCompare || rnative.test(docElem.contains) ? 1294 function(a, b) { 1295 var adown = a.nodeType === 9 ? a.documentElement : a, 1296 bup = b && b.parentNode; 1297 return a === bup || !! (bup && bup.nodeType === 1 && ( 1298 adown.contains ? 1299 adown.contains(bup) : 1300 a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16 1301 )); 1302 } : 1303 function(a, b) { 1304 if (b) { 1305 while ((b = b.parentNode)) { 1306 if (b === a) { 1307 return true; 1308 } 1309 } 1310 } 1311 return false; 1312 }; 1313 1314 /* Sorting 1315 ---------------------------------------------------------------------- */ 1316 1317 // Document order sorting 1318 sortOrder = hasCompare ? 1319 function(a, b) { 1320 1321 // Flag for duplicate removal 1322 if (a === b) { 1323 hasDuplicate = true; 1324 return 0; 1325 } 1326 1327 // Sort on method existence if only one input has compareDocumentPosition 1328 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1329 if (compare) { 1330 return compare; 1331 } 1332 1333 // Calculate position if both inputs belong to the same document 1334 compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? 1335 a.compareDocumentPosition(b) : 1336 1337 // Otherwise we know they are disconnected 1338 1; 1339 1340 // Disconnected nodes 1341 if (compare & 1 || 1342 (!support.sortDetached && b.compareDocumentPosition(a) === compare)) { 1343 1344 // Choose the first element that is related to our preferred document 1345 if (a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) { 1346 return -1; 1347 } 1348 if (b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) { 1349 return 1; 1350 } 1351 1352 // Maintain original order 1353 return sortInput ? 1354 (indexOf.call(sortInput, a) - indexOf.call(sortInput, b)) : 1355 0; 1356 } 1357 1358 return compare & 4 ? -1 : 1; 1359 } : 1360 function(a, b) { 1361 // Exit early if the nodes are identical 1362 if (a === b) { 1363 hasDuplicate = true; 1364 return 0; 1365 } 1366 1367 var cur, 1368 i = 0, 1369 aup = a.parentNode, 1370 bup = b.parentNode, 1371 ap = [a], 1372 bp = [b]; 1373 1374 // Parentless nodes are either documents or disconnected 1375 if (!aup || !bup) { 1376 return a === doc ? -1 : 1377 b === doc ? 1 : 1378 aup ? -1 : 1379 bup ? 1 : 1380 sortInput ? 1381 (indexOf.call(sortInput, a) - indexOf.call(sortInput, b)) : 1382 0; 1383 1384 // If the nodes are siblings, we can do a quick check 1385 } else if (aup === bup) { 1386 return siblingCheck(a, b); 1387 } 1388 1389 // Otherwise we need full lists of their ancestors for comparison 1390 cur = a; 1391 while ((cur = cur.parentNode)) { 1392 ap.unshift(cur); 1393 } 1394 cur = b; 1395 while ((cur = cur.parentNode)) { 1396 bp.unshift(cur); 1397 } 1398 1399 // Walk down the tree looking for a discrepancy 1400 while (ap[i] === bp[i]) { 1401 i++; 1402 } 1403 1404 return i ? 1405 // Do a sibling check if the nodes have a common ancestor 1406 siblingCheck(ap[i], bp[i]) : 1407 1408 // Otherwise nodes in our document sort first 1409 ap[i] === preferredDoc ? -1 : 1410 bp[i] === preferredDoc ? 1 : 1411 0; 1412 }; 1413 1414 return doc; 1415 }; 1416 1417 Sizzle.matches = function(expr, elements) { 1418 return Sizzle(expr, null, null, elements); 1419 }; 1420 1421 Sizzle.matchesSelector = function(elem, expr) { 1422 // Set document vars if needed 1423 if ((elem.ownerDocument || elem) !== document) { 1424 setDocument(elem); 1425 } 1426 1427 // Make sure that attribute selectors are quoted 1428 expr = expr.replace(rattributeQuotes, "='$1']"); 1429 1430 if (support.matchesSelector && documentIsHTML && 1431 (!rbuggyMatches || !rbuggyMatches.test(expr)) && 1432 (!rbuggyQSA || !rbuggyQSA.test(expr))) { 1433 1434 try { 1435 var ret = matches.call(elem, expr); 1436 1437 // IE 9's matchesSelector returns false on disconnected nodes 1438 if (ret || support.disconnectedMatch || 1439 // As well, disconnected nodes are said to be in a document 1440 // fragment in IE 9 1441 elem.document && elem.document.nodeType !== 11) { 1442 return ret; 1443 } 1444 } catch (e) {} 1445 } 1446 1447 return Sizzle(expr, document, null, [elem]).length > 0; 1448 }; 1449 1450 Sizzle.contains = function(context, elem) { 1451 // Set document vars if needed 1452 if ((context.ownerDocument || context) !== document) { 1453 setDocument(context); 1454 } 1455 return contains(context, elem); 1456 }; 1457 1458 Sizzle.attr = function(elem, name) { 1459 // Set document vars if needed 1460 if ((elem.ownerDocument || elem) !== document) { 1461 setDocument(elem); 1462 } 1463 1464 var fn = Expr.attrHandle[name.toLowerCase()], 1465 // Don't get fooled by Object.prototype properties (jQuery #13807) 1466 val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? 1467 fn(elem, name, !documentIsHTML) : 1468 undefined; 1469 1470 return val !== undefined ? 1471 val : 1472 support.attributes || !documentIsHTML ? 1473 elem.getAttribute(name) : 1474 (val = elem.getAttributeNode(name)) && val.specified ? 1475 val.value : 1476 null; 1477 }; 1478 1479 Sizzle.error = function(msg) { 1480 throw new Error("Syntax error, unrecognized expression: " + msg); 1481 }; 1482 1483 /** 1484 * Document sorting and removing duplicates 1485 * @param {ArrayLike} results 1486 */ 1487 Sizzle.uniqueSort = function(results) { 1488 var elem, 1489 duplicates = [], 1490 j = 0, 1491 i = 0; 1492 1493 // Unless we *know* we can detect duplicates, assume their presence 1494 hasDuplicate = !support.detectDuplicates; 1495 sortInput = !support.sortStable && results.slice(0); 1496 results.sort(sortOrder); 1497 1498 if (hasDuplicate) { 1499 while ((elem = results[i++])) { 1500 if (elem === results[i]) { 1501 j = duplicates.push(i); 1502 } 1503 } 1504 while (j--) { 1505 results.splice(duplicates[j], 1); 1506 } 1507 } 1508 1509 // Clear input after sorting to release objects 1510 // See https://github.com/jquery/sizzle/pull/225 1511 sortInput = null; 1512 1513 return results; 1514 }; 1515 1516 /** 1517 * Utility function for retrieving the text value of an array of DOM nodes 1518 * @param {Array|Element} elem 1519 */ 1520 getText = Sizzle.getText = function(elem) { 1521 var node, 1522 ret = "", 1523 i = 0, 1524 nodeType = elem.nodeType; 1525 1526 if (!nodeType) { 1527 // If no nodeType, this is expected to be an array 1528 while ((node = elem[i++])) { 1529 // Do not traverse comment nodes 1530 ret += getText(node); 1531 } 1532 } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) { 1533 // Use textContent for elements 1534 // innerText usage removed for consistency of new lines (jQuery #11153) 1535 if (typeof elem.textContent === "string") { 1536 return elem.textContent; 1537 } else { 1538 // Traverse its children 1539 for (elem = elem.firstChild; elem; elem = elem.nextSibling) { 1540 ret += getText(elem); 1541 } 1542 } 1543 } else if (nodeType === 3 || nodeType === 4) { 1544 return elem.nodeValue; 1545 } 1546 // Do not include comment or processing instruction nodes 1547 1548 return ret; 1549 }; 1550 1551 Expr = Sizzle.selectors = { 1552 1553 // Can be adjusted by the user 1554 cacheLength: 50, 1555 1556 createPseudo: markFunction, 1557 1558 match: matchExpr, 1559 1560 attrHandle: {}, 1561 1562 find: {}, 1563 1564 relative: { 1565 ">": { 1566 dir: "parentNode", 1567 first: true 1568 }, 1569 " ": { 1570 dir: "parentNode" 1571 }, 1572 "+": { 1573 dir: "previousSibling", 1574 first: true 1575 }, 1576 "~": { 1577 dir: "previousSibling" 1578 } 1579 }, 1580 1581 preFilter: { 1582 "ATTR": function(match) { 1583 match[1] = match[1].replace(runescape, funescape); 1584 1585 // Move the given value to match[3] whether quoted or unquoted 1586 match[3] = (match[4] || match[5] || "").replace(runescape, funescape); 1587 1588 if (match[2] === "~=") { 1589 match[3] = " " + match[3] + " "; 1590 } 1591 1592 return match.slice(0, 4); 1593 }, 1594 1595 "CHILD": function(match) { 1596 /* matches from matchExpr["CHILD"] 1597 1 type (only|nth|...) 1598 2 what (child|of-type) 1599 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1600 4 xn-component of xn+y argument ([+-]?\d*n|) 1601 5 sign of xn-component 1602 6 x of xn-component 1603 7 sign of y-component 1604 8 y of y-component 1605 */ 1606 match[1] = match[1].toLowerCase(); 1607 1608 if (match[1].slice(0, 3) === "nth") { 1609 // nth-* requires argument 1610 if (!match[3]) { 1611 Sizzle.error(match[0]); 1612 } 1613 1614 // numeric x and y parameters for Expr.filter.CHILD 1615 // remember that false/true cast respectively to 0/1 1616 match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd")); 1617 match[5] = +((match[7] + match[8]) || match[3] === "odd"); 1618 1619 // other types prohibit arguments 1620 } else if (match[3]) { 1621 Sizzle.error(match[0]); 1622 } 1623 1624 return match; 1625 }, 1626 1627 "PSEUDO": function(match) { 1628 var excess, 1629 unquoted = !match[5] && match[2]; 1630 1631 if (matchExpr["CHILD"].test(match[0])) { 1632 return null; 1633 } 1634 1635 // Accept quoted arguments as-is 1636 if (match[3] && match[4] !== undefined) { 1637 match[2] = match[4]; 1638 1639 // Strip excess characters from unquoted arguments 1640 } else if (unquoted && rpseudo.test(unquoted) && 1641 // Get excess from tokenize (recursively) 1642 (excess = tokenize(unquoted, true)) && 1643 // advance to the next closing parenthesis 1644 (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) { 1645 1646 // excess is a negative index 1647 match[0] = match[0].slice(0, excess); 1648 match[2] = unquoted.slice(0, excess); 1649 } 1650 1651 // Return only captures needed by the pseudo filter method (type and argument) 1652 return match.slice(0, 3); 1653 } 1654 }, 1655 1656 filter: { 1657 1658 "TAG": function(nodeNameSelector) { 1659 var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase(); 1660 return nodeNameSelector === "*" ? 1661 function() { 1662 return true; 1663 } : 1664 function(elem) { 1665 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 1666 }; 1667 }, 1668 1669 "CLASS": function(className) { 1670 var pattern = classCache[className + " "]; 1671 1672 return pattern || 1673 (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && 1674 classCache(className, function(elem) { 1675 return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || ""); 1676 }); 1677 }, 1678 1679 "ATTR": function(name, operator, check) { 1680 return function(elem) { 1681 var result = Sizzle.attr(elem, name); 1682 1683 if (result == null) { 1684 return operator === "!="; 1685 } 1686 if (!operator) { 1687 return true; 1688 } 1689 1690 result += ""; 1691 1692 return operator === "=" ? result === check : 1693 operator === "!=" ? result !== check : 1694 operator === "^=" ? check && result.indexOf(check) === 0 : 1695 operator === "*=" ? check && result.indexOf(check) > -1 : 1696 operator === "$=" ? check && result.slice(-check.length) === check : 1697 operator === "~=" ? (" " + result + " ").indexOf(check) > -1 : 1698 operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : 1699 false; 1700 }; 1701 }, 1702 1703 "CHILD": function(type, what, argument, first, last) { 1704 var simple = type.slice(0, 3) !== "nth", 1705 forward = type.slice(-4) !== "last", 1706 ofType = what === "of-type"; 1707 1708 return first === 1 && last === 0 ? 1709 1710 // Shortcut for :nth-*(n) 1711 1712 function(elem) { 1713 return !!elem.parentNode; 1714 } : 1715 1716 function(elem, context, xml) { 1717 var cache, outerCache, node, diff, nodeIndex, start, 1718 dir = simple !== forward ? "nextSibling" : "previousSibling", 1719 parent = elem.parentNode, 1720 name = ofType && elem.nodeName.toLowerCase(), 1721 useCache = !xml && !ofType; 1722 1723 if (parent) { 1724 1725 // :(first|last|only)-(child|of-type) 1726 if (simple) { 1727 while (dir) { 1728 node = elem; 1729 while ((node = node[dir])) { 1730 if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) { 1731 return false; 1732 } 1733 } 1734 // Reverse direction for :only-* (if we haven't yet done so) 1735 start = dir = type === "only" && !start && "nextSibling"; 1736 } 1737 return true; 1738 } 1739 1740 start = [forward ? parent.firstChild : parent.lastChild]; 1741 1742 // non-xml :nth-child(...) stores cache data on `parent` 1743 if (forward && useCache) { 1744 // Seek `elem` from a previously-cached index 1745 outerCache = parent[expando] || (parent[expando] = {}); 1746 cache = outerCache[type] || []; 1747 nodeIndex = cache[0] === dirruns && cache[1]; 1748 diff = cache[0] === dirruns && cache[2]; 1749 node = nodeIndex && parent.childNodes[nodeIndex]; 1750 1751 while ((node = ++nodeIndex && node && node[dir] || 1752 1753 // Fallback to seeking `elem` from the start 1754 (diff = nodeIndex = 0) || start.pop())) { 1755 1756 // When found, cache indexes on `parent` and break 1757 if (node.nodeType === 1 && ++diff && node === elem) { 1758 outerCache[type] = [dirruns, nodeIndex, diff]; 1759 break; 1760 } 1761 } 1762 1763 // Use previously-cached element index if available 1764 } else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) { 1765 diff = cache[1]; 1766 1767 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) 1768 } else { 1769 // Use the same loop as above to seek `elem` from the start 1770 while ((node = ++nodeIndex && node && node[dir] || 1771 (diff = nodeIndex = 0) || start.pop())) { 1772 1773 if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) { 1774 // Cache the index of each encountered element 1775 if (useCache) { 1776 (node[expando] || (node[expando] = {}))[type] = [dirruns, diff]; 1777 } 1778 1779 if (node === elem) { 1780 break; 1781 } 1782 } 1783 } 1784 } 1785 1786 // Incorporate the offset, then check against cycle size 1787 diff -= last; 1788 return diff === first || (diff % first === 0 && diff / first >= 0); 1789 } 1790 }; 1791 }, 1792 1793 "PSEUDO": function(pseudo, argument) { 1794 // pseudo-class names are case-insensitive 1795 // http://www.w3.org/TR/selectors/#pseudo-classes 1796 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 1797 // Remember that setFilters inherits from pseudos 1798 var args, 1799 fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || 1800 Sizzle.error("unsupported pseudo: " + pseudo); 1801 1802 // The user may use createPseudo to indicate that 1803 // arguments are needed to create the filter function 1804 // just as Sizzle does 1805 if (fn[expando]) { 1806 return fn(argument); 1807 } 1808 1809 // But maintain support for old signatures 1810 if (fn.length > 1) { 1811 args = [pseudo, pseudo, "", argument]; 1812 return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? 1813 markFunction(function(seed, matches) { 1814 var idx, 1815 matched = fn(seed, argument), 1816 i = matched.length; 1817 while (i--) { 1818 idx = indexOf.call(seed, matched[i]); 1819 seed[idx] = !(matches[idx] = matched[i]); 1820 } 1821 }) : 1822 function(elem) { 1823 return fn(elem, 0, args); 1824 }; 1825 } 1826 1827 return fn; 1828 } 1829 }, 1830 1831 pseudos: { 1832 // Potentially complex pseudos 1833 "not": markFunction(function(selector) { 1834 // Trim the selector passed to compile 1835 // to avoid treating leading and trailing 1836 // spaces as combinators 1837 var input = [], 1838 results = [], 1839 matcher = compile(selector.replace(rtrim, "$1")); 1840 1841 return matcher[expando] ? 1842 markFunction(function(seed, matches, context, xml) { 1843 var elem, 1844 unmatched = matcher(seed, null, xml, []), 1845 i = seed.length; 1846 1847 // Match elements unmatched by `matcher` 1848 while (i--) { 1849 if ((elem = unmatched[i])) { 1850 seed[i] = !(matches[i] = elem); 1851 } 1852 } 1853 }) : 1854 function(elem, context, xml) { 1855 input[0] = elem; 1856 matcher(input, null, xml, results); 1857 return !results.pop(); 1858 }; 1859 }), 1860 1861 "has": markFunction(function(selector) { 1862 return function(elem) { 1863 return Sizzle(selector, elem).length > 0; 1864 }; 1865 }), 1866 1867 "contains": markFunction(function(text) { 1868 return function(elem) { 1869 return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1; 1870 }; 1871 }), 1872 1873 // "Whether an element is represented by a :lang() selector 1874 // is based solely on the element's language value 1875 // being equal to the identifier C, 1876 // or beginning with the identifier C immediately followed by "-". 1877 // The matching of C against the element's language value is performed case-insensitively. 1878 // The identifier C does not have to be a valid language name." 1879 // http://www.w3.org/TR/selectors/#lang-pseudo 1880 "lang": markFunction(function(lang) { 1881 // lang value must be a valid identifier 1882 if (!ridentifier.test(lang || "")) { 1883 Sizzle.error("unsupported lang: " + lang); 1884 } 1885 lang = lang.replace(runescape, funescape).toLowerCase(); 1886 return function(elem) { 1887 var elemLang; 1888 do { 1889 if ((elemLang = documentIsHTML ? 1890 elem.lang : 1891 elem.getAttribute("xml:lang") || elem.getAttribute("lang"))) { 1892 1893 elemLang = elemLang.toLowerCase(); 1894 return elemLang === lang || elemLang.indexOf(lang + "-") === 0; 1895 } 1896 } while ((elem = elem.parentNode) && elem.nodeType === 1); 1897 return false; 1898 }; 1899 }), 1900 1901 // Miscellaneous 1902 "target": function(elem) { 1903 var hash = window.location && window.location.hash; 1904 return hash && hash.slice(1) === elem.id; 1905 }, 1906 1907 "root": function(elem) { 1908 return elem === docElem; 1909 }, 1910 1911 "focus": function(elem) { 1912 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !! (elem.type || elem.href || ~elem.tabIndex); 1913 }, 1914 1915 // Boolean properties 1916 "enabled": function(elem) { 1917 return elem.disabled === false; 1918 }, 1919 1920 "disabled": function(elem) { 1921 return elem.disabled === true; 1922 }, 1923 1924 "checked": function(elem) { 1925 // In CSS3, :checked should return both checked and selected elements 1926 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#
vendor: 4,480 bytes, lines 1926-2088
1926checked 1927 var nodeName = elem.nodeName.toLowerCase(); 1928 return (nodeName === "input" && !! elem.checked) || (nodeName === "option" && !! elem.selected); 1929 }, 1930 1931 "selected": function(elem) { 1932 // Accessing this property makes selected-by-default 1933 // options in Safari work properly 1934 if (elem.parentNode) { 1935 elem.parentNode.selectedIndex; 1936 } 1937 1938 return elem.selected === true; 1939 }, 1940 1941 // Contents 1942 "empty": function(elem) { 1943 // http://www.w3.org/TR/selectors/#empty-pseudo 1944 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 1945 // but not by others (comment: 8; processing instruction: 7; etc.) 1946 // nodeType < 6 works because attributes (2) do not appear as children 1947 for (elem = elem.firstChild; elem; elem = elem.nextSibling) { 1948 if (elem.nodeType < 6) { 1949 return false; 1950 } 1951 } 1952 return true; 1953 }, 1954 1955 "parent": function(elem) { 1956 return !Expr.pseudos["empty"](elem); 1957 }, 1958 1959 // Element/input types 1960 "header": function(elem) { 1961 return rheader.test(elem.nodeName); 1962 }, 1963 1964 "input": function(elem) { 1965 return rinputs.test(elem.nodeName); 1966 }, 1967 1968 "button": function(elem) { 1969 var name = elem.nodeName.toLowerCase(); 1970 return name === "input" && elem.type === "button" || name === "button"; 1971 }, 1972 1973 "text": function(elem) { 1974 var attr; 1975 return elem.nodeName.toLowerCase() === "input" && 1976 elem.type === "text" && 1977 1978 // Support: IE<8 1979 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 1980 ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text"); 1981 }, 1982 1983 // Position-in-collection 1984 "first": createPositionalPseudo(function() { 1985 return [0]; 1986 }), 1987 1988 "last": createPositionalPseudo(function(matchIndexes, length) { 1989 return [length - 1]; 1990 }), 1991 1992 "eq": createPositionalPseudo(function(matchIndexes, length, argument) { 1993 return [argument < 0 ? argument + length : argument]; 1994 }), 1995 1996 "even": createPositionalPseudo(function(matchIndexes, length) { 1997 var i = 0; 1998 for (; i < length; i += 2) { 1999 matchIndexes.push(i); 2000 } 2001 return matchIndexes; 2002 }), 2003 2004 "odd": createPositionalPseudo(function(matchIndexes, length) { 2005 var i = 1; 2006 for (; i < length; i += 2) { 2007 matchIndexes.push(i); 2008 } 2009 return matchIndexes; 2010 }), 2011 2012 "lt": createPositionalPseudo(function(matchIndexes, length, argument) { 2013 var i = argument < 0 ? argument + length : argument; 2014 for (; --i >= 0;) { 2015 matchIndexes.push(i); 2016 } 2017 return matchIndexes; 2018 }), 2019 2020 "gt": createPositionalPseudo(function(matchIndexes, length, argument) { 2021 var i = argument < 0 ? argument + length : argument; 2022 for (; ++i < length;) { 2023 matchIndexes.push(i); 2024 } 2025 return matchIndexes; 2026 }) 2027 } 2028 }; 2029 2030 Expr.pseudos["nth"] = Expr.pseudos["eq"]; 2031 2032 // Add button/input type pseudos 2033 for (i in { 2034 radio: true, 2035 checkbox: true, 2036 file: true, 2037 password: true, 2038 image: true 2039 }) { 2040 Expr.pseudos[i] = createInputPseudo(i); 2041 } 2042 for (i in { 2043 submit: true, 2044 reset: true 2045 }) { 2046 Expr.pseudos[i] = createButtonPseudo(i); 2047 } 2048 2049 // Easy API for creating new setFilters 2050 2051 function setFilters() {} 2052 setFilters.prototype = Expr.filters = Expr.pseudos; 2053 Expr.setFilters = new setFilters(); 2054 2055 function tokenize(selector, parseOnly) { 2056 var matched, match, tokens, type, 2057 soFar, groups, preFilters, 2058 cached = tokenCache[selector + " "]; 2059 2060 if (cached) { 2061 return parseOnly ? 0 : cached.slice(0); 2062 } 2063 2064 soFar = selector; 2065 groups = []; 2066 preFilters = Expr.preFilter; 2067 2068 while (soFar) { 2069 2070 // Comma and first run 2071 if (!matched || (match = rcomma.exec(soFar))) { 2072 if (match) { 2073 // Don't consume trailing commas as valid 2074 soFar = soFar.slice(match[0].length) || soFar; 2075 } 2076 groups.push((tokens = [])); 2077 } 2078 2079 matched = false; 2080 2081 // Combinators 2082 if ((match = rcombinators.exec(soFar))) { 2083 matched = match.shift(); 2084 tokens.push({ 2085 value: matched, 2086 // Cast descendant combinators to space 2087 type: match[0].replace(rtrim, " ") 2088 });
vendor: 114,364 bytes, lines 2089-6066
2089 soFar = soFar.slice(matched.length); 2090 } 2091 2092 // Filters 2093 for (type in Expr.filter) { 2094 if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || 2095 (match = preFilters[type](match)))) { 2096 matched = match.shift(); 2097 tokens.push({ 2098 value: matched, 2099 type: type, 2100 matches: match 2101 }); 2102 soFar = soFar.slice(matched.length); 2103 } 2104 } 2105 2106 if (!matched) { 2107 break; 2108 } 2109 } 2110 2111 // Return the length of the invalid excess 2112 // if we're just parsing 2113 // Otherwise, throw an error or return tokens 2114 return parseOnly ? 2115 soFar.length : 2116 soFar ? 2117 Sizzle.error(selector) : 2118 // Cache the tokens 2119 tokenCache(selector, groups).slice(0); 2120 } 2121 2122 function toSelector(tokens) { 2123 var i = 0, 2124 len = tokens.length, 2125 selector = ""; 2126 for (; i < len; i++) { 2127 selector += tokens[i].value; 2128 } 2129 return selector; 2130 } 2131 2132 function addCombinator(matcher, combinator, base) { 2133 var dir = combinator.dir, 2134 checkNonElements = base && dir === "parentNode", 2135 doneName = done++; 2136 2137 return combinator.first ? 2138 // Check against closest ancestor/preceding element 2139 2140 function(elem, context, xml) { 2141 while ((elem = elem[dir])) { 2142 if (elem.nodeType === 1 || checkNonElements) { 2143 return matcher(elem, context, xml); 2144 } 2145 } 2146 } : 2147 2148 // Check against all ancestor/preceding elements 2149 2150 function(elem, context, xml) { 2151 var oldCache, outerCache, 2152 newCache = [dirruns, doneName]; 2153 2154 // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching 2155 if (xml) { 2156 while ((elem = elem[dir])) { 2157 if (elem.nodeType === 1 || checkNonElements) { 2158 if (matcher(elem, context, xml)) { 2159 return true; 2160 } 2161 } 2162 } 2163 } else { 2164 while ((elem = elem[dir])) { 2165 if (elem.nodeType === 1 || checkNonElements) { 2166 outerCache = elem[expando] || (elem[expando] = {}); 2167 if ((oldCache = outerCache[dir]) && 2168 oldCache[0] === dirruns && oldCache[1] === doneName) { 2169 2170 // Assign to newCache so results back-propagate to previous elements 2171 return (newCache[2] = oldCache[2]); 2172 } else { 2173 // Reuse newcache so results back-propagate to previous elements 2174 outerCache[dir] = newCache; 2175 2176 // A match means we're done; a fail means we have to keep checking 2177 if ((newCache[2] = matcher(elem, context, xml))) { 2178 return true; 2179 } 2180 } 2181 } 2182 } 2183 } 2184 }; 2185 } 2186 2187 function elementMatcher(matchers) { 2188 return matchers.length > 1 ? 2189 function(elem, context, xml) { 2190 var i = matchers.length; 2191 while (i--) { 2192 if (!matchers[i](elem, context, xml)) { 2193 return false; 2194 } 2195 } 2196 return true; 2197 } : 2198 matchers[0]; 2199 } 2200 2201 function condense(unmatched, map, filter, context, xml) { 2202 var elem, 2203 newUnmatched = [], 2204 i = 0, 2205 len = unmatched.length, 2206 mapped = map != null; 2207 2208 for (; i < len; i++) { 2209 if ((elem = unmatched[i])) { 2210 if (!filter || filter(elem, context, xml)) { 2211 newUnmatched.push(elem); 2212 if (mapped) { 2213 map.push(i); 2214 } 2215 } 2216 } 2217 } 2218 2219 return newUnmatched; 2220 } 2221 2222 function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) { 2223 if (postFilter && !postFilter[expando]) { 2224 postFilter = setMatcher(postFilter); 2225 } 2226 if (postFinder && !postFinder[expando]) { 2227 postFinder = setMatcher(postFinder, postSelector); 2228 } 2229 return markFunction(function(seed, results, context, xml) { 2230 var temp, i, elem, 2231 preMap = [], 2232 postMap = [], 2233 preexisting = results.length, 2234 2235 // Get initial elements from seed or context 2236 elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []), 2237 2238 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2239 matcherIn = preFilter && (seed || !selector) ? 2240 condense(elems, preMap, preFilter, context, xml) : 2241 elems, 2242 2243 matcherOut = matcher ? 2244 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 2245 postFinder || (seed ? preFilter : preexisting || postFilter) ? 2246 2247 // ...intermediate processing is necessary 2248 [] : 2249 2250 // ...otherwise use results directly 2251 results : 2252 matcherIn; 2253 2254 // Find primary matches 2255 if (matcher) { 2256 matcher(matcherIn, matcherOut, context, xml); 2257 } 2258 2259 // Apply postFilter 2260 if (postFilter) { 2261 temp = condense(matcherOut, postMap); 2262 postFilter(temp, [], context, xml); 2263 2264 // Un-match failing elements by moving them back to matcherIn 2265 i = temp.length; 2266 while (i--) { 2267 if ((elem = temp[i])) { 2268 matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem); 2269 } 2270 } 2271 } 2272 2273 if (seed) { 2274 if (postFinder || preFilter) { 2275 if (postFinder) { 2276 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2277 temp = []; 2278 i = matcherOut.length; 2279 while (i--) { 2280 if ((elem = matcherOut[i])) { 2281 // Restore matcherIn since elem is not yet a final match 2282 temp.push((matcherIn[i] = elem)); 2283 } 2284 } 2285 postFinder(null, (matcherOut = []), temp, xml); 2286 } 2287 2288 // Move matched elements from seed to results to keep them synchronized 2289 i = matcherOut.length; 2290 while (i--) { 2291 if ((elem = matcherOut[i]) && 2292 (temp = postFinder ? indexOf.call(seed, elem) : preMap[i]) > -1) { 2293 2294 seed[temp] = !(results[temp] = elem); 2295 } 2296 } 2297 } 2298 2299 // Add elements to results, through postFinder if defined 2300 } else { 2301 matcherOut = condense( 2302 matcherOut === results ? 2303 matcherOut.splice(preexisting, matcherOut.length) : 2304 matcherOut 2305 ); 2306 if (postFinder) { 2307 postFinder(null, results, matcherOut, xml); 2308 } else { 2309 push.apply(results, matcherOut); 2310 } 2311 } 2312 }); 2313 } 2314 2315 function matcherFromTokens(tokens) { 2316 var checkContext, matcher, j, 2317 len = tokens.length, 2318 leadingRelative = Expr.relative[tokens[0].type], 2319 implicitRelative = leadingRelative || Expr.relative[" "], 2320 i = leadingRelative ? 1 : 0, 2321 2322 // The foundational matcher ensures that elements are reachable from top-level context(s) 2323 matchContext = addCombinator(function(elem) { 2324 return elem === checkContext; 2325 }, implicitRelative, true), 2326 matchAnyContext = addCombinator(function(elem) { 2327 return indexOf.call(checkContext, elem) > -1; 2328 }, implicitRelative, true), 2329 matchers = [ 2330 function(elem, context, xml) { 2331 return (!leadingRelative && (xml || context !== outermostContext)) || ( 2332 (checkContext = context).nodeType ? 2333 matchContext(elem, context, xml) : 2334 matchAnyContext(elem, context, xml)); 2335 } 2336 ]; 2337 2338 for (; i < len; i++) { 2339 if ((matcher = Expr.relative[tokens[i].type])) { 2340 matchers = [addCombinator(elementMatcher(matchers), matcher)]; 2341 } else { 2342 matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches); 2343 2344 // Return special upon seeing a positional matcher 2345 if (matcher[expando]) { 2346 // Find the next relative operator (if any) for proper handling 2347 j = ++i; 2348 for (; j < len; j++) { 2349 if (Expr.relative[tokens[j].type]) { 2350 break; 2351 } 2352 } 2353 return setMatcher( 2354 i > 1 && elementMatcher(matchers), 2355 i > 1 && toSelector( 2356 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2357 tokens.slice(0, i - 1).concat({ 2358 value: tokens[i - 2].type === " " ? "*" : "" 2359 }) 2360 ).replace(rtrim, "$1"), 2361 matcher, 2362 i < j && matcherFromTokens(tokens.slice(i, j)), 2363 j < len && matcherFromTokens((tokens = tokens.slice(j))), 2364 j < len && toSelector(tokens) 2365 ); 2366 } 2367 matchers.push(matcher); 2368 } 2369 } 2370 2371 return elementMatcher(matchers); 2372 } 2373 2374 function matcherFromGroupMatchers(elementMatchers, setMatchers) { 2375 var bySet = setMatchers.length > 0, 2376 byElement = elementMatchers.length > 0, 2377 superMatcher = function(seed, context, xml, results, outermost) { 2378 var elem, j, matcher, 2379 matchedCount = 0, 2380 i = "0", 2381 unmatched = seed && [], 2382 setMatched = [], 2383 contextBackup = outermostContext, 2384 // We must always have either seed elements or outermost context 2385 elems = seed || byElement && Expr.find["TAG"]("*", outermost), 2386 // Use integer dirruns iff this is the outermost matcher 2387 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), 2388 len = elems.length; 2389 2390 if (outermost) { 2391 outermostContext = context !== document && context; 2392 } 2393 2394 // Add elements passing elementMatchers directly to results 2395 // Keep `i` a string if there are no elements so `matchedCount` will be "00" below 2396 // Support: IE<9, Safari 2397 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 2398 for (; i !== len && (elem = elems[i]) != null; i++) { 2399 if (byElement && elem) { 2400 j = 0; 2401 while ((matcher = elementMatchers[j++])) { 2402 if (matcher(elem, context, xml)) { 2403 results.push(elem); 2404 break; 2405 } 2406 } 2407 if (outermost) { 2408 dirruns = dirrunsUnique; 2409 } 2410 } 2411 2412 // Track unmatched elements for set filters 2413 if (bySet) { 2414 // They will have gone through all possible matchers 2415 if ((elem = !matcher && elem)) { 2416 matchedCount--; 2417 } 2418 2419 // Lengthen the array for every element, matched or not 2420 if (seed) { 2421 unmatched.push(elem); 2422 } 2423 } 2424 } 2425 2426 // Apply set filters to unmatched elements 2427 matchedCount += i; 2428 if (bySet && i !== matchedCount) { 2429 j = 0; 2430 while ((matcher = setMatchers[j++])) { 2431 matcher(unmatched, setMatched, context, xml); 2432 } 2433 2434 if (seed) { 2435 // Reintegrate element matches to eliminate the need for sorting 2436 if (matchedCount > 0) { 2437 while (i--) { 2438 if (!(unmatched[i] || setMatched[i])) { 2439 setMatched[i] = pop.call(results); 2440 } 2441 } 2442 } 2443 2444 // Discard index placeholder values to get only actual matches 2445 setMatched = condense(setMatched); 2446 } 2447 2448 // Add matches to results 2449 push.apply(results, setMatched); 2450 2451 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2452 if (outermost && !seed && setMatched.length > 0 && 2453 (matchedCount + setMatchers.length) > 1) { 2454 2455 Sizzle.uniqueSort(results); 2456 } 2457 } 2458 2459 // Override manipulation of globals by nested matchers 2460 if (outermost) { 2461 dirruns = dirrunsUnique; 2462 outermostContext = contextBackup; 2463 } 2464 2465 return unmatched; 2466 }; 2467 2468 return bySet ? 2469 markFunction(superMatcher) : 2470 superMatcher; 2471 } 2472 2473 compile = Sizzle.compile = function(selector, group /* Internal Use Only */ ) { 2474 var i, 2475 setMatchers = [], 2476 elementMatchers = [], 2477 cached = compilerCache[selector + " "]; 2478 2479 if (!cached) { 2480 // Generate a function of recursive functions that can be used to check each element 2481 if (!group) { 2482 group = tokenize(selector); 2483 } 2484 i = group.length; 2485 while (i--) { 2486 cached = matcherFromTokens(group[i]); 2487 if (cached[expando]) { 2488 setMatchers.push(cached); 2489 } else { 2490 elementMatchers.push(cached); 2491 } 2492 } 2493 2494 // Cache the compiled function 2495 cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers)); 2496 } 2497 return cached; 2498 }; 2499 2500 function multipleContexts(selector, contexts, results) { 2501 var i = 0, 2502 len = contexts.length; 2503 for (; i < len; i++) { 2504 Sizzle(selector, contexts[i], results); 2505 } 2506 return results; 2507 } 2508 2509 function select(selector, context, results, seed) { 2510 var i, tokens, token, type, find, 2511 match = tokenize(selector); 2512 2513 if (!seed) { 2514 // Try to minimize operations if there is only one group 2515 if (match.length === 1) { 2516 2517 // Take a shortcut and set the context if the root selector is an ID 2518 tokens = match[0] = match[0].slice(0); 2519 if (tokens.length > 2 && (token = tokens[0]).type === "ID" && 2520 support.getById && context.nodeType === 9 && documentIsHTML && 2521 Expr.relative[tokens[1].type]) { 2522 2523 context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0]; 2524 if (!context) { 2525 return results; 2526 } 2527 selector = selector.slice(tokens.shift().value.length); 2528 } 2529 2530 // Fetch a seed set for right-to-left matching 2531 i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length; 2532 while (i--) { 2533 token = tokens[i]; 2534 2535 // Abort if we hit a combinator 2536 if (Expr.relative[(type = token.type)]) { 2537 break; 2538 } 2539 if ((find = Expr.find[type])) { 2540 // Search, expanding context for leading sibling combinators 2541 if ((seed = find( 2542 token.matches[0].replace(runescape, funescape), 2543 rsibling.test(tokens[0].type) && testContext(context.parentNode) || context 2544 ))) { 2545 2546 // If seed is empty or no tokens remain, we can return early 2547 tokens.splice(i, 1); 2548 selector = seed.length && toSelector(tokens); 2549 if (!selector) { 2550 push.apply(results, seed); 2551 return results; 2552 } 2553 2554 break; 2555 } 2556 } 2557 } 2558 } 2559 } 2560 2561 // Compile and execute a filtering function 2562 // Provide `match` to avoid retokenization if we modified the selector above 2563 compile(selector, match)( 2564 seed, 2565 context, !documentIsHTML, 2566 results, 2567 rsibling.test(selector) && testContext(context.parentNode) || context 2568 ); 2569 return results; 2570 } 2571 2572 // One-time assignments 2573 2574 // Sort stability 2575 support.sortStable = expando.split("").sort(sortOrder).join("") === expando; 2576 2577 // Support: Chrome<14 2578 // Always assume duplicates if they aren't passed to the comparison function 2579 support.detectDuplicates = !! hasDuplicate; 2580 2581 // Initialize against the default document 2582 setDocument(); 2583 2584 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 2585 // Detached nodes confoundingly follow *each other* 2586 support.sortDetached = assert(function(div1) { 2587 // Should return 1, but returns 4 (following) 2588 return div1.compareDocumentPosition(document.createElement("div")) & 1; 2589 }); 2590 2591 // Support: IE<8 2592 // Prevent attribute/property "interpolation" 2593 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 2594 if (!assert(function(div) { 2595 div.innerHTML = "<a href='#'></a>"; 2596 return div.firstChild.getAttribute("href") === "#"; 2597 })) { 2598 addHandle("type|href|height|width", function(elem, name, isXML) { 2599 if (!isXML) { 2600 return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2); 2601 } 2602 }); 2603 } 2604 2605 // Support: IE<9 2606 // Use defaultValue in place of getAttribute("value") 2607 if (!support.attributes || !assert(function(div) { 2608 div.innerHTML = "<input/>"; 2609 div.firstChild.setAttribute("value", ""); 2610 return div.firstChild.getAttribute("value") === ""; 2611 })) { 2612 addHandle("value", function(elem, name, isXML) { 2613 if (!isXML && elem.nodeName.toLowerCase() === "input") { 2614 return elem.defaultValue; 2615 } 2616 }); 2617 } 2618 2619 // Support: IE<9 2620 // Use getAttributeNode to fetch booleans when getAttribute lies 2621 if (!assert(function(div) { 2622 return div.getAttribute("disabled") == null; 2623 })) { 2624 addHandle(booleans, function(elem, name, isXML) { 2625 var val; 2626 if (!isXML) { 2627 return elem[name] === true ? name.toLowerCase() : 2628 (val = elem.getAttributeNode(name)) && val.specified ? 2629 val.value : 2630 null; 2631 } 2632 }); 2633 } 2634 2635 return Sizzle; 2636 2637 })(window); 2638 2639 2640 2641 jQuery.find = Sizzle; 2642 jQuery.expr = Sizzle.selectors; 2643 jQuery.expr[":"] = jQuery.expr.pseudos; 2644 jQuery.unique = Sizzle.uniqueSort; 2645 jQuery.text = Sizzle.getText; 2646 jQuery.isXMLDoc = Sizzle.isXML; 2647 jQuery.contains = Sizzle.contains; 2648 2649 2650 2651 var rneedsContext = jQuery.expr.match.needsContext; 2652 2653 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); 2654 2655 2656 2657 var risSimple = /^.[^:#\[\.,]*$/; 2658 2659 // Implement the identical functionality for filter and not 2660 2661 function winnow(elements, qualifier, not) { 2662 if (jQuery.isFunction(qualifier)) { 2663 return jQuery.grep(elements, function(elem, i) { 2664 /* jshint -W018 */ 2665 return !!qualifier.call(elem, i, elem) !== not; 2666 }); 2667 2668 } 2669 2670 if (qualifier.nodeType) { 2671 return jQuery.grep(elements, function(elem) { 2672 return (elem === qualifier) !== not; 2673 }); 2674 2675 } 2676 2677 if (typeof qualifier === "string") { 2678 if (risSimple.test(qualifier)) { 2679 return jQuery.filter(qualifier, elements, not); 2680 } 2681 2682 qualifier = jQuery.filter(qualifier, elements); 2683 } 2684 2685 return jQuery.grep(elements, function(elem) { 2686 return (jQuery.inArray(elem, qualifier) >= 0) !== not; 2687 }); 2688 } 2689 2690 jQuery.filter = function(expr, elems, not) { 2691 var elem = elems[0]; 2692 2693 if (not) { 2694 expr = ":not(" + expr + ")"; 2695 } 2696 2697 return elems.length === 1 && elem.nodeType === 1 ? 2698 jQuery.find.matchesSelector(elem, expr) ? [elem] : [] : 2699 jQuery.find.matches(expr, jQuery.grep(elems, function(elem) { 2700 return elem.nodeType === 1; 2701 })); 2702 }; 2703 2704 jQuery.fn.extend({ 2705 find: function(selector) { 2706 var i, 2707 ret = [], 2708 self = this, 2709 len = self.length; 2710 2711 if (typeof selector !== "string") { 2712 return this.pushStack(jQuery(selector).filter(function() { 2713 for (i = 0; i < len; i++) { 2714 if (jQuery.contains(self[i], this)) { 2715 return true; 2716 } 2717 } 2718 })); 2719 } 2720 2721 for (i = 0; i < len; i++) { 2722 jQuery.find(selector, self[i], ret); 2723 } 2724 2725 // Needed because $( selector, context ) becomes $( context ).find( selector ) 2726 ret = this.pushStack(len > 1 ? jQuery.unique(ret) : ret); 2727 ret.selector = this.selector ? this.selector + " " + selector : selector; 2728 return ret; 2729 }, 2730 filter: function(selector) { 2731 return this.pushStack(winnow(this, selector || [], false)); 2732 }, 2733 not: function(selector) { 2734 return this.pushStack(winnow(this, selector || [], true)); 2735 }, 2736 is: function(selector) { 2737 return !!winnow( 2738 this, 2739 2740 // If this is a positional/relative selector, check membership in the returned set 2741 // so $("p:first").is("p:last") won't return true for a doc with two "p". 2742 typeof selector === "string" && rneedsContext.test(selector) ? 2743 jQuery(selector) : 2744 selector || [], 2745 false 2746 ).length; 2747 } 2748 }); 2749 2750 2751 // Initialize a jQuery object 2752 2753 2754 // A central reference to the root jQuery(document) 2755 var rootjQuery, 2756 2757 // Use the correct document accordingly with window argument (sandbox) 2758 document = window.document, 2759 2760 // A simple way to check for HTML strings 2761 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 2762 // Strict HTML recognition (#11290: must start with <) 2763 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, 2764 2765 init = jQuery.fn.init = function(selector, context) { 2766 var match, elem; 2767 2768 // HANDLE: $(""), $(null), $(undefined), $(false) 2769 if (!selector) { 2770 return this; 2771 } 2772 2773 // Handle HTML strings 2774 if (typeof selector === "string") { 2775 if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) { 2776 // Assume that strings that start and end with <> are HTML and skip the regex check 2777 match = [null, selector, null]; 2778 2779 } else { 2780 match = rquickExpr.exec(selector); 2781 } 2782 2783 // Match html or make sure no context is specified for #id 2784 if (match && (match[1] || !context)) { 2785 2786 // HANDLE: $(html) -> $(array) 2787 if (match[1]) { 2788 context = context instanceof jQuery ? context[0] : context; 2789 2790 // scripts is true for back-compat 2791 // Intentionally let the error be thrown if parseHTML is not present 2792 jQuery.merge(this, jQuery.parseHTML( 2793 match[1], 2794 context && context.nodeType ? context.ownerDocument || context : document, 2795 true 2796 )); 2797 2798 // HANDLE: $(html, props) 2799 if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) { 2800 for (match in context) { 2801 // Properties of context are called as methods if possible 2802 if (jQuery.isFunction(this[match])) { 2803 this[match](context[match]); 2804 2805 // ...and otherwise set as attributes 2806 } else { 2807 this.attr(match, context[match]); 2808 } 2809 } 2810 } 2811 2812 return this; 2813 2814 // HANDLE: $(#id) 2815 } else { 2816 elem = document.getElementById(match[2]); 2817 2818 // Check parentNode to catch when Blackberry 4.6 returns 2819 // nodes that are no longer in the document #6963 2820 if (elem && elem.parentNode) { 2821 // Handle the case where IE and Opera return items 2822 // by name instead of ID 2823 if (elem.id !== match[2]) { 2824 return rootjQuery.find(selector); 2825 } 2826 2827 // Otherwise, we inject the element directly into the jQuery object 2828 this.length = 1; 2829 this[0] = elem; 2830 } 2831 2832 this.context = document; 2833 this.selector = selector; 2834 return this; 2835 } 2836 2837 // HANDLE: $(expr, $(...)) 2838 } else if (!context || context.jquery) { 2839 return (context || rootjQuery).find(selector); 2840 2841 // HANDLE: $(expr, context) 2842 // (which is just equivalent to: $(context).find(expr) 2843 } else { 2844 return this.constructor(context).find(selector); 2845 } 2846 2847 // HANDLE: $(DOMElement) 2848 } else if (selector.nodeType) { 2849 this.context = this[0] = selector; 2850 this.length = 1; 2851 return this; 2852 2853 // HANDLE: $(function) 2854 // Shortcut for document ready 2855 } else if (jQuery.isFunction(selector)) { 2856 return typeof rootjQuery.ready !== "undefined" ? 2857 rootjQuery.ready(selector) : 2858 // Execute immediately if ready is not present 2859 selector(jQuery); 2860 } 2861 2862 if (selector.selector !== undefined) { 2863 this.selector = selector.selector; 2864 this.context = selector.context; 2865 } 2866 2867 return jQuery.makeArray(selector, this); 2868 }; 2869 2870 // Give the init function the jQuery prototype for later instantiation 2871 init.prototype = jQuery.fn; 2872 2873 // Initialize central reference 2874 rootjQuery = jQuery(document); 2875 2876 2877 var rparentsprev = /^(?:parents|prev(?:Until|All))/, 2878 // methods guaranteed to produce a unique set when starting from a unique set 2879 guaranteedUnique = { 2880 children: true, 2881 contents: true, 2882 next: true, 2883 prev: true 2884 }; 2885 2886 jQuery.extend({ 2887 dir: function(elem, dir, until) { 2888 var matched = [], 2889 cur = elem[dir]; 2890 2891 while (cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery(cur).is(until))) { 2892 if (cur.nodeType === 1) { 2893 matched.push(cur); 2894 } 2895 cur = cur[dir]; 2896 } 2897 return matched; 2898 }, 2899 2900 sibling: function(n, elem) { 2901 var r = []; 2902 2903 for (; n; n = n.nextSibling) { 2904 if (n.nodeType === 1 && n !== elem) { 2905 r.push(n); 2906 } 2907 } 2908 2909 return r; 2910 } 2911 }); 2912 2913 jQuery.fn.extend({ 2914 has: function(target) { 2915 var i, 2916 targets = jQuery(target, this), 2917 len = targets.length; 2918 2919 return this.filter(function() { 2920 for (i = 0; i < len; i++) { 2921 if (jQuery.contains(this, targets[i])) { 2922 return true; 2923 } 2924 } 2925 }); 2926 }, 2927 2928 closest: function(selectors, context) { 2929 var cur, 2930 i = 0, 2931 l = this.length, 2932 matched = [], 2933 pos = rneedsContext.test(selectors) || typeof selectors !== "string" ? 2934 jQuery(selectors, context || this.context) : 2935 0; 2936 2937 for (; i < l; i++) { 2938 for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) { 2939 // Always skip document fragments 2940 if (cur.nodeType < 11 && (pos ? 2941 pos.index(cur) > -1 : 2942 2943 // Don't pass non-elements to Sizzle 2944 cur.nodeType === 1 && 2945 jQuery.find.matchesSelector(cur, selectors))) { 2946 2947 matched.push(cur); 2948 break; 2949 } 2950 } 2951 } 2952 2953 return this.pushStack(matched.length > 1 ? jQuery.unique(matched) : matched); 2954 }, 2955 2956 // Determine the position of an element within 2957 // the matched set of elements 2958 index: function(elem) { 2959 2960 // No argument, return index in parent 2961 if (!elem) { 2962 return (this[0] && this[0].parentNode) ? this.first().prevAll().length : -1; 2963 } 2964 2965 // index in selector 2966 if (typeof elem === "string") { 2967 return jQuery.inArray(this[0], jQuery(elem)); 2968 } 2969 2970 // Locate the position of the desired element 2971 return jQuery.inArray( 2972 // If it receives a jQuery object, the first element is used 2973 elem.jquery ? elem[0] : elem, this); 2974 }, 2975 2976 add: function(selector, context) { 2977 return this.pushStack( 2978 jQuery.unique( 2979 jQuery.merge(this.get(), jQuery(selector, context)) 2980 ) 2981 ); 2982 }, 2983 2984 addBack: function(selector) { 2985 return this.add(selector == null ? 2986 this.prevObject : this.prevObject.filter(selector) 2987 ); 2988 } 2989 }); 2990 2991 function sibling(cur, dir) { 2992 do { 2993 cur = cur[dir]; 2994 } while (cur && cur.nodeType !== 1); 2995 2996 return cur; 2997 } 2998 2999 jQuery.each({ 3000 parent: function(elem) { 3001 var parent = elem.parentNode; 3002 return parent && parent.nodeType !== 11 ? parent : null; 3003 }, 3004 parents: function(elem) { 3005 return jQuery.dir(elem, "parentNode"); 3006 }, 3007 parentsUntil: function(elem, i, until) { 3008 return jQuery.dir(elem, "parentNode", until); 3009 }, 3010 next: function(elem) { 3011 return sibling(elem, "nextSibling"); 3012 }, 3013 prev: function(elem) { 3014 return sibling(elem, "previousSibling"); 3015 }, 3016 nextAll: function(elem) { 3017 return jQuery.dir(elem, "nextSibling"); 3018 }, 3019 prevAll: function(elem) { 3020 return jQuery.dir(elem, "previousSibling"); 3021 }, 3022 nextUntil: function(elem, i, until) { 3023 return jQuery.dir(elem, "nextSibling", until); 3024 }, 3025 prevUntil: function(elem, i, until) { 3026 return jQuery.dir(elem, "previousSibling", until); 3027 }, 3028 siblings: function(elem) { 3029 return jQuery.sibling((elem.parentNode || {}).firstChild, elem); 3030 }, 3031 children: function(elem) { 3032 return jQuery.sibling(elem.firstChild); 3033 }, 3034 contents: function(elem) { 3035 return jQuery.nodeName(elem, "iframe") ? 3036 elem.contentDocument || elem.contentWindow.document : 3037 jQuery.merge([], elem.childNodes); 3038 } 3039 }, function(name, fn) { 3040 jQuery.fn[name] = function(until, selector) { 3041 var ret = jQuery.map(this, fn, until); 3042 3043 if (name.slice(-5) !== "Until") { 3044 selector = until; 3045 } 3046 3047 if (selector && typeof selector === "string") { 3048 ret = jQuery.filter(selector, ret); 3049 } 3050 3051 if (this.length > 1) { 3052 // Remove duplicates 3053 if (!guaranteedUnique[name]) { 3054 ret = jQuery.unique(ret); 3055 } 3056 3057 // Reverse order for parents* and prev-derivatives 3058 if (rparentsprev.test(name)) { 3059 ret = ret.reverse(); 3060 } 3061 } 3062 3063 return this.pushStack(ret); 3064 }; 3065 }); 3066 var rnotwhite = (/\S+/g); 3067 3068 3069 3070 // String to Object options format cache 3071 var optionsCache = {}; 3072 3073 // Convert String-formatted options into Object-formatted ones and store in cache 3074 3075 function createOptions(options) { 3076 var object = optionsCache[options] = {}; 3077 jQuery.each(options.match(rnotwhite) || [], function(_, flag) { 3078 object[flag] = true; 3079 }); 3080 return object; 3081 } 3082 3083 /* 3084 * Create a callback list using the following parameters: 3085 * 3086 * options: an optional list of space-separated options that will change how 3087 * the callback list behaves or a more traditional option object 3088 * 3089 * By default a callback list will act like an event callback list and can be 3090 * "fired" multiple times. 3091 * 3092 * Possible options: 3093 * 3094 * once: will ensure the callback list can only be fired once (like a Deferred) 3095 * 3096 * memory: will keep track of previous values and will call any callback added 3097 * after the list has been fired right away with the latest "memorized" 3098 * values (like a Deferred) 3099 * 3100 * unique: will ensure a callback can only be added once (no duplicate in the list) 3101 * 3102 * stopOnFalse: interrupt callings when a callback returns false 3103 * 3104 */ 3105 jQuery.Callbacks = function(options) { 3106 3107 // Convert options from String-formatted to Object-formatted if needed 3108 // (we check in cache first) 3109 options = typeof options === "string" ? 3110 (optionsCache[options] || createOptions(options)) : 3111 jQuery.extend({}, options); 3112 3113 var // Flag to know if list is currently firing 3114 firing, 3115 // Last fire value (for non-forgettable lists) 3116 memory, 3117 // Flag to know if list was already fired 3118 fired, 3119 // End of the loop when firing 3120 firingLength, 3121 // Index of currently firing callback (modified by remove if needed) 3122 firingIndex, 3123 // First callback to fire (used internally by add and fireWith) 3124 firingStart, 3125 // Actual callback list 3126 list = [], 3127 // Stack of fire calls for repeatable lists 3128 stack = !options.once && [], 3129 // Fire callbacks 3130 fire = function(data) { 3131 memory = options.memory && data; 3132 fired = true; 3133 firingIndex = firingStart || 0; 3134 firingStart = 0; 3135 firingLength = list.length; 3136 firing = true; 3137 for (; list && firingIndex < firingLength; firingIndex++) { 3138 if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) { 3139 memory = false; // To prevent further calls using add 3140 break; 3141 } 3142 } 3143 firing = false; 3144 if (list) { 3145 if (stack) { 3146 if (stack.length) { 3147 fire(stack.shift()); 3148 } 3149 } else if (memory) { 3150 list = []; 3151 } else { 3152 self.disable(); 3153 } 3154 } 3155 }, 3156 // Actual Callbacks object 3157 self = { 3158 // Add a callback or a collection of callbacks to the list 3159 add: function() { 3160 if (list) { 3161 // First, we save the current length 3162 var start = list.length; 3163 (function add(args) { 3164 jQuery.each(args, function(_, arg) { 3165 var type = jQuery.type(arg); 3166 if (type === "function") { 3167 if (!options.unique || !self.has(arg)) { 3168 list.push(arg); 3169 } 3170 } else if (arg && arg.length && type !== "string") { 3171 // Inspect recursively 3172 add(arg); 3173 } 3174 }); 3175 })(arguments); 3176 // Do we need to add the callbacks to the 3177 // current firing batch? 3178 if (firing) { 3179 firingLength = list.length; 3180 // With memory, if we're not firing then 3181 // we should call right away 3182 } else if (memory) { 3183 firingStart = start; 3184 fire(memory); 3185 } 3186 } 3187 return this; 3188 }, 3189 // Remove a callback from the list 3190 remove: function() { 3191 if (list) { 3192 jQuery.each(arguments, function(_, arg) { 3193 var index; 3194 while ((index = jQuery.inArray(arg, list, index)) > -1) { 3195 list.splice(index, 1); 3196 // Handle firing indexes 3197 if (firing) { 3198 if (index <= firingLength) { 3199 firingLength--; 3200 } 3201 if (index <= firingIndex) { 3202 firingIndex--; 3203 } 3204 } 3205 } 3206 }); 3207 } 3208 return this; 3209 }, 3210 // Check if a given callback is in the list. 3211 // If no argument is given, return whether or not list has callbacks attached. 3212 has: function(fn) { 3213 return fn ? jQuery.inArray(fn, list) > -1 : !! (list && list.length); 3214 }, 3215 // Remove all callbacks from the list 3216 empty: function() { 3217 list = []; 3218 firingLength = 0; 3219 return this; 3220 }, 3221 // Have the list do nothing anymore 3222 disable: function() { 3223 list = stack = memory = undefined; 3224 return this; 3225 }, 3226 // Is it disabled? 3227 disabled: function() { 3228 return !list; 3229 }, 3230 // Lock the list in its current state 3231 lock: function() { 3232 stack = undefined; 3233 if (!memory) { 3234 self.disable(); 3235 } 3236 return this; 3237 }, 3238 // Is it locked? 3239 locked: function() { 3240 return !stack; 3241 }, 3242 // Call all callbacks with the given context and arguments 3243 fireWith: function(context, args) { 3244 if (list && (!fired || stack)) { 3245 args = args || []; 3246 args = [context, args.slice ? args.slice() : args]; 3247 if (firing) { 3248 stack.push(args); 3249 } else { 3250 fire(args); 3251 } 3252 } 3253 return this; 3254 }, 3255 // Call all the callbacks with the given arguments 3256 fire: function() { 3257 self.fireWith(this, arguments); 3258 return this; 3259 }, 3260 // To know if the callbacks have already been called at least once 3261 fired: function() { 3262 return !!fired; 3263 } 3264 }; 3265 3266 return self; 3267 }; 3268 3269 3270 jQuery.extend({ 3271 3272 Deferred: function(func) { 3273 var tuples = [ 3274 // action, add listener, listener list, final state 3275 ["resolve", "done", jQuery.Callbacks("once memory"), "resolved"], 3276 ["reject", "fail", jQuery.Callbacks("once memory"), "rejected"], 3277 ["notify", "progress", jQuery.Callbacks("memory")] 3278 ], 3279 state = "pending", 3280 promise = { 3281 state: function() { 3282 return state; 3283 }, 3284 always: function() { 3285 deferred.done(arguments).fail(arguments); 3286 return this; 3287 }, 3288 then: function( /* fnDone, fnFail, fnProgress */ ) { 3289 var fns = arguments; 3290 return jQuery.Deferred(function(newDefer) { 3291 jQuery.each(tuples, function(i, tuple) { 3292 var fn = jQuery.isFunction(fns[i]) && fns[i]; 3293 // deferred[ done | fail | progress ] for forwarding actions to newDefer 3294 deferred[tuple[1]](function() { 3295 var returned = fn && fn.apply(this, arguments); 3296 if (returned && jQuery.isFunction(returned.promise)) { 3297 returned.promise() 3298 .done(newDefer.resolve) 3299 .fail(newDefer.reject) 3300 .progress(newDefer.notify); 3301 } else { 3302 newDefer[tuple[0] + "With"](this === promise ? newDefer.promise() : this, fn ? [returned] : arguments); 3303 } 3304 }); 3305 }); 3306 fns = null; 3307 }).promise(); 3308 }, 3309 // Get a promise for this deferred 3310 // If obj is provided, the promise aspect is added to the object 3311 promise: function(obj) { 3312 return obj != null ? jQuery.extend(obj, promise) : promise; 3313 } 3314 }, 3315 deferred = {}; 3316 3317 // Keep pipe for back-compat 3318 promise.pipe = promise.then; 3319 3320 // Add list-specific methods 3321 jQuery.each(tuples, function(i, tuple) { 3322 var list = tuple[2], 3323 stateString = tuple[3]; 3324 3325 // promise[ done | fail | progress ] = list.add 3326 promise[tuple[1]] = list.add; 3327 3328 // Handle state 3329 if (stateString) { 3330 list.add(function() { 3331 // state = [ resolved | rejected ] 3332 state = stateString; 3333 3334 // [ reject_list | resolve_list ].disable; progress_list.lock 3335 }, tuples[i ^ 1][2].disable, tuples[2][2].lock); 3336 } 3337 3338 // deferred[ resolve | reject | notify ] 3339 deferred[tuple[0]] = function() { 3340 deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments); 3341 return this; 3342 }; 3343 deferred[tuple[0] + "With"] = list.fireWith; 3344 }); 3345 3346 // Make the deferred a promise 3347 promise.promise(deferred); 3348 3349 // Call given func if any 3350 if (func) { 3351 func.call(deferred, deferred); 3352 } 3353 3354 // All done! 3355 return deferred; 3356 }, 3357 3358 // Deferred helper 3359 when: function(subordinate /* , ..., subordinateN */ ) { 3360 var i = 0, 3361 resolveValues = slice.call(arguments), 3362 length = resolveValues.length, 3363 3364 // the count of uncompleted subordinates 3365 remaining = length !== 1 || (subordinate && jQuery.isFunction(subordinate.promise)) ? length : 0, 3366 3367 // the master Deferred. If resolveValues consist of only a single Deferred, just use that. 3368 deferred = remaining === 1 ? subordinate : jQuery.Deferred(), 3369 3370 // Update function for both resolve and progress values 3371 updateFunc = function(i, contexts, values) { 3372 return function(value) { 3373 contexts[i] = this; 3374 values[i] = arguments.length > 1 ? slice.call(arguments) : value; 3375 if (values === progressValues) { 3376 deferred.notifyWith(contexts, values); 3377 3378 } else if (!(--remaining)) { 3379 deferred.resolveWith(contexts, values); 3380 } 3381 }; 3382 }, 3383 3384 progressValues, progressContexts, resolveContexts; 3385 3386 // add listeners to Deferred subordinates; treat others as resolved 3387 if (length > 1) { 3388 progressValues = new Array(length); 3389 progressContexts = new Array(length); 3390 resolveContexts = new Array(length); 3391 for (; i < length; i++) { 3392 if (resolveValues[i] && jQuery.isFunction(resolveValues[i].promise)) { 3393 resolveValues[i].promise() 3394 .done(updateFunc(i, resolveContexts, resolveValues)) 3395 .fail(deferred.reject) 3396 .progress(updateFunc(i, progressContexts, progressValues)); 3397 } else { 3398 --remaining; 3399 } 3400 } 3401 } 3402 3403 // if we're not waiting on anything, resolve the master 3404 if (!remaining) { 3405 deferred.resolveWith(resolveContexts, resolveValues); 3406 } 3407 3408 return deferred.promise(); 3409 } 3410 }); 3411 3412 3413 // The deferred used on DOM ready 3414 var readyList; 3415 3416 jQuery.fn.ready = function(fn) { 3417 if (jQuery.isReady) { 3418 // jQuery.readyæ¹æ³å¨DOMContentLoadedåæ·»å äºä¸ä¼æ§è¡.jQuery.isReadyæ è¯DOM is ready,æå¯è½ä¼æholdReadyæ åµ,使¯DOM is ready,åç»åæ·»å æ¹æ³è¿æ¯ä¸æ§è¡ 3419 // bigRenderä¸ç卿巿°ç»ä»¶html代ç ä¸éè¦æ¯æjQuery.ready,æ¤å¤å¤çä¸DOMContentLoadedåçjQuery.readyæ¹æ³,ç´æ¥æ§è¡ 3420 // console.log('hackReady fn ' + fn); 3421 fn.apply(document, [jQuery]); 3422 return this; 3423 } 3424 // Add the callback 3425 jQuery.ready.promise().done(fn); 3426 3427 return this; 3428 }; 3429 3430 jQuery.extend({ 3431 // Is the DOM ready to be used? Set to true once it occurs. 3432 isReady: false, 3433 3434 // A counter to track how many items to wait for before 3435 // the ready event fires. See #6781 3436 readyWait: 1, 3437 3438 // Hold (or release) the ready event 3439 holdReady: function(hold) { 3440 if (hold) { 3441 jQuery.readyWait++; 3442 } else { 3443 jQuery.ready(true); 3444 } 3445 }, 3446 3447 // Handle when the DOM is ready 3448 ready: function(wait) { 3449 3450 // Abort if there are pending holds or we're already ready 3451 if (wait === true ? --jQuery.readyWait : jQuery.isReady) { 3452 return; 3453 } 3454 3455 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 3456 if (!document.body) { 3457 return setTimeout(jQuery.ready); 3458 } 3459 3460 // Remember that the DOM is ready 3461 jQuery.isReady = true; 3462 3463 // If a normal DOM Ready event fired, decrement, and wait if need be 3464 if (wait !== true && --jQuery.readyWait > 0) { 3465 return; 3466 } 3467 3468 // If there are functions bound, to execute 3469 readyList.resolveWith(document, [jQuery]); 3470 3471 // Trigger any bound ready events 3472 if (jQuery.fn.trigger) { 3473 jQuery(document).trigger("ready").off("ready"); 3474 } 3475 } 3476 }); 3477 3478 /** 3479 * Clean-up method for dom ready events 3480 */ 3481 3482 function detach() { 3483 if (document.addEventListener) { 3484 document.removeEventListener("DOMContentLoaded", completed, false); 3485 window.removeEventListener("load", completed, false); 3486 3487 } else { 3488 document.detachEvent("onreadystatechange", completed); 3489 window.detachEvent("onload", completed); 3490 } 3491 } 3492 3493 /** 3494 * The ready event handler and self cleanup method 3495 */ 3496 3497 function completed() { 3498 // readyState === "complete" is good enough for us to call the dom ready in oldIE 3499 if (document.addEventListener || event.type === "load" || document.readyState === "complete") { 3500 detach(); 3501 jQuery.ready(); 3502 } 3503 } 3504 3505 jQuery.ready.promise = function(obj) { 3506 if (!readyList) { 3507 3508 readyList = jQuery.Deferred(); 3509 3510 // Catch cases where $(document).ready() is called after the browser event has already occurred. 3511 // we once tried to use readyState "interactive" here, but it caused issues like the one 3512 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 3513 if (document.readyState === "complete") { 3514 // Handle it asynchronously to allow scripts the opportunity to delay ready 3515 setTimeout(jQuery.ready); 3516 3517 // Standards-based browsers support DOMContentLoaded 3518 } else if (document.addEventListener) { 3519 // Use the handy event callback 3520 document.addEventListener("DOMContentLoaded", completed, false); 3521 3522 // A fallback to window.onload, that will always work 3523 window.addEventListener("load", completed, false); 3524 3525 // If IE event model is used 3526 } else { 3527 // Ensure firing before onload, maybe late but safe also for iframes 3528 document.attachEvent("onreadystatechange", completed); 3529 3530 // A fallback to window.onload, that will always work 3531 window.attachEvent("onload", completed); 3532 3533 // If IE and not a frame 3534 // continually check to see if the document is ready 3535 var top = false; 3536 3537 try { 3538 top = window.frameElement == null && document.documentElement; 3539 } catch (e) {} 3540 3541 if (top && top.doScroll) { 3542 (function doScrollCheck() { 3543 if (!jQuery.isReady) { 3544 3545 try { 3546 // Use the trick by Diego Perini 3547 // http://javascript.nwbox.com/IEContentLoaded/ 3548 top.doScroll("left"); 3549 } catch (e) { 3550 return setTimeout(doScrollCheck, 50); 3551 } 3552 3553 // detach all dom ready events 3554 detach(); 3555 3556 // and execute any waiting functions 3557 jQuery.ready(); 3558 } 3559 })(); 3560 } 3561 } 3562 } 3563 return readyList.promise(obj); 3564 }; 3565 3566 3567 var strundefined = typeof undefined; 3568 3569 3570 3571 // Support: IE<9 3572 // Iteration over object's inherited properties before its own 3573 var i; 3574 for (i in jQuery(support)) { 3575 break; 3576 } 3577 support.ownLast = i !== "0"; 3578 3579 // Note: most support tests are defined in their respective modules. 3580 // false until the test is run 3581 support.inlineBlockNeedsLayout = false; 3582 3583 jQuery(function() { 3584 // We need to execute this one support test ASAP because we need to know 3585 // if body.style.zoom needs to be set. 3586 3587 var container, div, 3588 body = document.getElementsByTagName("body")[0]; 3589 3590 if (!body) { 3591 // Return for frameset docs that don't have a body 3592 return; 3593 } 3594 3595 // Setup 3596 container = document.createElement("div"); 3597 container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; 3598 3599 div = document.createElement("div"); 3600 body.appendChild(container).appendChild(div); 3601 3602 if (typeof div.style.zoom !== strundefined) { 3603 // Support: IE<8 3604 // Check if natively block-level elements act like inline-block 3605 // elements when setting their display to 'inline' and giving 3606 // them layout 3607 div.style.cssText = "border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1"; 3608 3609 if ((support.inlineBlockNeedsLayout = (div.offsetWidth === 3))) { 3610 // Prevent IE 6 from affecting layout for positioned elements #11048 3611 // Prevent IE from shrinking the body in IE 7 mode #12869 3612 // Support: IE<8 3613 body.style.zoom = 1; 3614 } 3615 } 3616 3617 body.removeChild(container); 3618 3619 // Null elements to avoid leaks in IE 3620 container = div = null; 3621 }); 3622 3623 3624 3625 (function() { 3626 var div = document.createElement("div"); 3627 3628 // Execute the test only if not already executed in another module. 3629 if (support.deleteExpando == null) { 3630 // Support: IE<9 3631 support.deleteExpando = true; 3632 try { 3633 delete div.test; 3634 } catch (e) { 3635 support.deleteExpando = false; 3636 } 3637 } 3638 3639 // Null elements to avoid leaks in IE. 3640 div = null; 3641 })(); 3642 3643 3644 /** 3645 * Determines whether an object can have data 3646 */ 3647 jQuery.acceptData = function(elem) { 3648 var noData = jQuery.noData[(elem.nodeName + " ").toLowerCase()], 3649 nodeType = +elem.nodeType || 1; 3650 3651 // Do not set data on non-element DOM nodes because it will not be cleared (#8335). 3652 return nodeType !== 1 && nodeType !== 9 ? 3653 false : 3654 3655 // Nodes accept data unless otherwise specified; rejection can be conditional 3656 !noData || noData !== true && elem.getAttribute("classid") === noData; 3657 }; 3658 3659 3660 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 3661 rmultiDash = /([A-Z])/g; 3662 3663 function dataAttr(elem, key, data) { 3664 // If nothing was found internally, try to fetch any 3665 // data from the HTML5 data-* attribute 3666 if (data === undefined && elem.nodeType === 1) { 3667 3668 var name = "data-" + key.replace(rmultiDash, "-$1").toLowerCase(); 3669 3670 data = elem.getAttribute(name); 3671 3672 if (typeof data === "string") { 3673 try { 3674 data = data === "true" ? true : 3675 data === "false" ? false : 3676 data === "null" ? null : 3677 // Only convert to a number if it doesn't change the string 3678 +data + "" === data ? +data : 3679 rbrace.test(data) ? jQuery.parseJSON(data) : 3680 data; 3681 } catch (e) {} 3682 3683 // Make sure we set the data so it isn't changed later 3684 jQuery.data(elem, key, data); 3685 3686 } else { 3687 data = undefined; 3688 } 3689 } 3690 3691 return data; 3692 } 3693 3694 // checks a cache object for emptiness 3695 3696 function isEmptyDataObject(obj) { 3697 var name; 3698 for (name in obj) { 3699 3700 // if the public data object is empty, the private is still empty 3701 if (name === "data" && jQuery.isEmptyObject(obj[name])) { 3702 continue; 3703 } 3704 if (name !== "toJSON") { 3705 return false; 3706 } 3707 } 3708 3709 return true; 3710 } 3711 3712 function internalData(elem, name, data, pvt /* Internal Use Only */ ) { 3713 if (!jQuery.acceptData(elem)) { 3714 return; 3715 } 3716 3717 var ret, thisCache, 3718 internalKey = jQuery.expando, 3719 3720 // We have to handle DOM nodes and JS objects differently because IE6-7 3721 // can't GC object references properly across the DOM-JS boundary 3722 isNode = elem.nodeType, 3723 3724 // Only DOM nodes need the global jQuery cache; JS object data is 3725 // attached directly to the object so GC can occur automatically 3726 cache = isNode ? jQuery.cache : elem, 3727 3728 // Only defining an ID for JS objects if its cache already exists allows 3729 // the code to shortcut on the same path as a DOM node with no cache 3730 id = isNode ? elem[internalKey] : elem[internalKey] && internalKey; 3731 3732 // Avoid doing any more work than we need to when trying to get data on an 3733 // object that has no data at all 3734 if ((!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string") { 3735 return; 3736 } 3737 3738 if (!id) { 3739 // Only DOM nodes need a new unique ID for each element since their data 3740 // ends up in the global cache 3741 if (isNode) { 3742 id = elem[internalKey] = deletedIds.pop() || jQuery.guid++; 3743 } else { 3744 id = internalKey; 3745 } 3746 } 3747 3748 if (!cache[id]) { 3749 // Avoid exposing jQuery metadata on plain JS objects when the object 3750 // is serialized using JSON.stringify 3751 cache[id] = isNode ? {} : { 3752 toJSON: jQuery.noop 3753 }; 3754 } 3755 3756 // An object can be passed to jQuery.data instead of a key/value pair; this gets 3757 // shallow copied over onto the existing cache 3758 if (typeof name === "object" || typeof name === "function") { 3759 if (pvt) { 3760 cache[id] = jQuery.extend(cache[id], name); 3761 } else { 3762 cache[id].data = jQuery.extend(cache[id].data, name); 3763 } 3764 } 3765 3766 thisCache = cache[id]; 3767 3768 // jQuery data() is stored in a separate object inside the object's internal data 3769 // cache in order to avoid key collisions between internal data and user-defined 3770 // data. 3771 if (!pvt) { 3772 if (!thisCache.data) { 3773 thisCache.data = {}; 3774 } 3775 3776 thisCache = thisCache.data; 3777 } 3778 3779 if (data !== undefined) { 3780 thisCache[jQuery.camelCase(name)] = data; 3781 } 3782 3783 // Check for both converted-to-camel and non-converted data property names 3784 // If a data property was specified 3785 if (typeof name === "string") { 3786 3787 // First Try to find as-is property data 3788 ret = thisCache[name]; 3789 3790 // Test for null|undefined property data 3791 if (ret == null) { 3792 3793 // Try to find the camelCased property 3794 ret = thisCache[jQuery.camelCase(name)]; 3795 } 3796 } else { 3797 ret = thisCache; 3798 } 3799 3800 return ret; 3801 } 3802 3803 function internalRemoveData(elem, name, pvt) { 3804 if (!jQuery.acceptData(elem)) { 3805 return; 3806 } 3807 3808 var thisCache, i, 3809 isNode = elem.nodeType, 3810 3811 // See jQuery.data for more information 3812 cache = isNode ? jQuery.cache : elem, 3813 id = isNode ? elem[jQuery.expando] : jQuery.expando; 3814 3815 // If there is already no cache entry for this object, there is no 3816 // purpose in continuing 3817 if (!cache[id]) { 3818 return; 3819 } 3820 3821 if (name) { 3822 3823 thisCache = pvt ? cache[id] : cache[id].data; 3824 3825 if (thisCache) { 3826 3827 // Support array or space separated string names for data keys 3828 if (!jQuery.isArray(name)) { 3829 3830 // try the string as a key before any manipulation 3831 if (name in thisCache) { 3832 name = [name]; 3833 } else { 3834 3835 // split the camel cased version by spaces unless a key with the spaces exists 3836 name = jQuery.camelCase(name); 3837 if (name in thisCache) { 3838 name = [name]; 3839 } else { 3840 name = name.split(" "); 3841 } 3842 } 3843 } else { 3844 // If "name" is an array of keys... 3845 // When data is initially created, via ("key", "val") signature, 3846 // keys will be converted to camelCase. 3847 // Since there is no way to tell _how_ a key was added, remove 3848 // both plain key and camelCase key. #12786 3849 // This will only penalize the array argument path. 3850 name = name.concat(jQuery.map(name, jQuery.camelCase)); 3851 } 3852 3853 i = name.length; 3854 while (i--) { 3855 delete thisCache[name[i]]; 3856 } 3857 3858 // If there is no data left in the cache, we want to continue 3859 // and let the cache object itself get destroyed 3860 if (pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache)) { 3861 return; 3862 } 3863 } 3864 } 3865 3866 // See jQuery.data for more information 3867 if (!pvt) { 3868 delete cache[id].data; 3869 3870 // Don't destroy the parent cache unless the internal data object 3871 // had been the only thing left in it 3872 if (!isEmptyDataObject(cache[id])) { 3873 return; 3874 } 3875 } 3876 3877 // Destroy the cache 3878 if (isNode) { 3879 jQuery.cleanData([elem], true); 3880 3881 // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) 3882 /* jshint eqeqeq: false */ 3883 } else if (support.deleteExpando || cache != cache.window) { 3884 /* jshint eqeqeq: true */ 3885 delete cache[id]; 3886 3887 // When all else fails, null 3888 } else { 3889 cache[id] = null; 3890 } 3891 } 3892 3893 jQuery.extend({ 3894 cache: {}, 3895 3896 // The following elements (space-suffixed to avoid Object.prototype collisions) 3897 // throw uncatchable exceptions if you attempt to set expando properties 3898 noData: { 3899 "applet ": true, 3900 "embed ": true, 3901 // ...but Flash objects (which have this classid) *can* handle expandos 3902 "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 3903 }, 3904 3905 hasData: function(elem) { 3906 elem = elem.nodeType ? jQuery.cache[elem[jQuery.expando]] : elem[jQuery.expando]; 3907 return !!elem && !isEmptyDataObject(elem); 3908 }, 3909 3910 data: function(elem, name, data) { 3911 return internalData(elem, name, data); 3912 }, 3913 3914 removeData: function(elem, name) { 3915 return internalRemoveData(elem, name); 3916 }, 3917 3918 // For internal use only. 3919 _data: function(elem, name, data) { 3920 return internalData(elem, name, data, true); 3921 }, 3922 3923 _removeData: function(elem, name) { 3924 return internalRemoveData(elem, name, true); 3925 } 3926 }); 3927 3928 jQuery.fn.extend({ 3929 data: function(key, value) { 3930 var i, name, data, 3931 elem = this[0], 3932 attrs = elem && elem.attributes; 3933 3934 // Special expections of .data basically thwart jQuery.access, 3935 // so implement the relevant behavior ourselves 3936 3937 // Gets all values 3938 if (key === undefined) { 3939 if (this.length) { 3940 data = jQuery.data(elem); 3941 3942 if (elem.nodeType === 1 && !jQuery._data(elem, "parsedAttrs")) { 3943 i = attrs.length; 3944 while (i--) { 3945 name = attrs[i].name; 3946 3947 if (name.indexOf("data-") === 0) { 3948 name = jQuery.camelCase(name.slice(5)); 3949 3950 dataAttr(elem, name, data[name]); 3951 } 3952 } 3953 jQuery._data(elem, "parsedAttrs", true); 3954 } 3955 } 3956 3957 return data; 3958 } 3959 3960 // Sets multiple values 3961 if (typeof key === "object") { 3962 return this.each(function() { 3963 jQuery.data(this, key); 3964 }); 3965 } 3966 3967 return arguments.length > 1 ? 3968 3969 // Sets one value 3970 this.each(function() { 3971 jQuery.data(this, key, value); 3972 }) : 3973 3974 // Gets one value 3975 // Try to fetch any internally stored data first 3976 elem ? dataAttr(elem, key, jQuery.data(elem, key)) : undefined; 3977 }, 3978 3979 removeData: function(key) { 3980 return this.each(function() { 3981 jQuery.removeData(this, key); 3982 }); 3983 } 3984 }); 3985 3986 3987 jQuery.extend({ 3988 queue: function(elem, type, data) { 3989 var queue; 3990 3991 if (elem) { 3992 type = (type || "fx") + "queue"; 3993 queue = jQuery._data(elem, type); 3994 3995 // Speed up dequeue by getting out quickly if this is just a lookup 3996 if (data) { 3997 if (!queue || jQuery.isArray(data)) { 3998 queue = jQuery._data(elem, type, jQuery.makeArray(data)); 3999 } else { 4000 queue.push(data); 4001 } 4002 } 4003 return queue || []; 4004 } 4005 }, 4006 4007 dequeue: function(elem, type) { 4008 type = type || "fx"; 4009 4010 var queue = jQuery.queue(elem, type), 4011 startLength = queue.length, 4012 fn = queue.shift(), 4013 hooks = jQuery._queueHooks(elem, type), 4014 next = function() { 4015 jQuery.dequeue(elem, type); 4016 }; 4017 4018 // If the fx queue is dequeued, always remove the progress sentinel 4019 if (fn === "inprogress") { 4020 fn = queue.shift(); 4021 startLength--; 4022 } 4023 4024 if (fn) { 4025 4026 // Add a progress sentinel to prevent the fx queue from being 4027 // automatically dequeued 4028 if (type === "fx") { 4029 queue.unshift("inprogress"); 4030 } 4031 4032 // clear up the last queue stop function 4033 delete hooks.stop; 4034 fn.call(elem, next, hooks); 4035 } 4036 4037 if (!startLength && hooks) { 4038 hooks.empty.fire(); 4039 } 4040 }, 4041 4042 // not intended for public consumption - generates a queueHooks object, or returns the current one 4043 _queueHooks: function(elem, type) { 4044 var key = type + "queueHooks"; 4045 return jQuery._data(elem, key) || jQuery._data(elem, key, { 4046 empty: jQuery.Callbacks("once memory").add(function() { 4047 jQuery._removeData(elem, type + "queue"); 4048 jQuery._removeData(elem, key); 4049 }) 4050 }); 4051 } 4052 }); 4053 4054 jQuery.fn.extend({ 4055 queue: function(type, data) { 4056 var setter = 2; 4057 4058 if (typeof type !== "string") { 4059 data = type; 4060 type = "fx"; 4061 setter--; 4062 } 4063 4064 if (arguments.length < setter) { 4065 return jQuery.queue(this[0], type); 4066 } 4067 4068 return data === undefined ? 4069 this : 4070 this.each(function() { 4071 var queue = jQuery.queue(this, type, data); 4072 4073 // ensure a hooks for this queue 4074 jQuery._queueHooks(this, type); 4075 4076 if (type === "fx" && queue[0] !== "inprogress") { 4077 jQuery.dequeue(this, type); 4078 } 4079 }); 4080 }, 4081 dequeue: function(type) { 4082 return this.each(function() { 4083 jQuery.dequeue(this, type); 4084 }); 4085 }, 4086 clearQueue: function(type) { 4087 return this.queue(type || "fx", []); 4088 }, 4089 // Get a promise resolved when queues of a certain type 4090 // are emptied (fx is the type by default) 4091 promise: function(type, obj) { 4092 var tmp, 4093 count = 1, 4094 defer = jQuery.Deferred(), 4095 elements = this, 4096 i = this.length, 4097 resolve = function() { 4098 if (!(--count)) { 4099 defer.resolveWith(elements, [elements]); 4100 } 4101 }; 4102 4103 if (typeof type !== "string") { 4104 obj = type; 4105 type = undefined; 4106 } 4107 type = type || "fx"; 4108 4109 while (i--) { 4110 tmp = jQuery._data(elements[i], type + "queueHooks"); 4111 if (tmp && tmp.empty) { 4112 count++; 4113 tmp.empty.add(resolve); 4114 } 4115 } 4116 resolve(); 4117 return defer.promise(obj); 4118 } 4119 }); 4120 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; 4121 4122 var cssExpand = ["Top", "Right", "Bottom", "Left"]; 4123 4124 var isHidden = function(elem, el) { 4125 // isHidden might be called from jQuery#filter function; 4126 // in that case, element will be second argument 4127 elem = el || elem; 4128 return jQuery.css(elem, "display") === "none" || !jQuery.contains(elem.ownerDocument, elem); 4129 }; 4130 4131 4132 4133 // Multifunctional method to get and set values of a collection 4134 // The value/s can optionally be executed if it's a function 4135 var access = jQuery.access = function(elems, fn, key, value, chainable, emptyGet, raw) { 4136 var i = 0, 4137 length = elems.length, 4138 bulk = key == null; 4139 4140 // Sets many values 4141 if (jQuery.type(key) === "object") { 4142 chainable = true; 4143 for (i in key) { 4144 jQuery.access(elems, fn, i, key[i], true, emptyGet, raw); 4145 } 4146 4147 // Sets one value 4148 } else if (value !== undefined) { 4149 chainable = true; 4150 4151 if (!jQuery.isFunction(value)) { 4152 raw = true; 4153 } 4154 4155 if (bulk) { 4156 // Bulk operations run against the entire set 4157 if (raw) { 4158 fn.call(elems, value); 4159 fn = null; 4160 4161 // ...except when executing function values 4162 } else { 4163 bulk = fn; 4164 fn = function(elem, key, value) { 4165 return bulk.call(jQuery(elem), value); 4166 }; 4167 } 4168 } 4169 4170 if (fn) { 4171 for (; i < length; i++) { 4172 fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key))); 4173 } 4174 } 4175 } 4176 4177 return chainable ? 4178 elems : 4179 4180 // Gets 4181 bulk ? 4182 fn.call(elems) : 4183 length ? fn(elems[0], key) : emptyGet; 4184 }; 4185 var rcheckableType = (/^(?:checkbox|radio)$/i); 4186 4187 4188 4189 (function() { 4190 var fragment = document.createDocumentFragment(), 4191 div = document.createElement("div"), 4192 input = document.createElement("input"); 4193 4194 // Setup 4195 div.setAttribute("className", "t"); 4196 div.innerHTML = " <link/><table></table><a href='/a'>a</a>"; 4197 4198 // IE strips leading whitespace when .innerHTML is used 4199 support.leadingWhitespace = div.firstChild.nodeType === 3; 4200 4201 // Make sure that tbody elements aren't automatically inserted 4202 // IE will insert them into empty tables 4203 support.tbody = !div.getElementsByTagName("tbody").length; 4204 4205 // Make sure that link elements get serialized correctly by innerHTML 4206 // This requires a wrapper element in IE 4207 support.htmlSerialize = !! div.getElementsByTagName("link").length; 4208 4209 // Makes sure cloning an html5 element does not cause problems 4210 // Where outerHTML is undefined, this still works 4211 support.html5Clone = 4212 document.createElement("nav").cloneNode(true).outerHTML !== "<:nav></:nav>"; 4213 4214 // Check if a disconnected checkbox will retain its checked 4215 // value of true after appended to the DOM (IE6/7) 4216 input.type = "checkbox"; 4217 input.checked = true; 4218 fragment.appendChild(input); 4219 support.appendChecked = input.checked; 4220 4221 // Make sure textarea (and checkbox) defaultValue is properly cloned 4222 // Support: IE6-IE11+ 4223 div.innerHTML = "<textarea>x</textarea>"; 4224 support.noCloneChecked = !! div.cloneNode(true).lastChild.defaultValue; 4225 4226 // #11217 - WebKit loses check when the name is after the checked attribute 4227 fragment.appendChild(div); 4228 div.innerHTML = "<input type='radio' checked='checked' name='t'/>"; 4229 4230 // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 4231 // old WebKit doesn't clone checked state correctly in fragments 4232 support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked; 4233 4234 // Support: IE<9 4235 // Opera does not clone events (and typeof div.attachEvent === undefined). 4236 // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() 4237 support.noCloneEvent = true; 4238 if (div.attachEvent) { 4239 div.attachEvent("onclick", function() { 4240 support.noCloneEvent = false; 4241 }); 4242 4243 div.cloneNode(true).click(); 4244 } 4245 4246 // Execute the test only if not already executed in another module. 4247 if (support.deleteExpando == null) { 4248 // Support: IE<9 4249 support.deleteExpando = true; 4250 try { 4251 delete div.test; 4252 } catch (e) { 4253 support.deleteExpando = false; 4254 } 4255 } 4256 4257 // Null elements to avoid leaks in IE. 4258 fragment = div = input = null; 4259 })(); 4260 4261 4262 (function() { 4263 var i, eventName, 4264 div = document.createElement("div"); 4265 4266 // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) 4267 for (i in { 4268 submit: true, 4269 change: true, 4270 focusin: true 4271 }) { 4272 eventName = "on" + i; 4273 4274 if (!(support[i + "Bubbles"] = eventName in window)) { 4275 // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) 4276 div.setAttribute(eventName, "t"); 4277 support[i + "Bubbles"] = div.attributes[eventName].expando === false; 4278 } 4279 } 4280 4281 // Null elements to avoid leaks in IE. 4282 div = null; 4283 })(); 4284 4285 4286 var rformElems = /^(?:input|select|textarea)$/i, 4287 rkeyEvent = /^key/, 4288 rmouseEvent = /^(?:mouse|contextmenu)|click/, 4289 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 4290 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; 4291 4292 function returnTrue() { 4293 return true; 4294 } 4295 4296 function returnFalse() { 4297 return false; 4298 } 4299 4300 function safeActiveElement() { 4301 try { 4302 return document.activeElement; 4303 } catch (err) {} 4304 } 4305 4306 /* 4307 * Helper functions for managing events -- not part of the public interface. 4308 * Props to Dean Edwards' addEvent library for many of the ideas. 4309 */ 4310 jQuery.event = { 4311 4312 global: {}, 4313 4314 add: function(elem, types, handler, data, selector) { 4315 var tmp, events, t, handleObjIn, 4316 special, eventHandle, handleObj, 4317 handlers, type, namespaces, origType, 4318 elemData = jQuery._data(elem); 4319 4320 // Don't attach events to noData or text/comment nodes (but allow plain objects) 4321 if (!elemData) { 4322 return; 4323 } 4324 4325 // Caller can pass in an object of custom data in lieu of the handler 4326 if (handler.handler) { 4327 handleObjIn = handler; 4328 handler = handleObjIn.handler; 4329 selector = handleObjIn.selector; 4330 } 4331 4332 // Make sure that the handler has a unique ID, used to find/remove it later 4333 if (!handler.guid) { 4334 handler.guid = jQuery.guid++; 4335 } 4336 4337 // Init the element's event structure and main handler, if this is the first 4338 if (!(events = elemData.events)) { 4339 events = elemData.events = {}; 4340 } 4341 if (!(eventHandle = elemData.handle)) { 4342 eventHandle = elemData.handle = function(e) { 4343 // Discard the second event of a jQuery.event.trigger() and 4344 // when an event is called after a page has unloaded 4345 return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? 4346 jQuery.event.dispatch.apply(eventHandle.elem, arguments) : 4347 undefined; 4348 }; 4349 // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events 4350 eventHandle.elem = elem; 4351 } 4352 4353 // Handle multiple events separated by a space 4354 types = (types || "").match(rnotwhite) || [""]; 4355 t = types.length; 4356 while (t--) { 4357 tmp = rtypenamespace.exec(types[t]) || []; 4358 type = origType = tmp[1]; 4359 namespaces = (tmp[2] || "").split(".").sort(); 4360 4361 // There *must* be a type, no attaching namespace-only handlers 4362 if (!type) { 4363 continue; 4364 } 4365 4366 // If event changes its type, use the special event handlers for the changed type 4367 special = jQuery.event.special[type] || {}; 4368 4369 // If selector defined, determine special event api type, otherwise given type 4370 type = (selector ? special.delegateType : special.bindType) || type; 4371 4372 // Update special based on newly reset type 4373 special = jQuery.event.special[type] || {}; 4374 4375 // handleObj is passed to all event handlers 4376 handleObj = jQuery.extend({ 4377 type: type, 4378 origType: origType, 4379 data: data, 4380 handler: handler, 4381 guid: handler.guid, 4382 selector: selector, 4383 needsContext: selector && jQuery.expr.match.needsContext.test(selector), 4384 namespace: namespaces.join(".") 4385 }, handleObjIn); 4386 4387 // Init the event handler queue if we're the first 4388 if (!(handlers = events[type])) { 4389 handlers = events[type] = []; 4390 handlers.delegateCount = 0; 4391 4392 // Only use addEventListener/attachEvent if the special events handler returns false 4393 if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) { 4394 // Bind the global event handler to the element 4395 if (elem.addEventListener) { 4396 elem.addEventListener(type, eventHandle, false); 4397 4398 } else if (elem.attachEvent) { 4399 elem.attachEvent("on" + type, eventHandle); 4400 } 4401 } 4402 } 4403 4404 if (special.add) { 4405 special.add.call(elem, handleObj); 4406 4407 if (!handleObj.handler.guid) { 4408 handleObj.handler.guid = handler.guid; 4409 } 4410 } 4411 4412 // Add to the element's handler list, delegates in front 4413 if (selector) { 4414 handlers.splice(handlers.delegateCount++, 0, handleObj); 4415 } else { 4416 handlers.push(handleObj); 4417 } 4418 4419 // Keep track of which events have ever been used, for event optimization 4420 jQuery.event.global[type] = true; 4421 } 4422 4423 // Nullify elem to prevent memory leaks in IE 4424 elem = null; 4425 }, 4426 4427 // Detach an event or set of events from an element 4428 remove: function(elem, types, handler, selector, mappedTypes) { 4429 var j, handleObj, tmp, 4430 origCount, t, events, 4431 special, handlers, type, 4432 namespaces, origType, 4433 elemData = jQuery.hasData(elem) && jQuery._data(elem); 4434 4435 if (!elemData || !(events = elemData.events)) { 4436 return; 4437 } 4438 4439 // Once for each type.namespace in types; type may be omitted 4440 types = (types || "").match(rnotwhite) || [""]; 4441 t = types.length; 4442 while (t--) { 4443 tmp = rtypenamespace.exec(types[t]) || []; 4444 type = origType = tmp[1]; 4445 namespaces = (tmp[2] || "").split(".").sort(); 4446 4447 // Unbind all events (on this namespace, if provided) for the element 4448 if (!type) { 4449 for (type in events) { 4450 jQuery.event.remove(elem, type + types[t], handler, selector, true); 4451 } 4452 continue; 4453 } 4454 4455 special = jQuery.event.special[type] || {}; 4456 type = (selector ? special.delegateType : special.bindType) || type; 4457 handlers = events[type] || []; 4458 tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)"); 4459 4460 // Remove matching events 4461 origCount = j = handlers.length; 4462 while (j--) { 4463 handleObj = handlers[j]; 4464 4465 if ((mappedTypes || origType === handleObj.origType) && 4466 (!handler || handler.guid === handleObj.guid) && 4467 (!tmp || tmp.test(handleObj.namespace)) && 4468 (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) { 4469 handlers.splice(j, 1); 4470 4471 if (handleObj.selector) { 4472 handlers.delegateCount--; 4473 } 4474 if (special.remove) { 4475 special.remove.call(elem, handleObj); 4476 } 4477 } 4478 } 4479 4480 // Remove generic event handler if we removed something and no more handlers exist 4481 // (avoids potential for endless recursion during removal of special event handlers) 4482 if (origCount && !handlers.length) { 4483 if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) { 4484 jQuery.removeEvent(elem, type, elemData.handle); 4485 } 4486 4487 delete events[type]; 4488 } 4489 } 4490 4491 // Remove the expando if it's no longer used 4492 if (jQuery.isEmptyObject(events)) { 4493 delete elemData.handle; 4494 4495 // removeData also checks for emptiness and clears the expando if empty 4496 // so use it instead of delete 4497 jQuery._removeData(elem, "events"); 4498 } 4499 }, 4500 4501 trigger: function(event, data, elem, onlyHandlers) { 4502 var handle, ontype, cur, 4503 bubbleType, special, tmp, i, 4504 eventPath = [elem || document], 4505 type = hasOwn.call(event, "type") ? event.type : event, 4506 namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : []; 4507 4508 cur = tmp = elem = elem || document; 4509 4510 // Don't do events on text and comment nodes 4511 if (elem.nodeType === 3 || elem.nodeType === 8) { 4512 return; 4513 } 4514 4515 // focus/blur morphs to focusin/out; ensure we're not firing them right now 4516 if (rfocusMorph.test(type + jQuery.event.triggered)) { 4517 return; 4518 } 4519 4520 if (type.indexOf(".") >= 0) { 4521 // Namespaced trigger; create a regexp to match event type in handle() 4522 namespaces = type.split("."); 4523 type = namespaces.shift(); 4524 namespaces.sort(); 4525 } 4526 ontype = type.indexOf(":") < 0 && "on" + type; 4527 4528 // Caller can pass in a jQuery.Event object, Object, or just an event type string 4529 event = event[jQuery.expando] ? 4530 event : 4531 new jQuery.Event(type, typeof event === "object" && event); 4532 4533 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 4534 event.isTrigger = onlyHandlers ? 2 : 3; 4535 event.namespace = namespaces.join("."); 4536 event.namespace_re = event.namespace ? 4537 new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : 4538 null; 4539 4540 // Clean up the event in case it is being reused 4541 event.result = undefined; 4542 if (!event.target) { 4543 event.target = elem; 4544 } 4545 4546 // Clone any incoming data and prepend the event, creating the handler arg list 4547 data = data == null ? 4548 [event] : 4549 jQuery.makeArray(data, [event]); 4550 4551 // Allow special events to draw outside the lines 4552 special = jQuery.event.special[type] || {}; 4553 if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) { 4554 return; 4555 } 4556 4557 // Determine event propagation path in advance, per W3C events spec (#9951) 4558 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 4559 if (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) { 4560 4561 bubbleType = special.delegateType || type; 4562 if (!rfocusMorph.test(bubbleType + type)) { 4563 cur = cur.parentNode; 4564 } 4565 for (; cur; cur = cur.parentNode) { 4566 eventPath.push(cur); 4567 tmp = cur; 4568 } 4569 4570 // Only add window if we got to document (e.g., not plain obj or detached DOM) 4571 if (tmp === (elem.ownerDocument || document)) { 4572 eventPath.push(tmp.defaultView || tmp.parentWindow || window); 4573 } 4574 } 4575 4576 // Fire handlers on the event path 4577 i = 0; 4578 while ((cur = eventPath[i++]) && !event.isPropagationStopped()) { 4579 4580 event.type = i > 1 ? 4581 bubbleType : 4582 special.bindType || type; 4583 4584 // jQuery handler 4585 handle = (jQuery._data(cur, "events") || {})[event.type] && jQuery._data(cur, "handle"); 4586 if (handle) { 4587 handle.apply(cur, data); 4588 } 4589 4590 // Native handler 4591 handle = ontype && cur[ontype]; 4592 if (handle && handle.apply && jQuery.acceptData(cur)) { 4593 event.result = handle.apply(cur, data); 4594 if (event.result === false) { 4595 event.preventDefault(); 4596 } 4597 } 4598 } 4599 event.type = type; 4600 4601 // If nobody prevented the default action, do it now 4602 if (!onlyHandlers && !event.isDefaultPrevented()) { 4603 4604 if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && 4605 jQuery.acceptData(elem)) { 4606 4607 // Call a native DOM method on the target with the same name name as the event. 4608 // Can't use an .isFunction() check here because IE6/7 fails that test. 4609 // Don't do default actions on window, that's where global variables be (#6170) 4610 if (ontype && elem[type] && !jQuery.isWindow(elem)) { 4611 4612 // Don't re-trigger an onFOO event when we call its FOO() method 4613 tmp = elem[ontype]; 4614 4615 if (tmp) { 4616 elem[ontype] = null; 4617 } 4618 4619 // Prevent re-triggering of the same event, since we already bubbled it above 4620 jQuery.event.triggered = type; 4621 try { 4622 elem[type](); 4623 } catch (e) { 4624 // IE<9 dies on focus/blur to hidden element (#1486,#12518) 4625 // only reproducible on winXP IE8 native, not IE9 in IE8 mode 4626 } 4627 jQuery.event.triggered = undefined; 4628 4629 if (tmp) { 4630 elem[ontype] = tmp; 4631 } 4632 } 4633 } 4634 } 4635 4636 return event.result; 4637 }, 4638 4639 dispatch: function(event) { 4640 4641 // Make a writable jQuery.Event from the native event object 4642 event = jQuery.event.fix(event); 4643 4644 var i, ret, handleObj, matched, j, 4645 handlerQueue = [], 4646 args = slice.call(arguments), 4647 handlers = (jQuery._data(this, "events") || {})[event.type] || [], 4648 special = jQuery.event.special[event.type] || {}; 4649 4650 // Use the fix-ed jQuery.Event rather than the (read-only) native event 4651 args[0] = event; 4652 event.delegateTarget = this; 4653 4654 // Call the preDispatch hook for the mapped type, and let it bail if desired 4655 if (special.preDispatch && special.preDispatch.call(this, event) === false) { 4656 return; 4657 } 4658 4659 // Determine handlers 4660 handlerQueue = jQuery.event.handlers.call(this, event, handlers); 4661 4662 // Run delegates first; they may want to stop propagation beneath us 4663 i = 0; 4664 while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) { 4665 event.currentTarget = matched.elem; 4666 4667 j = 0; 4668 while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) { 4669 4670 // Triggered event must either 1) have no namespace, or 4671 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). 4672 if (!event.namespace_re || event.namespace_re.test(handleObj.namespace)) { 4673 4674 event.handleObj = handleObj; 4675 event.data = handleObj.data; 4676 4677 ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler) 4678 .apply(matched.elem, args); 4679 4680 if (ret !== undefined) { 4681 if ((event.result = ret) === false) { 4682 event.preventDefault(); 4683 event.stopPropagation(); 4684 } 4685 } 4686 } 4687 } 4688 } 4689 4690 // Call the postDispatch hook for the mapped type 4691 if (special.postDispatch) { 4692 special.postDispatch.call(this, event); 4693 } 4694 4695 return event.result; 4696 }, 4697 4698 handlers: function(event, handlers) { 4699 var sel, handleObj, matches, i, 4700 handlerQueue = [], 4701 delegateCount = handlers.delegateCount, 4702 cur = event.target; 4703 4704 // Find delegate handlers 4705 // Black-hole SVG <use> instance trees (#13180) 4706 // Avoid non-left-click bubbling in Firefox (#3861) 4707 if (delegateCount && cur.nodeType && (!event.button || event.type !== "click")) { 4708 4709 /* jshint eqeqeq: false */ 4710 for (; cur != this; cur = cur.parentNode || this) { 4711 /* jshint eqeqeq: true */ 4712 4713 // Don't check non-elements (#13208) 4714 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 4715 if (cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click")) { 4716 matches = []; 4717 for (i = 0; i < delegateCount; i++) { 4718 handleObj = handlers[i]; 4719 4720 // Don't conflict with Object.prototype properties (#13203) 4721 sel = handleObj.selector + " "; 4722 4723 if (matches[sel] === undefined) { 4724 matches[sel] = handleObj.needsContext ? 4725 jQuery(sel, this).index(cur) >= 0 : 4726 jQuery.find(sel, this, null, [cur]).length; 4727 } 4728 if (matches[sel]) { 4729 matches.push(handleObj); 4730 } 4731 } 4732 if (matches.length) { 4733 handlerQueue.push({ 4734 elem: cur, 4735 handlers: matches 4736 }); 4737 } 4738 } 4739 } 4740 } 4741 4742 // Add the remaining (directly-bound) handlers 4743 if (delegateCount < handlers.length) { 4744 handlerQueue.push({ 4745 elem: this, 4746 handlers: handlers.slice(delegateCount) 4747 }); 4748 } 4749 4750 return handlerQueue; 4751 }, 4752 4753 fix: function(event) { 4754 if (event[jQuery.expando]) { 4755 return event; 4756 } 4757 4758 // Create a writable copy of the event object and normalize some properties 4759 var i, prop, copy, 4760 type = event.type, 4761 originalEvent = event, 4762 fixHook = this.fixHooks[type]; 4763 4764 if (!fixHook) { 4765 this.fixHooks[type] = fixHook = 4766 rmouseEvent.test(type) ? this.mouseHooks : 4767 rkeyEvent.test(type) ? this.keyHooks : {}; 4768 } 4769 copy = fixHook.props ? this.props.concat(fixHook.props) : this.props; 4770 4771 event = new jQuery.Event(originalEvent); 4772 4773 i = copy.length; 4774 while (i--) { 4775 prop = copy[i]; 4776 event[prop] = originalEvent[prop]; 4777 } 4778 4779 // Support: IE<9 4780 // Fix target property (#1925) 4781 if (!event.target) { 4782 event.target = originalEvent.srcElement || document; 4783 } 4784 4785 // Support: Chrome 23+, Safari? 4786 // Target should not be a text node (#504, #13143) 4787 if (event.target.nodeType === 3) { 4788 event.target = event.target.parentNode; 4789 } 4790 4791 // Support: IE<9 4792 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) 4793 event.metaKey = !! event.metaKey; 4794 4795 return fixHook.filter ? fixHook.filter(event, originalEvent) : event; 4796 }, 4797 4798 // Includes some event props shared by KeyEvent and MouseEvent 4799 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), 4800 4801 fixHooks: {}, 4802 4803 keyHooks: { 4804 props: "char charCode key keyCode".split(" "), 4805 filter: function(event, original) { 4806 4807 // Add which for key events 4808 if (event.which == null) { 4809 event.which = original.charCode != null ? original.charCode : original.keyCode; 4810 } 4811 4812 return event; 4813 } 4814 }, 4815 4816 mouseHooks: { 4817 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), 4818 filter: function(event, original) { 4819 var body, eventDoc, doc, 4820 button = original.button, 4821 fromElement = original.fromElement; 4822 4823 // Calculate pageX/Y if missing and clientX/Y available 4824 if (event.pageX == null && original.clientX != null) { 4825 eventDoc = event.target.ownerDocument || document; 4826 doc = eventDoc.documentElement; 4827 body = eventDoc.body; 4828 4829 event.pageX = original.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); 4830 event.pageY = original.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); 4831 } 4832 4833 // Add relatedTarget, if necessary 4834 if (!event.relatedTarget && fromElement) { 4835 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; 4836 } 4837 4838 // Add which for click: 1 === left; 2 === middle; 3 === right 4839 // Note: button is not normalized, so don't use it 4840 if (!event.which && button !== undefined) { 4841 event.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0))); 4842 } 4843 4844 return event; 4845 } 4846 }, 4847 4848 special: { 4849 load: { 4850 // Prevent triggered image.load events from bubbling to window.load 4851 noBubble: true 4852 }, 4853 focus: { 4854 // Fire native event if possible so blur/focus sequence is correct 4855 trigger: function() { 4856 if (this !== safeActiveElement() && this.focus) { 4857 try { 4858 this.focus(); 4859 return false; 4860 } catch (e) { 4861 // Support: IE<9 4862 // If we error on focus to hidden element (#1486, #12518), 4863 // let .trigger() run the handlers 4864 } 4865 } 4866 }, 4867 delegateType: "focusin" 4868 }, 4869 blur: { 4870 trigger: function() { 4871 if (this === safeActiveElement() && this.blur) { 4872 this.blur(); 4873 return false; 4874 } 4875 }, 4876 delegateType: "focusout" 4877 }, 4878 click: { 4879 // For checkbox, fire native event so checked state will be right 4880 trigger: function() { 4881 if (jQuery.nodeName(this, "input") && this.type === "checkbox" && this.click) { 4882 this.click(); 4883 return false; 4884 } 4885 }, 4886 4887 // For cross-browser consistency, don't fire native .click() on links 4888 _default: function(event) { 4889 return jQuery.nodeName(event.target, "a"); 4890 } 4891 }, 4892 4893 beforeunload: { 4894 postDispatch: function(event) { 4895 4896 // Even when returnValue equals to undefined Firefox will still show alert 4897 if (event.result !== undefined) { 4898 event.originalEvent.returnValue = event.result; 4899 } 4900 } 4901 } 4902 }, 4903 4904 simulate: function(type, elem, event, bubble) { 4905 // Piggyback on a donor event to simulate a different one. 4906 // Fake originalEvent to avoid donor's stopPropagation, but if the 4907 // simulated event prevents default then we do the same on the donor. 4908 var e = jQuery.extend( 4909 new jQuery.Event(), 4910 event, { 4911 type: type, 4912 isSimulated: true, 4913 originalEvent: {} 4914 } 4915 ); 4916 if (bubble) { 4917 jQuery.event.trigger(e, null, elem); 4918 } else { 4919 jQuery.event.dispatch.call(elem, e); 4920 } 4921 if (e.isDefaultPrevented()) { 4922 event.preventDefault(); 4923 } 4924 } 4925 }; 4926 4927 jQuery.removeEvent = document.removeEventListener ? 4928 function(elem, type, handle) { 4929 if (elem.removeEventListener) { 4930 elem.removeEventListener(type, handle, false); 4931 } 4932 } : 4933 function(elem, type, handle) { 4934 var name = "on" + type; 4935 4936 if (elem.detachEvent) { 4937 4938 // #8545, #7054, preventing memory leaks for custom events in IE6-8 4939 // detachEvent needed property on element, by name of that event, to properly expose it to GC 4940 if (typeof elem[name] === strundefined) { 4941 elem[name] = null; 4942 } 4943 4944 elem.detachEvent(name, handle); 4945 } 4946 }; 4947 4948 jQuery.Event = function(src, props) { 4949 // Allow instantiation without the 'new' keyword 4950 if (!(this instanceof jQuery.Event)) { 4951 return new jQuery.Event(src, props); 4952 } 4953 4954 // Event object 4955 if (src && src.type) { 4956 this.originalEvent = src; 4957 this.type = src.type; 4958 4959 // Events bubbling up the document may have been marked as prevented 4960 // by a handler lower down the tree; reflect the correct value. 4961 this.isDefaultPrevented = src.defaultPrevented || 4962 src.defaultPrevented === undefined && ( 4963 // Support: IE < 9 4964 src.returnValue === false || 4965 // Support: Android < 4.0 4966 src.getPreventDefault && src.getPreventDefault()) ? 4967 returnTrue : 4968 returnFalse; 4969 4970 // Event type 4971 } else { 4972 this.type = src; 4973 } 4974 4975 // Put explicitly provided properties onto the event object 4976 if (props) { 4977 jQuery.extend(this, props); 4978 } 4979 4980 // Create a timestamp if incoming event doesn't have one 4981 this.timeStamp = src && src.timeStamp || jQuery.now(); 4982 4983 // Mark it as fixed 4984 this[jQuery.expando] = true; 4985 }; 4986 4987 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 4988 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 4989 jQuery.Event.prototype = { 4990 isDefaultPrevented: returnFalse, 4991 isPropagationStopped: returnFalse, 4992 isImmediatePropagationStopped: returnFalse, 4993 4994 preventDefault: function() { 4995 var e = this.originalEvent; 4996 4997 this.isDefaultPrevented = returnTrue; 4998 if (!e) { 4999 return; 5000 } 5001 5002 // If preventDefault exists, run it on the original event 5003 if (e.preventDefault) { 5004 e.preventDefault(); 5005 5006 // Support: IE 5007 // Otherwise set the returnValue property of the original event to false 5008 } else { 5009 e.returnValue = false; 5010 } 5011 }, 5012 stopPropagation: function() { 5013 var e = this.originalEvent; 5014 5015 this.isPropagationStopped = returnTrue; 5016 if (!e) { 5017 return; 5018 } 5019 // If stopPropagation exists, run it on the original event 5020 if (e.stopPropagation) { 5021 e.stopPropagation(); 5022 } 5023 5024 // Support: IE 5025 // Set the cancelBubble property of the original event to true 5026 e.cancelBubble = true; 5027 }, 5028 stopImmediatePropagation: function() { 5029 this.isImmediatePropagationStopped = returnTrue; 5030 this.stopPropagation(); 5031 } 5032 }; 5033 5034 // Create mouseenter/leave events using mouseover/out and event-time checks 5035 jQuery.each({ 5036 mouseenter: "mouseover", 5037 mouseleave: "mouseout" 5038 }, function(orig, fix) { 5039 jQuery.event.special[orig] = { 5040 delegateType: fix, 5041 bindType: fix, 5042 5043 handle: function(event) { 5044 var ret, 5045 target = this, 5046 related = event.relatedTarget, 5047 handleObj = event.handleObj; 5048 5049 // For mousenter/leave call the handler if related is outside the target. 5050 // NB: No relatedTarget if the mouse left/entered the browser window 5051 if (!related || (related !== target && !jQuery.contains(target, related))) { 5052 event.type = handleObj.origType; 5053 ret = handleObj.handler.apply(this, arguments); 5054 event.type = fix; 5055 } 5056 return ret; 5057 } 5058 }; 5059 }); 5060 5061 // IE submit delegation 5062 if (!support.submitBubbles) { 5063 5064 jQuery.event.special.submit = { 5065 setup: function() { 5066 // Only need this for delegated form submit events 5067 if (jQuery.nodeName(this, "form")) { 5068 return false; 5069 } 5070 5071 // Lazy-add a submit handler when a descendant form may potentially be submitted 5072 jQuery.event.add(this, "click._submit keypress._submit", function(e) { 5073 // Node name check avoids a VML-related crash in IE (#9807) 5074 var elem = e.target, 5075 form = jQuery.nodeName(elem, "input") || jQuery.nodeName(elem, "button") ? elem.form : undefined; 5076 if (form && !jQuery._data(form, "submitBubbles")) { 5077 jQuery.event.add(form, "submit._submit", function(event) { 5078 event._submit_bubble = true; 5079 }); 5080 jQuery._data(form, "submitBubbles", true); 5081 } 5082 }); 5083 // return undefined since we don't need an event listener 5084 }, 5085 5086 postDispatch: function(event) { 5087 // If form was submitted by the user, bubble the event up the tree 5088 if (event._submit_bubble) { 5089 delete event._submit_bubble; 5090 if (this.parentNode && !event.isTrigger) { 5091 jQuery.event.simulate("submit", this.parentNode, event, true); 5092 } 5093 } 5094 }, 5095 5096 teardown: function() { 5097 // Only need this for delegated form submit events 5098 if (jQuery.nodeName(this, "form")) { 5099 return false; 5100 } 5101 5102 // Remove delegated handlers; cleanData eventually reaps submit handlers attached above 5103 jQuery.event.remove(this, "._submit"); 5104 } 5105 }; 5106 } 5107 5108 // IE change delegation and checkbox/radio fix 5109 if (!support.changeBubbles) { 5110 5111 jQuery.event.special.change = { 5112 5113 setup: function() { 5114 5115 if (rformElems.test(this.nodeName)) { 5116 // IE doesn't fire change on a check/radio until blur; trigger it on click 5117 // after a propertychange. Eat the blur-change in special.change.handle. 5118 // This still fires onchange a second time for check/radio after blur. 5119 if (this.type === "checkbox" || this.type === "radio") { 5120 jQuery.event.add(this, "propertychange._change", function(event) { 5121 if (event.originalEvent.propertyName === "checked") { 5122 this._just_changed = true; 5123 } 5124 }); 5125 jQuery.event.add(this, "click._change", function(event) { 5126 if (this._just_changed && !event.isTrigger) { 5127 this._just_changed = false; 5128 } 5129 // Allow triggered, simulated change events (#11500) 5130 jQuery.event.simulate("change", this, event, true); 5131 }); 5132 } 5133 return false; 5134 } 5135 // Delegated event; lazy-add a change handler on descendant inputs 5136 jQuery.event.add(this, "beforeactivate._change", function(e) { 5137 var elem = e.target; 5138 5139 if (rformElems.test(elem.nodeName) && !jQuery._data(elem, "changeBubbles")) { 5140 jQuery.event.add(elem, "change._change", function(event) { 5141 if (this.parentNode && !event.isSimulated && !event.isTrigger) { 5142 jQuery.event.simulate("change", this.parentNode, event, true); 5143 } 5144 }); 5145 jQuery._data(elem, "changeBubbles", true); 5146 } 5147 }); 5148 }, 5149 5150 handle: function(event) { 5151 var elem = event.target; 5152 5153 // Swallow native change events from checkbox/radio, we already triggered them above 5154 if (this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox")) { 5155 return event.handleObj.handler.apply(this, arguments); 5156 } 5157 }, 5158 5159 teardown: function() { 5160 jQuery.event.remove(this, "._change"); 5161 5162 return !rformElems.test(this.nodeName); 5163 } 5164 }; 5165 } 5166 5167 // Create "bubbling" focus and blur events 5168 if (!support.focusinBubbles) { 5169 jQuery.each({ 5170 focus: "focusin", 5171 blur: "focusout" 5172 }, function(orig, fix) { 5173 5174 // Attach a single capturing handler on the document while someone wants focusin/focusout 5175 var handler = function(event) { 5176 jQuery.event.simulate(fix, event.target, jQuery.event.fix(event), true); 5177 }; 5178 5179 jQuery.event.special[fix] = { 5180 setup: function() { 5181 var doc = this.ownerDocument || this, 5182 attaches = jQuery._data(doc, fix); 5183 5184 if (!attaches) { 5185 doc.addEventListener(orig, handler, true); 5186 } 5187 jQuery._data(doc, fix, (attaches || 0) + 1); 5188 }, 5189 teardown: function() { 5190 var doc = this.ownerDocument || this, 5191 attaches = jQuery._data(doc, fix) - 1; 5192 5193 if (!attaches) { 5194 doc.removeEventListener(orig, handler, true); 5195 jQuery._removeData(doc, fix); 5196 } else { 5197 jQuery._data(doc, fix, attaches); 5198 } 5199 } 5200 }; 5201 }); 5202 } 5203 5204 jQuery.fn.extend({ 5205 5206 on: function(types, selector, data, fn, /*INTERNAL*/ one) { 5207 var type, origFn; 5208 5209 // Types can be a map of types/handlers 5210 if (typeof types === "object") { 5211 // ( types-Object, selector, data ) 5212 if (typeof selector !== "string") { 5213 // ( types-Object, data ) 5214 data = data || selector; 5215 selector = undefined; 5216 } 5217 for (type in types) { 5218 this.on(type, selector, data, types[type], one); 5219 } 5220 return this; 5221 } 5222 5223 if (data == null && fn == null) { 5224 // ( types, fn ) 5225 fn = selector; 5226 data = selector = undefined; 5227 } else if (fn == null) { 5228 if (typeof selector === "string") { 5229 // ( types, selector, fn ) 5230 fn = data; 5231 data = undefined; 5232 } else { 5233 // ( types, data, fn ) 5234 fn = data; 5235 data = selector; 5236 selector = undefined; 5237 } 5238 } 5239 if (fn === false) { 5240 fn = returnFalse; 5241 } else if (!fn) { 5242 return this; 5243 } 5244 5245 if (one === 1) { 5246 origFn = fn; 5247 fn = function(event) { 5248 // Can use an empty set, since event contains the info 5249 jQuery().off(event); 5250 return origFn.apply(this, arguments); 5251 }; 5252 // Use same guid so caller can remove using origFn 5253 fn.guid = origFn.guid || (origFn.guid = jQuery.guid++); 5254 } 5255 return this.each(function() { 5256 jQuery.event.add(this, types, fn, data, selector); 5257 }); 5258 }, 5259 one: function(types, selector, data, fn) { 5260 return this.on(types, selector, data, fn, 1); 5261 }, 5262 off: function(types, selector, fn) { 5263 var handleObj, type; 5264 if (types && types.preventDefault && types.handleObj) { 5265 // ( event ) dispatched jQuery.Event 5266 handleObj = types.handleObj; 5267 jQuery(types.delegateTarget).off( 5268 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, 5269 handleObj.selector, 5270 handleObj.handler 5271 ); 5272 return this; 5273 } 5274 if (typeof types === "object") { 5275 // ( types-object [, selector] ) 5276 for (type in types) { 5277 this.off(type, selector, types[type]); 5278 } 5279 return this; 5280 } 5281 if (selector === false || typeof selector === "function") { 5282 // ( types [, fn] ) 5283 fn = selector; 5284 selector = undefined; 5285 } 5286 if (fn === false) { 5287 fn = returnFalse; 5288 } 5289 return this.each(function() { 5290 jQuery.event.remove(this, types, fn, selector); 5291 }); 5292 }, 5293 5294 trigger: function(type, data) { 5295 return this.each(function() { 5296 jQuery.event.trigger(type, data, this); 5297 }); 5298 }, 5299 triggerHandler: function(type, data) { 5300 var elem = this[0]; 5301 if (elem) { 5302 return jQuery.event.trigger(type, data, elem, true); 5303 } 5304 } 5305 }); 5306 5307 5308 function createSafeFragment(document) { 5309 var list = nodeNames.split("|"), 5310 safeFrag = document.createDocumentFragment(); 5311 5312 if (safeFrag.createElement) { 5313 while (list.length) { 5314 safeFrag.createElement( 5315 list.pop() 5316 ); 5317 } 5318 } 5319 return safeFrag; 5320 } 5321 5322 var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + 5323 "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", 5324 rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, 5325 rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), 5326 rleadingWhitespace = /^\s+/, 5327 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, 5328 rtagName = /<([\w:]+)/, 5329 rtbody = /<tbody/i, 5330 rhtml = /<|&#?\w+;/, 5331 rnoInnerhtml = /<(?:script|style|link)/i, 5332 // checked="checked" or checked 5333 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5334 rscriptType = /^$|\/(?:java|ecma)script/i, 5335 rscriptTypeMasked = /^true\/(.*)/, 5336 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, 5337 5338 // We have to close these tags to support XHTML (#13200) 5339 wrapMap = { 5340 option: [1, "<select multiple='multiple'>", "</select>"], 5341 legend: [1, "<fieldset>", "</fieldset>"], 5342 area: [1, "<map>", "</map>"], 5343 param: [1, "<object>", "</object>"], 5344 thead: [1, "<table>", "</table>"], 5345 tr: [2, "<table><tbody>", "</tbody></table>"], 5346 col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"], 5347 td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], 5348 5349 // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, 5350 // unless wrapped in a div with non-breaking characters in front of it. 5351 _default: support.htmlSerialize ? [0, "", ""] : [1, "X<div>", "</div>"] 5352 }, 5353 safeFragment = createSafeFragment(document), 5354 fragmentDiv = safeFragment.appendChild(document.createElement("div")); 5355 5356 wrapMap.optgroup = wrapMap.option; 5357 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 5358 wrapMap.th = wrapMap.td; 5359 5360 function getAll(context, tag) { 5361 var elems, elem, 5362 i = 0, 5363 found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName(tag || "*") : 5364 typeof context.querySelectorAll !== strundefined ? context.querySelectorAll(tag || "*") : 5365 undefined; 5366 5367 if (!found) { 5368 for (found = [], elems = context.childNodes || context; 5369 (elem = elems[i]) != null; i++) { 5370 if (!tag || jQuery.nodeName(elem, tag)) { 5371 found.push(elem); 5372 } else { 5373 jQuery.merge(found, getAll(elem, tag)); 5374 } 5375 } 5376 } 5377 5378 return tag === undefined || tag && jQuery.nodeName(context, tag) ? 5379 jQuery.merge([context], found) : 5380 found; 5381 } 5382 5383 // Used in buildFragment, fixes the defaultChecked property 5384 5385 function fixDefaultChecked(elem) { 5386 if (rcheckableType.test(elem.type)) { 5387 elem.defaultChecked = elem.checked; 5388 } 5389 } 5390 5391 // Support: IE<8 5392 // Manipulating tables requires a tbody 5393 5394 function manipulationTarget(elem, content) { 5395 return jQuery.nodeName(elem, "table") && 5396 jQuery.nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr") ? 5397 5398 elem.getElementsByTagName("tbody")[0] || 5399 elem.appendChild(elem.ownerDocument.createElement("tbody")) : 5400 elem; 5401 } 5402 5403 // Replace/restore the type attribute of script elements for safe DOM manipulation 5404 5405 function disableScript(elem) { 5406 elem.type = (jQuery.find.attr(elem, "type") !== null) + "/" + elem.type; 5407 return elem; 5408 } 5409 5410 function restoreScript(elem) { 5411 var match = rscriptTypeMasked.exec(elem.type); 5412 if (match) { 5413 elem.type = match[1]; 5414 } else { 5415 elem.removeAttribute("type"); 5416 } 5417 return elem; 5418 } 5419 5420 // Mark scripts as having already been evaluated 5421 5422 function setGlobalEval(elems, refElements) { 5423 var elem, 5424 i = 0; 5425 for (; 5426 (elem = elems[i]) != null; i++) { 5427 jQuery._data(elem, "globalEval", !refElements || jQuery._data(refElements[i], "globalEval")); 5428 } 5429 } 5430 5431 function cloneCopyEvent(src, dest) { 5432 5433 if (dest.nodeType !== 1 || !jQuery.hasData(src)) { 5434 return; 5435 } 5436 5437 var type, i, l, 5438 oldData = jQuery._data(src), 5439 curData = jQuery._data(dest, oldData), 5440 events = oldData.events; 5441 5442 if (events) { 5443 delete curData.handle; 5444 curData.events = {}; 5445 5446 for (type in events) { 5447 for (i = 0, l = events[type].length; i < l; i++) { 5448 jQuery.event.add(dest, type, events[type][i]); 5449 } 5450 } 5451 } 5452 5453 // make the cloned public data object a copy from the original 5454 if (curData.data) { 5455 curData.data = jQuery.extend({}, curData.data); 5456 } 5457 } 5458 5459 function fixCloneNodeIssues(src, dest) { 5460 var nodeName, e, data; 5461 5462 // We do not need to do anything for non-Elements 5463 if (dest.nodeType !== 1) { 5464 return; 5465 } 5466 5467 nodeName = dest.nodeName.toLowerCase(); 5468 5469 // IE6-8 copies events bound via attachEvent when using cloneNode. 5470 if (!support.noCloneEvent && dest[jQuery.expando]) { 5471 data = jQuery._data(dest); 5472 5473 for (e in data.events) { 5474 jQuery.removeEvent(dest, e, data.handle); 5475 } 5476 5477 // Event data gets referenced instead of copied if the expando gets copied too 5478 dest.removeAttribute(jQuery.expando); 5479 } 5480 5481 // IE blanks contents when cloning scripts, and tries to evaluate newly-set text 5482 if (nodeName === "script" && dest.text !== src.text) { 5483 disableScript(dest).text = src.text; 5484 restoreScript(dest); 5485 5486 // IE6-10 improperly clones children of object elements using classid. 5487 // IE10 throws NoModificationAllowedError if parent is null, #12132. 5488 } else if (nodeName === "object") { 5489 if (dest.parentNode) { 5490 dest.outerHTML = src.outerHTML; 5491 } 5492 5493 // This path appears unavoidable for IE9. When cloning an object 5494 // element in IE9, the outerHTML strategy above is not sufficient. 5495 // If the src has innerHTML and the destination does not, 5496 // copy the src.innerHTML into the dest.innerHTML. #10324 5497 if (support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML))) { 5498 dest.innerHTML = src.innerHTML; 5499 } 5500 5501 } else if (nodeName === "input" && rcheckableType.test(src.type)) { 5502 // IE6-8 fails to persist the checked state of a cloned checkbox 5503 // or radio button. Worse, IE6-7 fail to give the cloned element 5504 // a checked appearance if the defaultChecked value isn't also set 5505 5506 dest.defaultChecked = dest.checked = src.checked; 5507 5508 // IE6-7 get confused and end up setting the value of a cloned 5509 // checkbox/radio button to an empty string instead of "on" 5510 if (dest.value !== src.value) { 5511 dest.value = src.value; 5512 } 5513 5514 // IE6-8 fails to return the selected option to the default selected 5515 // state when cloning options 5516 } else if (nodeName === "option") { 5517 dest.defaultSelected = dest.selected = src.defaultSelected; 5518 5519 // IE6-8 fails to set the defaultValue to the correct value when 5520 // cloning other types of input fields 5521 } else if (nodeName === "input" || nodeName === "textarea") { 5522 dest.defaultValue = src.defaultValue; 5523 } 5524 } 5525 5526 jQuery.extend({ 5527 clone: function(elem, dataAndEvents, deepDataAndEvents) { 5528 var destElements, node, clone, i, srcElements, 5529 inPage = jQuery.contains(elem.ownerDocument, elem); 5530 5531 if (support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test("<" + elem.nodeName + ">")) { 5532 clone = elem.cloneNode(true); 5533 5534 // IE<=8 does not properly clone detached, unknown element nodes 5535 } else { 5536 fragmentDiv.innerHTML = elem.outerHTML; 5537 fragmentDiv.removeChild(clone = fragmentDiv.firstChild); 5538 } 5539 5540 if ((!support.noCloneEvent || !support.noCloneChecked) && 5541 (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) { 5542 5543 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 5544 destElements = getAll(clone); 5545 srcElements = getAll(elem); 5546 5547 // Fix all IE cloning issues 5548 for (i = 0; 5549 (node = srcElements[i]) != null; ++i) { 5550 // Ensure that the destination node is not null; Fixes #9587 5551 if (destElements[i]) { 5552 fixCloneNodeIssues(node, destElements[i]); 5553 } 5554 } 5555 } 5556 5557 // Copy the events from the original to the clone 5558 if (dataAndEvents) { 5559 if (deepDataAndEvents) { 5560 srcElements = srcElements || getAll(elem); 5561 destElements = destElements || getAll(clone); 5562 5563 for (i = 0; 5564 (node = srcElements[i]) != null; i++) { 5565 cloneCopyEvent(node, destElements[i]); 5566 } 5567 } else { 5568 cloneCopyEvent(elem, clone); 5569 } 5570 } 5571 5572 // Preserve script evaluation history 5573 destElements = getAll(clone, "script"); 5574 if (destElements.length > 0) { 5575 setGlobalEval(destElements, !inPage && getAll(elem, "script")); 5576 } 5577 5578 destElements = srcElements = node = null; 5579 5580 // Return the cloned set 5581 return clone; 5582 }, 5583 5584 buildFragment: function(elems, context, scripts, selection) { 5585 var j, elem, contains, 5586 tmp, tag, tbody, wrap, 5587 l = elems.length, 5588 5589 // Ensure a safe fragment 5590 safe = createSafeFragment(context), 5591 5592 nodes = [], 5593 i = 0; 5594 5595 for (; i < l; i++) { 5596 elem = elems[i]; 5597 5598 if (elem || elem === 0) { 5599 5600 // Add nodes directly 5601 if (jQuery.type(elem) === "object") { 5602 jQuery.merge(nodes, elem.nodeType ? [elem] : elem); 5603 5604 // Convert non-html into a text node 5605 } else if (!rhtml.test(elem)) { 5606 nodes.push(context.createTextNode(elem)); 5607 5608 // Convert html into DOM nodes 5609 } else { 5610 tmp = tmp || safe.appendChild(context.createElement("div")); 5611 5612 // Deserialize a standard representation 5613 tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase(); 5614 wrap = wrapMap[tag] || wrapMap._default; 5615 5616 tmp.innerHTML = wrap[1] + elem.replace(rxhtmlTag, "<$1></$2>") + wrap[2]; 5617 5618 // Descend through wrappers to the right content 5619 j = wrap[0]; 5620 while (j--) { 5621 tmp = tmp.lastChild; 5622 } 5623 5624 // Manually add leading whitespace removed by IE 5625 if (!support.leadingWhitespace && rleadingWhitespace.test(elem)) { 5626 nodes.push(context.createTextNode(rleadingWhitespace.exec(elem)[0])); 5627 } 5628 5629 // Remove IE's autoinserted <tbody> from table fragments 5630 if (!support.tbody) { 5631 5632 // String was a <table>, *may* have spurious <tbody> 5633 elem = tag === "table" && !rtbody.test(elem) ? 5634 tmp.firstChild : 5635 5636 // String was a bare <thead> or <tfoot> 5637 wrap[1] === "<table>" && !rtbody.test(elem) ? 5638 tmp : 5639 0; 5640 5641 j = elem && elem.childNodes.length; 5642 while (j--) { 5643 if (jQuery.nodeName((tbody = elem.childNodes[j]), "tbody") && !tbody.childNodes.length) { 5644 elem.removeChild(tbody); 5645 } 5646 } 5647 } 5648 5649 jQuery.merge(nodes, tmp.childNodes); 5650 5651 // Fix #12392 for WebKit and IE > 9 5652 tmp.textContent = ""; 5653 5654 // Fix #12392 for oldIE 5655 while (tmp.firstChild) { 5656 tmp.removeChild(tmp.firstChild); 5657 } 5658 5659 // Remember the top-level container for proper cleanup 5660 tmp = safe.lastChild; 5661 } 5662 } 5663 } 5664 5665 // Fix #11356: Clear elements from fragment 5666 if (tmp) { 5667 safe.removeChild(tmp); 5668 } 5669 5670 // Reset defaultChecked for any radios and checkboxes 5671 // about to be appended to the DOM in IE 6/7 (#8060) 5672 if (!support.appendChecked) { 5673 jQuery.grep(getAll(nodes, "input"), fixDefaultChecked); 5674 } 5675 5676 i = 0; 5677 while ((elem = nodes[i++])) { 5678 5679 // #4087 - If origin and destination elements are the same, and this is 5680 // that element, do not do anything 5681 if (selection && jQuery.inArray(elem, selection) !== -1) { 5682 continue; 5683 } 5684 5685 contains = jQuery.contains(elem.ownerDocument, elem); 5686 5687 // Append to fragment 5688 tmp = getAll(safe.appendChild(elem), "script"); 5689 5690 // Preserve script evaluation history 5691 if (contains) { 5692 setGlobalEval(tmp); 5693 } 5694 5695 // Capture executables 5696 if (scripts) { 5697 j = 0; 5698 while ((elem = tmp[j++])) { 5699 if (rscriptType.test(elem.type || "")) { 5700 scripts.push(elem); 5701 } 5702 } 5703 } 5704 } 5705 5706 tmp = null; 5707 5708 return safe; 5709 }, 5710 5711 cleanData: function(elems, /* internal */ acceptData) { 5712 var elem, type, id, data, 5713 i = 0, 5714 internalKey = jQuery.expando, 5715 cache = jQuery.cache, 5716 deleteExpando = support.deleteExpando, 5717 special = jQuery.event.special; 5718 5719 for (; 5720 (elem = elems[i]) != null; i++) { 5721 if (acceptData || jQuery.acceptData(elem)) { 5722 5723 id = elem[internalKey]; 5724 data = id && cache[id]; 5725 5726 if (data) { 5727 if (data.events) { 5728 for (type in data.events) { 5729 if (special[type]) { 5730 jQuery.event.remove(elem, type); 5731 5732 // This is a shortcut to avoid jQuery.event.remove's overhead 5733 } else { 5734 jQuery.removeEvent(elem, type, data.handle); 5735 } 5736 } 5737 } 5738 5739 // Remove cache only if it was not already removed by jQuery.event.remove 5740 if (cache[id]) { 5741 5742 delete cache[id]; 5743 5744 // IE does not allow us to delete expando properties from nodes, 5745 // nor does it have a removeAttribute function on Document nodes; 5746 // we must handle all of these cases 5747 if (deleteExpando) { 5748 delete elem[internalKey]; 5749 5750 } else if (typeof elem.removeAttribute !== strundefined) { 5751 elem.removeAttribute(internalKey); 5752 5753 } else { 5754 elem[internalKey] = null; 5755 } 5756 5757 deletedIds.push(id); 5758 } 5759 } 5760 } 5761 } 5762 } 5763 }); 5764 5765 jQuery.fn.extend({ 5766 text: function(value) { 5767 return access(this, function(value) { 5768 return value === undefined ? 5769 jQuery.text(this) : 5770 this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(value)); 5771 }, null, value, arguments.length); 5772 }, 5773 5774 append: function() { 5775 return this.domManip(arguments, function(elem) { 5776 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 5777 var target = manipulationTarget(this, elem); 5778 target.appendChild(elem); 5779 } 5780 }); 5781 }, 5782 5783 prepend: function() { 5784 return this.domManip(arguments, function(elem) { 5785 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 5786 var target = manipulationTarget(this, elem); 5787 target.insertBefore(elem, target.firstChild); 5788 } 5789 }); 5790 }, 5791 5792 before: function() { 5793 return this.domManip(arguments, function(elem) { 5794 if (this.parentNode) { 5795 this.parentNode.insertBefore(elem, this); 5796 } 5797 }); 5798 }, 5799 5800 after: function() { 5801 return this.domManip(arguments, function(elem) { 5802 if (this.parentNode) { 5803 this.parentNode.insertBefore(elem, this.nextSibling); 5804 } 5805 }); 5806 }, 5807 5808 remove: function(selector, keepData /* Internal Use Only */ ) { 5809 var elem, 5810 elems = selector ? jQuery.filter(selector, this) : this, 5811 i = 0; 5812 5813 for (; 5814 (elem = elems[i]) != null; i++) { 5815 5816 if (!keepData && elem.nodeType === 1) { 5817 jQuery.cleanData(getAll(elem)); 5818 } 5819 5820 if (elem.parentNode) { 5821 if (keepData && jQuery.contains(elem.ownerDocument, elem)) { 5822 setGlobalEval(getAll(elem, "script")); 5823 } 5824 elem.parentNode.removeChild(elem); 5825 } 5826 } 5827 5828 return this; 5829 }, 5830 5831 empty: function() { 5832 var elem, 5833 i = 0; 5834 5835 for (; 5836 (elem = this[i]) != null; i++) { 5837 // Remove element nodes and prevent memory leaks 5838 if (elem.nodeType === 1) { 5839 jQuery.cleanData(getAll(elem, false)); 5840 } 5841 5842 // Remove any remaining nodes 5843 while (elem.firstChild) { 5844 elem.removeChild(elem.firstChild); 5845 } 5846 5847 // If this is a select, ensure that it displays empty (#12336) 5848 // Support: IE<9 5849 if (elem.options && jQuery.nodeName(elem, "select")) { 5850 elem.options.length = 0; 5851 } 5852 } 5853 5854 return this; 5855 }, 5856 5857 clone: function(dataAndEvents, deepDataAndEvents) { 5858 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 5859 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 5860 5861 return this.map(function() { 5862 return jQuery.clone(this, dataAndEvents, deepDataAndEvents); 5863 }); 5864 }, 5865 5866 html: function(value) { 5867 return access(this, function(value) { 5868 var elem = this[0] || {}, 5869 i = 0, 5870 l = this.length; 5871 5872 if (value === undefined) { 5873 return elem.nodeType === 1 ? 5874 elem.innerHTML.replace(rinlinejQuery, "") : 5875 undefined; 5876 } 5877 5878 // See if we can take a shortcut and just use innerHTML 5879 if (typeof value === "string" && !rnoInnerhtml.test(value) && 5880 (support.htmlSerialize || !rnoshimcache.test(value)) && 5881 (support.leadingWhitespace || !rleadingWhitespace.test(value)) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) { 5882 5883 value = value.replace(rxhtmlTag, "<$1></$2>"); 5884 5885 try { 5886 for (; i < l; i++) { 5887 // Remove element nodes and prevent memory leaks 5888 elem = this[i] || {}; 5889 if (elem.nodeType === 1) { 5890 jQuery.cleanData(getAll(elem, false)); 5891 elem.innerHTML = value; 5892 } 5893 } 5894 5895 elem = 0; 5896 5897 // If using innerHTML throws an exception, use the fallback method 5898 } catch (e) {} 5899 } 5900 5901 if (elem) { 5902 this.empty().append(value); 5903 } 5904 }, null, value, arguments.length); 5905 }, 5906 5907 replaceWith: function() { 5908 var arg = arguments[0]; 5909 5910 // Make the changes, replacing each context element with the new content 5911 this.domManip(arguments, function(elem) { 5912 arg = this.parentNode; 5913 5914 jQuery.cleanData(getAll(this)); 5915 5916 if (arg) { 5917 arg.replaceChild(elem, this); 5918 } 5919 }); 5920 5921 // Force removal if there was no new content (e.g., from empty arguments) 5922 return arg && (arg.length || arg.nodeType) ? this : this.remove(); 5923 }, 5924 5925 detach: function(selector) { 5926 return this.remove(selector, true); 5927 }, 5928 5929 domManip: function(args, callback) { 5930 5931 // Flatten any nested arrays 5932 args = concat.apply([], args); 5933 5934 var first, node, hasScripts, 5935 scripts, doc, fragment, 5936 i = 0, 5937 l = this.length, 5938 set = this, 5939 iNoClone = l - 1, 5940 value = args[0], 5941 isFunction = jQuery.isFunction(value); 5942 5943 // We can't cloneNode fragments that contain checked, in WebKit 5944 if (isFunction || 5945 (l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value))) { 5946 return this.each(function(index) { 5947 var self = set.eq(index); 5948 if (isFunction) { 5949 args[0] = value.call(this, index, self.html()); 5950 } 5951 self.domManip(args, callback); 5952 }); 5953 } 5954 5955 if (l) { 5956 fragment = jQuery.buildFragment(args, this[0].ownerDocument, false, this); 5957 first = fragment.firstChild; 5958 5959 if (fragment.childNodes.length === 1) { 5960 fragment = first; 5961 } 5962 5963 if (first) { 5964 scripts = jQuery.map(getAll(fragment, "script"), disableScript); 5965 hasScripts = scripts.length; 5966 5967 // Use the original fragment for the last item instead of the first because it can end up 5968 // being emptied incorrectly in certain situations (#8070). 5969 for (; i < l; i++) { 5970 node = fragment; 5971 5972 if (i !== iNoClone) { 5973 node = jQuery.clone(node, true, true); 5974 5975 // Keep references to cloned scripts for later restoration 5976 if (hasScripts) { 5977 jQuery.merge(scripts, getAll(node, "script")); 5978 } 5979 } 5980 5981 callback.call(this[i], node, i); 5982 } 5983 5984 if (hasScripts) { 5985 doc = scripts[scripts.length - 1].ownerDocument; 5986 5987 // Reenable scripts 5988 jQuery.map(scripts, restoreScript); 5989 5990 // Evaluate executable scripts on first document insertion 5991 for (i = 0; i < hasScripts; i++) { 5992 node = scripts[i]; 5993 if (rscriptType.test(node.type || "") && !jQuery._data(node, "globalEval") && jQuery.contains(doc, node)) { 5994 5995 if (node.src) { 5996 // Optional AJAX dependency, but won't run scripts if not present 5997 if (jQuery._evalUrl) { 5998 jQuery._evalUrl(node.src); 5999 } 6000 } else { 6001 jQuery.globalEval((node.text || node.textContent || node.innerHTML || "").replace(rcleanScript, "")); 6002 } 6003 } 6004 } 6005 } 6006 6007 // Fix #11809: Avoid leaking memory 6008 fragment = first = null; 6009 } 6010 } 6011 6012 return this; 6013 } 6014 }); 6015 6016 jQuery.each({ 6017 appendTo: "append", 6018 prependTo: "prepend", 6019 insertBefore: "before", 6020 insertAfter: "after", 6021 replaceAll: "replaceWith" 6022 }, function(name, original) { 6023 jQuery.fn[name] = function(selector) { 6024 var elems, 6025 i = 0, 6026 ret = [], 6027 insert = jQuery(selector), 6028 last = insert.length - 1; 6029 6030 for (; i <= last; i++) { 6031 elems = i === last ? this : this.clone(true); 6032 jQuery(insert[i])[original](elems); 6033 6034 // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() 6035 push.apply(ret, elems.get()); 6036 } 6037 6038 return this.pushStack(ret); 6039 }; 6040 }); 6041 6042 6043 var iframe, 6044 elemdisplay = {}; 6045 6046 /** 6047 * Retrieve the actual display of a element 6048 * @param {String} name nodeName of the element 6049 * @param {Object} doc Document object 6050 */ 6051 // Called only from within defaultDisplay 6052 6053 function actualDisplay(name, doc) { 6054 var elem = jQuery(doc.createElement(name)).appendTo(doc.body), 6055 6056 // getDefaultComputedStyle might be reliably used only on attached element 6057 display = window.getDefaultComputedStyle ? 6058 6059 // Use of this method is a temporary fix (more like optmization) until something better comes along, 6060 // since it was removed from specification and supported only in FF 6061 window.getDefaultComputedStyle(elem[0]).display : jQuery.css(elem[0], "display"); 6062 6063 // We don't have any data stored on the element, 6064 // so use "detach" method as fast way to get rid of the element 6065 elem.detach(); 6066
6067 return display; 6068 } 6069 6070 /** 6071 * Try to determine the default display value of an element 6072 * @param {String} nodeName 6073 */ 6074 6075 function defaultDisplay(nodeName) { 6076 var doc = document, 6077 display = elemdisplay[nodeName]; 6078 6079 if (!display) { 6080 display = actualDisplay(nodeName, doc); 6081 6082 // If the simple way fails, read from inside an iframe 6083 if (display === "none" || !display) { 6084 6085 // Use the already-created iframe if possible 6086 iframe = (iframe || jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(doc.documentElement); 6087 6088 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse 6089 doc = (iframe[0].contentWindow || iframe[0].contentDocument).document; 6090 6091 // Support: IE 6092 doc.write(); 6093 doc.close(); 6094 6095 display = actualDisplay(nodeName, doc); 6096 iframe.detach(); 6097 } 6098 6099 // Store the correct default display 6100 elemdisplay[nodeName] = display; 6101 } 6102 6103 return display; 6104 } 6105 6106 6107 (function() { 6108 var a, shrinkWrapBlocksVal, 6109 div = document.createElement("div"), 6110 divReset = 6111 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" + 6112 "display:block;padding:0;margin:0;border:0"; 6113 6114 // Setup 6115 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; 6116 a = div.getElementsByTagName("a")[0]; 6117 6118 a.style.cssText = "float:left;opacity:.5"; 6119 6120 // Make sure that element opacity exists 6121 // (IE uses filter instead) 6122 // Use a regex to work around a WebKit issue. See #5145 6123 support.opacity = /^0.5/.test(a.style.opacity); 6124 6125 // Verify style float existence 6126 // (IE uses styleFloat instead of cssFloat) 6127 support.cssFloat = !! a.style.cssFloat; 6128 6129 div.style.backgroundClip = "content-box"; 6130 div.cloneNode(true).style.backgroundClip = ""; 6131 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6132 6133 // Null elements to avoid leaks in IE. 6134 a = div = null; 6135 6136 support.shrinkWrapBlocks = function() { 6137 var body, container, div, containerStyles; 6138 6139 if (shrinkWrapBlocksVal == null) { 6140 body = document.getElementsByTagName("body")[0]; 6141 if (!body) { 6142 // Test fired too early or in an unsupported environment, exit. 6143 return; 6144 } 6145 6146 containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px"; 6147 container = document.createElement("div"); 6148 div = document.createElement("div"); 6149 6150 body.appendChild(container).appendChild(div); 6151 6152 // Will be changed later if needed. 6153 shrinkWrapBlocksVal = false; 6154 6155 if (typeof div.style.zoom !== strundefined) { 6156 // Support: IE6 6157 // Check if elements with layout shrink-wrap their children 6158 div.style.cssText = divReset + ";width:1px;padding:1px;zoom:1"; 6159 div.innerHTML = "<div></div>"; 6160 div.firstChild.style.width = "5px"; 6161 shrinkWrapBlocksVal = div.offsetWidth !== 3; 6162 } 6163 6164 body.removeChild(container); 6165 6166 // Null elements to avoid leaks in IE. 6167 body = container = div = null; 6168 } 6169 6170 return shrinkWrapBlocksVal; 6171 }; 6172 6173 })(); 6174 var rmargin = (/^margin/); 6175 6176 var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i"); 6177 6178 6179 6180 var getStyles, curCSS, 6181 rposition = /^(top|right|bottom|left)$/; 6182 6183 if (window.getComputedStyle) { 6184 getStyles = function(elem) { 6185 return elem.ownerDocument.defaultView.getComputedStyle(elem, null); 6186 }; 6187 6188 curCSS = function(elem, name, computed) { 6189 var width, minWidth, maxWidth, ret, 6190 style = elem.style; 6191 6192 computed = computed || getStyles(elem); 6193 6194 // getPropertyValue is only needed for .css('filter') in IE9, see #12537 6195 ret = computed ? computed.getPropertyValue(name) || computed[name] : undefined; 6196 6197 if (computed) { 6198 6199 if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) { 6200 ret = jQuery.style(elem, name); 6201 } 6202 6203 // A tribute to the "awesome hack by Dean Edwards" 6204 // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right 6205 // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels 6206 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values 6207 if (rnumnonpx.test(ret) && rmargin.test(name)) { 6208 6209 // Remember the original values 6210 width = style.width; 6211 minWidth = style.minWidth; 6212 maxWidth = style.maxWidth; 6213 6214 // Put in the new values to get a computed value out 6215 style.minWidth = style.maxWidth = style.width = ret; 6216 ret = computed.width; 6217 6218 // Revert the changed values 6219 style.width = width; 6220 style.minWidth = minWidth; 6221 style.maxWidth = maxWidth; 6222 } 6223 } 6224
vendor: 4,171 bytes, lines 6225-6363
6225 // Support: IE 6226 // IE returns zIndex value as an integer. 6227 return ret === undefined ? 6228 ret : 6229 ret + ""; 6230 }; 6231 } else if (document.documentElement.currentStyle) { 6232 getStyles = function(elem) { 6233 return elem.currentStyle; 6234 }; 6235 6236 curCSS = function(elem, name, computed) { 6237 var left, rs, rsLeft, ret, 6238 style = elem.style; 6239 6240 computed = computed || getStyles(elem); 6241 ret = computed ? computed[name] : undefined; 6242 6243 // Avoid setting ret to empty string here 6244 // so we don't default to auto 6245 if (ret == null && style && style[name]) { 6246 ret = style[name]; 6247 } 6248 6249 // From the awesome hack by Dean Edwards 6250 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 6251 6252 // If we're not dealing with a regular pixel number 6253 // but a number that has a weird ending, we need to convert it to pixels 6254 // but not position css attributes, as those are proportional to the parent element instead 6255 // and we can't measure the parent instead because it might trigger a "stacking dolls" problem 6256 if (rnumnonpx.test(ret) && !rposition.test(name)) { 6257 6258 // Remember the original values 6259 left = style.left; 6260 rs = elem.runtimeStyle; 6261 rsLeft = rs && rs.left; 6262 6263 // Put in the new values to get a computed value out 6264 if (rsLeft) { 6265 rs.left = elem.currentStyle.left; 6266 } 6267 style.left = name === "fontSize" ? "1em" : ret; 6268 ret = style.pixelLeft + "px"; 6269 6270 // Revert the changed values 6271 style.left = left; 6272 if (rsLeft) { 6273 rs.left = rsLeft; 6274 } 6275 } 6276 6277 // Support: IE 6278 // IE returns zIndex value as an integer. 6279 return ret === undefined ? 6280 ret : 6281 ret + "" || "auto"; 6282 }; 6283 } 6284 6285 6286 6287 function addGetHookIf(conditionFn, hookFn) { 6288 // Define the hook, we'll check on the first run if it's really needed. 6289 return { 6290 get: function() { 6291 var condition = conditionFn(); 6292 6293 if (condition == null) { 6294 // The test was not ready at this point; screw the hook this time 6295 // but check again when needed next time. 6296 return; 6297 } 6298 6299 if (condition) { 6300 // Hook not needed (or it's not possible to use it due to missing dependency), 6301 // remove it. 6302 // Since there are no other hooks for marginRight, remove the whole object. 6303 delete this.get; 6304 return; 6305 } 6306 6307 // Hook needed; redefine it so that the support test is not executed again. 6308 6309 return (this.get = hookFn).apply(this, arguments); 6310 } 6311 }; 6312 } 6313 6314 6315 (function() { 6316 var a, reliableHiddenOffsetsVal, boxSizingVal, boxSizingReliableVal, 6317 pixelPositionVal, reliableMarginRightVal, 6318 div = document.createElement("div"), 6319 containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px", 6320 divReset = 6321 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" + 6322 "display:block;padding:0;margin:0;border:0"; 6323 6324 // Setup 6325 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; 6326 a = div.getElementsByTagName("a")[0]; 6327 6328 a.style.cssText = "float:left;opacity:.5"; 6329 6330 // Make sure that element opacity exists 6331 // (IE uses filter instead) 6332 // Use a regex to work around a WebKit issue. See #5145 6333 support.opacity = /^0.5/.test(a.style.opacity); 6334 6335 // Verify style float existence 6336 // (IE uses styleFloat instead of cssFloat) 6337 support.cssFloat = !! a.style.cssFloat; 6338 6339 div.style.backgroundClip = "content-box"; 6340 div.cloneNode(true).style.backgroundClip = ""; 6341 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6342 6343 // Null elements to avoid leaks in IE. 6344 a = div = null; 6345 6346 jQuery.extend(support, { 6347 reliableHiddenOffsets: function() { 6348 if (reliableHiddenOffsetsVal != null) { 6349 return reliableHiddenOffsetsVal; 6350 } 6351 6352 var container, tds, isSupported, 6353 div = document.createElement("div"), 6354 body = document.getElementsByTagName("body")[0]; 6355 6356 if (!body) { 6357 // Return for frameset docs that don't have a body 6358 return; 6359 } 6360 6361 // Setup 6362 div.setAttribute("className", "t"); 6363 div.innerHTML = " <link/><table></table><a href='/a'>a</a>
6363<input type='checkbox'/>"; 6364 6365 container = document.createElement("div"); 6366 container.style.cssText = containerStyles; 6367 6368 body.appendChild(container).appendChild(div); 6369 6370 // Support: IE8 6371 // Check if table cells still have offsetWidth/Height when they are set 6372 // to display:none and there are still other visible table cells in a 6373 // table row; if so, offsetWidth/Height are not reliable for use when 6374 // determining if an element has been hidden directly using 6375 // display:none (it is still safe to use offsets if a parent element is 6376 // hidden; don safety goggles and see bug #4512 for more information). 6377 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; 6378 tds = div.getElementsByTagName("td"); 6379 tds[0].style.cssText = "padding:0;margin:0;border:0;display:none"; 6380 isSupported = (tds[0].offsetHeight === 0); 6381 6382 tds[0].style.display = ""; 6383 tds[1].style.display = "none"; 6384 6385 // Support: IE8 6386 // Check if empty table cells still have offsetWidth/Height 6387 reliableHiddenOffsetsVal = isSupported && (tds[0].offsetHeight === 0); 6388 6389 body.removeChild(container); 6390 6391 // Null elements to avoid leaks in IE. 6392 div = body = null; 6393 6394 return reliableHiddenOffsetsVal; 6395 }, 6396 6397 boxSizing: function() { 6398 if (boxSizingVal == null) { 6399 computeStyleTests(); 6400 } 6401 return boxSizingVal; 6402 }, 6403 6404 boxSizingReliable: function() { 6405 if (boxSizingReliableVal == null) { 6406 computeStyleTests(); 6407 } 6408 return boxSizingReliableVal; 6409 }, 6410 6411 pixelPosition: function() { 6412 if (pixelPositionVal == null) { 6413 computeStyleTests(); 6414 } 6415 return pixelPositionVal; 6416 }, 6417 6418 reliableMarginRight: function() { 6419 var body, container, div, marginDiv; 6420 6421 // Use window.getComputedStyle because jsdom on node.js will break without it. 6422 if (reliableMarginRightVal == null && window.getComputedStyle) { 6423 body = document.getElementsByTagName("body")[0]; 6424 if (!body) { 6425 // Test fired too early or in an unsupported environment, exit. 6426 return; 6427 } 6428 6429 container = document.createElement("div"); 6430 div = document.createElement("div"); 6431 container.style.cssText = containerStyles; 6432 6433 body.appendChild(container).appendChild(div); 6434 6435 // Check if div with explicit width and no margin-right incorrectly 6436 // gets computed margin-right based on width of container. (#3333) 6437 // Fails in WebKit before Feb 2011 nightlies 6438 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 6439 marginDiv = div.appendChild(document.createElement("div")); 6440 marginDiv.style.cssText = div.style.cssText = divReset; 6441 marginDiv.style.marginRight = marginDiv.style.width = "0"; 6442 div.style.width = "1px"; 6443 6444 reliableMarginRightVal = !parseFloat((window.getComputedStyle(marginDiv, null) || {}).marginRight); 6445 6446 body.removeChild(container); 6447 } 6448 6449 return reliableMarginRightVal; 6450 } 6451 }); 6452 6453 function computeStyleTests() { 6454 var container, div, 6455 body = document.getElementsByTagName("body")[0]; 6456 6457 if (!body) { 6458 // Test fired too early or in an unsupported environment, exit. 6459 return; 6460 } 6461 6462 container = document.createElement("div"); 6463 div = document.createElement("div"); 6464 container.style.cssText = containerStyles; 6465 6466 body.appendChild(container).appendChild(div); 6467 6468 div.style.cssText = 6469 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;" + 6470 "position:absolute;display:block;padding:1px;border:1px;width:4px;" + 6471 "margin-top:1%;top:1%"; 6472 6473 // Workaround failing boxSizing test due to offsetWidth returning wrong value 6474 // with some non-1 values of body zoom, ticket #13543 6475 jQuery.swap(body, body.style.zoom != null ? { 6476 zoom: 1 6477 } : {}, function() { 6478 boxSizingVal = div.offsetWidth === 4; 6479 }); 6480 6481 // Will be changed later if needed. 6482 boxSizingReliableVal = true; 6483 pixelPositionVal = false; 6484 reliableMarginRightVal = true; 6485
vendor: 107,491 bytes, lines 6486-10355
6486 // Use window.getComputedStyle because jsdom on node.js will break without it. 6487 if (window.getComputedStyle) { 6488 pixelPositionVal = (window.getComputedStyle(div, null) || {}).top !== "1%"; 6489 boxSizingReliableVal = 6490 (window.getComputedStyle(div, null) || { 6491 width: "4px" 6492 }).width === "4px"; 6493 } 6494 6495 body.removeChild(container); 6496 6497 // Null elements to avoid leaks in IE. 6498 div = body = null; 6499 } 6500 6501 })(); 6502 6503 6504 // A method for quickly swapping in/out CSS properties to get correct calculations. 6505 jQuery.swap = function(elem, options, callback, args) { 6506 var ret, name, 6507 old = {}; 6508 6509 // Remember the old values, and insert the new ones 6510 for (name in options) { 6511 old[name] = elem.style[name]; 6512 elem.style[name] = options[name]; 6513 } 6514 6515 ret = callback.apply(elem, args || []); 6516 6517 // Revert the old values 6518 for (name in options) { 6519 elem.style[name] = old[name]; 6520 } 6521 6522 return ret; 6523 }; 6524 6525 6526 var 6527 ralpha = /alpha\([^)]*\)/i, 6528 ropacity = /opacity\s*=\s*([^)]*)/, 6529 6530 // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" 6531 // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 6532 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6533 rnumsplit = new RegExp("^(" + pnum + ")(.*)$", "i"), 6534 rrelNum = new RegExp("^([+-])=(" + pnum + ")", "i"), 6535 6536 cssShow = { 6537 position: "absolute", 6538 visibility: "hidden", 6539 display: "block" 6540 }, 6541 cssNormalTransform = { 6542 letterSpacing: 0, 6543 fontWeight: 400 6544 }, 6545 6546 cssPrefixes = ["Webkit", "O", "Moz", "ms"]; 6547 6548 6549 // return a css property mapped to a potentially vendor prefixed property 6550 6551 function vendorPropName(style, name) { 6552 6553 // shortcut for names that are not vendor prefixed 6554 if (name in style) { 6555 return name; 6556 } 6557 6558 // check for vendor prefixed names 6559 var capName = name.charAt(0).toUpperCase() + name.slice(1), 6560 origName = name, 6561 i = cssPrefixes.length; 6562 6563 while (i--) { 6564 name = cssPrefixes[i] + capName; 6565 if (name in style) { 6566 return name; 6567 } 6568 } 6569 6570 return origName; 6571 } 6572 6573 function showHide(elements, show) { 6574 var display, elem, hidden, 6575 values = [], 6576 index = 0, 6577 length = elements.length; 6578 6579 for (; index < length; index++) { 6580 elem = elements[index]; 6581 if (!elem.style) { 6582 continue; 6583 } 6584 6585 values[index] = jQuery._data(elem, "olddisplay"); 6586 display = elem.style.display; 6587 if (show) { 6588 // Reset the inline display of this element to learn if it is 6589 // being hidden by cascaded rules or not 6590 if (!values[index] && display === "none") { 6591 elem.style.display = ""; 6592 } 6593 6594 // Set elements which have been overridden with display: none 6595 // in a stylesheet to whatever the default browser style is 6596 // for such an element 6597 if (elem.style.display === "" && isHidden(elem)) { 6598 values[index] = jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName)); 6599 } 6600 } else { 6601 6602 if (!values[index]) { 6603 hidden = isHidden(elem); 6604 6605 if (display && display !== "none" || !hidden) { 6606 jQuery._data(elem, "olddisplay", hidden ? display : jQuery.css(elem, "display")); 6607 } 6608 } 6609 } 6610 } 6611 6612 // Set the display of most of the elements in a second loop 6613 // to avoid the constant reflow 6614 for (index = 0; index < length; index++) { 6615 elem = elements[index]; 6616 if (!elem.style) { 6617 continue; 6618 } 6619 if (!show || elem.style.display === "none" || elem.style.display === "") { 6620 elem.style.display = show ? values[index] || "" : "none"; 6621 } 6622 } 6623 6624 return elements; 6625 } 6626 6627 function setPositiveNumber(elem, value, subtract) { 6628 var matches = rnumsplit.exec(value); 6629 return matches ? 6630 // Guard against undefined "subtract", e.g., when used as in cssHooks 6631 Math.max(0, matches[1] - (subtract || 0)) + (matches[2] || "px") : 6632 value; 6633 } 6634 6635 function augmentWidthOrHeight(elem, name, extra, isBorderBox, styles) { 6636 var i = extra === (isBorderBox ? "border" : "content") ? 6637 // If we already have the right measurement, avoid augmentation 6638 4 : 6639 // Otherwise initialize for horizontal or vertical properties 6640 name === "width" ? 1 : 0, 6641 6642 val = 0; 6643 6644 for (; i < 4; i += 2) { 6645 // both box models exclude margin, so add it if we want it 6646 if (extra === "margin") { 6647 val += jQuery.css(elem, extra + cssExpand[i], true, styles); 6648 } 6649 6650 if (isBorderBox) { 6651 // border-box includes padding, so remove it if we want content 6652 if (extra === "content") { 6653 val -= jQuery.css(elem, "padding" + cssExpand[i], true, styles); 6654 } 6655 6656 // at this point, extra isn't border nor margin, so remove border 6657 if (extra !== "margin") { 6658 val -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles); 6659 } 6660 } else { 6661 // at this point, extra isn't content, so add padding 6662 val += jQuery.css(elem, "padding" + cssExpand[i], true, styles); 6663 6664 // at this point, extra isn't content nor padding, so add border 6665 if (extra !== "padding") { 6666 val += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles); 6667 } 6668 } 6669 } 6670 6671 return val; 6672 } 6673 6674 function getWidthOrHeight(elem, name, extra) { 6675 6676 // Start with offset property, which is equivalent to the border-box value 6677 var valueIsBorderBox = true, 6678 val = name === "width" ? elem.offsetWidth : elem.offsetHeight, 6679 styles = getStyles(elem), 6680 isBorderBox = support.boxSizing() && jQuery.css(elem, "boxSizing", false, styles) === "border-box"; 6681 6682 // some non-html elements return undefined for offsetWidth, so check for null/undefined 6683 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 6684 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 6685 if (val <= 0 || val == null) { 6686 // Fall back to computed then uncomputed css if necessary 6687 val = curCSS(elem, name, styles); 6688 if (val < 0 || val == null) { 6689 val = elem.style[name]; 6690 } 6691 6692 // Computed unit is not pixels. Stop here and return. 6693 if (rnumnonpx.test(val)) { 6694 return val; 6695 } 6696 6697 // we need the check for style in case a browser which returns unreliable values 6698 // for getComputedStyle silently falls back to the reliable elem.style 6699 valueIsBorderBox = isBorderBox && (support.boxSizingReliable() || val === elem.style[name]); 6700 6701 // Normalize "", auto, and prepare for extra 6702 val = parseFloat(val) || 0; 6703 } 6704 6705 // use the active box-sizing model to add/subtract irrelevant styles 6706 return (val + 6707 augmentWidthOrHeight( 6708 elem, 6709 name, 6710 extra || (isBorderBox ? "border" : "content"), 6711 valueIsBorderBox, 6712 styles 6713 ) 6714 ) + "px"; 6715 } 6716 6717 jQuery.extend({ 6718 // Add in style property hooks for overriding the default 6719 // behavior of getting and setting a style property 6720 cssHooks: { 6721 opacity: { 6722 get: function(elem, computed) { 6723 if (computed) { 6724 // We should always get a number back from opacity 6725 var ret = curCSS(elem, "opacity"); 6726 return ret === "" ? "1" : ret; 6727 } 6728 } 6729 } 6730 }, 6731 6732 // Don't automatically add "px" to these possibly-unitless properties 6733 cssNumber: { 6734 "columnCount": true, 6735 "fillOpacity": true, 6736 "fontWeight": true, 6737 "lineHeight": true, 6738 "opacity": true, 6739 "order": true, 6740 "orphans": true, 6741 "widows": true, 6742 "zIndex": true, 6743 "zoom": true 6744 }, 6745 6746 // Add in properties whose names you wish to fix before 6747 // setting or getting the value 6748 cssProps: { 6749 // normalize float css property 6750 "float": support.cssFloat ? "cssFloat" : "styleFloat" 6751 }, 6752 6753 // Get and set the style property on a DOM Node 6754 style: function(elem, name, value, extra) { 6755 // Don't set styles on text and comment nodes 6756 if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) { 6757 return; 6758 } 6759 6760 // Make sure that we're working with the right name 6761 var ret, type, hooks, 6762 origName = jQuery.camelCase(name), 6763 style = elem.style; 6764 6765 name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(style, origName)); 6766 6767 // gets hook for the prefixed version 6768 // followed by the unprefixed version 6769 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; 6770 6771 // Check if we're setting a value 6772 if (value !== undefined) { 6773 type = typeof value; 6774 6775 // convert relative number strings (+= or -=) to relative numbers. #7345 6776 if (type === "string" && (ret = rrelNum.exec(value))) { 6777 value = (ret[1] + 1) * ret[2] + parseFloat(jQuery.css(elem, name)); 6778 // Fixes bug #9237 6779 type = "number"; 6780 } 6781 6782 // Make sure that null and NaN values aren't set. See: #7116 6783 if (value == null || value !== value) { 6784 return; 6785 } 6786 6787 // If a number was passed in, add 'px' to the (except for certain CSS properties) 6788 if (type === "number" && !jQuery.cssNumber[origName]) { 6789 value += "px"; 6790 } 6791 6792 // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, 6793 // but it would mean to define eight (for every problematic property) identical functions 6794 if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) { 6795 style[name] = "inherit"; 6796 } 6797 6798 // If a hook was provided, use that value, otherwise just set the specified value 6799 if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) { 6800 6801 // Support: IE 6802 // Swallow errors from 'invalid' CSS values (#5509) 6803 try { 6804 // Support: Chrome, Safari 6805 // Setting style to blank string required to delete "style: x !important;" 6806 style[name] = ""; 6807 style[name] = value; 6808 } catch (e) {} 6809 } 6810 6811 } else { 6812 // If a hook was provided get the non-computed value from there 6813 if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) { 6814 return ret; 6815 } 6816 6817 // Otherwise just get the value from the style object 6818 return style[name]; 6819 } 6820 }, 6821 6822 css: function(elem, name, extra, styles) { 6823 var num, val, hooks, 6824 origName = jQuery.camelCase(name); 6825 6826 // Make sure that we're working with the right name 6827 name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(elem.style, origName)); 6828 6829 // gets hook for the prefixed version 6830 // followed by the unprefixed version 6831 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; 6832 6833 // If a hook was provided get the computed value from there 6834 if (hooks && "get" in hooks) { 6835 val = hooks.get(elem, true, extra); 6836 } 6837 6838 // Otherwise, if a way to get the computed value exists, use that 6839 if (val === undefined) { 6840 val = curCSS(elem, name, styles); 6841 } 6842 6843 //convert "normal" to computed value 6844 if (val === "normal" && name in cssNormalTransform) { 6845 val = cssNormalTransform[name]; 6846 } 6847 6848 // Return, converting to number if forced or a qualifier was provided and val looks numeric 6849 if (extra === "" || extra) { 6850 num = parseFloat(val); 6851 return extra === true || jQuery.isNumeric(num) ? num || 0 : val; 6852 } 6853 return val; 6854 } 6855 }); 6856 6857 jQuery.each(["height", "width"], function(i, name) { 6858 jQuery.cssHooks[name] = { 6859 get: function(elem, computed, extra) { 6860 if (computed) { 6861 // certain elements can have dimension info if we invisibly show them 6862 // however, it must have a current display style that would benefit from this 6863 return elem.offsetWidth === 0 && rdisplayswap.test(jQuery.css(elem, "display")) ? 6864 jQuery.swap(elem, cssShow, function() { 6865 return getWidthOrHeight(elem, name, extra); 6866 }) : 6867 getWidthOrHeight(elem, name, extra); 6868 } 6869 }, 6870 6871 set: function(elem, value, extra) { 6872 var styles = extra && getStyles(elem); 6873 return setPositiveNumber(elem, value, extra ? 6874 augmentWidthOrHeight( 6875 elem, 6876 name, 6877 extra, 6878 support.boxSizing() && jQuery.css(elem, "boxSizing", false, styles) === "border-box", 6879 styles 6880 ) : 0 6881 ); 6882 } 6883 }; 6884 }); 6885 6886 if (!support.opacity) { 6887 jQuery.cssHooks.opacity = { 6888 get: function(elem, computed) { 6889 // IE uses filters for opacity 6890 return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ? 6891 (0.01 * parseFloat(RegExp.$1)) + "" : 6892 computed ? "1" : ""; 6893 }, 6894 6895 set: function(elem, value) { 6896 var style = elem.style, 6897 currentStyle = elem.currentStyle, 6898 opacity = jQuery.isNumeric(value) ? "alpha(opacity=" + value * 100 + ")" : "", 6899 filter = currentStyle && currentStyle.filter || style.filter || ""; 6900 6901 // IE has trouble with opacity if it does not have layout 6902 // Force it by setting the zoom level 6903 style.zoom = 1; 6904 6905 // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 6906 // if value === "", then remove inline opacity #12685 6907 if ((value >= 1 || value === "") && 6908 jQuery.trim(filter.replace(ralpha, "")) === "" && 6909 style.removeAttribute) { 6910 6911 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText 6912 // if "filter:" is present at all, clearType is disabled, we want to avoid this 6913 // style.removeAttribute is IE Only, but so apparently is this code path... 6914 style.removeAttribute("filter"); 6915 6916 // if there is no filter style applied in a css rule or unset inline opacity, we are done 6917 if (value === "" || currentStyle && !currentStyle.filter) { 6918 return; 6919 } 6920 } 6921 6922 // otherwise, set new filter values 6923 style.filter = ralpha.test(filter) ? 6924 filter.replace(ralpha, opacity) : 6925 filter + " " + opacity; 6926 } 6927 }; 6928 } 6929 6930 jQuery.cssHooks.marginRight = addGetHookIf(support.reliableMarginRight, 6931 function(elem, computed) { 6932 if (computed) { 6933 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 6934 // Work around by temporarily setting element display to inline-block 6935 return jQuery.swap(elem, { 6936 "display": "inline-block" 6937 }, 6938 curCSS, [elem, "marginRight"]); 6939 } 6940 } 6941 ); 6942 6943 // These hooks are used by animate to expand properties 6944 jQuery.each({ 6945 margin: "", 6946 padding: "", 6947 border: "Width" 6948 }, function(prefix, suffix) { 6949 jQuery.cssHooks[prefix + suffix] = { 6950 expand: function(value) { 6951 var i = 0, 6952 expanded = {}, 6953 6954 // assumes a single number if not a string 6955 parts = typeof value === "string" ? value.split(" ") : [value]; 6956 6957 for (; i < 4; i++) { 6958 expanded[prefix + cssExpand[i] + suffix] = 6959 parts[i] || parts[i - 2] || parts[0]; 6960 } 6961 6962 return expanded; 6963 } 6964 }; 6965 6966 if (!rmargin.test(prefix)) { 6967 jQuery.cssHooks[prefix + suffix].set = setPositiveNumber; 6968 } 6969 }); 6970 6971 jQuery.fn.extend({ 6972 css: function(name, value) { 6973 return access(this, function(elem, name, value) { 6974 var styles, len, 6975 map = {}, 6976 i = 0; 6977 6978 if (jQuery.isArray(name)) { 6979 styles = getStyles(elem); 6980 len = name.length; 6981 6982 for (; i < len; i++) { 6983 map[name[i]] = jQuery.css(elem, name[i], false, styles); 6984 } 6985 6986 return map; 6987 } 6988 6989 return value !== undefined ? 6990 jQuery.style(elem, name, value) : 6991 jQuery.css(elem, name); 6992 }, name, value, arguments.length > 1); 6993 }, 6994 show: function() { 6995 return showHide(this, true); 6996 }, 6997 hide: function() { 6998 return showHide(this); 6999 }, 7000 toggle: function(state) { 7001 if (typeof state === "boolean") { 7002 return state ? this.show() : this.hide(); 7003 } 7004 7005 return this.each(function() { 7006 if (isHidden(this)) { 7007 jQuery(this).show(); 7008 } else { 7009 jQuery(this).hide(); 7010 } 7011 }); 7012 } 7013 }); 7014 7015 7016 function Tween(elem, options, prop, end, easing) { 7017 return new Tween.prototype.init(elem, options, prop, end, easing); 7018 } 7019 jQuery.Tween = Tween; 7020 7021 Tween.prototype = { 7022 constructor: Tween, 7023 init: function(elem, options, prop, end, easing, unit) { 7024 this.elem = elem; 7025 this.prop = prop; 7026 this.easing = easing || "swing"; 7027 this.options = options; 7028 this.start = this.now = this.cur(); 7029 this.end = end; 7030 this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px"); 7031 }, 7032 cur: function() { 7033 var hooks = Tween.propHooks[this.prop]; 7034 7035 return hooks && hooks.get ? 7036 hooks.get(this) : 7037 Tween.propHooks._default.get(this); 7038 }, 7039 run: function(percent) { 7040 var eased, 7041 hooks = Tween.propHooks[this.prop]; 7042 7043 if (this.options.duration) { 7044 this.pos = eased = jQuery.easing[this.easing]( 7045 percent, this.options.duration * percent, 0, 1, this.options.duration 7046 ); 7047 } else { 7048 this.pos = eased = percent; 7049 } 7050 this.now = (this.end - this.start) * eased + this.start; 7051 7052 if (this.options.step) { 7053 this.options.step.call(this.elem, this.now, this); 7054 } 7055 7056 if (hooks && hooks.set) { 7057 hooks.set(this); 7058 } else { 7059 Tween.propHooks._default.set(this); 7060 } 7061 return this; 7062 } 7063 }; 7064 7065 Tween.prototype.init.prototype = Tween.prototype; 7066 7067 Tween.propHooks = { 7068 _default: { 7069 get: function(tween) { 7070 var result; 7071 7072 if (tween.elem[tween.prop] != null && 7073 (!tween.elem.style || tween.elem.style[tween.prop] == null)) { 7074 return tween.elem[tween.prop]; 7075 } 7076 7077 // passing an empty string as a 3rd parameter to .css will automatically 7078 // attempt a parseFloat and fallback to a string if the parse fails 7079 // so, simple values such as "10px" are parsed to Float. 7080 // complex values such as "rotate(1rad)" are returned as is. 7081 result = jQuery.css(tween.elem, tween.prop, ""); 7082 // Empty strings, null, undefined and "auto" are converted to 0. 7083 return !result || result === "auto" ? 0 : result; 7084 }, 7085 set: function(tween) { 7086 // use step hook for back compat - use cssHook if its there - use .style if its 7087 // available and use plain properties where available 7088 if (jQuery.fx.step[tween.prop]) { 7089 jQuery.fx.step[tween.prop](tween); 7090 } else if (tween.elem.style && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) { 7091 jQuery.style(tween.elem, tween.prop, tween.now + tween.unit); 7092 } else { 7093 tween.elem[tween.prop] = tween.now; 7094 } 7095 } 7096 } 7097 }; 7098 7099 // Support: IE <=9 7100 // Panic based approach to setting things on disconnected nodes 7101 7102 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 7103 set: function(tween) { 7104 if (tween.elem.nodeType && tween.elem.parentNode) { 7105 tween.elem[tween.prop] = tween.now; 7106 } 7107 } 7108 }; 7109 7110 jQuery.easing = { 7111 linear: function(p) { 7112 return p; 7113 }, 7114 swing: function(p) { 7115 return 0.5 - Math.cos(p * Math.PI) / 2; 7116 } 7117 }; 7118 7119 jQuery.fx = Tween.prototype.init; 7120 7121 // Back Compat <1.8 extension point 7122 jQuery.fx.step = {}; 7123 7124 7125 7126 var 7127 fxNow, timerId, 7128 rfxtypes = /^(?:toggle|show|hide)$/, 7129 rfxnum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"), 7130 rrun = /queueHooks$/, 7131 animationPrefilters = [defaultPrefilter], 7132 tweeners = { 7133 "*": [ 7134 function(prop, value) { 7135 var tween = this.createTween(prop, value), 7136 target = tween.cur(), 7137 parts = rfxnum.exec(value), 7138 unit = parts && parts[3] || (jQuery.cssNumber[prop] ? "" : "px"), 7139 7140 // Starting value computation is required for potential unit mismatches 7141 start = (jQuery.cssNumber[prop] || unit !== "px" && +target) && 7142 rfxnum.exec(jQuery.css(tween.elem, prop)), 7143 scale = 1, 7144 maxIterations = 20; 7145 7146 if (start && start[3] !== unit) { 7147 // Trust units reported by jQuery.css 7148 unit = unit || start[3]; 7149 7150 // Make sure we update the tween properties later on 7151 parts = parts || []; 7152 7153 // Iteratively approximate from a nonzero starting point 7154 start = +target || 1; 7155 7156 do { 7157 // If previous iteration zeroed out, double until we get *something* 7158 // Use a string for doubling factor so we don't accidentally see scale as unchanged below 7159 scale = scale || ".5"; 7160 7161 // Adjust and apply 7162 start = start / scale; 7163 jQuery.style(tween.elem, prop, start + unit); 7164 7165 // Update scale, tolerating zero or NaN from tween.cur() 7166 // And breaking the loop if scale is unchanged or perfect, or if we've just had enough 7167 } while (scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations); 7168 } 7169 7170 // Update tween properties 7171 if (parts) { 7172 start = tween.start = +start || +target || 0; 7173 tween.unit = unit; 7174 // If a +=/-= token was provided, we're doing a relative animation 7175 tween.end = parts[1] ? 7176 start + (parts[1] + 1) * parts[2] : +parts[2]; 7177 } 7178 7179 return tween; 7180 } 7181 ] 7182 }; 7183 7184 // Animations created synchronously will run synchronously 7185 7186 function createFxNow() { 7187 setTimeout(function() { 7188 fxNow = undefined; 7189 }); 7190 return (fxNow = jQuery.now()); 7191 } 7192 7193 // Generate parameters to create a standard animation 7194 7195 function genFx(type, includeWidth) { 7196 var which, 7197 attrs = { 7198 height: type 7199 }, 7200 i = 0; 7201 7202 // if we include width, step value is 1 to do all cssExpand values, 7203 // if we don't include width, step value is 2 to skip over Left and Right 7204 includeWidth = includeWidth ? 1 : 0; 7205 for (; i < 4; i += 2 - includeWidth) { 7206 which = cssExpand[i]; 7207 attrs["margin" + which] = attrs["padding" + which] = type; 7208 } 7209 7210 if (includeWidth) { 7211 attrs.opacity = attrs.width = type; 7212 } 7213 7214 return attrs; 7215 } 7216 7217 function createTween(value, prop, animation) { 7218 var tween, 7219 collection = (tweeners[prop] || []).concat(tweeners["*"]), 7220 index = 0, 7221 length = collection.length; 7222 for (; index < length; index++) { 7223 if ((tween = collection[index].call(animation, prop, value))) { 7224 7225 // we're done with this property 7226 return tween; 7227 } 7228 } 7229 } 7230 7231 function defaultPrefilter(elem, props, opts) { 7232 /* jshint validthis: true */ 7233 var prop, value, toggle, tween, hooks, oldfire, display, dDisplay, 7234 anim = this, 7235 orig = {}, 7236 style = elem.style, 7237 hidden = elem.nodeType && isHidden(elem), 7238 dataShow = jQuery._data(elem, "fxshow"); 7239 7240 // handle queue: false promises 7241 if (!opts.queue) { 7242 hooks = jQuery._queueHooks(elem, "fx"); 7243 if (hooks.unqueued == null) { 7244 hooks.unqueued = 0; 7245 oldfire = hooks.empty.fire; 7246 hooks.empty.fire = function() { 7247 if (!hooks.unqueued) { 7248 oldfire(); 7249 } 7250 }; 7251 } 7252 hooks.unqueued++; 7253 7254 anim.always(function() { 7255 // doing this makes sure that the complete handler will be called 7256 // before this completes 7257 anim.always(function() { 7258 hooks.unqueued--; 7259 if (!jQuery.queue(elem, "fx").length) { 7260 hooks.empty.fire(); 7261 } 7262 }); 7263 }); 7264 } 7265 7266 // height/width overflow pass 7267 if (elem.nodeType === 1 && ("height" in props || "width" in props)) { 7268 // Make sure that nothing sneaks out 7269 // Record all 3 overflow attributes because IE does not 7270 // change the overflow attribute when overflowX and 7271 // overflowY are set to the same value 7272 opts.overflow = [style.overflow, style.overflowX, style.overflowY]; 7273 7274 // Set display property to inline-block for height/width 7275 // animations on inline elements that are having width/height animated 7276 display = jQuery.css(elem, "display"); 7277 dDisplay = defaultDisplay(elem.nodeName); 7278 if (display === "none") { 7279 display = dDisplay; 7280 } 7281 if (display === "inline" && 7282 jQuery.css(elem, "float") === "none") { 7283 7284 // inline-level elements accept inline-block; 7285 // block-level elements need to be inline with layout 7286 if (!support.inlineBlockNeedsLayout || dDisplay === "inline") { 7287 style.display = "inline-block"; 7288 } else { 7289 style.zoom = 1; 7290 } 7291 } 7292 } 7293 7294 if (opts.overflow) { 7295 style.overflow = "hidden"; 7296 if (!support.shrinkWrapBlocks()) { 7297 anim.always(function() { 7298 style.overflow = opts.overflow[0]; 7299 style.overflowX = opts.overflow[1]; 7300 style.overflowY = opts.overflow[2]; 7301 }); 7302 } 7303 } 7304 7305 // show/hide pass 7306 for (prop in props) { 7307 value = props[prop]; 7308 if (rfxtypes.exec(value)) { 7309 delete props[prop]; 7310 toggle = toggle || value === "toggle"; 7311 if (value === (hidden ? "hide" : "show")) { 7312 7313 // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden 7314 if (value === "show" && dataShow && dataShow[prop] !== undefined) { 7315 hidden = true; 7316 } else { 7317 continue; 7318 } 7319 } 7320 orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop); 7321 } 7322 } 7323 7324 if (!jQuery.isEmptyObject(orig)) { 7325 if (dataShow) { 7326 if ("hidden" in dataShow) { 7327 hidden = dataShow.hidden; 7328 } 7329 } else { 7330 dataShow = jQuery._data(elem, "fxshow", {}); 7331 } 7332 7333 // store state if its toggle - enables .stop().toggle() to "reverse" 7334 if (toggle) { 7335 dataShow.hidden = !hidden; 7336 } 7337 if (hidden) { 7338 jQuery(elem).show(); 7339 } else { 7340 anim.done(function() { 7341 jQuery(elem).hide(); 7342 }); 7343 } 7344 anim.done(function() { 7345 var prop; 7346 jQuery._removeData(elem, "fxshow"); 7347 for (prop in orig) { 7348 jQuery.style(elem, prop, orig[prop]); 7349 } 7350 }); 7351 for (prop in orig) { 7352 tween = createTween(hidden ? dataShow[prop] : 0, prop, anim); 7353 7354 if (!(prop in dataShow)) { 7355 dataShow[prop] = tween.start; 7356 if (hidden) { 7357 tween.end = tween.start; 7358 tween.start = prop === "width" || prop === "height" ? 1 : 0; 7359 } 7360 } 7361 } 7362 } 7363 } 7364 7365 function propFilter(props, specialEasing) { 7366 var index, name, easing, value, hooks; 7367 7368 // camelCase, specialEasing and expand cssHook pass 7369 for (index in props) { 7370 name = jQuery.camelCase(index); 7371 easing = specialEasing[name]; 7372 value = props[index]; 7373 if (jQuery.isArray(value)) { 7374 easing = value[1]; 7375 value = props[index] = value[0]; 7376 } 7377 7378 if (index !== name) { 7379 props[name] = value; 7380 delete props[index]; 7381 } 7382 7383 hooks = jQuery.cssHooks[name]; 7384 if (hooks && "expand" in hooks) { 7385 value = hooks.expand(value); 7386 delete props[name]; 7387 7388 // not quite $.extend, this wont overwrite keys already present. 7389 // also - reusing 'index' from above because we have the correct "name" 7390 for (index in value) { 7391 if (!(index in props)) { 7392 props[index] = value[index]; 7393 specialEasing[index] = easing; 7394 } 7395 } 7396 } else { 7397 specialEasing[name] = easing; 7398 } 7399 } 7400 } 7401 7402 function Animation(elem, properties, options) { 7403 var result, 7404 stopped, 7405 index = 0, 7406 length = animationPrefilters.length, 7407 deferred = jQuery.Deferred().always(function() { 7408 // don't match elem in the :animated selector 7409 delete tick.elem; 7410 }), 7411 tick = function() { 7412 if (stopped) { 7413 return false; 7414 } 7415 var currentTime = fxNow || createFxNow(), 7416 remaining = Math.max(0, animation.startTime + animation.duration - currentTime), 7417 // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) 7418 temp = remaining / animation.duration || 0, 7419 percent = 1 - temp, 7420 index = 0, 7421 length = animation.tweens.length; 7422 7423 for (; index < length; index++) { 7424 animation.tweens[index].run(percent); 7425 } 7426 7427 deferred.notifyWith(elem, [animation, percent, remaining]); 7428 7429 if (percent < 1 && length) { 7430 return remaining; 7431 } else { 7432 deferred.resolveWith(elem, [animation]); 7433 return false; 7434 } 7435 }, 7436 animation = deferred.promise({ 7437 elem: elem, 7438 props: jQuery.extend({}, properties), 7439 opts: jQuery.extend(true, { 7440 specialEasing: {} 7441 }, options), 7442 originalProperties: properties, 7443 originalOptions: options, 7444 startTime: fxNow || createFxNow(), 7445 duration: options.duration, 7446 tweens: [], 7447 createTween: function(prop, end) { 7448 var tween = jQuery.Tween(elem, animation.opts, prop, end, 7449 animation.opts.specialEasing[prop] || animation.opts.easing); 7450 animation.tweens.push(tween); 7451 return tween; 7452 }, 7453 stop: function(gotoEnd) { 7454 var index = 0, 7455 // if we are going to the end, we want to run all the tweens 7456 // otherwise we skip this part 7457 length = gotoEnd ? animation.tweens.length : 0; 7458 if (stopped) { 7459 return this; 7460 } 7461 stopped = true; 7462 for (; index < length; index++) { 7463 animation.tweens[index].run(1); 7464 } 7465 7466 // resolve when we played the last frame 7467 // otherwise, reject 7468 if (gotoEnd) { 7469 deferred.resolveWith(elem, [animation, gotoEnd]); 7470 } else { 7471 deferred.rejectWith(elem, [animation, gotoEnd]); 7472 } 7473 return this; 7474 } 7475 }), 7476 props = animation.props; 7477 7478 propFilter(props, animation.opts.specialEasing); 7479 7480 for (; index < length; index++) { 7481 result = animationPrefilters[index].call(animation, elem, props, animation.opts); 7482 if (result) { 7483 return result; 7484 } 7485 } 7486 7487 jQuery.map(props, createTween, animation); 7488 7489 if (jQuery.isFunction(animation.opts.start)) { 7490 animation.opts.start.call(elem, animation); 7491 } 7492 7493 jQuery.fx.timer( 7494 jQuery.extend(tick, { 7495 elem: elem, 7496 anim: animation, 7497 queue: animation.opts.queue 7498 }) 7499 ); 7500 7501 // attach callbacks from options 7502 return animation.progress(animation.opts.progress) 7503 .done(animation.opts.done, animation.opts.complete) 7504 .fail(animation.opts.fail) 7505 .always(animation.opts.always); 7506 } 7507 7508 jQuery.Animation = jQuery.extend(Animation, { 7509 tweener: function(props, callback) { 7510 if (jQuery.isFunction(props)) { 7511 callback = props; 7512 props = ["*"]; 7513 } else { 7514 props = props.split(" "); 7515 } 7516 7517 var prop, 7518 index = 0, 7519 length = props.length; 7520 7521 for (; index < length; index++) { 7522 prop = props[index]; 7523 tweeners[prop] = tweeners[prop] || []; 7524 tweeners[prop].unshift(callback); 7525 } 7526 }, 7527 7528 prefilter: function(callback, prepend) { 7529 if (prepend) { 7530 animationPrefilters.unshift(callback); 7531 } else { 7532 animationPrefilters.push(callback); 7533 } 7534 } 7535 }); 7536 7537 jQuery.speed = function(speed, easing, fn) { 7538 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : { 7539 complete: fn || !fn && easing || jQuery.isFunction(speed) && speed, 7540 duration: speed, 7541 easing: fn && easing || easing && !jQuery.isFunction(easing) && easing 7542 }; 7543 7544 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : 7545 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default; 7546 7547 // normalize opt.queue - true/undefined/null -> "fx" 7548 if (opt.queue == null || opt.queue === true) { 7549 opt.queue = "fx"; 7550 } 7551 7552 // Queueing 7553 opt.old = opt.complete; 7554 7555 opt.complete = function() { 7556 if (jQuery.isFunction(opt.old)) { 7557 opt.old.call(this); 7558 } 7559 7560 if (opt.queue) { 7561 jQuery.dequeue(this, opt.queue); 7562 } 7563 }; 7564 7565 return opt; 7566 }; 7567 7568 jQuery.fn.extend({ 7569 fadeTo: function(speed, to, easing, callback) { 7570 7571 // show any hidden elements after setting opacity to 0 7572 return this.filter(isHidden).css("opacity", 0).show() 7573 7574 // animate to the value specified 7575 .end().animate({ 7576 opacity: to 7577 }, speed, easing, callback); 7578 }, 7579 animate: function(prop, speed, easing, callback) { 7580 var empty = jQuery.isEmptyObject(prop), 7581 optall = jQuery.speed(speed, easing, callback), 7582 doAnimation = function() { 7583 // Operate on a copy of prop so per-property easing won't be lost 7584 var anim = Animation(this, jQuery.extend({}, prop), optall); 7585 7586 // Empty animations, or finishing resolves immediately 7587 if (empty || jQuery._data(this, "finish")) { 7588 anim.stop(true); 7589 } 7590 }; 7591 doAnimation.finish = doAnimation; 7592 7593 return empty || optall.queue === false ? 7594 this.each(doAnimation) : 7595 this.queue(optall.queue, doAnimation); 7596 }, 7597 stop: function(type, clearQueue, gotoEnd) { 7598 var stopQueue = function(hooks) { 7599 var stop = hooks.stop; 7600 delete hooks.stop; 7601 stop(gotoEnd); 7602 }; 7603 7604 if (typeof type !== "string") { 7605 gotoEnd = clearQueue; 7606 clearQueue = type; 7607 type = undefined; 7608 } 7609 if (clearQueue && type !== false) { 7610 this.queue(type || "fx", []); 7611 } 7612 7613 return this.each(function() { 7614 var dequeue = true, 7615 index = type != null && type + "queueHooks", 7616 timers = jQuery.timers, 7617 data = jQuery._data(this); 7618 7619 if (index) { 7620 if (data[index] && data[index].stop) { 7621 stopQueue(data[index]); 7622 } 7623 } else { 7624 for (index in data) { 7625 if (data[index] && data[index].stop && rrun.test(index)) { 7626 stopQueue(data[index]); 7627 } 7628 } 7629 } 7630 7631 for (index = timers.length; index--;) { 7632 if (timers[index].elem === this && (type == null || timers[index].queue === type)) { 7633 timers[index].anim.stop(gotoEnd); 7634 dequeue = false; 7635 timers.splice(index, 1); 7636 } 7637 } 7638 7639 // start the next in the queue if the last step wasn't forced 7640 // timers currently will call their complete callbacks, which will dequeue 7641 // but only if they were gotoEnd 7642 if (dequeue || !gotoEnd) { 7643 jQuery.dequeue(this, type); 7644 } 7645 }); 7646 }, 7647 finish: function(type) { 7648 if (type !== false) { 7649 type = type || "fx"; 7650 } 7651 return this.each(function() { 7652 var index, 7653 data = jQuery._data(this), 7654 queue = data[type + "queue"], 7655 hooks = data[type + "queueHooks"], 7656 timers = jQuery.timers, 7657 length = queue ? queue.length : 0; 7658 7659 // enable finishing flag on private data 7660 data.finish = true; 7661 7662 // empty the queue first 7663 jQuery.queue(this, type, []); 7664 7665 if (hooks && hooks.stop) { 7666 hooks.stop.call(this, true); 7667 } 7668 7669 // look for any active animations, and finish them 7670 for (index = timers.length; index--;) { 7671 if (timers[index].elem === this && timers[index].queue === type) { 7672 timers[index].anim.stop(true); 7673 timers.splice(index, 1); 7674 } 7675 } 7676 7677 // look for any animations in the old queue and finish them 7678 for (index = 0; index < length; index++) { 7679 if (queue[index] && queue[index].finish) { 7680 queue[index].finish.call(this); 7681 } 7682 } 7683 7684 // turn off finishing flag 7685 delete data.finish; 7686 }); 7687 } 7688 }); 7689 7690 jQuery.each(["toggle", "show", "hide"], function(i, name) { 7691 var cssFn = jQuery.fn[name]; 7692 jQuery.fn[name] = function(speed, easing, callback) { 7693 return speed == null || typeof speed === "boolean" ? 7694 cssFn.apply(this, arguments) : 7695 this.animate(genFx(name, true), speed, easing, callback); 7696 }; 7697 }); 7698 7699 // Generate shortcuts for custom animations 7700 jQuery.each({ 7701 slideDown: genFx("show"), 7702 slideUp: genFx("hide"), 7703 slideToggle: genFx("toggle"), 7704 fadeIn: { 7705 opacity: "show" 7706 }, 7707 fadeOut: { 7708 opacity: "hide" 7709 }, 7710 fadeToggle: { 7711 opacity: "toggle" 7712 } 7713 }, function(name, props) { 7714 jQuery.fn[name] = function(speed, easing, callback) { 7715 return this.animate(props, speed, easing, callback); 7716 }; 7717 }); 7718 7719 jQuery.timers = []; 7720 jQuery.fx.tick = function() { 7721 var timer, 7722 timers = jQuery.timers, 7723 i = 0; 7724 7725 fxNow = jQuery.now(); 7726 7727 for (; i < timers.length; i++) { 7728 timer = timers[i]; 7729 // Checks the timer has not already been removed 7730 if (!timer() && timers[i] === timer) { 7731 timers.splice(i--, 1); 7732 } 7733 } 7734 7735 if (!timers.length) { 7736 jQuery.fx.stop(); 7737 } 7738 fxNow = undefined; 7739 }; 7740 7741 jQuery.fx.timer = function(timer) { 7742 jQuery.timers.push(timer); 7743 if (timer()) { 7744 jQuery.fx.start(); 7745 } else { 7746 jQuery.timers.pop(); 7747 } 7748 }; 7749 7750 jQuery.fx.interval = 13; 7751 7752 jQuery.fx.start = function() { 7753 if (!timerId) { 7754 timerId = setInterval(jQuery.fx.tick, jQuery.fx.interval); 7755 } 7756 }; 7757 7758 jQuery.fx.stop = function() { 7759 clearInterval(timerId); 7760 timerId = null; 7761 }; 7762 7763 jQuery.fx.speeds = { 7764 slow: 600, 7765 fast: 200, 7766 // Default speed 7767 _default: 400 7768 }; 7769 7770 7771 // Based off of the plugin by Clint Helfers, with permission. 7772 // http://blindsignals.com/index.php/2009/07/jquery-delay/ 7773 jQuery.fn.delay = function(time, type) { 7774 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; 7775 type = type || "fx"; 7776 7777 return this.queue(type, function(next, hooks) { 7778 var timeout = setTimeout(next, time); 7779 hooks.stop = function() { 7780 clearTimeout(timeout); 7781 }; 7782 }); 7783 }; 7784 7785 7786 (function() { 7787 var a, input, select, opt, 7788 div = document.createElement("div"); 7789 7790 // Setup 7791 div.setAttribute("className", "t"); 7792 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; 7793 a = div.getElementsByTagName("a")[0]; 7794 7795 // First batch of tests. 7796 select = document.createElement("select"); 7797 opt = select.appendChild(document.createElement("option")); 7798 input = div.getElementsByTagName("input")[0]; 7799 7800 a.style.cssText = "top:1px"; 7801 7802 // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) 7803 support.getSetAttribute = div.className !== "t"; 7804 7805 // Get the style information from getAttribute 7806 // (IE uses .cssText instead) 7807 support.style = /top/.test(a.getAttribute("style")); 7808 7809 // Make sure that URLs aren't manipulated 7810 // (IE normalizes it by default) 7811 support.hrefNormalized = a.getAttribute("href") === "/a"; 7812 7813 // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) 7814 support.checkOn = !! input.value; 7815 7816 // Make sure that a selected-by-default option has a working selected property. 7817 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) 7818 support.optSelected = opt.selected; 7819 7820 // Tests for enctype support on a form (#6743) 7821 support.enctype = !! document.createElement("form").enctype; 7822 7823 // Make sure that the options inside disabled selects aren't marked as disabled 7824 // (WebKit marks them as disabled) 7825 select.disabled = true; 7826 support.optDisabled = !opt.disabled; 7827 7828 // Support: IE8 only 7829 // Check if we can trust getAttribute("value") 7830 input = document.createElement("input"); 7831 input.setAttribute("value", ""); 7832 support.input = input.getAttribute("value") === ""; 7833 7834 // Check if an input maintains its value after becoming a radio 7835 input.value = "t"; 7836 input.setAttribute("type", "radio"); 7837 support.radioValue = input.value === "t"; 7838 7839 // Null elements to avoid leaks in IE. 7840 a = input = select = opt = div = null; 7841 })(); 7842 7843 7844 var rreturn = /\r/g; 7845 7846 jQuery.fn.extend({ 7847 val: function(value) { 7848 var hooks, ret, isFunction, 7849 elem = this[0]; 7850 7851 if (!arguments.length) { 7852 if (elem) { 7853 hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()]; 7854 7855 if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) { 7856 return ret; 7857 } 7858 7859 ret = elem.value; 7860 7861 return typeof ret === "string" ? 7862 // handle most common string cases 7863 ret.replace(rreturn, "") : 7864 // handle cases where value is null/undef or number 7865 ret == null ? "" : ret; 7866 } 7867 7868 return; 7869 } 7870 7871 isFunction = jQuery.isFunction(value); 7872 7873 return this.each(function(i) { 7874 var val; 7875 7876 if (this.nodeType !== 1) { 7877 return; 7878 } 7879 7880 if (isFunction) { 7881 val = value.call(this, i, jQuery(this).val()); 7882 } else { 7883 val = value; 7884 } 7885 7886 // Treat null/undefined as ""; convert numbers to string 7887 if (val == null) { 7888 val = ""; 7889 } else if (typeof val === "number") { 7890 val += ""; 7891 } else if (jQuery.isArray(val)) { 7892 val = jQuery.map(val, function(value) { 7893 return value == null ? "" : value + ""; 7894 }); 7895 } 7896 7897 hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()]; 7898 7899 // If set returns undefined, fall back to normal setting 7900 if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) { 7901 this.value = val; 7902 } 7903 }); 7904 } 7905 }); 7906 7907 jQuery.extend({ 7908 valHooks: { 7909 option: { 7910 get: function(elem) { 7911 var val = jQuery.find.attr(elem, "value"); 7912 return val != null ? 7913 val : 7914 jQuery.text(elem); 7915 } 7916 }, 7917 select: { 7918 get: function(elem) { 7919 var value, option, 7920 options = elem.options, 7921 index = elem.selectedIndex, 7922 one = elem.type === "select-one" || index < 0, 7923 values = one ? null : [], 7924 max = one ? index + 1 : options.length, 7925 i = index < 0 ? 7926 max : 7927 one ? index : 0; 7928 7929 // Loop through all the selected options 7930 for (; i < max; i++) { 7931 option = options[i]; 7932 7933 // oldIE doesn't update selected after form reset (#2551) 7934 if ((option.selected || i === index) && 7935 // Don't return options that are disabled or in a disabled optgroup 7936 (support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && 7937 (!option.parentNode.disabled || !jQuery.nodeName(option.parentNode, "optgroup"))) { 7938 7939 // Get the specific value for the option 7940 value = jQuery(option).val(); 7941 7942 // We don't need an array for one selects 7943 if (one) { 7944 return value; 7945 } 7946 7947 // Multi-Selects return an array 7948 values.push(value); 7949 } 7950 } 7951 7952 return values; 7953 }, 7954 7955 set: function(elem, value) { 7956 var optionSet, option, 7957 options = elem.options, 7958 values = jQuery.makeArray(value), 7959 i = options.length; 7960 7961 while (i--) { 7962 option = options[i]; 7963 7964 if (jQuery.inArray(jQuery.valHooks.option.get(option), values) >= 0) { 7965 7966 // Support: IE6 7967 // When new option element is added to select box we need to 7968 // force reflow of newly added node in order to workaround delay 7969 // of initialization properties 7970 try { 7971 option.selected = optionSet = true; 7972 7973 } catch (_) { 7974 7975 // Will be executed only in IE6 7976 option.scrollHeight; 7977 } 7978 7979 } else { 7980 option.selected = false; 7981 } 7982 } 7983 7984 // Force browsers to behave consistently when non-matching value is set 7985 if (!optionSet) { 7986 elem.selectedIndex = -1; 7987 } 7988 7989 return options; 7990 } 7991 } 7992 } 7993 }); 7994 7995 // Radios and checkboxes getter/setter 7996 jQuery.each(["radio", "checkbox"], function() { 7997 jQuery.valHooks[this] = { 7998 set: function(elem, value) { 7999 if (jQuery.isArray(value)) { 8000 return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) >= 0); 8001 } 8002 } 8003 }; 8004 if (!support.checkOn) { 8005 jQuery.valHooks[this].get = function(elem) { 8006 // Support: Webkit 8007 // "" is returned instead of "on" if a value isn't specified 8008 return elem.getAttribute("value") === null ? "on" : elem.value; 8009 }; 8010 } 8011 }); 8012 8013 8014 8015 var nodeHook, boolHook, 8016 attrHandle = jQuery.expr.attrHandle, 8017 ruseDefault = /^(?:checked|selected)$/i, 8018 getSetAttribute = support.getSetAttribute, 8019 getSetInput = support.input; 8020 8021 jQuery.fn.extend({ 8022 attr: function(name, value) { 8023 return access(this, jQuery.attr, name, value, arguments.length > 1); 8024 }, 8025 8026 removeAttr: function(name) { 8027 return this.each(function() { 8028 jQuery.removeAttr(this, name); 8029 }); 8030 } 8031 }); 8032 8033 jQuery.extend({ 8034 attr: function(elem, name, value) { 8035 var hooks, ret, 8036 nType = elem.nodeType; 8037 8038 // don't get/set attributes on text, comment and attribute nodes 8039 if (!elem || nType === 3 || nType === 8 || nType === 2) { 8040 return; 8041 } 8042 8043 // Fallback to prop when attributes are not supported 8044 if (typeof elem.getAttribute === strundefined) { 8045 return jQuery.prop(elem, name, value); 8046 } 8047 8048 // All attributes are lowercase 8049 // Grab necessary hook if one is defined 8050 if (nType !== 1 || !jQuery.isXMLDoc(elem)) { 8051 name = name.toLowerCase(); 8052 hooks = jQuery.attrHooks[name] || 8053 (jQuery.expr.match.bool.test(name) ? boolHook : nodeHook); 8054 } 8055 8056 if (value !== undefined) { 8057 8058 if (value === null) { 8059 jQuery.removeAttr(elem, name); 8060 8061 } else if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) { 8062 return ret; 8063 8064 } else { 8065 elem.setAttribute(name, value + ""); 8066 return value; 8067 } 8068 8069 } else if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { 8070 return ret; 8071 8072 } else { 8073 ret = jQuery.find.attr(elem, name); 8074 8075 // Non-existent attributes return null, we normalize to undefined 8076 return ret == null ? 8077 undefined : 8078 ret; 8079 } 8080 }, 8081 8082 removeAttr: function(elem, value) { 8083 var name, propName, 8084 i = 0, 8085 attrNames = value && value.match(rnotwhite); 8086 8087 if (attrNames && elem.nodeType === 1) { 8088 while ((name = attrNames[i++])) { 8089 propName = jQuery.propFix[name] || name; 8090 8091 // Boolean attributes get special treatment (#10870) 8092 if (jQuery.expr.match.bool.test(name)) { 8093 // Set corresponding property to false 8094 if (getSetInput && getSetAttribute || !ruseDefault.test(name)) { 8095 elem[propName] = false; 8096 // Support: IE<9 8097 // Also clear defaultChecked/defaultSelected (if appropriate) 8098 } else { 8099 elem[jQuery.camelCase("default-" + name)] = 8100 elem[propName] = false; 8101 } 8102 8103 // See #9699 for explanation of this approach (setting first, then removal) 8104 } else { 8105 jQuery.attr(elem, name, ""); 8106 } 8107 8108 elem.removeAttribute(getSetAttribute ? name : propName); 8109 } 8110 } 8111 }, 8112 8113 attrHooks: { 8114 type: { 8115 set: function(elem, value) { 8116 if (!support.radioValue && value === "radio" && jQuery.nodeName(elem, "input")) { 8117 // Setting the type on a radio button after the value resets the value in IE6-9 8118 // Reset value to default in case type is set after value during creation 8119 var val = elem.value; 8120 elem.setAttribute("type", value); 8121 if (val) { 8122 elem.value = val; 8123 } 8124 return value; 8125 } 8126 } 8127 } 8128 } 8129 }); 8130 8131 // Hook for boolean attributes 8132 boolHook = { 8133 set: function(elem, value, name) { 8134 if (value === false) { 8135 // Remove boolean attributes when set to false 8136 jQuery.removeAttr(elem, name); 8137 } else if (getSetInput && getSetAttribute || !ruseDefault.test(name)) { 8138 // IE<8 needs the *property* name 8139 elem.setAttribute(!getSetAttribute && jQuery.propFix[name] || name, name); 8140 8141 // Use defaultChecked and defaultSelected for oldIE 8142 } else { 8143 elem[jQuery.camelCase("default-" + name)] = elem[name] = true; 8144 } 8145 8146 return name; 8147 } 8148 }; 8149 8150 // Retrieve booleans specially 8151 jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(i, name) { 8152 8153 var getter = attrHandle[name] || jQuery.find.attr; 8154 8155 attrHandle[name] = getSetInput && getSetAttribute || !ruseDefault.test(name) ? 8156 function(elem, name, isXML) { 8157 var ret, handle; 8158 if (!isXML) { 8159 // Avoid an infinite loop by temporarily removing this function from the getter 8160 handle = attrHandle[name]; 8161 attrHandle[name] = ret; 8162 ret = getter(elem, name, isXML) != null ? 8163 name.toLowerCase() : 8164 null; 8165 attrHandle[name] = handle; 8166 } 8167 return ret; 8168 } : 8169 function(elem, name, isXML) { 8170 if (!isXML) { 8171 return elem[jQuery.camelCase("default-" + name)] ? 8172 name.toLowerCase() : 8173 null; 8174 } 8175 }; 8176 }); 8177 8178 // fix oldIE attroperties 8179 if (!getSetInput || !getSetAttribute) { 8180 jQuery.attrHooks.value = { 8181 set: function(elem, value, name) { 8182 if (jQuery.nodeName(elem, "input")) { 8183 // Does not return so that setAttribute is also used 8184 elem.defaultValue = value; 8185 } else { 8186 // Use nodeHook if defined (#1954); otherwise setAttribute is fine 8187 return nodeHook && nodeHook.set(elem, value, name); 8188 } 8189 } 8190 }; 8191 } 8192 8193 // IE6/7 do not support getting/setting some attributes with get/setAttribute 8194 if (!getSetAttribute) { 8195 8196 // Use this for any attribute in IE6/7 8197 // This fixes almost every IE6/7 issue 8198 nodeHook = { 8199 set: function(elem, value, name) { 8200 // Set the existing or create a new attribute node 8201 var ret = elem.getAttributeNode(name); 8202 if (!ret) { 8203 elem.setAttributeNode( 8204 (ret = elem.ownerDocument.createAttribute(name)) 8205 ); 8206 } 8207 8208 ret.value = value += ""; 8209 8210 // Break association with cloned elements by also using setAttribute (#9646) 8211 if (name === "value" || value === elem.getAttribute(name)) { 8212 return value; 8213 } 8214 } 8215 }; 8216 8217 // Some attributes are constructed with empty-string values when not defined 8218 attrHandle.id = attrHandle.name = attrHandle.coords = 8219 function(elem, name, isXML) { 8220 var ret; 8221 if (!isXML) { 8222 return (ret = elem.getAttributeNode(name)) && ret.value !== "" ? 8223 ret.value : 8224 null; 8225 } 8226 }; 8227 8228 // Fixing value retrieval on a button requires this module 8229 jQuery.valHooks.button = { 8230 get: function(elem, name) { 8231 var ret = elem.getAttributeNode(name); 8232 if (ret && ret.specified) { 8233 return ret.value; 8234 } 8235 }, 8236 set: nodeHook.set 8237 }; 8238 8239 // Set contenteditable to false on removals(#10429) 8240 // Setting to empty string throws an error as an invalid value 8241 jQuery.attrHooks.contenteditable = { 8242 set: function(elem, value, name) { 8243 nodeHook.set(elem, value === "" ? false : value, name); 8244 } 8245 }; 8246 8247 // Set width and height to auto instead of 0 on empty string( Bug #8150 ) 8248 // This is for removals 8249 jQuery.each(["width", "height"], function(i, name) { 8250 jQuery.attrHooks[name] = { 8251 set: function(elem, value) { 8252 if (value === "") { 8253 elem.setAttribute(name, "auto"); 8254 return value; 8255 } 8256 } 8257 }; 8258 }); 8259 } 8260 8261 if (!support.style) { 8262 jQuery.attrHooks.style = { 8263 get: function(elem) { 8264 // Return undefined in the case of empty string 8265 // Note: IE uppercases css property names, but if we were to .toLowerCase() 8266 // .cssText, that would destroy case senstitivity in URL's, like in "background" 8267 return elem.style.cssText || undefined; 8268 }, 8269 set: function(elem, value) { 8270 return (elem.style.cssText = value + ""); 8271 } 8272 }; 8273 } 8274 8275 8276 8277 var rfocusable = /^(?:input|select|textarea|button|object)$/i, 8278 rclickable = /^(?:a|area)$/i; 8279 8280 jQuery.fn.extend({ 8281 prop: function(name, value) { 8282 return access(this, jQuery.prop, name, value, arguments.length > 1); 8283 }, 8284 8285 removeProp: function(name) { 8286 name = jQuery.propFix[name] || name; 8287 return this.each(function() { 8288 // try/catch handles cases where IE balks (such as removing a property on window) 8289 try { 8290 this[name] = undefined; 8291 delete this[name]; 8292 } catch (e) {} 8293 }); 8294 } 8295 }); 8296 8297 jQuery.extend({ 8298 propFix: { 8299 "for": "htmlFor", 8300 "class": "className" 8301 }, 8302 8303 prop: function(elem, name, value) { 8304 var ret, hooks, notxml, 8305 nType = elem.nodeType; 8306 8307 // don't get/set properties on text, comment and attribute nodes 8308 if (!elem || nType === 3 || nType === 8 || nType === 2) { 8309 return; 8310 } 8311 8312 notxml = nType !== 1 || !jQuery.isXMLDoc(elem); 8313 8314 if (notxml) { 8315 // Fix name and attach hooks 8316 name = jQuery.propFix[name] || name; 8317 hooks = jQuery.propHooks[name]; 8318 } 8319 8320 if (value !== undefined) { 8321 return hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined ? 8322 ret : 8323 (elem[name] = value); 8324 8325 } else { 8326 return hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null ? 8327 ret : 8328 elem[name]; 8329 } 8330 }, 8331 8332 propHooks: { 8333 tabIndex: { 8334 get: function(elem) { 8335 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set 8336 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 8337 // Use proper attribute retrieval(#12072) 8338 var tabindex = jQuery.find.attr(elem, "tabindex"); 8339 8340 return tabindex ? 8341 parseInt(tabindex, 10) : 8342 rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href ? 8343 0 : -1; 8344 } 8345 } 8346 } 8347 }); 8348 8349 // Some attributes require a special call on IE 8350 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 8351 if (!support.hrefNormalized) { 8352 // href/src property should get the full normalized URL (#10299/#12915) 8353 jQuery.each(["href", "src"], function(i, name) { 8354 jQuery.propHooks[name] = { 8355 get: function(elem) { 8356 return elem.getAttribute(name, 4); 8357 } 8358 }; 8359 }); 8360 } 8361 8362 // Support: Safari, IE9+ 8363 // mis-reports the default selected property of an option 8364 // Accessing the parent's selectedIndex property fixes it 8365 if (!support.optSelected) { 8366 jQuery.propHooks.selected = { 8367 get: function(elem) { 8368 var parent = elem.parentNode; 8369 8370 if (parent) { 8371 parent.selectedIndex; 8372 8373 // Make sure that it also works with optgroups, see #5701 8374 if (parent.parentNode) { 8375 parent.parentNode.selectedIndex; 8376 } 8377 } 8378 return null; 8379 } 8380 }; 8381 } 8382 8383 jQuery.each([ 8384 "tabIndex", 8385 "readOnly", 8386 "maxLength", 8387 "cellSpacing", 8388 "cellPadding", 8389 "rowSpan", 8390 "colSpan", 8391 "useMap", 8392 "frameBorder", 8393 "contentEditable" 8394 ], function() { 8395 jQuery.propFix[this.toLowerCase()] = this; 8396 }); 8397 8398 // IE6/7 call enctype encoding 8399 if (!support.enctype) { 8400 jQuery.propFix.enctype = "encoding"; 8401 } 8402 8403 8404 8405 var rclass = /[\t\r\n\f]/g; 8406 8407 jQuery.fn.extend({ 8408 addClass: function(value) { 8409 var classes, elem, cur, clazz, j, finalValue, 8410 i = 0, 8411 len = this.length, 8412 proceed = typeof value === "string" && value; 8413 8414 if (jQuery.isFunction(value)) { 8415 return this.each(function(j) { 8416 jQuery(this).addClass(value.call(this, j, this.className)); 8417 }); 8418 } 8419 8420 if (proceed) { 8421 // The disjunction here is for better compressibility (see removeClass) 8422 classes = (value || "").match(rnotwhite) || []; 8423 8424 for (; i < len; i++) { 8425 elem = this[i]; 8426 cur = elem.nodeType === 1 && (elem.className ? 8427 (" " + elem.className + " ").replace(rclass, " ") : 8428 " " 8429 ); 8430 8431 if (cur) { 8432 j = 0; 8433 while ((clazz = classes[j++])) { 8434 if (cur.indexOf(" " + clazz + " ") < 0) { 8435 cur += clazz + " "; 8436 } 8437 } 8438 8439 // only assign if different to avoid unneeded rendering. 8440 finalValue = jQuery.trim(cur); 8441 if (elem.className !== finalValue) { 8442 elem.className = finalValue; 8443 } 8444 } 8445 } 8446 } 8447 8448 return this; 8449 }, 8450 8451 removeClass: function(value) { 8452 var classes, elem, cur, clazz, j, finalValue, 8453 i = 0, 8454 len = this.length, 8455 proceed = arguments.length === 0 || typeof value === "string" && value; 8456 8457 if (jQuery.isFunction(value)) { 8458 return this.each(function(j) { 8459 jQuery(this).removeClass(value.call(this, j, this.className)); 8460 }); 8461 } 8462 if (proceed) { 8463 classes = (value || "").match(rnotwhite) || []; 8464 8465 for (; i < len; i++) { 8466 elem = this[i]; 8467 // This expression is here for better compressibility (see addClass) 8468 cur = elem.nodeType === 1 && (elem.className ? 8469 (" " + elem.className + " ").replace(rclass, " ") : 8470 "" 8471 ); 8472 8473 if (cur) { 8474 j = 0; 8475 while ((clazz = classes[j++])) { 8476 // Remove *all* instances 8477 while (cur.indexOf(" " + clazz + " ") >= 0) { 8478 cur = cur.replace(" " + clazz + " ", " "); 8479 } 8480 } 8481 8482 // only assign if different to avoid unneeded rendering. 8483 finalValue = value ? jQuery.trim(cur) : ""; 8484 if (elem.className !== finalValue) { 8485 elem.className = finalValue; 8486 } 8487 } 8488 } 8489 } 8490 8491 return this; 8492 }, 8493 8494 toggleClass: function(value, stateVal) { 8495 var type = typeof value; 8496 8497 if (typeof stateVal === "boolean" && type === "string") { 8498 return stateVal ? this.addClass(value) : this.removeClass(value); 8499 } 8500 8501 if (jQuery.isFunction(value)) { 8502 return this.each(function(i) { 8503 jQuery(this).toggleClass(value.call(this, i, this.className, stateVal), stateVal); 8504 }); 8505 } 8506 8507 return this.each(function() { 8508 if (type === "string") { 8509 // toggle individual class names 8510 var className, 8511 i = 0, 8512 self = jQuery(this), 8513 classNames = value.match(rnotwhite) || []; 8514 8515 while ((className = classNames[i++])) { 8516 // check each className given, space separated list 8517 if (self.hasClass(className)) { 8518 self.removeClass(className); 8519 } else { 8520 self.addClass(className); 8521 } 8522 } 8523 8524 // Toggle whole class name 8525 } else if (type === strundefined || type === "boolean") { 8526 if (this.className) { 8527 // store className if set 8528 jQuery._data(this, "__className__", this.className); 8529 } 8530 8531 // If the element has a class name or if we're passed "false", 8532 // then remove the whole classname (if there was one, the above saved it). 8533 // Otherwise bring back whatever was previously saved (if anything), 8534 // falling back to the empty string if nothing was stored. 8535 this.className = this.className || value === false ? "" : jQuery._data(this, "__className__") || ""; 8536 } 8537 }); 8538 }, 8539 8540 hasClass: function(selector) { 8541 var className = " " + selector + " ", 8542 i = 0, 8543 l = this.length; 8544 for (; i < l; i++) { 8545 if (this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf(className) >= 0) { 8546 return true; 8547 } 8548 } 8549 8550 return false; 8551 } 8552 }); 8553 8554 8555 8556 // Return jQuery for attributes-only inclusion 8557 8558 8559 jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick " + 8560 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 8561 "change select submit keydown keypress keyup error contextmenu").split(" "), function(i, name) { 8562 8563 // Handle event binding 8564 jQuery.fn[name] = function(data, fn) { 8565 return arguments.length > 0 ? 8566 this.on(name, null, data, fn) : 8567 this.trigger(name); 8568 }; 8569 }); 8570 8571 jQuery.fn.extend({ 8572 hover: function(fnOver, fnOut) { 8573 return this.mouseenter(fnOver).mouseleave(fnOut || fnOver); 8574 }, 8575 8576 bind: function(types, data, fn) { 8577 return this.on(types, null, data, fn); 8578 }, 8579 unbind: function(types, fn) { 8580 return this.off(types, null, fn); 8581 }, 8582 8583 delegate: function(selector, types, data, fn) { 8584 return this.on(types, selector, data, fn); 8585 }, 8586 undelegate: function(selector, types, fn) { 8587 // ( namespace ) or ( selector, types [, fn] ) 8588 return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn); 8589 } 8590 }); 8591 8592 8593 var nonce = jQuery.now(); 8594 8595 var rquery = (/\?/); 8596 8597 8598 8599 var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g; 8600 8601 jQuery.parseJSON = function(data) { 8602 // Attempt to parse using the native JSON parser first 8603 if (window.JSON && window.JSON.parse) { 8604 // Support: Android 2.3 8605 // Workaround failure to string-cast null input 8606 return window.JSON.parse(data + ""); 8607 } 8608 8609 var requireNonComma, 8610 depth = null, 8611 str = jQuery.trim(data + ""); 8612 8613 // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains 8614 // after removing valid tokens 8615 return str && !jQuery.trim(str.replace(rvalidtokens, function(token, comma, open, close) { 8616 8617 // Force termination if we see a misplaced comma 8618 if (requireNonComma && comma) { 8619 depth = 0; 8620 } 8621 8622 // Perform no more replacements after returning to outermost depth 8623 if (depth === 0) { 8624 return token; 8625 } 8626 8627 // Commas must not follow "[", "{", or "," 8628 requireNonComma = open || comma; 8629 8630 // Determine new depth 8631 // array/object open ("[" or "{"): depth += true - false (increment) 8632 // array/object close ("]" or "}"): depth += false - true (decrement) 8633 // other cases ("," or primitive): depth += true - true (numeric cast) 8634 depth += !close - !open; 8635 8636 // Remove this token 8637 return ""; 8638 })) ? 8639 (Function("return " + str))() : 8640 jQuery.error("Invalid JSON: " + data); 8641 }; 8642 8643 8644 // Cross-browser xml parsing 8645 jQuery.parseXML = function(data) { 8646 var xml, tmp; 8647 if (!data || typeof data !== "string") { 8648 return null; 8649 } 8650 try { 8651 if (window.DOMParser) { // Standard 8652 tmp = new DOMParser(); 8653 xml = tmp.parseFromString(data, "text/xml"); 8654 } else { // IE 8655 xml = new ActiveXObject("Microsoft.XMLDOM"); 8656 xml.async = "false"; 8657 xml.loadXML(data); 8658 } 8659 } catch (e) { 8660 xml = undefined; 8661 } 8662 if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length) { 8663 jQuery.error("Invalid XML: " + data); 8664 } 8665 return xml; 8666 }; 8667 8668 8669 var 8670 // Document location 8671 ajaxLocParts, 8672 ajaxLocation, 8673 8674 rhash = /#.*$/, 8675 rts = /([?&])_=[^&]*/, 8676 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL 8677 // #7653, #8125, #8152: local protocol detection 8678 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 8679 rnoContent = /^(?:GET|HEAD)$/, 8680 rprotocol = /^\/\//, 8681 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/, 8682 8683 /* Prefilters 8684 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 8685 * 2) These are called: 8686 * - BEFORE asking for a transport 8687 * - AFTER param serialization (s.data is a string if s.processData is true) 8688 * 3) key is the dataType 8689 * 4) the catchall symbol "*" can be used 8690 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 8691 */ 8692 prefilters = {}, 8693 8694 /* Transports bindings 8695 * 1) key is the dataType 8696 * 2) the catchall symbol "*" can be used 8697 * 3) selection will start with transport dataType and THEN go to "*" if needed 8698 */ 8699 transports = {}, 8700 8701 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 8702 allTypes = "*/".concat("*"); 8703 8704 // #8138, IE may throw an exception when accessing 8705 // a field from window.location if document.domain has been set 8706 try { 8707 ajaxLocation = location.href; 8708 } catch (e) { 8709 // Use the href attribute of an A element 8710 // since IE will modify it given document.location 8711 ajaxLocation = document.createElement("a"); 8712 ajaxLocation.href = ""; 8713 ajaxLocation = ajaxLocation.href; 8714 } 8715 8716 // Segment location into parts 8717 ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || []; 8718 8719 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 8720 8721 function addToPrefiltersOrTransports(structure) { 8722 8723 // dataTypeExpression is optional and defaults to "*" 8724 return function(dataTypeExpression, func) { 8725 8726 if (typeof dataTypeExpression !== "string") { 8727 func = dataTypeExpression; 8728 dataTypeExpression = "*"; 8729 } 8730 8731 var dataType, 8732 i = 0, 8733 dataTypes = dataTypeExpression.toLowerCase().match(rnotwhite) || []; 8734 8735 if (jQuery.isFunction(func)) { 8736 // For each dataType in the dataTypeExpression 8737 while ((dataType = dataTypes[i++])) { 8738 // Prepend if requested 8739 if (dataType.charAt(0) === "+") { 8740 dataType = dataType.slice(1) || "*"; 8741 (structure[dataType] = structure[dataType] || []).unshift(func); 8742 8743 // Otherwise append 8744 } else { 8745 (structure[dataType] = structure[dataType] || []).push(func); 8746 } 8747 } 8748 } 8749 }; 8750 } 8751 8752 // Base inspection function for prefilters and transports 8753 8754 function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) { 8755 8756 var inspected = {}, 8757 seekingTransport = (structure === transports); 8758 8759 function inspect(dataType) { 8760 var selected; 8761 inspected[dataType] = true; 8762 jQuery.each(structure[dataType] || [], function(_, prefilterOrFactory) { 8763 var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR); 8764 if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) { 8765 options.dataTypes.unshift(dataTypeOrTransport); 8766 inspect(dataTypeOrTransport); 8767 return false; 8768 } else if (seekingTransport) { 8769 return !(selected = dataTypeOrTransport); 8770 } 8771 }); 8772 return selected; 8773 } 8774 8775 return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*"); 8776 } 8777 8778 // A special extend for ajax options 8779 // that takes "flat" options (not to be deep extended) 8780 // Fixes #9887 8781 8782 function ajaxExtend(target, src) { 8783 var deep, key, 8784 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 8785 8786 for (key in src) { 8787 if (src[key] !== undefined) { 8788 (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key]; 8789 } 8790 } 8791 if (deep) { 8792 jQuery.extend(true, target, deep); 8793 } 8794 8795 return target; 8796 } 8797 8798 /* Handles responses to an ajax request: 8799 * - finds the right dataType (mediates between content-type and expected dataType) 8800 * - returns the corresponding response 8801 */ 8802 8803 function ajaxHandleResponses(s, jqXHR, responses) { 8804 var firstDataType, ct, finalDataType, type, 8805 contents = s.contents, 8806 dataTypes = s.dataTypes; 8807 8808 // Remove auto dataType and get content-type in the process 8809 while (dataTypes[0] === "*") { 8810 dataTypes.shift(); 8811 if (ct === undefined) { 8812 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); 8813 } 8814 } 8815 8816 // Check if we're dealing with a known content-type 8817 if (ct) { 8818 for (type in contents) { 8819 if (contents[type] && contents[type].test(ct)) { 8820 dataTypes.unshift(type); 8821 break; 8822 } 8823 } 8824 } 8825 8826 // Check to see if we have a response for the expected dataType 8827 if (dataTypes[0] in responses) { 8828 finalDataType = dataTypes[0]; 8829 } else { 8830 // Try convertible dataTypes 8831 for (type in responses) { 8832 if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) { 8833 finalDataType = type; 8834 break; 8835 } 8836 if (!firstDataType) { 8837 firstDataType = type; 8838 } 8839 } 8840 // Or just use first one 8841 finalDataType = finalDataType || firstDataType; 8842 } 8843 8844 // If we found a dataType 8845 // We add the dataType to the list if needed 8846 // and return the corresponding response 8847 if (finalDataType) { 8848 if (finalDataType !== dataTypes[0]) { 8849 dataTypes.unshift(finalDataType); 8850 } 8851 return responses[finalDataType]; 8852 } 8853 } 8854 8855 /* Chain conversions given the request and the original response 8856 * Also sets the responseXXX fields on the jqXHR instance 8857 */ 8858 8859 function ajaxConvert(s, response, jqXHR, isSuccess) { 8860 var conv2, current, conv, tmp, prev, 8861 converters = {}, 8862 // Work with a copy of dataTypes in case we need to modify it for conversion 8863 dataTypes = s.dataTypes.slice(); 8864 8865 // Create converters map with lowercased keys 8866 if (dataTypes[1]) { 8867 for (conv in s.converters) { 8868 converters[conv.toLowerCase()] = s.converters[conv]; 8869 } 8870 } 8871 8872 current = dataTypes.shift(); 8873 8874 // Convert to each sequential dataType 8875 while (current) { 8876 8877 if (s.responseFields[current]) { 8878 jqXHR[s.responseFields[current]] = response; 8879 } 8880 8881 // Apply the dataFilter if provided 8882 if (!prev && isSuccess && s.dataFilter) { 8883 response = s.dataFilter(response, s.dataType); 8884 } 8885 8886 prev = current; 8887 current = dataTypes.shift(); 8888 8889 if (current) { 8890 8891 // There's only work to do if current dataType is non-auto 8892 if (current === "*") { 8893 8894 current = prev; 8895 8896 // Convert response if prev dataType is non-auto and differs from current 8897 } else if (prev !== "*" && prev !== current) { 8898 8899 // Seek a direct converter 8900 conv = converters[prev + " " + current] || converters["* " + current]; 8901 8902 // If none found, seek a pair 8903 if (!conv) { 8904 for (conv2 in converters) { 8905 8906 // If conv2 outputs current 8907 tmp = conv2.split(" "); 8908 if (tmp[1] === current) { 8909 8910 // If prev can be converted to accepted input 8911 conv = converters[prev + " " + tmp[0]] || 8912 converters["* " + tmp[0]]; 8913 if (conv) { 8914 // Condense equivalence converters 8915 if (conv === true) { 8916 conv = converters[conv2]; 8917 8918 // Otherwise, insert the intermediate dataType 8919 } else if (converters[conv2] !== true) { 8920 current = tmp[0]; 8921 dataTypes.unshift(tmp[1]); 8922 } 8923 break; 8924 } 8925 } 8926 } 8927 } 8928 8929 // Apply converter (if not an equivalence) 8930 if (conv !== true) { 8931 8932 // Unless errors are allowed to bubble, catch and return them 8933 if (conv && s["throws"]) { 8934 response = conv(response); 8935 } else { 8936 try { 8937 response = conv(response); 8938 } catch (e) { 8939 return { 8940 state: "parsererror", 8941 error: conv ? e : "No conversion from " + prev + " to " + current 8942 }; 8943 } 8944 } 8945 } 8946 } 8947 } 8948 } 8949 8950 return { 8951 state: "success", 8952 data: response 8953 }; 8954 } 8955 8956 jQuery.extend({ 8957 8958 // Counter for holding the number of active queries 8959 active: 0, 8960 8961 // Last-Modified header cache for next request 8962 lastModified: {}, 8963 etag: {}, 8964 8965 ajaxSettings: { 8966 url: ajaxLocation, 8967 type: "GET", 8968 isLocal: rlocalProtocol.test(ajaxLocParts[1]), 8969 global: true, 8970 processData: true, 8971 async: true, 8972 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 8973 /* 8974 timeout: 0, 8975 data: null, 8976 dataType: null, 8977 username: null, 8978 password: null, 8979 cache: null, 8980 throws: false, 8981 traditional: false, 8982 headers: {}, 8983 */ 8984 8985 accepts: { 8986 "*": allTypes, 8987 text: "text/plain", 8988 html: "text/html", 8989 xml: "application/xml, text/xml", 8990 json: "application/json, text/javascript" 8991 }, 8992 8993 contents: { 8994 xml: /xml/, 8995 html: /html/, 8996 json: /json/ 8997 }, 8998 8999 responseFields: { 9000 xml: "responseXML", 9001 text: "responseText", 9002 json: "responseJSON" 9003 }, 9004 9005 // Data converters 9006 // Keys separate source (or catchall "*") and destination types with a single space 9007 converters: { 9008 9009 // Convert anything to text 9010 "* text": String, 9011 9012 // Text to html (true = no transformation) 9013 "text html": true, 9014 9015 // Evaluate text as a json expression 9016 "text json": jQuery.parseJSON, 9017 9018 // Parse text as xml 9019 "text xml": jQuery.parseXML 9020 }, 9021 9022 // For options that shouldn't be deep extended: 9023 // you can add your own custom options here if 9024 // and when you create one that shouldn't be 9025 // deep extended (see ajaxExtend) 9026 flatOptions: { 9027 url: true, 9028 context: true 9029 } 9030 }, 9031 9032 // Creates a full fledged settings object into target 9033 // with both ajaxSettings and settings fields. 9034 // If target is omitted, writes into ajaxSettings. 9035 ajaxSetup: function(target, settings) { 9036 return settings ? 9037 9038 // Building a settings object 9039 ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : 9040 9041 // Extending ajaxSettings 9042 ajaxExtend(jQuery.ajaxSettings, target); 9043 }, 9044 9045 ajaxPrefilter: addToPrefiltersOrTransports(prefilters), 9046 ajaxTransport: addToPrefiltersOrTransports(transports), 9047 9048 // Main method 9049 ajax: function(url, options) { 9050 9051 // If url is an object, simulate pre-1.5 signature 9052 if (typeof url === "object") { 9053 options = url; 9054 url = undefined; 9055 } 9056 9057 // Force options to be an object 9058 options = options || {}; 9059 9060 var // Cross-domain detection vars 9061 parts, 9062 // Loop variable 9063 i, 9064 // URL without anti-cache param 9065 cacheURL, 9066 // Response headers as string 9067 responseHeadersString, 9068 // timeout handle 9069 timeoutTimer, 9070 9071 // To know if global events are to be dispatched 9072 fireGlobals, 9073 9074 transport, 9075 // Response headers 9076 responseHeaders, 9077 // Create the final options object 9078 s = jQuery.ajaxSetup({}, options), 9079 // Callbacks context 9080 callbackContext = s.context || s, 9081 // Context for global events is callbackContext if it is a DOM node or jQuery collection 9082 globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? 9083 jQuery(callbackContext) : 9084 jQuery.event, 9085 // Deferreds 9086 deferred = jQuery.Deferred(), 9087 completeDeferred = jQuery.Callbacks("once memory"), 9088 // Status-dependent callbacks 9089 statusCode = s.statusCode || {}, 9090 // Headers (they are sent all at once) 9091 requestHeaders = {}, 9092 requestHeadersNames = {}, 9093 // The jqXHR state 9094 state = 0, 9095 // Default abort message 9096 strAbort = "canceled", 9097 // Fake xhr 9098 jqXHR = { 9099 readyState: 0, 9100 9101 // Builds headers hashtable if needed 9102 getResponseHeader: function(key) { 9103 var match; 9104 if (state === 2) { 9105 if (!responseHeaders) { 9106 responseHeaders = {}; 9107 while ((match = rheaders.exec(responseHeadersString))) { 9108 responseHeaders[match[1].toLowerCase()] = match[2]; 9109 } 9110 } 9111 match = responseHeaders[key.toLowerCase()]; 9112 } 9113 return match == null ? null : match; 9114 }, 9115 9116 // Raw string 9117 getAllResponseHeaders: function() { 9118 return state === 2 ? responseHeadersString : null; 9119 }, 9120 9121 // Caches the header 9122 setRequestHeader: function(name, value) { 9123 var lname = name.toLowerCase(); 9124 if (!state) { 9125 name = requestHeadersNames[lname] = requestHeadersNames[lname] || name; 9126 requestHeaders[name] = value; 9127 } 9128 return this; 9129 }, 9130 9131 // Overrides response content-type header 9132 overrideMimeType: function(type) { 9133 if (!state) { 9134 s.mimeType = type; 9135 } 9136 return this; 9137 }, 9138 9139 // Status-dependent callbacks 9140 statusCode: function(map) { 9141 var code; 9142 if (map) { 9143 if (state < 2) { 9144 for (code in map) { 9145 // Lazy-add the new callback in a way that preserves old ones 9146 statusCode[code] = [statusCode[code], map[code]]; 9147 } 9148 } else { 9149 // Execute the appropriate callbacks 9150 jqXHR.always(map[jqXHR.status]); 9151 } 9152 } 9153 return this; 9154 }, 9155 9156 // Cancel the request 9157 abort: function(statusText) { 9158 var finalText = statusText || strAbort; 9159 if (transport) { 9160 transport.abort(finalText); 9161 } 9162 done(0, finalText); 9163 return this; 9164 } 9165 }; 9166 9167 // Attach deferreds 9168 deferred.promise(jqXHR).complete = completeDeferred.add; 9169 jqXHR.success = jqXHR.done; 9170 jqXHR.error = jqXHR.fail; 9171 9172 // Remove hash character (#7531: and string promotion) 9173 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) 9174 // Handle falsy url in the settings object (#10093: consistency with old signature) 9175 // We also use the url parameter if available 9176 s.url = ((url || s.url || ajaxLocation) + "").replace(rhash, "").replace(rprotocol, ajaxLocParts[1] + "//"); 9177 9178 // Alias method option to type as per ticket #12004 9179 s.type = options.method || options.type || s.method || s.type; 9180 9181 // Extract dataTypes list 9182 s.dataTypes = jQuery.trim(s.dataType || "*").toLowerCase().match(rnotwhite) || [""]; 9183 9184 // A cross-domain request is in order when we have a protocol:host:port mismatch 9185 if (s.crossDomain == null) { 9186 parts = rurl.exec(s.url.toLowerCase()); 9187 s.crossDomain = !! (parts && 9188 (parts[1] !== ajaxLocParts[1] || parts[2] !== ajaxLocParts[2] || 9189 (parts[3] || (parts[1] === "http:" ? "80" : "443")) !== 9190 (ajaxLocParts[3] || (ajaxLocParts[1] === "http:" ? "80" : "443"))) 9191 ); 9192 } 9193 9194 // Convert data if not already a string 9195 if (s.data && s.processData && typeof s.data !== "string") { 9196 s.data = jQuery.param(s.data, s.traditional); 9197 } 9198 9199 // Apply prefilters 9200 inspectPrefiltersOrTransports(prefilters, s, options, jqXHR); 9201 9202 // If request was aborted inside a prefilter, stop there 9203 if (state === 2) { 9204 return jqXHR; 9205 } 9206 9207 // We can fire global events as of now if asked to 9208 fireGlobals = s.global; 9209 9210 // Watch for a new set of requests 9211 if (fireGlobals && jQuery.active++ === 0) { 9212 jQuery.event.trigger("ajaxStart"); 9213 } 9214 9215 // Uppercase the type 9216 s.type = s.type.toUpperCase(); 9217 9218 // Determine if request has content 9219 s.hasContent = !rnoContent.test(s.type); 9220 9221 // Save the URL in case we're toying with the If-Modified-Since 9222 // and/or If-None-Match header later on 9223 cacheURL = s.url; 9224 9225 // More options handling for requests with no content 9226 if (!s.hasContent) { 9227 9228 // If data is available, append data to url 9229 if (s.data) { 9230 cacheURL = (s.url += (rquery.test(cacheURL) ? "&" : "?") + s.data); 9231 // #9682: remove data so that it's not used in an eventual retry 9232 delete s.data; 9233 } 9234 9235 // Add anti-cache in url if needed 9236 if (s.cache === false) { 9237 s.url = rts.test(cacheURL) ? 9238 9239 // If there is already a '_' parameter, set its value 9240 cacheURL.replace(rts, "$1_=" + nonce++) : 9241 9242 // Otherwise add one to the end 9243 cacheURL + (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++; 9244 } 9245 } 9246 9247 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9248 if (s.ifModified) { 9249 if (jQuery.lastModified[cacheURL]) { 9250 jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]); 9251 } 9252 if (jQuery.etag[cacheURL]) { 9253 jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]); 9254 } 9255 } 9256 9257 // Set the correct header, if data is being sent 9258 if (s.data && s.hasContent && s.contentType !== false || options.contentType) { 9259 jqXHR.setRequestHeader("Content-Type", s.contentType); 9260 } 9261 9262 // Set the Accepts header for the server, depending on the dataType 9263 jqXHR.setRequestHeader( 9264 "Accept", 9265 s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? 9266 s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : 9267 s.accepts["*"] 9268 ); 9269 9270 // Check for headers option 9271 for (i in s.headers) { 9272 jqXHR.setRequestHeader(i, s.headers[i]); 9273 } 9274 9275 // Allow custom headers/mimetypes and early abort 9276 if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || state === 2)) { 9277 // Abort if not done already and return 9278 return jqXHR.abort(); 9279 } 9280 9281 // aborting is no longer a cancellation 9282 strAbort = "abort"; 9283 9284 // Install callbacks on deferreds 9285 for (i in { 9286 success: 1, 9287 error: 1, 9288 complete: 1 9289 }) { 9290 jqXHR[i](s[i]); 9291 } 9292 9293 // Get transport 9294 transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR); 9295 9296 // If no transport, we auto-abort 9297 if (!transport) { 9298 done(-1, "No Transport"); 9299 } else { 9300 jqXHR.readyState = 1; 9301 9302 // Send global event 9303 if (fireGlobals) { 9304 globalEventContext.trigger("ajaxSend", [jqXHR, s]); 9305 } 9306 // Timeout 9307 if (s.async && s.timeout > 0) { 9308 timeoutTimer = setTimeout(function() { 9309 jqXHR.abort("timeout"); 9310 }, s.timeout); 9311 } 9312 9313 try { 9314 state = 1; 9315 transport.send(requestHeaders, done); 9316 } catch (e) { 9317 // Propagate exception as error if not done 9318 if (state < 2) { 9319 done(-1, e); 9320 // Simply rethrow otherwise 9321 } else { 9322 throw e; 9323 } 9324 } 9325 } 9326 9327 // Callback for when everything is done 9328 9329 function done(status, nativeStatusText, responses, headers) { 9330 var isSuccess, success, error, response, modified, 9331 statusText = nativeStatusText; 9332 9333 // Called once 9334 if (state === 2) { 9335 return; 9336 } 9337 9338 // State is "done" now 9339 state = 2; 9340 9341 // Clear timeout if it exists 9342 if (timeoutTimer) { 9343 clearTimeout(timeoutTimer); 9344 } 9345 9346 // Dereference transport for early garbage collection 9347 // (no matter how long the jqXHR object will be used) 9348 transport = undefined; 9349 9350 // Cache response headers 9351 responseHeadersString = headers || ""; 9352 9353 // Set readyState 9354 jqXHR.readyState = status > 0 ? 4 : 0; 9355 9356 // Determine if successful 9357 isSuccess = status >= 200 && status < 300 || status === 304; 9358 9359 // Get response data 9360 if (responses) { 9361 response = ajaxHandleResponses(s, jqXHR, responses); 9362 } 9363 9364 // Convert no matter what (that way responseXXX fields are always set) 9365 response = ajaxConvert(s, response, jqXHR, isSuccess); 9366 9367 // If successful, handle type chaining 9368 if (isSuccess) { 9369 9370 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9371 if (s.ifModified) { 9372 modified = jqXHR.getResponseHeader("Last-Modified"); 9373 if (modified) { 9374 jQuery.lastModified[cacheURL] = modified; 9375 } 9376 modified = jqXHR.getResponseHeader("etag"); 9377 if (modified) { 9378 jQuery.etag[cacheURL] = modified; 9379 } 9380 } 9381 9382 // if no content 9383 if (status === 204 || s.type === "HEAD") { 9384 statusText = "nocontent"; 9385 9386 // if not modified 9387 } else if (status === 304) { 9388 statusText = "notmodified"; 9389 9390 // If we have data, let's convert it 9391 } else { 9392 statusText = response.state; 9393 success = response.data; 9394 error = response.error; 9395 isSuccess = !error; 9396 } 9397 } else { 9398 // We extract error from statusText 9399 // then normalize statusText and status for non-aborts 9400 error = statusText; 9401 if (status || !statusText) { 9402 statusText = "error"; 9403 if (status < 0) { 9404 status = 0; 9405 } 9406 } 9407 } 9408 9409 // Set data for the fake xhr object 9410 jqXHR.status = status; 9411 jqXHR.statusText = (nativeStatusText || statusText) + ""; 9412 9413 // Success/Error 9414 if (isSuccess) { 9415 deferred.resolveWith(callbackContext, [success, statusText, jqXHR]); 9416 } else { 9417 deferred.rejectWith(callbackContext, [jqXHR, statusText, error]); 9418 } 9419 9420 // Status-dependent callbacks 9421 jqXHR.statusCode(statusCode); 9422 statusCode = undefined; 9423 9424 if (fireGlobals) { 9425 globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]); 9426 } 9427 9428 // Complete 9429 completeDeferred.fireWith(callbackContext, [jqXHR, statusText]); 9430 9431 if (fireGlobals) { 9432 globalEventContext.trigger("ajaxComplete", [jqXHR, s]); 9433 // Handle the global AJAX counter 9434 if (!(--jQuery.active)) { 9435 jQuery.event.trigger("ajaxStop"); 9436 } 9437 } 9438 } 9439 9440 return jqXHR; 9441 }, 9442 9443 getJSON: function(url, data, callback) { 9444 return jQuery.get(url, data, callback, "json"); 9445 }, 9446 9447 getScript: function(url, callback) { 9448 return jQuery.get(url, undefined, callback, "script"); 9449 } 9450 }); 9451 9452 jQuery.each(["get", "post"], function(i, method) { 9453 jQuery[method] = function(url, data, callback, type) { 9454 // shift arguments if data argument was omitted 9455 if (jQuery.isFunction(data)) { 9456 type = type || callback; 9457 callback = data; 9458 data = undefined; 9459 } 9460 9461 return jQuery.ajax({ 9462 url: url, 9463 type: method, 9464 dataType: type, 9465 data: data, 9466 success: callback 9467 }); 9468 }; 9469 }); 9470 9471 // Attach a bunch of functions for handling common AJAX events 9472 jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function(i, type) { 9473 jQuery.fn[type] = function(fn) { 9474 return this.on(type, fn); 9475 }; 9476 }); 9477 9478 9479 jQuery._evalUrl = function(url) { 9480 return jQuery.ajax({ 9481 url: url, 9482 type: "GET", 9483 dataType: "script", 9484 async: false, 9485 global: false, 9486 "throws": true 9487 }); 9488 }; 9489 9490 9491 jQuery.fn.extend({ 9492 wrapAll: function(html) { 9493 if (jQuery.isFunction(html)) { 9494 return this.each(function(i) { 9495 jQuery(this).wrapAll(html.call(this, i)); 9496 }); 9497 } 9498 9499 if (this[0]) { 9500 // The elements to wrap the target around 9501 var wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true); 9502 9503 if (this[0].parentNode) { 9504 wrap.insertBefore(this[0]); 9505 } 9506 9507 wrap.map(function() { 9508 var elem = this; 9509 9510 while (elem.firstChild && elem.firstChild.nodeType === 1) { 9511 elem = elem.firstChild; 9512 } 9513 9514 return elem; 9515 }).append(this); 9516 } 9517 9518 return this; 9519 }, 9520 9521 wrapInner: function(html) { 9522 if (jQuery.isFunction(html)) { 9523 return this.each(function(i) { 9524 jQuery(this).wrapInner(html.call(this, i)); 9525 }); 9526 } 9527 9528 return this.each(function() { 9529 var self = jQuery(this), 9530 contents = self.contents(); 9531 9532 if (contents.length) { 9533 contents.wrapAll(html); 9534 9535 } else { 9536 self.append(html); 9537 } 9538 }); 9539 }, 9540 9541 wrap: function(html) { 9542 var isFunction = jQuery.isFunction(html); 9543 9544 return this.each(function(i) { 9545 jQuery(this).wrapAll(isFunction ? html.call(this, i) : html); 9546 }); 9547 }, 9548 9549 unwrap: function() { 9550 return this.parent().each(function() { 9551 if (!jQuery.nodeName(this, "body")) { 9552 jQuery(this).replaceWith(this.childNodes); 9553 } 9554 }).end(); 9555 } 9556 }); 9557 9558 9559 jQuery.expr.filters.hidden = function(elem) { 9560 // Support: Opera <= 12.12 9561 // Opera reports offsetWidths and offsetHeights less than zero on some elements 9562 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || 9563 (!support.reliableHiddenOffsets() && 9564 ((elem.style && elem.style.display) || jQuery.css(elem, "display")) === "none"); 9565 }; 9566 9567 jQuery.expr.filters.visible = function(elem) { 9568 return !jQuery.expr.filters.hidden(elem); 9569 }; 9570 9571 9572 9573 var r20 = /%20/g, 9574 rbracket = /\[\]$/, 9575 rCRLF = /\r?\n/g, 9576 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 9577 rsubmittable = /^(?:input|select|textarea|keygen)/i; 9578 9579 function buildParams(prefix, obj, traditional, add) { 9580 var name; 9581 9582 if (jQuery.isArray(obj)) { 9583 // Serialize array item. 9584 jQuery.each(obj, function(i, v) { 9585 if (traditional || rbracket.test(prefix)) { 9586 // Treat each array item as a scalar. 9587 add(prefix, v); 9588 9589 } else { 9590 // Item is non-scalar (array or object), encode its numeric index. 9591 buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add); 9592 } 9593 }); 9594 9595 } else if (!traditional && jQuery.type(obj) === "object") { 9596 // Serialize object item. 9597 for (name in obj) { 9598 buildParams(prefix + "[" + name + "]", obj[name], traditional, add); 9599 } 9600 9601 } else { 9602 // Serialize scalar item. 9603 add(prefix, obj); 9604 } 9605 } 9606 9607 // Serialize an array of form elements or a set of 9608 // key/values into a query string 9609 jQuery.param = function(a, traditional) { 9610 var prefix, 9611 s = [], 9612 add = function(key, value) { 9613 // If value is a function, invoke it and return its value 9614 value = jQuery.isFunction(value) ? value() : (value == null ? "" : value); 9615 s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value); 9616 }; 9617 9618 // Set traditional to true for jQuery <= 1.3.2 behavior. 9619 if (traditional === undefined) { 9620 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; 9621 } 9622 9623 // If an array was passed in, assume that it is an array of form elements. 9624 if (jQuery.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) { 9625 // Serialize the form elements 9626 jQuery.each(a, function() { 9627 add(this.name, this.value); 9628 }); 9629 9630 } else { 9631 // If traditional, encode the "old" way (the way 1.3.2 or older 9632 // did it), otherwise encode params recursively. 9633 for (prefix in a) { 9634 buildParams(prefix, a[prefix], traditional, add); 9635 } 9636 } 9637 9638 // Return the resulting serialization 9639 return s.join("&").replace(r20, "+"); 9640 }; 9641 9642 jQuery.fn.extend({ 9643 serialize: function() { 9644 return jQuery.param(this.serializeArray()); 9645 }, 9646 serializeArray: function() { 9647 return this.map(function() { 9648 // Can add propHook for "elements" to filter or add form elements 9649 var elements = jQuery.prop(this, "elements"); 9650 return elements ? jQuery.makeArray(elements) : this; 9651 }) 9652 .filter(function() { 9653 var type = this.type; 9654 // Use .is(":disabled") so that fieldset[disabled] works 9655 return this.name && !jQuery(this).is(":disabled") && 9656 rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && 9657 (this.checked || !rcheckableType.test(type)); 9658 }) 9659 .map(function(i, elem) { 9660 var val = jQuery(this).val(); 9661 9662 return val == null ? 9663 null : 9664 jQuery.isArray(val) ? 9665 jQuery.map(val, function(val) { 9666 return { 9667 name: elem.name, 9668 value: val.replace(rCRLF, "\r\n") 9669 }; 9670 }) : { 9671 name: elem.name, 9672 value: val.replace(rCRLF, "\r\n") 9673 }; 9674 }).get(); 9675 } 9676 }); 9677 9678 9679 // Create the request object 9680 // (This is still attached to ajaxSettings for backward compatibility) 9681 jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? 9682 // Support: IE6+ 9683 9684 function() { 9685 9686 // XHR cannot access local files, always use ActiveX for that case 9687 return !this.isLocal && 9688 9689 // Support: IE7-8 9690 // oldIE XHR does not support non-RFC2616 methods (#13240) 9691 // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx 9692 // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9 9693 // Although this check for six methods instead of eight 9694 // since IE also does not support "trace" and "connect" 9695 /^(get|post|head|put|delete|options)$/i.test(this.type) && 9696 9697 createStandardXHR() || createActiveXHR(); 9698 } : 9699 // For all other browsers, use the standard XMLHttpRequest object 9700 createStandardXHR; 9701 9702 var xhrId = 0, 9703 xhrCallbacks = {}, 9704 xhrSupported = jQuery.ajaxSettings.xhr(); 9705 9706 // Support: IE<10 9707 // Open requests must be manually aborted on unload (#5280) 9708 if (window.ActiveXObject) { 9709 jQuery(window).on("unload", function() { 9710 for (var key in xhrCallbacks) { 9711 xhrCallbacks[key](undefined, true); 9712 } 9713 }); 9714 } 9715 9716 // Determine support properties 9717 support.cors = !! xhrSupported && ("withCredentials" in xhrSupported); 9718 xhrSupported = support.ajax = !! xhrSupported; 9719 9720 // Create transport if the browser can provide an xhr 9721 if (xhrSupported) { 9722 9723 jQuery.ajaxTransport(function(options) { 9724 // Cross domain only allowed if supported through XMLHttpRequest 9725 if (!options.crossDomain || support.cors) { 9726 9727 var callback; 9728 9729 return { 9730 send: function(headers, complete) { 9731 var i, 9732 xhr = options.xhr(), 9733 id = ++xhrId; 9734 9735 // Open the socket 9736 xhr.open(options.type, options.url, options.async, options.username, options.password); 9737 9738 // Apply custom fields if provided 9739 if (options.xhrFields) { 9740 for (i in options.xhrFields) { 9741 xhr[i] = options.xhrFields[i]; 9742 } 9743 } 9744 9745 // Override mime type if needed 9746 if (options.mimeType && xhr.overrideMimeType) { 9747 xhr.overrideMimeType(options.mimeType); 9748 } 9749 9750 // X-Requested-With header 9751 // For cross-domain requests, seeing as conditions for a preflight are 9752 // akin to a jigsaw puzzle, we simply never set it to be sure. 9753 // (it can always be set on a per-request basis or even using ajaxSetup) 9754 // For same-domain requests, won't change header if already provided. 9755 if (!options.crossDomain && !headers["X-Requested-With"]) { 9756 headers["X-Requested-With"] = "XMLHttpRequest"; 9757 } 9758 9759 // Set headers 9760 for (i in headers) { 9761 // Support: IE<9 9762 // IE's ActiveXObject throws a 'Type Mismatch' exception when setting 9763 // request header to a null-value. 9764 // 9765 // To keep consistent with other XHR implementations, cast the value 9766 // to string and ignore `undefined`. 9767 if (headers[i] !== undefined) { 9768 xhr.setRequestHeader(i, headers[i] + ""); 9769 } 9770 } 9771 9772 // Do send the request 9773 // This may raise an exception which is actually 9774 // handled in jQuery.ajax (so no try/catch here) 9775 xhr.send((options.hasContent && options.data) || null); 9776 9777 // Listener 9778 callback = function(_, isAbort) { 9779 var status, statusText, responses; 9780 9781 // Was never called and is aborted or complete 9782 if (callback && (isAbort || xhr.readyState === 4)) { 9783 // Clean up 9784 delete xhrCallbacks[id]; 9785 callback = undefined; 9786 xhr.onreadystatechange = jQuery.noop; 9787 9788 // Abort manually if needed 9789 if (isAbort) { 9790 if (xhr.readyState !== 4) { 9791 xhr.abort(); 9792 } 9793 } else { 9794 responses = {}; 9795 status = xhr.status; 9796 9797 // Support: IE<10 9798 // Accessing binary-data responseText throws an exception 9799 // (#11426) 9800 if (typeof xhr.responseText === "string") { 9801 responses.text = xhr.responseText; 9802 } 9803 9804 // Firefox throws an exception when accessing 9805 // statusText for faulty cross-domain requests 9806 try { 9807 statusText = xhr.statusText; 9808 } catch (e) { 9809 // We normalize with Webkit giving an empty statusText 9810 statusText = ""; 9811 } 9812 9813 // Filter status for non standard behaviors 9814 9815 // If the request is local and we have data: assume a success 9816 // (success with no data won't get notified, that's the best we 9817 // can do given current implementations) 9818 if (!status && options.isLocal && !options.crossDomain) { 9819 status = responses.text ? 200 : 404; 9820 // IE - #1450: sometimes returns 1223 when it should be 204 9821 } else if (status === 1223) { 9822 status = 204; 9823 } 9824 } 9825 } 9826 9827 // Call complete if needed 9828 if (responses) { 9829 complete(status, statusText, responses, xhr.getAllResponseHeaders()); 9830 } 9831 }; 9832 9833 if (!options.async) { 9834 // if we're in sync mode we fire the callback 9835 callback(); 9836 } else if (xhr.readyState === 4) { 9837 // (IE6 & IE7) if it's in cache and has been 9838 // retrieved directly we need to fire the callback 9839 setTimeout(callback); 9840 } else { 9841 // Add to the list of active xhr callbacks 9842 xhr.onreadystatechange = xhrCallbacks[id] = callback; 9843 } 9844 }, 9845 9846 abort: function() { 9847 if (callback) { 9848 callback(undefined, true); 9849 } 9850 } 9851 }; 9852 } 9853 }); 9854 } 9855 9856 // Functions to create xhrs 9857 9858 function createStandardXHR() { 9859 try { 9860 return new window.XMLHttpRequest(); 9861 } catch (e) {} 9862 } 9863 9864 function createActiveXHR() { 9865 try { 9866 return new window.ActiveXObject("Microsoft.XMLHTTP"); 9867 } catch (e) {} 9868 } 9869 9870 9871 9872 // Install script dataType 9873 jQuery.ajaxSetup({ 9874 accepts: { 9875 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" 9876 }, 9877 contents: { 9878 script: /(?:java|ecma)script/ 9879 }, 9880 converters: { 9881 "text script": function(text) { 9882 jQuery.globalEval(text); 9883 return text; 9884 } 9885 } 9886 }); 9887 9888 // Handle cache's special case and global 9889 jQuery.ajaxPrefilter("script", function(s) { 9890 if (s.cache === undefined) { 9891 s.cache = false; 9892 } 9893 if (s.crossDomain) { 9894 s.type = "GET"; 9895 s.global = false; 9896 } 9897 }); 9898 9899 // Bind script tag hack transport 9900 jQuery.ajaxTransport("script", function(s) { 9901 9902 // This transport only deals with cross domain requests 9903 if (s.crossDomain) { 9904 9905 var script, 9906 head = document.head || jQuery("head")[0] || document.documentElement; 9907 9908 return { 9909 9910 send: function(_, callback) { 9911 9912 script = document.createElement("script"); 9913 9914 script.async = true; 9915 9916 if (s.scriptCharset) { 9917 script.charset = s.scriptCharset; 9918 } 9919 9920 script.src = s.url; 9921 9922 // Attach handlers for all browsers 9923 script.onload = script.onreadystatechange = function(_, isAbort) { 9924 9925 if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState)) { 9926 9927 // Handle memory leak in IE 9928 script.onload = script.onreadystatechange = null; 9929 9930 // Remove the script 9931 if (script.parentNode) { 9932 script.parentNode.removeChild(script); 9933 } 9934 9935 // Dereference the script 9936 script = null; 9937 9938 // Callback if not abort 9939 if (!isAbort) { 9940 callback(200, "success"); 9941 } 9942 } 9943 }; 9944 9945 // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending 9946 // Use native DOM manipulation to avoid our domManip AJAX trickery 9947 head.insertBefore(script, head.firstChild); 9948 }, 9949 9950 abort: function() { 9951 if (script) { 9952 script.onload(undefined, true); 9953 } 9954 } 9955 }; 9956 } 9957 }); 9958 9959 9960 9961 var oldCallbacks = [], 9962 rjsonp = /(=)\?(?=&|$)|\?\?/; 9963 9964 // Default jsonp settings 9965 jQuery.ajaxSetup({ 9966 jsonp: "callback", 9967 jsonpCallback: function() { 9968 var callback = oldCallbacks.pop() || (jQuery.expando + "_" + (nonce++)); 9969 this[callback] = true; 9970 return callback; 9971 } 9972 }); 9973 9974 // Detect, normalize options and install callbacks for jsonp requests 9975 jQuery.ajaxPrefilter("json jsonp", function(s, originalSettings, jqXHR) { 9976 9977 var callbackName, overwritten, responseContainer, 9978 jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? 9979 "url" : 9980 typeof s.data === "string" && !(s.contentType || "").indexOf("application/x-www-form-urlencoded") && rjsonp.test(s.data) && "data" 9981 ); 9982 9983 // Handle iff the expected data type is "jsonp" or we have a parameter to set 9984 if (jsonProp || s.dataTypes[0] === "jsonp") { 9985 9986 // Get callback name, remembering preexisting value associated with it 9987 callbackName = s.jsonpCallback = jQuery.isFunction(s.jsonpCallback) ? 9988 s.jsonpCallback() : 9989 s.jsonpCallback; 9990 9991 // Insert callback into url or form data 9992 if (jsonProp) { 9993 s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName); 9994 } else if (s.jsonp !== false) { 9995 s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName; 9996 } 9997 9998 // Use data converter to retrieve json after script execution 9999 s.converters["script json"] = function() { 10000 if (!responseContainer) { 10001 jQuery.error(callbackName + " was not called"); 10002 } 10003 return responseContainer[0]; 10004 }; 10005 10006 // force json dataType 10007 s.dataTypes[0] = "json"; 10008 10009 // Install callback 10010 overwritten = window[callbackName]; 10011 window[callbackName] = function() { 10012 responseContainer = arguments; 10013 }; 10014 10015 // Clean-up function (fires after converters) 10016 jqXHR.always(function() { 10017 // Restore preexisting value 10018 window[callbackName] = overwritten; 10019 10020 // Save back as free 10021 if (s[callbackName]) { 10022 // make sure that re-using the options doesn't screw things around 10023 s.jsonpCallback = originalSettings.jsonpCallback; 10024 10025 // save the callback name for future use 10026 oldCallbacks.push(callbackName); 10027 } 10028 10029 // Call if it was a function and we have a response 10030 if (responseContainer && jQuery.isFunction(overwritten)) { 10031 overwritten(responseContainer[0]); 10032 } 10033 10034 responseContainer = overwritten = undefined; 10035 }); 10036 10037 // Delegate to script 10038 return "script"; 10039 } 10040 }); 10041 10042 10043 10044 // data: string of html 10045 // context (optional): If specified, the fragment will be created in this context, defaults to document 10046 // keepScripts (optional): If true, will include scripts passed in the html string 10047 jQuery.parseHTML = function(data, context, keepScripts) { 10048 if (!data || typeof data !== "string") { 10049 return null; 10050 } 10051 if (typeof context === "boolean") { 10052 keepScripts = context; 10053 context = false; 10054 } 10055 context = context || document; 10056 10057 var parsed = rsingleTag.exec(data), 10058 scripts = !keepScripts && []; 10059 10060 // Single tag 10061 if (parsed) { 10062 return [context.createElement(parsed[1])]; 10063 } 10064 10065 parsed = jQuery.buildFragment([data], context, scripts); 10066 10067 if (scripts && scripts.length) { 10068 jQuery(scripts).remove(); 10069 } 10070 10071 return jQuery.merge([], parsed.childNodes); 10072 }; 10073 10074 10075 // Keep a copy of the old load method 10076 var _load = jQuery.fn.load; 10077 10078 /** 10079 * Load a url into a page 10080 */ 10081 jQuery.fn.load = function(url, params, callback) { 10082 if (typeof url !== "string" && _load) { 10083 return _load.apply(this, arguments); 10084 } 10085 10086 var selector, response, type, 10087 self = this, 10088 off = url.indexOf(" "); 10089 10090 if (off >= 0) { 10091 selector = url.slice(off, url.length); 10092 url = url.slice(0, off); 10093 } 10094 10095 // If it's a function 10096 if (jQuery.isFunction(params)) { 10097 10098 // We assume that it's the callback 10099 callback = params; 10100 params = undefined; 10101 10102 // Otherwise, build a param string 10103 } else if (params && typeof params === "object") { 10104 type = "POST"; 10105 } 10106 10107 // If we have elements to modify, make the request 10108 if (self.length > 0) { 10109 jQuery.ajax({ 10110 url: url, 10111 10112 // if "type" variable is undefined, then "GET" method will be used 10113 type: type, 10114 dataType: "html", 10115 data: params 10116 }).done(function(responseText) { 10117 10118 // Save response for use in complete callback 10119 response = arguments; 10120 10121 self.html(selector ? 10122 10123 // If a selector was specified, locate the right elements in a dummy div 10124 // Exclude scripts to avoid IE 'Permission Denied' errors 10125 jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) : 10126 10127 // Otherwise use the full result 10128 responseText); 10129 10130 }).complete(callback && function(jqXHR, status) { 10131 self.each(callback, response || [jqXHR.responseText, status, jqXHR]); 10132 }); 10133 } 10134 10135 return this; 10136 }; 10137 10138 10139 10140 jQuery.expr.filters.animated = function(elem) { 10141 return jQuery.grep(jQuery.timers, function(fn) { 10142 return elem === fn.elem; 10143 }).length; 10144 }; 10145 10146 10147 10148 var docElem = window.document.documentElement; 10149 10150 /** 10151 * Gets a window from an element 10152 */ 10153 10154 function getWindow(elem) { 10155 return jQuery.isWindow(elem) ? 10156 elem : 10157 elem.nodeType === 9 ? 10158 elem.defaultView || elem.parentWindow : 10159 false; 10160 } 10161 10162 jQuery.offset = { 10163 setOffset: function(elem, options, i) { 10164 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10165 position = jQuery.css(elem, "position"), 10166 curElem = jQuery(elem), 10167 props = {}; 10168 10169 // set position first, in-case top/left are set even on static elem 10170 if (position === "static") { 10171 elem.style.position = "relative"; 10172 } 10173 10174 curOffset = curElem.offset(); 10175 curCSSTop = jQuery.css(elem, "top"); 10176 curCSSLeft = jQuery.css(elem, "left"); 10177 calculatePosition = (position === "absolute" || position === "fixed") && 10178 jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1; 10179 10180 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed 10181 if (calculatePosition) { 10182 curPosition = curElem.position(); 10183 curTop = curPosition.top; 10184 curLeft = curPosition.left; 10185 } else { 10186 curTop = parseFloat(curCSSTop) || 0; 10187 curLeft = parseFloat(curCSSLeft) || 0; 10188 } 10189 10190 if (jQuery.isFunction(options)) { 10191 options = options.call(elem, i, curOffset); 10192 } 10193 10194 if (options.top != null) { 10195 props.top = (options.top - curOffset.top) + curTop; 10196 } 10197 if (options.left != null) { 10198 props.left = (options.left - curOffset.left) + curLeft; 10199 } 10200 10201 if ("using" in options) { 10202 options.using.call(elem, props); 10203 } else { 10204 curElem.css(props); 10205 } 10206 } 10207 }; 10208 10209 jQuery.fn.extend({ 10210 offset: function(options) { 10211 if (arguments.length) { 10212 return options === undefined ? 10213 this : 10214 this.each(function(i) { 10215 jQuery.offset.setOffset(this, options, i); 10216 }); 10217 } 10218 10219 var docElem, win, 10220 box = { 10221 top: 0, 10222 left: 0 10223 }, 10224 elem = this[0], 10225 doc = elem && elem.ownerDocument; 10226 10227 if (!doc) { 10228 return; 10229 } 10230 10231 docElem = doc.documentElement; 10232 10233 // Make sure it's not a disconnected DOM node 10234 if (!jQuery.contains(docElem, elem)) { 10235 return box; 10236 } 10237 10238 // If we don't have gBCR, just use 0,0 rather than error 10239 // BlackBerry 5, iOS 3 (original iPhone) 10240 if (typeof elem.getBoundingClientRect !== strundefined) { 10241 box = elem.getBoundingClientRect(); 10242 } 10243 win = getWindow(doc); 10244 return { 10245 top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0), 10246 left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0) 10247 }; 10248 }, 10249 10250 position: function() { 10251 if (!this[0]) { 10252 return; 10253 } 10254 10255 var offsetParent, offset, 10256 parentOffset = { 10257 top: 0, 10258 left: 0 10259 }, 10260 elem = this[0]; 10261 10262 // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent 10263 if (jQuery.css(elem, "position") === "fixed") { 10264 // we assume that getBoundingClientRect is available when computed position is fixed 10265 offset = elem.getBoundingClientRect(); 10266 } else { 10267 // Get *real* offsetParent 10268 offsetParent = this.offsetParent(); 10269 10270 // Get correct offsets 10271 offset = this.offset(); 10272 if (!jQuery.nodeName(offsetParent[0], "html")) { 10273 parentOffset = offsetParent.offset(); 10274 } 10275 10276 // Add offsetParent borders 10277 parentOffset.top += jQuery.css(offsetParent[0], "borderTopWidth", true); 10278 parentOffset.left += jQuery.css(offsetParent[0], "borderLeftWidth", true); 10279 } 10280 10281 // Subtract parent offsets and element margins 10282 // note: when an element has margin: auto the offsetLeft and marginLeft 10283 // are the same in Safari causing offset.left to incorrectly be 0 10284 return { 10285 top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true), 10286 left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true) 10287 }; 10288 }, 10289 10290 offsetParent: function() { 10291 return this.map(function() { 10292 var offsetParent = this.offsetParent || docElem; 10293 10294 while (offsetParent && (!jQuery.nodeName(offsetParent, "html") && jQuery.css(offsetParent, "position") === "static")) { 10295 offsetParent = offsetParent.offsetParent; 10296 } 10297 return offsetParent || docElem; 10298 }); 10299 } 10300 }); 10301 10302 // Create scrollLeft and scrollTop methods 10303 jQuery.each({ 10304 scrollLeft: "pageXOffset", 10305 scrollTop: "pageYOffset" 10306 }, function(method, prop) { 10307 var top = /Y/.test(prop); 10308 10309 jQuery.fn[method] = function(val) { 10310 return access(this, function(elem, method, val) { 10311 var win = getWindow(elem); 10312 10313 if (val === undefined) { 10314 return win ? (prop in win) ? win[prop] : 10315 win.document.documentElement[method] : 10316 elem[method]; 10317 } 10318 10319 if (win) { 10320 win.scrollTo(!top ? val : jQuery(win).scrollLeft(), 10321 top ? val : jQuery(win).scrollTop() 10322 ); 10323 10324 } else { 10325 elem[method] = val; 10326 } 10327 }, method, val, arguments.length, null); 10328 }; 10329 }); 10330 10331 // Add the top/left cssHooks using jQuery.fn.position 10332 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10333 // getComputedStyle returns percent when specified for top/left/bottom/right 10334 // rather than make the css module depend on the offset module, we just check for it here 10335 jQuery.each(["top", "left"], function(i, prop) { 10336 jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, 10337 function(elem, computed) { 10338 if (computed) { 10339 computed = curCSS(elem, prop); 10340 // if curCSS returns percentage, fallback to offset 10341 return rnumnonpx.test(computed) ? 10342 jQuery(elem).position()[prop] + "px" : 10343 computed; 10344 } 10345 } 10346 ); 10347 }); 10348 10349 10350 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10351 jQuery.each({ 10352 Height: "height", 10353 Width: "width" 10354 }, function(name, type) { 10355 jQuery.each({
10356 padding: "inner" + name, 10357 content: type, 10358 "": "outer" + name 10359 }, function(defaultExtra, funcName) { 10360 // margin is only for outerHeight, outerWidth 10361 jQuery.fn[funcName] = function(margin, value) { 10362 var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"), 10363 extra = defaultExtra || (margin === true || value === true ? "margin" : "border"); 10364 10365 return access(this, function(elem, type, value) { 10366 var doc; 10367 10368 if (jQuery.isWindow(elem)) { 10369 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there 10370 // isn't a whole lot we can do. See pull request at this URL for discussion: 10371 // https://github.com/jquery/jquery/pull/764 10372 return elem.document.documentElement["client" + name]; 10373 } 10374 10375 // Get document width or height 10376 if (elem.nodeType === 9) { 10377 doc = elem.documentElement; 10378 10379 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest 10380 // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. 10381 return Math.max( 10382 elem.body["scroll" + name], doc["scroll" + name], 10383 elem.body["offset" + name], doc["offset" + name], 10384 doc["client" + name] 10385 ); 10386 } 10387 10388 return value === undefined ? 10389 // Get width or height on the element, requesting but not forcing parseFloat 10390 jQuery.css(elem, type, extra) : 10391 10392 // Set width or height on the element 10393 jQuery.style(elem, type, value, extra); 10394 }, type, chainable ? margin : undefined, chainable, null); 10395 }; 10396 }); 10397 }); 10398 10399 10400 // The number of elements contained in the matched element set 10401 jQuery.fn.size = function() { 10402 return this.length; 10403 }; 10404 10405 jQuery.fn.andSelf = jQuery.fn.addBack; 10406 10407 10408 10409 // Register as a named AMD module, since jQuery can be concatenated with other 10410 // files that may use define, but not via a proper concatenation script that 10411 // understands anonymous AMD modules. A named AMD is safest and most robust 10412 // way to register. Lowercase jquery is used because AMD module names are 10413 // derived from file names, and jQuery is normally delivered in a lowercase 10414 // file name. Do this after creating the global so that if an AMD module wants 10415 // to call noConflict to hide this version of jQuery, it will work. 10416 if (typeof define === "function" && define.amd) { 10417 define("jquery", [], function() { 10418 return jQuery; 10419 }); 10420 } 10421 10422 10423 10424 var 10425 // Map over jQuery in case of overwrite 10426 _jQuery = window.jQuery, 10427 10428 // Map over the $ in case of overwrite 10429 _$ = window.$; 10430 10431 jQuery.noConflict = function(deep) { 10432 if (window.$ === jQuery) { 10433 window.$ = _$; 10434 } 10435 10436 if (deep && window.jQuery === jQuery) { 10437 window.jQuery = _jQuery; 10438 } 10439 10440 return jQuery; 10441 }; 10442 10443 // Expose jQuery and $ identifiers, even in 10444 // AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 10445 // and CommonJS for browser emulators (#13566) 10446 if (typeof noGlobal === strundefined) { 10447 window.jQuery = window.$ = jQuery; 10448 } 10449 10450 10451 10452 return jQuery; 10453 10454})); 10455 10456/** 10457 * cookie 10458 * 10459 * $.cookie('the_cookie'); // 读å cookie 10460 * $.cookie('the_cookie', 'the_value'); // åå¨ cookie 10461 * $.cookie('the_cookie', 'the_value', { expires: 7 }); // åå¨ä¸ä¸ªå¸¦7天æéçcookie 10462 * $.cookie('the_cookie', null, 0); // å é¤cookie 10463 */ 10464;(function($) { 10465 $.cookie = function(name, value, options) { 10466 if (typeof value != 'undefined') { 10467 // name and value given, set cookie 10468 options = options || {}; 10469 if (value === null) { 10470 value = ''; 10471 options.expires = -1; 10472 } 10473 var expires = ''; 10474 if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { 10475 var date; 10476 if (typeof options.expires == 'number') { 10477 date = new Date(); 10478 date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); 10479 // date.setTime(date.getTime() + (options.expires * 60 * 1000)); 10480 } 10481 else { 10482 date = options.expires; 10483 } 10484 // use expires attribute, max-age is not supported by IE 10485 expires = '; expires=' + date.toUTCString(); 10486 } 10487 var path = options.path ? '; path=' + options.path : ''; 10488 var domain = options.domain ? '; domain=' + options.domain : ''; 10489 var secure = options.secure ? '; secure' : ''; 10490 document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); 10491 } 10492 else { 10493 // only name given, get cookie 10494 var cookieValue = null; 10495 if (document.cookie && document.cookie != '') { 10496 var cookies = document.cookie.split(';'); 10497 for (var i = 0; i < cookies.length; i++) { 10498 var cookie = jQuery.trim(cookies[i]); 10499 // Does this cookie string begin with the name we want? 10500 if (cookie.substring(0, name.length + 1) == (name + '=')) { 10501 cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); 10502 break; 10503 } 10504 } 10505 } 10506 return cookieValue; 10507 } 10508 }; 10509})(jQuery); 10510 10511/** 10512 * jQuery JSON plugin 2.4.0 10513 * 10514 * @author Brantley Harris, 2009-2011 10515 * @author Timo Tijhof, 2011-2012
10516 * @source This plugin is heavily influenced by MochiKit's serializeJSON, which is 10517 * copyrighted 2005 by Bob Ippolito. 10518 * @source Brantley Harris wrote this plugin. It is based somewhat on the JSON.org 10519 * website's http://www.json.org/json2.js, which proclaims: 10520 * "NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.", a sentiment that 10521 * I uphold. 10522 * @license MIT License <http://www.opensource.org/licenses/mit-license.php> 10523 */ 10524;(function ($) { 10525 'use strict'; 10526 10527 var escape = /["\\\x00-\x1f\x7f-\x9f]/g, 10528 meta = { 10529 '\b': '\\b', 10530 '\t': '\\t', 10531 '\n': '\\n', 10532 '\f': '\\f', 10533 '\r': '\\r', 10534 '"' : '\\"', 10535 '\\': '\\\\' 10536 }, 10537 hasOwn = Object.prototype.hasOwnProperty; 10538 10539 /** 10540 * jQuery.toJSON 10541 * Converts the given argument into a JSON representation. 10542 * 10543 * @param o {Mixed} The json-serializable *thing* to be converted 10544 * 10545 * If an object has a toJSON prototype, that will be used to get the representation. 10546 * Non-integer/string keys are skipped in the object, as are keys that point to a 10547 * function. 10548 * 10549 */ 10550 $.toJSON = typeof JSON === 'object' && JSON.stringify ? JSON.stringify : function (o) { 10551 if (o === null) { 10552 return 'null'; 10553 } 10554 10555 var pairs, k, name, val, 10556 type = $.type(o); 10557 10558 if (type === 'undefined') { 10559 return undefined; 10560 } 10561 10562 // Also covers instantiated Number and Boolean objects, 10563 // which are typeof 'object' but thanks to $.type, we 10564 // catch them here. I don't know whether it is right 10565 // or wrong that instantiated primitives are not 10566 // exported to JSON as an {"object":..}. 10567 // We choose this path because that's what the browsers did. 10568 if (type === 'number' || type === 'boolean') { 10569 return String(o); 10570 } 10571 if (type === 'string') { 10572 return $.quoteString(o); 10573 } 10574 if (typeof o.toJSON === 'function') { 10575 return $.toJSON(o.toJSON()); 10576 } 10577 if (type === 'date') { 10578 var month = o.getUTCMonth() + 1, 10579 day = o.getUTCDate(), 10580 year = o.getUTCFullYear(), 10581 hours = o.getUTCHours(), 10582 minutes = o.getUTCMinutes(), 10583 seconds = o.getUTCSeconds(), 10584 milli = o.getUTCMilliseconds(); 10585 10586 if (month < 10) { 10587 month = '0' + month; 10588 } 10589 if (day < 10) { 10590 day = '0' + day; 10591 } 10592 if (hours < 10) { 10593 hours = '0' + hours; 10594 } 10595 if (minutes < 10) { 10596 minutes = '0' + minutes; 10597 } 10598 if (seconds < 10) { 10599 seconds = '0' + seconds; 10600 } 10601 if (milli < 100) { 10602 milli = '0' + milli; 10603 } 10604 if (milli < 10) { 10605 milli = '0' + milli; 10606 } 10607 return '"' + year + '-' + month + '-' + day + 'T' + 10608 hours + ':' + minutes + ':' + seconds + 10609 '.' + milli + 'Z"'; 10610 } 10611 10612 pairs = []; 10613 10614 if ($.isArray(o)) { 10615 for (k = 0; k < o.length; k++) { 10616 pairs.push($.toJSON(o[k]) || 'null'); 10617 } 10618 return '[' + pairs.join(',') + ']'; 10619 } 10620 10621 // Any other object (plain object, RegExp, ..) 10622 // Need to do typeof instead of $.type, because we also 10623 // want to catch non-plain objects. 10624 if (typeof o === 'object') { 10625 for (k in o) { 10626 // Only include own properties, 10627 // Filter out inherited prototypes 10628 if (hasOwn.call(o, k)) { 10629 // Keys must be numerical or string. Skip others 10630 type = typeof k; 10631 if (type === 'number') { 10632 name = '"' + k + '"'; 10633 } else if (type === 'string') { 10634 name = $.quoteString(k); 10635 } else { 10636 continue; 10637 } 10638 type = typeof o[k]; 10639 10640 // Invalid values like these return undefined 10641 // from toJSON, however those object members 10642 // shouldn't be included in the JSON string at all. 10643 if (type !== 'function' && type !== 'undefined') { 10644 val = $.toJSON(o[k]); 10645 pairs.push(name + ':' + val); 10646 } 10647 } 10648 } 10649 return '{' + pairs.join(',') + '}'; 10650 } 10651 }; 10652 10653 /** 10654 * jQuery.evalJSON 10655 * Evaluates a given json string. 10656 * 10657 * @param str {String} 10658 */ 10659 $.evalJSON = typeof JSON === 'object' && JSON.parse ? JSON.parse : function (str) { 10660 /*jshint evil: true */ 10661 return eval('(' + str + ')'); 10662 }; 10663 10664 /** 10665 * jQuery.secureEvalJSON 10666 * Evals JSON in a way that is *more* secure. 10667 * 10668 * @param str {String} 10669 */ 10670 $.secureEvalJSON = typeof JSON === 'object' && JSON.parse ? JSON.parse : function (str) { 10671 var filtered = 10672 str 10673 .replace(/\\["\\\/bfnrtu]/g, '@') 10674 .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') 10675 .replace(/(?:^|:|,)(?:\s*\[)+/g, ''); 10676 10677 if (/^[\],:{}\s]*$/.test(filtered)) { 10678 /*jshint evil: true */ 10679 return eval('(' + str + ')'); 10680 }
10681 throw new SyntaxError('Error parsing JSON, source is not valid.'); 10682 }; 10683 10684 /** 10685 * jQuery.quoteString 10686 * Returns a string-repr of a string, escaping quotes intelligently. 10687 * Mostly a support function for toJSON. 10688 * Examples: 10689 * >>> jQuery.quoteString('apple') 10690 * "apple" 10691 * 10692 * >>> jQuery.quoteString('"Where are we going?", she asked.') 10693 * "\"Where are we going?\", she asked." 10694 */ 10695 $.quoteString = function (str) { 10696 if (str.match(escape)) { 10697 return '"' + str.replace(escape, function (a) { 10698 var c = meta[a]; 10699 if (typeof c === 'string') { 10700 return c; 10701 } 10702 c = a.charCodeAt(); 10703 return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16); 10704 }) + '"'; 10705 } 10706 return '"' + str + '"'; 10707 }; 10708 10709}(jQuery)); 10710/** 10711 * onload 10712 * @param window 10713 * @param undefined 10714 * @returns 10715 */ 10716(function(window, undefined){ 10717 window.onloadHack = function(func){ 10718 if (!!!func || typeof func !== 'function') { 10719 return; 10720 } 10721 if (document.readyState === "complete") { 10722 func(); 10723 } 10724 else if( window.addEventListener ){ 10725 window.addEventListener( "load", func, false); 10726 } else if( window.attachEvent ){ 10727 window.attachEvent( "onload", func, false); 10728 } 10729 } 10730})(window); 10731/** 10732 * å·æ°é¡µé¢ä¸ææck4æå ¥å¹´ä»½å段 10733 * @param window 10734 * @param undefined 10735 * @returns 10736 */ 10737(function(window, undefined){ 10738 onloadHack(function(){ 10739 $('.ck4_inset_year_container').each(function (){ 10740 var d = new Date(); 10741 var time = d.getFullYear(); 10742 $(this).text(time) 10743 }) 10744 }) 10745})(window); 10746(function(root,factory){if(typeof exports==="object"){module.exports=exports=factory()}else if(typeof define==="function"&&define.amd){define([],factory)}else{root.leadongDec=factory()}}(this,function(){var leadongDec=leadongDec||(function(Math,undefined){var crypto;if(typeof window!=='undefined'&&window.crypto){crypto=window.crypto}if(!crypto&&typeof window!=='undefined'&&window.msCrypto){crypto=window.msCrypto}var create=Object.create||(function(){function F(){}return function(obj){var subtype;F.prototype=obj;subtype=new F();F.prototype=null;return subtype}}());var C={};var C_lib=C.lib={};var Base=C_lib.Base=(function(){return{extend:function(overrides){var subtype=create(this);if(overrides){subtype.mixIn(overrides)}if(!subtype.hasOwnProperty('init')||this.init===subtype.init){subtype.init=function(){subtype.$super.init.apply(this,arguments)}}subtype.init.prototype=subtype;subtype.$super=this;return subtype},create:function(){var instance=this.extend();instance.init.apply(instance,arguments);return instance},init:function(){},mixIn:function(properties){for(var propertyName in properties){if(properties.hasOwnProperty(propertyName)){this[propertyName]=properties[propertyName]}}if(properties.hasOwnProperty('toString')){this.toString=properties.toString}}}}());var WordArray=C_lib.WordArray=Base.extend({init:function(words,sigBytes){words=this.words=words||[];if(sigBytes!=undefined){this.sigBytes=sigBytes}else{this.sigBytes=words.length*4}},concat:function(wordArray){var thisWords=this.words;var thatWords=wordArray.words;var thisSigBytes=this.sigBytes;var thatSigBytes=wordArray.sigBytes;if(thisSigBytes%4){for(var i=0;i<thatSigBytes;i++){var thatByte=(thatWords[i>>>2]>>>(24-(i%4)*8))&0xff;thisWords[(thisSigBytes+i)>>>2]|=thatByte<<(24-((thisSigBytes+i)%4)*8)}}else{for(var i=0;i<thatSigBytes;i+=4){thisWords[(thisSigBytes+i)>>>2]=thatWords[i>>>2]}}this.sigBytes+=thatSigBytes;return this}});var C_enc=C.enc={};var Latin1=C_enc.Latin1={stringify:function(wordArray){var words=wordArray.words;var sigBytes=wordArray.sigBytes;var latin1Chars=[];for(var i=0;i<sigBytes;i++){var bite=(words[i>>>2]>>>(24-(i%4)*8))&0xff;latin1Chars.push(String.fromCharCode(bite))}return latin1Chars.join('')},parse:function(latin1Str){var latin1StrLength=latin1Str.length;var words=[];for(var i=0;i<latin1StrLength;i++){words[i>>>2]|=(latin1Str.charCodeAt(i)&0xff)<<(24-(i%4)*8)}return new WordArray.init(words,latin1StrLength)}};var Utf8=C_enc.Utf8={stringify:function(wordArray){try{return decodeURIComponent(escape(Latin1.stringify(wordArray))
vendor: 9,164 bytes, line 10746
10746)}catch(e){throw new Error('Malformed UTF-8 data');}},parse:function(utf8Str){return Latin1.parse(unescape(encodeURIComponent(utf8Str)))}};var BufferedBlockAlgorithm=C_lib.BufferedBlockAlgorithm=Base.extend({reset:function(){this._data=new WordArray.init();this._nDataBytes=0},_append:function(data){if(typeof data=='string'){data=Utf8.parse(data)}this._data.concat(data);this._nDataBytes+=data.sigBytes},_process:function(doFlush){var processedWords;var data=this._data;var dataWords=data.words;var dataSigBytes=data.sigBytes;var blockSize=this.blockSize;var blockSizeBytes=blockSize*4;var nBlocksReady=dataSigBytes/blockSizeBytes;if(doFlush){nBlocksReady=Math.ceil(nBlocksReady)}else{nBlocksReady=Math.max((nBlocksReady|0)-this._minBufferSize,0)}var nWordsReady=nBlocksReady*blockSize;var nBytesReady=Math.min(nWordsReady*4,dataSigBytes);if(nWordsReady){for(var offset=0;offset<nWordsReady;offset+=blockSize){this._doProcessBlock(dataWords,offset)}processedWords=dataWords.splice(0,nWordsReady);data.sigBytes-=nBytesReady}return new WordArray.init(processedWords,nBytesReady)},_minBufferSize:0});var C_algo=C.algo={};return C}(Math));(function(){var C=leadongDec;var C_lib=C.lib;var WordArray=C_lib.WordArray;var C_enc=C.enc;var Base64=C_enc.Base64={parse:function(base64Str){var base64StrLength=base64Str.length;var map=this._map;var reverseMap=this._reverseMap;if(!reverseMap){reverseMap=this._reverseMap=[];for(var j=0;j<map.length;j++){reverseMap[map.charCodeAt(j)]=j}}var paddingChar=map.charAt(64);if(paddingChar){var paddingIndex=base64Str.indexOf(paddingChar);if(paddingIndex!==-1){base64StrLength=paddingIndex}}return parseLoop(base64Str,base64StrLength,reverseMap)},_map:'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='};function parseLoop(base64Str,base64StrLength,reverseMap){var words=[];var nBytes=0;for(var i=0;i<base64StrLength;i++){if(i%4){var bits1=reverseMap[base64Str.charCodeAt(i-1)]<<((i%4)*2);var bits2=reverseMap[base64Str.charCodeAt(i)]>>>(6-(i%4)*2);var bitsCombined=bits1|bits2;words[nBytes>>>2]|=bitsCombined<<(24-(nBytes%4)*8);nBytes++}}return WordArray.create(words,nBytes)}}());leadongDec.lib.Cipher||(function(undefined){var C=leadongDec;var C_lib=C.lib;var Base=C_lib.Base;var WordArray=C_lib.WordArray;var BufferedBlockAlgorithm=C_lib.BufferedBlockAlgorithm;var C_enc=C.enc;var Base64=C_enc.Base64;var Cipher=C_lib.Cipher=BufferedBlockAlgorithm.extend({cfg:Base.extend(),createDecryptor:function(key,cfg){return this.create(this._DEC_XFORM_MODE,key,cfg)},init:function(xformMode,key,cfg){this.cfg=this.cfg.extend(cfg);this._xformMode=xformMode;this._key=key;this.reset()},reset:function(){BufferedBlockAlgorithm.reset.call(this);this._doReset()},process:function(dataUpdate){},finalize:function(dataUpdate){if(dataUpdate){this._append(dataUpdate)}var finalProcessedData=this._doFinalize();return finalProcessedData},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:(function(){function selectCipherStrategy(key){if(typeof key=='string'){return PasswordBasedCipher}else{return SerializableCipher}}return function(cipher){return{encrypt:function(message,key,cfg){return selectCipherStrategy(key).encrypt(cipher,message,key,cfg)},decrypt:function(ciphertext,key,cfg){return selectCipherStrategy(key).decrypt(cipher,ciphertext,key,cfg)}}}}())});var C_mode=C.mode={};var BlockCipherMode=C_lib.BlockCipherMode=Base.extend({createDecryptor:function(cipher,iv){return this.Decryptor.create(cipher,iv)},init:function(cipher,iv){this._cipher=cipher;this._iv=iv}});var CBC=C_mode.CBC=(function(){var CBC=BlockCipherMode.extend();CBC.Decryptor=CBC.extend({processBlock:function(words,offset){var cipher=this._cipher;var blockSize=cipher.blockSize;var thisBlock=words.slice(offset,offset+blockSize);cipher.decryptBlock(words,offset);xorBlock.call(this,words,offset,blockSize);this._prevBlock=thisBlock}});function xorBlock(words,offset,blockSize){var block;var iv=this._iv;if(iv){block=iv;this._iv=undefined}else{block=this._prevBlock}for(var i=0;i<blockSize;i++){words[offset+i]^=block[i]}}return CBC}());var C_pad=C.pad={};var Pkcs7=C_pad.Pkcs7={pad:function(data,blockSize){var blockSizeBytes=blockSize*4;var nPaddingBytes=blockSizeBytes-data.sigBytes%blockSizeBytes;var paddingWord=(nPaddingBytes<<24)|(nPaddingBytes<<16)|(nPaddingBytes<<8)|nPaddingBytes;var paddingWords=[];for(var i=0;i<nPaddingBytes;i+=4){paddingWords.push(paddingWord)}var padding=WordArray.create(paddingWords,nPaddingBytes);data.concat(padding)},unpad:function(data){var nPaddingBytes=data.words[(data.sigBytes-1)>>>2]&0xff;data.sigBytes-=nPaddingBytes}};var BlockCipher=C_lib.BlockCipher=Cipher.extend({cfg:Cipher.cfg.extend({mode:CBC,padding:Pkcs7}),reset:function(){var modeCreator;Cipher.reset.call(this);var cfg=this.cfg;var iv=cfg.iv;var mode=cfg.mode;if(this._xformMode==this._ENC_XFORM_MODE){}else{modeCreator=mode.createDecryptor;this._minBufferSize=1}if(this._mode&&this._mode.__creator==modeCreator){this._mode.init(this,iv&&iv.words)}else{this._mode=modeCreator.call(mode,this,iv&&iv.words);this._mode.__creator=modeCreator}},_doProcessBlock:function(words,offset){this._mode.processBlock(words,offset)},_doFinalize:function(){var finalProcessedBlocks;var padding=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){padding.pad(this._data,this.blockSize);finalProcessedBlocks=this._process(!!'flush')}else{finalProcessedBlocks=this._process(!!'flush');padding.unpad(finalProcessedBlocks)}return finalProcessedBlocks},blockSize:128/32});var CipherParams=C_lib.CipherParams=Base.extend({init:function(cipherParams){this.mixIn(cipherParams)},toString:function(formatter){return(formatter||this.formatter).stringify(this)}});var C_format=C.format={};var OpenSSLFormatter=C_format.OpenSSL={parse:function(openSSLStr){var salt;var ciphertext=Base64.parse(openSSLStr);var ciphertextWords=ciphertext.words;if(ciphertextWords[0]==0x53616c74&&ciphertextWords[1]==0x65645f5f){salt=WordArray.create(ciphertextWords.slice(2,4));ciphertextWords.splice(0,4);ciphertext.sigBytes-=16}return CipherParams.create({ciphertext:ciphertext,salt:salt})}};var SerializableCipher=C_lib.SerializableCipher=Base.extend({cfg:Base.extend({format:OpenSSLFormatter}),decrypt:function(cipher,ciphertext,key,cfg){cfg=this.cfg.extend(cfg);ciphertext=this._parse(ciphertext,cfg.format);var plaintext=cipher.createDecryptor(key,cfg).finalize(ciphertext.ciphertext);return plaintext},_parse:function(ciphertext,format){if(typeof ciphertext=='string'){return format.parse(ciphertext,this)}else{return ciphertext}}});var C_kdf=C.kdf={};var PasswordBasedCipher=C_lib.PasswordBasedCipher=SerializableCipher.extend({decrypt:function(cipher,ciphertext,password,cfg){cfg=this.cfg.extend(cfg);ciphertext=this._parse(ciphertext,cfg.format);var derivedParams=cfg.kdf.execute(password,cipher.keySize,cipher.ivSize,ciphertext.salt);cfg.iv=derivedParams.iv;var plaintext=SerializableCipher.decrypt.call(this,cipher,ciphertext,derivedParams.key,cfg);return plaintext}})}());leadongDec.mode.ECB=(function(){var ECB=leadongDec.lib.BlockCipherMode.extend();ECB.Decryptor=ECB.extend({processBlock:function(words,offset){this._cipher.decryptBlock(words,offset)}});return ECB}());(function(){var C=leadongDec;var C_lib=C.lib;var BlockCipher=C_lib.BlockCipher;var C_algo=C.algo;var SBOX=[];var INV_SBOX=[];var SUB_MIX_0=[];var SUB_MIX_1=[];var SUB_MIX_2=[];var SUB_MIX_3=[];var INV_SUB_MIX_0=[];var INV_SUB_MIX_1=[];var INV_SUB_MIX_2=[];var INV_SUB_MIX_3=[];(function(){var d=[];for(var i=0;i<256;i++){if(i<128){d[i]=i<<1}else{d[i]=(i<<1)^0x11b}}var x=0;var xi=0;for(var i=0;i<256;i++){var sx=xi^(xi<<1)^(xi<<2)^(xi<<3)^(xi<<4);sx=(sx>>>8)^(sx&0xff)^0x63;SBOX[x]=sx;INV_SBOX[sx]=x;var x2=d[x];var x4=d[x2];var x8=d[x4];var t=(d[sx]*0x101)^(sx*0x1010100);SUB_MIX_0[x]=(t<<24)|(t>>>8);SUB_MIX_1[x]=(t<<16)|(t>>>16);SUB_MIX_2[x]=(t<<8)|(t>>>24);SUB_MIX_3[x]=t;var t=(x8*0x1010101)^(x4*0x10001)^(x2*0x101)^(x*0x1010100);INV_SUB_MIX_0[sx]=(t<<24)|(t>>>8);INV_SUB_MIX_1[sx]=(t<<16)|(t>>>16);INV_SUB_MIX_2[sx]=(t<<8)|(t>>>24);INV_SUB_MIX_3[sx]=t;if(!x){x=xi=1}else{x=x2^d[d[d[x8^x2]]];xi^=d[d[xi]]}}}());var RCON=[0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0x1b,0x36];var AES=C_algo.AES=BlockCipher.extend({_doReset:function(){var t;if(this._nRounds&&this._keyPriorReset===this._key){return}var key=this._keyPriorReset=this._key;var keyWords=key.words;var keySize=key.sigBytes/4;var nRounds=this._nRounds=keySize+6;var ksRows=(nRounds+1)*4;var keySchedule=this._keySchedule=[];for(var ksRow=0;ksRow<ksRows;ksRow++){if(ksRow<keySize){keySchedule[ksRow]=keyWords[ksRow]}else{t=keySchedule[ksRow-1];if(!(ksRow%keySize)){t=(t<<8)|(t>>>24);t=(SBOX[t>>>24]<<24)|(SBOX[(t>>>16)&0xff]<<16)|(SBOX[(t>>>8)&0xff]<<8)|SBOX[t&0xff];t^=RCON[(ksRow/keySize)|0]<<24}else if(keySize>6&&ksRow%keySize==4){t=(SBOX[t>>>24]<<24)|(SBOX[(t>>>16)&0xff]<<16)|(SBOX[(t>>>8)&0xff]<<8)|SBOX[t&0xff]}keySchedule[ksRow]=keySchedule[ksRow-keySize]^t}}var invKeySchedule=this._invKeySchedule=[];for(var invKsRow=0;invKsRow<ksRows;invKsRow++){var ksRow=ksRows-invKsRow;if(invKsRow%4){var t=keySchedule[ksRow]}else{var t=keySchedule[ksRow-4]}if(invKsRow<4||ksRow<=4){invKeySchedule[invKsRow]=t}
10746else{invKeySchedule[invKsRow]=INV_SUB_MIX_0[SBOX[t>>>24]]^INV_SUB_MIX_1[SBOX[(t>>>16)&0xff]]^INV_SUB_MIX_2[SBOX[(t>>>8)&0xff]]^INV_SUB_MIX_3[SBOX[t&0xff]]}}},decryptBlock:function(M,offset){var t=M[offset+1];M[offset+1]=M[offset+3];M[offset+3]=t;this._doCryptBlock(M,offset,this._invKeySchedule,INV_SUB_MIX_0,INV_SUB_MIX_1,INV_SUB_MIX_2,INV_SUB_MIX_3,INV_SBOX);var t=M[offset+1];M[offset+1]=M[offset+3];M[offset+3]=t},_doCryptBlock:function(M,offset,keySchedule,SUB_MIX_0,SUB_MIX_1,SUB_MIX_2,SUB_MIX_3,SBOX){var nRounds=this._nRounds;var s0=M[offset]^keySchedule[0];var s1=M[offset+1]^keySchedule[1];var s2=M[offset+2]^keySchedule[2];var s3=M[offset+3]^keySchedule[3];var ksRow=4;for(var round=1;round<nRounds;round++){var t0=SUB_MIX_0[s0>>>24]^SUB_MIX_1[(s1>>>16)&0xff]^SUB_MIX_2[(s2>>>8)&0xff]^SUB_MIX_3[s3&0xff]^keySchedule[ksRow++];var t1=SUB_MIX_0[s1>>>24]^SUB_MIX_1[(s2>>>16)&0xff]^SUB_MIX_2[(s3>>>8)&0xff]^SUB_MIX_3[s0&0xff]^keySchedule[ksRow++];var t2=SUB_MIX_0[s2>>>24]^SUB_MIX_1[(s3>>>16)&0xff]^SUB_MIX_2[(s0>>>8)&0xff]^SUB_MIX_3[s1&0xff]^keySchedule[ksRow++];var t3=SUB_MIX_0[s3>>>24]^SUB_MIX_1[(s0>>>16)&0xff]^SUB_MIX_2[(s1>>>8)&0xff]^SUB_MIX_3[s2&0xff]^keySchedule[ksRow++];s0=t0;s1=t1;s2=t2;s3=t3}var t0=((SBOX[s0>>>24]<<24)|(SBOX[(s1>>>16)&0xff]<<16)|(SBOX[(s2>>>8)&0xff]<<8)|SBOX[s3&0xff])^keySchedule[ksRow++];var t1=((SBOX[s1>>>24]<<24)|(SBOX[(s2>>>16)&0xff]<<16)|(SBOX[(s3>>>8)&0xff]<<8)|SBOX[s0&0xff])^keySchedule[ksRow++];var t2=((SBOX[s2>>>24]<<24)|(SBOX[(s3>>>16)&0xff]<<16)|(SBOX[(s0>>>8)&0xff]<<8)|SBOX[s1&0xff])^keySchedule[ksRow++];var t3=((SBOX[s3>>>24]<<24)|(SBOX[(s0>>>16)&0xff]<<16)|(SBOX[(s1>>>8)&0xff]<<8)|SBOX[s2&0xff])^keySchedule[ksRow++];M[offset]=t0;M[offset+1]=t1;M[offset+2]=t2;M[offset+3]=t3},keySize:256/32});C.AES=BlockCipher._createHelper(AES)}());return leadongDec}));; 10747 10748/** 10749 * @description: æå°åå ç»ä»¶ä¾èµå è½½ 10750 */ 10751(function () { 10752 var previewDomain = ''; 10753 var searchTimer = ''; 10754 try { 10755 const scriptSrc = document.currentScript.src; 10756 const fullUrl = scriptSrc.startsWith('//') ? window.location.protocol + scriptSrc : scriptSrc; 10757 const currentLocation = new URL(fullUrl); 10758 previewDomain = currentLocation.origin; 10759 searchTimer = currentLocation.search; 10760 if(previewDomain && (previewDomain.indexOf('ldwebsitebuilder') != -1 || previewDomain.indexOf('website.leadong.com') != -1)) { 10761 try { 10762 previewDomain = JSON.parse(localStorage.getItem('cdnDomainFont')); 10763 }catch(e) { 10764 previewDomain = localStorage.getItem('cdnDomainFont'); 10765 } 10766 } 10767 } catch (e) { 10768 console.log(e); 10769 } 10770 //äºä»¶ä¸å¿ 10771 class EventEmitter { 10772 constructor() { 10773 this._events = Object.create(null); 10774 } 10775 //注åçå¬ 10776 on(type, fn, context = this) { 10777 if (!this._events[type]) { 10778 this._events[type] = []; 10779 } 10780 10781 this._events[type].push([fn, context]); 10782 } 10783 10784 once(type, fn, context = this) { 10785 let fired = false; 10786 10787 function magic() { 10788 this.off(type, magic); 10789 10790 if (!fired) { 10791 fired = true; 10792 fn.apply(context, arguments); 10793 } 10794 } 10795 10796 this.on(type, magic); 10797 } 10798 //ç§»é¤çå¬ 10799 off(type, fn) { 10800 let _events = this._events[type]; 10801 if (!_events) { 10802 return; 10803 } 10804 10805 let count = _events.length; 10806 while (count--) { 10807 if (_events[count][0] === fn) { 10808 _events[count][0] = undefined; 10809 } 10810 } 10811 } 10812 //ååºçå¬äºä»¶ 10813 emit(type) { 10814 let events = this._events[type]; 10815 if (!events) { 10816 return; 10817 } 10818 10819 let len = events.length; 10820 let eventsCopy = [...events]; 10821 for (let i = 0; i < len; i++) { 10822 let event = eventsCopy[i]; 10823 let [fn, context] = event; 10824 if (fn) { 10825 fn.apply(context, [].slice.call(arguments, 1)); 10826 } 10827 } 10828 } 10829 } 10830 var leadComponentSite = window.leadComponentSite || (window.leadComponentSite = {}); 10831 const globalMinimumUnitEvent = new EventEmitter(); 10832 Object.assign(leadComponentSite, { 10833 previewDomain: previewDomain, 10834 globalMinimumUnitEvent: globalMinimumUnitEvent, 10835 loadSuccessJsList:[], 10836 searchTimer: searchTimer || '', 10837 // å è½½ä¾èµæå 10838 jsDeepSuccess: async function (jsDeep, cssDeep) { 10839 for (let urlLink of cssDeep) { 10840 if (this.isLoadSuccess(urlLink)) { 10841 continue; 10842 } 10843 await this.loadDependFunc({ url: urlLink, type: 'style' }); 10844 } 10845 for (let urlLink of jsDeep) { 10846 if (this.isLoadSuccess(urlLink)) { 10847 continue; 10848 } 10849 await this.loadDependFunc({ url: urlLink, type: 'script' }); 10850 } 10851 }, 10852 //åå»ºèµæºå è½½çpromis对象 10853 loadDependFunc(option) { 10854 var loadDependPromise = new Promise((resolve, rej) => { 10855 if (option.type == "script") { 10856 var scriptDom = document.createElement("script"); 10857 scriptDom.type = "text/javascript"; 10858 scriptDom.src = option.url; 10859 document.head.appendChild(scriptDom); 10860 scriptDom.onload = function () { 10861 leadComponentSite.loadSuccessJsList.push(option.url); 10862 resolve("success"); 10863 }; 10864 scriptDom.onerror = function () { 10865 resolve("error"); 10866 }; 10867 } 10868 if (option.type == "style") { 10869 var linkDom = document.createElement("link"); 10870 linkDom.rel = "stylesheet"; 10871 linkDom.href = option.url; 10872 leadComponentSite.loadSuccessJsList.push(option.url); 10873 document.head.appendChild(linkDom); 10874 resolve("success"); 10875 } 10876 }); 10877 10878 return loadDependPromise; 10879 }, 10880 // æ¥æ¾é¡µé¢æ¯å¦åå¨å·²å è½½èµæº 10881 isLoadSuccess(scriptUrl) { 10882 if(this.loadSuccessJsList.indexOf(scriptUrl) != -1){ 10883 return true; 10884 } 10885 }, 10886 // å è½½æå®çåè°å½æ° 10887 renderCallback(options) { 10888 const { callback } = options 10889 if (callback && typeof callback == 'function') { 10890 callback() 10891 } 10892 }, 10893 async dialogSource(url, type, width = 0, height= 0) { 10894 if(type == 'image') { 10895 var html = ` 10896 <div class="lead-preview-box"> 10897 <div class="lead-preview-close"> 10898 <svg class="lead-preview-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="#ffffff" d="M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"></path></svg> 10899 </div> 10900 <div class="lead-preview-menu"> 10901 <span class="lead-preview-icon lead-preview-reduce"> 10902 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="#ffffff" d="m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704M352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64"></path></svg> 10903 </span> 10904 <span class="lead-preview-icon lead-preview-enlarge"> 10905 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="#ffffff" d="m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"></path></svg> 10906 </span> 10907 <span class="lead-preview-icon lead-preview-left"> 10908 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="#ffffff" d="M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"></path></svg> 10909 </span> 10910 <span class="lead-preview-icon lead-preview-right"> 10911 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="#ffffff" d="M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"></path></svg> 10912 </span> 10913 </div> 10914 <div class="lead-preview-bx-img"> 10915 <img src="${url}"/> 10916 </div> 10917 </div> 10918 ` 10919 document.body.insertAdjacentHTML('beforeend', html) 10920 $('.lead-preview-close').on('click', function() { 10921 $('.lead-preview-box').remove() 10922 }) 10923 var scale = 1; // åå§ç¼©æ¾æ¯ä¾ 10924 var rotate = 0; // åå§æè½¬è§åº¦ 10925 $('.lead-preview-reduce').on('click', function() { 10926 scale = Math.max(0.1, scale - 0.1); // æ¯æ¬¡æ¾å¤§ 0.1 10927 updateTransform(); 10928 }) 10929 $('.lead-preview-enlarge').on('click', function() { 10930 scale += 0.1; // æ¯æ¬¡æ¾å¤§ 0.1 10931 updateTransform(); 10932 }) 10933 $('.lead-preview-left').on('click', function() { 10934 rotate -= 90; // æ¯æ¬¡åå·¦æè½¬ 90 度 10935 updateTransform(); 10936 }) 10937 $('.lead-preview-right').on('click', function() { 10938 rotate += 90; // æ¯æ¬¡åå³æè½¬ 90 度 10939 updateTransform(); 10940 }) 10941 function updateTransform() { 10942 $('.lead-preview-bx-img img').css('transform', 'scale(' + scale + ') rotate(' + rotate + 'deg)'); 10943 } 10944 } else if(type == 'vr') { 10945 // width heightææ²¡æåä½å¦px || % || vwç 10946 var isHasWidthUnit = /(px|%|vw|vh|em|rem|in|cm|mm|pt|pc|ex|ch|vmin|vmax)$/.test(width) 10947 var isHasHeightUnit = /(px|%|vw|vh|em|rem|in|cm|mm|pt|pc|ex|ch|vmin|vmax)$/.test(height) 10948 var calcWidth = width; 10949 var calcHeight = height; 10950 // 妿width height没æåä½ï¼åå ä¸px 10951 if(!isHasWidthUnit) { 10952 calcWidth = width + 'px' 10953 } 10954 if(!isHasHeightUnit){ 10955 calcHeight = height + 'px' 10956 } 10957 var html = ` 10958 <div class="lead-preview-box"> 10959 <div class="lead-preview-close"> 10960 <svg class="lead-preview-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="#ffffff" d="M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"></path></svg> 10961 </div> 10962 <div class="lead-preview-bx-img" style="width: 100%;height: 100%;"> 10963 <iframe frameborder="0" allowfullscreen src="${url}" style="${width == 0 ? '' : 'width:' + calcWidth + ';'} ${height == 0 ? '' : 'height:' + calcHeight + ';'}"/> 10964 </div> 10965 </div> 10966 ` 10967 document.body.insertAdjacentHTML('beforeend', html) 10968 $('.lead-preview-close').on('click', function() { 10969 $('.lead-preview-box').remove() 10970 }) 10971 } else if(type == 'video') { 10972 const regex = /(m3u8)$/; 10973 var htmlIframe = ""; 10974 if(regex.test(url)) {
10975 htmlIframe = `<video class="lead-preview-bx-video" src="${url}" controls="true" autoplay></video>` 10976 }else{ 10977 htmlIframe = `<iframe class="lead-preview-bx-video" src="${url}" style="width: 100%;height: 100%;" controls="true" autoplay scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>` 10978 } 10979 var html = ` 10980 <div class="lead-preview-box lead-preview-video-box"> 10981 <div class="lead-preview-close"> 10982 <svg class="lead-preview-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="#ffffff" d="M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"></path></svg> 10983 </div> 10984 <div class="lead-preview-bx-img"> 10985 ${htmlIframe} 10986 </div> 10987 </div> 10988 <style> 10989 .lead-preview-bx-img lite-youtube::after{ 10990 background:black; 10991 } 10992 .lead-preview-bx-img .lead-video-iframe iframe { 10993 width: 80%; 10994 height: 80%; 10995 position: absolute; 10996 top: 50%; 10997 left: 50%; 10998 transform: translateX(-50%) translateY(-50%); 10999 } 11000 </style> 11001 ` 11002 11003 document.body.insertAdjacentHTML('beforeend', html) 11004 11005 if(regex.test(url)) { 11006 try { 11007 if(!Hls) { 11008 if(leadComponentSite.hlsSourceImport) { 11009 await leadComponentSite.hlsSourceImport.init({}) 11010 } 11011 } 11012 if (Hls && Hls.isSupported) { 11013 const hls = new Hls(); 11014 hls.loadSource(url); 11015 hls.attachMedia($('.lead-preview-bx-video')[0]); 11016 hls.on(Hls.Events.MANIFEST_PARSED, function() { 11017 $('.lead-preview-bx-video')[0].play(); 11018 }); 11019 } 11020 } catch (e) { 11021 console.log(e) 11022 } 11023 } 11024 $('.lead-preview-close').on('click', function() { 11025 $('.lead-preview-box').remove() 11026 }) 11027 } 11028 }, 11029 }) 11030 11031 /** 11032 * sku 11033 */ 11034 var miniUnitSku = leadComponentSite.miniUnitSku || (leadComponentSite.miniUnitSku = {}); 11035 Object.assign(miniUnitSku, { 11036 init: async function (options) { 11037 const deeped = { 11038 jsDeep: [leadComponentSite.previewDomain + '/static/assets/blockEditor/script/standalone.js', leadComponentSite.previewDomain + '/static/assets/blockEditor/script/spec-adjoin-martix.js'], 11039 cssDeep: [] 11040 } 11041 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11042 leadComponentSite.renderCallback(options) 11043 } 11044 }) 11045 /** 11046 * three 11047 */ 11048 var threeSourceImport = leadComponentSite.threeSourceImport || (leadComponentSite.threeSourceImport = {}); 11049 Object.assign(threeSourceImport, { 11050 init: async function (options) { 11051 const deeped = { 11052 cssDeep: [], 11053 jsDeep: [ 11054 leadComponentSite.previewDomain + '/static/assets/blockEditor/script/three.js', 11055 leadComponentSite.previewDomain + '/static/assets/blockEditor/script/OBJLoader.js', 11056 leadComponentSite.previewDomain + '/static/assets/blockEditor/script/STLLoader.js', 11057 leadComponentSite.previewDomain + '/static/assets/blockEditor/script/OrbitControls.js', 11058 leadComponentSite.previewDomain + '/static/assets/blockEditor/script/tween.js', 11059 leadComponentSite.previewDomain + '/static/assets/blockEditor/script/screenfull.js', 11060 ] 11061 } 11062 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11063 leadComponentSite.renderCallback(options) 11064 } 11065 }) 11066 /** 11067 * Swiper 11068 */ 11069 var miniUnitProductImg = leadComponentSite.miniUnitProductImg || (leadComponentSite.miniUnitProductImg = {}); 11070 Object.assign(miniUnitProductImg, { 11071 init: async function (options) { 11072 const deeped = { 11073 cssDeep: [leadComponentSite.previewDomain + '/static/assets/blockEditor/styles/swiper.min.css'], 11074 jsDeep: [leadComponentSite.previewDomain + '/static/assets/blockEditor/script/swiper.min.js'] 11075 } 11076 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11077 leadComponentSite.renderCallback(options) 11078 } 11079 }) 11080 /** 11081 * slick 11082 */ 11083 var slickSourceImport = leadComponentSite.slickSourceImport || (leadComponentSite.slickSourceImport = {}); 11084 var phoenixSites = window.phoenixSite || (window.phoenixSite = {}); 11085 Object.assign(slickSourceImport, { 11086 init: async function (options) { 11087 const deeped = { 11088 cssDeep: [leadComponentSite.previewDomain + '/static/assets/blockEditor/styles/slick.css?t=20241213', leadComponentSite.previewDomain + '/static/assets/blockEditor/styles/slick-theme.css'], 11089 jsDeep: [leadComponentSite.previewDomain + '/static/assets/blockEditor/script/slick.min.js?t=20260723'] 11090 } 11091 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11092 leadComponentSite.renderCallback(options) 11093 }, 11094 leadInit: async function (options) { 11095 const cdnUrl = (phoenixSites && phoenixSites.page && phoenixSites.page.cdnUrl) 11096 ? phoenixSites.page.cdnUrl 11097 : leadComponentSite.previewDomain; 11098 11099 const deeped = { 11100 cssDeep: [cdnUrl + '/static/assets/blockControl/slick/slick.css?t=20250616', cdnUrl + '/static/assets/blockControl/slick/slick-theme.css?t=20250616'], 11101 jsDeep: [cdnUrl + '/static/assets/blockControl/slick/slick.min.js?t=20250616'] 11102 } 11103 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11104 leadComponentSite.renderCallback(options) 11105 } 11106 }) 11107 /** 11108 * masonry.pkgd.min.js 11109 */ 11110 var masonrySourceImport = leadComponentSite.masonrySourceImport || (leadComponentSite.masonrySourceImport = {}); 11111 Object.assign(masonrySourceImport, { 11112 init: async function (options) { 11113 const deeped = { 11114 cssDeep: [], 11115 jsDeep: [leadComponentSite.previewDomain + '/static/assets/blockEditor/script/masonry.pkgd.min.js'] 11116 } 11117 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11118 leadComponentSite.renderCallback(options) 11119 } 11120 }) 11121 /** 11122 * imagesloaded.pkgd.min.js 11123 */ 11124 var imagesloadedSourceImport = leadComponentSite.imagesloadedSourceImport || (leadComponentSite.imagesloadedSourceImport = {}); 11125 Object.assign(imagesloadedSourceImport, { 11126 init: async function (options) { 11127 const deeped = { 11128 cssDeep: [], 11129 jsDeep: [leadComponentSite.previewDomain + '/static/assets/blockEditor/script/imagesloaded.pkgd.min.js'] 11130 } 11131 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11132 leadComponentSite.renderCallback(options) 11133 } 11134 }) 11135 /** 11136 * videojs 11137 */ 11138 var videoSourceImport = leadComponentSite.videojs || (leadComponentSite.videojs = {}); 11139 Object.assign(videoSourceImport, { 11140 init: async function (options) { 11141 const deeped = { 11142 cssDeep: [leadComponentSite.previewDomain + '/static/assets/widget/script/plugins/videojs/video-js.min.css'], 11143 jsDeep: [leadComponentSite.previewDomain + '/static/assets/widget/script/plugins/videojs/video.min.js'] 11144 } 11145 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11146 leadComponentSite.renderCallback(options) 11147 } 11148 }) 11149 /** 11150 * OwlCarousel 11151 */ 11152 var owlSourceImport = leadComponentSite.owl || (leadComponentSite.owl = {}); 11153 Object.assign(owlSourceImport, { 11154 init: async function (options) { 11155 const deeped = { 11156 cssDeep: [], 11157 jsDeep: [leadComponentSite.previewDomain + '/static/assets/widget/script/plugins/owlcarousel2/owl.carousel.min.js'] 11158 } 11159 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11160 leadComponentSite.renderCallback(options) 11161 } 11162 }) 11163 /** 11164 * ScrollPic 11165 */ 11166 var scrollPicSourceImport = leadComponentSite.scrollPic || (leadComponentSite.scrollPic = {}); 11167 Object.assign(scrollPicSourceImport, { 11168 init: async function (options) { 11169 const deeped = { 11170 cssDeep: [], 11171 jsDeep: [leadComponentSite.previewDomain + '/static/assets/widget/script/plugins/scrollPic.js'] 11172 } 11173 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11174 leadComponentSite.renderCallback(options) 11175 } 11176 }) 11177 /** 11178 * jQuery Mousewheel 11179 */ 11180 var jQMousewheelSourceImport = leadComponentSite.jQMousewheel || (leadComponentSite.jQMousewheel = {}); 11181 Object.assign(jQMousewheelSourceImport, { 11182 init: async function (options) { 11183 const deeped = { 11184 cssDeep: [], 11185 jsDeep: [leadComponentSite.previewDomain + '/static/assets/widget/script/plugins/jquery.mousewheel.min.js'] 11186 } 11187 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11188 leadComponentSite.renderCallback(options) 11189 } 11190 }) 11191 /** 11192 * mCustomScrollbar 11193 */ 11194 var mCustomSourceImport = leadComponentSite.mCustomScrollbar || (leadComponentSite.mCustomScrollbar = {}); 11195 Object.assign(mCustomSourceImport, { 11196 init: async function (options) { 11197 const deeped = { 11198 cssDeep: [leadComponentSite.previewDomain + '/static/assets/widget/script/plugins/malihuCustomScrollbarPlugin/jquery.mCustomScrollbar.min.css'], 11199 jsDeep: [leadComponentSite.previewDomain + '/static/assets/widget/script/plugins/malihuCustomScrollbarPlugin/jquery.mCustomScrollbar.min.js?t=4515'] 11200 } 11201 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11202 leadComponentSite.renderCallback(options) 11203 } 11204 }) 11205 /** 11206 * fancybox 11207 */ 11208 var fancyboxImport = leadComponentSite.fancyboxConcat || (leadComponentSite.fancyboxConcat = {}); 11209 Object.assign(fancyboxImport, { 11210 init: async function (options) { 11211 const deeped = { 11212 cssDeep: [leadComponentSite.previewDomain + '/static/assets/widget/script/plugins/fancybox/fancybox.css'], 11213 jsDeep: [leadComponentSite.previewDomain + '/static/assets/widget/script/plugins/fancybox/fancybox.umd.js'] 11214 } 11215 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11216 leadComponentSite.renderCallback(options) 11217 } 11218 }) 11219 /** 11220 * mCustomScrollbar-concat 11221 */ 11222 var mCustomConcatSourceImport = leadComponentSite.mCustomScrollbarConcat || (leadComponentSite.mCustomScrollbarConcat = {}); 11223 Object.assign(mCustomConcatSourceImport, { 11224 init: async function (options) { 11225 const deeped = { 11226 cssDeep: [leadComponentSite.previewDomain + '/static/assets/widget/script/plugins/malihuCustomScrollbarPlugin/jquery.mCustomScrollbar.min.css'], 11227 jsDeep: [leadComponentSite.previewDomain + '/static/assets/widget/script/plugins/malihuCustomScrollbarPlugin/jquery.mCustomScrollbar.concat.min.js'] 11228 } 11229 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11230 leadComponentSite.renderCallback(options) 11231 } 11232 }) 11233 /** 11234 * jquery.justifiedGallery.min.js 11235 */ 11236 var justifiedGallerySourceImport = leadComponentSite.justifiedGallerySourceImport || (leadComponentSite.justifiedGallerySourceImport = {}); 11237 Object.assign(justifiedGallerySourceImport, { 11238 init: async function (options) { 11239 const deeped = { 11240 cssDeep: [leadComponentSite.previewDomain + '/static/assets/blockEditor/styles/justifiedGallery.css'], 11241 jsDeep: [leadComponentSite.previewDomain + '/static/assets/blockEditor/script/jquery.justifiedGallery.min.js'] 11242 } 11243 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11244 leadComponentSite.renderCallback(options) 11245 } 11246 }) 11247 /** 11248 * å å ¥è´ç©è½¦å询çè 11249 */ 11250 var blockPaySourceImport = leadComponentSite.blockPaySourceImport || (leadComponentSite.blockPaySourceImport = {}); 11251 Object.assign(blockPaySourceImport, { 11252 init: async function (options) { 11253 const deeped = { 11254 cssDeep: [leadComponentSite.previewDomain + '/static/assets/widget/style/component/shoppingcartStatus/shoppingcartStatus.css?t=1727182405391'], 11255 jsDeep: [leadComponentSite.previewDomain + '/static/assets/blockEditor/script/prodBaseUnitDeep.js?t=1727182405391'] 11256 } 11257 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11258 leadComponentSite.renderCallback(options) 11259 } 11260 }) 11261 11262 /** 11263 * hls.min.js m3u8ææ¾å¨ 11264 */ 11265 var hlsSourceImport = leadComponentSite.hlsSourceImport || (leadComponentSite.hlsSourceImport = {}); 11266 Object.assign(hlsSourceImport, { 11267 init: async function (options) { 11268 const deeped = { 11269 cssDeep: [], 11270 jsDeep: [leadComponentSite.previewDomain + '/static/assets/blockEditor/script/hls.min.js'] 11271 } 11272 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11273 leadComponentSite.renderCallback(options) 11274 } 11275 }) 11276 11277 /** 11278 * motion.js 卿æä»¶ 11279 */ 11280 var motionSourceImport = leadComponentSite.motionSourceImport || (leadComponentSite.motionSourceImport = {}); 11281 Object.assign(motionSourceImport, { 11282 init: async function (options) { 11283 const deeped = { 11284 cssDeep: [], 11285 jsDeep: [leadComponentSite.previewDomain + '/static/assets/blockEditor/script/motion.min.js'] 11286 } 11287 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11288 leadComponentSite.renderCallback(options) 11289 } 11290 }) 11291 11292 /** 11293 * motion-helper.js 卿叮婿件 è¿åjqçsliderdownçææ 11294 */ 11295 var motionHelperSourceImport = leadComponentSite.motionHelperSourceImport || (leadComponentSite.motionHelperSourceImport = {}); 11296 Object.assign(motionHelperSourceImport, { 11297 init: async function (options) { 11298 const deeped = { 11299 cssDeep: [], 11300 jsDeep: [leadComponentSite.previewDomain + '/static/assets/blockEditor/script/motion_helper.js'] 11301 } 11302 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11303 leadComponentSite.renderCallback(options) 11304 } 11305 }) 11306 /** 11307 * turn.js å¾å翻页 11308 */ 11309 var turn = leadComponentSite.turn || (leadComponentSite.turn = {});
11310 Object.assign(turn, { 11311 init: async function (options) { 11312 const deeped = { 11313 cssDeep: [], 11314 jsDeep: [leadComponentSite.previewDomain + '/static/assets/blockEditor/script/turn.min.js'] 11315 } 11316 await leadComponentSite.jsDeepSuccess(deeped.jsDeep, deeped.cssDeep) 11317 leadComponentSite.renderCallback(options) 11318 } 11319 }) 11320})(); 11321(function(window, $, undefined){ 11322 // åå°å ¨å±å½åç©ºé´ 11323 var phoenixSite = window.phoenixSite || (window.phoenixSite = {}); 11324 var name = "formMailtoPopUpNew"; 11325 var form = phoenixSite[name] || (phoenixSite[name] = {}); 11326 form.version = "1.0.0"; 11327 // å¼¹çªæ¹æ³ 11328 $.extend(form, { 11329 popup: function(formType, formName, redirectUrl, pageId, pageType,editorPageId,trackingCodeId,formId,redirectPageId){ 11330 var curBackendPageId = phoenixSite.page._pId; 11331 var date = new Date(); 11332 var currentdate = date.getTime().toString(); 11333 var data = {}; 11334 if(!!!redirectUrl){ 11335 data = { 11336 'formType': formType, 11337 'formName': formName, 11338 'pageType': pageType, 11339 'editorPageId':editorPageId, 11340 'cur_backend_pageId': curBackendPageId, 11341 'currentdate': "t_" + currentdate 11342 } 11343 }else{ 11344 data = { 11345 'formType': formType, 11346 'formName': formName, 11347 'pageType': pageType, 11348 'editorPageId':editorPageId, 11349 'redirectUrl': redirectUrl, 11350 'cur_backend_pageId': pageId, 11351 'currentdate': "t_" + currentdate 11352 } 11353 } 11354 var _formAjaxUrl = '/phoenix/admin/form/inquiryHelper'; 11355 if(formId && redirectPageId){ 11356 data = { 11357 'formId':formId, 11358 'redirectPageId':redirectPageId, 11359 'cur_backend_pageId':!!!redirectUrl ? curBackendPageId : pageId 11360 } 11361 _formAjaxUrl = '/phoenix/admin/form/newEditorForm' 11362 } 11363 var _options = { 11364 url: _formAjaxUrl, 11365 type: 'get', 11366 data: data, 11367 success: function(xhr){ 11368 $('#form_mailto_popup_div').remove(); 11369 $('body').append(xhr); 11370 $("#form_mailto_popup_div").fadeIn(); 11371 //æ¨¡ææ·»å æé®æ¶é¤ææºç«¯å 为ç»å¯¹å®ä½ææ¯åºå®å®ä½è½¯é®ç弹起产ççå®ä½å½±å 11372 if($(".pop-inquire .pop-main .control-group.submitGroup").length>0 && $("#formsubmitClone").length == 0){ 11373 var submitGroupAdd = $(".pop-inquire .pop-main .control-group.submitGroup").clone(); 11374 $(".pop-inquire .pop-box").append(submitGroupAdd); 11375 if($(".pop-inquire .pop-box>.submitGroup").find("button").length == 1){ 11376 $(".pop-inquire .pop-box>.submitGroup").find("button").eq(0).attr("id","formsubmitClone"); 11377 } 11378 if($(".pop-inquire .pop-box>.submitGroup").find("button").length == 2){ 11379 $(".pop-inquire .pop-box>.submitGroup").find("button").eq(0).attr("id","formsubmitClone"); 11380 $(".pop-inquire .pop-box>.submitGroup").find("button").eq(1).attr("id","formresetClone") 11381 } 11382 } 11383 } 11384 } 11385 $.ajax(_options); 11386 //æé®ç¹å»å§æ 11387 //æäº¤ 11388 $(document).on("click","#formsubmitClone",function(ev){ 11389 if(trackingCodeId){ 11390 var trackingCode = window?.cyberPhoenixSite?.trackingCode?.[trackingCodeId] || '' 11391 if(trackingCode && trackingCode != ""){ 11392 try{ 11393 eval(trackingCode); 11394 }catch (e) { 11395 console.log(e) 11396 } 11397 } 11398 } 11399 $(".form_mailto_inquire_popup #formsubmit").click(); 11400 }) 11401 //éç½® 11402 $(document).on("click","#formresetClone",function(ev){ 11403 $(".form_mailto_inquire_popup #formreset").click(); 11404 }) 11405 } 11406 }) 11407})(window, jQuery); 11408 11409/** 11410 * å ¨å±å·¥å ·æ¹æ³ 11411 * resizeç嬿¹é åªå¨æå®æ¹åççªå£å¤§å°å æ§è¡ 11412 * é²æèæµ 11413 */ 11414(function(window, $, undefined){ 11415 window.debouncess = function(func, wait) { 11416 let timeout; 11417 11418 return function (...args) { 11419 const context = this; 11420 11421 // æ¸ é¤ä¹åç宿¶å¨ 11422 clearTimeout(timeout); 11423 11424 // 设置æ°ç宿¶å¨ 11425 timeout = setTimeout(() => {
11426 func.apply(context, args); 11427 }, wait); 11428 }; 11429 } 11430 11431 // window.resizeDebounce = function(func, offsetPx, originWidth) { 11432 // window.addEventListener("resize", function() { 11433 // let currentWidth = window.innerWidth; 11434 // if(Math.abs(currentWidth - originWidth) > offsetPx) { 11435 // func() 11436 // } 11437 // return currentWidth 11438 // }) 11439 // } 11440 11441 window.resizeDebounce = function(func, offsetPx, delay = 300) { 11442 // 䏿¬¡æ§è¡æ¶ç宽度 11443 let lastWidth = window.innerWidth; 11444 // 鲿宿¶å¨ 11445 let debounceTimer = null; 11446 11447 // å建resizeå¤ç彿° 11448 window._resizeHandler = function() { 11449 11450 // è·åå½åçªå£å®½åº¦ 11451 let currentWidth = window.innerWidth; 11452 // 计ç®ä¸ä¸æ¬¡æ§è¡æ¶å®½åº¦çå·®å¼ 11453 let diffFromLast = Math.abs(currentWidth - lastWidth); 11454 11455 // æ¸ é¤ä¹åç宿¶å¨ 11456 if (debounceTimer) { 11457 clearTimeout(debounceTimer); 11458 } 11459 11460 // åªæå½å®½åº¦ååè¶ è¿é弿¶æéè¦é²ææ§è¡ 11461 if (diffFromLast > offsetPx) { 11462 // è®¾ç½®é²æå®æ¶å¨ï¼å¨æå®å»¶è¿åæ§è¡ 11463 debounceTimer = setTimeout(() => { 11464 func('resize'); 11465 // æ´æ°ä¸æ¬¡æ§è¡æ¶ç宽度 11466 lastWidth = window.innerWidth; 11467 debounceTimer = null; 11468 }, delay); 11469 } 11470 }; 11471 11472 // æ·»å äºä»¶çå¬ 11473 window.addEventListener("resize", window._resizeHandler); 11474 } 11475 11476 window.MEDIA_WIDTH = { 11477 PAD: 1024, 11478 MOBILE: 767 11479 } 11480 11481 window.getCurrentDevice = function() { 11482 let currentWidth = window.innerWidth; 11483 if (currentWidth <= window.MEDIA_WIDTH.MOBILE) { 11484 return 'mobilePortrait'; 11485 } else if (currentWidth <= window.MEDIA_WIDTH.PAD) { 11486 return 'tablet'; 11487 } else { 11488 return 'desktop'; 11489 } 11490 } 11491 11492 11493})(window, jQuery);
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.