vendor: 35,938 bytes, lines 1-1150
1/*! 2 * jQuery JavaScript Library v1.8.3 3 * http://jquery.com/ 4 * 5 * Includes Sizzle.js 6 * http://sizzlejs.com/ 7 * 8 * Copyright 2012 jQuery Foundation and other contributors 9 * Released under the MIT license 10 * http://jquery.org/license 11 * 12 * Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time) 13 */ 14(function (window, undefined) 15{ 16 var 17 // A central reference to the root jQuery(document) 18 rootjQuery, 19 20 // The deferred used on DOM ready 21 readyList, 22 23 // Use the correct document accordingly with window argument (sandbox) 24 document = window.document, 25 location = window.location, 26 navigator = window.navigator, 27 28 // Map over jQuery in case of overwrite 29 _jQuery = window.jQuery, 30 31 // Map over the $ in case of overwrite 32 _$ = window.$, 33 34 // Save a reference to some core methods 35 core_push = Array.prototype.push, 36 core_slice = Array.prototype.slice, 37 core_indexOf = Array.prototype.indexOf, 38 core_toString = Object.prototype.toString, 39 core_hasOwn = Object.prototype.hasOwnProperty, 40 core_trim = String.prototype.trim, 41 42 // Define a local copy of jQuery 43 jQuery = function (selector, context) 44 { 45 // The jQuery object is actually just the init constructor 'enhanced' 46 return new jQuery.fn.init(selector, context, rootjQuery); 47 }, 48 49 // Used for matching numbers 50 core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, 51 52 // Used for detecting and trimming whitespace 53 core_rnotwhite = /\S/, 54 core_rspace = /\s+/, 55 56 // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) 57 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, 58 59 // A simple way to check for HTML strings 60 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 61 rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, 62 63 // Match a standalone tag 64 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, 65 66 // JSON RegExp 67 rvalidchars = /^[\],:{}\s]*$/, 68 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, 69 rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, 70 rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, 71 72 // Matches dashed string for camelizing 73 rmsPrefix = /^-ms-/, 74 rdashAlpha = /-([\da-z])/gi, 75 76 // Used by jQuery.camelCase as callback to replace() 77 fcamelCase = function (all, letter) 78 { 79 return ( letter + "" ).toUpperCase(); 80 }, 81 82 // The ready event handler and self cleanup method 83 DOMContentLoaded = function () 84 { 85 if (document.addEventListener) 86 { 87 document.removeEventListener("DOMContentLoaded", DOMContentLoaded, false); 88 jQuery.ready(); 89 } else if (document.readyState === "complete") 90 { 91 // we're here because readyState === "complete" in oldIE 92 // which is good enough for us to call the dom ready! 93 document.detachEvent("onreadystatechange", DOMContentLoaded); 94 jQuery.ready(); 95 } 96 }, 97 98 // [[Class]] -> type pairs 99 class2type = {}; 100 101 jQuery.fn = jQuery.prototype = { 102 constructor: jQuery, 103 init: function (selector, context, rootjQuery) 104 { 105 var match, elem, ret, doc; 106 107 // Handle $(""), $(null), $(undefined), $(false) 108 if (!selector) 109 { 110 return this; 111 } 112 113 // Handle $(DOMElement) 114 if (selector.nodeType) 115 { 116 this.context = this[0] = selector; 117 this.length = 1; 118 return this; 119 } 120 121 // Handle HTML strings 122 if (typeof selector === "string") 123 { 124 if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) 125 { 126 // Assume that strings that start and end with <> are HTML and skip the regex check 127 match = [ null, selector, null ]; 128 129 } else 130 { 131 match = rquickExpr.exec(selector); 132 } 133 134 // Match html or make sure no context is specified for #id 135 if (match && (match[1] || !context)) 136 { 137 138 // HANDLE: $(html) -> $(array) 139 if (match[1]) 140 { 141 context = context instanceof jQuery ? context[0] : context; 142 doc = ( context && context.nodeType ? context.ownerDocument || context : document ); 143 144 // scripts is true for back-compat 145 selector = jQuery.parseHTML(match[1], doc, true); 146 if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) 147 { 148 this.attr.call(selector, context, true); 149 } 150 151 return jQuery.merge(this, selector); 152 153 // HANDLE: $(#id) 154 } else 155 { 156 elem = document.getElementById(match[2]); 157 158 // Check parentNode to catch when Blackberry 4.6 returns 159 // nodes that are no longer in the document #6963 160 if (elem && elem.parentNode) 161 { 162 // Handle the case where IE and Opera return items 163 // by name instead of ID 164 if (elem.id !== match[2]) 165 { 166 return rootjQuery.find(selector); 167 } 168 169 // Otherwise, we inject the element directly into the jQuery object 170 this.length = 1; 171 this[0] = elem; 172 } 173 174 this.context = document; 175 this.selector = selector; 176 return this; 177 } 178 179 // HANDLE: $(expr, $(...)) 180 } else if (!context || context.jquery) 181 { 182 return ( context || rootjQuery ).find(selector); 183 184 // HANDLE: $(expr, context) 185 // (which is just equivalent to: $(context).find(expr) 186 } else 187 { 188 return this.constructor(context).find(selector); 189 } 190 191 // HANDLE: $(function) 192 // Shortcut for document ready 193 } else if (jQuery.isFunction(selector)) 194 { 195 return rootjQuery.ready(selector); 196 } 197 198 if (selector.selector !== undefined) 199 { 200 this.selector = selector.selector; 201 this.context = selector.context; 202 } 203 204 return jQuery.makeArray(selector, this); 205 }, 206 207 // Start with an empty selector 208 selector: "", 209 210 // The current version of jQuery being used 211 jquery: "1.8.3", 212 213 // The default length of a jQuery object is 0 214 length: 0, 215 216 // The number of elements contained in the matched element set 217 size: function () 218 { 219 return this.length; 220 }, 221 222 toArray: function () 223 { 224 return core_slice.call(this); 225 }, 226 227 // Get the Nth element in the matched element set OR 228 // Get the whole matched element set as a clean array 229 get: function (num) 230 { 231 return num == null ? 232 233 // Return a 'clean' array 234 this.toArray() : 235 236 // Return just the object 237 ( num < 0 ? this[ this.length + num ] : this[ num ] ); 238 }, 239 240 // Take an array of elements and push it onto the stack 241 // (returning the new matched element set) 242 pushStack: function (elems, name, selector) 243 { 244 245 // Build a new jQuery matched element set 246 var ret = jQuery.merge(this.constructor(), elems); 247 248 // Add the old object onto the stack (as a reference) 249 ret.prevObject = this; 250 251 ret.context = this.context; 252 253 if (name === "find") 254 { 255 ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; 256 } else if (name) 257 { 258 ret.selector = this.selector + "." + name + "(" + selector + ")"; 259 } 260 261 // Return the newly-formed element set 262 return ret; 263 }, 264 265 // Execute a callback for every element in the matched set. 266 // (You can seed the arguments with an array of args, but this is 267 // only used internally.) 268 each: function (callback, args) 269 { 270 return jQuery.each(this, callback, args); 271 }, 272 273 ready: function (fn) 274 { 275 // Add the callback 276 jQuery.ready.promise().done(fn); 277 278 return this; 279 }, 280 281 eq: function (i) 282 { 283 i = +i; 284 return i === -1 ? 285 this.slice(i) : 286 this.slice(i, i + 1); 287 }, 288 289 first: function () 290 { 291 return this.eq(0); 292 }, 293 294 last: function () 295 { 296 return this.eq(-1); 297 }, 298 299 slice: function () 300 { 301 return this.pushStack(core_slice.apply(this, arguments), 302 "slice", core_slice.call(arguments).join(",")); 303 }, 304 305 map: function (callback) 306 { 307 return this.pushStack(jQuery.map(this, function (elem, i) 308 { 309 return callback.call(elem, i, elem); 310 })); 311 }, 312 313 end: function () 314 { 315 return this.prevObject || this.constructor(null); 316 }, 317 318 // For internal use only. 319 // Behaves like an Array's method, not like a jQuery method. 320 push: core_push, 321 sort: [].sort, 322 splice: [].splice 323 }; 324 325// Give the init function the jQuery prototype for later instantiation 326 jQuery.fn.init.prototype = jQuery.fn; 327 328 jQuery.extend = jQuery.fn.extend = function () 329 { 330 var options, name, src, copy, copyIsArray, clone, 331 target = arguments[0] || {}, 332 i = 1, 333 length = arguments.length, 334 deep = false; 335 336 // Handle a deep copy situation 337 if (typeof target === "boolean") 338 { 339 deep = target; 340 target = arguments[1] || {}; 341 // skip the boolean and the target 342 i = 2; 343 } 344 345 // Handle case when target is a string or something (possible in deep copy) 346 if (typeof target !== "object" && !jQuery.isFunction(target)) 347 { 348 target = {}; 349 } 350 351 // extend jQuery itself if only one argument is passed 352 if (length === i) 353 { 354 target = this; 355 --i; 356 } 357 358 for (; i < length; i++) 359 { 360 // Only deal with non-null/undefined values 361 if ((options = arguments[ i ]) != null) 362 { 363 // Extend the base object 364 for (name in options) 365 { 366 src = target[ name ]; 367 copy = options[ name ]; 368 369 // Prevent never-ending loop 370 if (target === copy) 371 { 372 continue; 373 } 374 375 // Recurse if we're merging plain objects or arrays 376 if (deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) )) 377 { 378 if (copyIsArray) 379 { 380 copyIsArray = false; 381 clone = src && jQuery.isArray(src) ? src : []; 382 383 } else 384 { 385 clone = src && jQuery.isPlainObject(src) ? src : {}; 386 } 387 388 // Never move original objects, clone them 389 target[ name ] = jQuery.extend(deep, clone, copy); 390 391 // Don't bring in undefined values 392 } else if (copy !== undefined) 393 { 394 target[ name ] = copy; 395 } 396 } 397 } 398 } 399 400 // Return the modified object 401 return target; 402 }; 403 404 jQuery.extend({ 405 noConflict: function (deep) 406 { 407 if (window.$ === jQuery) 408 { 409 window.$ = _$; 410 } 411 412 if (deep && window.jQuery === jQuery) 413 { 414 window.jQuery = _jQuery; 415 } 416 417 return jQuery; 418 }, 419 420 // Is the DOM ready to be used? Set to true once it occurs. 421 isReady: false, 422 423 // A counter to track how many items to wait for before 424 // the ready event fires. See #6781 425 readyWait: 1, 426 427 // Hold (or release) the ready event 428 holdReady: function (hold) 429 { 430 if (hold) 431 { 432 jQuery.readyWait++; 433 } else 434 { 435 jQuery.ready(true); 436 } 437 }, 438 439 // Handle when the DOM is ready 440 ready: function (wait) 441 { 442 443 // Abort if there are pending holds or we're already ready 444 if (wait === true ? --jQuery.readyWait : jQuery.isReady) 445 { 446 return; 447 } 448 449 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 450 if (!document.body) 451 { 452 return setTimeout(jQuery.ready, 1); 453 } 454 455 // Remember that the DOM is ready 456 jQuery.isReady = true; 457 458 // If a normal DOM Ready event fired, decrement, and wait if need be 459 if (wait !== true && --jQuery.readyWait > 0) 460 { 461 return; 462 } 463 464 // If there are functions bound, to execute 465 readyList.resolveWith(document, [ jQuery ]); 466 467 // Trigger any bound ready events 468 if (jQuery.fn.trigger) 469 { 470 jQuery(document).trigger("ready").off("ready"); 471 } 472 }, 473 474 // See test/unit/core.js for details concerning isFunction. 475 // Since version 1.3, DOM methods and functions like alert 476 // aren't supported. They return false on IE (#2968). 477 isFunction: function (obj) 478 { 479 return jQuery.type(obj) === "function"; 480 }, 481 482 isArray: Array.isArray || function (obj) 483 { 484 return jQuery.type(obj) === "array"; 485 }, 486 487 isWindow: function (obj) 488 { 489 return obj != null && obj == obj.window; 490 }, 491 492 isNumeric: function (obj) 493 { 494 return !isNaN(parseFloat(obj)) && isFinite(obj); 495 }, 496 497 type: function (obj) 498 { 499 return obj == null ? 500 String(obj) : 501 class2type[ core_toString.call(obj) ] || "object"; 502 }, 503 504 isPlainObject: function (obj) 505 { 506 // Must be an Object. 507 // Because of IE, we also have to check the presence of the constructor property. 508 // Make sure that DOM nodes and window objects don't pass through, as well 509 if (!obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) 510 { 511 return false; 512 } 513 514 try 515 { 516 // Not own constructor property must be Object 517 if (obj.constructor && !core_hasOwn.call(obj, "constructor") && !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) 518 { 519 return false; 520 } 521 } catch (e) 522 { 523 // IE8,9 Will throw exceptions on certain host objects #9897 524 return false; 525 } 526 527 // Own properties are enumerated firstly, so to speed up, 528 // if last one is own, then all properties are own. 529 530 var key; 531 for (key in obj) 532 { 533 } 534 535 return key === undefined || core_hasOwn.call(obj, key); 536 }, 537 538 isEmptyObject: function (obj) 539 { 540 var name; 541 for (name in obj) 542 { 543 return false; 544 } 545 return true; 546 }, 547 548 error: function (msg) 549 { 550 throw new Error(msg); 551 }, 552 553 // data: string of html 554 // context (optional): If specified, the fragment will be created in this context, defaults to document 555 // scripts (optional): If true, will include scripts passed in the html string 556 parseHTML: function (data, context, scripts) 557 { 558 var parsed; 559 if (!data || typeof data !== "string") 560 { 561 return null; 562 } 563 if (typeof context === "boolean") 564 { 565 scripts = context; 566 context = 0; 567 } 568 context = context || document; 569 570 // Single tag 571 if ((parsed = rsingleTag.exec(data))) 572 { 573 return [ context.createElement(parsed[1]) ]; 574 } 575 576 parsed = jQuery.buildFragment([ data ], context, scripts ? null : []); 577 return jQuery.merge([], 578 (parsed.cacheable ? jQuery.clone(parsed.fragment) : parsed.fragment).childNodes); 579 }, 580 581 parseJSON: function (data) 582 { 583 if (!data || typeof data !== "string") 584 { 585 return null; 586 } 587 588 // Make sure leading/trailing whitespace is removed (IE can't handle it) 589 data = jQuery.trim(data); 590 591 // Attempt to parse using the native JSON parser first 592 if (window.JSON && window.JSON.parse) 593 { 594 return window.JSON.parse(data); 595 } 596 597 // Make sure the incoming data is actual JSON 598 // Logic borrowed from http://json.org/json2.js 599 if (rvalidchars.test(data.replace(rvalidescape, "@") 600 .replace(rvalidtokens, "]") 601 .replace(rvalidbraces, ""))) 602 { 603 604 return ( new Function("return " + data) )(); 605 606 } 607 jQuery.error("Invalid JSON: " + data); 608 }, 609 610 // Cross-browser xml parsing 611 parseXML: function (data) 612 { 613 var xml, tmp; 614 if (!data || typeof data !== "string") 615 { 616 return null; 617 } 618 try 619 { 620 if (window.DOMParser) 621 { // Standard 622 tmp = new DOMParser(); 623 xml = tmp.parseFromString(data, "text/xml"); 624 } else 625 { // IE 626 xml = new ActiveXObject("Microsoft.XMLDOM"); 627 xml.async = "false"; 628 xml.loadXML(data); 629 } 630 } catch (e) 631 { 632 xml = undefined; 633 } 634 if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length) 635 { 636 jQuery.error("Invalid XML: " + data); 637 } 638 return xml; 639 }, 640 641 noop: function () 642 { 643 }, 644 645 // Evaluates a script in a global context 646 // Workarounds based on findings by Jim Driscoll 647 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context 648 globalEval: function (data) 649 { 650 if (data && core_rnotwhite.test(data)) 651 { 652 // We use execScript on Internet Explorer 653 // We use an anonymous function so that context is window 654 // rather than jQuery in Firefox 655 ( window.execScript || function (data) 656 { 657 window[ "eval" ].call(window, data); 658 } )(data); 659 } 660 }, 661 662 // Convert dashed to camelCase; used by the css and data modules 663 // Microsoft forgot to hump their vendor prefix (#9572) 664 camelCase: function (string) 665 { 666 return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase); 667 }, 668 669 nodeName: function (elem, name) 670 { 671 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 672 }, 673 674 // args is for internal usage only 675 each: function (obj, callback, args) 676 { 677 var name, 678 i = 0, 679 length = obj.length, 680 isObj = length === undefined || jQuery.isFunction(obj); 681 682 if (args) 683 { 684 if (isObj) 685 { 686 for (name in obj) 687 { 688 if (callback.apply(obj[ name ], args) === false) 689 { 690 break; 691 } 692 } 693 } else 694 { 695 for (; i < length;) 696 { 697 if (callback.apply(obj[ i++ ], args) === false) 698 { 699 break; 700 } 701 } 702 } 703 704 // A special, fast, case for the most common use of each 705 } else 706 { 707 if (isObj) 708 { 709 for (name in obj) 710 { 711 if (callback.call(obj[ name ], name, obj[ name ]) === false) 712 { 713 break; 714 } 715 } 716 } else 717 { 718 for (; i < length;) 719 { 720 if (callback.call(obj[ i ], i, obj[ i++ ]) === false) 721 { 722 break; 723 } 724 } 725 } 726 } 727 728 return obj; 729 }, 730 731 // Use native String.trim function wherever possible 732 trim: core_trim && !core_trim.call("\uFEFF\xA0") ? 733 function (text) 734 { 735 return text == null ? 736 "" : 737 core_trim.call(text); 738 } : 739 740 // Otherwise use our own trimming functionality 741 function (text) 742 { 743 return text == null ? 744 "" : 745 ( text + "" ).replace(rtrim, ""); 746 }, 747 748 // results is for internal usage only 749 makeArray: function (arr, results) 750 { 751 var type, 752 ret = results || []; 753 754 if (arr != null) 755 { 756 // The window, strings (and functions) also have 'length' 757 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 758 type = jQuery.type(arr); 759 760 if (arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow(arr)) 761 { 762 core_push.call(ret, arr); 763 } else 764 { 765 jQuery.merge(ret, arr); 766 } 767 } 768 769 return ret; 770 }, 771 772 inArray: function (elem, arr, i) 773 { 774 var len; 775 776 if (arr) 777 { 778 if (core_indexOf) 779 { 780 return core_indexOf.call(arr, elem, i); 781 } 782 783 len = arr.length; 784 i = i ? i < 0 ? Math.max(0, len + i) : i : 0; 785 786 for (; i < len; i++) 787 { 788 // Skip accessing in sparse arrays 789 if (i in arr && arr[ i ] === elem) 790 { 791 return i; 792 } 793 } 794 } 795 796 return -1; 797 }, 798 799 merge: function (first, second) 800 { 801 var l = second.length, 802 i = first.length, 803 j = 0; 804 805 if (typeof l === "number") 806 { 807 for (; j < l; j++) 808 { 809 first[ i++ ] = second[ j ]; 810 } 811 812 } else 813 { 814 while (second[j] !== undefined) 815 { 816 first[ i++ ] = second[ j++ ]; 817 } 818 } 819 820 first.length = i; 821 822 return first; 823 }, 824 825 grep: function (elems, callback, inv) 826 { 827 var retVal, 828 ret = [], 829 i = 0, 830 length = elems.length; 831 inv = !!inv; 832 833 // Go through the array, only saving the items 834 // that pass the validator function 835 for (; i < length; i++) 836 { 837 retVal = !!callback(elems[ i ], i); 838 if (inv !== retVal) 839 { 840 ret.push(elems[ i ]); 841 } 842 } 843 844 return ret; 845 }, 846 847 // arg is for internal usage only 848 map: function (elems, callback, arg) 849 { 850 var value, key, 851 ret = [], 852 i = 0, 853 length = elems.length, 854 // jquery objects are treated as arrays 855 isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length - 1 ] ) || length === 0 || jQuery.isArray(elems) ); 856 857 // Go through the array, translating each of the items to their 858 if (isArray) 859 { 860 for (; i < length; i++) 861 { 862 value = callback(elems[ i ], i, arg); 863 864 if (value != null) 865 { 866 ret[ ret.length ] = value; 867 } 868 } 869 870 // Go through every key on the object, 871 } else 872 { 873 for (key in elems) 874 { 875 value = callback(elems[ key ], key, arg); 876 877 if (value != null) 878 { 879 ret[ ret.length ] = value; 880 } 881 } 882 } 883 884 // Flatten any nested arrays 885 return ret.concat.apply([], ret); 886 }, 887 888 // A global GUID counter for objects 889 guid: 1, 890 891 // Bind a function to a context, optionally partially applying any 892 // arguments. 893 proxy: function (fn, context) 894 { 895 var tmp, args, proxy; 896 897 if (typeof context === "string") 898 { 899 tmp = fn[ context ]; 900 context = fn; 901 fn = tmp; 902 } 903 904 // Quick check to determine if target is callable, in the spec 905 // this throws a TypeError, but we will just return undefined. 906 if (!jQuery.isFunction(fn)) 907 { 908 return undefined; 909 } 910 911 // Simulated bind 912 args = core_slice.call(arguments, 2); 913 proxy = function () 914 { 915 return fn.apply(context, args.concat(core_slice.call(arguments))); 916 }; 917 918 // Set the guid of unique handler to the same of original handler, so it can be removed 919 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 920 921 return proxy; 922 }, 923 924 // Multifunctional method to get and set values of a collection 925 // The value/s can optionally be executed if it's a function 926 access: function (elems, fn, key, value, chainable, emptyGet, pass) 927 { 928 var exec, 929 bulk = key == null, 930 i = 0, 931 length = elems.length; 932 933 // Sets many values 934 if (key && typeof key === "object") 935 { 936 for (i in key) 937 { 938 jQuery.access(elems, fn, i, key[i], 1, emptyGet, value); 939 } 940 chainable = 1; 941 942 // Sets one value 943 } else if (value !== undefined) 944 { 945 // Optionally, function values get executed if exec is true 946 exec = pass === undefined && jQuery.isFunction(value); 947 948 if (bulk) 949 { 950 // Bulk operations only iterate when executing function values 951 if (exec) 952 { 953 exec = fn; 954 fn = function (elem, key, value) 955 { 956 return exec.call(jQuery(elem), value); 957 }; 958 959 // Otherwise they run against the entire set 960 } else 961 { 962 fn.call(elems, value); 963 fn = null; 964 } 965 } 966 967 if (fn) 968 { 969 for (; i < length; i++) 970 { 971 fn(elems[i], key, exec ? value.call(elems[i], i, fn(elems[i], key)) : value, pass); 972 } 973 } 974 975 chainable = 1; 976 } 977 978 return chainable ? 979 elems : 980 981 // Gets 982 bulk ? 983 fn.call(elems) : 984 length ? fn(elems[0], key) : emptyGet; 985 }, 986 987 now: function () 988 { 989 return ( new Date() ).getTime(); 990 } 991 }); 992 993 jQuery.ready.promise = function (obj) 994 { 995 if (!readyList) 996 { 997 998 readyList = jQuery.Deferred(); 999 1000 // Catch cases where $(document).ready() is called after the browser event has already occurred. 1001 // we once tried to use readyState "interactive" here, but it caused issues like the one 1002 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 1003 if (document.readyState === "complete") 1004 { 1005 // Handle it asynchronously to allow scripts the opportunity to delay ready 1006 setTimeout(jQuery.ready, 1); 1007 1008 // Standards-based browsers support DOMContentLoaded 1009 } else if (document.addEventListener) 1010 { 1011 // Use the handy event callback 1012 document.addEventListener("DOMContentLoaded", DOMContentLoaded, false); 1013 1014 // A fallback to window.onload, that will always work 1015 window.addEventListener("load", jQuery.ready, false); 1016 1017 // If IE event model is used 1018 } else 1019 { 1020 // Ensure firing before onload, maybe late but safe also for iframes 1021 document.attachEvent("onreadystatechange", DOMContentLoaded); 1022 1023 // A fallback to window.onload, that will always work 1024 window.attachEvent("onload", jQuery.ready); 1025 1026 // If IE and not a frame 1027 // continually check to see if the document is ready 1028 var top = false; 1029 1030 try 1031 { 1032 top = window.frameElement == null && document.documentElement; 1033 } catch (e) 1034 { 1035 } 1036 1037 if (top && top.doScroll) 1038 { 1039 (function doScrollCheck() 1040 { 1041 if (!jQuery.isReady) 1042 { 1043 1044 try 1045 { 1046 // Use the trick by Diego Perini 1047 // http://javascript.nwbox.com/IEContentLoaded/ 1048 top.doScroll("left"); 1049 } catch (e) 1050 { 1051 return setTimeout(doScrollCheck, 50); 1052 } 1053 1054 // and execute any waiting functions 1055 jQuery.ready(); 1056 } 1057 })(); 1058 } 1059 } 1060 } 1061 return readyList.promise(obj); 1062 }; 1063 1064// Populate the class2type map 1065 jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function (i, name) 1066 { 1067 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 1068 }); 1069 1070// All jQuery objects should point back to these 1071 rootjQuery = jQuery(document); 1072// String to Object options format cache 1073 var optionsCache = {}; 1074 1075// Convert String-formatted options into Object-formatted ones and store in cache 1076 function createOptions(options) 1077 { 1078 var object = optionsCache[ options ] = {}; 1079 jQuery.each(options.split(core_rspace), function (_, flag) 1080 { 1081 object[ flag ] = true; 1082 }); 1083 return object; 1084 } 1085 1086 /* 1087 * Create a callback list using the following parameters: 1088 * 1089 * options: an optional list of space-separated options that will change how 1090 * the callback list behaves or a more traditional option object 1091 * 1092 * By default a callback list will act like an event callback list and can be 1093 * "fired" multiple times. 1094 * 1095 * Possible options: 1096 * 1097 * once: will ensure the callback list can only be fired once (like a Deferred) 1098 * 1099 * memory: will keep track of previous values and will call any callback added 1100 * after the list has been fired right away with the latest "memorized" 1101 * values (like a Deferred) 1102 * 1103 * unique: will ensure a callback can only be added once (no duplicate in the list) 1104 * 1105 * stopOnFalse: interrupt callings when a callback returns false 1106 * 1107 */ 1108 jQuery.Callbacks = function (options) 1109 { 1110 1111 // Convert options from String-formatted to Object-formatted if needed 1112 // (we check in cache first) 1113 options = typeof options === "string" ? 1114 ( optionsCache[ options ] || createOptions(options) ) : 1115 jQuery.extend({}, options); 1116 1117 var // Last fire value (for non-forgettable lists) 1118 memory, 1119 // Flag to know if list was already fired 1120 fired, 1121 // Flag to know if list is currently firing 1122 firing, 1123 // First callback to fire (used internally by add and fireWith) 1124 firingStart, 1125 // End of the loop when firing 1126 firingLength, 1127 // Index of currently firing callback (modified by remove if needed) 1128 firingIndex, 1129 // Actual callback list 1130 list = [], 1131 // Stack of fire calls for repeatable lists 1132 stack = !options.once && [], 1133 // Fire callbacks 1134 fire = function (data) 1135 { 1136 memory = options.memory && data; 1137 fired = true; 1138 firingIndex = firingStart || 0; 1139 firingStart = 0; 1140 firingLength = list.length; 1141 firing = true; 1142 for (; list && firingIndex < firingLength; firingIndex++) 1143 { 1144 if (list[ firingIndex ].apply(data[ 0 ], data[ 1 ]) === false && options.stopOnFalse) 1145 { 1146 memory = false; // To prevent further calls using add 1147 break; 1148 } 1149 } 1150 firing = false;
vendor: 1,907 bytes, lines 1151-1199
1151 if (list) 1152 { 1153 if (stack) 1154 { 1155 if (stack.length) 1156 { 1157 fire(stack.shift()); 1158 } 1159 } else if (memory) 1160 { 1161 list = []; 1162 } else 1163 { 1164 self.disable(); 1165 } 1166 } 1167 }, 1168 // Actual Callbacks object 1169 self = { 1170 // Add a callback or a collection of callbacks to the list 1171 add: function () 1172 { 1173 if (list) 1174 { 1175 // First, we save the current length 1176 var start = list.length; 1177 (function add(args) 1178 { 1179 jQuery.each(args, function (_, arg) 1180 { 1181 var type = jQuery.type(arg); 1182 if (type === "function") 1183 { 1184 if (!options.unique || !self.has(arg)) 1185 { 1186 list.push(arg); 1187 } 1188 } else if (arg && arg.length && type !== "string") 1189 { 1190 // Inspect recursively 1191 add(arg); 1192 } 1193 }); 1194 })(arguments); 1195 // Do we need to add the callbacks to the 1196 // current firing batch? 1197 if (firing) 1198 { 1199 firingLength = list.length;
vendor: 350,929 bytes, lines 1200-11160
1200 // With memory, if we're not firing then 1201 // we should call right away 1202 } else if (memory) 1203 { 1204 firingStart = start; 1205 fire(memory); 1206 } 1207 } 1208 return this; 1209 }, 1210 // Remove a callback from the list 1211 remove: function () 1212 { 1213 if (list) 1214 { 1215 jQuery.each(arguments, function (_, arg) 1216 { 1217 var index; 1218 while (( index = jQuery.inArray(arg, list, index) ) > -1) 1219 { 1220 list.splice(index, 1); 1221 // Handle firing indexes 1222 if (firing) 1223 { 1224 if (index <= firingLength) 1225 { 1226 firingLength--; 1227 } 1228 if (index <= firingIndex) 1229 { 1230 firingIndex--; 1231 } 1232 } 1233 } 1234 }); 1235 } 1236 return this; 1237 }, 1238 // Control if a given callback is in the list 1239 has: function (fn) 1240 { 1241 return jQuery.inArray(fn, list) > -1; 1242 }, 1243 // Remove all callbacks from the list 1244 empty: function () 1245 { 1246 list = []; 1247 return this; 1248 }, 1249 // Have the list do nothing anymore 1250 disable: function () 1251 { 1252 list = stack = memory = undefined; 1253 return this; 1254 }, 1255 // Is it disabled? 1256 disabled: function () 1257 { 1258 return !list; 1259 }, 1260 // Lock the list in its current state 1261 lock: function () 1262 { 1263 stack = undefined; 1264 if (!memory) 1265 { 1266 self.disable(); 1267 } 1268 return this; 1269 }, 1270 // Is it locked? 1271 locked: function () 1272 { 1273 return !stack; 1274 }, 1275 // Call all callbacks with the given context and arguments 1276 fireWith: function (context, args) 1277 { 1278 args = args || []; 1279 args = [ context, args.slice ? args.slice() : args ]; 1280 if (list && ( !fired || stack )) 1281 { 1282 if (firing) 1283 { 1284 stack.push(args); 1285 } else 1286 { 1287 fire(args); 1288 } 1289 } 1290 return this; 1291 }, 1292 // Call all the callbacks with the given arguments 1293 fire: function () 1294 { 1295 self.fireWith(this, arguments); 1296 return this; 1297 }, 1298 // To know if the callbacks have already been called at least once 1299 fired: function () 1300 { 1301 return !!fired; 1302 } 1303 }; 1304 1305 return self; 1306 }; 1307 jQuery.extend({ 1308 1309 Deferred: function (func) 1310 { 1311 var tuples = [ 1312 // action, add listener, listener list, final state 1313 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], 1314 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], 1315 [ "notify", "progress", jQuery.Callbacks("memory") ] 1316 ], 1317 state = "pending", 1318 promise = { 1319 state: function () 1320 { 1321 return state; 1322 }, 1323 always: function () 1324 { 1325 deferred.done(arguments).fail(arguments); 1326 return this; 1327 }, 1328 then: function (/* fnDone, fnFail, fnProgress */) 1329 { 1330 var fns = arguments; 1331 return jQuery.Deferred(function (newDefer) 1332 { 1333 jQuery.each(tuples, function (i, tuple) 1334 { 1335 var action = tuple[ 0 ], 1336 fn = fns[ i ]; 1337 // deferred[ done | fail | progress ] for forwarding actions to newDefer 1338 deferred[ tuple[1] ](jQuery.isFunction(fn) ? 1339 function () 1340 { 1341 var returned = fn.apply(this, arguments); 1342 if (returned && jQuery.isFunction(returned.promise)) 1343 { 1344 returned.promise() 1345 .done(newDefer.resolve) 1346 .fail(newDefer.reject) 1347 .progress(newDefer.notify); 1348 } else 1349 { 1350 newDefer[ action + "With" ](this === deferred ? newDefer : this, [ returned ]); 1351 } 1352 } : 1353 newDefer[ action ] 1354 ); 1355 }); 1356 fns = null; 1357 }).promise(); 1358 }, 1359 // Get a promise for this deferred 1360 // If obj is provided, the promise aspect is added to the object 1361 promise: function (obj) 1362 { 1363 return obj != null ? jQuery.extend(obj, promise) : promise; 1364 } 1365 }, 1366 deferred = {}; 1367 1368 // Keep pipe for back-compat 1369 promise.pipe = promise.then; 1370 1371 // Add list-specific methods 1372 jQuery.each(tuples, function (i, tuple) 1373 { 1374 var list = tuple[ 2 ], 1375 stateString = tuple[ 3 ]; 1376 1377 // promise[ done | fail | progress ] = list.add 1378 promise[ tuple[1] ] = list.add; 1379 1380 // Handle state 1381 if (stateString) 1382 { 1383 list.add(function () 1384 { 1385 // state = [ resolved | rejected ] 1386 state = stateString; 1387 1388 // [ reject_list | resolve_list ].disable; progress_list.lock 1389 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock); 1390 } 1391 1392 // deferred[ resolve | reject | notify ] = list.fire 1393 deferred[ tuple[0] ] = list.fire; 1394 deferred[ tuple[0] + "With" ] = list.fireWith; 1395 }); 1396 1397 // Make the deferred a promise 1398 promise.promise(deferred); 1399 1400 // Call given func if any 1401 if (func) 1402 { 1403 func.call(deferred, deferred); 1404 } 1405 1406 // All done! 1407 return deferred; 1408 }, 1409 1410 // Deferred helper 1411 when: function (subordinate /* , ..., subordinateN */) 1412 { 1413 var i = 0, 1414 resolveValues = core_slice.call(arguments), 1415 length = resolveValues.length, 1416 1417 // the count of uncompleted subordinates 1418 remaining = length !== 1 || ( subordinate && jQuery.isFunction(subordinate.promise) ) ? length : 0, 1419 1420 // the master Deferred. If resolveValues consist of only a single Deferred, just use that. 1421 deferred = remaining === 1 ? subordinate : jQuery.Deferred(), 1422 1423 // Update function for both resolve and progress values 1424 updateFunc = function (i, contexts, values) 1425 { 1426 return function (value) 1427 { 1428 contexts[ i ] = this; 1429 values[ i ] = arguments.length > 1 ? core_slice.call(arguments) : value; 1430 if (values === progressValues) 1431 { 1432 deferred.notifyWith(contexts, values); 1433 } else if (!( --remaining )) 1434 { 1435 deferred.resolveWith(contexts, values); 1436 } 1437 }; 1438 }, 1439 1440 progressValues, progressContexts, resolveContexts; 1441 1442 // add listeners to Deferred subordinates; treat others as resolved 1443 if (length > 1) 1444 { 1445 progressValues = new Array(length); 1446 progressContexts = new Array(length); 1447 resolveContexts = new Array(length); 1448 for (; i < length; i++) 1449 { 1450 if (resolveValues[ i ] && jQuery.isFunction(resolveValues[ i ].promise)) 1451 { 1452 resolveValues[ i ].promise() 1453 .done(updateFunc(i, resolveContexts, resolveValues)) 1454 .fail(deferred.reject) 1455 .progress(updateFunc(i, progressContexts, progressValues)); 1456 } else 1457 { 1458 --remaining; 1459 } 1460 } 1461 } 1462 1463 // if we're not waiting on anything, resolve the master 1464 if (!remaining) 1465 { 1466 deferred.resolveWith(resolveContexts, resolveValues); 1467 } 1468 1469 return deferred.promise(); 1470 } 1471 }); 1472 jQuery.support = (function () 1473 { 1474 1475 var support, 1476 all, 1477 a, 1478 select, 1479 opt, 1480 input, 1481 fragment, 1482 eventName, 1483 i, 1484 isSupported, 1485 clickFn, 1486 div = document.createElement("div"); 1487 1488 // Setup 1489 div.setAttribute("className", "t"); 1490 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; 1491 1492 // Support tests won't run in some limited or non-browser environments 1493 all = div.getElementsByTagName("*"); 1494 a = div.getElementsByTagName("a")[ 0 ]; 1495 if (!all || !a || !all.length) 1496 { 1497 return {}; 1498 } 1499 1500 // First batch of tests 1501 select = document.createElement("select"); 1502 opt = select.appendChild(document.createElement("option")); 1503 input = div.getElementsByTagName("input")[ 0 ]; 1504 1505 a.style.cssText = "top:1px;float:left;opacity:.5"; 1506 support = { 1507 // IE strips leading whitespace when .innerHTML is used 1508 leadingWhitespace: ( div.firstChild.nodeType === 3 ), 1509 1510 // Make sure that tbody elements aren't automatically inserted 1511 // IE will insert them into empty tables 1512 tbody: !div.getElementsByTagName("tbody").length, 1513 1514 // Make sure that link elements get serialized correctly by innerHTML 1515 // This requires a wrapper element in IE 1516 htmlSerialize: !!div.getElementsByTagName("link").length, 1517 1518 // Get the style information from getAttribute 1519 // (IE uses .cssText instead) 1520 style: /top/.test(a.getAttribute("style")), 1521 1522 // Make sure that URLs aren't manipulated 1523 // (IE normalizes it by default) 1524 hrefNormalized: ( a.getAttribute("href") === "/a" ), 1525 1526 // Make sure that element opacity exists 1527 // (IE uses filter instead) 1528 // Use a regex to work around a WebKit issue. See #5145 1529 opacity: /^0.5/.test(a.style.opacity), 1530 1531 // Verify style float existence 1532 // (IE uses styleFloat instead of cssFloat) 1533 cssFloat: !!a.style.cssFloat, 1534 1535 // Make sure that if no value is specified for a checkbox 1536 // that it defaults to "on". 1537 // (WebKit defaults to "" instead) 1538 checkOn: ( input.value === "on" ), 1539 1540 // Make sure that a selected-by-default option has a working selected property. 1541 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) 1542 optSelected: opt.selected, 1543 1544 // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) 1545 getSetAttribute: div.className !== "t", 1546 1547 // Tests for enctype support on a form (#6743) 1548 enctype: !!document.createElement("form").enctype, 1549 1550 // Makes sure cloning an html5 element does not cause problems 1551 // Where outerHTML is undefined, this still works 1552 html5Clone: document.createElement("nav").cloneNode(true).outerHTML !== "<:nav></:nav>", 1553 1554 // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode 1555 boxModel: ( document.compatMode === "CSS1Compat" ), 1556 1557 // Will be defined later 1558 submitBubbles: true, 1559 changeBubbles: true, 1560 focusinBubbles: false, 1561 deleteExpando: true, 1562 noCloneEvent: true, 1563 inlineBlockNeedsLayout: false, 1564 shrinkWrapBlocks: false, 1565 reliableMarginRight: true, 1566 boxSizingReliable: true, 1567 pixelPosition: false 1568 }; 1569 1570 // Make sure checked status is properly cloned 1571 input.checked = true; 1572 support.noCloneChecked = input.cloneNode(true).checked; 1573 1574 // Make sure that the options inside disabled selects aren't marked as disabled 1575 // (WebKit marks them as disabled) 1576 select.disabled = true; 1577 support.optDisabled = !opt.disabled; 1578 1579 // Test to see if it's possible to delete an expando from an element 1580 // Fails in Internet Explorer 1581 try 1582 { 1583 delete div.test; 1584 } catch (e) 1585 { 1586 support.deleteExpando = false; 1587 } 1588 1589 if (!div.addEventListener && div.attachEvent && div.fireEvent) 1590 { 1591 div.attachEvent("onclick", clickFn = function () 1592 { 1593 // Cloning a node shouldn't copy over any 1594 // bound event handlers (IE does this) 1595 support.noCloneEvent = false; 1596 }); 1597 div.cloneNode(true).fireEvent("onclick"); 1598 div.detachEvent("onclick", clickFn); 1599 } 1600 1601 // Check if a radio maintains its value 1602 // after being appended to the DOM 1603 input = document.createElement("input"); 1604 input.value = "t"; 1605 input.setAttribute("type", "radio"); 1606 support.radioValue = input.value === "t"; 1607 1608 input.setAttribute("checked", "checked"); 1609 1610 // #11217 - WebKit loses check when the name is after the checked attribute 1611 input.setAttribute("name", "t"); 1612 1613 div.appendChild(input); 1614 fragment = document.createDocumentFragment(); 1615 fragment.appendChild(div.lastChild); 1616 1617 // WebKit doesn't clone checked state correctly in fragments 1618 support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; 1619 1620 // Check if a disconnected checkbox will retain its checked 1621 // value of true after appended to the DOM (IE6/7) 1622 support.appendChecked = input.checked; 1623 1624 fragment.removeChild(input); 1625 fragment.appendChild(div); 1626 1627 // Technique from Juriy Zaytsev 1628 // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ 1629 // We only care about the case where non-standard event systems 1630 // are used, namely in IE. Short-circuiting here helps us to 1631 // avoid an eval call (in setAttribute) which can cause CSP 1632 // to go haywire. See: https://developer.mozilla.org/en/Security/CSP 1633 if (div.attachEvent) 1634 { 1635 for (i in { 1636 submit: true, 1637 change: true, 1638 focusin: true 1639 }) 1640 { 1641 eventName = "on" + i; 1642 isSupported = ( eventName in div ); 1643 if (!isSupported) 1644 { 1645 div.setAttribute(eventName, "return;"); 1646 isSupported = ( typeof div[ eventName ] === "function" ); 1647 } 1648 support[ i + "Bubbles" ] = isSupported; 1649 } 1650 } 1651 1652 // Run tests that need a body at doc ready 1653 jQuery(function () 1654 { 1655 var container, div, tds, marginDiv, 1656 divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;", 1657 body = document.getElementsByTagName("body")[0]; 1658 1659 if (!body) 1660 { 1661 // Return for frameset docs that don't have a body 1662 return; 1663 } 1664 1665 container = document.createElement("div"); 1666 container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px"; 1667 body.insertBefore(container, body.firstChild); 1668 1669 // Construct the test element 1670 div = document.createElement("div"); 1671 container.appendChild(div); 1672 1673 // Check if table cells still have offsetWidth/Height when they are set 1674 // to display:none and there are still other visible table cells in a 1675 // table row; if so, offsetWidth/Height are not reliable for use when 1676 // determining if an element has been hidden directly using 1677 // display:none (it is still safe to use offsets if a parent element is 1678 // hidden; don safety goggles and see bug #4512 for more information). 1679 // (only IE 8 fails this test) 1680 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; 1681 tds = div.getElementsByTagName("td"); 1682 tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; 1683 isSupported = ( tds[ 0 ].offsetHeight === 0 ); 1684 1685 tds[ 0 ].style.display = ""; 1686 tds[ 1 ].style.display = "none"; 1687 1688 // Check if empty table cells still have offsetWidth/Height 1689 // (IE <= 8 fail this test) 1690 support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); 1691 1692 // Check box-sizing and margin behavior 1693 div.innerHTML = ""; 1694 div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; 1695 support.boxSizing = ( div.offsetWidth === 4 ); 1696 support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); 1697 1698 // NOTE: To any future maintainer, we've window.getComputedStyle 1699 // because jsdom on node.js will break without it. 1700 if (window.getComputedStyle) 1701 { 1702 support.pixelPosition = ( window.getComputedStyle(div, null) || {} ).top !== "1%"; 1703 support.boxSizingReliable = ( window.getComputedStyle(div, null) || { width: "4px" } ).width === "4px"; 1704 1705 // Check if div with explicit width and no margin-right incorrectly 1706 // gets computed margin-right based on width of container. For more 1707 // info see bug #3333 1708 // Fails in WebKit before Feb 2011 nightlies 1709 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 1710 marginDiv = document.createElement("div"); 1711 marginDiv.style.cssText = div.style.cssText = divReset; 1712 marginDiv.style.marginRight = marginDiv.style.width = "0"; 1713 div.style.width = "1px"; 1714 div.appendChild(marginDiv); 1715 support.reliableMarginRight = !parseFloat(( window.getComputedStyle(marginDiv, null) || {} ).marginRight); 1716 } 1717 1718 if (typeof div.style.zoom !== "undefined") 1719 { 1720 // Check if natively block-level elements act like inline-block 1721 // elements when setting their display to 'inline' and giving 1722 // them layout 1723 // (IE < 8 does this) 1724 div.innerHTML = ""; 1725 div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; 1726 support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); 1727 1728 // Check if elements with layout shrink-wrap their children 1729 // (IE 6 does this) 1730 div.style.display = "block"; 1731 div.style.overflow = "visible"; 1732 div.innerHTML = "<div></div>"; 1733 div.firstChild.style.width = "5px"; 1734 support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); 1735 1736 container.style.zoom = 1; 1737 } 1738 1739 // Null elements to avoid leaks in IE 1740 body.removeChild(container); 1741 container = div = tds = marginDiv = null; 1742 }); 1743 1744 // Null elements to avoid leaks in IE 1745 fragment.removeChild(div); 1746 all = a = select = opt = input = fragment = div = null; 1747 1748 return support; 1749 })(); 1750 var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, 1751 rmultiDash = /([A-Z])/g; 1752 1753 jQuery.extend({ 1754 cache: {}, 1755 1756 deletedIds: [], 1757 1758 // Remove at next major release (1.9/2.0) 1759 uuid: 0, 1760 1761 // Unique for each copy of jQuery on the page 1762 // Non-digits removed to match rinlinejQuery 1763 expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace(/\D/g, ""), 1764 1765 // The following elements throw uncatchable exceptions if you 1766 // attempt to add expando properties to them. 1767 noData: { 1768 "embed": true, 1769 // Ban all objects except for Flash (which handle expandos) 1770 "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", 1771 "applet": true 1772 }, 1773 1774 hasData: function (elem) 1775 { 1776 elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; 1777 return !!elem && !isEmptyDataObject(elem); 1778 }, 1779 1780 data: function (elem, name, data, pvt /* Internal Use Only */) 1781 { 1782 if (!jQuery.acceptData(elem)) 1783 { 1784 return; 1785 } 1786 1787 var thisCache, ret, 1788 internalKey = jQuery.expando, 1789 getByName = typeof name === "string", 1790 1791 // We have to handle DOM nodes and JS objects differently because IE6-7 1792 // can't GC object references properly across the DOM-JS boundary 1793 isNode = elem.nodeType, 1794 1795 // Only DOM nodes need the global jQuery cache; JS object data is 1796 // attached directly to the object so GC can occur automatically 1797 cache = isNode ? jQuery.cache : elem, 1798 1799 // Only defining an ID for JS objects if its cache already exists allows 1800 // the code to shortcut on the same path as a DOM node with no cache 1801 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; 1802 1803 // Avoid doing any more work than we need to when trying to get data on an 1804 // object that has no data at all 1805 if ((!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined) 1806 { 1807 return; 1808 } 1809 1810 if (!id) 1811 { 1812 // Only DOM nodes need a new unique ID for each element since their data 1813 // ends up in the global cache 1814 if (isNode) 1815 { 1816 elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++; 1817 } else 1818 { 1819 id = internalKey; 1820 } 1821 } 1822 1823 if (!cache[ id ]) 1824 { 1825 cache[ id ] = {}; 1826 1827 // Avoids exposing jQuery metadata on plain JS objects when the object 1828 // is serialized using JSON.stringify 1829 if (!isNode) 1830 { 1831 cache[ id ].toJSON = jQuery.noop; 1832 } 1833 } 1834 1835 // An object can be passed to jQuery.data instead of a key/value pair; this gets 1836 // shallow copied over onto the existing cache 1837 if (typeof name === "object" || typeof name === "function") 1838 { 1839 if (pvt) 1840 { 1841 cache[ id ] = jQuery.extend(cache[ id ], name); 1842 } else 1843 { 1844 cache[ id ].data = jQuery.extend(cache[ id ].data, name); 1845 } 1846 } 1847 1848 thisCache = cache[ id ]; 1849 1850 // jQuery data() is stored in a separate object inside the object's internal data 1851 // cache in order to avoid key collisions between internal data and user-defined 1852 // data. 1853 if (!pvt) 1854 { 1855 if (!thisCache.data) 1856 { 1857 thisCache.data = {}; 1858 } 1859 1860 thisCache = thisCache.data; 1861 } 1862 1863 if (data !== undefined) 1864 { 1865 thisCache[ jQuery.camelCase(name) ] = data; 1866 } 1867 1868 // Check for both converted-to-camel and non-converted data property names 1869 // If a data property was specified 1870 if (getByName) 1871 { 1872 1873 // First Try to find as-is property data 1874 ret = thisCache[ name ]; 1875 1876 // Test for null|undefined property data 1877 if (ret == null) 1878 { 1879 1880 // Try to find the camelCased property 1881 ret = thisCache[ jQuery.camelCase(name) ]; 1882 } 1883 } else 1884 { 1885 ret = thisCache; 1886 } 1887 1888 return ret; 1889 }, 1890 1891 removeData: function (elem, name, pvt /* Internal Use Only */) 1892 { 1893 if (!jQuery.acceptData(elem)) 1894 { 1895 return; 1896 } 1897 1898 var thisCache, i, l, 1899 1900 isNode = elem.nodeType, 1901 1902 // See jQuery.data for more information 1903 cache = isNode ? jQuery.cache : elem, 1904 id = isNode ? elem[ jQuery.expando ] : jQuery.expando; 1905 1906 // If there is already no cache entry for this object, there is no 1907 // purpose in continuing 1908 if (!cache[ id ]) 1909 { 1910 return; 1911 } 1912 1913 if (name) 1914 { 1915 1916 thisCache = pvt ? cache[ id ] : cache[ id ].data; 1917 1918 if (thisCache) 1919 { 1920 1921 // Support array or space separated string names for data keys 1922 if (!jQuery.isArray(name)) 1923 { 1924 1925 // try the string as a key before any manipulation 1926 if (name in thisCache) 1927 { 1928 name = [ name ]; 1929 } else 1930 { 1931 1932 // split the camel cased version by spaces unless a key with the spaces exists 1933 name = jQuery.camelCase(name); 1934 if (name in thisCache) 1935 { 1936 name = [ name ]; 1937 } else 1938 { 1939 name = name.split(" "); 1940 } 1941 } 1942 } 1943 1944 for (i = 0, l = name.length; i < l; i++) 1945 { 1946 delete thisCache[ name[i] ]; 1947 } 1948 1949 // If there is no data left in the cache, we want to continue 1950 // and let the cache object itself get destroyed 1951 if (!( pvt ? isEmptyDataObject : jQuery.isEmptyObject )(thisCache)) 1952 { 1953 return; 1954 } 1955 } 1956 } 1957 1958 // See jQuery.data for more information 1959 if (!pvt) 1960 { 1961 delete cache[ id ].data; 1962 1963 // Don't destroy the parent cache unless the internal data object 1964 // had been the only thing left in it 1965 if (!isEmptyDataObject(cache[ id ])) 1966 { 1967 return; 1968 } 1969 } 1970 1971 // Destroy the cache 1972 if (isNode) 1973 { 1974 jQuery.cleanData([ elem ], true); 1975 1976 // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) 1977 } else if (jQuery.support.deleteExpando || cache != cache.window) 1978 { 1979 delete cache[ id ]; 1980 1981 // When all else fails, null 1982 } else 1983 { 1984 cache[ id ] = null; 1985 } 1986 }, 1987 1988 // For internal use only. 1989 _data: function (elem, name, data) 1990 { 1991 return jQuery.data(elem, name, data, true); 1992 }, 1993 1994 // A method for determining if a DOM node can handle the data expando 1995 acceptData: function (elem) 1996 { 1997 var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; 1998 1999 // nodes accept data unless otherwise specified; rejection can be conditional 2000 return !noData || noData !== true && elem.getAttribute("classid") === noData; 2001 } 2002 }); 2003 2004 jQuery.fn.extend({ 2005 data: function (key, value) 2006 { 2007 var parts, part, attr, name, l, 2008 elem = this[0], 2009 i = 0, 2010 data = null; 2011 2012 // Gets all values 2013 if (key === undefined) 2014 { 2015 if (this.length) 2016 { 2017 data = jQuery.data(elem); 2018 2019 if (elem.nodeType === 1 && !jQuery._data(elem, "parsedAttrs")) 2020 { 2021 attr = elem.attributes; 2022 for (l = attr.length; i < l; i++) 2023 { 2024 name = attr[i].name; 2025 2026 if (!name.indexOf("data-")) 2027 { 2028 name = jQuery.camelCase(name.substring(5)); 2029 2030 dataAttr(elem, name, data[ name ]); 2031 } 2032 } 2033 jQuery._data(elem, "parsedAttrs", true); 2034 } 2035 } 2036 2037 return data; 2038 } 2039 2040 // Sets multiple values 2041 if (typeof key === "object") 2042 { 2043 return this.each(function () 2044 { 2045 jQuery.data(this, key); 2046 }); 2047 } 2048 2049 parts = key.split(".", 2); 2050 parts[1] = parts[1] ? "." + parts[1] : ""; 2051 part = parts[1] + "!"; 2052 2053 return jQuery.access(this, function (value) 2054 { 2055 2056 if (value === undefined) 2057 { 2058 data = this.triggerHandler("getData" + part, [ parts[0] ]); 2059 2060 // Try to fetch any internally stored data first 2061 if (data === undefined && elem) 2062 { 2063 data = jQuery.data(elem, key); 2064 data = dataAttr(elem, key, data); 2065 } 2066 2067 return data === undefined && parts[1] ? 2068 this.data(parts[0]) : 2069 data; 2070 } 2071 2072 parts[1] = value; 2073 this.each(function () 2074 { 2075 var self = jQuery(this); 2076 2077 self.triggerHandler("setData" + part, parts); 2078 jQuery.data(this, key, value); 2079 self.triggerHandler("changeData" + part, parts); 2080 }); 2081 }, null, value, arguments.length > 1, null, false); 2082 }, 2083 2084 removeData: function (key) 2085 { 2086 return this.each(function () 2087 { 2088 jQuery.removeData(this, key); 2089 }); 2090 } 2091 }); 2092 2093 function dataAttr(elem, key, data) 2094 { 2095 // If nothing was found internally, try to fetch any 2096 // data from the HTML5 data-* attribute 2097 if (data === undefined && elem.nodeType === 1) 2098 { 2099 2100 var name = "data-" + key.replace(rmultiDash, "-$1").toLowerCase(); 2101 2102 data = elem.getAttribute(name); 2103 2104 if (typeof data === "string") 2105 { 2106 try 2107 { 2108 data = data === "true" ? true : 2109 data === "false" ? false : 2110 data === "null" ? null : 2111 // Only convert to a number if it doesn't change the string 2112 +data + "" === data ? +data : 2113 rbrace.test(data) ? jQuery.parseJSON(data) : 2114 data; 2115 } catch (e) 2116 { 2117 } 2118 2119 // Make sure we set the data so it isn't changed later 2120 jQuery.data(elem, key, data); 2121 2122 } else 2123 { 2124 data = undefined; 2125 } 2126 } 2127 2128 return data; 2129 } 2130 2131// checks a cache object for emptiness 2132 function isEmptyDataObject(obj) 2133 { 2134 var name; 2135 for (name in obj) 2136 { 2137 2138 // if the public data object is empty, the private is still empty 2139 if (name === "data" && jQuery.isEmptyObject(obj[name])) 2140 { 2141 continue; 2142 } 2143 if (name !== "toJSON") 2144 { 2145 return false; 2146 } 2147 } 2148 2149 return true; 2150 } 2151 2152 jQuery.extend({ 2153 queue: function (elem, type, data) 2154 { 2155 var queue; 2156 2157 if (elem) 2158 { 2159 type = ( type || "fx" ) + "queue"; 2160 queue = jQuery._data(elem, type); 2161 2162 // Speed up dequeue by getting out quickly if this is just a lookup 2163 if (data) 2164 { 2165 if (!queue || jQuery.isArray(data)) 2166 { 2167 queue = jQuery._data(elem, type, jQuery.makeArray(data)); 2168 } else 2169 { 2170 queue.push(data); 2171 } 2172 } 2173 return queue || []; 2174 } 2175 }, 2176 2177 dequeue: function (elem, type) 2178 { 2179 type = type || "fx"; 2180 2181 var queue = jQuery.queue(elem, type), 2182 startLength = queue.length, 2183 fn = queue.shift(), 2184 hooks = jQuery._queueHooks(elem, type), 2185 next = function () 2186 { 2187 jQuery.dequeue(elem, type); 2188 }; 2189 2190 // If the fx queue is dequeued, always remove the progress sentinel 2191 if (fn === "inprogress") 2192 { 2193 fn = queue.shift(); 2194 startLength--; 2195 } 2196 2197 if (fn) 2198 { 2199 2200 // Add a progress sentinel to prevent the fx queue from being 2201 // automatically dequeued 2202 if (type === "fx") 2203 { 2204 queue.unshift("inprogress"); 2205 } 2206 2207 // clear up the last queue stop function 2208 delete hooks.stop; 2209 fn.call(elem, next, hooks); 2210 } 2211 2212 if (!startLength && hooks) 2213 { 2214 hooks.empty.fire(); 2215 } 2216 }, 2217 2218 // not intended for public consumption - generates a queueHooks object, or returns the current one 2219 _queueHooks: function (elem, type) 2220 { 2221 var key = type + "queueHooks"; 2222 return jQuery._data(elem, key) || jQuery._data(elem, key, { 2223 empty: jQuery.Callbacks("once memory").add(function () 2224 { 2225 jQuery.removeData(elem, type + "queue", true); 2226 jQuery.removeData(elem, key, true); 2227 }) 2228 }); 2229 } 2230 }); 2231 2232 jQuery.fn.extend({ 2233 queue: function (type, data) 2234 { 2235 var setter = 2; 2236 2237 if (typeof type !== "string") 2238 { 2239 data = type; 2240 type = "fx"; 2241 setter--; 2242 } 2243 2244 if (arguments.length < setter) 2245 { 2246 return jQuery.queue(this[0], type); 2247 } 2248 2249 return data === undefined ? 2250 this : 2251 this.each(function () 2252 { 2253 var queue = jQuery.queue(this, type, data); 2254 2255 // ensure a hooks for this queue 2256 jQuery._queueHooks(this, type); 2257 2258 if (type === "fx" && queue[0] !== "inprogress") 2259 { 2260 jQuery.dequeue(this, type); 2261 } 2262 }); 2263 }, 2264 dequeue: function (type) 2265 { 2266 return this.each(function () 2267 { 2268 jQuery.dequeue(this, type); 2269 }); 2270 }, 2271 // Based off of the plugin by Clint Helfers, with permission. 2272 // http://blindsignals.com/index.php/2009/07/jquery-delay/ 2273 delay: function (time, type) 2274 { 2275 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 2276 type = type || "fx"; 2277 2278 return this.queue(type, function (next, hooks) 2279 { 2280 var timeout = setTimeout(next, time); 2281 hooks.stop = function () 2282 { 2283 clearTimeout(timeout); 2284 }; 2285 }); 2286 }, 2287 clearQueue: function (type) 2288 { 2289 return this.queue(type || "fx", []); 2290 }, 2291 // Get a promise resolved when queues of a certain type 2292 // are emptied (fx is the type by default) 2293 promise: function (type, obj) 2294 { 2295 var tmp, 2296 count = 1, 2297 defer = jQuery.Deferred(), 2298 elements = this, 2299 i = this.length, 2300 resolve = function () 2301 { 2302 if (!( --count )) 2303 { 2304 defer.resolveWith(elements, [ elements ]); 2305 } 2306 }; 2307 2308 if (typeof type !== "string") 2309 { 2310 obj = type; 2311 type = undefined; 2312 } 2313 type = type || "fx"; 2314 2315 while (i--) 2316 { 2317 tmp = jQuery._data(elements[ i ], type + "queueHooks"); 2318 if (tmp && tmp.empty) 2319 { 2320 count++; 2321 tmp.empty.add(resolve); 2322 } 2323 } 2324 resolve(); 2325 return defer.promise(obj); 2326 } 2327 }); 2328 var nodeHook, boolHook, fixSpecified, 2329 rclass = /[\t\r\n]/g, 2330 rreturn = /\r/g, 2331 rtype = /^(?:button|input)$/i, 2332 rfocusable = /^(?:button|input|object|select|textarea)$/i, 2333 rclickable = /^a(?:rea|)$/i, 2334 rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, 2335 getSetAttribute = jQuery.support.getSetAttribute; 2336 2337 jQuery.fn.extend({ 2338 attr: function (name, value) 2339 { 2340 return jQuery.access(this, jQuery.attr, name, value, arguments.length > 1); 2341 }, 2342 2343 removeAttr: function (name) 2344 { 2345 return this.each(function () 2346 { 2347 jQuery.removeAttr(this, name); 2348 }); 2349 }, 2350 2351 prop: function (name, value) 2352 { 2353 return jQuery.access(this, jQuery.prop, name, value, arguments.length > 1); 2354 }, 2355 2356 removeProp: function (name) 2357 { 2358 name = jQuery.propFix[ name ] || name; 2359 return this.each(function () 2360 { 2361 // try/catch handles cases where IE balks (such as removing a property on window) 2362 try 2363 { 2364 this[ name ] = undefined; 2365 delete this[ name ]; 2366 } catch (e) 2367 { 2368 } 2369 }); 2370 }, 2371 2372 addClass: function (value) 2373 { 2374 var classNames, i, l, elem, 2375 setClass, c, cl; 2376 2377 if (jQuery.isFunction(value)) 2378 { 2379 return this.each(function (j) 2380 { 2381 jQuery(this).addClass(value.call(this, j, this.className)); 2382 }); 2383 } 2384 2385 if (value && typeof value === "string") 2386 { 2387 classNames = value.split(core_rspace); 2388 2389 for (i = 0, l = this.length; i < l; i++) 2390 { 2391 elem = this[ i ]; 2392 2393 if (elem.nodeType === 1) 2394 { 2395 if (!elem.className && classNames.length === 1) 2396 { 2397 elem.className = value; 2398 2399 } else 2400 { 2401 setClass = " " + elem.className + " "; 2402 2403 for (c = 0, cl = classNames.length; c < cl; c++) 2404 { 2405 if (setClass.indexOf(" " + classNames[ c ] + " ") < 0) 2406 { 2407 setClass += classNames[ c ] + " "; 2408 } 2409 } 2410 elem.className = jQuery.trim(setClass); 2411 } 2412 } 2413 } 2414 } 2415 2416 return this; 2417 }, 2418 2419 removeClass: function (value) 2420 { 2421 var removes, className, elem, c, cl, i, l; 2422 2423 if (jQuery.isFunction(value)) 2424 { 2425 return this.each(function (j) 2426 { 2427 jQuery(this).removeClass(value.call(this, j, this.className)); 2428 }); 2429 } 2430 if ((value && typeof value === "string") || value === undefined) 2431 { 2432 removes = ( value || "" ).split(core_rspace); 2433 2434 for (i = 0, l = this.length; i < l; i++) 2435 { 2436 elem = this[ i ]; 2437 if (elem.nodeType === 1 && elem.className) 2438 { 2439 2440 className = (" " + elem.className + " ").replace(rclass, " "); 2441 2442 // loop over each item in the removal list 2443 for (c = 0, cl = removes.length; c < cl; c++) 2444 { 2445 // Remove until there is nothing to remove, 2446 while (className.indexOf(" " + removes[ c ] + " ") >= 0) 2447 { 2448 className = className.replace(" " + removes[ c ] + " ", " "); 2449 } 2450 } 2451 elem.className = value ? jQuery.trim(className) : ""; 2452 } 2453 } 2454 } 2455 2456 return this; 2457 }, 2458 2459 toggleClass: function (value, stateVal) 2460 { 2461 var type = typeof value, 2462 isBool = typeof stateVal === "boolean"; 2463 2464 if (jQuery.isFunction(value)) 2465 { 2466 return this.each(function (i) 2467 { 2468 jQuery(this).toggleClass(value.call(this, i, this.className, stateVal), stateVal); 2469 }); 2470 } 2471 2472 return this.each(function () 2473 { 2474 if (type === "string") 2475 { 2476 // toggle individual class names 2477 var className, 2478 i = 0, 2479 self = jQuery(this), 2480 state = stateVal, 2481 classNames = value.split(core_rspace); 2482 2483 while ((className = classNames[ i++ ])) 2484 { 2485 // check each className given, space separated list 2486 state = isBool ? state : !self.hasClass(className); 2487 self[ state ? "addClass" : "removeClass" ](className); 2488 } 2489 2490 } else if (type === "undefined" || type === "boolean") 2491 { 2492 if (this.className) 2493 { 2494 // store className if set 2495 jQuery._data(this, "__className__", this.className); 2496 } 2497 2498 // toggle whole className 2499 this.className = this.className || value === false ? "" : jQuery._data(this, "__className__") || ""; 2500 } 2501 }); 2502 }, 2503 2504 hasClass: function (selector) 2505 { 2506 var className = " " + selector + " ", 2507 i = 0, 2508 l = this.length; 2509 for (; i < l; i++) 2510 { 2511 if (this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf(className) >= 0) 2512 { 2513 return true; 2514 } 2515 } 2516 2517 return false; 2518 }, 2519 2520 val: function (value) 2521 { 2522 var hooks, ret, isFunction, 2523 elem = this[0]; 2524 2525 if (!arguments.length) 2526 { 2527 if (elem) 2528 { 2529 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 2530 2531 if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) 2532 { 2533 return ret; 2534 } 2535 2536 ret = elem.value; 2537 2538 return typeof ret === "string" ? 2539 // handle most common string cases 2540 ret.replace(rreturn, "") : 2541 // handle cases where value is null/undef or number 2542 ret == null ? "" : ret; 2543 } 2544 2545 return; 2546 } 2547 2548 isFunction = jQuery.isFunction(value); 2549 2550 return this.each(function (i) 2551 { 2552 var val, 2553 self = jQuery(this); 2554 2555 if (this.nodeType !== 1) 2556 { 2557 return; 2558 } 2559 2560 if (isFunction) 2561 { 2562 val = value.call(this, i, self.val()); 2563 } else 2564 { 2565 val = value; 2566 } 2567 2568 // Treat null/undefined as ""; convert numbers to string 2569 if (val == null) 2570 { 2571 val = ""; 2572 } else if (typeof val === "number") 2573 { 2574 val += ""; 2575 } else if (jQuery.isArray(val)) 2576 { 2577 val = jQuery.map(val, function (value) 2578 { 2579 return value == null ? "" : value + ""; 2580 }); 2581 } 2582 2583 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 2584 2585 // If set returns undefined, fall back to normal setting 2586 if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) 2587 { 2588 this.value = val; 2589 } 2590 }); 2591 } 2592 }); 2593 2594 jQuery.extend({ 2595 valHooks: { 2596 option: { 2597 get: function (elem) 2598 { 2599 // attributes.value is undefined in Blackberry 4.7 but 2600 // uses .value. See #6932 2601 var val = elem.attributes.value; 2602 return !val || val.specified ? elem.value : elem.text; 2603 } 2604 }, 2605 select: { 2606 get: function (elem) 2607 { 2608 var value, option, 2609 options = elem.options, 2610 index = elem.selectedIndex, 2611 one = elem.type === "select-one" || index < 0, 2612 values = one ? null : [], 2613 max = one ? index + 1 : options.length, 2614 i = index < 0 ? 2615 max : 2616 one ? index : 0; 2617 2618 // Loop through all the selected options 2619 for (; i < max; i++) 2620 { 2621 option = options[ i ]; 2622 2623 // oldIE doesn't update selected after form reset (#2551) 2624 if (( option.selected || i === index ) && 2625 // Don't return options that are disabled or in a disabled optgroup 2626 ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && 2627 ( !option.parentNode.disabled || !jQuery.nodeName(option.parentNode, "optgroup") )) 2628 { 2629 2630 // Get the specific value for the option 2631 value = jQuery(option).val(); 2632 2633 // We don't need an array for one selects 2634 if (one) 2635 { 2636 return value; 2637 } 2638 2639 // Multi-Selects return an array 2640 values.push(value); 2641 } 2642 } 2643 2644 return values; 2645 }, 2646 2647 set: function (elem, value) 2648 { 2649 var values = jQuery.makeArray(value); 2650 2651 jQuery(elem).find("option").each(function () 2652 { 2653 this.selected = jQuery.inArray(jQuery(this).val(), values) >= 0; 2654 }); 2655 2656 if (!values.length) 2657 { 2658 elem.selectedIndex = -1; 2659 } 2660 return values; 2661 } 2662 } 2663 }, 2664 2665 // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9 2666 attrFn: {}, 2667 2668 attr: function (elem, name, value, pass) 2669 { 2670 var ret, hooks, notxml, 2671 nType = elem.nodeType; 2672 2673 // don't get/set attributes on text, comment and attribute nodes 2674 if (!elem || nType === 3 || nType === 8 || nType === 2) 2675 { 2676 return; 2677 } 2678 2679 if (pass && jQuery.isFunction(jQuery.fn[ name ])) 2680 { 2681 return jQuery(elem)[ name ](value); 2682 } 2683 2684 // Fallback to prop when attributes are not supported 2685 if (typeof elem.getAttribute === "undefined") 2686 { 2687 return jQuery.prop(elem, name, value); 2688 } 2689 2690 notxml = nType !== 1 || !jQuery.isXMLDoc(elem); 2691 2692 // All attributes are lowercase 2693 // Grab necessary hook if one is defined 2694 if (notxml) 2695 { 2696 name = name.toLowerCase(); 2697 hooks = jQuery.attrHooks[ name ] || ( rboolean.test(name) ? boolHook : nodeHook ); 2698 } 2699 2700 if (value !== undefined) 2701 { 2702 2703 if (value === null) 2704 { 2705 jQuery.removeAttr(elem, name); 2706 return; 2707 2708 } else if (hooks && "set" in hooks && notxml && (ret = hooks.set(elem, value, name)) !== undefined) 2709 { 2710 return ret; 2711 2712 } else 2713 { 2714 elem.setAttribute(name, value + ""); 2715 return value; 2716 } 2717 2718 } else if (hooks && "get" in hooks && notxml && (ret = hooks.get(elem, name)) !== null) 2719 { 2720 return ret; 2721 2722 } else 2723 { 2724 2725 ret = elem.getAttribute(name); 2726 2727 // Non-existent attributes return null, we normalize to undefined 2728 return ret === null ? 2729 undefined : 2730 ret; 2731 } 2732 }, 2733 2734 removeAttr: function (elem, value) 2735 { 2736 var propName, attrNames, name, isBool, 2737 i = 0; 2738 2739 if (value && elem.nodeType === 1) 2740 { 2741 2742 attrNames = value.split(core_rspace); 2743 2744 for (; i < attrNames.length; i++) 2745 { 2746 name = attrNames[ i ]; 2747 2748 if (name) 2749 { 2750 propName = jQuery.propFix[ name ] || name; 2751 isBool = rboolean.test(name); 2752 2753 // See #9699 for explanation of this approach (setting first, then removal) 2754 // Do not do this for boolean attributes (see #10870) 2755 if (!isBool) 2756 { 2757 jQuery.attr(elem, name, ""); 2758 } 2759 elem.removeAttribute(getSetAttribute ? name : propName); 2760 2761 // Set corresponding property to false for boolean attributes 2762 if (isBool && propName in elem) 2763 { 2764 elem[ propName ] = false; 2765 } 2766 } 2767 } 2768 } 2769 }, 2770 2771 attrHooks: { 2772 type: { 2773 set: function (elem, value) 2774 { 2775 // We can't allow the type property to be changed (since it causes problems in IE) 2776 if (rtype.test(elem.nodeName) && elem.parentNode) 2777 { 2778 jQuery.error("type property can't be changed"); 2779 } else if (!jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input")) 2780 { 2781 // Setting the type on a radio button after the value resets the value in IE6-9 2782 // Reset value to it's default in case type is set after value 2783 // This is for element creation 2784 var val = elem.value; 2785 elem.setAttribute("type", value); 2786 if (val) 2787 { 2788 elem.value = val; 2789 } 2790 return value; 2791 } 2792 } 2793 }, 2794 // Use the value property for back compat 2795 // Use the nodeHook for button elements in IE6/7 (#1954) 2796 value: { 2797 get: function (elem, name) 2798 { 2799 if (nodeHook && jQuery.nodeName(elem, "button")) 2800 { 2801 return nodeHook.get(elem, name); 2802 } 2803 return name in elem ? 2804 elem.value : 2805 null; 2806 }, 2807 set: function (elem, value, name) 2808 { 2809 if (nodeHook && jQuery.nodeName(elem, "button")) 2810 { 2811 return nodeHook.set(elem, value, name); 2812 } 2813 // Does not return so that setAttribute is also used 2814 elem.value = value; 2815 } 2816 } 2817 }, 2818 2819 propFix: { 2820 tabindex: "tabIndex", 2821 readonly: "readOnly", 2822 "for": "htmlFor", 2823 "class": "className", 2824 maxlength: "maxLength", 2825 cellspacing: "cellSpacing", 2826 cellpadding: "cellPadding", 2827 rowspan: "rowSpan", 2828 colspan: "colSpan", 2829 usemap: "useMap", 2830 frameborder: "frameBorder", 2831 contenteditable: "contentEditable" 2832 }, 2833 2834 prop: function (elem, name, value) 2835 { 2836 var ret, hooks, notxml, 2837 nType = elem.nodeType; 2838 2839 // don't get/set properties on text, comment and attribute nodes 2840 if (!elem || nType === 3 || nType === 8 || nType === 2) 2841 { 2842 return; 2843 } 2844 2845 notxml = nType !== 1 || !jQuery.isXMLDoc(elem); 2846 2847 if (notxml) 2848 { 2849 // Fix name and attach hooks 2850 name = jQuery.propFix[ name ] || name; 2851 hooks = jQuery.propHooks[ name ]; 2852 } 2853 2854 if (value !== undefined) 2855 { 2856 if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) 2857 { 2858 return ret; 2859 2860 } else 2861 { 2862 return ( elem[ name ] = value ); 2863 } 2864 2865 } else 2866 { 2867 if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) 2868 { 2869 return ret; 2870 2871 } else 2872 { 2873 return elem[ name ]; 2874 } 2875 } 2876 }, 2877 2878 propHooks: { 2879 tabIndex: { 2880 get: function (elem) 2881 { 2882 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set 2883 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 2884 var attributeNode = elem.getAttributeNode("tabindex"); 2885 2886 return attributeNode && attributeNode.specified ? 2887 parseInt(attributeNode.value, 10) : 2888 rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href ? 2889 0 : 2890 undefined; 2891 } 2892 } 2893 } 2894 }); 2895 2896// Hook for boolean attributes 2897 boolHook = { 2898 get: function (elem, name) 2899 { 2900 // Align boolean attributes with corresponding properties 2901 // Fall back to attribute presence where some booleans are not supported 2902 var attrNode, 2903 property = jQuery.prop(elem, name); 2904 return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? 2905 name.toLowerCase() : 2906 undefined; 2907 }, 2908 set: function (elem, value, name) 2909 { 2910 var propName; 2911 if (value === false) 2912 { 2913 // Remove boolean attributes when set to false 2914 jQuery.removeAttr(elem, name); 2915 } else 2916 { 2917 // value is true since we know at this point it's type boolean and not false 2918 // Set boolean attributes to the same name and set the DOM property 2919 propName = jQuery.propFix[ name ] || name; 2920 if (propName in elem) 2921 { 2922 // Only set the IDL specifically if it already exists on the element 2923 elem[ propName ] = true; 2924 } 2925 2926 elem.setAttribute(name, name.toLowerCase()); 2927 } 2928 return name; 2929 } 2930 }; 2931 2932// IE6/7 do not support getting/setting some attributes with get/setAttribute 2933 if (!getSetAttribute) 2934 { 2935 2936 fixSpecified = { 2937 name: true, 2938 id: true, 2939 coords: true 2940 }; 2941 2942 // Use this for any attribute in IE6/7 2943 // This fixes almost every IE6/7 issue 2944 nodeHook = jQuery.valHooks.button = { 2945 get: function (elem, name) 2946 { 2947 var ret; 2948 ret = elem.getAttributeNode(name); 2949 return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ? 2950 ret.value : 2951 undefined; 2952 }, 2953 set: function (elem, value, name) 2954 { 2955 // Set the existing or create a new attribute node 2956 var ret = elem.getAttributeNode(name); 2957 if (!ret) 2958 { 2959 ret = document.createAttribute(name); 2960 elem.setAttributeNode(ret); 2961 } 2962 return ( ret.value = value + "" ); 2963 } 2964 }; 2965 2966 // Set width and height to auto instead of 0 on empty string( Bug #8150 ) 2967 // This is for removals 2968 jQuery.each([ "width", "height" ], function (i, name) 2969 { 2970 jQuery.attrHooks[ name ] = jQuery.extend(jQuery.attrHooks[ name ], { 2971 set: function (elem, value) 2972 { 2973 if (value === "") 2974 { 2975 elem.setAttribute(name, "auto"); 2976 return value; 2977 } 2978 } 2979 }); 2980 }); 2981 2982 // Set contenteditable to false on removals(#10429) 2983 // Setting to empty string throws an error as an invalid value 2984 jQuery.attrHooks.contenteditable = { 2985 get: nodeHook.get, 2986 set: function (elem, value, name) 2987 { 2988 if (value === "") 2989 { 2990 value = "false"; 2991 } 2992 nodeHook.set(elem, value, name); 2993 } 2994 }; 2995 } 2996 2997 2998// Some attributes require a special call on IE 2999 if (!jQuery.support.hrefNormalized) 3000 { 3001 jQuery.each([ "href", "src", "width", "height" ], function (i, name) 3002 { 3003 jQuery.attrHooks[ name ] = jQuery.extend(jQuery.attrHooks[ name ], { 3004 get: function (elem) 3005 { 3006 var ret = elem.getAttribute(name, 2); 3007 return ret === null ? undefined : ret; 3008 } 3009 }); 3010 }); 3011 } 3012 3013 if (!jQuery.support.style) 3014 { 3015 jQuery.attrHooks.style = { 3016 get: function (elem) 3017 { 3018 // Return undefined in the case of empty string 3019 // Normalize to lowercase since IE uppercases css property names 3020 return elem.style.cssText.toLowerCase() || undefined; 3021 }, 3022 set: function (elem, value) 3023 { 3024 return ( elem.style.cssText = value + "" ); 3025 } 3026 }; 3027 } 3028 3029// Safari mis-reports the default selected property of an option 3030// Accessing the parent's selectedIndex property fixes it 3031 if (!jQuery.support.optSelected) 3032 { 3033 jQuery.propHooks.selected = jQuery.extend(jQuery.propHooks.selected, { 3034 get: function (elem) 3035 { 3036 var parent = elem.parentNode; 3037 3038 if (parent) 3039 { 3040 parent.selectedIndex; 3041 3042 // Make sure that it also works with optgroups, see #5701 3043 if (parent.parentNode) 3044 { 3045 parent.parentNode.selectedIndex; 3046 } 3047 } 3048 return null; 3049 } 3050 }); 3051 } 3052 3053// IE6/7 call enctype encoding 3054 if (!jQuery.support.enctype) 3055 { 3056 jQuery.propFix.enctype = "encoding"; 3057 } 3058 3059// Radios and checkboxes getter/setter 3060 if (!jQuery.support.checkOn) 3061 { 3062 jQuery.each([ "radio", "checkbox" ], function () 3063 { 3064 jQuery.valHooks[ this ] = { 3065 get: function (elem) 3066 { 3067 // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified 3068 return elem.getAttribute("value") === null ? "on" : elem.value; 3069 } 3070 }; 3071 }); 3072 } 3073 jQuery.each([ "radio", "checkbox" ], function () 3074 { 3075 jQuery.valHooks[ this ] = jQuery.extend(jQuery.valHooks[ this ], { 3076 set: function (elem, value) 3077 { 3078 if (jQuery.isArray(value)) 3079 { 3080 return ( elem.checked = jQuery.inArray(jQuery(elem).val(), value) >= 0 ); 3081 } 3082 } 3083 }); 3084 }); 3085 var rformElems = /^(?:textarea|input|select)$/i, 3086 rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/, 3087 rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, 3088 rkeyEvent = /^key/, 3089 rmouseEvent = /^(?:mouse|contextmenu)|click/, 3090 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 3091 hoverHack = function (events) 3092 { 3093 return jQuery.event.special.hover ? events : events.replace(rhoverHack, "mouseenter$1 mouseleave$1"); 3094 }; 3095 3096 /* 3097 * Helper functions for managing events -- not part of the public interface. 3098 * Props to Dean Edwards' addEvent library for many of the ideas. 3099 */ 3100 jQuery.event = { 3101 3102 add: function (elem, types, handler, data, selector) 3103 { 3104 3105 var elemData, eventHandle, events, 3106 t, tns, type, namespaces, handleObj, 3107 handleObjIn, handlers, special; 3108 3109 // Don't attach events to noData or text/comment nodes (allow plain objects tho) 3110 if (elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data(elem))) 3111 { 3112 return; 3113 } 3114 3115 // Caller can pass in an object of custom data in lieu of the handler 3116 if (handler.handler) 3117 { 3118 handleObjIn = handler; 3119 handler = handleObjIn.handler; 3120 selector = handleObjIn.selector; 3121 } 3122 3123 // Make sure that the handler has a unique ID, used to find/remove it later 3124 if (!handler.guid) 3125 { 3126 handler.guid = jQuery.guid++; 3127 } 3128 3129 // Init the element's event structure and main handler, if this is the first 3130 events = elemData.events; 3131 if (!events) 3132 { 3133 elemData.events = events = {}; 3134 } 3135 eventHandle = elemData.handle; 3136 if (!eventHandle) 3137 { 3138 elemData.handle = eventHandle = function (e) 3139 { 3140 // Discard the second event of a jQuery.event.trigger() and 3141 // when an event is called after a page has unloaded 3142 return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? 3143 jQuery.event.dispatch.apply(eventHandle.elem, arguments) : 3144 undefined; 3145 }; 3146 // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events 3147 eventHandle.elem = elem; 3148 } 3149 3150 // Handle multiple events separated by a space 3151 // jQuery(...).bind("mouseover mouseout", fn); 3152 types = jQuery.trim(hoverHack(types)).split(" "); 3153 for (t = 0; t < types.length; t++) 3154 { 3155 3156 tns = rtypenamespace.exec(types[t]) || []; 3157 type = tns[1]; 3158 namespaces = ( tns[2] || "" ).split(".").sort(); 3159 3160 // If event changes its type, use the special event handlers for the changed type 3161 special = jQuery.event.special[ type ] || {}; 3162 3163 // If selector defined, determine special event api type, otherwise given type 3164 type = ( selector ? special.delegateType : special.bindType ) || type; 3165 3166 // Update special based on newly reset type 3167 special = jQuery.event.special[ type ] || {}; 3168 3169 // handleObj is passed to all event handlers 3170 handleObj = jQuery.extend({ 3171 type: type, 3172 origType: tns[1], 3173 data: data, 3174 handler: handler, 3175 guid: handler.guid, 3176 selector: selector, 3177 needsContext: selector && jQuery.expr.match.needsContext.test(selector), 3178 namespace: namespaces.join(".") 3179 }, handleObjIn); 3180 3181 // Init the event handler queue if we're the first 3182 handlers = events[ type ]; 3183 if (!handlers) 3184 { 3185 handlers = events[ type ] = []; 3186 handlers.delegateCount = 0; 3187 3188 // Only use addEventListener/attachEvent if the special events handler returns false 3189 if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) 3190 { 3191 // Bind the global event handler to the element 3192 if (elem.addEventListener) 3193 { 3194 elem.addEventListener(type, eventHandle, false); 3195 3196 } else if (elem.attachEvent) 3197 { 3198 elem.attachEvent("on" + type, eventHandle); 3199 } 3200 } 3201 } 3202 3203 if (special.add) 3204 { 3205 special.add.call(elem, handleObj); 3206 3207 if (!handleObj.handler.guid) 3208 { 3209 handleObj.handler.guid = handler.guid; 3210 } 3211 } 3212 3213 // Add to the element's handler list, delegates in front 3214 if (selector) 3215 { 3216 handlers.splice(handlers.delegateCount++, 0, handleObj); 3217 } else 3218 { 3219 handlers.push(handleObj); 3220 } 3221 3222 // Keep track of which events have ever been used, for event optimization 3223 jQuery.event.global[ type ] = true; 3224 } 3225 3226 // Nullify elem to prevent memory leaks in IE 3227 elem = null; 3228 }, 3229 3230 global: {}, 3231 3232 // Detach an event or set of events from an element 3233 remove: function (elem, types, handler, selector, mappedTypes) 3234 { 3235 3236 var t, tns, type, origType, namespaces, origCount, 3237 j, events, special, eventType, handleObj, 3238 elemData = jQuery.hasData(elem) && jQuery._data(elem); 3239 3240 if (!elemData || !(events = elemData.events)) 3241 { 3242 return; 3243 } 3244 3245 // Once for each type.namespace in types; type may be omitted 3246 types = jQuery.trim(hoverHack(types || "")).split(" "); 3247 for (t = 0; t < types.length; t++) 3248 { 3249 tns = rtypenamespace.exec(types[t]) || []; 3250 type = origType = tns[1]; 3251 namespaces = tns[2]; 3252 3253 // Unbind all events (on this namespace, if provided) for the element 3254 if (!type) 3255 { 3256 for (type in events) 3257 { 3258 jQuery.event.remove(elem, type + types[ t ], handler, selector, true); 3259 } 3260 continue; 3261 } 3262 3263 special = jQuery.event.special[ type ] || {}; 3264 type = ( selector ? special.delegateType : special.bindType ) || type; 3265 eventType = events[ type ] || []; 3266 origCount = eventType.length; 3267 namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null; 3268 3269 // Remove matching events 3270 for (j = 0; j < eventType.length; j++) 3271 { 3272 handleObj = eventType[ j ]; 3273 3274 if (( mappedTypes || origType === handleObj.origType ) && 3275 ( !handler || handler.guid === handleObj.guid ) && 3276 ( !namespaces || namespaces.test(handleObj.namespace) ) && 3277 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector )) 3278 { 3279 eventType.splice(j--, 1); 3280 3281 if (handleObj.selector) 3282 { 3283 eventType.delegateCount--; 3284 } 3285 if (special.remove) 3286 { 3287 special.remove.call(elem, handleObj); 3288 } 3289 } 3290 } 3291 3292 // Remove generic event handler if we removed something and no more handlers exist 3293 // (avoids potential for endless recursion during removal of special event handlers) 3294 if (eventType.length === 0 && origCount !== eventType.length) 3295 { 3296 if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) 3297 { 3298 jQuery.removeEvent(elem, type, elemData.handle); 3299 } 3300 3301 delete events[ type ]; 3302 } 3303 } 3304 3305 // Remove the expando if it's no longer used 3306 if (jQuery.isEmptyObject(events)) 3307 { 3308 delete elemData.handle; 3309 3310 // removeData also checks for emptiness and clears the expando if empty 3311 // so use it instead of delete 3312 jQuery.removeData(elem, "events", true); 3313 } 3314 }, 3315 3316 // Events that are safe to short-circuit if no handlers are attached. 3317 // Native DOM events should not be added, they may have inline handlers. 3318 customEvent: { 3319 "getData": true, 3320 "setData": true, 3321 "changeData": true 3322 }, 3323 3324 trigger: function (event, data, elem, onlyHandlers) 3325 { 3326 // Don't do events on text and comment nodes 3327 if (elem && (elem.nodeType === 3 || elem.nodeType === 8)) 3328 { 3329 return; 3330 } 3331 3332 // Event object or event type 3333 var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType, 3334 type = event.type || event, 3335 namespaces = []; 3336 3337 // focus/blur morphs to focusin/out; ensure we're not firing them right now 3338 if (rfocusMorph.test(type + jQuery.event.triggered)) 3339 { 3340 return; 3341 } 3342 3343 if (type.indexOf("!") >= 0) 3344 { 3345 // Exclusive events trigger only for the exact event (no namespaces) 3346 type = type.slice(0, -1); 3347 exclusive = true; 3348 } 3349 3350 if (type.indexOf(".") >= 0) 3351 { 3352 // Namespaced trigger; create a regexp to match event type in handle() 3353 namespaces = type.split("."); 3354 type = namespaces.shift(); 3355 namespaces.sort(); 3356 } 3357 3358 if ((!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ]) 3359 { 3360 // No jQuery handlers for this event type, and it can't have inline handlers 3361 return; 3362 } 3363 3364 // Caller can pass in an Event, Object, or just an event type string 3365 event = typeof event === "object" ? 3366 // jQuery.Event object 3367 event[ jQuery.expando ] ? event : 3368 // Object literal 3369 new jQuery.Event(type, event) : 3370 // Just the event type (string) 3371 new jQuery.Event(type); 3372 3373 event.type = type; 3374 event.isTrigger = true; 3375 event.exclusive = exclusive; 3376 event.namespace = namespaces.join("."); 3377 event.namespace_re = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; 3378 ontype = type.indexOf(":") < 0 ? "on" + type : ""; 3379 3380 // Handle a global trigger 3381 if (!elem) 3382 { 3383 3384 // TODO: Stop taunting the data cache; remove global events and always attach to document 3385 cache = jQuery.cache; 3386 for (i in cache) 3387 { 3388 if (cache[ i ].events && cache[ i ].events[ type ]) 3389 { 3390 jQuery.event.trigger(event, data, cache[ i ].handle.elem, true); 3391 } 3392 } 3393 return; 3394 } 3395 3396 // Clean up the event in case it is being reused 3397 event.result = undefined; 3398 if (!event.target) 3399 { 3400 event.target = elem; 3401 } 3402 3403 // Clone any incoming data and prepend the event, creating the handler arg list 3404 data = data != null ? jQuery.makeArray(data) : []; 3405 data.unshift(event); 3406 3407 // Allow special events to draw outside the lines 3408 special = jQuery.event.special[ type ] || {}; 3409 if (special.trigger && special.trigger.apply(elem, data) === false) 3410 { 3411 return; 3412 } 3413 3414 // Determine event propagation path in advance, per W3C events spec (#9951) 3415 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 3416 eventPath = [ 3417 [ elem, special.bindType || type ] 3418 ]; 3419 if (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) 3420 { 3421 3422 bubbleType = special.delegateType || type; 3423 cur = rfocusMorph.test(bubbleType + type) ? elem : elem.parentNode; 3424 for (old = elem; cur; cur = cur.parentNode) 3425 { 3426 eventPath.push([ cur, bubbleType ]); 3427 old = cur; 3428 } 3429 3430 // Only add window if we got to document (e.g., not plain obj or detached DOM) 3431 if (old === (elem.ownerDocument || document)) 3432 { 3433 eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); 3434 } 3435 } 3436 3437 // Fire handlers on the event path 3438 for (i = 0; i < eventPath.length && !event.isPropagationStopped(); i++) 3439 { 3440 3441 cur = eventPath[i][0]; 3442 event.type = eventPath[i][1]; 3443 3444 handle = ( jQuery._data(cur, "events") || {} )[ event.type ] && jQuery._data(cur, "handle"); 3445 if (handle) 3446 { 3447 handle.apply(cur, data); 3448 } 3449 // Note that this is a bare JS function and not a jQuery handler 3450 handle = ontype && cur[ ontype ]; 3451 if (handle && jQuery.acceptData(cur) && handle.apply && handle.apply(cur, data) === false) 3452 { 3453 event.preventDefault(); 3454 } 3455 } 3456 event.type = type; 3457 3458 // If nobody prevented the default action, do it now 3459 if (!onlyHandlers && !event.isDefaultPrevented()) 3460 { 3461 3462 if ((!special._default || special._default.apply(elem.ownerDocument, data) === false) && !(type === "click" && jQuery.nodeName(elem, "a")) && jQuery.acceptData(elem)) 3463 { 3464 3465 // Call a native DOM method on the target with the same name name as the event. 3466 // Can't use an .isFunction() check here because IE6/7 fails that test. 3467 // Don't do default actions on window, that's where global variables be (#6170) 3468 // IE<9 dies on focus/blur to hidden element (#1486) 3469 if (ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow(elem)) 3470 { 3471 3472 // Don't re-trigger an onFOO event when we call its FOO() method 3473 old = elem[ ontype ]; 3474 3475 if (old) 3476 { 3477 elem[ ontype ] = null; 3478 } 3479 3480 // Prevent re-triggering of the same event, since we already bubbled it above 3481 jQuery.event.triggered = type; 3482 elem[ type ](); 3483 jQuery.event.triggered = undefined; 3484 3485 if (old) 3486 { 3487 elem[ ontype ] = old; 3488 } 3489 } 3490 } 3491 } 3492 3493 return event.result; 3494 }, 3495 3496 dispatch: function (event) 3497 { 3498 3499 // Make a writable jQuery.Event from the native event object 3500 event = jQuery.event.fix(event || window.event); 3501 3502 var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related, 3503 handlers = ( (jQuery._data(this, "events") || {} )[ event.type ] || []), 3504 delegateCount = handlers.delegateCount, 3505 args = core_slice.call(arguments), 3506 run_all = !event.exclusive && !event.namespace, 3507 special = jQuery.event.special[ event.type ] || {}, 3508 handlerQueue = []; 3509 3510 // Use the fix-ed jQuery.Event rather than the (read-only) native event 3511 args[0] = event; 3512 event.delegateTarget = this; 3513 3514 // Call the preDispatch hook for the mapped type, and let it bail if desired 3515 if (special.preDispatch && special.preDispatch.call(this, event) === false) 3516 { 3517 return; 3518 } 3519 3520 // Determine handlers that should run if there are delegated events 3521 // Avoid non-left-click bubbling in Firefox (#3861) 3522 if (delegateCount && !(event.button && event.type === "click")) 3523 { 3524 3525 for (cur = event.target; cur != this; cur = cur.parentNode || this) 3526 { 3527 3528 // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764) 3529 if (cur.disabled !== true || event.type !== "click") 3530 { 3531 selMatch = {}; 3532 matches = []; 3533 for (i = 0; i < delegateCount; i++) 3534 { 3535 handleObj = handlers[ i ]; 3536 sel = handleObj.selector; 3537 3538 if (selMatch[ sel ] === undefined) 3539 { 3540 selMatch[ sel ] = handleObj.needsContext ? 3541 jQuery(sel, this).index(cur) >= 0 : 3542 jQuery.find(sel, this, null, [ cur ]).length; 3543 } 3544 if (selMatch[ sel ]) 3545 { 3546 matches.push(handleObj); 3547 } 3548 } 3549 if (matches.length) 3550 { 3551 handlerQueue.push({ elem: cur, matches: matches }); 3552 } 3553 } 3554 } 3555 } 3556 3557 // Add the remaining (directly-bound) handlers 3558 if (handlers.length > delegateCount) 3559 { 3560 handlerQueue.push({ elem: this, matches: handlers.slice(delegateCount) }); 3561 } 3562 3563 // Run delegates first; they may want to stop propagation beneath us 3564 for (i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++) 3565 { 3566 matched = handlerQueue[ i ]; 3567 event.currentTarget = matched.elem; 3568 3569 for (j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++) 3570 { 3571 handleObj = matched.matches[ j ]; 3572 3573 // Triggered event must either 1) be non-exclusive and have no namespace, or 3574 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). 3575 if (run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test(handleObj.namespace)) 3576 { 3577 3578 event.data = handleObj.data; 3579 event.handleObj = handleObj; 3580 3581 ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) 3582 .apply(matched.elem, args); 3583 3584 if (ret !== undefined) 3585 { 3586 event.result = ret; 3587 if (ret === false) 3588 { 3589 event.preventDefault(); 3590 event.stopPropagation(); 3591 } 3592 } 3593 } 3594 } 3595 } 3596 3597 // Call the postDispatch hook for the mapped type 3598 if (special.postDispatch) 3599 { 3600 special.postDispatch.call(this, event); 3601 } 3602 3603 return event.result; 3604 }, 3605 3606 // Includes some event props shared by KeyEvent and MouseEvent 3607 // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** 3608 props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), 3609 3610 fixHooks: {}, 3611 3612 keyHooks: { 3613 props: "char charCode key keyCode".split(" "), 3614 filter: function (event, original) 3615 { 3616 3617 // Add which for key events 3618 if (event.which == null) 3619 { 3620 event.which = original.charCode != null ? original.charCode : original.keyCode; 3621 } 3622 3623 return event; 3624 } 3625 }, 3626 3627 mouseHooks: { 3628 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), 3629 filter: function (event, original) 3630 { 3631 var eventDoc, doc, body, 3632 button = original.button, 3633 fromElement = original.fromElement; 3634 3635 // Calculate pageX/Y if missing and clientX/Y available 3636 if (event.pageX == null && original.clientX != null) 3637 { 3638 eventDoc = event.target.ownerDocument || document; 3639 doc = eventDoc.documentElement; 3640 body = eventDoc.body; 3641 3642 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); 3643 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); 3644 } 3645 3646 // Add relatedTarget, if necessary 3647 if (!event.relatedTarget && fromElement) 3648 { 3649 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; 3650 } 3651 3652 // Add which for click: 1 === left; 2 === middle; 3 === right 3653 // Note: button is not normalized, so don't use it 3654 if (!event.which && button !== undefined) 3655 { 3656 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); 3657 } 3658 3659 return event; 3660 } 3661 }, 3662 3663 fix: function (event) 3664 { 3665 if (event[ jQuery.expando ]) 3666 { 3667 return event; 3668 } 3669 3670 // Create a writable copy of the event object and normalize some properties 3671 var i, prop, 3672 originalEvent = event, 3673 fixHook = jQuery.event.fixHooks[ event.type ] || {}, 3674 copy = fixHook.props ? this.props.concat(fixHook.props) : this.props; 3675 3676 event = jQuery.Event(originalEvent); 3677 3678 for (i = copy.length; i;) 3679 { 3680 prop = copy[ --i ]; 3681 event[ prop ] = originalEvent[ prop ]; 3682 } 3683 3684 // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) 3685 if (!event.target) 3686 { 3687 event.target = originalEvent.srcElement || document; 3688 } 3689 3690 // Target should not be a text node (#504, Safari) 3691 if (event.target.nodeType === 3) 3692 { 3693 event.target = event.target.parentNode; 3694 } 3695 3696 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8) 3697 event.metaKey = !!event.metaKey; 3698 3699 return fixHook.filter ? fixHook.filter(event, originalEvent) : event; 3700 }, 3701 3702 special: { 3703 load: { 3704 // Prevent triggered image.load events from bubbling to window.load 3705 noBubble: true 3706 }, 3707 3708 focus: { 3709 delegateType: "focusin" 3710 }, 3711 blur: { 3712 delegateType: "focusout" 3713 }, 3714 3715 beforeunload: { 3716 setup: function (data, namespaces, eventHandle) 3717 { 3718 // We only want to do this special case on windows 3719 if (jQuery.isWindow(this)) 3720 { 3721 this.onbeforeunload = eventHandle; 3722 } 3723 }, 3724 3725 teardown: function (namespaces, eventHandle) 3726 { 3727 if (this.onbeforeunload === eventHandle) 3728 { 3729 this.onbeforeunload = null; 3730 } 3731 } 3732 } 3733 }, 3734 3735 simulate: function (type, elem, event, bubble) 3736 { 3737 // Piggyback on a donor event to simulate a different one. 3738 // Fake originalEvent to avoid donor's stopPropagation, but if the 3739 // simulated event prevents default then we do the same on the donor. 3740 var e = jQuery.extend( 3741 new jQuery.Event(), 3742 event, 3743 { type: type, 3744 isSimulated: true, 3745 originalEvent: {} 3746 } 3747 ); 3748 if (bubble) 3749 { 3750 jQuery.event.trigger(e, null, elem); 3751 } else 3752 { 3753 jQuery.event.dispatch.call(elem, e); 3754 } 3755 if (e.isDefaultPrevented()) 3756 { 3757 event.preventDefault(); 3758 } 3759 } 3760 }; 3761 3762// Some plugins are using, but it's undocumented/deprecated and will be removed. 3763// The 1.7 special event interface should provide all the hooks needed now. 3764 jQuery.event.handle = jQuery.event.dispatch; 3765 3766 jQuery.removeEvent = document.removeEventListener ? 3767 function (elem, type, handle) 3768 { 3769 if (elem.removeEventListener) 3770 { 3771 elem.removeEventListener(type, handle, false); 3772 } 3773 } : 3774 function (elem, type, handle) 3775 { 3776 var name = "on" + type; 3777 3778 if (elem.detachEvent) 3779 { 3780 3781 // #8545, #7054, preventing memory leaks for custom events in IE6-8 3782 // detachEvent needed property on element, by name of that event, to properly expose it to GC 3783 if (typeof elem[ name ] === "undefined") 3784 { 3785 elem[ name ] = null; 3786 } 3787 3788 elem.detachEvent(name, handle); 3789 } 3790 }; 3791 3792 jQuery.Event = function (src, props) 3793 { 3794 // Allow instantiation without the 'new' keyword 3795 if (!(this instanceof jQuery.Event)) 3796 { 3797 return new jQuery.Event(src, props); 3798 } 3799 3800 // Event object 3801 if (src && src.type) 3802 { 3803 this.originalEvent = src; 3804 this.type = src.type; 3805 3806 // Events bubbling up the document may have been marked as prevented 3807 // by a handler lower down the tree; reflect the correct value. 3808 this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || 3809 src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; 3810 3811 // Event type 3812 } else 3813 { 3814 this.type = src; 3815 } 3816 3817 // Put explicitly provided properties onto the event object 3818 if (props) 3819 { 3820 jQuery.extend(this, props); 3821 } 3822 3823 // Create a timestamp if incoming event doesn't have one 3824 this.timeStamp = src && src.timeStamp || jQuery.now(); 3825 3826 // Mark it as fixed 3827 this[ jQuery.expando ] = true; 3828 }; 3829 3830 function returnFalse() 3831 { 3832 return false; 3833 } 3834 3835 function returnTrue() 3836 { 3837 return true; 3838 } 3839 3840// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 3841// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 3842 jQuery.Event.prototype = { 3843 preventDefault: function () 3844 { 3845 this.isDefaultPrevented = returnTrue; 3846 3847 var e = this.originalEvent; 3848 if (!e) 3849 { 3850 return; 3851 } 3852 3853 // if preventDefault exists run it on the original event 3854 if (e.preventDefault) 3855 { 3856 e.preventDefault(); 3857 3858 // otherwise set the returnValue property of the original event to false (IE) 3859 } else 3860 { 3861 e.returnValue = false; 3862 } 3863 }, 3864 stopPropagation: function () 3865 { 3866 this.isPropagationStopped = returnTrue; 3867 3868 var e = this.originalEvent; 3869 if (!e) 3870 { 3871 return; 3872 } 3873 // if stopPropagation exists run it on the original event 3874 if (e.stopPropagation) 3875 { 3876 e.stopPropagation(); 3877 } 3878 // otherwise set the cancelBubble property of the original event to true (IE) 3879 e.cancelBubble = true; 3880 }, 3881 stopImmediatePropagation: function () 3882 { 3883 this.isImmediatePropagationStopped = returnTrue; 3884 this.stopPropagation(); 3885 }, 3886 isDefaultPrevented: returnFalse, 3887 isPropagationStopped: returnFalse, 3888 isImmediatePropagationStopped: returnFalse 3889 }; 3890 3891// Create mouseenter/leave events using mouseover/out and event-time checks 3892 jQuery.each({ 3893 mouseenter: "mouseover", 3894 mouseleave: "mouseout" 3895 }, function (orig, fix) 3896 { 3897 jQuery.event.special[ orig ] = { 3898 delegateType: fix, 3899 bindType: fix, 3900 3901 handle: function (event) 3902 { 3903 var ret, 3904 target = this, 3905 related = event.relatedTarget, 3906 handleObj = event.handleObj, 3907 selector = handleObj.selector; 3908 3909 // For mousenter/leave call the handler if related is outside the target. 3910 // NB: No relatedTarget if the mouse left/entered the browser window 3911 if (!related || (related !== target && !jQuery.contains(target, related))) 3912 { 3913 event.type = handleObj.origType; 3914 ret = handleObj.handler.apply(this, arguments); 3915 event.type = fix; 3916 } 3917 return ret; 3918 } 3919 }; 3920 }); 3921 3922// IE submit delegation 3923 if (!jQuery.support.submitBubbles) 3924 { 3925 3926 jQuery.event.special.submit = { 3927 setup: function () 3928 { 3929 // Only need this for delegated form submit events 3930 if (jQuery.nodeName(this, "form")) 3931 { 3932 return false; 3933 } 3934 3935 // Lazy-add a submit handler when a descendant form may potentially be submitted 3936 jQuery.event.add(this, "click._submit keypress._submit", function (e) 3937 { 3938 // Node name check avoids a VML-related crash in IE (#9807) 3939 var elem = e.target, 3940 form = jQuery.nodeName(elem, "input") || jQuery.nodeName(elem, "button") ? elem.form : undefined; 3941 if (form && !jQuery._data(form, "_submit_attached")) 3942 { 3943 jQuery.event.add(form, "submit._submit", function (event) 3944 { 3945 event._submit_bubble = true; 3946 }); 3947 jQuery._data(form, "_submit_attached", true); 3948 } 3949 }); 3950 // return undefined since we don't need an event listener 3951 }, 3952 3953 postDispatch: function (event) 3954 { 3955 // If form was submitted by the user, bubble the event up the tree 3956 if (event._submit_bubble) 3957 { 3958 delete event._submit_bubble; 3959 if (this.parentNode && !event.isTrigger) 3960 { 3961 jQuery.event.simulate("submit", this.parentNode, event, true); 3962 } 3963 } 3964 }, 3965 3966 teardown: function () 3967 { 3968 // Only need this for delegated form submit events 3969 if (jQuery.nodeName(this, "form")) 3970 { 3971 return false; 3972 } 3973 3974 // Remove delegated handlers; cleanData eventually reaps submit handlers attached above 3975 jQuery.event.remove(this, "._submit"); 3976 } 3977 }; 3978 } 3979 3980// IE change delegation and checkbox/radio fix 3981 if (!jQuery.support.changeBubbles) 3982 { 3983 3984 jQuery.event.special.change = { 3985 3986 setup: function () 3987 { 3988 3989 if (rformElems.test(this.nodeName)) 3990 { 3991 // IE doesn't fire change on a check/radio until blur; trigger it on click 3992 // after a propertychange. Eat the blur-change in special.change.handle. 3993 // This still fires onchange a second time for check/radio after blur. 3994 if (this.type === "checkbox" || this.type === "radio") 3995 { 3996 jQuery.event.add(this, "propertychange._change", function (event) 3997 { 3998 if (event.originalEvent.propertyName === "checked") 3999 { 4000 this._just_changed = true; 4001 } 4002 }); 4003 jQuery.event.add(this, "click._change", function (event) 4004 { 4005 if (this._just_changed && !event.isTrigger) 4006 { 4007 this._just_changed = false; 4008 } 4009 // Allow triggered, simulated change events (#11500) 4010 jQuery.event.simulate("change", this, event, true); 4011 }); 4012 } 4013 return false; 4014 } 4015 // Delegated event; lazy-add a change handler on descendant inputs 4016 jQuery.event.add(this, "beforeactivate._change", function (e) 4017 { 4018 var elem = e.target; 4019 4020 if (rformElems.test(elem.nodeName) && !jQuery._data(elem, "_change_attached")) 4021 { 4022 jQuery.event.add(elem, "change._change", function (event) 4023 { 4024 if (this.parentNode && !event.isSimulated && !event.isTrigger) 4025 { 4026 jQuery.event.simulate("change", this.parentNode, event, true); 4027 } 4028 }); 4029 jQuery._data(elem, "_change_attached", true); 4030 } 4031 }); 4032 }, 4033 4034 handle: function (event) 4035 { 4036 var elem = event.target; 4037 4038 // Swallow native change events from checkbox/radio, we already triggered them above 4039 if (this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox")) 4040 { 4041 return event.handleObj.handler.apply(this, arguments); 4042 } 4043 }, 4044 4045 teardown: function () 4046 { 4047 jQuery.event.remove(this, "._change"); 4048 4049 return !rformElems.test(this.nodeName); 4050 } 4051 }; 4052 } 4053 4054// Create "bubbling" focus and blur events 4055 if (!jQuery.support.focusinBubbles) 4056 { 4057 jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) 4058 { 4059 4060 // Attach a single capturing handler while someone wants focusin/focusout 4061 var attaches = 0, 4062 handler = function (event) 4063 { 4064 jQuery.event.simulate(fix, event.target, jQuery.event.fix(event), true); 4065 }; 4066 4067 jQuery.event.special[ fix ] = { 4068 setup: function () 4069 { 4070 if (attaches++ === 0) 4071 { 4072 document.addEventListener(orig, handler, true); 4073 } 4074 }, 4075 teardown: function () 4076 { 4077 if (--attaches === 0) 4078 { 4079 document.removeEventListener(orig, handler, true); 4080 } 4081 } 4082 }; 4083 }); 4084 } 4085 4086 jQuery.fn.extend({ 4087 4088 on: function (types, selector, data, fn, /*INTERNAL*/ one) 4089 { 4090 var origFn, type; 4091 4092 // Types can be a map of types/handlers 4093 if (typeof types === "object") 4094 { 4095 // ( types-Object, selector, data ) 4096 if (typeof selector !== "string") 4097 { // && selector != null 4098 // ( types-Object, data ) 4099 data = data || selector; 4100 selector = undefined; 4101 } 4102 for (type in types) 4103 { 4104 this.on(type, selector, data, types[ type ], one); 4105 } 4106 return this; 4107 } 4108 4109 if (data == null && fn == null) 4110 { 4111 // ( types, fn ) 4112 fn = selector; 4113 data = selector = undefined; 4114 } else if (fn == null) 4115 { 4116 if (typeof selector === "string") 4117 { 4118 // ( types, selector, fn ) 4119 fn = data; 4120 data = undefined; 4121 } else 4122 { 4123 // ( types, data, fn ) 4124 fn = data; 4125 data = selector; 4126 selector = undefined; 4127 } 4128 } 4129 if (fn === false) 4130 { 4131 fn = returnFalse; 4132 } else if (!fn) 4133 { 4134 return this; 4135 } 4136 4137 if (one === 1) 4138 { 4139 origFn = fn; 4140 fn = function (event) 4141 { 4142 // Can use an empty set, since event contains the info 4143 jQuery().off(event); 4144 return origFn.apply(this, arguments); 4145 }; 4146 // Use same guid so caller can remove using origFn 4147 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 4148 } 4149 return this.each(function () 4150 { 4151 jQuery.event.add(this, types, fn, data, selector); 4152 }); 4153 }, 4154 one: function (types, selector, data, fn) 4155 { 4156 return this.on(types, selector, data, fn, 1); 4157 }, 4158 off: function (types, selector, fn) 4159 { 4160 var handleObj, type; 4161 if (types && types.preventDefault && types.handleObj) 4162 { 4163 // ( event ) dispatched jQuery.Event 4164 handleObj = types.handleObj; 4165 jQuery(types.delegateTarget).off( 4166 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, 4167 handleObj.selector, 4168 handleObj.handler 4169 ); 4170 return this; 4171 } 4172 if (typeof types === "object") 4173 { 4174 // ( types-object [, selector] ) 4175 for (type in types) 4176 { 4177 this.off(type, selector, types[ type ]); 4178 } 4179 return this; 4180 } 4181 if (selector === false || typeof selector === "function") 4182 { 4183 // ( types [, fn] ) 4184 fn = selector; 4185 selector = undefined; 4186 } 4187 if (fn === false) 4188 { 4189 fn = returnFalse; 4190 } 4191 return this.each(function () 4192 { 4193 jQuery.event.remove(this, types, fn, selector); 4194 }); 4195 }, 4196 4197 bind: function (types, data, fn) 4198 { 4199 return this.on(types, null, data, fn); 4200 }, 4201 unbind: function (types, fn) 4202 { 4203 return this.off(types, null, fn); 4204 }, 4205 4206 live: function (types, data, fn) 4207 { 4208 jQuery(this.context).on(types, this.selector, data, fn); 4209 return this; 4210 }, 4211 die: function (types, fn) 4212 { 4213 jQuery(this.context).off(types, this.selector || "**", fn); 4214 return this; 4215 }, 4216 4217 delegate: function (selector, types, data, fn) 4218 { 4219 return this.on(types, selector, data, fn); 4220 }, 4221 undelegate: function (selector, types, fn) 4222 { 4223 // ( namespace ) or ( selector, types [, fn] ) 4224 return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn); 4225 }, 4226 4227 trigger: function (type, data) 4228 { 4229 return this.each(function () 4230 { 4231 jQuery.event.trigger(type, data, this); 4232 }); 4233 }, 4234 triggerHandler: function (type, data) 4235 { 4236 if (this[0]) 4237 { 4238 return jQuery.event.trigger(type, data, this[0], true); 4239 } 4240 }, 4241 4242 toggle: function (fn) 4243 { 4244 // Save reference to arguments for access in closure 4245 var args = arguments, 4246 guid = fn.guid || jQuery.guid++, 4247 i = 0, 4248 toggler = function (event) 4249 { 4250 // Figure out which function to execute 4251 var lastToggle = ( jQuery._data(this, "lastToggle" + fn.guid) || 0 ) % i; 4252 jQuery._data(this, "lastToggle" + fn.guid, lastToggle + 1); 4253 4254 // Make sure that clicks stop 4255 event.preventDefault(); 4256 4257 // and execute the function 4258 return args[ lastToggle ].apply(this, arguments) || false; 4259 }; 4260 4261 // link all the functions, so any of them can unbind this click handler 4262 toggler.guid = guid; 4263 while (i < args.length) 4264 { 4265 args[ i++ ].guid = guid; 4266 } 4267 4268 return this.click(toggler); 4269 }, 4270 4271 hover: function (fnOver, fnOut) 4272 { 4273 return this.mouseenter(fnOver).mouseleave(fnOut || fnOver); 4274 } 4275 }); 4276 4277 jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick " + 4278 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 4279 "change select submit keydown keypress keyup error contextmenu").split(" "), function (i, name) 4280 { 4281 4282 // Handle event binding 4283 jQuery.fn[ name ] = function (data, fn) 4284 { 4285 if (fn == null) 4286 { 4287 fn = data; 4288 data = null; 4289 } 4290 4291 return arguments.length > 0 ? 4292 this.on(name, null, data, fn) : 4293 this.trigger(name); 4294 }; 4295 4296 if (rkeyEvent.test(name)) 4297 { 4298 jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; 4299 } 4300 4301 if (rmouseEvent.test(name)) 4302 { 4303 jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; 4304 } 4305 }); 4306 /*! 4307 * Sizzle CSS Selector Engine 4308 * Copyright 2012 jQuery Foundation and other contributors 4309 * Released under the MIT license 4310 * http://sizzlejs.com/ 4311 */ 4312 (function (window, undefined) 4313 { 4314 4315 var cachedruns, 4316 assertGetIdNotName, 4317 Expr, 4318 getText, 4319 isXML, 4320 contains, 4321 compile, 4322 sortOrder, 4323 hasDuplicate, 4324 outermostContext, 4325 4326 baseHasDuplicate = true, 4327 strundefined = "undefined", 4328 4329 expando = ( "sizcache" + Math.random() ).replace(".", ""), 4330 4331 Token = String, 4332 document = window.document, 4333 docElem = document.documentElement, 4334 dirruns = 0, 4335 done = 0, 4336 pop = [].pop, 4337 push = [].push, 4338 slice = [].slice, 4339 // Use a stripped-down indexOf if a native one is unavailable 4340 indexOf = [].indexOf || function (elem) 4341 { 4342 var i = 0, 4343 len = this.length; 4344 for (; i < len; i++) 4345 { 4346 if (this[i] === elem) 4347 { 4348 return i; 4349 } 4350 } 4351 return -1; 4352 }, 4353 4354 // Augment a function for special use by Sizzle 4355 markFunction = function (fn, value) 4356 { 4357 fn[ expando ] = value == null || value; 4358 return fn; 4359 }, 4360 4361 createCache = function () 4362 { 4363 var cache = {}, 4364 keys = []; 4365 4366 return markFunction(function (key, value) 4367 { 4368 // Only keep the most recent entries 4369 if (keys.push(key) > Expr.cacheLength) 4370 { 4371 delete cache[ keys.shift() ]; 4372 } 4373 4374 // Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157) 4375 return (cache[ key + " " ] = value); 4376 }, cache); 4377 }, 4378 4379 classCache = createCache(), 4380 tokenCache = createCache(), 4381 compilerCache = createCache(), 4382 4383 // Regex 4384 4385 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace 4386 whitespace = "[\\x20\\t\\r\\n\\f]", 4387 // http://www.w3.org/TR/css3-syntax/#characters 4388 characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", 4389 4390 // Loosely modeled on CSS identifier characters 4391 // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) 4392 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier 4393 identifier = characterEncoding.replace("w", "w#"), 4394 4395 // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors 4396 operators = "([*^$|!~]?=)", 4397 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + 4398 "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", 4399 4400 // Prefer arguments not in parens/brackets, 4401 // then attribute selectors and non-pseudos (denoted by :), 4402 // then anything else 4403 // These preferences are here to reduce the number of selectors 4404 // needing tokenize in the PSEUDO preFilter 4405 pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)", 4406 4407 // For matchExpr.POS and matchExpr.needsContext 4408 pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 4409 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", 4410 4411 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 4412 rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"), 4413 4414 rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), 4415 rcombinators = new RegExp("^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*"), 4416 rpseudo = new RegExp(pseudos), 4417 4418 // Easily-parseable/retrievable ID or TAG or CLASS selectors 4419 rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, 4420 4421 rnot = /^:not/, 4422 rsibling = /[\x20\t\r\n\f]*[+~]/, 4423 rendsWithNot = /:not\($/, 4424 4425 rheader = /h\d/i, 4426 rinputs = /input|select|textarea|button/i, 4427 4428 rbackslash = /\\(?!\\)/g, 4429 4430 matchExpr = { 4431 "ID": new RegExp("^#(" + characterEncoding + ")"), 4432 "CLASS": new RegExp("^\\.(" + characterEncoding + ")"), 4433 "NAME": new RegExp("^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]"), 4434 "TAG": new RegExp("^(" + characterEncoding.replace("w", "w*") + ")"), 4435 "ATTR": new RegExp("^" + attributes), 4436 "PSEUDO": new RegExp("^" + pseudos), 4437 "POS": new RegExp(pos, "i"), 4438 "CHILD": new RegExp("^:(only|nth|first|last)-child(?:\\(" + whitespace + 4439 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + 4440 "*(\\d+)|))" + whitespace + "*\\)|)", "i"), 4441 // For use in libraries implementing .is() 4442 "needsContext": new RegExp("^" + whitespace + "*[>+~]|" + pos, "i") 4443 }, 4444 4445 // Support 4446 4447 // Used for testing something on an element 4448 assert = function (fn) 4449 { 4450 var div = document.createElement("div"); 4451 4452 try 4453 { 4454 return fn(div); 4455 } catch (e) 4456 { 4457 return false; 4458 } finally 4459 { 4460 // release memory in IE 4461 div = null; 4462 } 4463 }, 4464 4465 // Check if getElementsByTagName("*") returns only elements 4466 assertTagNameNoComments = assert(function (div) 4467 { 4468 div.appendChild(document.createComment("")); 4469 return !div.getElementsByTagName("*").length; 4470 }), 4471 4472 // Check if getAttribute returns normalized href attributes 4473 assertHrefNotNormalized = assert(function (div) 4474 { 4475 div.innerHTML = "<a href='#'></a>"; 4476 return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && 4477 div.firstChild.getAttribute("href") === "#"; 4478 }), 4479 4480 // Check if attributes should be retrieved by attribute nodes 4481 assertAttributes = assert(function (div) 4482 { 4483 div.innerHTML = "<select></select>"; 4484 var type = typeof div.lastChild.getAttribute("multiple"); 4485 // IE8 returns a string for some attributes even when not present 4486 return type !== "boolean" && type !== "string"; 4487 }), 4488 4489 // Check if getElementsByClassName can be trusted 4490 assertUsableClassName = assert(function (div) 4491 { 4492 // Opera can't find a second classname (in 9.6) 4493 div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; 4494 if (!div.getElementsByClassName || !div.getElementsByClassName("e").length) 4495 { 4496 return false; 4497 } 4498 4499 // Safari 3.2 caches class attributes and doesn't catch changes 4500 div.lastChild.className = "e"; 4501 return div.getElementsByClassName("e").length === 2; 4502 }), 4503 4504 // Check if getElementById returns elements by name 4505 // Check if getElementsByName privileges form controls or returns elements by ID 4506 assertUsableName = assert(function (div) 4507 { 4508 // Inject content 4509 div.id = expando + 0; 4510 div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>"; 4511 docElem.insertBefore(div, docElem.firstChild); 4512 4513 // Test 4514 var pass = document.getElementsByName && 4515 // buggy browsers will return fewer than the correct 2 4516 document.getElementsByName(expando).length === 2 + 4517 // buggy browsers will return more than the correct 0 4518 document.getElementsByName(expando + 0).length; 4519 assertGetIdNotName = !document.getElementById(expando); 4520 4521 // Cleanup 4522 docElem.removeChild(div); 4523 4524 return pass; 4525 }); 4526 4527// If slice is not available, provide a backup 4528 try 4529 { 4530 slice.call(docElem.childNodes, 0)[0].nodeType; 4531 } catch (e) 4532 { 4533 slice = function (i) 4534 { 4535 var elem, 4536 results = []; 4537 for (; (elem = this[i]); i++) 4538 { 4539 results.push(elem); 4540 } 4541 return results; 4542 }; 4543 } 4544 4545 function Sizzle(selector, context, results, seed) 4546 { 4547 results = results || []; 4548 context = context || document; 4549 var match, elem, xml, m, 4550 nodeType = context.nodeType; 4551 4552 if (!selector || typeof selector !== "string") 4553 { 4554 return results; 4555 } 4556 4557 if (nodeType !== 1 && nodeType !== 9) 4558 { 4559 return []; 4560 } 4561 4562 xml = isXML(context); 4563 4564 if (!xml && !seed) 4565 { 4566 if ((match = rquickExpr.exec(selector))) 4567 { 4568 // Speed-up: Sizzle("#ID") 4569 if ((m = match[1])) 4570 { 4571 if (nodeType === 9) 4572 { 4573 elem = context.getElementById(m); 4574 // Check parentNode to catch when Blackberry 4.6 returns 4575 // nodes that are no longer in the document #6963 4576 if (elem && elem.parentNode) 4577 { 4578 // Handle the case where IE, Opera, and Webkit return items 4579 // by name instead of ID 4580 if (elem.id === m) 4581 { 4582 results.push(elem); 4583 return results; 4584 } 4585 } else 4586 { 4587 return results; 4588 } 4589 } else 4590 { 4591 // Context is not a document 4592 if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && 4593 contains(context, elem) && elem.id === m) 4594 { 4595 results.push(elem); 4596 return results; 4597 } 4598 } 4599 4600 // Speed-up: Sizzle("TAG") 4601 } else if (match[2]) 4602 { 4603 push.apply(results, slice.call(context.getElementsByTagName(selector), 0)); 4604 return results; 4605 4606 // Speed-up: Sizzle(".CLASS") 4607 } else if ((m = match[3]) && assertUsableClassName && context.getElementsByClassName) 4608 { 4609 push.apply(results, slice.call(context.getElementsByClassName(m), 0)); 4610 return results; 4611 } 4612 } 4613 } 4614 4615 // All others 4616 return select(selector.replace(rtrim, "$1"), context, results, seed, xml); 4617 } 4618 4619 Sizzle.matches = function (expr, elements) 4620 { 4621 return Sizzle(expr, null, null, elements); 4622 }; 4623 4624 Sizzle.matchesSelector = function (elem, expr) 4625 { 4626 return Sizzle(expr, null, null, [ elem ]).length > 0; 4627 }; 4628 4629// Returns a function to use in pseudos for input types 4630 function createInputPseudo(type) 4631 { 4632 return function (elem) 4633 { 4634 var name = elem.nodeName.toLowerCase(); 4635 return name === "input" && elem.type === type; 4636 }; 4637 } 4638 4639// Returns a function to use in pseudos for buttons 4640 function createButtonPseudo(type) 4641 { 4642 return function (elem) 4643 { 4644 var name = elem.nodeName.toLowerCase(); 4645 return (name === "input" || name === "button") && elem.type === type; 4646 }; 4647 } 4648 4649// Returns a function to use in pseudos for positionals 4650 function createPositionalPseudo(fn) 4651 { 4652 return markFunction(function (argument) 4653 { 4654 argument = +argument; 4655 return markFunction(function (seed, matches) 4656 { 4657 var j, 4658 matchIndexes = fn([], seed.length, argument), 4659 i = matchIndexes.length; 4660 4661 // Match elements found at the specified indexes 4662 while (i--) 4663 { 4664 if (seed[ (j = matchIndexes[i]) ]) 4665 { 4666 seed[j] = !(matches[j] = seed[j]); 4667 } 4668 } 4669 }); 4670 }); 4671 } 4672 4673 /** 4674 * Utility function for retrieving the text value of an array of DOM nodes 4675 * @param {Array|Element} elem 4676 */ 4677 getText = Sizzle.getText = function (elem) 4678 { 4679 var node, 4680 ret = "", 4681 i = 0, 4682 nodeType = elem.nodeType; 4683 4684 if (nodeType) 4685 { 4686 if (nodeType === 1 || nodeType === 9 || nodeType === 11) 4687 { 4688 // Use textContent for elements 4689 // innerText usage removed for consistency of new lines (see #11153) 4690 if (typeof elem.textContent === "string") 4691 { 4692 return elem.textContent; 4693 } else 4694 { 4695 // Traverse its children 4696 for (elem = elem.firstChild; elem; elem = elem.nextSibling) 4697 { 4698 ret += getText(elem); 4699 } 4700 } 4701 } else if (nodeType === 3 || nodeType === 4) 4702 { 4703 return elem.nodeValue; 4704 } 4705 // Do not include comment or processing instruction nodes 4706 } else 4707 { 4708 4709 // If no nodeType, this is expected to be an array 4710 for (; (node = elem[i]); i++) 4711 { 4712 // Do not traverse comment nodes 4713 ret += getText(node); 4714 } 4715 } 4716 return ret; 4717 }; 4718 4719 isXML = Sizzle.isXML = function (elem) 4720 { 4721 // documentElement is verified for cases where it doesn't yet exist 4722 // (such as loading iframes in IE - #4833) 4723 var documentElement = elem && (elem.ownerDocument || elem).documentElement; 4724 return documentElement ? documentElement.nodeName !== "HTML" : false; 4725 }; 4726 4727// Element contains another 4728 contains = Sizzle.contains = docElem.contains ? 4729 function (a, b) 4730 { 4731 var adown = a.nodeType === 9 ? a.documentElement : a, 4732 bup = b && b.parentNode; 4733 return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) ); 4734 } : 4735 docElem.compareDocumentPosition ? 4736 function (a, b) 4737 { 4738 return b && !!( a.compareDocumentPosition(b) & 16 ); 4739 } : 4740 function (a, b) 4741 { 4742 while ((b = b.parentNode)) 4743 { 4744 if (b === a) 4745 { 4746 return true; 4747 } 4748 } 4749 return false; 4750 }; 4751 4752 Sizzle.attr = function (elem, name) 4753 { 4754 var val, 4755 xml = isXML(elem); 4756 4757 if (!xml) 4758 { 4759 name = name.toLowerCase(); 4760 } 4761 if ((val = Expr.attrHandle[ name ])) 4762 { 4763 return val(elem); 4764 } 4765 if (xml || assertAttributes) 4766 { 4767 return elem.getAttribute(name); 4768 } 4769 val = elem.getAttributeNode(name); 4770 return val ? 4771 typeof elem[ name ] === "boolean" ? 4772 elem[ name ] ? name : null : 4773 val.specified ? val.value : null : 4774 null; 4775 }; 4776 4777 Expr = Sizzle.selectors = { 4778 4779 // Can be adjusted by the user 4780 cacheLength: 50, 4781 4782 createPseudo: markFunction, 4783 4784 match: matchExpr, 4785 4786 // IE6/7 return a modified href 4787 attrHandle: assertHrefNotNormalized ? 4788 {} : 4789 { 4790 "href": function (elem) 4791 { 4792 return elem.getAttribute("href", 2); 4793 }, 4794 "type": function (elem) 4795 { 4796 return elem.getAttribute("type"); 4797 } 4798 }, 4799 4800 find: { 4801 "ID": assertGetIdNotName ? 4802 function (id, context, xml) 4803 { 4804 if (typeof context.getElementById !== strundefined && !xml) 4805 { 4806 var m = context.getElementById(id); 4807 // Check parentNode to catch when Blackberry 4.6 returns 4808 // nodes that are no longer in the document #6963 4809 return m && m.parentNode ? [m] : []; 4810 } 4811 } : 4812 function (id, context, xml) 4813 { 4814 if (typeof context.getElementById !== strundefined && !xml) 4815 { 4816 var m = context.getElementById(id); 4817 4818 return m ? 4819 m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? 4820 [m] : 4821 undefined : 4822 []; 4823 } 4824 }, 4825 4826 "TAG": assertTagNameNoComments ? 4827 function (tag, context) 4828 { 4829 if (typeof context.getElementsByTagName !== strundefined) 4830 { 4831 return context.getElementsByTagName(tag); 4832 } 4833 } : 4834 function (tag, context) 4835 { 4836 var results = context.getElementsByTagName(tag); 4837 4838 // Filter out possible comments 4839 if (tag === "*") 4840 { 4841 var elem, 4842 tmp = [], 4843 i = 0; 4844 4845 for (; (elem = results[i]); i++) 4846 { 4847 if (elem.nodeType === 1) 4848 { 4849 tmp.push(elem); 4850 } 4851 } 4852 4853 return tmp; 4854 } 4855 return results; 4856 }, 4857 4858 "NAME": assertUsableName && function (tag, context) 4859 { 4860 if (typeof context.getElementsByName !== strundefined) 4861 { 4862 return context.getElementsByName(name); 4863 } 4864 }, 4865 4866 "CLASS": assertUsableClassName && function (className, context, xml) 4867 { 4868 if (typeof context.getElementsByClassName !== strundefined && !xml) 4869 { 4870 return context.getElementsByClassName(className); 4871 } 4872 } 4873 }, 4874 4875 relative: { 4876 ">": { dir: "parentNode", first: true }, 4877 " ": { dir: "parentNode" }, 4878 "+": { dir: "previousSibling", first: true }, 4879 "~": { dir: "previousSibling" } 4880 }, 4881 4882 preFilter: { 4883 "ATTR": function (match) 4884 { 4885 match[1] = match[1].replace(rbackslash, ""); 4886 4887 // Move the given value to match[3] whether quoted or unquoted 4888 match[3] = ( match[4] || match[5] || "" ).replace(rbackslash, ""); 4889 4890 if (match[2] === "~=") 4891 { 4892 match[3] = " " + match[3] + " "; 4893 } 4894 4895 return match.slice(0, 4); 4896 }, 4897 4898 "CHILD": function (match) 4899 { 4900 /* matches from matchExpr["CHILD"] 4901 1 type (only|nth|...) 4902 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4903 3 xn-component of xn+y argument ([+-]?\d*n|) 4904 4 sign of xn-component 4905 5 x of xn-component 4906 6 sign of y-component 4907 7 y of y-component 4908 */ 4909 match[1] = match[1].toLowerCase(); 4910 4911 if (match[1] === "nth") 4912 { 4913 // nth-child requires argument 4914 if (!match[2]) 4915 { 4916 Sizzle.error(match[0]); 4917 } 4918 4919 // numeric x and y parameters for Expr.filter.CHILD 4920 // remember that false/true cast respectively to 0/1 4921 match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) ); 4922 match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" ); 4923 4924 // other types prohibit arguments 4925 } else if (match[2]) 4926 { 4927 Sizzle.error(match[0]); 4928 } 4929 4930 return match; 4931 }, 4932 4933 "PSEUDO": function (match) 4934 { 4935 var unquoted, excess; 4936 if (matchExpr["CHILD"].test(match[0])) 4937 { 4938 return null; 4939 } 4940 4941 if (match[3]) 4942 { 4943 match[2] = match[3]; 4944 } else if ((unquoted = match[4])) 4945 { 4946 // Only check arguments that contain a pseudo 4947 if (rpseudo.test(unquoted) && 4948 // Get excess from tokenize (recursively) 4949 (excess = tokenize(unquoted, true)) && 4950 // advance to the next closing parenthesis 4951 (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) 4952 { 4953 4954 // excess is a negative index 4955 unquoted = unquoted.slice(0, excess); 4956 match[0] = match[0].slice(0, excess); 4957 } 4958 match[2] = unquoted; 4959 } 4960 4961 // Return only captures needed by the pseudo filter method (type and argument) 4962 return match.slice(0, 3); 4963 } 4964 }, 4965 4966 filter: { 4967 "ID": assertGetIdNotName ? 4968 function (id) 4969 { 4970 id = id.replace(rbackslash, ""); 4971 return function (elem) 4972 { 4973 return elem.getAttribute("id") === id; 4974 }; 4975 } : 4976 function (id) 4977 { 4978 id = id.replace(rbackslash, ""); 4979 return function (elem) 4980 { 4981 var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); 4982 return node && node.value === id; 4983 }; 4984 }, 4985 4986 "TAG": function (nodeName) 4987 { 4988 if (nodeName === "*") 4989 { 4990 return function () 4991 { 4992 return true; 4993 }; 4994 } 4995 nodeName = nodeName.replace(rbackslash, "").toLowerCase(); 4996 4997 return function (elem) 4998 { 4999 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 5000 }; 5001 }, 5002 5003 "CLASS": function (className) 5004 { 5005 var pattern = classCache[ expando ][ className + " " ]; 5006 5007 return pattern || 5008 (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && 5009 classCache(className, function (elem) 5010 { 5011 return pattern.test(elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || ""); 5012 }); 5013 }, 5014 5015 "ATTR": function (name, operator, check) 5016 { 5017 return function (elem, context) 5018 { 5019 var result = Sizzle.attr(elem, name); 5020 5021 if (result == null) 5022 { 5023 return operator === "!="; 5024 } 5025 if (!operator) 5026 { 5027 return true; 5028 } 5029 5030 result += ""; 5031 5032 return operator === "=" ? result === check : 5033 operator === "!=" ? result !== check : 5034 operator === "^=" ? check && result.indexOf(check) === 0 : 5035 operator === "*=" ? check && result.indexOf(check) > -1 : 5036 operator === "$=" ? check && result.substr(result.length - check.length) === check : 5037 operator === "~=" ? ( " " + result + " " ).indexOf(check) > -1 : 5038 operator === "|=" ? result === check || result.substr(0, check.length + 1) === check + "-" : 5039 false; 5040 }; 5041 }, 5042 5043 "CHILD": function (type, argument, first, last) 5044 { 5045 5046 if (type === "nth") 5047 { 5048 return function (elem) 5049 { 5050 var node, diff, 5051 parent = elem.parentNode; 5052 5053 if (first === 1 && last === 0) 5054 { 5055 return true; 5056 } 5057 5058 if (parent) 5059 { 5060 diff = 0; 5061 for (node = parent.firstChild; node; node = node.nextSibling) 5062 { 5063 if (node.nodeType === 1) 5064 { 5065 diff++; 5066 if (elem === node) 5067 { 5068 break; 5069 } 5070 } 5071 } 5072 } 5073 5074 // Incorporate the offset (or cast to NaN), then check against cycle size 5075 diff -= last; 5076 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 5077 }; 5078 } 5079 5080 return function (elem) 5081 { 5082 var node = elem; 5083 5084 switch (type) 5085 { 5086 case "only": 5087 case "first": 5088 while ((node = node.previousSibling)) 5089 { 5090 if (node.nodeType === 1) 5091 { 5092 return false; 5093 } 5094 } 5095 5096 if (type === "first") 5097 { 5098 return true; 5099 } 5100 5101 node = elem; 5102 5103 /* falls through */ 5104 case "last": 5105 while ((node = node.nextSibling)) 5106 { 5107 if (node.nodeType === 1) 5108 { 5109 return false; 5110 } 5111 } 5112 5113 return true; 5114 } 5115 }; 5116 }, 5117 5118 "PSEUDO": function (pseudo, argument) 5119 { 5120 // pseudo-class names are case-insensitive 5121 // http://www.w3.org/TR/selectors/#pseudo-classes 5122 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 5123 // Remember that setFilters inherits from pseudos 5124 var args, 5125 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 5126 Sizzle.error("unsupported pseudo: " + pseudo); 5127 5128 // The user may use createPseudo to indicate that 5129 // arguments are needed to create the filter function 5130 // just as Sizzle does 5131 if (fn[ expando ]) 5132 { 5133 return fn(argument); 5134 } 5135 5136 // But maintain support for old signatures 5137 if (fn.length > 1) 5138 { 5139 args = [ pseudo, pseudo, "", argument ]; 5140 return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? 5141 markFunction(function (seed, matches) 5142 { 5143 var idx, 5144 matched = fn(seed, argument), 5145 i = matched.length; 5146 while (i--) 5147 { 5148 idx = indexOf.call(seed, matched[i]); 5149 seed[ idx ] = !( matches[ idx ] = matched[i] ); 5150 } 5151 }) : 5152 function (elem) 5153 { 5154 return fn(elem, 0, args); 5155 }; 5156 } 5157 5158 return fn; 5159 } 5160 }, 5161 5162 pseudos: { 5163 "not": markFunction(function (selector) 5164 { 5165 // Trim the selector passed to compile 5166 // to avoid treating leading and trailing 5167 // spaces as combinators 5168 var input = [], 5169 results = [], 5170 matcher = compile(selector.replace(rtrim, "$1")); 5171 5172 return matcher[ expando ] ? 5173 markFunction(function (seed, matches, context, xml) 5174 { 5175 var elem, 5176 unmatched = matcher(seed, null, xml, []), 5177 i = seed.length; 5178 5179 // Match elements unmatched by `matcher` 5180 while (i--) 5181 { 5182 if ((elem = unmatched[i])) 5183 { 5184 seed[i] = !(matches[i] = elem); 5185 } 5186 } 5187 }) : 5188 function (elem, context, xml) 5189 { 5190 input[0] = elem; 5191 matcher(input, null, xml, results); 5192 return !results.pop(); 5193 }; 5194 }), 5195 5196 "has": markFunction(function (selector) 5197 { 5198 return function (elem) 5199 { 5200 return Sizzle(selector, elem).length > 0; 5201 }; 5202 }), 5203 5204 "contains": markFunction(function (text) 5205 { 5206 return function (elem) 5207 { 5208 return ( elem.textContent || elem.innerText || getText(elem) ).indexOf(text) > -1; 5209 }; 5210 }), 5211 5212 "enabled": function (elem) 5213 { 5214 return elem.disabled === false; 5215 }, 5216 5217 "disabled": function (elem) 5218 { 5219 return elem.disabled === true; 5220 }, 5221 5222 "checked": function (elem) 5223 { 5224 // In CSS3, :checked should return both checked and selected elements 5225 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 5226 var nodeName = elem.nodeName.toLowerCase(); 5227 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); 5228 }, 5229 5230 "selected": function (elem) 5231 { 5232 // Accessing this property makes selected-by-default 5233 // options in Safari work properly 5234 if (elem.parentNode) 5235 { 5236 elem.parentNode.selectedIndex; 5237 } 5238 5239 return elem.selected === true; 5240 }, 5241 5242 "parent": function (elem) 5243 { 5244 return !Expr.pseudos["empty"](elem); 5245 }, 5246 5247 "empty": function (elem) 5248 { 5249 // http://www.w3.org/TR/selectors/#empty-pseudo 5250 // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), 5251 // not comment, processing instructions, or others 5252 // Thanks to Diego Perini for the nodeName shortcut 5253 // Greater than "@" means alpha characters (specifically not starting with "#" or "?") 5254 var nodeType; 5255 elem = elem.firstChild; 5256 while (elem) 5257 { 5258 if (elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4) 5259 { 5260 return false; 5261 } 5262 elem = elem.nextSibling; 5263 } 5264 return true; 5265 }, 5266 5267 "header": function (elem) 5268 { 5269 return rheader.test(elem.nodeName); 5270 }, 5271 5272 "text": function (elem) 5273 { 5274 var type, attr; 5275 // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) 5276 // use getAttribute instead to test this case 5277 return elem.nodeName.toLowerCase() === "input" && 5278 (type = elem.type) === "text" && 5279 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type ); 5280 }, 5281 5282 // Input types 5283 "radio": createInputPseudo("radio"), 5284 "checkbox": createInputPseudo("checkbox"), 5285 "file": createInputPseudo("file"), 5286 "password": createInputPseudo("password"), 5287 "image": createInputPseudo("image"), 5288 5289 "submit": createButtonPseudo("submit"), 5290 "reset": createButtonPseudo("reset"), 5291 5292 "button": function (elem) 5293 { 5294 var name = elem.nodeName.toLowerCase(); 5295 return name === "input" && elem.type === "button" || name === "button"; 5296 }, 5297 5298 "input": function (elem) 5299 { 5300 return rinputs.test(elem.nodeName); 5301 }, 5302 5303 "focus": function (elem) 5304 { 5305 var doc = elem.ownerDocument; 5306 return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); 5307 }, 5308 5309 "active": function (elem) 5310 { 5311 return elem === elem.ownerDocument.activeElement; 5312 }, 5313 5314 // Positional types 5315 "first": createPositionalPseudo(function () 5316 { 5317 return [ 0 ]; 5318 }), 5319 5320 "last": createPositionalPseudo(function (matchIndexes, length) 5321 { 5322 return [ length - 1 ]; 5323 }), 5324 5325 "eq": createPositionalPseudo(function (matchIndexes, length, argument) 5326 { 5327 return [ argument < 0 ? argument + length : argument ]; 5328 }), 5329 5330 "even": createPositionalPseudo(function (matchIndexes, length) 5331 { 5332 for (var i = 0; i < length; i += 2) 5333 { 5334 matchIndexes.push(i); 5335 } 5336 return matchIndexes; 5337 }), 5338 5339 "odd": createPositionalPseudo(function (matchIndexes, length) 5340 { 5341 for (var i = 1; i < length; i += 2) 5342 { 5343 matchIndexes.push(i); 5344 } 5345 return matchIndexes; 5346 }), 5347 5348 "lt": createPositionalPseudo(function (matchIndexes, length, argument) 5349 { 5350 for (var i = argument < 0 ? argument + length : argument; --i >= 0;) 5351 { 5352 matchIndexes.push(i); 5353 } 5354 return matchIndexes; 5355 }), 5356 5357 "gt": createPositionalPseudo(function (matchIndexes, length, argument) 5358 { 5359 for (var i = argument < 0 ? argument + length : argument; ++i < length;) 5360 { 5361 matchIndexes.push(i); 5362 } 5363 return matchIndexes; 5364 }) 5365 } 5366 }; 5367 5368 function siblingCheck(a, b, ret) 5369 { 5370 if (a === b) 5371 { 5372 return ret; 5373 } 5374 5375 var cur = a.nextSibling; 5376 5377 while (cur) 5378 { 5379 if (cur === b) 5380 { 5381 return -1; 5382 } 5383 5384 cur = cur.nextSibling; 5385 } 5386 5387 return 1; 5388 } 5389 5390 sortOrder = docElem.compareDocumentPosition ? 5391 function (a, b) 5392 { 5393 if (a === b) 5394 { 5395 hasDuplicate = true; 5396 return 0; 5397 } 5398 5399 return ( !a.compareDocumentPosition || !b.compareDocumentPosition ? 5400 a.compareDocumentPosition : 5401 a.compareDocumentPosition(b) & 4 5402 ) ? -1 : 1; 5403 } : 5404 function (a, b) 5405 { 5406 // The nodes are identical, we can exit early 5407 if (a === b) 5408 { 5409 hasDuplicate = true; 5410 return 0; 5411 5412 // Fallback to using sourceIndex (in IE) if it's available on both nodes 5413 } else if (a.sourceIndex && b.sourceIndex) 5414 { 5415 return a.sourceIndex - b.sourceIndex; 5416 } 5417 5418 var al, bl, 5419 ap = [], 5420 bp = [], 5421 aup = a.parentNode, 5422 bup = b.parentNode, 5423 cur = aup; 5424 5425 // If the nodes are siblings (or identical) we can do a quick check 5426 if (aup === bup) 5427 { 5428 return siblingCheck(a, b); 5429 5430 // If no parents were found then the nodes are disconnected 5431 } else if (!aup) 5432 { 5433 return -1; 5434 5435 } else if (!bup) 5436 { 5437 return 1; 5438 } 5439 5440 // Otherwise they're somewhere else in the tree so we need 5441 // to build up a full list of the parentNodes for comparison 5442 while (cur) 5443 { 5444 ap.unshift(cur); 5445 cur = cur.parentNode; 5446 } 5447 5448 cur = bup; 5449 5450 while (cur) 5451 { 5452 bp.unshift(cur); 5453 cur = cur.parentNode; 5454 } 5455 5456 al = ap.length; 5457 bl = bp.length; 5458 5459 // Start walking down the tree looking for a discrepancy 5460 for (var i = 0; i < al && i < bl; i++) 5461 { 5462 if (ap[i] !== bp[i]) 5463 { 5464 return siblingCheck(ap[i], bp[i]); 5465 } 5466 } 5467 5468 // We ended someplace up the tree so do a sibling check 5469 return i === al ? 5470 siblingCheck(a, bp[i], -1) : 5471 siblingCheck(ap[i], b, 1); 5472 }; 5473 5474// Always assume the presence of duplicates if sort doesn't 5475// pass them to our comparison function (as in Google Chrome). 5476 [0, 0].sort(sortOrder); 5477 baseHasDuplicate = !hasDuplicate; 5478 5479// Document sorting and removing duplicates 5480 Sizzle.uniqueSort = function (results) 5481 { 5482 var elem, 5483 duplicates = [], 5484 i = 1, 5485 j = 0; 5486 5487 hasDuplicate = baseHasDuplicate; 5488 results.sort(sortOrder); 5489 5490 if (hasDuplicate) 5491 { 5492 for (; (elem = results[i]); i++) 5493 { 5494 if (elem === results[ i - 1 ]) 5495 { 5496 j = duplicates.push(i); 5497 } 5498 } 5499 while (j--) 5500 { 5501 results.splice(duplicates[ j ], 1); 5502 } 5503 } 5504 5505 return results; 5506 }; 5507 5508 Sizzle.error = function (msg) 5509 { 5510 throw new Error("Syntax error, unrecognized expression: " + msg); 5511 }; 5512 5513 function tokenize(selector, parseOnly) 5514 { 5515 var matched, match, tokens, type, 5516 soFar, groups, preFilters, 5517 cached = tokenCache[ expando ][ selector + " " ]; 5518 5519 if (cached) 5520 { 5521 return parseOnly ? 0 : cached.slice(0); 5522 } 5523 5524 soFar = selector; 5525 groups = []; 5526 preFilters = Expr.preFilter; 5527 5528 while (soFar) 5529 { 5530 5531 // Comma and first run 5532 if (!matched || (match = rcomma.exec(soFar))) 5533 { 5534 if (match) 5535 { 5536 // Don't consume trailing commas as valid 5537 soFar = soFar.slice(match[0].length) || soFar; 5538 } 5539 groups.push(tokens = []); 5540 } 5541 5542 matched = false; 5543 5544 // Combinators 5545 if ((match = rcombinators.exec(soFar))) 5546 { 5547 tokens.push(matched = new Token(match.shift())); 5548 soFar = soFar.slice(matched.length); 5549 5550 // Cast descendant combinators to space 5551 matched.type = match[0].replace(rtrim, " "); 5552 } 5553 5554 // Filters 5555 for (type in Expr.filter) 5556 { 5557 if ((match = matchExpr[ type ].exec(soFar)) && (!preFilters[ type ] || 5558 (match = preFilters[ type ](match)))) 5559 { 5560 5561 tokens.push(matched = new Token(match.shift())); 5562 soFar = soFar.slice(matched.length); 5563 matched.type = type; 5564 matched.matches = match; 5565 } 5566 } 5567 5568 if (!matched) 5569 { 5570 break; 5571 } 5572 } 5573 5574 // Return the length of the invalid excess 5575 // if we're just parsing 5576 // Otherwise, throw an error or return tokens 5577 return parseOnly ? 5578 soFar.length : 5579 soFar ? 5580 Sizzle.error(selector) : 5581 // Cache the tokens 5582 tokenCache(selector, groups).slice(0); 5583 } 5584 5585 function addCombinator(matcher, combinator, base) 5586 { 5587 var dir = combinator.dir, 5588 checkNonElements = base && combinator.dir === "parentNode", 5589 doneName = done++; 5590 5591 return combinator.first ? 5592 // Check against closest ancestor/preceding element 5593 function (elem, context, xml) 5594 { 5595 while ((elem = elem[ dir ])) 5596 { 5597 if (checkNonElements || elem.nodeType === 1) 5598 { 5599 return matcher(elem, context, xml); 5600 } 5601 } 5602 } : 5603 5604 // Check against all ancestor/preceding elements 5605 function (elem, context, xml) 5606 { 5607 // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching 5608 if (!xml) 5609 { 5610 var cache, 5611 dirkey = dirruns + " " + doneName + " ", 5612 cachedkey = dirkey + cachedruns; 5613 while ((elem = elem[ dir ])) 5614 { 5615 if (checkNonElements || elem.nodeType === 1) 5616 { 5617 if ((cache = elem[ expando ]) === cachedkey) 5618 { 5619 return elem.sizset; 5620 } else if (typeof cache === "string" && cache.indexOf(dirkey) === 0) 5621 { 5622 if (elem.sizset) 5623 { 5624 return elem; 5625 } 5626 } else 5627 { 5628 elem[ expando ] = cachedkey; 5629 if (matcher(elem, context, xml)) 5630 { 5631 elem.sizset = true; 5632 return elem; 5633 } 5634 elem.sizset = false; 5635 } 5636 } 5637 } 5638 } else 5639 { 5640 while ((elem = elem[ dir ])) 5641 { 5642 if (checkNonElements || elem.nodeType === 1) 5643 { 5644 if (matcher(elem, context, xml)) 5645 { 5646 return elem; 5647 } 5648 } 5649 } 5650 } 5651 }; 5652 } 5653 5654 function elementMatcher(matchers) 5655 { 5656 return matchers.length > 1 ? 5657 function (elem, context, xml) 5658 { 5659 var i = matchers.length; 5660 while (i--) 5661 { 5662 if (!matchers[i](elem, context, xml)) 5663 { 5664 return false; 5665 } 5666 } 5667 return true; 5668 } : 5669 matchers[0]; 5670 } 5671 5672 function condense(unmatched, map, filter, context, xml) 5673 { 5674 var elem, 5675 newUnmatched = [], 5676 i = 0, 5677 len = unmatched.length, 5678 mapped = map != null; 5679 5680 for (; i < len; i++) 5681 { 5682 if ((elem = unmatched[i])) 5683 { 5684 if (!filter || filter(elem, context, xml)) 5685 { 5686 newUnmatched.push(elem); 5687 if (mapped) 5688 { 5689 map.push(i); 5690 } 5691 } 5692 } 5693 } 5694 5695 return newUnmatched; 5696 } 5697 5698 function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) 5699 { 5700 if (postFilter && !postFilter[ expando ]) 5701 { 5702 postFilter = setMatcher(postFilter); 5703 } 5704 if (postFinder && !postFinder[ expando ]) 5705 { 5706 postFinder = setMatcher(postFinder, postSelector); 5707 } 5708 return markFunction(function (seed, results, context, xml) 5709 { 5710 var temp, i, elem, 5711 preMap = [], 5712 postMap = [], 5713 preexisting = results.length, 5714 5715 // Get initial elements from seed or context 5716 elems = seed || multipleContexts(selector || "*", context.nodeType ? [ context ] : context, []), 5717 5718 // Prefilter to get matcher input, preserving a map for seed-results synchronization 5719 matcherIn = preFilter && ( seed || !selector ) ? 5720 condense(elems, preMap, preFilter, context, xml) : 5721 elems, 5722 5723 matcherOut = matcher ? 5724 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 5725 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 5726 5727 // ...intermediate processing is necessary 5728 [] : 5729 5730 // ...otherwise use results directly 5731 results : 5732 matcherIn; 5733 5734 // Find primary matches 5735 if (matcher) 5736 { 5737 matcher(matcherIn, matcherOut, context, xml); 5738 } 5739 5740 // Apply postFilter 5741 if (postFilter) 5742 { 5743 temp = condense(matcherOut, postMap); 5744 postFilter(temp, [], context, xml); 5745 5746 // Un-match failing elements by moving them back to matcherIn 5747 i = temp.length; 5748 while (i--) 5749 { 5750 if ((elem = temp[i])) 5751 { 5752 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); 5753 } 5754 } 5755 } 5756 5757 if (seed) 5758 { 5759 if (postFinder || preFilter) 5760 { 5761 if (postFinder) 5762 { 5763 // Get the final matcherOut by condensing this intermediate into postFinder contexts 5764 temp = []; 5765 i = matcherOut.length; 5766 while (i--) 5767 { 5768 if ((elem = matcherOut[i])) 5769 { 5770 // Restore matcherIn since elem is not yet a final match 5771 temp.push((matcherIn[i] = elem)); 5772 } 5773 } 5774 postFinder(null, (matcherOut = []), temp, xml); 5775 } 5776 5777 // Move matched elements from seed to results to keep them synchronized 5778 i = matcherOut.length; 5779 while (i--) 5780 { 5781 if ((elem = matcherOut[i]) && 5782 (temp = postFinder ? indexOf.call(seed, elem) : preMap[i]) > -1) 5783 { 5784 5785 seed[temp] = !(results[temp] = elem); 5786 } 5787 } 5788 } 5789 5790 // Add elements to results, through postFinder if defined 5791 } else 5792 { 5793 matcherOut = condense( 5794 matcherOut === results ? 5795 matcherOut.splice(preexisting, matcherOut.length) : 5796 matcherOut 5797 ); 5798 if (postFinder) 5799 { 5800 postFinder(null, results, matcherOut, xml); 5801 } else 5802 { 5803 push.apply(results, matcherOut); 5804 } 5805 } 5806 }); 5807 } 5808 5809 function matcherFromTokens(tokens) 5810 { 5811 var checkContext, matcher, j, 5812 len = tokens.length, 5813 leadingRelative = Expr.relative[ tokens[0].type ], 5814 implicitRelative = leadingRelative || Expr.relative[" "], 5815 i = leadingRelative ? 1 : 0, 5816 5817 // The foundational matcher ensures that elements are reachable from top-level context(s) 5818 matchContext = addCombinator(function (elem) 5819 { 5820 return elem === checkContext; 5821 }, implicitRelative, true), 5822 matchAnyContext = addCombinator(function (elem) 5823 { 5824 return indexOf.call(checkContext, elem) > -1; 5825 }, implicitRelative, true), 5826 matchers = [ function (elem, context, xml) 5827 { 5828 return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 5829 (checkContext = context).nodeType ? 5830 matchContext(elem, context, xml) : 5831 matchAnyContext(elem, context, xml) ); 5832 } ]; 5833 5834 for (; i < len; i++) 5835 { 5836 if ((matcher = Expr.relative[ tokens[i].type ])) 5837 { 5838 matchers = [ addCombinator(elementMatcher(matchers), matcher) ]; 5839 } else 5840 { 5841 matcher = Expr.filter[ tokens[i].type ].apply(null, tokens[i].matches); 5842 5843 // Return special upon seeing a positional matcher 5844 if (matcher[ expando ]) 5845 { 5846 // Find the next relative operator (if any) for proper handling 5847 j = ++i; 5848 for (; j < len; j++) 5849 { 5850 if (Expr.relative[ tokens[j].type ]) 5851 { 5852 break; 5853 } 5854 } 5855 return setMatcher( 5856 i > 1 && elementMatcher(matchers), 5857 i > 1 && tokens.slice(0, i - 1).join("").replace(rtrim, "$1"), 5858 matcher, 5859 i < j && matcherFromTokens(tokens.slice(i, j)), 5860 j < len && matcherFromTokens((tokens = tokens.slice(j))), 5861 j < len && tokens.join("") 5862 ); 5863 } 5864 matchers.push(matcher); 5865 } 5866 } 5867 5868 return elementMatcher(matchers); 5869 } 5870 5871 function matcherFromGroupMatchers(elementMatchers, setMatchers) 5872 { 5873 var bySet = setMatchers.length > 0, 5874 byElement = elementMatchers.length > 0, 5875 superMatcher = function (seed, context, xml, results, expandContext) 5876 { 5877 var elem, j, matcher, 5878 setMatched = [], 5879 matchedCount = 0, 5880 i = "0", 5881 unmatched = seed && [], 5882 outermost = expandContext != null, 5883 contextBackup = outermostContext, 5884 // We must always have either seed elements or context 5885 elems = seed || byElement && Expr.find["TAG"]("*", expandContext && context.parentNode || context), 5886 // Nested matchers should use non-integer dirruns 5887 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); 5888 5889 if (outermost) 5890 { 5891 outermostContext = context !== document && context; 5892 cachedruns = superMatcher.el; 5893 } 5894 5895 // Add elements passing elementMatchers directly to results 5896 for (; (elem = elems[i]) != null; i++) 5897 { 5898 if (byElement && elem) 5899 { 5900 for (j = 0; (matcher = elementMatchers[j]); j++) 5901 { 5902 if (matcher(elem, context, xml)) 5903 { 5904 results.push(elem); 5905 break; 5906 } 5907 } 5908 if (outermost) 5909 { 5910 dirruns = dirrunsUnique; 5911 cachedruns = ++superMatcher.el; 5912 } 5913 } 5914 5915 // Track unmatched elements for set filters 5916 if (bySet) 5917 { 5918 // They will have gone through all possible matchers 5919 if ((elem = !matcher && elem)) 5920 { 5921 matchedCount--; 5922 } 5923 5924 // Lengthen the array for every element, matched or not 5925 if (seed) 5926 { 5927 unmatched.push(elem); 5928 } 5929 } 5930 } 5931 5932 // Apply set filters to unmatched elements 5933 matchedCount += i; 5934 if (bySet && i !== matchedCount) 5935 { 5936 for (j = 0; (matcher = setMatchers[j]); j++) 5937 { 5938 matcher(unmatched, setMatched, context, xml); 5939 } 5940 5941 if (seed) 5942 { 5943 // Reintegrate element matches to eliminate the need for sorting 5944 if (matchedCount > 0) 5945 { 5946 while (i--) 5947 { 5948 if (!(unmatched[i] || setMatched[i])) 5949 { 5950 setMatched[i] = pop.call(results); 5951 } 5952 } 5953 } 5954 5955 // Discard index placeholder values to get only actual matches 5956 setMatched = condense(setMatched); 5957 } 5958 5959 // Add matches to results 5960 push.apply(results, setMatched); 5961 5962 // Seedless set matches succeeding multiple successful matchers stipulate sorting 5963 if (outermost && !seed && setMatched.length > 0 && 5964 ( matchedCount + setMatchers.length ) > 1) 5965 { 5966 5967 Sizzle.uniqueSort(results); 5968 } 5969 } 5970 5971 // Override manipulation of globals by nested matchers 5972 if (outermost) 5973 { 5974 dirruns = dirrunsUnique; 5975 outermostContext = contextBackup; 5976 } 5977 5978 return unmatched; 5979 }; 5980 5981 superMatcher.el = 0; 5982 return bySet ? 5983 markFunction(superMatcher) : 5984 superMatcher; 5985 } 5986 5987 compile = Sizzle.compile = function (selector, group /* Internal Use Only */) 5988 { 5989 var i, 5990 setMatchers = [], 5991 elementMatchers = [], 5992 cached = compilerCache[ expando ][ selector + " " ]; 5993 5994 if (!cached) 5995 { 5996 // Generate a function of recursive functions that can be used to check each element 5997 if (!group) 5998 { 5999 group = tokenize(selector); 6000 } 6001 i = group.length; 6002 while (i--) 6003 { 6004 cached = matcherFromTokens(group[i]); 6005 if (cached[ expando ]) 6006 { 6007 setMatchers.push(cached); 6008 } else 6009 { 6010 elementMatchers.push(cached); 6011 } 6012 } 6013 6014 // Cache the compiled function 6015 cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers)); 6016 } 6017 return cached; 6018 }; 6019 6020 function multipleContexts(selector, contexts, results) 6021 { 6022 var i = 0, 6023 len = contexts.length; 6024 for (; i < len; i++) 6025 { 6026 Sizzle(selector, contexts[i], results); 6027 } 6028 return results; 6029 } 6030 6031 function select(selector, context, results, seed, xml) 6032 { 6033 var i, tokens, token, type, find, 6034 match = tokenize(selector), 6035 j = match.length; 6036 6037 if (!seed) 6038 { 6039 // Try to minimize operations if there is only one group 6040 if (match.length === 1) 6041 { 6042 6043 // Take a shortcut and set the context if the root selector is an ID 6044 tokens = match[0] = match[0].slice(0); 6045 if (tokens.length > 2 && (token = tokens[0]).type === "ID" && 6046 context.nodeType === 9 && !xml && 6047 Expr.relative[ tokens[1].type ]) 6048 { 6049 6050 context = Expr.find["ID"](token.matches[0].replace(rbackslash, ""), context, xml)[0]; 6051 if (!context) 6052 { 6053 return results; 6054 } 6055 6056 selector = selector.slice(tokens.shift().length); 6057 } 6058 6059 // Fetch a seed set for right-to-left matching 6060 for (i = matchExpr["POS"].test(selector) ? -1 : tokens.length - 1; i >= 0; i--) 6061 { 6062 token = tokens[i]; 6063 6064 // Abort if we hit a combinator 6065 if (Expr.relative[ (type = token.type) ]) 6066 { 6067 break; 6068 } 6069 if ((find = Expr.find[ type ])) 6070 { 6071 // Search, expanding context for leading sibling combinators 6072 if ((seed = find( 6073 token.matches[0].replace(rbackslash, ""), 6074 rsibling.test(tokens[0].type) && context.parentNode || context, 6075 xml 6076 ))) 6077 { 6078 6079 // If seed is empty or no tokens remain, we can return early 6080 tokens.splice(i, 1); 6081 selector = seed.length && tokens.join(""); 6082 if (!selector) 6083 { 6084 push.apply(results, slice.call(seed, 0)); 6085 return results; 6086 } 6087 6088 break; 6089 } 6090 } 6091 } 6092 } 6093 } 6094 6095 // Compile and execute a filtering function 6096 // Provide `match` to avoid retokenization if we modified the selector above 6097 compile(selector, match)( 6098 seed, 6099 context, 6100 xml, 6101 results, 6102 rsibling.test(selector) 6103 ); 6104 return results; 6105 } 6106 6107 if (document.querySelectorAll) 6108 { 6109 (function () 6110 { 6111 var disconnectedMatch, 6112 oldSelect = select, 6113 rescape = /'|\\/g, 6114 rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, 6115 6116 // qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA 6117 // A support test would require too much code (would include document ready) 6118 rbuggyQSA = [ ":focus" ], 6119 6120 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 6121 // A support test would require too much code (would include document ready) 6122 // just skip matchesSelector for :active 6123 rbuggyMatches = [ ":active" ], 6124 matches = docElem.matchesSelector || 6125 docElem.mozMatchesSelector || 6126 docElem.webkitMatchesSelector || 6127 docElem.oMatchesSelector || 6128 docElem.msMatchesSelector; 6129 6130 // Build QSA regex 6131 // Regex strategy adopted from Diego Perini 6132 assert(function (div) 6133 { 6134 // Select is set to empty string on purpose 6135 // This is to test IE's treatment of not explictly 6136 // setting a boolean content attribute, 6137 // since its presence should be enough 6138 // http://bugs.jquery.com/ticket/12359 6139 div.innerHTML = "<select><option selected=''></option></select>"; 6140 6141 // IE8 - Some boolean attributes are not treated correctly 6142 if (!div.querySelectorAll("[selected]").length) 6143 { 6144 rbuggyQSA.push("\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)"); 6145 } 6146 6147 // Webkit/Opera - :checked should return selected option elements 6148 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 6149 // IE8 throws error here (do not put tests after this one) 6150 if (!div.querySelectorAll(":checked").length) 6151 { 6152 rbuggyQSA.push(":checked"); 6153 } 6154 }); 6155 6156 assert(function (div) 6157 { 6158 6159 // Opera 10-12/IE9 - ^= $= *= and empty values 6160 // Should not select anything 6161 div.innerHTML = "<p test=''></p>"; 6162 if (div.querySelectorAll("[test^='']").length) 6163 { 6164 rbuggyQSA.push("[*^$]=" + whitespace + "*(?:\"\"|'')"); 6165 } 6166 6167 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 6168 // IE8 throws error here (do not put tests after this one) 6169 div.innerHTML = "<input type='hidden'/>"; 6170 if (!div.querySelectorAll(":enabled").length) 6171 { 6172 rbuggyQSA.push(":enabled", ":disabled"); 6173 } 6174 }); 6175 6176 // rbuggyQSA always contains :focus, so no need for a length check 6177 rbuggyQSA = /* rbuggyQSA.length && */ new RegExp(rbuggyQSA.join("|")); 6178 6179 select = function (selector, context, results, seed, xml) 6180 { 6181 // Only use querySelectorAll when not filtering, 6182 // when this is not xml, 6183 // and when no QSA bugs apply 6184 if (!seed && !xml && !rbuggyQSA.test(selector)) 6185 { 6186 var groups, i, 6187 old = true, 6188 nid = expando, 6189 newContext = context, 6190 newSelector = context.nodeType === 9 && selector; 6191 6192 // qSA works strangely on Element-rooted queries 6193 // We can work around this by specifying an extra ID on the root 6194 // and working up from there (Thanks to Andrew Dupont for the technique) 6195 // IE 8 doesn't work on object elements 6196 if (context.nodeType === 1 && context.nodeName.toLowerCase() !== "object") 6197 { 6198 groups = tokenize(selector); 6199 6200 if ((old = context.getAttribute("id"))) 6201 { 6202 nid = old.replace(rescape, "\\$&"); 6203 } else 6204 { 6205 context.setAttribute("id", nid); 6206 } 6207 nid = "[id='" + nid + "'] "; 6208 6209 i = groups.length; 6210 while (i--) 6211 { 6212 groups[i] = nid + groups[i].join(""); 6213 } 6214 newContext = rsibling.test(selector) && context.parentNode || context; 6215 newSelector = groups.join(","); 6216 } 6217 6218 if (newSelector) 6219 { 6220 try 6221 { 6222 push.apply(results, slice.call(newContext.querySelectorAll( 6223 newSelector 6224 ), 0)); 6225 return results; 6226 } catch (qsaError) 6227 { 6228 } finally 6229 { 6230 if (!old) 6231 { 6232 context.removeAttribute("id"); 6233 } 6234 } 6235 } 6236 } 6237 6238 return oldSelect(selector, context, results, seed, xml); 6239 }; 6240 6241 if (matches) 6242 { 6243 assert(function (div) 6244 { 6245 // Check to see if it's possible to do matchesSelector 6246 // on a disconnected node (IE 9) 6247 disconnectedMatch = matches.call(div, "div"); 6248 6249 // This should fail with an exception 6250 // Gecko does not error, returns false instead 6251 try 6252 { 6253 matches.call(div, "[test!='']:sizzle"); 6254 rbuggyMatches.push("!=", pseudos); 6255 } catch (e) 6256 { 6257 } 6258 }); 6259 6260 // rbuggyMatches always contains :active and :focus, so no need for a length check 6261 rbuggyMatches = /* rbuggyMatches.length && */ new RegExp(rbuggyMatches.join("|")); 6262 6263 Sizzle.matchesSelector = function (elem, expr) 6264 { 6265 // Make sure that attribute selectors are quoted 6266 expr = expr.replace(rattributeQuotes, "='$1']"); 6267 6268 // rbuggyMatches always contains :active, so no need for an existence check 6269 if (!isXML(elem) && !rbuggyMatches.test(expr) && !rbuggyQSA.test(expr)) 6270 { 6271 try 6272 { 6273 var ret = matches.call(elem, expr); 6274 6275 // IE 9's matchesSelector returns false on disconnected nodes 6276 if (ret || disconnectedMatch || 6277 // As well, disconnected nodes are said to be in a document 6278 // fragment in IE 9 6279 elem.document && elem.document.nodeType !== 11) 6280 { 6281 return ret; 6282 } 6283 } catch (e) 6284 { 6285 } 6286 } 6287 6288 return Sizzle(expr, null, null, [ elem ]).length > 0; 6289 }; 6290 } 6291 })(); 6292 } 6293 6294// Deprecated 6295 Expr.pseudos["nth"] = Expr.pseudos["eq"]; 6296 6297// Back-compat 6298 function setFilters() 6299 { 6300 } 6301 6302 Expr.filters = setFilters.prototype = Expr.pseudos; 6303 Expr.setFilters = new setFilters(); 6304 6305// Override sizzle attribute retrieval 6306 Sizzle.attr = jQuery.attr; 6307 jQuery.find = Sizzle; 6308 jQuery.expr = Sizzle.selectors; 6309 jQuery.expr[":"] = jQuery.expr.pseudos; 6310 jQuery.unique = Sizzle.uniqueSort; 6311 jQuery.text = Sizzle.getText; 6312 jQuery.isXMLDoc = Sizzle.isXML; 6313 jQuery.contains = Sizzle.contains; 6314 6315 6316 })(window); 6317 var runtil = /Until$/, 6318 rparentsprev = /^(?:parents|prev(?:Until|All))/, 6319 isSimple = /^.[^:#\[\.,]*$/, 6320 rneedsContext = jQuery.expr.match.needsContext, 6321 // methods guaranteed to produce a unique set when starting from a unique set 6322 guaranteedUnique = { 6323 children: true, 6324 contents: true, 6325 next: true, 6326 prev: true 6327 }; 6328 6329 jQuery.fn.extend({ 6330 find: function (selector) 6331 { 6332 var i, l, length, n, r, ret, 6333 self = this; 6334 6335 if (typeof selector !== "string") 6336 { 6337 return jQuery(selector).filter(function () 6338 { 6339 for (i = 0, l = self.length; i < l; i++) 6340 { 6341 if (jQuery.contains(self[ i ], this)) 6342 { 6343 return true; 6344 } 6345 } 6346 }); 6347 } 6348 6349 ret = this.pushStack("", "find", selector); 6350 6351 for (i = 0, l = this.length; i < l; i++) 6352 { 6353 length = ret.length; 6354 jQuery.find(selector, this[i], ret); 6355 6356 if (i > 0) 6357 { 6358 // Make sure that the results are unique 6359 for (n = length; n < ret.length; n++) 6360 { 6361 for (r = 0; r < length; r++) 6362 { 6363 if (ret[r] === ret[n]) 6364 { 6365 ret.splice(n--, 1); 6366 break; 6367 } 6368 } 6369 } 6370 } 6371 } 6372 6373 return ret; 6374 }, 6375 6376 has: function (target) 6377 { 6378 var i, 6379 targets = jQuery(target, this), 6380 len = targets.length; 6381 6382 return this.filter(function () 6383 { 6384 for (i = 0; i < len; i++) 6385 { 6386 if (jQuery.contains(this, targets[i])) 6387 { 6388 return true; 6389 } 6390 } 6391 }); 6392 }, 6393 6394 not: function (selector) 6395 { 6396 return this.pushStack(winnow(this, selector, false), "not", selector); 6397 }, 6398 6399 filter: function (selector) 6400 { 6401 return this.pushStack(winnow(this, selector, true), "filter", selector); 6402 }, 6403 6404 is: function (selector) 6405 { 6406 return !!selector && ( 6407 typeof selector === "string" ? 6408 // If this is a positional/relative selector, check membership in the returned set 6409 // so $("p:first").is("p:last") won't return true for a doc with two "p". 6410 rneedsContext.test(selector) ? 6411 jQuery(selector, this.context).index(this[0]) >= 0 : 6412 jQuery.filter(selector, this).length > 0 : 6413 this.filter(selector).length > 0 ); 6414 }, 6415 6416 closest: function (selectors, context) 6417 { 6418 var cur, 6419 i = 0, 6420 l = this.length, 6421 ret = [], 6422 pos = rneedsContext.test(selectors) || typeof selectors !== "string" ? 6423 jQuery(selectors, context || this.context) : 6424 0; 6425 6426 for (; i < l; i++) 6427 { 6428 cur = this[i]; 6429 6430 while (cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11) 6431 { 6432 if (pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors)) 6433 { 6434 ret.push(cur); 6435 break; 6436 } 6437 cur = cur.parentNode; 6438 } 6439 } 6440 6441 ret = ret.length > 1 ? jQuery.unique(ret) : ret; 6442 6443 return this.pushStack(ret, "closest", selectors); 6444 }, 6445 6446 // Determine the position of an element within 6447 // the matched set of elements 6448 index: function (elem) 6449 { 6450 6451 // No argument, return index in parent 6452 if (!elem) 6453 { 6454 return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; 6455 } 6456 6457 // index in selector 6458 if (typeof elem === "string") 6459 { 6460 return jQuery.inArray(this[0], jQuery(elem)); 6461 } 6462 6463 // Locate the position of the desired element 6464 return jQuery.inArray( 6465 // If it receives a jQuery object, the first element is used 6466 elem.jquery ? elem[0] : elem, this); 6467 }, 6468 6469 add: function (selector, context) 6470 { 6471 var set = typeof selector === "string" ? 6472 jQuery(selector, context) : 6473 jQuery.makeArray(selector && selector.nodeType ? [ selector ] : selector), 6474 all = jQuery.merge(this.get(), set); 6475 6476 return this.pushStack(isDisconnected(set[0]) || isDisconnected(all[0]) ? 6477 all : 6478 jQuery.unique(all)); 6479 }, 6480 6481 addBack: function (selector) 6482 { 6483 return this.add(selector == null ? 6484 this.prevObject : this.prevObject.filter(selector) 6485 ); 6486 } 6487 }); 6488 6489 jQuery.fn.andSelf = jQuery.fn.addBack; 6490 6491// A painfully simple check to see if an element is disconnected 6492// from a document (should be improved, where feasible). 6493 function isDisconnected(node) 6494 { 6495 return !node || !node.parentNode || node.parentNode.nodeType === 11; 6496 } 6497 6498 function sibling(cur, dir) 6499 { 6500 do { 6501 cur = cur[ dir ]; 6502 } while (cur && cur.nodeType !== 1); 6503 6504 return cur; 6505 } 6506 6507 jQuery.each({ 6508 parent: function (elem) 6509 { 6510 var parent = elem.parentNode; 6511 return parent && parent.nodeType !== 11 ? parent : null; 6512 }, 6513 parents: function (elem) 6514 { 6515 return jQuery.dir(elem, "parentNode"); 6516 }, 6517 parentsUntil: function (elem, i, until) 6518 { 6519 return jQuery.dir(elem, "parentNode", until); 6520 }, 6521 next: function (elem) 6522 { 6523 return sibling(elem, "nextSibling"); 6524 }, 6525 prev: function (elem) 6526 { 6527 return sibling(elem, "previousSibling"); 6528 }, 6529 nextAll: function (elem) 6530 { 6531 return jQuery.dir(elem, "nextSibling"); 6532 }, 6533 prevAll: function (elem) 6534 { 6535 return jQuery.dir(elem, "previousSibling"); 6536 }, 6537 nextUntil: function (elem, i, until) 6538 { 6539 return jQuery.dir(elem, "nextSibling", until); 6540 }, 6541 prevUntil: function (elem, i, until) 6542 { 6543 return jQuery.dir(elem, "previousSibling", until); 6544 }, 6545 siblings: function (elem) 6546 { 6547 return jQuery.sibling(( elem.parentNode || {} ).firstChild, elem); 6548 }, 6549 children: function (elem) 6550 { 6551 return jQuery.sibling(elem.firstChild); 6552 }, 6553 contents: function (elem) 6554 { 6555 return jQuery.nodeName(elem, "iframe") ? 6556 elem.contentDocument || elem.contentWindow.document : 6557 jQuery.merge([], elem.childNodes); 6558 } 6559 }, function (name, fn) 6560 { 6561 jQuery.fn[ name ] = function (until, selector) 6562 { 6563 var ret = jQuery.map(this, fn, until); 6564 6565 if (!runtil.test(name)) 6566 { 6567 selector = until; 6568 } 6569 6570 if (selector && typeof selector === "string") 6571 { 6572 ret = jQuery.filter(selector, ret); 6573 } 6574 6575 ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique(ret) : ret; 6576 6577 if (this.length > 1 && rparentsprev.test(name)) 6578 { 6579 ret = ret.reverse(); 6580 } 6581 6582 return this.pushStack(ret, name, core_slice.call(arguments).join(",")); 6583 }; 6584 }); 6585 6586 jQuery.extend({ 6587 filter: function (expr, elems, not) 6588 { 6589 if (not) 6590 { 6591 expr = ":not(" + expr + ")"; 6592 } 6593 6594 return elems.length === 1 ? 6595 jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : 6596 jQuery.find.matches(expr, elems); 6597 }, 6598 6599 dir: function (elem, dir, until) 6600 { 6601 var matched = [], 6602 cur = elem[ dir ]; 6603 6604 while (cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery(cur).is(until))) 6605 { 6606 if (cur.nodeType === 1) 6607 { 6608 matched.push(cur); 6609 } 6610 cur = cur[dir]; 6611 } 6612 return matched; 6613 }, 6614 6615 sibling: function (n, elem) 6616 { 6617 var r = []; 6618 6619 for (; n; n = n.nextSibling) 6620 { 6621 if (n.nodeType === 1 && n !== elem) 6622 { 6623 r.push(n); 6624 } 6625 } 6626 6627 return r; 6628 } 6629 }); 6630 6631// Implement the identical functionality for filter and not 6632 function winnow(elements, qualifier, keep) 6633 { 6634 6635 // Can't pass null or undefined to indexOf in Firefox 4 6636 // Set to 0 to skip string check 6637 qualifier = qualifier || 0; 6638 6639 if (jQuery.isFunction(qualifier)) 6640 { 6641 return jQuery.grep(elements, function (elem, i) 6642 { 6643 var retVal = !!qualifier.call(elem, i, elem); 6644 return retVal === keep; 6645 }); 6646 6647 } else if (qualifier.nodeType) 6648 { 6649 return jQuery.grep(elements, function (elem, i) 6650 { 6651 return ( elem === qualifier ) === keep; 6652 }); 6653 6654 } else if (typeof qualifier === "string") 6655 { 6656 var filtered = jQuery.grep(elements, function (elem) 6657 { 6658 return elem.nodeType === 1; 6659 }); 6660 6661 if (isSimple.test(qualifier)) 6662 { 6663 return jQuery.filter(qualifier, filtered, !keep); 6664 } else 6665 { 6666 qualifier = jQuery.filter(qualifier, filtered); 6667 } 6668 } 6669 6670 return jQuery.grep(elements, function (elem, i) 6671 { 6672 return ( jQuery.inArray(elem, qualifier) >= 0 ) === keep; 6673 }); 6674 } 6675 6676 function createSafeFragment(document) 6677 { 6678 var list = nodeNames.split("|"), 6679 safeFrag = document.createDocumentFragment(); 6680 6681 if (safeFrag.createElement) 6682 { 6683 while (list.length) 6684 { 6685 safeFrag.createElement( 6686 list.pop() 6687 ); 6688 } 6689 } 6690 return safeFrag; 6691 } 6692 6693 var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + 6694 "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", 6695 rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, 6696 rleadingWhitespace = /^\s+/, 6697 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, 6698 rtagName = /<([\w:]+)/, 6699 rtbody = /<tbody/i, 6700 rhtml = /<|&#?\w+;/, 6701 rnoInnerhtml = /<(?:script|style|link)/i, 6702 rnocache = /<(?:script|object|embed|option|style)/i, 6703 rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), 6704 rcheckableType = /^(?:checkbox|radio)$/, 6705 // checked="checked" or checked 6706 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 6707 rscriptType = /\/(java|ecma)script/i, 6708 rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g, 6709 wrapMap = { 6710 option: [ 1, "<select multiple='multiple'>", "</select>" ], 6711 legend: [ 1, "<fieldset>", "</fieldset>" ], 6712 thead: [ 1, "<table>", "</table>" ], 6713 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 6714 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 6715 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], 6716 area: [ 1, "<map>", "</map>" ], 6717 _default: [ 0, "", "" ] 6718 }, 6719 safeFragment = createSafeFragment(document), 6720 fragmentDiv = safeFragment.appendChild(document.createElement("div")); 6721 6722 wrapMap.optgroup = wrapMap.option; 6723 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 6724 wrapMap.th = wrapMap.td; 6725 6726// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, 6727// unless wrapped in a div with non-breaking characters in front of it. 6728 if (!jQuery.support.htmlSerialize) 6729 { 6730 wrapMap._default = [ 1, "X<div>", "</div>" ]; 6731 } 6732 6733 jQuery.fn.extend({ 6734 text: function (value) 6735 { 6736 return jQuery.access(this, function (value) 6737 { 6738 return value === undefined ? 6739 jQuery.text(this) : 6740 this.empty().append(( this[0] && this[0].ownerDocument || document ).createTextNode(value)); 6741 }, null, value, arguments.length); 6742 }, 6743 6744 wrapAll: function (html) 6745 { 6746 if (jQuery.isFunction(html)) 6747 { 6748 return this.each(function (i) 6749 { 6750 jQuery(this).wrapAll(html.call(this, i)); 6751 }); 6752 } 6753 6754 if (this[0]) 6755 { 6756 // The elements to wrap the target around 6757 var wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true); 6758 6759 if (this[0].parentNode) 6760 { 6761 wrap.insertBefore(this[0]); 6762 } 6763 6764 wrap.map(function () 6765 { 6766 var elem = this; 6767 6768 while (elem.firstChild && elem.firstChild.nodeType === 1) 6769 { 6770 elem = elem.firstChild; 6771 } 6772 6773 return elem; 6774 }).append(this); 6775 } 6776 6777 return this; 6778 }, 6779 6780 wrapInner: function (html) 6781 { 6782 if (jQuery.isFunction(html)) 6783 { 6784 return this.each(function (i) 6785 { 6786 jQuery(this).wrapInner(html.call(this, i)); 6787 }); 6788 } 6789 6790 return this.each(function () 6791 { 6792 var self = jQuery(this), 6793 contents = self.contents(); 6794 6795 if (contents.length) 6796 { 6797 contents.wrapAll(html); 6798 6799 } else 6800 { 6801 self.append(html); 6802 } 6803 }); 6804 }, 6805 6806 wrap: function (html) 6807 { 6808 var isFunction = jQuery.isFunction(html); 6809 6810 return this.each(function (i) 6811 { 6812 jQuery(this).wrapAll(isFunction ? html.call(this, i) : html); 6813 }); 6814 }, 6815 6816 unwrap: function () 6817 { 6818 return this.parent().each(function () 6819 { 6820 if (!jQuery.nodeName(this, "body")) 6821 { 6822 jQuery(this).replaceWith(this.childNodes); 6823 } 6824 }).end(); 6825 }, 6826 6827 append: function () 6828 { 6829 return this.domManip(arguments, true, function (elem) 6830 { 6831 if (this.nodeType === 1 || this.nodeType === 11) 6832 { 6833 this.appendChild(elem); 6834 } 6835 }); 6836 }, 6837 6838 prepend: function () 6839 { 6840 return this.domManip(arguments, true, function (elem) 6841 { 6842 if (this.nodeType === 1 || this.nodeType === 11) 6843 { 6844 this.insertBefore(elem, this.firstChild); 6845 } 6846 }); 6847 }, 6848 6849 before: function () 6850 { 6851 if (!isDisconnected(this[0])) 6852 { 6853 return this.domManip(arguments, false, function (elem) 6854 { 6855 this.parentNode.insertBefore(elem, this); 6856 }); 6857 } 6858 6859 if (arguments.length) 6860 { 6861 var set = jQuery.clean(arguments); 6862 return this.pushStack(jQuery.merge(set, this), "before", this.selector); 6863 } 6864 }, 6865 6866 after: function () 6867 { 6868 if (!isDisconnected(this[0])) 6869 { 6870 return this.domManip(arguments, false, function (elem) 6871 { 6872 this.parentNode.insertBefore(elem, this.nextSibling); 6873 }); 6874 } 6875 6876 if (arguments.length) 6877 { 6878 var set = jQuery.clean(arguments); 6879 return this.pushStack(jQuery.merge(this, set), "after", this.selector); 6880 } 6881 }, 6882 6883 // keepData is for internal use only--do not document 6884 remove: function (selector, keepData) 6885 { 6886 var elem, 6887 i = 0; 6888 6889 for (; (elem = this[i]) != null; i++) 6890 { 6891 if (!selector || jQuery.filter(selector, [ elem ]).length) 6892 { 6893 if (!keepData && elem.nodeType === 1) 6894 { 6895 jQuery.cleanData(elem.getElementsByTagName("*")); 6896 jQuery.cleanData([ elem ]); 6897 } 6898 6899 if (elem.parentNode) 6900 { 6901 elem.parentNode.removeChild(elem); 6902 } 6903 } 6904 } 6905 6906 return this; 6907 }, 6908 6909 empty: function () 6910 { 6911 var elem, 6912 i = 0; 6913 6914 for (; (elem = this[i]) != null; i++) 6915 { 6916 // Remove element nodes and prevent memory leaks 6917 if (elem.nodeType === 1) 6918 { 6919 jQuery.cleanData(elem.getElementsByTagName("*")); 6920 } 6921 6922 // Remove any remaining nodes 6923 while (elem.firstChild) 6924 { 6925 elem.removeChild(elem.firstChild); 6926 } 6927 } 6928 6929 return this; 6930 }, 6931 6932 clone: function (dataAndEvents, deepDataAndEvents) 6933 { 6934 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 6935 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 6936 6937 return this.map(function () 6938 { 6939 return jQuery.clone(this, dataAndEvents, deepDataAndEvents); 6940 }); 6941 }, 6942 6943 html: function (value) 6944 { 6945 return jQuery.access(this, function (value) 6946 { 6947 var elem = this[0] || {}, 6948 i = 0, 6949 l = this.length; 6950 6951 if (value === undefined) 6952 { 6953 return elem.nodeType === 1 ? 6954 elem.innerHTML.replace(rinlinejQuery, "") : 6955 undefined; 6956 } 6957 6958 // See if we can take a shortcut and just use innerHTML 6959 if (typeof value === "string" && !rnoInnerhtml.test(value) && 6960 ( jQuery.support.htmlSerialize || !rnoshimcache.test(value) ) && 6961 ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test(value) ) && !wrapMap[ ( rtagName.exec(value) || ["", ""] )[1].toLowerCase() ]) 6962 { 6963 6964 value = value.replace(rxhtmlTag, "<$1></$2>"); 6965 6966 try 6967 { 6968 for (; i < l; i++) 6969 { 6970 // Remove element nodes and prevent memory leaks 6971 elem = this[i] || {}; 6972 if (elem.nodeType === 1) 6973 { 6974 jQuery.cleanData(elem.getElementsByTagName("*")); 6975 elem.innerHTML = value; 6976 } 6977 } 6978 6979 elem = 0; 6980 6981 // If using innerHTML throws an exception, use the fallback method 6982 } catch (e) 6983 { 6984 } 6985 } 6986 6987 if (elem) 6988 { 6989 this.empty().append(value); 6990 } 6991 }, null, value, arguments.length); 6992 }, 6993 6994 replaceWith: function (value) 6995 { 6996 if (!isDisconnected(this[0])) 6997 { 6998 // Make sure that the elements are removed from the DOM before they are inserted 6999 // this can help fix replacing a parent with child elements 7000 if (jQuery.isFunction(value)) 7001 { 7002 return this.each(function (i) 7003 { 7004 var self = jQuery(this), old = self.html(); 7005 self.replaceWith(value.call(this, i, old)); 7006 }); 7007 } 7008 7009 if (typeof value !== "string") 7010 { 7011 value = jQuery(value).detach(); 7012 } 7013 7014 return this.each(function () 7015 { 7016 var next = this.nextSibling, 7017 parent = this.parentNode; 7018 7019 jQuery(this).remove(); 7020 7021 if (next) 7022 { 7023 jQuery(next).before(value); 7024 } else 7025 { 7026 jQuery(parent).append(value); 7027 } 7028 }); 7029 } 7030 7031 return this.length ? 7032 this.pushStack(jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value) : 7033 this; 7034 }, 7035 7036 detach: function (selector) 7037 { 7038 return this.remove(selector, true); 7039 }, 7040 7041 domManip: function (args, table, callback) 7042 { 7043 7044 // Flatten any nested arrays 7045 args = [].concat.apply([], args); 7046 7047 var results, first, fragment, iNoClone, 7048 i = 0, 7049 value = args[0], 7050 scripts = [], 7051 l = this.length; 7052 7053 // We can't cloneNode fragments that contain checked, in WebKit 7054 if (!jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test(value)) 7055 { 7056 return this.each(function () 7057 { 7058 jQuery(this).domManip(args, table, callback); 7059 }); 7060 } 7061 7062 if (jQuery.isFunction(value)) 7063 { 7064 return this.each(function (i) 7065 { 7066 var self = jQuery(this); 7067 args[0] = value.call(this, i, table ? self.html() : undefined); 7068 self.domManip(args, table, callback); 7069 }); 7070 } 7071 7072 if (this[0]) 7073 { 7074 results = jQuery.buildFragment(args, this, scripts); 7075 fragment = results.fragment; 7076 first = fragment.firstChild; 7077 7078 if (fragment.childNodes.length === 1) 7079 { 7080 fragment = first; 7081 } 7082 7083 if (first) 7084 { 7085 table = table && jQuery.nodeName(first, "tr"); 7086 7087 // Use the original fragment for the last item instead of the first because it can end up 7088 // being emptied incorrectly in certain situations (#8070). 7089 // Fragments from the fragment cache must always be cloned and never used in place. 7090 for (iNoClone = results.cacheable || l - 1; i < l; i++) 7091 { 7092 callback.call( 7093 table && jQuery.nodeName(this[i], "table") ? 7094 findOrAppend(this[i], "tbody") : 7095 this[i], 7096 i === iNoClone ? 7097 fragment : 7098 jQuery.clone(fragment, true, true) 7099 ); 7100 } 7101 } 7102 7103 // Fix #11809: Avoid leaking memory 7104 fragment = first = null; 7105 7106 if (scripts.length) 7107 { 7108 jQuery.each(scripts, function (i, elem) 7109 { 7110 if (elem.src) 7111 { 7112 if (jQuery.ajax) 7113 { 7114 jQuery.ajax({ 7115 url: elem.src, 7116 type: "GET", 7117 dataType: "script", 7118 async: false, 7119 global: false, 7120 "throws": true 7121 }); 7122 } else 7123 { 7124 jQuery.error("no ajax"); 7125 } 7126 } else 7127 { 7128 jQuery.globalEval(( elem.text || elem.textContent || elem.innerHTML || "" ).replace(rcleanScript, "")); 7129 } 7130 7131 if (elem.parentNode) 7132 { 7133 elem.parentNode.removeChild(elem); 7134 } 7135 }); 7136 } 7137 } 7138 7139 return this; 7140 } 7141 }); 7142 7143 function findOrAppend(elem, tag) 7144 { 7145 return elem.getElementsByTagName(tag)[0] || elem.appendChild(elem.ownerDocument.createElement(tag)); 7146 } 7147 7148 function cloneCopyEvent(src, dest) 7149 { 7150 7151 if (dest.nodeType !== 1 || !jQuery.hasData(src)) 7152 { 7153 return; 7154 } 7155 7156 var type, i, l, 7157 oldData = jQuery._data(src), 7158 curData = jQuery._data(dest, oldData), 7159 events = oldData.events; 7160 7161 if (events) 7162 { 7163 delete curData.handle; 7164 curData.events = {}; 7165 7166 for (type in events) 7167 { 7168 for (i = 0, l = events[ type ].length; i < l; i++) 7169 { 7170 jQuery.event.add(dest, type, events[ type ][ i ]); 7171 } 7172 } 7173 } 7174 7175 // make the cloned public data object a copy from the original 7176 if (curData.data) 7177 { 7178 curData.data = jQuery.extend({}, curData.data); 7179 } 7180 } 7181 7182 function cloneFixAttributes(src, dest) 7183 { 7184 var nodeName; 7185 7186 // We do not need to do anything for non-Elements 7187 if (dest.nodeType !== 1) 7188 { 7189 return; 7190 } 7191 7192 // clearAttributes removes the attributes, which we don't want, 7193 // but also removes the attachEvent events, which we *do* want 7194 if (dest.clearAttributes) 7195 { 7196 dest.clearAttributes(); 7197 } 7198 7199 // mergeAttributes, in contrast, only merges back on the 7200 // original attributes, not the events 7201 if (dest.mergeAttributes) 7202 { 7203 dest.mergeAttributes(src); 7204 } 7205 7206 nodeName = dest.nodeName.toLowerCase(); 7207 7208 if (nodeName === "object") 7209 { 7210 // IE6-10 improperly clones children of object elements using classid. 7211 // IE10 throws NoModificationAllowedError if parent is null, #12132. 7212 if (dest.parentNode) 7213 { 7214 dest.outerHTML = src.outerHTML; 7215 } 7216 7217 // This path appears unavoidable for IE9. When cloning an object 7218 // element in IE9, the outerHTML strategy above is not sufficient. 7219 // If the src has innerHTML and the destination does not, 7220 // copy the src.innerHTML into the dest.innerHTML. #10324 7221 if (jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML))) 7222 { 7223 dest.innerHTML = src.innerHTML; 7224 } 7225 7226 } else if (nodeName === "input" && rcheckableType.test(src.type)) 7227 { 7228 // IE6-8 fails to persist the checked state of a cloned checkbox 7229 // or radio button. Worse, IE6-7 fail to give the cloned element 7230 // a checked appearance if the defaultChecked value isn't also set 7231 7232 dest.defaultChecked = dest.checked = src.checked; 7233 7234 // IE6-7 get confused and end up setting the value of a cloned 7235 // checkbox/radio button to an empty string instead of "on" 7236 if (dest.value !== src.value) 7237 { 7238 dest.value = src.value; 7239 } 7240 7241 // IE6-8 fails to return the selected option to the default selected 7242 // state when cloning options 7243 } else if (nodeName === "option") 7244 { 7245 dest.selected = src.defaultSelected; 7246 7247 // IE6-8 fails to set the defaultValue to the correct value when 7248 // cloning other types of input fields 7249 } else if (nodeName === "input" || nodeName === "textarea") 7250 { 7251 dest.defaultValue = src.defaultValue; 7252 7253 // IE blanks contents when cloning scripts 7254 } else if (nodeName === "script" && dest.text !== src.text) 7255 { 7256 dest.text = src.text; 7257 } 7258 7259 // Event data gets referenced instead of copied if the expando 7260 // gets copied too 7261 dest.removeAttribute(jQuery.expando); 7262 } 7263 7264 jQuery.buildFragment = function (args, context, scripts) 7265 { 7266 var fragment, cacheable, cachehit, 7267 first = args[ 0 ]; 7268 7269 // Set context from what may come in as undefined or a jQuery collection or a node 7270 // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 & 7271 // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception 7272 context = context || document; 7273 context = !context.nodeType && context[0] || context; 7274 context = context.ownerDocument || context; 7275 7276 // Only cache "small" (1/2 KB) HTML strings that are associated with the main document 7277 // Cloning options loses the selected state, so don't cache them 7278 // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment 7279 // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache 7280 // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 7281 if (args.length === 1 && typeof first === "string" && first.length < 512 && context === document && 7282 first.charAt(0) === "<" && !rnocache.test(first) && 7283 (jQuery.support.checkClone || !rchecked.test(first)) && 7284 (jQuery.support.html5Clone || !rnoshimcache.test(first))) 7285 { 7286 7287 // Mark cacheable and look for a hit 7288 cacheable = true; 7289 fragment = jQuery.fragments[ first ]; 7290 cachehit = fragment !== undefined; 7291 } 7292 7293 if (!fragment) 7294 { 7295 fragment = context.createDocumentFragment(); 7296 jQuery.clean(args, context, fragment, scripts); 7297 7298 // Update the cache, but only store false 7299 // unless this is a second parsing of the same content 7300 if (cacheable) 7301 { 7302 jQuery.fragments[ first ] = cachehit && fragment; 7303 } 7304 } 7305 7306 return { fragment: fragment, cacheable: cacheable }; 7307 }; 7308 7309 jQuery.fragments = {}; 7310 7311 jQuery.each({ 7312 appendTo: "append", 7313 prependTo: "prepend", 7314 insertBefore: "before", 7315 insertAfter: "after", 7316 replaceAll: "replaceWith" 7317 }, function (name, original) 7318 { 7319 jQuery.fn[ name ] = function (selector) 7320 { 7321 var elems, 7322 i = 0, 7323 ret = [], 7324 insert = jQuery(selector), 7325 l = insert.length, 7326 parent = this.length === 1 && this[0].parentNode; 7327 7328 if ((parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1) 7329 { 7330 insert[ original ](this[0]); 7331 return this; 7332 } else 7333 { 7334 for (; i < l; i++) 7335 { 7336 elems = ( i > 0 ? this.clone(true) : this ).get(); 7337 jQuery(insert[i])[ original ](elems); 7338 ret = ret.concat(elems); 7339 } 7340 7341 return this.pushStack(ret, name, insert.selector); 7342 } 7343 }; 7344 }); 7345 7346 function getAll(elem) 7347 { 7348 if (typeof elem.getElementsByTagName !== "undefined") 7349 { 7350 return elem.getElementsByTagName("*"); 7351 7352 } else if (typeof elem.querySelectorAll !== "undefined") 7353 { 7354 return elem.querySelectorAll("*"); 7355 7356 } else 7357 { 7358 return []; 7359 } 7360 } 7361 7362// Used in clean, fixes the defaultChecked property 7363 function fixDefaultChecked(elem) 7364 { 7365 if (rcheckableType.test(elem.type)) 7366 { 7367 elem.defaultChecked = elem.checked; 7368 } 7369 } 7370 7371 jQuery.extend({ 7372 clone: function (elem, dataAndEvents, deepDataAndEvents) 7373 { 7374 var srcElements, 7375 destElements, 7376 i, 7377 clone; 7378 7379 if (jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test("<" + elem.nodeName + ">")) 7380 { 7381 clone = elem.cloneNode(true); 7382 7383 // IE<=8 does not properly clone detached, unknown element nodes 7384 } else 7385 { 7386 fragmentDiv.innerHTML = elem.outerHTML; 7387 fragmentDiv.removeChild(clone = fragmentDiv.firstChild); 7388 } 7389 7390 if ((!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && 7391 (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) 7392 { 7393 // IE copies events bound via attachEvent when using cloneNode. 7394 // Calling detachEvent on the clone will also remove the events 7395 // from the original. In order to get around this, we use some 7396 // proprietary methods to clear the events. Thanks to MooTools 7397 // guys for this hotness. 7398 7399 cloneFixAttributes(elem, clone); 7400 7401 // Using Sizzle here is crazy slow, so we use getElementsByTagName instead 7402 srcElements = getAll(elem); 7403 destElements = getAll(clone); 7404 7405 // Weird iteration because IE will replace the length property 7406 // with an element if you are cloning the body and one of the 7407 // elements on the page has a name or id of "length" 7408 for (i = 0; srcElements[i]; ++i) 7409 { 7410 // Ensure that the destination node is not null; Fixes #9587 7411 if (destElements[i]) 7412 { 7413 cloneFixAttributes(srcElements[i], destElements[i]); 7414 } 7415 } 7416 } 7417 7418 // Copy the events from the original to the clone 7419 if (dataAndEvents) 7420 { 7421 cloneCopyEvent(elem, clone); 7422 7423 if (deepDataAndEvents) 7424 { 7425 srcElements = getAll(elem); 7426 destElements = getAll(clone); 7427 7428 for (i = 0; srcElements[i]; ++i) 7429 { 7430 cloneCopyEvent(srcElements[i], destElements[i]); 7431 } 7432 } 7433 } 7434 7435 srcElements = destElements = null; 7436 7437 // Return the cloned set 7438 return clone; 7439 }, 7440 7441 clean: function (elems, context, fragment, scripts) 7442 { 7443 var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags, 7444 safe = context === document && safeFragment, 7445 ret = []; 7446 7447 // Ensure that context is a document 7448 if (!context || typeof context.createDocumentFragment === "undefined") 7449 { 7450 context = document; 7451 } 7452 7453 // Use the already-created safe fragment if context permits 7454 for (i = 0; (elem = elems[i]) != null; i++) 7455 { 7456 if (typeof elem === "number") 7457 { 7458 elem += ""; 7459 } 7460 7461 if (!elem) 7462 { 7463 continue; 7464 } 7465 7466 // Convert html string into DOM nodes 7467 if (typeof elem === "string") 7468 { 7469 if (!rhtml.test(elem)) 7470 { 7471 elem = context.createTextNode(elem); 7472 } else 7473 { 7474 // Ensure a safe container in which to render the html 7475 safe = safe || createSafeFragment(context); 7476 div = context.createElement("div"); 7477 safe.appendChild(div); 7478 7479 // Fix "XHTML"-style tags in all browsers 7480 elem = elem.replace(rxhtmlTag, "<$1></$2>"); 7481 7482 // Go to html and back, then peel off extra wrappers 7483 tag = ( rtagName.exec(elem) || ["", ""] )[1].toLowerCase(); 7484 wrap = wrapMap[ tag ] || wrapMap._default; 7485 depth = wrap[0]; 7486 div.innerHTML = wrap[1] + elem + wrap[2]; 7487 7488 // Move to the right depth 7489 while (depth--) 7490 { 7491 div = div.lastChild; 7492 } 7493 7494 // Remove IE's autoinserted <tbody> from table fragments 7495 if (!jQuery.support.tbody) 7496 { 7497 7498 // String was a <table>, *may* have spurious <tbody> 7499 hasBody = rtbody.test(elem); 7500 tbody = tag === "table" && !hasBody ? 7501 div.firstChild && div.firstChild.childNodes : 7502 7503 // String was a bare <thead> or <tfoot> 7504 wrap[1] === "<table>" && !hasBody ? 7505 div.childNodes : 7506 []; 7507 7508 for (j = tbody.length - 1; j >= 0; --j) 7509 { 7510 if (jQuery.nodeName(tbody[ j ], "tbody") && !tbody[ j ].childNodes.length) 7511 { 7512 tbody[ j ].parentNode.removeChild(tbody[ j ]); 7513 } 7514 } 7515 } 7516 7517 // IE completely kills leading whitespace when innerHTML is used 7518 if (!jQuery.support.leadingWhitespace && rleadingWhitespace.test(elem)) 7519 { 7520 div.insertBefore(context.createTextNode(rleadingWhitespace.exec(elem)[0]), div.firstChild); 7521 } 7522 7523 elem = div.childNodes; 7524 7525 // Take out of fragment container (we need a fresh div each time) 7526 div.parentNode.removeChild(div); 7527 } 7528 } 7529 7530 if (elem.nodeType) 7531 { 7532 ret.push(elem); 7533 } else 7534 { 7535 jQuery.merge(ret, elem); 7536 } 7537 } 7538 7539 // Fix #11356: Clear elements from safeFragment 7540 if (div) 7541 { 7542 elem = div = safe = null; 7543 } 7544 7545 // Reset defaultChecked for any radios and checkboxes 7546 // about to be appended to the DOM in IE 6/7 (#8060) 7547 if (!jQuery.support.appendChecked) 7548 { 7549 for (i = 0; (elem = ret[i]) != null; i++) 7550 { 7551 if (jQuery.nodeName(elem, "input")) 7552 { 7553 fixDefaultChecked(elem); 7554 } else if (typeof elem.getElementsByTagName !== "undefined") 7555 { 7556 jQuery.grep(elem.getElementsByTagName("input"), fixDefaultChecked); 7557 } 7558 } 7559 } 7560 7561 // Append elements to a provided document fragment 7562 if (fragment) 7563 { 7564 // Special handling of each script element 7565 handleScript = function (elem) 7566 { 7567 // Check if we consider it executable 7568 if (!elem.type || rscriptType.test(elem.type)) 7569 { 7570 // Detach the script and store it in the scripts array (if provided) or the fragment 7571 // Return truthy to indicate that it has been handled 7572 return scripts ? 7573 scripts.push(elem.parentNode ? elem.parentNode.removeChild(elem) : elem) : 7574 fragment.appendChild(elem); 7575 } 7576 }; 7577 7578 for (i = 0; (elem = ret[i]) != null; i++) 7579 { 7580 // Check if we're done after handling an executable script 7581 if (!( jQuery.nodeName(elem, "script") && handleScript(elem) )) 7582 { 7583 // Append to fragment and handle embedded scripts 7584 fragment.appendChild(elem); 7585 if (typeof elem.getElementsByTagName !== "undefined") 7586 { 7587 // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration 7588 jsTags = jQuery.grep(jQuery.merge([], elem.getElementsByTagName("script")), handleScript); 7589 7590 // Splice the scripts into ret after their former ancestor and advance our index beyond them 7591 ret.splice.apply(ret, [i + 1, 0].concat(jsTags)); 7592 i += jsTags.length; 7593 } 7594 } 7595 } 7596 } 7597 7598 return ret; 7599 }, 7600 7601 cleanData: function (elems, /* internal */ acceptData) 7602 { 7603 var data, id, elem, type, 7604 i = 0, 7605 internalKey = jQuery.expando, 7606 cache = jQuery.cache, 7607 deleteExpando = jQuery.support.deleteExpando, 7608 special = jQuery.event.special; 7609 7610 for (; (elem = elems[i]) != null; i++) 7611 { 7612 7613 if (acceptData || jQuery.acceptData(elem)) 7614 { 7615 7616 id = elem[ internalKey ]; 7617 data = id && cache[ id ]; 7618 7619 if (data) 7620 { 7621 if (data.events) 7622 { 7623 for (type in data.events) 7624 { 7625 if (special[ type ]) 7626 { 7627 jQuery.event.remove(elem, type); 7628 7629 // This is a shortcut to avoid jQuery.event.remove's overhead 7630 } else 7631 { 7632 jQuery.removeEvent(elem, type, data.handle); 7633 } 7634 } 7635 } 7636 7637 // Remove cache only if it was not already removed by jQuery.event.remove 7638 if (cache[ id ]) 7639 { 7640 7641 delete cache[ id ]; 7642 7643 // IE does not allow us to delete expando properties from nodes, 7644 // nor does it have a removeAttribute function on Document nodes; 7645 // we must handle all of these cases 7646 if (deleteExpando) 7647 { 7648 delete elem[ internalKey ]; 7649 7650 } else if (elem.removeAttribute) 7651 { 7652 elem.removeAttribute(internalKey); 7653 7654 } else 7655 { 7656 elem[ internalKey ] = null; 7657 } 7658 7659 jQuery.deletedIds.push(id); 7660 } 7661 } 7662 } 7663 } 7664 } 7665 }); 7666// Limit scope pollution from any deprecated API 7667 (function () 7668 { 7669 7670 var matched, browser; 7671 7672// Use of jQuery.browser is frowned upon. 7673// More details: http://api.jquery.com/jQuery.browser 7674// jQuery.uaMatch maintained for back-compat 7675 jQuery.uaMatch = function (ua) 7676 { 7677 ua = ua.toLowerCase(); 7678 7679 var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || 7680 /(webkit)[ \/]([\w.]+)/.exec(ua) || 7681 /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || 7682 /(msie) ([\w.]+)/.exec(ua) || 7683 ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || 7684 []; 7685 7686 return { 7687 browser: match[ 1 ] || "", 7688 version: match[ 2 ] || "0" 7689 }; 7690 }; 7691 7692 matched = jQuery.uaMatch(navigator.userAgent); 7693 browser = {}; 7694 7695 if (matched.browser) 7696 { 7697 browser[ matched.browser ] = true; 7698 browser.version = matched.version; 7699 } 7700 7701// Chrome is Webkit, but Webkit is also Safari. 7702 if (browser.chrome) 7703 { 7704 browser.webkit = true; 7705 } else if (browser.webkit) 7706 { 7707 browser.safari = true; 7708 } 7709 7710 jQuery.browser = browser; 7711 7712 jQuery.sub = function () 7713 { 7714 function jQuerySub(selector, context) 7715 { 7716 return new jQuerySub.fn.init(selector, context); 7717 } 7718 7719 jQuery.extend(true, jQuerySub, this); 7720 jQuerySub.superclass = this; 7721 jQuerySub.fn = jQuerySub.prototype = this(); 7722 jQuerySub.fn.constructor = jQuerySub; 7723 jQuerySub.sub = this.sub; 7724 jQuerySub.fn.init = function init(selector, context) 7725 { 7726 if (context && context instanceof jQuery && !(context instanceof jQuerySub)) 7727 { 7728 context = jQuerySub(context); 7729 } 7730 7731 return jQuery.fn.init.call(this, selector, context, rootjQuerySub); 7732 }; 7733 jQuerySub.fn.init.prototype = jQuerySub.fn; 7734 var rootjQuerySub = jQuerySub(document); 7735 return jQuerySub; 7736 }; 7737 7738 })(); 7739 var curCSS, iframe, iframeDoc, 7740 ralpha = /alpha\([^)]*\)/i, 7741 ropacity = /opacity=([^)]*)/, 7742 rposition = /^(top|right|bottom|left)$/, 7743 // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" 7744 // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 7745 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 7746 rmargin = /^margin/, 7747 rnumsplit = new RegExp("^(" + core_pnum + ")(.*)$", "i"), 7748 rnumnonpx = new RegExp("^(" + core_pnum + ")(?!px)[a-z%]+$", "i"), 7749 rrelNum = new RegExp("^([-+])=(" + core_pnum + ")", "i"), 7750 elemdisplay = { BODY: "block" }, 7751 7752 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 7753 cssNormalTransform = { 7754 letterSpacing: 0, 7755 fontWeight: 400 7756 }, 7757 7758 cssExpand = [ "Top", "Right", "Bottom", "Left" ], 7759 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], 7760 7761 eventsToggle = jQuery.fn.toggle; 7762 7763// return a css property mapped to a potentially vendor prefixed property 7764 function vendorPropName(style, name) 7765 { 7766 7767 // shortcut for names that are not vendor prefixed 7768 if (name in style) 7769 { 7770 return name; 7771 } 7772 7773 // check for vendor prefixed names 7774 var capName = name.charAt(0).toUpperCase() + name.slice(1), 7775 origName = name, 7776 i = cssPrefixes.length; 7777 7778 while (i--) 7779 { 7780 name = cssPrefixes[ i ] + capName; 7781 if (name in style) 7782 { 7783 return name; 7784 } 7785 } 7786 7787 return origName; 7788 } 7789 7790 function isHidden(elem, el) 7791 { 7792 elem = el || elem; 7793 return jQuery.css(elem, "display") === "none" || !jQuery.contains(elem.ownerDocument, elem); 7794 } 7795 7796 function showHide(elements, show) 7797 { 7798 var elem, display, 7799 values = [], 7800 index = 0, 7801 length = elements.length; 7802 7803 for (; index < length; index++) 7804 { 7805 elem = elements[ index ]; 7806 if (!elem.style) 7807 { 7808 continue; 7809 } 7810 values[ index ] = jQuery._data(elem, "olddisplay"); 7811 if (show) 7812 { 7813 // Reset the inline display of this element to learn if it is 7814 // being hidden by cascaded rules or not 7815 if (!values[ index ] && elem.style.display === "none") 7816 { 7817 elem.style.display = ""; 7818 } 7819 7820 // Set elements which have been overridden with display: none 7821 // in a stylesheet to whatever the default browser style is 7822 // for such an element 7823 if (elem.style.display === "" && isHidden(elem)) 7824 { 7825 values[ index ] = jQuery._data(elem, "olddisplay", css_defaultDisplay(elem.nodeName)); 7826 } 7827 } else 7828 { 7829 display = curCSS(elem, "display"); 7830 7831 if (!values[ index ] && display !== "none") 7832 { 7833 jQuery._data(elem, "olddisplay", display); 7834 } 7835 } 7836 } 7837 7838 // Set the display of most of the elements in a second loop 7839 // to avoid the constant reflow 7840 for (index = 0; index < length; index++) 7841 { 7842 elem = elements[ index ]; 7843 if (!elem.style) 7844 { 7845 continue; 7846 } 7847 if (!show || elem.style.display === "none" || elem.style.display === "") 7848 { 7849 elem.style.display = show ? values[ index ] || "" : "none"; 7850 } 7851 } 7852 7853 return elements; 7854 } 7855 7856 jQuery.fn.extend({ 7857 css: function (name, value) 7858 { 7859 return jQuery.access(this, function (elem, name, value) 7860 { 7861 return value !== undefined ? 7862 jQuery.style(elem, name, value) : 7863 jQuery.css(elem, name); 7864 }, name, value, arguments.length > 1); 7865 }, 7866 show: function () 7867 { 7868 return showHide(this, true); 7869 }, 7870 hide: function () 7871 { 7872 return showHide(this); 7873 }, 7874 toggle: function (state, fn2) 7875 { 7876 var bool = typeof state === "boolean"; 7877 7878 if (jQuery.isFunction(state) && jQuery.isFunction(fn2)) 7879 { 7880 return eventsToggle.apply(this, arguments); 7881 } 7882 7883 return this.each(function () 7884 { 7885 if (bool ? state : isHidden(this)) 7886 { 7887 jQuery(this).show(); 7888 } else 7889 { 7890 jQuery(this).hide(); 7891 } 7892 }); 7893 } 7894 }); 7895 7896 jQuery.extend({ 7897 // Add in style property hooks for overriding the default 7898 // behavior of getting and setting a style property 7899 cssHooks: { 7900 opacity: { 7901 get: function (elem, computed) 7902 { 7903 if (computed) 7904 { 7905 // We should always get a number back from opacity 7906 var ret = curCSS(elem, "opacity"); 7907 return ret === "" ? "1" : ret; 7908 7909 } 7910 } 7911 } 7912 }, 7913 7914 // Exclude the following css properties to add px 7915 cssNumber: { 7916 "fillOpacity": true, 7917 "fontWeight": true, 7918 "lineHeight": true, 7919 "opacity": true, 7920 "orphans": true, 7921 "widows": true, 7922 "zIndex": true, 7923 "zoom": true 7924 }, 7925 7926 // Add in properties whose names you wish to fix before 7927 // setting or getting the value 7928 cssProps: { 7929 // normalize float css property 7930 "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" 7931 }, 7932 7933 // Get and set the style property on a DOM Node 7934 style: function (elem, name, value, extra) 7935 { 7936 // Don't set styles on text and comment nodes 7937 if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) 7938 { 7939 return; 7940 } 7941 7942 // Make sure that we're working with the right name 7943 var ret, type, hooks, 7944 origName = jQuery.camelCase(name), 7945 style = elem.style; 7946 7947 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName(style, origName) ); 7948 7949 // gets hook for the prefixed version 7950 // followed by the unprefixed version 7951 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 7952 7953 // Check if we're setting a value 7954 if (value !== undefined) 7955 { 7956 type = typeof value; 7957 7958 // convert relative number strings (+= or -=) to relative numbers. #7345 7959 if (type === "string" && (ret = rrelNum.exec(value))) 7960 { 7961 value = ( ret[1] + 1 ) * ret[2] + parseFloat(jQuery.css(elem, name)); 7962 // Fixes bug #9237 7963 type = "number"; 7964 } 7965 7966 // Make sure that NaN and null values aren't set. See: #7116 7967 if (value == null || type === "number" && isNaN(value)) 7968 { 7969 return; 7970 } 7971 7972 // If a number was passed in, add 'px' to the (except for certain CSS properties) 7973 if (type === "number" && !jQuery.cssNumber[ origName ]) 7974 { 7975 value += "px"; 7976 } 7977 7978 // If a hook was provided, use that value, otherwise just set the specified value 7979 if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) 7980 { 7981 // Wrapped to prevent IE from throwing errors when 'invalid' values are provided 7982 // Fixes bug #5509 7983 try 7984 { 7985 style[ name ] = value; 7986 } catch (e) 7987 { 7988 } 7989 } 7990 7991 } else 7992 { 7993 // If a hook was provided get the non-computed value from there 7994 if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) 7995 { 7996 return ret; 7997 } 7998 7999 // Otherwise just get the value from the style object 8000 return style[ name ]; 8001 } 8002 }, 8003 8004 css: function (elem, name, numeric, extra) 8005 { 8006 var val, num, hooks, 8007 origName = jQuery.camelCase(name); 8008 8009 // Make sure that we're working with the right name 8010 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName(elem.style, origName) ); 8011 8012 // gets hook for the prefixed version 8013 // followed by the unprefixed version 8014 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 8015 8016 // If a hook was provided get the computed value from there 8017 if (hooks && "get" in hooks) 8018 { 8019 val = hooks.get(elem, true, extra); 8020 } 8021 8022 // Otherwise, if a way to get the computed value exists, use that 8023 if (val === undefined) 8024 { 8025 val = curCSS(elem, name); 8026 } 8027 8028 //convert "normal" to computed value 8029 if (val === "normal" && name in cssNormalTransform) 8030 { 8031 val = cssNormalTransform[ name ]; 8032 } 8033 8034 // Return, converting to number if forced or a qualifier was provided and val looks numeric 8035 if (numeric || extra !== undefined) 8036 { 8037 num = parseFloat(val); 8038 return numeric || jQuery.isNumeric(num) ? num || 0 : val; 8039 } 8040 return val; 8041 }, 8042 8043 // A method for quickly swapping in/out CSS properties to get correct calculations 8044 swap: function (elem, options, callback) 8045 { 8046 var ret, name, 8047 old = {}; 8048 8049 // Remember the old values, and insert the new ones 8050 for (name in options) 8051 { 8052 old[ name ] = elem.style[ name ]; 8053 elem.style[ name ] = options[ name ]; 8054 } 8055 8056 ret = callback.call(elem); 8057 8058 // Revert the old values 8059 for (name in options) 8060 { 8061 elem.style[ name ] = old[ name ]; 8062 } 8063 8064 return ret; 8065 } 8066 }); 8067 8068// NOTE: To any future maintainer, we've window.getComputedStyle 8069// because jsdom on node.js will break without it. 8070 if (window.getComputedStyle) 8071 { 8072 curCSS = function (elem, name) 8073 { 8074 var ret, width, minWidth, maxWidth, 8075 computed = window.getComputedStyle(elem, null), 8076 style = elem.style; 8077 8078 if (computed) 8079 { 8080 8081 // getPropertyValue is only needed for .css('filter') in IE9, see #12537 8082 ret = computed.getPropertyValue(name) || computed[ name ]; 8083 8084 if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) 8085 { 8086 ret = jQuery.style(elem, name); 8087 } 8088 8089 // A tribute to the "awesome hack by Dean Edwards" 8090 // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right 8091 // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels 8092 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values 8093 if (rnumnonpx.test(ret) && rmargin.test(name)) 8094 { 8095 width = style.width; 8096 minWidth = style.minWidth; 8097 maxWidth = style.maxWidth; 8098 8099 style.minWidth = style.maxWidth = style.width = ret; 8100 ret = computed.width; 8101 8102 style.width = width; 8103 style.minWidth = minWidth; 8104 style.maxWidth = maxWidth; 8105 } 8106 } 8107 8108 return ret; 8109 }; 8110 } else if (document.documentElement.currentStyle) 8111 { 8112 curCSS = function (elem, name) 8113 { 8114 var left, rsLeft, 8115 ret = elem.currentStyle && elem.currentStyle[ name ], 8116 style = elem.style; 8117 8118 // Avoid setting ret to empty string here 8119 // so we don't default to auto 8120 if (ret == null && style && style[ name ]) 8121 { 8122 ret = style[ name ]; 8123 } 8124 8125 // From the awesome hack by Dean Edwards 8126 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 8127 8128 // If we're not dealing with a regular pixel number 8129 // but a number that has a weird ending, we need to convert it to pixels 8130 // but not position css attributes, as those are proportional to the parent element instead 8131 // and we can't measure the parent instead because it might trigger a "stacking dolls" problem 8132 if (rnumnonpx.test(ret) && !rposition.test(name)) 8133 { 8134 8135 // Remember the original values 8136 left = style.left; 8137 rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; 8138 8139 // Put in the new values to get a computed value out 8140 if (rsLeft) 8141 { 8142 elem.runtimeStyle.left = elem.currentStyle.left; 8143 } 8144 style.left = name === "fontSize" ? "1em" : ret; 8145 ret = style.pixelLeft + "px"; 8146 8147 // Revert the changed values 8148 style.left = left; 8149 if (rsLeft) 8150 { 8151 elem.runtimeStyle.left = rsLeft; 8152 } 8153 } 8154 8155 return ret === "" ? "auto" : ret; 8156 }; 8157 } 8158 8159 function setPositiveNumber(elem, value, subtract) 8160 { 8161 var matches = rnumsplit.exec(value); 8162 return matches ? 8163 Math.max(0, matches[ 1 ] - ( subtract || 0 )) + ( matches[ 2 ] || "px" ) : 8164 value; 8165 } 8166 8167 function augmentWidthOrHeight(elem, name, extra, isBorderBox) 8168 { 8169 var i = extra === ( isBorderBox ? "border" : "content" ) ? 8170 // If we already have the right measurement, avoid augmentation 8171 4 : 8172 // Otherwise initialize for horizontal or vertical properties 8173 name === "width" ? 1 : 0, 8174 8175 val = 0; 8176 8177 for (; i < 4; i += 2) 8178 { 8179 // both box models exclude margin, so add it if we want it 8180 if (extra === "margin") 8181 { 8182 // we use jQuery.css instead of curCSS here 8183 // because of the reliableMarginRight CSS hook! 8184 val += jQuery.css(elem, extra + cssExpand[ i ], true); 8185 } 8186 8187 // From this point on we use curCSS for maximum performance (relevant in animations) 8188 if (isBorderBox) 8189 { 8190 // border-box includes padding, so remove it if we want content 8191 if (extra === "content") 8192 { 8193 val -= parseFloat(curCSS(elem, "padding" + cssExpand[ i ])) || 0; 8194 } 8195 8196 // at this point, extra isn't border nor margin, so remove border 8197 if (extra !== "margin") 8198 { 8199 val -= parseFloat(curCSS(elem, "border" + cssExpand[ i ] + "Width")) || 0; 8200 } 8201 } else 8202 { 8203 // at this point, extra isn't content, so add padding 8204 val += parseFloat(curCSS(elem, "padding" + cssExpand[ i ])) || 0; 8205 8206 // at this point, extra isn't content nor padding, so add border 8207 if (extra !== "padding") 8208 { 8209 val += parseFloat(curCSS(elem, "border" + cssExpand[ i ] + "Width")) || 0; 8210 } 8211 } 8212 } 8213 8214 return val; 8215 } 8216 8217 function getWidthOrHeight(elem, name, extra) 8218 { 8219 8220 // Start with offset property, which is equivalent to the border-box value 8221 var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, 8222 valueIsBorderBox = true, 8223 isBorderBox = jQuery.support.boxSizing && jQuery.css(elem, "boxSizing") === "border-box"; 8224 8225 // some non-html elements return undefined for offsetWidth, so check for null/undefined 8226 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 8227 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 8228 if (val <= 0 || val == null) 8229 { 8230 // Fall back to computed then uncomputed css if necessary 8231 val = curCSS(elem, name); 8232 if (val < 0 || val == null) 8233 { 8234 val = elem.style[ name ]; 8235 } 8236 8237 // Computed unit is not pixels. Stop here and return. 8238 if (rnumnonpx.test(val)) 8239 { 8240 return val; 8241 } 8242 8243 // we need the check for style in case a browser which returns unreliable values 8244 // for getComputedStyle silently falls back to the reliable elem.style 8245 valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); 8246 8247 // Normalize "", auto, and prepare for extra 8248 val = parseFloat(val) || 0; 8249 } 8250 8251 // use the active box-sizing model to add/subtract irrelevant styles 8252 return ( val + 8253 augmentWidthOrHeight( 8254 elem, 8255 name, 8256 extra || ( isBorderBox ? "border" : "content" ), 8257 valueIsBorderBox 8258 ) 8259 ) + "px"; 8260 } 8261 8262 8263// Try to determine the default display value of an element 8264 function css_defaultDisplay(nodeName) 8265 { 8266 if (elemdisplay[ nodeName ]) 8267 { 8268 return elemdisplay[ nodeName ]; 8269 } 8270 8271 var elem = jQuery("<" + nodeName + ">").appendTo(document.body), 8272 display = elem.css("display"); 8273 elem.remove(); 8274 8275 // If the simple way fails, 8276 // get element's real default display by attaching it to a temp iframe 8277 if (display === "none" || display === "") 8278 { 8279 // Use the already-created iframe if possible 8280 iframe = document.body.appendChild( 8281 iframe || jQuery.extend(document.createElement("iframe"), { 8282 frameBorder: 0, 8283 width: 0, 8284 height: 0 8285 }) 8286 ); 8287 8288 // Create a cacheable copy of the iframe document on first call. 8289 // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML 8290 // document to it; WebKit & Firefox won't allow reusing the iframe document. 8291 if (!iframeDoc || !iframe.createElement) 8292 { 8293 iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; 8294 iframeDoc.write("<!doctype html><html><body>"); 8295 iframeDoc.close(); 8296 } 8297 8298 elem = iframeDoc.body.appendChild(iframeDoc.createElement(nodeName)); 8299 8300 display = curCSS(elem, "display"); 8301 document.body.removeChild(iframe); 8302 } 8303 8304 // Store the correct default display 8305 elemdisplay[ nodeName ] = display; 8306 8307 return display; 8308 } 8309 8310 jQuery.each([ "height", "width" ], function (i, name) 8311 { 8312 jQuery.cssHooks[ name ] = { 8313 get: function (elem, computed, extra) 8314 { 8315 if (computed) 8316 { 8317 // certain elements can have dimension info if we invisibly show them 8318 // however, it must have a current display style that would benefit from this 8319 if (elem.offsetWidth === 0 && rdisplayswap.test(curCSS(elem, "display"))) 8320 { 8321 return jQuery.swap(elem, cssShow, function () 8322 { 8323 return getWidthOrHeight(elem, name, extra); 8324 }); 8325 } else 8326 { 8327 return getWidthOrHeight(elem, name, extra); 8328 } 8329 } 8330 }, 8331 8332 set: function (elem, value, extra) 8333 { 8334 return setPositiveNumber(elem, value, extra ? 8335 augmentWidthOrHeight( 8336 elem, 8337 name, 8338 extra, 8339 jQuery.support.boxSizing && jQuery.css(elem, "boxSizing") === "border-box" 8340 ) : 0 8341 ); 8342 } 8343 }; 8344 }); 8345 8346 if (!jQuery.support.opacity) 8347 { 8348 jQuery.cssHooks.opacity = { 8349 get: function (elem, computed) 8350 { 8351 // IE uses filters for opacity 8352 return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ? 8353 ( 0.01 * parseFloat(RegExp.$1) ) + "" : 8354 computed ? "1" : ""; 8355 }, 8356 8357 set: function (elem, value) 8358 { 8359 var style = elem.style, 8360 currentStyle = elem.currentStyle, 8361 opacity = jQuery.isNumeric(value) ? "alpha(opacity=" + value * 100 + ")" : "", 8362 filter = currentStyle && currentStyle.filter || style.filter || ""; 8363 8364 // IE has trouble with opacity if it does not have layout 8365 // Force it by setting the zoom level 8366 style.zoom = 1; 8367 8368 // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 8369 if (value >= 1 && jQuery.trim(filter.replace(ralpha, "")) === "" && 8370 style.removeAttribute) 8371 { 8372 8373 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText 8374 // if "filter:" is present at all, clearType is disabled, we want to avoid this 8375 // style.removeAttribute is IE Only, but so apparently is this code path... 8376 style.removeAttribute("filter"); 8377 8378 // if there there is no filter style applied in a css rule, we are done 8379 if (currentStyle && !currentStyle.filter) 8380 { 8381 return; 8382 } 8383 } 8384 8385 // otherwise, set new filter values 8386 style.filter = ralpha.test(filter) ? 8387 filter.replace(ralpha, opacity) : 8388 filter + " " + opacity; 8389 } 8390 }; 8391 } 8392 8393// These hooks cannot be added until DOM ready because the support test 8394// for it is not run until after DOM ready 8395 jQuery(function () 8396 { 8397 if (!jQuery.support.reliableMarginRight) 8398 { 8399 jQuery.cssHooks.marginRight = { 8400 get: function (elem, computed) 8401 { 8402 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 8403 // Work around by temporarily setting element display to inline-block 8404 return jQuery.swap(elem, { "display": "inline-block" }, function () 8405 { 8406 if (computed) 8407 { 8408 return curCSS(elem, "marginRight"); 8409 } 8410 }); 8411 } 8412 }; 8413 } 8414 8415 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 8416 // getComputedStyle returns percent when specified for top/left/bottom/right 8417 // rather than make the css module depend on the offset module, we just check for it here 8418 if (!jQuery.support.pixelPosition && jQuery.fn.position) 8419 { 8420 jQuery.each([ "top", "left" ], function (i, prop) 8421 { 8422 jQuery.cssHooks[ prop ] = { 8423 get: function (elem, computed) 8424 { 8425 if (computed) 8426 { 8427 var ret = curCSS(elem, prop); 8428 // if curCSS returns percentage, fallback to offset 8429 return rnumnonpx.test(ret) ? jQuery(elem).position()[ prop ] + "px" : ret; 8430 } 8431 } 8432 }; 8433 }); 8434 } 8435 8436 }); 8437 8438 if (jQuery.expr && jQuery.expr.filters) 8439 { 8440 jQuery.expr.filters.hidden = function (elem) 8441 { 8442 return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS(elem, "display")) === "none"); 8443 }; 8444 8445 jQuery.expr.filters.visible = function (elem) 8446 { 8447 return !jQuery.expr.filters.hidden(elem); 8448 }; 8449 } 8450 8451// These hooks are used by animate to expand properties 8452 jQuery.each({ 8453 margin: "", 8454 padding: "", 8455 border: "Width" 8456 }, function (prefix, suffix) 8457 { 8458 jQuery.cssHooks[ prefix + suffix ] = { 8459 expand: function (value) 8460 { 8461 var i, 8462 8463 // assumes a single number if not a string 8464 parts = typeof value === "string" ? value.split(" ") : [ value ], 8465 expanded = {}; 8466 8467 for (i = 0; i < 4; i++) 8468 { 8469 expanded[ prefix + cssExpand[ i ] + suffix ] = 8470 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 8471 } 8472 8473 return expanded; 8474 } 8475 }; 8476 8477 if (!rmargin.test(prefix)) 8478 { 8479 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 8480 } 8481 }); 8482 var r20 = /%20/g, 8483 rbracket = /\[\]$/, 8484 rCRLF = /\r?\n/g, 8485 rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, 8486 rselectTextarea = /^(?:select|textarea)/i; 8487 8488 jQuery.fn.extend({ 8489 serialize: function () 8490 { 8491 return jQuery.param(this.serializeArray()); 8492 }, 8493 serializeArray: function () 8494 { 8495 return this.map(function () 8496 { 8497 return this.elements ? jQuery.makeArray(this.elements) : this; 8498 }) 8499 .filter(function () 8500 { 8501 return this.name && !this.disabled && 8502 ( this.checked || rselectTextarea.test(this.nodeName) || 8503 rinput.test(this.type) ); 8504 }) 8505 .map(function (i, elem) 8506 { 8507 var val = jQuery(this).val(); 8508 8509 return val == null ? 8510 null : 8511 jQuery.isArray(val) ? 8512 jQuery.map(val, function (val, i) 8513 { 8514 return { name: elem.name, value: val.replace(rCRLF, "\r\n") }; 8515 }) : 8516 { name: elem.name, value: val.replace(rCRLF, "\r\n") }; 8517 }).get(); 8518 } 8519 }); 8520 8521//Serialize an array of form elements or a set of 8522//key/values into a query string 8523 jQuery.param = function (a, traditional) 8524 { 8525 var prefix, 8526 s = [], 8527 add = function (key, value) 8528 { 8529 // If value is a function, invoke it and return its value 8530 value = jQuery.isFunction(value) ? value() : ( value == null ? "" : value ); 8531 s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value); 8532 }; 8533 8534 // Set traditional to true for jQuery <= 1.3.2 behavior. 8535 if (traditional === undefined) 8536 { 8537 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; 8538 } 8539 8540 // If an array was passed in, assume that it is an array of form elements. 8541 if (jQuery.isArray(a) || ( a.jquery && !jQuery.isPlainObject(a) )) 8542 { 8543 // Serialize the form elements 8544 jQuery.each(a, function () 8545 { 8546 add(this.name, this.value); 8547 }); 8548 8549 } else 8550 { 8551 // If traditional, encode the "old" way (the way 1.3.2 or older 8552 // did it), otherwise encode params recursively. 8553 for (prefix in a) 8554 { 8555 buildParams(prefix, a[ prefix ], traditional, add); 8556 } 8557 } 8558 8559 // Return the resulting serialization 8560 return s.join("&").replace(r20, "+"); 8561 }; 8562 8563 function buildParams(prefix, obj, traditional, add) 8564 { 8565 var name; 8566 8567 if (jQuery.isArray(obj)) 8568 { 8569 // Serialize array item. 8570 jQuery.each(obj, function (i, v) 8571 { 8572 if (traditional || rbracket.test(prefix)) 8573 { 8574 // Treat each array item as a scalar. 8575 add(prefix, v); 8576 8577 } else 8578 { 8579 // If array item is non-scalar (array or object), encode its 8580 // numeric index to resolve deserialization ambiguity issues. 8581 // Note that rack (as of 1.0.0) can't currently deserialize 8582 // nested arrays properly, and attempting to do so may cause 8583 // a server error. Possible fixes are to modify rack's 8584 // deserialization algorithm or to provide an option or flag 8585 // to force array serialization to be shallow. 8586 buildParams(prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add); 8587 } 8588 }); 8589 8590 } else if (!traditional && jQuery.type(obj) === "object") 8591 { 8592 // Serialize object item. 8593 for (name in obj) 8594 { 8595 buildParams(prefix + "[" + name + "]", obj[ name ], traditional, add); 8596 } 8597 8598 } else 8599 { 8600 // Serialize scalar item. 8601 add(prefix, obj); 8602 } 8603 } 8604 8605 var 8606 // Document location 8607 ajaxLocParts, 8608 ajaxLocation, 8609 8610 rhash = /#.*$/, 8611 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL 8612 // #7653, #8125, #8152: local protocol detection 8613 rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, 8614 rnoContent = /^(?:GET|HEAD)$/, 8615 rprotocol = /^\/\//, 8616 rquery = /\?/, 8617 rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, 8618 rts = /([?&])_=[^&]*/, 8619 rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, 8620 8621 // Keep a copy of the old load method 8622 _load = jQuery.fn.load, 8623 8624 /* Prefilters 8625 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 8626 * 2) These are called: 8627 * - BEFORE asking for a transport 8628 * - AFTER param serialization (s.data is a string if s.processData is true) 8629 * 3) key is the dataType 8630 * 4) the catchall symbol "*" can be used 8631 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 8632 */ 8633 prefilters = {}, 8634 8635 /* Transports bindings 8636 * 1) key is the dataType 8637 * 2) the catchall symbol "*" can be used 8638 * 3) selection will start with transport dataType and THEN go to "*" if needed 8639 */ 8640 transports = {}, 8641 8642 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 8643 allTypes = ["*/"] + ["*"]; 8644 8645// #8138, IE may throw an exception when accessing 8646// a field from window.location if document.domain has been set 8647 try 8648 { 8649 ajaxLocation = location.href; 8650 } catch (e) 8651 { 8652 // Use the href attribute of an A element 8653 // since IE will modify it given document.location 8654 ajaxLocation = document.createElement("a"); 8655 ajaxLocation.href = ""; 8656 ajaxLocation = ajaxLocation.href; 8657 } 8658 8659// Segment location into parts 8660 ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || []; 8661 8662// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 8663 function addToPrefiltersOrTransports(structure) 8664 { 8665 8666 // dataTypeExpression is optional and defaults to "*" 8667 return function (dataTypeExpression, func) 8668 { 8669 8670 if (typeof dataTypeExpression !== "string") 8671 { 8672 func = dataTypeExpression; 8673 dataTypeExpression = "*"; 8674 } 8675 8676 var dataType, list, placeBefore, 8677 dataTypes = dataTypeExpression.toLowerCase().split(core_rspace), 8678 i = 0, 8679 length = dataTypes.length; 8680 8681 if (jQuery.isFunction(func)) 8682 { 8683 // For each dataType in the dataTypeExpression 8684 for (; i < length; i++) 8685 { 8686 dataType = dataTypes[ i ]; 8687 // We control if we're asked to add before 8688 // any existing element 8689 placeBefore = /^\+/.test(dataType); 8690 if (placeBefore) 8691 { 8692 dataType = dataType.substr(1) || "*"; 8693 } 8694 list = structure[ dataType ] = structure[ dataType ] || []; 8695 // then we add to the structure accordingly 8696 list[ placeBefore ? "unshift" : "push" ](func); 8697 } 8698 } 8699 }; 8700 } 8701 8702// Base inspection function for prefilters and transports 8703 function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR, dataType /* internal */, inspected /* internal */) 8704 { 8705 8706 dataType = dataType || options.dataTypes[ 0 ]; 8707 inspected = inspected || {}; 8708 8709 inspected[ dataType ] = true; 8710 8711 var selection, 8712 list = structure[ dataType ], 8713 i = 0, 8714 length = list ? list.length : 0, 8715 executeOnly = ( structure === prefilters ); 8716 8717 for (; i < length && ( executeOnly || !selection ); i++) 8718 { 8719 selection = list[ i ](options, originalOptions, jqXHR); 8720 // If we got redirected to another dataType 8721 // we try there if executing only and not done already 8722 if (typeof selection === "string") 8723 { 8724 if (!executeOnly || inspected[ selection ]) 8725 { 8726 selection = undefined; 8727 } else 8728 { 8729 options.dataTypes.unshift(selection); 8730 selection = inspectPrefiltersOrTransports( 8731 structure, options, originalOptions, jqXHR, selection, inspected); 8732 } 8733 } 8734 } 8735 // If we're only executing or nothing was selected 8736 // we try the catchall dataType if not done already 8737 if (( executeOnly || !selection ) && !inspected[ "*" ]) 8738 { 8739 selection = inspectPrefiltersOrTransports( 8740 structure, options, originalOptions, jqXHR, "*", inspected); 8741 } 8742 // unnecessary when only executing (prefilters) 8743 // but it'll be ignored by the caller in that case 8744 return selection; 8745 } 8746 8747// A special extend for ajax options 8748// that takes "flat" options (not to be deep extended) 8749// Fixes #9887 8750 function ajaxExtend(target, src) 8751 { 8752 var key, deep, 8753 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 8754 for (key in src) 8755 { 8756 if (src[ key ] !== undefined) 8757 { 8758 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 8759 } 8760 } 8761 if (deep) 8762 { 8763 jQuery.extend(true, target, deep); 8764 } 8765 } 8766 8767 jQuery.fn.load = function (url, params, callback) 8768 { 8769 if (typeof url !== "string" && _load) 8770 { 8771 return _load.apply(this, arguments); 8772 } 8773 8774 // Don't do a request if no elements are being requested 8775 if (!this.length) 8776 { 8777 return this; 8778 } 8779 8780 var selector, type, response, 8781 self = this, 8782 off = url.indexOf(" "); 8783 8784 if (off >= 0) 8785 { 8786 selector = url.slice(off, url.length); 8787 url = url.slice(0, off); 8788 } 8789 8790 // If it's a function 8791 if (jQuery.isFunction(params)) 8792 { 8793 8794 // We assume that it's the callback 8795 callback = params; 8796 params = undefined; 8797 8798 // Otherwise, build a param string 8799 } else if (params && typeof params === "object") 8800 { 8801 type = "POST"; 8802 } 8803 8804 // Request the remote document 8805 jQuery.ajax({ 8806 url: url, 8807 8808 // if "type" variable is undefined, then "GET" method will be used 8809 type: type, 8810 dataType: "html", 8811 data: params, 8812 complete: function (jqXHR, status) 8813 { 8814 if (callback) 8815 { 8816 self.each(callback, response || [ jqXHR.responseText, status, jqXHR ]); 8817 } 8818 } 8819 }).done(function (responseText) 8820 { 8821 8822 // Save response for use in complete callback 8823 response = arguments; 8824 8825 // See if a selector was specified 8826 self.html(selector ? 8827 8828 // Create a dummy div to hold the results 8829 jQuery("<div>") 8830 8831 // inject the contents of the document in, removing the scripts 8832 // to avoid any 'Permission Denied' errors in IE 8833 .append(responseText.replace(rscript, "")) 8834 8835 // Locate the specified elements 8836 .find(selector) : 8837 8838 // If not, just inject the full result 8839 responseText); 8840 8841 }); 8842 8843 return this; 8844 }; 8845 8846// Attach a bunch of functions for handling common AJAX events 8847 jQuery.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function (i, o) 8848 { 8849 jQuery.fn[ o ] = function (f) 8850 { 8851 return this.on(o, f); 8852 }; 8853 }); 8854 8855 jQuery.each([ "get", "post" ], function (i, method) 8856 { 8857 jQuery[ method ] = function (url, data, callback, type) 8858 { 8859 // shift arguments if data argument was omitted 8860 if (jQuery.isFunction(data)) 8861 { 8862 type = type || callback; 8863 callback = data; 8864 data = undefined; 8865 } 8866 8867 return jQuery.ajax({ 8868 type: method, 8869 url: url, 8870 data: data, 8871 success: callback, 8872 dataType: type 8873 }); 8874 }; 8875 }); 8876 8877 jQuery.extend({ 8878 8879 getScript: function (url, callback) 8880 { 8881 return jQuery.get(url, undefined, callback, "script"); 8882 }, 8883 8884 getJSON: function (url, data, callback) 8885 { 8886 return jQuery.get(url, data, callback, "json"); 8887 }, 8888 8889 // Creates a full fledged settings object into target 8890 // with both ajaxSettings and settings fields. 8891 // If target is omitted, writes into ajaxSettings. 8892 ajaxSetup: function (target, settings) 8893 { 8894 if (settings) 8895 { 8896 // Building a settings object 8897 ajaxExtend(target, jQuery.ajaxSettings); 8898 } else 8899 { 8900 // Extending ajaxSettings 8901 settings = target; 8902 target = jQuery.ajaxSettings; 8903 } 8904 ajaxExtend(target, settings); 8905 return target; 8906 }, 8907 8908 ajaxSettings: { 8909 url: ajaxLocation, 8910 isLocal: rlocalProtocol.test(ajaxLocParts[ 1 ]), 8911 global: true, 8912 type: "GET", 8913 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 8914 processData: true, 8915 async: true, 8916 /* 8917 timeout: 0, 8918 data: null, 8919 dataType: null, 8920 username: null, 8921 password: null, 8922 cache: null, 8923 throws: false, 8924 traditional: false, 8925 headers: {}, 8926 */ 8927 8928 accepts: { 8929 xml: "application/xml, text/xml", 8930 html: "text/html", 8931 text: "text/plain", 8932 json: "application/json, text/javascript", 8933 "*": allTypes 8934 }, 8935 8936 contents: { 8937 xml: /xml/, 8938 html: /html/, 8939 json: /json/ 8940 }, 8941 8942 responseFields: { 8943 xml: "responseXML", 8944 text: "responseText" 8945 }, 8946 8947 // List of data converters 8948 // 1) key format is "source_type destination_type" (a single space in-between) 8949 // 2) the catchall symbol "*" can be used for source_type 8950 converters: { 8951 8952 // Convert anything to text 8953 "* text": window.String, 8954 8955 // Text to html (true = no transformation) 8956 "text html": true, 8957 8958 // Evaluate text as a json expression 8959 "text json": jQuery.parseJSON, 8960 8961 // Parse text as xml 8962 "text xml": jQuery.parseXML 8963 }, 8964 8965 // For options that shouldn't be deep extended: 8966 // you can add your own custom options here if 8967 // and when you create one that shouldn't be 8968 // deep extended (see ajaxExtend) 8969 flatOptions: { 8970 context: true, 8971 url: true 8972 } 8973 }, 8974 8975 ajaxPrefilter: addToPrefiltersOrTransports(prefilters), 8976 ajaxTransport: addToPrefiltersOrTransports(transports), 8977 8978 // Main method 8979 ajax: function (url, options) 8980 { 8981 8982 // If url is an object, simulate pre-1.5 signature 8983 if (typeof url === "object") 8984 { 8985 options = url; 8986 url = undefined; 8987 } 8988 8989 // Force options to be an object 8990 options = options || {}; 8991 8992 var // ifModified key 8993 ifModifiedKey, 8994 // Response headers 8995 responseHeadersString, 8996 responseHeaders, 8997 // transport 8998 transport, 8999 // timeout handle 9000 timeoutTimer, 9001 // Cross-domain detection vars 9002 parts, 9003 // To know if global events are to be dispatched 9004 fireGlobals, 9005 // Loop variable 9006 i, 9007 // Create the final options object 9008 s = jQuery.ajaxSetup({}, options), 9009 // Callbacks context 9010 callbackContext = s.context || s, 9011 // Context for global events 9012 // It's the callbackContext if one was provided in the options 9013 // and if it's a DOM node or a jQuery collection 9014 globalEventContext = callbackContext !== s && 9015 ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? 9016 jQuery(callbackContext) : jQuery.event, 9017 // Deferreds 9018 deferred = jQuery.Deferred(), 9019 completeDeferred = jQuery.Callbacks("once memory"), 9020 // Status-dependent callbacks 9021 statusCode = s.statusCode || {}, 9022 // Headers (they are sent all at once) 9023 requestHeaders = {}, 9024 requestHeadersNames = {}, 9025 // The jqXHR state 9026 state = 0, 9027 // Default abort message 9028 strAbort = "canceled", 9029 // Fake xhr 9030 jqXHR = { 9031 9032 readyState: 0, 9033 9034 // Caches the header 9035 setRequestHeader: function (name, value) 9036 { 9037 if (!state) 9038 { 9039 var lname = name.toLowerCase(); 9040 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; 9041 requestHeaders[ name ] = value; 9042 } 9043 return this; 9044 }, 9045 9046 // Raw string 9047 getAllResponseHeaders: function () 9048 { 9049 return state === 2 ? responseHeadersString : null; 9050 }, 9051 9052 // Builds headers hashtable if needed 9053 getResponseHeader: function (key) 9054 { 9055 var match; 9056 if (state === 2) 9057 { 9058 if (!responseHeaders) 9059 { 9060 responseHeaders = {}; 9061 while (( match = rheaders.exec(responseHeadersString) )) 9062 { 9063 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; 9064 } 9065 } 9066 match = responseHeaders[ key.toLowerCase() ]; 9067 } 9068 return match === undefined ? null : match; 9069 }, 9070 9071 // Overrides response content-type header 9072 overrideMimeType: function (type) 9073 { 9074 if (!state) 9075 { 9076 s.mimeType = type; 9077 } 9078 return this; 9079 }, 9080 9081 // Cancel the request 9082 abort: function (statusText) 9083 { 9084 statusText = statusText || strAbort; 9085 if (transport) 9086 { 9087 transport.abort(statusText); 9088 } 9089 done(0, statusText); 9090 return this; 9091 } 9092 }; 9093 9094 // Callback for when everything is done 9095 // It is defined here because jslint complains if it is declared 9096 // at the end of the function (which would be more logical and readable) 9097 function done(status, nativeStatusText, responses, headers) 9098 { 9099 var isSuccess, success, error, response, modified, 9100 statusText = nativeStatusText; 9101 9102 // Called once 9103 if (state === 2) 9104 { 9105 return; 9106 } 9107 9108 // State is "done" now 9109 state = 2; 9110 9111 // Clear timeout if it exists 9112 if (timeoutTimer) 9113 { 9114 clearTimeout(timeoutTimer); 9115 } 9116 9117 // Dereference transport for early garbage collection 9118 // (no matter how long the jqXHR object will be used) 9119 transport = undefined; 9120 9121 // Cache response headers 9122 responseHeadersString = headers || ""; 9123 9124 // Set readyState 9125 jqXHR.readyState = status > 0 ? 4 : 0; 9126 9127 // Get response data 9128 if (responses) 9129 { 9130 response = ajaxHandleResponses(s, jqXHR, responses); 9131 } 9132 9133 // If successful, handle type chaining 9134 if (status >= 200 && status < 300 || status === 304) 9135 { 9136 9137 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9138 if (s.ifModified) 9139 { 9140 9141 modified = jqXHR.getResponseHeader("Last-Modified"); 9142 if (modified) 9143 { 9144 jQuery.lastModified[ ifModifiedKey ] = modified; 9145 } 9146 modified = jqXHR.getResponseHeader("Etag"); 9147 if (modified) 9148 { 9149 jQuery.etag[ ifModifiedKey ] = modified; 9150 } 9151 } 9152 9153 // If not modified 9154 if (status === 304) 9155 { 9156 9157 statusText = "notmodified"; 9158 isSuccess = true; 9159 9160 // If we have data 9161 } else 9162 { 9163 9164 isSuccess = ajaxConvert(s, response); 9165 statusText = isSuccess.state; 9166 success = isSuccess.data; 9167 error = isSuccess.error; 9168 isSuccess = !error; 9169 } 9170 } else 9171 { 9172 // We extract error from statusText 9173 // then normalize statusText and status for non-aborts 9174 error = statusText; 9175 if (!statusText || status) 9176 { 9177 statusText = "error"; 9178 if (status < 0) 9179 { 9180 status = 0; 9181 } 9182 } 9183 } 9184 9185 // Set data for the fake xhr object 9186 jqXHR.status = status; 9187 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9188 9189 // Success/Error 9190 if (isSuccess) 9191 { 9192 deferred.resolveWith(callbackContext, [ success, statusText, jqXHR ]); 9193 } else 9194 { 9195 deferred.rejectWith(callbackContext, [ jqXHR, statusText, error ]); 9196 } 9197 9198 // Status-dependent callbacks 9199 jqXHR.statusCode(statusCode); 9200 statusCode = undefined; 9201 9202 if (fireGlobals) 9203 { 9204 globalEventContext.trigger("ajax" + ( isSuccess ? "Success" : "Error" ), 9205 [ jqXHR, s, isSuccess ? success : error ]); 9206 } 9207 9208 // Complete 9209 completeDeferred.fireWith(callbackContext, [ jqXHR, statusText ]); 9210 9211 if (fireGlobals) 9212 { 9213 globalEventContext.trigger("ajaxComplete", [ jqXHR, s ]); 9214 // Handle the global AJAX counter 9215 if (!( --jQuery.active )) 9216 { 9217 jQuery.event.trigger("ajaxStop"); 9218 } 9219 } 9220 } 9221 9222 // Attach deferreds 9223 deferred.promise(jqXHR); 9224 jqXHR.success = jqXHR.done; 9225 jqXHR.error = jqXHR.fail; 9226 jqXHR.complete = completeDeferred.add; 9227 9228 // Status-dependent callbacks 9229 jqXHR.statusCode = function (map) 9230 { 9231 if (map) 9232 { 9233 var tmp; 9234 if (state < 2) 9235 { 9236 for (tmp in map) 9237 { 9238 statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; 9239 } 9240 } else 9241 { 9242 tmp = map[ jqXHR.status ]; 9243 jqXHR.always(tmp); 9244 } 9245 } 9246 return this; 9247 }; 9248 9249 // Remove hash character (#7531: and string promotion) 9250 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) 9251 // We also use the url parameter if available 9252 s.url = ( ( url || s.url ) + "" ).replace(rhash, "").replace(rprotocol, ajaxLocParts[ 1 ] + "//"); 9253 9254 // Extract dataTypes list 9255 s.dataTypes = jQuery.trim(s.dataType || "*").toLowerCase().split(core_rspace); 9256 9257 // A cross-domain request is in order when we have a protocol:host:port mismatch 9258 if (s.crossDomain == null) 9259 { 9260 parts = rurl.exec(s.url.toLowerCase()); 9261 s.crossDomain = !!( parts && 9262 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || 9263 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != 9264 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) 9265 ); 9266 } 9267 9268 // Convert data if not already a string 9269 if (s.data && s.processData && typeof s.data !== "string") 9270 { 9271 s.data = jQuery.param(s.data, s.traditional); 9272 } 9273 9274 // Apply prefilters 9275 inspectPrefiltersOrTransports(prefilters, s, options, jqXHR); 9276 9277 // If request was aborted inside a prefilter, stop there 9278 if (state === 2) 9279 { 9280 return jqXHR; 9281 } 9282 9283 // We can fire global events as of now if asked to 9284 fireGlobals = s.global; 9285 9286 // Uppercase the type 9287 s.type = s.type.toUpperCase(); 9288 9289 // Determine if request has content 9290 s.hasContent = !rnoContent.test(s.type); 9291 9292 // Watch for a new set of requests 9293 if (fireGlobals && jQuery.active++ === 0) 9294 { 9295 jQuery.event.trigger("ajaxStart"); 9296 } 9297 9298 // More options handling for requests with no content 9299 if (!s.hasContent) 9300 { 9301 9302 // If data is available, append data to url 9303 if (s.data) 9304 { 9305 s.url += ( rquery.test(s.url) ? "&" : "?" ) + s.data; 9306 // #9682: remove data so that it's not used in an eventual retry 9307 delete s.data; 9308 } 9309 9310 // Get ifModifiedKey before adding the anti-cache parameter 9311 ifModifiedKey = s.url; 9312 9313 // Add anti-cache in url if needed 9314 if (s.cache === false) 9315 { 9316 9317 var ts = jQuery.now(), 9318 // try replacing _= if it is there 9319 ret = s.url.replace(rts, "$1_=" + ts); 9320 9321 // if nothing was replaced, add timestamp to the end 9322 s.url = ret + ( ( ret === s.url ) ? ( rquery.test(s.url) ? "&" : "?" ) + "_=" + ts : "" ); 9323 } 9324 } 9325 9326 // Set the correct header, if data is being sent 9327 if (s.data && s.hasContent && s.contentType !== false || options.contentType) 9328 { 9329 jqXHR.setRequestHeader("Content-Type", s.contentType); 9330 } 9331 9332 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9333 if (s.ifModified) 9334 { 9335 ifModifiedKey = ifModifiedKey || s.url; 9336 if (jQuery.lastModified[ ifModifiedKey ]) 9337 { 9338 jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[ ifModifiedKey ]); 9339 } 9340 if (jQuery.etag[ ifModifiedKey ]) 9341 { 9342 jqXHR.setRequestHeader("If-None-Match", jQuery.etag[ ifModifiedKey ]); 9343 } 9344 } 9345 9346 // Set the Accepts header for the server, depending on the dataType 9347 jqXHR.setRequestHeader( 9348 "Accept", 9349 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? 9350 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9351 s.accepts[ "*" ] 9352 ); 9353 9354 // Check for headers option 9355 for (i in s.headers) 9356 { 9357 jqXHR.setRequestHeader(i, s.headers[ i ]); 9358 } 9359 9360 // Allow custom headers/mimetypes and early abort 9361 if (s.beforeSend && ( s.beforeSend.call(callbackContext, jqXHR, s) === false || state === 2 )) 9362 { 9363 // Abort if not done already and return 9364 return jqXHR.abort(); 9365 9366 } 9367 9368 // aborting is no longer a cancellation 9369 strAbort = "abort"; 9370 9371 // Install callbacks on deferreds 9372 for (i in { success: 1, error: 1, complete: 1 }) 9373 { 9374 jqXHR[ i ](s[ i ]); 9375 } 9376 9377 // Get transport 9378 transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR); 9379 9380 // If no transport, we auto-abort 9381 if (!transport) 9382 { 9383 done(-1, "No Transport"); 9384 } else 9385 { 9386 jqXHR.readyState = 1; 9387 // Send global event 9388 if (fireGlobals) 9389 { 9390 globalEventContext.trigger("ajaxSend", [ jqXHR, s ]); 9391 } 9392 // Timeout 9393 if (s.async && s.timeout > 0) 9394 { 9395 timeoutTimer = setTimeout(function () 9396 { 9397 jqXHR.abort("timeout"); 9398 }, s.timeout); 9399 } 9400 9401 try 9402 { 9403 state = 1; 9404 transport.send(requestHeaders, done); 9405 } catch (e) 9406 { 9407 // Propagate exception as error if not done 9408 if (state < 2) 9409 { 9410 done(-1, e); 9411 // Simply rethrow otherwise 9412 } else 9413 { 9414 throw e; 9415 } 9416 } 9417 } 9418 9419 return jqXHR; 9420 }, 9421 9422 // Counter for holding the number of active queries 9423 active: 0, 9424 9425 // Last-Modified header cache for next request 9426 lastModified: {}, 9427 etag: {} 9428 9429 }); 9430 9431 /* Handles responses to an ajax request: 9432 * - sets all responseXXX fields accordingly 9433 * - finds the right dataType (mediates between content-type and expected dataType) 9434 * - returns the corresponding response 9435 */ 9436 function ajaxHandleResponses(s, jqXHR, responses) 9437 { 9438 9439 var ct, type, finalDataType, firstDataType, 9440 contents = s.contents, 9441 dataTypes = s.dataTypes, 9442 responseFields = s.responseFields; 9443 9444 // Fill responseXXX fields 9445 for (type in responseFields) 9446 { 9447 if (type in responses) 9448 { 9449 jqXHR[ responseFields[type] ] = responses[ type ]; 9450 } 9451 } 9452 9453 // Remove auto dataType and get content-type in the process 9454 while (dataTypes[ 0 ] === "*") 9455 { 9456 dataTypes.shift(); 9457 if (ct === undefined) 9458 { 9459 ct = s.mimeType || jqXHR.getResponseHeader("content-type"); 9460 } 9461 } 9462 9463 // Check if we're dealing with a known content-type 9464 if (ct) 9465 { 9466 for (type in contents) 9467 { 9468 if (contents[ type ] && contents[ type ].test(ct)) 9469 { 9470 dataTypes.unshift(type); 9471 break; 9472 } 9473 } 9474 } 9475 9476 // Check to see if we have a response for the expected dataType 9477 if (dataTypes[ 0 ] in responses) 9478 { 9479 finalDataType = dataTypes[ 0 ]; 9480 } else 9481 { 9482 // Try convertible dataTypes 9483 for (type in responses) 9484 { 9485 if (!dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ]) 9486 { 9487 finalDataType = type; 9488 break; 9489 } 9490 if (!firstDataType) 9491 { 9492 firstDataType = type; 9493 } 9494 } 9495 // Or just use first one 9496 finalDataType = finalDataType || firstDataType; 9497 } 9498 9499 // If we found a dataType 9500 // We add the dataType to the list if needed 9501 // and return the corresponding response 9502 if (finalDataType) 9503 { 9504 if (finalDataType !== dataTypes[ 0 ]) 9505 { 9506 dataTypes.unshift(finalDataType); 9507 } 9508 return responses[ finalDataType ]; 9509 } 9510 } 9511 9512// Chain conversions given the request and the original response 9513 function ajaxConvert(s, response) 9514 { 9515 9516 var conv, conv2, current, tmp, 9517 // Work with a copy of dataTypes in case we need to modify it for conversion 9518 dataTypes = s.dataTypes.slice(), 9519 prev = dataTypes[ 0 ], 9520 converters = {}, 9521 i = 0; 9522 9523 // Apply the dataFilter if provided 9524 if (s.dataFilter) 9525 { 9526 response = s.dataFilter(response, s.dataType); 9527 } 9528 9529 // Create converters map with lowercased keys 9530 if (dataTypes[ 1 ]) 9531 { 9532 for (conv in s.converters) 9533 { 9534 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 9535 } 9536 } 9537 9538 // Convert to each sequential dataType, tolerating list modification 9539 for (; (current = dataTypes[++i]);) 9540 { 9541 9542 // There's only work to do if current dataType is non-auto 9543 if (current !== "*") 9544 { 9545 9546 // Convert response if prev dataType is non-auto and differs from current 9547 if (prev !== "*" && prev !== current) 9548 { 9549 9550 // Seek a direct converter 9551 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 9552 9553 // If none found, seek a pair 9554 if (!conv) 9555 { 9556 for (conv2 in converters) 9557 { 9558 9559 // If conv2 outputs current 9560 tmp = conv2.split(" "); 9561 if (tmp[ 1 ] === current) 9562 { 9563 9564 // If prev can be converted to accepted input 9565 conv = converters[ prev + " " + tmp[ 0 ] ] || 9566 converters[ "* " + tmp[ 0 ] ]; 9567 if (conv) 9568 { 9569 // Condense equivalence converters 9570 if (conv === true) 9571 { 9572 conv = converters[ conv2 ]; 9573 9574 // Otherwise, insert the intermediate dataType 9575 } else if (converters[ conv2 ] !== true) 9576 { 9577 current = tmp[ 0 ]; 9578 dataTypes.splice(i--, 0, current); 9579 } 9580 9581 break; 9582 } 9583 } 9584 } 9585 } 9586 9587 // Apply converter (if not an equivalence) 9588 if (conv !== true) 9589 { 9590 9591 // Unless errors are allowed to bubble, catch and return them 9592 if (conv && s["throws"]) 9593 { 9594 response = conv(response); 9595 } else 9596 { 9597 try 9598 { 9599 response = conv(response); 9600 } catch (e) 9601 { 9602 return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; 9603 } 9604 } 9605 } 9606 } 9607 9608 // Update prev for next iteration 9609 prev = current; 9610 } 9611 } 9612 9613 return { state: "success", data: response }; 9614 } 9615 9616 var oldCallbacks = [], 9617 rquestion = /\?/, 9618 rjsonp = /(=)\?(?=&|$)|\?\?/, 9619 nonce = jQuery.now(); 9620 9621// Default jsonp settings 9622 jQuery.ajaxSetup({ 9623 jsonp: "callback", 9624 jsonpCallback: function () 9625 { 9626 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); 9627 this[ callback ] = true; 9628 return callback; 9629 } 9630 }); 9631 9632// Detect, normalize options and install callbacks for jsonp requests 9633 jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) 9634 { 9635 9636 var callbackName, overwritten, responseContainer, 9637 data = s.data, 9638 url = s.url, 9639 hasCallback = s.jsonp !== false, 9640 replaceInUrl = hasCallback && rjsonp.test(url), 9641 replaceInData = hasCallback && !replaceInUrl && typeof data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && 9642 rjsonp.test(data); 9643 9644 // Handle iff the expected data type is "jsonp" or we have a parameter to set 9645 if (s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData) 9646 { 9647 9648 // Get callback name, remembering preexisting value associated with it 9649 callbackName = s.jsonpCallback = jQuery.isFunction(s.jsonpCallback) ? 9650 s.jsonpCallback() : 9651 s.jsonpCallback; 9652 overwritten = window[ callbackName ]; 9653 9654 // Insert callback into url or form data 9655 if (replaceInUrl) 9656 { 9657 s.url = url.replace(rjsonp, "$1" + callbackName); 9658 } else if (replaceInData) 9659 { 9660 s.data = data.replace(rjsonp, "$1" + callbackName); 9661 } else if (hasCallback) 9662 { 9663 s.url += ( rquestion.test(url) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 9664 } 9665 9666 // Use data converter to retrieve json after script execution 9667 s.converters["script json"] = function () 9668 { 9669 if (!responseContainer) 9670 { 9671 jQuery.error(callbackName + " was not called"); 9672 } 9673 return responseContainer[ 0 ]; 9674 }; 9675 9676 // force json dataType 9677 s.dataTypes[ 0 ] = "json"; 9678 9679 // Install callback 9680 window[ callbackName ] = function () 9681 { 9682 responseContainer = arguments; 9683 }; 9684 9685 // Clean-up function (fires after converters) 9686 jqXHR.always(function () 9687 { 9688 // Restore preexisting value 9689 window[ callbackName ] = overwritten; 9690 9691 // Save back as free 9692 if (s[ callbackName ]) 9693 { 9694 // make sure that re-using the options doesn't screw things around 9695 s.jsonpCallback = originalSettings.jsonpCallback; 9696 9697 // save the callback name for future use 9698 oldCallbacks.push(callbackName); 9699 } 9700 9701 // Call if it was a function and we have a response 9702 if (responseContainer && jQuery.isFunction(overwritten)) 9703 { 9704 overwritten(responseContainer[ 0 ]); 9705 } 9706 9707 responseContainer = overwritten = undefined; 9708 }); 9709 9710 // Delegate to script 9711 return "script"; 9712 } 9713 }); 9714// Install script dataType 9715 jQuery.ajaxSetup({ 9716 accepts: { 9717 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" 9718 }, 9719 contents: { 9720 script: /javascript|ecmascript/ 9721 }, 9722 converters: { 9723 "text script": function (text) 9724 { 9725 jQuery.globalEval(text); 9726 return text; 9727 } 9728 } 9729 }); 9730 9731// Handle cache's special case and global 9732 jQuery.ajaxPrefilter("script", function (s) 9733 { 9734 if (s.cache === undefined) 9735 { 9736 s.cache = false; 9737 } 9738 if (s.crossDomain) 9739 { 9740 s.type = "GET"; 9741 s.global = false; 9742 } 9743 }); 9744 9745// Bind script tag hack transport 9746 jQuery.ajaxTransport("script", function (s) 9747 { 9748 9749 // This transport only deals with cross domain requests 9750 if (s.crossDomain) 9751 { 9752 9753 var script, 9754 head = document.head || document.getElementsByTagName("head")[0] || document.documentElement; 9755 9756 return { 9757 9758 send: function (_, callback) 9759 { 9760 9761 script = document.createElement("script"); 9762 9763 script.async = "async"; 9764 9765 if (s.scriptCharset) 9766 { 9767 script.charset = s.scriptCharset; 9768 } 9769 9770 script.src = s.url; 9771 9772 // Attach handlers for all browsers 9773 script.onload = script.onreadystatechange = function (_, isAbort) 9774 { 9775 9776 if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState)) 9777 { 9778 9779 // Handle memory leak in IE 9780 script.onload = script.onreadystatechange = null; 9781 9782 // Remove the script 9783 if (head && script.parentNode) 9784 { 9785 head.removeChild(script); 9786 } 9787 9788 // Dereference the script 9789 script = undefined; 9790 9791 // Callback if not abort 9792 if (!isAbort) 9793 { 9794 callback(200, "success"); 9795 } 9796 } 9797 }; 9798 // Use insertBefore instead of appendChild to circumvent an IE6 bug. 9799 // This arises when a base node is used (#2709 and #4378). 9800 head.insertBefore(script, head.firstChild); 9801 }, 9802 9803 abort: function () 9804 { 9805 if (script) 9806 { 9807 script.onload(0, 1); 9808 } 9809 } 9810 }; 9811 } 9812 }); 9813 var xhrCallbacks, 9814 // #5280: Internet Explorer will keep connections alive if we don't abort on unload 9815 xhrOnUnloadAbort = window.ActiveXObject ? function () 9816 { 9817 // Abort all pending requests 9818 for (var key in xhrCallbacks) 9819 { 9820 xhrCallbacks[ key ](0, 1); 9821 } 9822 } : false, 9823 xhrId = 0; 9824 9825// Functions to create xhrs 9826 function createStandardXHR() 9827 { 9828 try 9829 { 9830 return new window.XMLHttpRequest(); 9831 } catch (e) 9832 { 9833 } 9834 } 9835 9836 function createActiveXHR() 9837 { 9838 try 9839 { 9840 return new window.ActiveXObject("Microsoft.XMLHTTP"); 9841 } catch (e) 9842 { 9843 } 9844 } 9845 9846// Create the request object 9847// (This is still attached to ajaxSettings for backward compatibility) 9848 jQuery.ajaxSettings.xhr = window.ActiveXObject ? 9849 /* Microsoft failed to properly 9850 * implement the XMLHttpRequest in IE7 (can't request local files), 9851 * so we use the ActiveXObject when it is available 9852 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so 9853 * we need a fallback. 9854 */ 9855 function () 9856 { 9857 return !this.isLocal && createStandardXHR() || createActiveXHR(); 9858 } : 9859 // For all other browsers, use the standard XMLHttpRequest object 9860 createStandardXHR; 9861 9862// Determine support properties 9863 (function (xhr) 9864 { 9865 jQuery.extend(jQuery.support, { 9866 ajax: !!xhr, 9867 cors: !!xhr && ( "withCredentials" in xhr ) 9868 }); 9869 })(jQuery.ajaxSettings.xhr()); 9870 9871// Create transport if the browser can provide an xhr 9872 if (jQuery.support.ajax) 9873 { 9874 9875 jQuery.ajaxTransport(function (s) 9876 { 9877 // Cross domain only allowed if supported through XMLHttpRequest 9878 if (!s.crossDomain || jQuery.support.cors) 9879 { 9880 9881 var callback; 9882 9883 return { 9884 send: function (headers, complete) 9885 { 9886 9887 // Get a new xhr 9888 var handle, i, 9889 xhr = s.xhr(); 9890 9891 // Open the socket 9892 // Passing null username, generates a login popup on Opera (#2865) 9893 if (s.username) 9894 { 9895 xhr.open(s.type, s.url, s.async, s.username, s.password); 9896 } else 9897 { 9898 xhr.open(s.type, s.url, s.async); 9899 } 9900 9901 // Apply custom fields if provided 9902 if (s.xhrFields) 9903 { 9904 for (i in s.xhrFields) 9905 { 9906 xhr[ i ] = s.xhrFields[ i ]; 9907 } 9908 } 9909 9910 // Override mime type if needed 9911 if (s.mimeType && xhr.overrideMimeType) 9912 { 9913 xhr.overrideMimeType(s.mimeType); 9914 } 9915 9916 // X-Requested-With header 9917 // For cross-domain requests, seeing as conditions for a preflight are 9918 // akin to a jigsaw puzzle, we simply never set it to be sure. 9919 // (it can always be set on a per-request basis or even using ajaxSetup) 9920 // For same-domain requests, won't change header if already provided. 9921 if (!s.crossDomain && !headers["X-Requested-With"]) 9922 { 9923 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 9924 } 9925 9926 // Need an extra try/catch for cross domain requests in Firefox 3 9927 try 9928 { 9929 for (i in headers) 9930 { 9931 xhr.setRequestHeader(i, headers[ i ]); 9932 } 9933 } catch (_) 9934 { 9935 } 9936 9937 // Do send the request 9938 // This may raise an exception which is actually 9939 // handled in jQuery.ajax (so no try/catch here) 9940 xhr.send(( s.hasContent && s.data ) || null); 9941 9942 // Listener 9943 callback = function (_, isAbort) 9944 { 9945 9946 var status, 9947 statusText, 9948 responseHeaders, 9949 responses, 9950 xml; 9951 9952 // Firefox throws exceptions when accessing properties 9953 // of an xhr when a network error occurred 9954 // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) 9955 try 9956 { 9957 9958 // Was never called and is aborted or complete 9959 if (callback && ( isAbort || xhr.readyState === 4 )) 9960 { 9961 9962 // Only called once 9963 callback = undefined; 9964 9965 // Do not keep as active anymore 9966 if (handle) 9967 { 9968 xhr.onreadystatechange = jQuery.noop; 9969 if (xhrOnUnloadAbort) 9970 { 9971 delete xhrCallbacks[ handle ]; 9972 } 9973 } 9974 9975 // If it's an abort 9976 if (isAbort) 9977 { 9978 // Abort it manually if needed 9979 if (xhr.readyState !== 4) 9980 { 9981 xhr.abort(); 9982 } 9983 } else 9984 { 9985 status = xhr.status; 9986 responseHeaders = xhr.getAllResponseHeaders(); 9987 responses = {}; 9988 xml = xhr.responseXML; 9989 9990 // Construct response list 9991 if (xml && xml.documentElement /* #4958 */) 9992 { 9993 responses.xml = xml; 9994 } 9995 9996 // When requesting binary data, IE6-9 will throw an exception 9997 // on any attempt to access responseText (#11426) 9998 try 9999 { 10000 responses.text = xhr.responseText; 10001 } catch (e) 10002 { 10003 } 10004 10005 // Firefox throws an exception when accessing 10006 // statusText for faulty cross-domain requests 10007 try 10008 { 10009 statusText = xhr.statusText; 10010 } catch (e) 10011 { 10012 // We normalize with Webkit giving an empty statusText 10013 statusText = ""; 10014 } 10015 10016 // Filter status for non standard behaviors 10017 10018 // If the request is local and we have data: assume a success 10019 // (success with no data won't get notified, that's the best we 10020 // can do given current implementations) 10021 if (!status && s.isLocal && !s.crossDomain) 10022 { 10023 status = responses.text ? 200 : 404; 10024 // IE - #1450: sometimes returns 1223 when it should be 204 10025 } else if (status === 1223) 10026 { 10027 status = 204; 10028 } 10029 } 10030 } 10031 } catch (firefoxAccessException) 10032 { 10033 if (!isAbort) 10034 { 10035 complete(-1, firefoxAccessException); 10036 } 10037 } 10038 10039 // Call complete if needed 10040 if (responses) 10041 { 10042 complete(status, statusText, responses, responseHeaders); 10043 } 10044 }; 10045 10046 if (!s.async) 10047 { 10048 // if we're in sync mode we fire the callback 10049 callback(); 10050 } else if (xhr.readyState === 4) 10051 { 10052 // (IE6 & IE7) if it's in cache and has been 10053 // retrieved directly we need to fire the callback 10054 setTimeout(callback, 0); 10055 } else 10056 { 10057 handle = ++xhrId; 10058 if (xhrOnUnloadAbort) 10059 { 10060 // Create the active xhrs callbacks list if needed 10061 // and attach the unload handler 10062 if (!xhrCallbacks) 10063 { 10064 xhrCallbacks = {}; 10065 jQuery(window).unload(xhrOnUnloadAbort); 10066 } 10067 // Add to list of active xhrs callbacks 10068 xhrCallbacks[ handle ] = callback; 10069 } 10070 xhr.onreadystatechange = callback; 10071 } 10072 }, 10073 10074 abort: function () 10075 { 10076 if (callback) 10077 { 10078 callback(0, 1); 10079 } 10080 } 10081 }; 10082 } 10083 }); 10084 } 10085 var fxNow, timerId, 10086 rfxtypes = /^(?:toggle|show|hide)$/, 10087 rfxnum = new RegExp("^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i"), 10088 rrun = /queueHooks$/, 10089 animationPrefilters = [ defaultPrefilter ], 10090 tweeners = { 10091 "*": [function (prop, value) 10092 { 10093 var end, unit, 10094 tween = this.createTween(prop, value), 10095 parts = rfxnum.exec(value), 10096 target = tween.cur(), 10097 start = +target || 0, 10098 scale = 1, 10099 maxIterations = 20; 10100 10101 if (parts) 10102 { 10103 end = +parts[2]; 10104 unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 10105 10106 // We need to compute starting value 10107 if (unit !== "px" && start) 10108 { 10109 // Iteratively approximate from a nonzero starting point 10110 // Prefer the current property, because this process will be trivial if it uses the same units 10111 // Fallback to end or a simple constant 10112 start = jQuery.css(tween.elem, prop, true) || end || 1; 10113 10114 do { 10115 // If previous iteration zeroed out, double until we get *something* 10116 // Use a string for doubling factor so we don't accidentally see scale as unchanged below 10117 scale = scale || ".5"; 10118 10119 // Adjust and apply 10120 start = start / scale; 10121 jQuery.style(tween.elem, prop, start + unit); 10122 10123 // Update scale, tolerating zero or NaN from tween.cur() 10124 // And breaking the loop if scale is unchanged or perfect, or if we've just had enough 10125 } while (scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations); 10126 } 10127 10128 tween.unit = unit; 10129 tween.start = start; 10130 // If a +=/-= token was provided, we're doing a relative animation 10131 tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; 10132 } 10133 return tween; 10134 }] 10135 }; 10136 10137// Animations created synchronously will run synchronously 10138 function createFxNow() 10139 { 10140 setTimeout(function () 10141 { 10142 fxNow = undefined; 10143 }, 0); 10144 return ( fxNow = jQuery.now() ); 10145 } 10146 10147 function createTweens(animation, props) 10148 { 10149 jQuery.each(props, function (prop, value) 10150 { 10151 var collection = ( tweeners[ prop ] || [] ).concat(tweeners[ "*" ]), 10152 index = 0, 10153 length = collection.length; 10154 for (; index < length; index++) 10155 { 10156 if (collection[ index ].call(animation, prop, value)) 10157 { 10158 10159 // we're done with this property 10160 return; 10161 } 10162 } 10163 }); 10164 } 10165 10166 function Animation(elem, properties, options) 10167 { 10168 var result, 10169 index = 0, 10170 tweenerIndex = 0, 10171 length = animationPrefilters.length, 10172 deferred = jQuery.Deferred().always(function () 10173 { 10174 // don't match elem in the :animated selector 10175 delete tick.elem; 10176 }), 10177 tick = function () 10178 { 10179 var currentTime = fxNow || createFxNow(), 10180 remaining = Math.max(0, animation.startTime + animation.duration - currentTime), 10181 // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) 10182 temp = remaining / animation.duration || 0, 10183 percent = 1 - temp, 10184 index = 0, 10185 length = animation.tweens.length; 10186 10187 for (; index < length; index++) 10188 { 10189 animation.tweens[ index ].run(percent); 10190 } 10191 10192 deferred.notifyWith(elem, [ animation, percent, remaining ]); 10193 10194 if (percent < 1 && length) 10195 { 10196 return remaining; 10197 } else 10198 { 10199 deferred.resolveWith(elem, [ animation ]); 10200 return false; 10201 } 10202 }, 10203 animation = deferred.promise({ 10204 elem: elem, 10205 props: jQuery.extend({}, properties), 10206 opts: jQuery.extend(true, { specialEasing: {} }, options), 10207 originalProperties: properties, 10208 originalOptions: options, 10209 startTime: fxNow || createFxNow(), 10210 duration: options.duration, 10211 tweens: [], 10212 createTween: function (prop, end, easing) 10213 { 10214 var tween = jQuery.Tween(elem, animation.opts, prop, end, 10215 animation.opts.specialEasing[ prop ] || animation.opts.easing); 10216 animation.tweens.push(tween); 10217 return tween; 10218 }, 10219 stop: function (gotoEnd) 10220 { 10221 var index = 0, 10222 // if we are going to the end, we want to run all the tweens 10223 // otherwise we skip this part 10224 length = gotoEnd ? animation.tweens.length : 0; 10225 10226 for (; index < length; index++) 10227 { 10228 animation.tweens[ index ].run(1); 10229 } 10230 10231 // resolve when we played the last frame 10232 // otherwise, reject 10233 if (gotoEnd) 10234 { 10235 deferred.resolveWith(elem, [ animation, gotoEnd ]); 10236 } else 10237 { 10238 deferred.rejectWith(elem, [ animation, gotoEnd ]); 10239 } 10240 return this; 10241 } 10242 }), 10243 props = animation.props; 10244 10245 propFilter(props, animation.opts.specialEasing); 10246 10247 for (; index < length; index++) 10248 { 10249 result = animationPrefilters[ index ].call(animation, elem, props, animation.opts); 10250 if (result) 10251 { 10252 return result; 10253 } 10254 } 10255 10256 createTweens(animation, props); 10257 10258 if (jQuery.isFunction(animation.opts.start)) 10259 { 10260 animation.opts.start.call(elem, animation); 10261 } 10262 10263 jQuery.fx.timer( 10264 jQuery.extend(tick, { 10265 anim: animation, 10266 queue: animation.opts.queue, 10267 elem: elem 10268 }) 10269 ); 10270 10271 // attach callbacks from options 10272 return animation.progress(animation.opts.progress) 10273 .done(animation.opts.done, animation.opts.complete) 10274 .fail(animation.opts.fail) 10275 .always(animation.opts.always); 10276 } 10277 10278 function propFilter(props, specialEasing) 10279 { 10280 var index, name, easing, value, hooks; 10281 10282 // camelCase, specialEasing and expand cssHook pass 10283 for (index in props) 10284 { 10285 name = jQuery.camelCase(index); 10286 easing = specialEasing[ name ]; 10287 value = props[ index ]; 10288 if (jQuery.isArray(value)) 10289 { 10290 easing = value[ 1 ]; 10291 value = props[ index ] = value[ 0 ]; 10292 } 10293 10294 if (index !== name) 10295 { 10296 props[ name ] = value; 10297 delete props[ index ]; 10298 } 10299 10300 hooks = jQuery.cssHooks[ name ]; 10301 if (hooks && "expand" in hooks) 10302 { 10303 value = hooks.expand(value); 10304 delete props[ name ]; 10305 10306 // not quite $.extend, this wont overwrite keys already present. 10307 // also - reusing 'index' from above because we have the correct "name" 10308 for (index in value) 10309 { 10310 if (!( index in props )) 10311 { 10312 props[ index ] = value[ index ]; 10313 specialEasing[ index ] = easing; 10314 } 10315 } 10316 } else 10317 { 10318 specialEasing[ name ] = easing; 10319 } 10320 } 10321 } 10322 10323 jQuery.Animation = jQuery.extend(Animation, { 10324 10325 tweener: function (props, callback) 10326 { 10327 if (jQuery.isFunction(props)) 10328 { 10329 callback = props; 10330 props = [ "*" ]; 10331 } else 10332 { 10333 props = props.split(" "); 10334 } 10335 10336 var prop, 10337 index = 0, 10338 length = props.length; 10339 10340 for (; index < length; index++) 10341 { 10342 prop = props[ index ]; 10343 tweeners[ prop ] = tweeners[ prop ] || []; 10344 tweeners[ prop ].unshift(callback); 10345 } 10346 }, 10347 10348 prefilter: function (callback, prepend) 10349 { 10350 if (prepend) 10351 { 10352 animationPrefilters.unshift(callback); 10353 } else 10354 { 10355 animationPrefilters.push(callback); 10356 } 10357 } 10358 }); 10359 10360 function defaultPrefilter(elem, props, opts) 10361 { 10362 var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire, 10363 anim = this, 10364 style = elem.style, 10365 orig = {}, 10366 handled = [], 10367 hidden = elem.nodeType && isHidden(elem); 10368 10369 // handle queue: false promises 10370 if (!opts.queue) 10371 { 10372 hooks = jQuery._queueHooks(elem, "fx"); 10373 if (hooks.unqueued == null) 10374 { 10375 hooks.unqueued = 0; 10376 oldfire = hooks.empty.fire; 10377 hooks.empty.fire = function () 10378 { 10379 if (!hooks.unqueued) 10380 { 10381 oldfire(); 10382 } 10383 }; 10384 } 10385 hooks.unqueued++; 10386 10387 anim.always(function () 10388 { 10389 // doing this makes sure that the complete handler will be called 10390 // before this completes 10391 anim.always(function () 10392 { 10393 hooks.unqueued--; 10394 if (!jQuery.queue(elem, "fx").length) 10395 { 10396 hooks.empty.fire(); 10397 } 10398 }); 10399 }); 10400 } 10401 10402 // height/width overflow pass 10403 if (elem.nodeType === 1 && ( "height" in props || "width" in props )) 10404 { 10405 // Make sure that nothing sneaks out 10406 // Record all 3 overflow attributes because IE does not 10407 // change the overflow attribute when overflowX and 10408 // overflowY are set to the same value 10409 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 10410 10411 // Set display property to inline-block for height/width 10412 // animations on inline elements that are having width/height animated 10413 if (jQuery.css(elem, "display") === "inline" && 10414 jQuery.css(elem, "float") === "none") 10415 { 10416 10417 // inline-level elements accept inline-block; 10418 // block-level elements need to be inline with layout 10419 if (!jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay(elem.nodeName) === "inline") 10420 { 10421 style.display = "inline-block"; 10422 10423 } else 10424 { 10425 style.zoom = 1; 10426 } 10427 } 10428 } 10429 10430 if (opts.overflow) 10431 { 10432 style.overflow = "hidden"; 10433 if (!jQuery.support.shrinkWrapBlocks) 10434 { 10435 anim.done(function () 10436 { 10437 style.overflow = opts.overflow[ 0 ]; 10438 style.overflowX = opts.overflow[ 1 ]; 10439 style.overflowY = opts.overflow[ 2 ]; 10440 }); 10441 } 10442 } 10443 10444 10445 // show/hide pass 10446 for (index in props) 10447 { 10448 value = props[ index ]; 10449 if (rfxtypes.exec(value)) 10450 { 10451 delete props[ index ]; 10452 toggle = toggle || value === "toggle"; 10453 if (value === ( hidden ? "hide" : "show" )) 10454 { 10455 continue; 10456 } 10457 handled.push(index); 10458 } 10459 } 10460 10461 length = handled.length; 10462 if (length) 10463 { 10464 dataShow = jQuery._data(elem, "fxshow") || jQuery._data(elem, "fxshow", {}); 10465 if ("hidden" in dataShow) 10466 { 10467 hidden = dataShow.hidden; 10468 } 10469 10470 // store state if its toggle - enables .stop().toggle() to "reverse" 10471 if (toggle) 10472 { 10473 dataShow.hidden = !hidden; 10474 } 10475 if (hidden) 10476 { 10477 jQuery(elem).show(); 10478 } else 10479 { 10480 anim.done(function () 10481 { 10482 jQuery(elem).hide(); 10483 }); 10484 } 10485 anim.done(function () 10486 { 10487 var prop; 10488 jQuery.removeData(elem, "fxshow", true); 10489 for (prop in orig) 10490 { 10491 jQuery.style(elem, prop, orig[ prop ]); 10492 } 10493 }); 10494 for (index = 0; index < length; index++) 10495 { 10496 prop = handled[ index ]; 10497 tween = anim.createTween(prop, hidden ? dataShow[ prop ] : 0); 10498 orig[ prop ] = dataShow[ prop ] || jQuery.style(elem, prop); 10499 10500 if (!( prop in dataShow )) 10501 { 10502 dataShow[ prop ] = tween.start; 10503 if (hidden) 10504 { 10505 tween.end = tween.start; 10506 tween.start = prop === "width" || prop === "height" ? 1 : 0; 10507 } 10508 } 10509 } 10510 } 10511 } 10512 10513 function Tween(elem, options, prop, end, easing) 10514 { 10515 return new Tween.prototype.init(elem, options, prop, end, easing); 10516 } 10517 10518 jQuery.Tween = Tween; 10519 10520 Tween.prototype = { 10521 constructor: Tween, 10522 init: function (elem, options, prop, end, easing, unit) 10523 { 10524 this.elem = elem; 10525 this.prop = prop; 10526 this.easing = easing || "swing"; 10527 this.options = options; 10528 this.start = this.now = this.cur(); 10529 this.end = end; 10530 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 10531 }, 10532 cur: function () 10533 { 10534 var hooks = Tween.propHooks[ this.prop ]; 10535 10536 return hooks && hooks.get ? 10537 hooks.get(this) : 10538 Tween.propHooks._default.get(this); 10539 }, 10540 run: function (percent) 10541 { 10542 var eased, 10543 hooks = Tween.propHooks[ this.prop ]; 10544 10545 if (this.options.duration) 10546 { 10547 this.pos = eased = jQuery.easing[ this.easing ]( 10548 percent, this.options.duration * percent, 0, 1, this.options.duration 10549 ); 10550 } else 10551 { 10552 this.pos = eased = percent; 10553 } 10554 this.now = ( this.end - this.start ) * eased + this.start; 10555 10556 if (this.options.step) 10557 { 10558 this.options.step.call(this.elem, this.now, this); 10559 } 10560 10561 if (hooks && hooks.set) 10562 { 10563 hooks.set(this); 10564 } else 10565 { 10566 Tween.propHooks._default.set(this); 10567 } 10568 return this; 10569 } 10570 }; 10571 10572 Tween.prototype.init.prototype = Tween.prototype; 10573 10574 Tween.propHooks = { 10575 _default: { 10576 get: function (tween) 10577 { 10578 var result; 10579 10580 if (tween.elem[ tween.prop ] != null && 10581 (!tween.elem.style || tween.elem.style[ tween.prop ] == null)) 10582 { 10583 return tween.elem[ tween.prop ]; 10584 } 10585 10586 // passing any value as a 4th parameter to .css will automatically 10587 // attempt a parseFloat and fallback to a string if the parse fails 10588 // so, simple values such as "10px" are parsed to Float. 10589 // complex values such as "rotate(1rad)" are returned as is. 10590 result = jQuery.css(tween.elem, tween.prop, false, ""); 10591 // Empty strings, null, undefined and "auto" are converted to 0. 10592 return !result || result === "auto" ? 0 : result; 10593 }, 10594 set: function (tween) 10595 { 10596 // use step hook for back compat - use cssHook if its there - use .style if its 10597 // available and use plain properties where available 10598 if (jQuery.fx.step[ tween.prop ]) 10599 { 10600 jQuery.fx.step[ tween.prop ](tween); 10601 } else if (tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] )) 10602 { 10603 jQuery.style(tween.elem, tween.prop, tween.now + tween.unit); 10604 } else 10605 { 10606 tween.elem[ tween.prop ] = tween.now; 10607 } 10608 } 10609 } 10610 }; 10611 10612// Remove in 2.0 - this supports IE8's panic based approach 10613// to setting things on disconnected nodes 10614 10615 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 10616 set: function (tween) 10617 { 10618 if (tween.elem.nodeType && tween.elem.parentNode) 10619 { 10620 tween.elem[ tween.prop ] = tween.now; 10621 } 10622 } 10623 }; 10624 10625 jQuery.each([ "toggle", "show", "hide" ], function (i, name) 10626 { 10627 var cssFn = jQuery.fn[ name ]; 10628 jQuery.fn[ name ] = function (speed, easing, callback) 10629 { 10630 return speed == null || typeof speed === "boolean" || 10631 // special check for .toggle( handler, handler, ... ) 10632 ( !i && jQuery.isFunction(speed) && jQuery.isFunction(easing) ) ? 10633 cssFn.apply(this, arguments) : 10634 this.animate(genFx(name, true), speed, easing, callback); 10635 }; 10636 }); 10637 10638 jQuery.fn.extend({ 10639 fadeTo: function (speed, to, easing, callback) 10640 { 10641 10642 // show any hidden elements after setting opacity to 0 10643 return this.filter(isHidden).css("opacity", 0).show() 10644 10645 // animate to the value specified 10646 .end().animate({ opacity: to }, speed, easing, callback); 10647 }, 10648 animate: function (prop, speed, easing, callback) 10649 { 10650 var empty = jQuery.isEmptyObject(prop), 10651 optall = jQuery.speed(speed, easing, callback), 10652 doAnimation = function () 10653 { 10654 // Operate on a copy of prop so per-property easing won't be lost 10655 var anim = Animation(this, jQuery.extend({}, prop), optall); 10656 10657 // Empty animations resolve immediately 10658 if (empty) 10659 { 10660 anim.stop(true); 10661 } 10662 }; 10663 10664 return empty || optall.queue === false ? 10665 this.each(doAnimation) : 10666 this.queue(optall.queue, doAnimation); 10667 }, 10668 stop: function (type, clearQueue, gotoEnd) 10669 { 10670 var stopQueue = function (hooks) 10671 { 10672 var stop = hooks.stop; 10673 delete hooks.stop; 10674 stop(gotoEnd); 10675 }; 10676 10677 if (typeof type !== "string") 10678 { 10679 gotoEnd = clearQueue; 10680 clearQueue = type; 10681 type = undefined; 10682 } 10683 if (clearQueue && type !== false) 10684 { 10685 this.queue(type || "fx", []); 10686 } 10687 10688 return this.each(function () 10689 { 10690 var dequeue = true, 10691 index = type != null && type + "queueHooks", 10692 timers = jQuery.timers, 10693 data = jQuery._data(this); 10694 10695 if (index) 10696 { 10697 if (data[ index ] && data[ index ].stop) 10698 { 10699 stopQueue(data[ index ]); 10700 } 10701 } else 10702 { 10703 for (index in data) 10704 { 10705 if (data[ index ] && data[ index ].stop && rrun.test(index)) 10706 { 10707 stopQueue(data[ index ]); 10708 } 10709 } 10710 } 10711 10712 for (index = timers.length; index--;) 10713 { 10714 if (timers[ index ].elem === this && (type == null || timers[ index ].queue === type)) 10715 { 10716 timers[ index ].anim.stop(gotoEnd); 10717 dequeue = false; 10718 timers.splice(index, 1); 10719 } 10720 } 10721 10722 // start the next in the queue if the last step wasn't forced 10723 // timers currently will call their complete callbacks, which will dequeue 10724 // but only if they were gotoEnd 10725 if (dequeue || !gotoEnd) 10726 { 10727 jQuery.dequeue(this, type); 10728 } 10729 }); 10730 } 10731 }); 10732 10733// Generate parameters to create a standard animation 10734 function genFx(type, includeWidth) 10735 { 10736 var which, 10737 attrs = { height: type }, 10738 i = 0; 10739 10740 // if we include width, step value is 1 to do all cssExpand values, 10741 // if we don't include width, step value is 2 to skip over Left and Right 10742 includeWidth = includeWidth ? 1 : 0; 10743 for (; i < 4; i += 2 - includeWidth) 10744 { 10745 which = cssExpand[ i ]; 10746 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 10747 } 10748 10749 if (includeWidth) 10750 { 10751 attrs.opacity = attrs.width = type; 10752 } 10753 10754 return attrs; 10755 } 10756 10757// Generate shortcuts for custom animations 10758 jQuery.each({ 10759 slideDown: genFx("show"), 10760 slideUp: genFx("hide"), 10761 slideToggle: genFx("toggle"), 10762 fadeIn: { opacity: "show" }, 10763 fadeOut: { opacity: "hide" }, 10764 fadeToggle: { opacity: "toggle" } 10765 }, function (name, props) 10766 { 10767 jQuery.fn[ name ] = function (speed, easing, callback) 10768 { 10769 return this.animate(props, speed, easing, callback); 10770 }; 10771 }); 10772 10773 jQuery.speed = function (speed, easing, fn) 10774 { 10775 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : { 10776 complete: fn || !fn && easing || 10777 jQuery.isFunction(speed) && speed, 10778 duration: speed, 10779 easing: fn && easing || easing && !jQuery.isFunction(easing) && easing 10780 }; 10781 10782 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : 10783 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; 10784 10785 // normalize opt.queue - true/undefined/null -> "fx" 10786 if (opt.queue == null || opt.queue === true) 10787 { 10788 opt.queue = "fx"; 10789 } 10790 10791 // Queueing 10792 opt.old = opt.complete; 10793 10794 opt.complete = function () 10795 { 10796 if (jQuery.isFunction(opt.old)) 10797 { 10798 opt.old.call(this); 10799 } 10800 10801 if (opt.queue) 10802 { 10803 jQuery.dequeue(this, opt.queue); 10804 } 10805 }; 10806 10807 return opt; 10808 }; 10809 10810 jQuery.easing = { 10811 linear: function (p) 10812 { 10813 return p; 10814 }, 10815 swing: function (p) 10816 { 10817 return 0.5 - Math.cos(p * Math.PI) / 2; 10818 } 10819 }; 10820 10821 jQuery.timers = []; 10822 jQuery.fx = Tween.prototype.init; 10823 jQuery.fx.tick = function () 10824 { 10825 var timer, 10826 timers = jQuery.timers, 10827 i = 0; 10828 10829 fxNow = jQuery.now(); 10830 10831 for (; i < timers.length; i++) 10832 { 10833 timer = timers[ i ]; 10834 // Checks the timer has not already been removed 10835 if (!timer() && timers[ i ] === timer) 10836 { 10837 timers.splice(i--, 1); 10838 } 10839 } 10840 10841 if (!timers.length) 10842 { 10843 jQuery.fx.stop(); 10844 } 10845 fxNow = undefined; 10846 }; 10847 10848 jQuery.fx.timer = function (timer) 10849 { 10850 if (timer() && jQuery.timers.push(timer) && !timerId) 10851 { 10852 timerId = setInterval(jQuery.fx.tick, jQuery.fx.interval); 10853 } 10854 }; 10855 10856 jQuery.fx.interval = 13; 10857 10858 jQuery.fx.stop = function () 10859 { 10860 clearInterval(timerId); 10861 timerId = null; 10862 }; 10863 10864 jQuery.fx.speeds = { 10865 slow: 600, 10866 fast: 200, 10867 // Default speed 10868 _default: 400 10869 }; 10870 10871// Back Compat <1.8 extension point 10872 jQuery.fx.step = {}; 10873 10874 if (jQuery.expr && jQuery.expr.filters) 10875 { 10876 jQuery.expr.filters.animated = function (elem) 10877 { 10878 return jQuery.grep(jQuery.timers,function (fn) 10879 { 10880 return elem === fn.elem; 10881 }).length; 10882 }; 10883 } 10884 var rroot = /^(?:body|html)$/i; 10885 10886 jQuery.fn.offset = function (options) 10887 { 10888 if (arguments.length) 10889 { 10890 return options === undefined ? 10891 this : 10892 this.each(function (i) 10893 { 10894 jQuery.offset.setOffset(this, options, i); 10895 }); 10896 } 10897 10898 var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, 10899 box = { top: 0, left: 0 }, 10900 elem = this[ 0 ], 10901 doc = elem && elem.ownerDocument; 10902 10903 if (!doc) 10904 { 10905 return; 10906 } 10907 10908 if ((body = doc.body) === elem) 10909 { 10910 return jQuery.offset.bodyOffset(elem); 10911 } 10912 10913 docElem = doc.documentElement; 10914 10915 // Make sure it's not a disconnected DOM node 10916 if (!jQuery.contains(docElem, elem)) 10917 { 10918 return box; 10919 } 10920 10921 // If we don't have gBCR, just use 0,0 rather than error 10922 // BlackBerry 5, iOS 3 (original iPhone) 10923 if (typeof elem.getBoundingClientRect !== "undefined") 10924 { 10925 box = elem.getBoundingClientRect(); 10926 } 10927 win = getWindow(doc); 10928 clientTop = docElem.clientTop || body.clientTop || 0; 10929 clientLeft = docElem.clientLeft || body.clientLeft || 0; 10930 scrollTop = win.pageYOffset || docElem.scrollTop; 10931 scrollLeft = win.pageXOffset || docElem.scrollLeft; 10932 return { 10933 top: box.top + scrollTop - clientTop, 10934 left: box.left + scrollLeft - clientLeft 10935 }; 10936 }; 10937 10938 jQuery.offset = { 10939 10940 bodyOffset: function (body) 10941 { 10942 var top = body.offsetTop, 10943 left = body.offsetLeft; 10944 10945 if (jQuery.support.doesNotIncludeMarginInBodyOffset) 10946 { 10947 top += parseFloat(jQuery.css(body, "marginTop")) || 0; 10948 left += parseFloat(jQuery.css(body, "marginLeft")) || 0; 10949 } 10950 10951 return { top: top, left: left }; 10952 }, 10953 10954 setOffset: function (elem, options, i) 10955 { 10956 var position = jQuery.css(elem, "position"); 10957 10958 // set position first, in-case top/left are set even on static elem 10959 if (position === "static") 10960 { 10961 elem.style.position = "relative"; 10962 } 10963 10964 var curElem = jQuery(elem), 10965 curOffset = curElem.offset(), 10966 curCSSTop = jQuery.css(elem, "top"), 10967 curCSSLeft = jQuery.css(elem, "left"), 10968 calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, 10969 props = {}, curPosition = {}, curTop, curLeft; 10970 10971 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed 10972 if (calculatePosition) 10973 { 10974 curPosition = curElem.position(); 10975 curTop = curPosition.top; 10976 curLeft = curPosition.left; 10977 } else 10978 { 10979 curTop = parseFloat(curCSSTop) || 0; 10980 curLeft = parseFloat(curCSSLeft) || 0; 10981 } 10982 10983 if (jQuery.isFunction(options)) 10984 { 10985 options = options.call(elem, i, curOffset); 10986 } 10987 10988 if (options.top != null) 10989 { 10990 props.top = ( options.top - curOffset.top ) + curTop; 10991 } 10992 if (options.left != null) 10993 { 10994 props.left = ( options.left - curOffset.left ) + curLeft; 10995 } 10996 10997 if ("using" in options) 10998 { 10999 options.using.call(elem, props); 11000 } else 11001 { 11002 curElem.css(props); 11003 } 11004 } 11005 }; 11006 11007 11008 jQuery.fn.extend({ 11009 11010 position: function () 11011 { 11012 if (!this[0]) 11013 { 11014 return; 11015 } 11016 11017 var elem = this[0], 11018 11019 // Get *real* offsetParent 11020 offsetParent = this.offsetParent(), 11021 11022 // Get correct offsets 11023 offset = this.offset(), 11024 parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); 11025 11026 // Subtract element margins 11027 // note: when an element has margin: auto the offsetLeft and marginLeft 11028 // are the same in Safari causing offset.left to incorrectly be 0 11029 offset.top -= parseFloat(jQuery.css(elem, "marginTop")) || 0; 11030 offset.left -= parseFloat(jQuery.css(elem, "marginLeft")) || 0; 11031 11032 // Add offsetParent borders 11033 parentOffset.top += parseFloat(jQuery.css(offsetParent[0], "borderTopWidth")) || 0; 11034 parentOffset.left += parseFloat(jQuery.css(offsetParent[0], "borderLeftWidth")) || 0; 11035 11036 // Subtract the two offsets 11037 return { 11038 top: offset.top - parentOffset.top, 11039 left: offset.left - parentOffset.left 11040 }; 11041 }, 11042 11043 offsetParent: function () 11044 { 11045 return this.map(function () 11046 { 11047 var offsetParent = this.offsetParent || document.body; 11048 while (offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static")) 11049 { 11050 offsetParent = offsetParent.offsetParent; 11051 } 11052 return offsetParent || document.body; 11053 }); 11054 } 11055 }); 11056 11057 11058// Create scrollLeft and scrollTop methods 11059 jQuery.each({scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function (method, prop) 11060 { 11061 var top = /Y/.test(prop); 11062 11063 jQuery.fn[ method ] = function (val) 11064 { 11065 return jQuery.access(this, function (elem, method, val) 11066 { 11067 var win = getWindow(elem); 11068 11069 if (val === undefined) 11070 { 11071 return win ? (prop in win) ? win[ prop ] : 11072 win.document.documentElement[ method ] : 11073 elem[ method ]; 11074 } 11075 11076 if (win) 11077 { 11078 win.scrollTo( 11079 !top ? val : jQuery(win).scrollLeft(), 11080 top ? val : jQuery(win).scrollTop() 11081 ); 11082 11083 } else 11084 { 11085 elem[ method ] = val; 11086 } 11087 }, method, val, arguments.length, null); 11088 }; 11089 }); 11090 11091 function getWindow(elem) 11092 { 11093 return jQuery.isWindow(elem) ? 11094 elem : 11095 elem.nodeType === 9 ? 11096 elem.defaultView || elem.parentWindow : 11097 false; 11098 } 11099 11100// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 11101 jQuery.each({ Height: "height", Width: "width" }, function (name, type) 11102 { 11103 jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) 11104 { 11105 // margin is only for outerHeight, outerWidth 11106 jQuery.fn[ funcName ] = function (margin, value) 11107 { 11108 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 11109 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 11110 11111 return jQuery.access(this, function (elem, type, value) 11112 { 11113 var doc; 11114 11115 if (jQuery.isWindow(elem)) 11116 { 11117 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there 11118 // isn't a whole lot we can do. See pull request at this URL for discussion: 11119 // https://github.com/jquery/jquery/pull/764 11120 return elem.document.documentElement[ "client" + name ]; 11121 } 11122 11123 // Get document width or height 11124 if (elem.nodeType === 9) 11125 { 11126 doc = elem.documentElement; 11127 11128 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest 11129 // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. 11130 return Math.max( 11131 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 11132 elem.body[ "offset" + name ], doc[ "offset" + name ], 11133 doc[ "client" + name ] 11134 ); 11135 } 11136 11137 return value === undefined ? 11138 // Get width or height on the element, requesting but not forcing parseFloat 11139 jQuery.css(elem, type, value, extra) : 11140 11141 // Set width or height on the element 11142 jQuery.style(elem, type, value, extra); 11143 }, type, chainable ? margin : undefined, chainable, null); 11144 }; 11145 }); 11146 }); 11147// Expose jQuery to the global object 11148// window.jQuery = window.$ = jQuery; 11149 11150// Expose jQuery as an AMD module, but only for AMD loaders that 11151// understand the issues with loading multiple versions of jQuery 11152// in a page that all might call define(). The loader will indicate 11153// they have special allowances for multiple jQuery versions by 11154// specifying define.amd.jQuery = true. Register as a named module, 11155// since jQuery can be concatenated with other files that may use define, 11156// but not use a proper concatenation script that understands anonymous 11157// AMD modules. A named AMD is safest and most robust way to register. 11158// Lowercase jquery is used because AMD module names are derived from 11159// file names, and jQuery is normally delivered in a lowercase file name. 11160// Do this after creating the global so that if an AMD module wants to call
11161// noConflict to hide this version of jQuery, it will work. 11162 if (typeof define === "function" && define.amd && define.amd.jQuery) 11163 { 11164 define("jquery", [], function () 11165 { 11166 return jQuery; 11167 }); 11168 } 11169 11170// Expose jQuery to the global object 11171 window.jfbcJQuery = jQuery.noConflict(); 11172 window.jfbcJQ = { 11173 extend: function (obj) 11174 { 11175 window.jfbcJQuery.extend(true, window.jfbcJQ, obj) 11176 }, 11177 jQuery: window.jfbcJQuery 11178 }; 11179 11180})(window); 11181 11182 11183/** 11184 * Bootstrap.js by @fat & @mdo 11185 * plugins: bootstrap-transition.js, bootstrap-modal.js, bootstrap-dropdown.js, bootstrap-scrollspy.js, bootstrap-tab.js, bootstrap-tooltip.js, bootstrap-popover.js, bootstrap-affix.js, bootstrap-alert.js, bootstrap-button.js, bootstrap-collapse.js, bootstrap-carousel.js, bootstrap-typeahead.js 11186 * Copyright 2012 Twitter, Inc. 11187 * http://www.apache.org/licenses/LICENSE-2.0.txt 11188 */ 11189!function (a) 11190{ 11191 a(function () 11192 { 11193 a.support.transition = function () 11194 { 11195 var a = function () 11196 { 11197 var a = document.createElement("sc-bootstrap"), b = {WebkitTransition: "webkitTransitionEnd", MozTransition: "transitionend", OTransition: "oTransitionEnd otransitionend", transition: "transitionend"}, c; 11198 for (c in b)if (a.style[c] !== undefined)return b[c] 11199 }(); 11200 return a && {end: a} 11201 }() 11202 }) 11203}(window.jfbcJQuery), !function (a) 11204{ 11205 var b = function (b, c) 11206 { 11207 this.options = c, this.$element = a(b).delegate('[data-dismiss="sc-modal"]', "click.dismiss.sc-modal", a.proxy(this.hide, this)), this.options.remote && this.$element.find(".sc-modal-body").load(this.options.remote) 11208 }; 11209 b.prototype = {constructor: b, toggle: function () 11210 { 11211 return this[this.isShown ? "hide" : "show"]() 11212 }, show: function () 11213 { 11214 var b = this, c = a.Event("show"); 11215 this.$element.trigger(c); 11216 if (this.isShown || c.isDefaultPrevented())return; 11217 this.isShown = !0, this.escape(), this.backdrop(function () 11218 { 11219 var c = a.support.transition && b.$element.hasClass("fade"); 11220 b.$element.parent().length || b.$element.appendTo(document.body), b.$element.show(), c && b.$element[0].offsetWidth, b.$element.addClass("in").attr("aria-hidden", !1), b.enforceFocus(), c ? b.$element.one(a.support.transition.end, function () 11221 { 11222 b.$element.focus().trigger("shown") 11223 }) : b.$element.focus().trigger("shown") 11224 }) 11225 }, hide: function (b) 11226 { 11227 b && b.preventDefault(); 11228 var c = this; 11229 b = a.Event("hide"), this.$element.trigger(b); 11230 if (!this.isShown || b.isDefaultPrevented())return; 11231 this.isShown = !1, this.escape(), a(document).off("focusin.sc-modal"), this.$element.removeClass("in").attr("aria-hidden", !0), a.support.transition && this.$element.hasClass("fade") ? this.hideWithTransition() : this.hideModal() 11232 }, enforceFocus: function () 11233 { 11234 var b = this; 11235 a(document).on("focusin.sc-modal", function (a) 11236 { 11237 b.$element[0] !== a.target && !b.$element.has(a.target).length && b.$element.focus() 11238 }) 11239 }, escape: function () 11240 { 11241 var a = this; 11242 this.isShown && this.options.keyboard ? this.$element.on("keyup.dismiss.sc-modal", function (b) 11243 { 11244 b.which == 27 && a.hide() 11245 }) : this.isShown || this.$element.off("keyup.dismiss.sc-modal") 11246 }, hideWithTransition: function () 11247 { 11248 var b = this, c = setTimeout(function () 11249 { 11250 b.$element.off(a.support.transition.end), b.hideModal() 11251 }, 500); 11252 this.$element.one(a.support.transition.end, function () 11253 { 11254 clearTimeout(c), b.hideModal() 11255 }) 11256 }, hideModal: function () 11257 { 11258 var a = this; 11259 this.$element.hide(), this.backdrop(function () 11260 { 11261 a.removeBackdrop(), a.$element.trigger("hidden") 11262 }) 11263 }, removeBackdrop: function () 11264 { 11265 this.$backdrop && this.$backdrop.remove(), this.$backdrop = null 11266 }, backdrop: function (b) 11267 { 11268 var c = this, d = this.$element.hasClass("fade") ? "fade" : ""; 11269 if (this.isShown && this.options.backdrop) 11270 { 11271 var e = a.support.transition && d; 11272 this.$backdrop = a('<div class="sourcecoast modal-backdrop ' + d + '" />').appendTo(document.body), this.$backdrop.click(this.options.backdrop == "static" ? a.proxy(this.$element[0].focus, this.$element[0]) : a.proxy(this.hide, this)), e && this.$backdrop[0].offsetWidth, this.$backdrop.addClass("in"); 11273 if (!b)return; 11274 e ? this.$backdrop.one(a.support.transition.end, b) : b() 11275 } else!this.isShown && this.$backdrop ? (this.$backdrop.removeClass("in"), a.support.transition && this.$element.hasClass("fade") ? this.$backdrop.one(a.support.transition.end, b) : b()) : b && b() 11276 }}; 11277 var c = a.fn.modal; 11278 a.fn.modal = function (c) 11279 { 11280 return this.each(function () 11281 { 11282 var d = a(this), e = d.data("sc-modal"), f = a.extend({}, a.fn.modal.defaults, d.data(), typeof c == "object" && c); 11283 e || d.data("sc-modal", e = new b(this, f)), typeof c == "string" ? e[c]() : f.show && e.show() 11284 }) 11285 }, a.fn.modal.defaults = {backdrop: !0, keyboard: !0, show: !0}, a.fn.modal.Constructor = b, a.fn.modal.noConflict = function () 11286 { 11287 return a.fn.modal = c, this 11288 }, a(document).on("click.sc-modal.data-api", '[data-toggle="sc-modal"]', function (b) 11289 { 11290 var c = a(this), d = c.attr("href"), e = a(c.attr("data-target") || d && d.replace(/.*(?=#[^\s]+$)/, "")), f = e.data("sc-modal") ? "toggle" : a.extend({remote: !/#/.test(d) && d}, e.data(), c.data()); 11291 b.preventDefault(), e.modal(f).one("hide", function () 11292 { 11293 c.focus() 11294 }) 11295 }) 11296}(window.jfbcJQuery); 11297 11298!function (e) 11299{ 11300 "use strict"; 11301 function r() 11302 { 11303 e(t).parent().parent().removeClass("nav-hover"); 11304 e(".dropdown-backdrop").remove(); 11305 e(t).each(function () 11306 { 11307 i(e(this)).removeClass("open") 11308 }) 11309 } 11310 11311 function i(t) 11312 { 11313 var n = t.attr("data-target"), r; 11314 if (!n) 11315 { 11316 n = t.attr("href"); 11317 n = n && /#/.test(n) && n.replace(/.*(?=#[^\s]*$)/, "") 11318 } 11319 r = n && e(n); 11320 if (!r || !r.length)r = t.parent(); 11321 return r 11322 } 11323 11324 var t = "[data-toggle=sc-dropdown]", n = function (t) 11325 { 11326 var n = e(t).on("click.dropdown.data-api", this.toggle).on('mouseover.dropdown.data-api', this.toggle); 11327 e("html").on("click.dropdown.data-api", function () 11328 { 11329 n.parent().parent().removeClass('nav-hover'); 11330 n.parent().removeClass("open") 11331 }) 11332 }; 11333 n.prototype = {constructor: n, toggle: function (t) 11334 { 11335 var n = e(this), s, o, u, h; 11336 if (n.is(".disabled, :disabled"))return; 11337 s = i(n); 11338 o = s.hasClass("open"); 11339 h = s.parent().hasClass("nav-hover"); 11340 if (!h && t.type == "mouseover")return; 11341 u = n.attr("href"); 11342 if (u && u !== "#") 11343 { 11344 window.location = u; 11345 return 11346 } 11347 r(); 11348 if ((!o && t.type != "mouseover") || (h && t.type == "mouseover")) 11349 { 11350 if ("ontouchstart"in document.documentElement) 11351 { 11352 e('<div class="dropdown-backdrop"/>').insertBefore(e(this)).on("click", r) 11353 } 11354 s.parent().toggleClass("nav-hover"); 11355 s.toggleClass("open") 11356 } 11357 n.focus(); 11358 return false 11359 }, keydown: function (n) 11360 { 11361 var r, s, o, u, a, f; 11362 if (!/(38|40|27)/.test(n.keyCode))return; 11363 r = e(this); 11364 n.preventDefault(); 11365 n.stopPropagation(); 11366 if (r.is(".disabled, :disabled"))return; 11367 u = i(r); 11368 a = u.hasClass("open"); 11369 if (!a || a && n.keyCode == 27) 11370 { 11371 if (n.which == 27)u.find(t).focus(); 11372 return r.click() 11373 } 11374 s = e("[role=menu] li:not(.divider):visible a", u); 11375 if (!s.length)return; 11376 f = s.index(s.filter(":focus")); 11377 if (n.keyCode == 38 && f > 0)f--; 11378 if (n.keyCode == 40 && f < s.length - 1)f++; 11379 if (!~f)f = 0; 11380 s.eq(f).focus() 11381 }}; 11382 var s = e.fn.dropdown; 11383 e.fn.dropdown = function (t) 11384 { 11385 return this.each(function () 11386 { 11387 var r = e(this), i = r.data("dropdown"); 11388 if (!i)r.data("dropdown", i = new n(this)); 11389 if (typeof t == "string")i[t].call(r) 11390 }) 11391 }; 11392 e.fn.dropdown.Constructor = n; 11393 e.fn.dropdown.noConflict = function () 11394 { 11395 e.fn.dropdown = s; 11396 return this 11397 }; 11398 e(document).on("click.dropdown.data-api", r).on("click.dropdown.data-api", ".dropdown form",function (e) 11399 { 11400 e.stopPropagation() 11401 }).on("click.dropdown.data-api", t, n.prototype.toggle).on("keydown.dropdown.data-api", t + ", [role=menu]", n.prototype.keydown).on("mouseover.dropdown.data-api", t, n.prototype.toggle) 11402}(window.jfbcJQuery); 11403 11404/* =========================================================== 11405 * bootstrap-tooltip.js v2.3.2 11406 * http://getbootstrap.com/2.3.2/javascript.html#tooltips 11407 * Inspired by the original jQuery.tipsy by Jason Frame 11408 * =========================================================== 11409 * Copyright 2013 Twitter, Inc. 11410 * 11411 * Licensed under the Apache License, Version 2.0 (the "License");
11412 * you may not use this file except in compliance with the License. 11413 * You may obtain a copy of the License at 11414 * 11415 * http://www.apache.org/licenses/LICENSE-2.0 11416 * 11417 * Unless required by applicable law or agreed to in writing, software 11418 * distributed under the License is distributed on an "AS IS" BASIS, 11419 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11420 * See the License for the specific language governing permissions and 11421 * limitations under the License. 11422 * ========================================================== */ 11423!function (a) 11424{ 11425 11426 "use strict"; // jshint ;_; 11427 11428 11429 /* TOOLTIP PUBLIC CLASS DEFINITION 11430 * =============================== */ 11431 11432 var Tooltip = function (element, options) 11433 { 11434 this.init('tooltip', element, options) 11435 } 11436 11437 Tooltip.prototype = { 11438 11439 constructor: Tooltip, init: function (type, element, options) 11440 { 11441 var eventIn 11442 , eventOut 11443 , triggers 11444 , trigger 11445 , i 11446 11447 this.type = type 11448 this.$element = a(element) 11449 this.options = this.getOptions(options) 11450 this.enabled = true 11451 11452 triggers = this.options.trigger.split(' ') 11453 11454 for (i = triggers.length; i--;) 11455 { 11456 trigger = triggers[i] 11457 if (trigger == 'click') 11458 { 11459 this.$element.on('click.' + this.type, this.options.selector, a.proxy(this.toggle, this)) 11460 } else if (trigger != 'manual') 11461 { 11462 eventIn = trigger == 'hover' ? 'mouseenter' : 'focus' 11463 eventOut = trigger == 'hover' ? 'mouseleave' : 'blur' 11464 this.$element.on(eventIn + '.' + this.type, this.options.selector, a.proxy(this.enter, this)) 11465 this.$element.on(eventOut + '.' + this.type, this.options.selector, a.proxy(this.leave, this)) 11466 } 11467 } 11468 11469 this.options.selector ? 11470 (this._options = a.extend({}, this.options, { trigger: 'manual', selector: '' })) : 11471 this.fixTitle() 11472 }, getOptions: function (options) 11473 { 11474 options = a.extend({}, a.fn[this.type].defaults, this.aelement.data(), options) 11475 11476 if (options.delay && typeof options.delay == 'number') 11477 { 11478 options.delay = { 11479 show: options.delay, hide: options.delay 11480 } 11481 } 11482 11483 return options 11484 }, enter: function (e) 11485 { 11486 var defaults = a.fn[this.type].defaults 11487 , options = {} 11488 , self 11489 11490 this._options && a.each(this._options, function (key, value) 11491 { 11492 if (defaults[key] != value) options[key] = value 11493 }, this) 11494 11495 self = a(e.currentTarget)[this.type](options).data(this.type) 11496 11497 if (!self.options.delay || !self.options.delay.show) return self.show() 11498 11499 clearTimeout(this.timeout) 11500 self.hoverState = 'in' 11501 this.timeout = setTimeout(function () 11502 { 11503 if (self.hoverState == 'in') self.show() 11504 }, self.options.delay.show) 11505 }, leave: function (e) 11506 { 11507 var self = a(e.currentTarget)[this.type](this._options).data(this.type) 11508 11509 if (this.timeout) clearTimeout(this.timeout) 11510 if (!self.options.delay || !self.options.delay.hide) return self.hide() 11511 11512 self.hoverState = 'out' 11513 this.timeout = setTimeout(function () 11514 { 11515 if (self.hoverState == 'out') self.hide() 11516 }, self.options.delay.hide) 11517 }, show: function () 11518 { 11519 var $tip 11520 , pos 11521 , actualWidth 11522 , actualHeight 11523 , placement 11524 , tp 11525 , e = a.Event('show') 11526 11527 if (this.hasContent() && this.enabled) 11528 { 11529 this.$element.trigger(e) 11530 if (e.isDefaultPrevented()) return 11531 $tip = this.tip() 11532 this.setContent() 11533 11534 if (this.options.animation) 11535 { 11536 $tip.addClass('fade') 11537 } 11538 11539 placement = typeof this.options.placement == 'function' ? 11540 this.options.placement.call(this, $tip[0], this.$element[0]) : 11541 this.options.placement 11542 11543 $tip 11544 .detach() 11545 .css({ top: 0, left: 0, display: 'block' }) 11546 11547 this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) 11548 11549 pos = this.getPosition() 11550 11551 actualWidth = $tip[0].offsetWidth 11552 actualHeight = $tip[0].offsetHeight 11553 11554 switch (placement) 11555 { 11556 case 'bottom': 11557 tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} 11558 break 11559 case 'top': 11560 tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2} 11561 break 11562 case 'left': 11563 tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth} 11564 break 11565 case 'right': 11566 tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width} 11567 break 11568 } 11569 11570 this.applyPlacement(tp, placement) 11571 this.$element.trigger('shown') 11572 } 11573 }, applyPlacement: function (offset, placement) 11574 { 11575 var $tip = this.tip() 11576 , width = $tip[0].offsetWidth 11577 , height = $tip[0].offsetHeight 11578 , actualWidth 11579 , actualHeight 11580 , delta 11581 , replace 11582 11583 $tip 11584 .offset(offset) 11585 .addClass(placement) 11586 .addClass('in') 11587 11588 actualWidth = $tip[0].offsetWidth 11589 actualHeight = $tip[0].offsetHeight 11590 11591 if (placement == 'top' && actualHeight != height) 11592 { 11593 offset.top = offset.top + height - actualHeight 11594 replace = true 11595 } 11596 11597 if (placement == 'bottom' || placement == 'top') 11598 { 11599 delta = 0 11600 11601 if (offset.left < 0) 11602 { 11603 delta = offset.left * -2 11604 offset.left = 0 11605 $tip.offset(offset) 11606 actualWidth = $tip[0].offsetWidth 11607 actualHeight = $tip[0].offsetHeight 11608 } 11609 11610 this.replaceArrow(delta - width + actualWidth, actualWidth, 'left') 11611 } else 11612 { 11613 this.replaceArrow(actualHeight - height, actualHeight, 'top') 11614 } 11615 11616 if (replace) $tip.offset(offset) 11617 }, replaceArrow: function (delta, dimension, position) 11618 { 11619 this 11620 .arrow() 11621 .css(position, delta ? (50 * (1 - delta / dimension) + "%") : '') 11622 }, setContent: function () 11623 { 11624 var $tip = this.tip() 11625 , title = this.getTitle() 11626 11627 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) 11628 $tip.removeClass('fade in top bottom left right') 11629 }, hide: function () 11630 { 11631 var that = this 11632 , $tip = this.tip() 11633 , e = a.Event('hide') 11634 11635 this.$element.trigger(e) 11636 if (e.isDefaultPrevented()) return 11637 11638 $tip.removeClass('in') 11639 11640 function removeWithAnimation() 11641 { 11642 var timeout = setTimeout(function () 11643 { 11644 $tip.off(a.support.transition.end).detach() 11645 }, 500) 11646 11647 $tip.one(a.support.transition.end, function () 11648 { 11649 clearTimeout(timeout) 11650 $tip.detach() 11651 }) 11652 } 11653 11654 a.support.transition && this.$tip.hasClass('fade') ? 11655 removeWithAnimation() : 11656 $tip.detach() 11657 11658 this.$element.trigger('hidden') 11659 11660 return this 11661 }, fixTitle: function () 11662 { 11663 var $e = this.$element 11664 if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') 11665 { 11666 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') 11667 } 11668 }, hasContent: function () 11669 { 11670 return this.getTitle() 11671 }, getPosition: function () 11672 { 11673 var el = this.$element[0] 11674 return a.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : { 11675 width: el.offsetWidth, height: el.offsetHeight 11676 }, this.$element.offset()) 11677 }, getTitle: function () 11678 { 11679 var title 11680 , $e = this.$element 11681 , o = this.options 11682 11683 title = $e.attr('data-original-title') 11684 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) 11685 11686 return title 11687 }, tip: function () 11688 { 11689 return this.$tip = this.$tip || a(this.options.template) 11690 }, arrow: function () 11691 { 11692 return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow") 11693 }, validate: function () 11694 { 11695 if (!this.$element[0].parentNode) 11696 { 11697 this.hide() 11698 this.$element = null 11699 this.options = null 11700 } 11701 }, enable: function () 11702 { 11703 this.enabled = true 11704 }, disable: function () 11705 { 11706 this.enabled = false 11707 }, toggleEnabled: function () 11708 { 11709 this.enabled = !this.enabled 11710 }, toggle: function (e) 11711 { 11712 var self = e ? a(e.currentTarget)[this.type](this._options).data(this.type) : this 11713 self.tip().hasClass('in') ? self.hide() : self.show() 11714 }, destroy: function () 11715 { 11716 this.hide().$element.off('.' + this.type).removeData(this.type) 11717 } 11718 11719 } 11720 11721 11722 /* TOOLTIP PLUGIN DEFINITION 11723 * ========================= */ 11724 11725 var old = a.fn.tooltip 11726 11727 a.fn.tooltip = function (option) 11728 { 11729 return this.each(function () 11730 { 11731 var $this = a(this) 11732 , data = $this.data('tooltip') 11733 , options = typeof option == 'object' && option 11734 if (!data) $this.data('tooltip', (data = new Tooltip(this, options))) 11735 if (typeof option == 'string') data[option]() 11736 }) 11737 } 11738 11739 a.fn.tooltip.Constructor = Tooltip 11740 11741 a.fn.tooltip.defaults = { 11742 animation: true, placement: 'top', selector: false, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', trigger: 'hover focus', title: '', delay: 0, html: false, container: false 11743 } 11744 11745 11746 /* TOOLTIP NO CONFLICT 11747 * =================== */ 11748 11749 a.fn.tooltip.noConflict = function () 11750 { 11751 a.fn.tooltip = old 11752 return this 11753 } 11754 11755}(window.jfbcJQuery); 11756 11757!function (a) 11758{ 11759 11760 "use strict"; // jshint ;_; 11761 11762 11763 /* ALERT CLASS DEFINITION 11764 * ====================== */ 11765 11766 var dismiss = '[data-dismiss="alert"]' 11767 , Alert = function (el) 11768 { 11769 a(el).on('click', dismiss, this.close) 11770 } 11771 11772 Alert.prototype.close = function (e) 11773 { 11774 var $this = a(this) 11775 , selector = $this.attr('data-target') 11776 , $parent 11777 11778 if (!selector) 11779 { 11780 selector = $this.attr('href') 11781 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 11782 } 11783 11784 $parent = a(selector) 11785 11786 e && e.preventDefault() 11787 11788 $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) 11789 11790 $parent.trigger(e = a.Event('close')) 11791 11792 if (e.isDefaultPrevented()) return 11793 11794 $parent.removeClass('in') 11795 11796 function removeElement() 11797 { 11798 $parent 11799 .trigger('closed') 11800 .remove() 11801 } 11802 11803 a.support.transition && $parent.hasClass('fade') ? 11804 $parent.on(a.support.transition.end, removeElement) : 11805 removeElement() 11806 } 11807 11808 11809 /* ALERT PLUGIN DEFINITION 11810 * ======================= */ 11811 11812 var old = a.fn.alert 11813 11814 a.fn.alert = function (option) 11815 { 11816 return this.each(function () 11817 { 11818 var $this = a(this) 11819 , data = $this.data('alert')
11820 if (!data) $this.data('alert', (data = new Alert(this))) 11821 if (typeof option == 'string') data[option].call($this) 11822 }) 11823 } 11824 11825 a.fn.alert.Constructor = Alert 11826 11827 11828 /* ALERT NO CONFLICT 11829 * ================= */ 11830 11831 a.fn.alert.noConflict = function () 11832 { 11833 a.fn.alert = old 11834 return this 11835 } 11836 11837 11838 /* ALERT DATA-API 11839 * ============== */ 11840 11841 a(document).on('click.alert.data-api', dismiss, Alert.prototype.close) 11842 11843}(window.jfbcJQuery), 11844 11845 /* ============================================================= 11846 * bootstrap-collapse.js v2.3.2 11847 * http://twitter.github.com/bootstrap/javascript.html#collapse 11848 * ============================================================= 11849 * Copyright 2012 Twitter, Inc. 11850 * 11851 * Licensed under the Apache License, Version 2.0 (the "License"); 11852 * you may not use this file except in compliance with the License. 11853 * You may obtain a copy of the License at 11854 * 11855 * http://www.apache.org/licenses/LICENSE-2.0 11856 * 11857 * Unless required by applicable law or agreed to in writing, software 11858 * distributed under the License is distributed on an "AS IS" BASIS, 11859 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11860 * See the License for the specific language governing permissions and 11861 * limitations under the License. 11862 * ============================================================ */ 11863 11864 11865 !function (a) 11866 { 11867 11868 "use strict"; // jshint ;_; 11869 11870 11871 /* COLLAPSE PUBLIC CLASS DEFINITION 11872 * ================================ */ 11873 11874 var Collapse = function (element, options) 11875 { 11876 this.$element = a(element) 11877 this.options = a.extend({}, a.fn.collapse.defaults, options) 11878 11879 if (this.options.parent) 11880 { 11881 this.$parent = a(this.options.parent) 11882 } 11883 11884 this.options.toggle && this.toggle() 11885 } 11886 11887 Collapse.prototype = { 11888 11889 constructor: Collapse, dimension: function () 11890 { 11891 var hasWidth = this.$element.hasClass('width') 11892 return hasWidth ? 'width' : 'height' 11893 }, show: function () 11894 { 11895 var dimension 11896 , scroll 11897 , actives 11898 , hasData 11899 11900 if (this.transitioning || this.$element.hasClass('in')) return 11901 dimension = this.dimension() 11902 scroll = a.camelCase(['scroll', dimension].join('-')) 11903 actives = this.$parent && this.$parent.find('> .accordion-group > .in') 11904 11905 if (actives && actives.length) 11906 { 11907 hasData = actives.data('collapse') 11908 if (hasData && hasData.transitioning) return 11909 actives.collapse('hide') 11910 hasData || actives.data('collapse', null) 11911 } 11912 11913 this.$element[dimension](0) 11914 this.transition('addClass', a.Event('show'), 'shown') 11915 a.support.transition && this.$element[dimension](this.$element[0][scroll]) 11916 }, hide: function () 11917 { 11918 var dimension 11919 if (this.transitioning || !this.$element.hasClass('in')) return 11920 dimension = this.dimension() 11921 this.reset(this.$element[dimension]()) 11922 this.transition('removeClass', a.Event('hide'), 'hidden') 11923 this.$element[dimension](0) 11924 }, reset: function (size) 11925 { 11926 var dimension = this.dimension() 11927 11928 this.$element 11929 .removeClass('collapse') 11930 [dimension](size || 'auto') 11931 [0].offsetWidth 11932 11933 this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') 11934 11935 return this 11936 }, transition: function (method, startEvent, completeEvent) 11937 { 11938 var that = this 11939 , complete = function () 11940 { 11941 if (startEvent.type == 'show') that.reset() 11942 that.transitioning = 0 11943 that.$element.trigger(completeEvent) 11944 } 11945 11946 this.$element.trigger(startEvent) 11947 11948 if (startEvent.isDefaultPrevented()) return 11949 11950 //this.transitioning = 1 // Disabled by Sourcecoast - Never properly completing, and I don't care about that. 11951 11952 this.$element[method]('in') 11953 11954 a.support.transition && this.$element.hasClass('collapse') ? 11955 this.$element.one(a.support.transition.end, complete) : 11956 complete() 11957 }, toggle: function () 11958 { 11959 this[this.$element.hasClass('in') ? 'hide' : 'show']() 11960 } 11961 11962 } 11963 11964 11965 /* COLLAPSE PLUGIN DEFINITION 11966 * ========================== */ 11967 11968 var old = a.fn.collapse 11969 11970 a.fn.collapse = function (option) 11971 { 11972 return this.each(function () 11973 { 11974 var $this = a(this) 11975 , data = $this.data('collapse') 11976 , options = a.extend({}, a.fn.collapse.defaults, $this.data(), typeof option == 'object' && option) 11977 if (!data) $this.data('collapse', (data = new Collapse(this, options))) 11978 if (typeof option == 'string') data[option]() 11979 }) 11980 } 11981 11982 a.fn.collapse.defaults = { 11983 toggle: true 11984 } 11985 11986 a.fn.collapse.Constructor = Collapse 11987 11988 11989 /* COLLAPSE NO CONFLICT 11990 * ==================== */ 11991 11992 a.fn.collapse.noConflict = function () 11993 { 11994 a.fn.collapse = old 11995 return this 11996 } 11997 11998 11999 /* COLLAPSE DATA-API 12000 * ================= */ 12001 12002 a(document).on('click.collapse.data-api', '[data-toggle=jfbc-collapse]', function (e) 12003 { 12004 var $this = a(this), href 12005 , target = $this.attr('data-target') 12006 || e.preventDefault() 12007 || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 12008 , option = a(target).data('collapse') ? 'toggle' : $this.data() 12009 $this[a(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed') 12010 a(target).collapse(option) 12011 }) 12012 12013 }(window.jfbcJQuery);
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.