1/*! 2 * jQuery JavaScript Library v1.7.2 3 * http://jquery.com/ 4 * 5 * Copyright 2011, John Resig 6 * Dual licensed under the MIT or GPL Version 2 licenses. 7 * http://jquery.org/license 8 * 9 * Includes Sizzle.js 10 * http://sizzlejs.com/ 11 * Copyright 2011, The Dojo Foundation 12 * Released under the MIT, BSD, and GPL Licenses. 13 * 14 * Date: Wed Mar 21 12:46:34 2012 -0700 15 */ 16(function (window, undefined) { 17 18// Use the correct document accordingly with window argument (sandbox) 19 var document = window.document, 20 navigator = window.navigator, 21 location = window.location; 22 var jQuery = (function () { 23 24// Define a local copy of jQuery 25 var jQuery = function (selector, context) { 26 // The jQuery object is actually just the init constructor 'enhanced' 27 return new jQuery.fn.init(selector, context, rootjQuery); 28 }, 29 30 // Map over jQuery in case of overwrite 31 _jQuery = window.jQuery, 32 33 // Map over the $ in case of overwrite 34 _$ = window.$, 35 36 // A central reference to the root jQuery(document) 37 rootjQuery, 38 39 // A simple way to check for HTML strings or ID strings 40 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 41 quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, 42 43 // Check if a string has a non-whitespace character in it 44 rnotwhite = /\S/, 45 46 // Used for trimming whitespace 47 trimLeft = /^\s+/, 48 trimRight = /\s+$/, 49 50 // Match a standalone tag 51 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, 52 53 // JSON RegExp 54 rvalidchars = /^[\],:{}\s]*$/, 55 rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, 56 rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, 57 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, 58 59 // Useragent RegExp 60 rwebkit = /(webkit)[ \/]([\w.]+)/, 61 ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, 62 rmsie = /(msie) ([\w.]+)/, 63 rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, 64 65 // Matches dashed string for camelizing 66 rdashAlpha = /-([a-z]|[0-9])/ig, 67 rmsPrefix = /^-ms-/, 68 69 // Used by jQuery.camelCase as callback to replace() 70 fcamelCase = function (all, letter) { 71 return (letter + "").toUpperCase(); 72 }, 73 74 // Keep a UserAgent string for use with jQuery.browser 75 userAgent = navigator.userAgent, 76 77 // For matching the engine and version of the browser 78 browserMatch, 79 80 // The deferred used on DOM ready 81 readyList, 82 83 // The ready event handler 84 DOMContentLoaded, 85 86 // Save a reference to some core methods 87 toString = Object.prototype.toString, 88 hasOwn = Object.prototype.hasOwnProperty, 89 push = Array.prototype.push, 90 slice = Array.prototype.slice, 91 trim = String.prototype.trim, 92 indexOf = Array.prototype.indexOf, 93 94 // [[Class]] -> type pairs 95 class2type = {}; 96 97 jQuery.fn = jQuery.prototype = { 98 constructor: jQuery, 99 init: function (selector, context, rootjQuery) { 100 var match, elem, ret, doc; 101 102 // Handle $(""), $(null), or $(undefined) 103 if (!selector) { 104 return this; 105 } 106 107 // Handle $(DOMElement) 108 if (selector.nodeType) { 109 this.context = this[0] = selector; 110 this.length = 1; 111 return this; 112 } 113 114 // The body element only exists once, optimize finding it 115 if (selector === "body" && !context && document.body) { 116 this.context = document; 117 this[0] = document.body; 118 this.selector = selector; 119 this.length = 1; 120 return this; 121 } 122 123 // Handle HTML strings 124 if (typeof selector === "string") { 125 // Are we dealing with HTML string or an ID? 126 if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) { 127 // Assume that strings that start and end with <> are HTML and skip the regex check 128 match = [null, selector, null]; 129 130 } else { 131 match = quickExpr.exec(selector); 132 } 133 134 // Verify a match, and that no context was specified for #id 135 if (match && (match[1] || !context)) { 136 137 // HANDLE: $(html) -> $(array) 138 if (match[1]) { 139 context = context instanceof jQuery ? context[0] : context; 140 doc = (context ? context.ownerDocument || context : document); 141
vendor: 4,422 bytes, lines 142-252
142 // If a single string is passed in and it's a single tag 143 // just do a createElement and skip the rest 144 ret = rsingleTag.exec(selector); 145 146 if (ret) { 147 if (jQuery.isPlainObject(context)) { 148 selector = [document.createElement(ret[1])]; 149 jQuery.fn.attr.call(selector, context, true); 150 151 } else { 152 selector = [doc.createElement(ret[1])]; 153 } 154 155 } else { 156 ret = jQuery.buildFragment([match[1]], [doc]); 157 selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes; 158 } 159 160 return jQuery.merge(this, selector); 161 162 // HANDLE: $("#id") 163 } else { 164 elem = document.getElementById(match[2]); 165 166 // Check parentNode to catch when Blackberry 4.6 returns 167 // nodes that are no longer in the document #6963 168 if (elem && elem.parentNode) { 169 // Handle the case where IE and Opera return items 170 // by name instead of ID 171 if (elem.id !== match[2]) { 172 return rootjQuery.find(selector); 173 } 174 175 // Otherwise, we inject the element directly into the jQuery object 176 this.length = 1; 177 this[0] = elem; 178 } 179 180 this.context = document; 181 this.selector = selector; 182 return this; 183 } 184 185 // HANDLE: $(expr, $(...)) 186 } else if (!context || context.jquery) { 187 return (context || rootjQuery).find(selector); 188 189 // HANDLE: $(expr, context) 190 // (which is just equivalent to: $(context).find(expr) 191 } else { 192 return this.constructor(context).find(selector); 193 } 194 195 // HANDLE: $(function) 196 // Shortcut for document ready 197 } else if (jQuery.isFunction(selector)) { 198 return rootjQuery.ready(selector); 199 } 200 201 if (selector.selector !== undefined) { 202 this.selector = selector.selector; 203 this.context = selector.context; 204 } 205 206 return jQuery.makeArray(selector, this); 207 }, 208 209 // Start with an empty selector 210 selector: "", 211 212 // The current version of jQuery being used 213 jquery: "1.7.2", 214 215 // The default length of a jQuery object is 0 216 length: 0, 217 218 // The number of elements contained in the matched element set 219 size: function () { 220 return this.length; 221 }, 222 223 toArray: function () { 224 return slice.call(this, 0); 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 return num == null ? 231 232 // Return a 'clean' array 233 this.toArray() : 234 235 // Return just the object 236 (num < 0 ? this[this.length + num] : this[num]); 237 }, 238 239 // Take an array of elements and push it onto the stack 240 // (returning the new matched element set) 241 pushStack: function (elems, name, selector) { 242 // Build a new jQuery matched element set 243 var ret = this.constructor(); 244 245 if (jQuery.isArray(elems)) { 246 push.apply(ret, elems); 247 248 } else { 249 jQuery.merge(ret, elems); 250 } 251 252 // Add the old object onto the stack (as a reference)
vendor: 25,012 bytes, lines 253-939
253 ret.prevObject = this; 254 255 ret.context = this.context; 256 257 if (name === "find") { 258 ret.selector = this.selector + (this.selector ? " " : "") + selector; 259 } else if (name) { 260 ret.selector = this.selector + "." + name + "(" + selector + ")"; 261 } 262 263 // Return the newly-formed element set 264 return ret; 265 }, 266 267 // Execute a callback for every element in the matched set. 268 // (You can seed the arguments with an array of args, but this is 269 // only used internally.) 270 each: function (callback, args) { 271 return jQuery.each(this, callback, args); 272 }, 273 274 ready: function (fn) { 275 // Attach the listeners 276 jQuery.bindReady(); 277 278 // Add the callback 279 readyList.add(fn); 280 281 return this; 282 }, 283 284 eq: function (i) { 285 i = +i; 286 return i === -1 ? 287 this.slice(i) : 288 this.slice(i, i + 1); 289 }, 290 291 first: function () { 292 return this.eq(0); 293 }, 294 295 last: function () { 296 return this.eq(-1); 297 }, 298 299 slice: function () { 300 return this.pushStack(slice.apply(this, arguments), 301 "slice", slice.call(arguments).join(",")); 302 }, 303 304 map: function (callback) { 305 return this.pushStack(jQuery.map(this, function (elem, i) { 306 return callback.call(elem, i, elem); 307 })); 308 }, 309 310 end: function () { 311 return this.prevObject || this.constructor(null); 312 }, 313 314 // For internal use only. 315 // Behaves like an Array's method, not like a jQuery method. 316 push: push, 317 sort: [].sort, 318 splice: [].splice 319 }; 320 321// Give the init function the jQuery prototype for later instantiation 322 jQuery.fn.init.prototype = jQuery.fn; 323 324 jQuery.extend = jQuery.fn.extend = function () { 325 var options, name, src, copy, copyIsArray, clone, 326 target = arguments[0] || {}, 327 i = 1, 328 length = arguments.length, 329 deep = false; 330 331 // Handle a deep copy situation 332 if (typeof target === "boolean") { 333 deep = target; 334 target = arguments[1] || {}; 335 // skip the boolean and the target 336 i = 2; 337 } 338 339 // Handle case when target is a string or something (possible in deep copy) 340 if (typeof target !== "object" && !jQuery.isFunction(target)) { 341 target = {}; 342 } 343 344 // extend jQuery itself if only one argument is passed 345 if (length === i) { 346 target = this; 347 --i; 348 } 349 350 for (; i < length; i++) { 351 // Only deal with non-null/undefined values 352 if ((options = arguments[i]) != null) { 353 // Extend the base object 354 for (name in options) { 355 src = target[name]; 356 copy = options[name]; 357 358 // Prevent never-ending loop 359 if (target === copy) { 360 continue; 361 } 362 363 // Recurse if we're merging plain objects or arrays 364 if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) { 365 if (copyIsArray) { 366 copyIsArray = false; 367 clone = src && jQuery.isArray(src) ? src : []; 368 369 } else { 370 clone = src && jQuery.isPlainObject(src) ? src : {}; 371 } 372 373 // Never move original objects, clone them 374 target[name] = jQuery.extend(deep, clone, copy); 375 376 // Don't bring in undefined values 377 } else if (copy !== undefined) { 378 target[name] = copy; 379 } 380 } 381 } 382 } 383 384 // Return the modified object 385 return target; 386 }; 387 388 jQuery.extend({ 389 noConflict: function (deep) { 390 if (window.$ === jQuery) { 391 window.$ = _$; 392 } 393 394 if (deep && window.jQuery === jQuery) { 395 window.jQuery = _jQuery; 396 } 397 398 return jQuery; 399 }, 400 401 // Is the DOM ready to be used? Set to true once it occurs. 402 isReady: false, 403 404 // A counter to track how many items to wait for before 405 // the ready event fires. See #6781 406 readyWait: 1, 407 408 // Hold (or release) the ready event 409 holdReady: function (hold) { 410 if (hold) { 411 jQuery.readyWait++; 412 } else { 413 jQuery.ready(true); 414 } 415 }, 416 417 // Handle when the DOM is ready 418 ready: function (wait) { 419 // Either a released hold or an DOMready/load event and not yet ready 420 if ((wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady)) { 421 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 422 if (!document.body) { 423 return setTimeout(jQuery.ready, 1); 424 } 425 426 // Remember that the DOM is ready 427 jQuery.isReady = true; 428 429 // If a normal DOM Ready event fired, decrement, and wait if need be 430 if (wait !== true && --jQuery.readyWait > 0) { 431 return; 432 } 433 434 // If there are functions bound, to execute 435 readyList.fireWith(document, [jQuery]); 436 437 // Trigger any bound ready events 438 if (jQuery.fn.trigger) { 439 jQuery(document).trigger("ready").off("ready"); 440 } 441 } 442 }, 443 444 bindReady: function () { 445 if (readyList) { 446 return; 447 } 448 449 readyList = jQuery.Callbacks("once memory"); 450 451 // Catch cases where $(document).ready() is called after the 452 // browser event has already occurred. 453 if (document.readyState === "complete") { 454 // Handle it asynchronously to allow scripts the opportunity to delay ready 455 return setTimeout(jQuery.ready, 1); 456 } 457 458 // Mozilla, Opera and webkit nightlies currently support this event 459 if (document.addEventListener) { 460 // Use the handy event callback 461 document.addEventListener("DOMContentLoaded", DOMContentLoaded, false); 462 463 // A fallback to window.onload, that will always work 464 window.addEventListener("load", jQuery.ready, false); 465 466 // If IE event model is used 467 } else if (document.attachEvent) { 468 // ensure firing before onload, 469 // maybe late but safe also for iframes 470 document.attachEvent("onreadystatechange", DOMContentLoaded); 471 472 // A fallback to window.onload, that will always work 473 window.attachEvent("onload", jQuery.ready); 474 475 // If IE and not a frame 476 // continually check to see if the document is ready 477 var toplevel = false; 478 479 try { 480 toplevel = window.frameElement == null; 481 } catch (e) { 482 } 483 484 if (document.documentElement.doScroll && toplevel) { 485 doScrollCheck(); 486 } 487 } 488 }, 489 490 // See test/unit/core.js for details concerning isFunction. 491 // Since version 1.3, DOM methods and functions like alert 492 // aren't supported. They return false on IE (#2968). 493 isFunction: function (obj) { 494 return jQuery.type(obj) === "function"; 495 }, 496 497 isArray: Array.isArray || function (obj) { 498 return jQuery.type(obj) === "array"; 499 }, 500 501 isWindow: function (obj) { 502 return obj != null && obj == obj.window; 503 }, 504 505 isNumeric: function (obj) { 506 return !isNaN(parseFloat(obj)) && isFinite(obj); 507 }, 508 509 type: function (obj) { 510 return obj == null ? 511 String(obj) : 512 class2type[toString.call(obj)] || "object"; 513 }, 514 515 isPlainObject: function (obj) { 516 // Must be an Object. 517 // Because of IE, we also have to check the presence of the constructor property. 518 // Make sure that DOM nodes and window objects don't pass through, as well 519 if (!obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) { 520 return false; 521 } 522 523 try { 524 // Not own constructor property must be Object 525 if (obj.constructor && 526 !hasOwn.call(obj, "constructor") && 527 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) { 528 return false; 529 } 530 } catch (e) { 531 // IE8,9 Will throw exceptions on certain host objects #9897 532 return false; 533 } 534 535 // Own properties are enumerated firstly, so to speed up, 536 // if last one is own, then all properties are own. 537 538 var key; 539 for (key in obj) { 540 } 541 542 return key === undefined || hasOwn.call(obj, key); 543 }, 544 545 isEmptyObject: function (obj) { 546 for (var name in obj) { 547 return false; 548 } 549 return true; 550 }, 551 552 error: function (msg) { 553 throw new Error(msg); 554 }, 555 556 parseJSON: function (data) { 557 if (typeof data !== "string" || !data) { 558 return null; 559 } 560 561 // Make sure leading/trailing whitespace is removed (IE can't handle it) 562 data = jQuery.trim(data); 563 564 // Attempt to parse using the native JSON parser first 565 if (window.JSON && window.JSON.parse) { 566 return window.JSON.parse(data); 567 } 568 569 // Make sure the incoming data is actual JSON 570 // Logic borrowed from http://json.org/json2.js 571 if (rvalidchars.test(data.replace(rvalidescape, "@") 572 .replace(rvalidtokens, "]") 573 .replace(rvalidbraces, ""))) { 574 575 return (new Function("return " + data))(); 576 577 } 578 jQuery.error("Invalid JSON: " + data); 579 }, 580 581 // Cross-browser xml parsing 582 parseXML: function (data) { 583 if (typeof data !== "string" || !data) { 584 return null; 585 } 586 var xml, tmp; 587 try { 588 if (window.DOMParser) { // Standard 589 tmp = new DOMParser(); 590 xml = tmp.parseFromString(data, "text/xml"); 591 } else { // IE 592 xml = new ActiveXObject("Microsoft.XMLDOM"); 593 xml.async = "false"; 594 xml.loadXML(data); 595 } 596 } catch (e) { 597 xml = undefined; 598 } 599 if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length) { 600 jQuery.error("Invalid XML: " + data); 601 } 602 return xml; 603 }, 604 605 noop: function () { 606 }, 607 608 // Evaluates a script in a global context 609 // Workarounds based on findings by Jim Driscoll 610 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context 611 globalEval: function (data) { 612 if (data && rnotwhite.test(data)) { 613 // We use execScript on Internet Explorer 614 // We use an anonymous function so that context is window 615 // rather than jQuery in Firefox 616 (window.execScript || function (data) { 617 window["eval"].call(window, data); 618 })(data); 619 } 620 }, 621 622 // Convert dashed to camelCase; used by the css and data modules 623 // Microsoft forgot to hump their vendor prefix (#9572) 624 camelCase: function (string) { 625 return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase); 626 }, 627 628 nodeName: function (elem, name) { 629 return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); 630 }, 631 632 // args is for internal usage only 633 each: function (object, callback, args) { 634 var name, i = 0, 635 length = object.length, 636 isObj = length === undefined || jQuery.isFunction(object); 637 638 if (args) { 639 if (isObj) { 640 for (name in object) { 641 if (callback.apply(object[name], args) === false) { 642 break; 643 } 644 } 645 } else { 646 for (; i < length;) { 647 if (callback.apply(object[i++], args) === false) { 648 break; 649 } 650 } 651 } 652 653 // A special, fast, case for the most common use of each 654 } else { 655 if (isObj) { 656 for (name in object) { 657 if (callback.call(object[name], name, object[name]) === false) { 658 break; 659 } 660 } 661 } else { 662 for (; i < length;) { 663 if (callback.call(object[i], i, object[i++]) === false) { 664 break; 665 } 666 } 667 } 668 } 669 670 return object; 671 }, 672 673 // Use native String.trim function wherever possible 674 trim: trim ? 675 function (text) { 676 return text == null ? 677 "" : 678 trim.call(text); 679 } : 680 681 // Otherwise use our own trimming functionality 682 function (text) { 683 return text == null ? 684 "" : 685 text.toString().replace(trimLeft, "").replace(trimRight, ""); 686 }, 687 688 // results is for internal usage only 689 makeArray: function (array, results) { 690 var ret = results || []; 691 692 if (array != null) { 693 // The window, strings (and functions) also have 'length' 694 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 695 var type = jQuery.type(array); 696 697 if (array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow(array)) { 698 push.call(ret, array); 699 } else { 700 jQuery.merge(ret, array); 701 } 702 } 703 704 return ret; 705 }, 706 707 inArray: function (elem, array, i) { 708 var len; 709 710 if (array) { 711 if (indexOf) { 712 return indexOf.call(array, elem, i); 713 } 714 715 len = array.length; 716 i = i ? i < 0 ? Math.max(0, len + i) : i : 0; 717 718 for (; i < len; i++) { 719 // Skip accessing in sparse arrays 720 if (i in array && array[i] === elem) { 721 return i; 722 } 723 } 724 } 725 726 return -1; 727 }, 728 729 merge: function (first, second) { 730 var i = first.length, 731 j = 0; 732 733 if (typeof second.length === "number") { 734 for (var l = second.length; j < l; j++) { 735 first[i++] = second[j]; 736 } 737 738 } else { 739 while (second[j] !== undefined) { 740 first[i++] = second[j++]; 741 } 742 } 743 744 first.length = i; 745 746 return first; 747 }, 748 749 grep: function (elems, callback, inv) { 750 var ret = [], retVal; 751 inv = !!inv; 752 753 // Go through the array, only saving the items 754 // that pass the validator function 755 for (var i = 0, length = elems.length; i < length; i++) { 756 retVal = !!callback(elems[i], i); 757 if (inv !== retVal) { 758 ret.push(elems[i]); 759 } 760 } 761 762 return ret; 763 }, 764 765 // arg is for internal usage only 766 map: function (elems, callback, arg) { 767 var value, key, ret = [], 768 i = 0, 769 length = elems.length, 770 // jquery objects are treated as arrays 771 isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ((length > 0 && elems[0] && elems[length - 1]) || length === 0 || jQuery.isArray(elems)); 772 773 // Go through the array, translating each of the items to their 774 if (isArray) { 775 for (; i < length; i++) { 776 value = callback(elems[i], i, arg); 777 778 if (value != null) { 779 ret[ret.length] = value; 780 } 781 } 782 783 // Go through every key on the object, 784 } else { 785 for (key in elems) { 786 value = callback(elems[key], key, arg); 787 788 if (value != null) { 789 ret[ret.length] = value; 790 } 791 } 792 } 793 794 // Flatten any nested arrays 795 return ret.concat.apply([], ret); 796 }, 797 798 // A global GUID counter for objects 799 guid: 1, 800 801 // Bind a function to a context, optionally partially applying any 802 // arguments. 803 proxy: function (fn, context) { 804 if (typeof context === "string") { 805 var tmp = fn[context]; 806 context = fn; 807 fn = tmp; 808 } 809 810 // Quick check to determine if target is callable, in the spec 811 // this throws a TypeError, but we will just return undefined. 812 if (!jQuery.isFunction(fn)) { 813 return undefined; 814 } 815 816 // Simulated bind 817 var args = slice.call(arguments, 2), 818 proxy = function () { 819 return fn.apply(context, args.concat(slice.call(arguments))); 820 }; 821 822 // Set the guid of unique handler to the same of original handler, so it can be removed 823 proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; 824 825 return proxy; 826 }, 827 828 // Mutifunctional method to get and set values to a collection 829 // The value/s can optionally be executed if it's a function 830 access: function (elems, fn, key, value, chainable, emptyGet, pass) { 831 var exec, 832 bulk = key == null, 833 i = 0, 834 length = elems.length; 835 836 // Sets many values 837 if (key && typeof key === "object") { 838 for (i in key) { 839 jQuery.access(elems, fn, i, key[i], 1, emptyGet, value); 840 } 841 chainable = 1; 842 843 // Sets one value 844 } else if (value !== undefined) { 845 // Optionally, function values get executed if exec is true 846 exec = pass === undefined && jQuery.isFunction(value); 847 848 if (bulk) { 849 // Bulk operations only iterate when executing function values 850 if (exec) { 851 exec = fn; 852 fn = function (elem, key, value) { 853 return exec.call(jQuery(elem), value); 854 }; 855 856 // Otherwise they run against the entire set 857 } else { 858 fn.call(elems, value); 859 fn = null; 860 } 861 } 862 863 if (fn) { 864 for (; i < length; i++) { 865 fn(elems[i], key, exec ? value.call(elems[i], i, fn(elems[i], key)) : value, pass); 866 } 867 } 868 869 chainable = 1; 870 } 871 872 return chainable ? 873 elems : 874 875 // Gets 876 bulk ? 877 fn.call(elems) : 878 length ? fn(elems[0], key) : emptyGet; 879 }, 880 881 now: function () { 882 return (new Date()).getTime(); 883 }, 884 885 // Use of jQuery.browser is frowned upon. 886 // More details: http://docs.jquery.com/Utilities/jQuery.browser 887 uaMatch: function (ua) { 888 ua = ua.toLowerCase(); 889 890 var match = rwebkit.exec(ua) || 891 ropera.exec(ua) || 892 rmsie.exec(ua) || 893 ua.indexOf("compatible") < 0 && rmozilla.exec(ua) || 894 []; 895 896 return {browser: match[1] || "", version: match[2] || "0"}; 897 }, 898 899 sub: function () { 900 function jQuerySub(selector, context) { 901 return new jQuerySub.fn.init(selector, context); 902 } 903 904 jQuery.extend(true, jQuerySub, this); 905 jQuerySub.superclass = this; 906 jQuerySub.fn = jQuerySub.prototype = this(); 907 jQuerySub.fn.constructor = jQuerySub; 908 jQuerySub.sub = this.sub; 909 jQuerySub.fn.init = function init(selector, context) { 910 if (context && context instanceof jQuery && !(context instanceof jQuerySub)) { 911 context = jQuerySub(context); 912 } 913 914 return jQuery.fn.init.call(this, selector, context, rootjQuerySub); 915 }; 916 jQuerySub.fn.init.prototype = jQuerySub.fn; 917 var rootjQuerySub = jQuerySub(document); 918 return jQuerySub; 919 }, 920 921 browser: {} 922 }); 923 924// Populate the class2type map 925 jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function (i, name) { 926 class2type["[object " + name + "]"] = name.toLowerCase(); 927 }); 928 929 browserMatch = jQuery.uaMatch(userAgent); 930 if (browserMatch.browser) { 931 jQuery.browser[browserMatch.browser] = true; 932 jQuery.browser.version = browserMatch.version; 933 } 934 935// Deprecated, use jQuery.browser.webkit instead 936 if (jQuery.browser.webkit) { 937 jQuery.browser.safari = true; 938 } 939
940// IE doesn't match non-breaking spaces with \s 941 if (rnotwhite.test("\xA0")) { 942 trimLeft = /^[\s\xA0]+/; 943 trimRight = /[\s\xA0]+$/; 944 } 945 946// All jQuery objects should point back to these 947 rootjQuery = jQuery(document); 948 949// Cleanup functions for the document ready method 950 if (document.addEventListener) { 951 DOMContentLoaded = function () { 952 document.removeEventListener("DOMContentLoaded", DOMContentLoaded, false); 953 jQuery.ready(); 954 }; 955 956 } else if (document.attachEvent) { 957 DOMContentLoaded = function () { 958 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 959 if (document.readyState === "complete") { 960 document.detachEvent("onreadystatechange", DOMContentLoaded); 961 jQuery.ready(); 962 } 963 }; 964 } 965 966// The DOM ready check for Internet Explorer 967 function doScrollCheck() { 968 if (jQuery.isReady) { 969 return; 970 } 971 972 try { 973 // If IE is used, use the trick by Diego Perini 974 // http://javascript.nwbox.com/IEContentLoaded/ 975 document.documentElement.doScroll("left"); 976 } catch (e) { 977 setTimeout(doScrollCheck, 1); 978 return; 979 } 980 981 // and execute any waiting functions 982 jQuery.ready(); 983 } 984 985 return jQuery; 986 987 })(); 988 989 990// String to Object flags format cache 991 var flagsCache = {}; 992 993// Convert String-formatted flags into Object-formatted ones and store in cache 994 function createFlags(flags) { 995 var object = flagsCache[flags] = {}, 996 i, length; 997 flags = flags.split(/\s+/); 998 for (i = 0, length = flags.length; i < length; i++) { 999 object[flags[i]] = true; 1000 } 1001 return object; 1002 } 1003 1004 /* 1005 * Create a callback list using the following parameters: 1006 * 1007 * flags: an optional list of space-separated flags that will change how 1008 * the callback list behaves 1009 * 1010 * By default a callback list will act like an event callback list and can be 1011 * "fired" multiple times. 1012 * 1013 * Possible flags: 1014 * 1015 * once: will ensure the callback list can only be fired once (like a Deferred) 1016 * 1017 * memory: will keep track of previous values and will call any callback added 1018 * after the list has been fired right away with the latest "memorized" 1019 * values (like a Deferred) 1020 * 1021 * unique: will ensure a callback can only be added once (no duplicate in the list) 1022 * 1023 * stopOnFalse: interrupt callings when a callback returns false 1024 * 1025 */ 1026 jQuery.Callbacks = function (flags) { 1027 1028 // Convert flags from String-formatted to Object-formatted 1029 // (we check in cache first) 1030 flags = flags ? (flagsCache[flags] || createFlags(flags)) : {}; 1031 1032 var // Actual callback list 1033 list = [], 1034 // Stack of fire calls for repeatable lists 1035 stack = [], 1036 // Last fire value (for non-forgettable lists) 1037 memory, 1038 // Flag to know if list was already fired 1039 fired, 1040 // Flag to know if list is currently firing 1041 firing, 1042 // First callback to fire (used internally by add and fireWith) 1043 firingStart, 1044 // End of the loop when firing 1045 firingLength, 1046 // Index of currently firing callback (modified by remove if needed) 1047 firingIndex, 1048 // Add one or several callbacks to the list 1049 add = function (args) { 1050 var i, 1051 length, 1052 elem, 1053 type, 1054 actual; 1055 for (i = 0, length = args.length; i < length; i++) { 1056 elem = args[i]; 1057 type = jQuery.type(elem); 1058 if (type === "array") { 1059 // Inspect recursively 1060 add(elem); 1061 } else if (type === "function") { 1062 // Add if not in unique mode and callback is not in 1063 if (!flags.unique || !self.has(elem)) { 1064 list.push(elem); 1065 } 1066 } 1067 } 1068 }, 1069 // Fire callbacks
1070 fire = function (context, args) { 1071 args = args || []; 1072 memory = !flags.memory || [context, args]; 1073 fired = true; 1074 firing = true; 1075 firingIndex = firingStart || 0; 1076 firingStart = 0; 1077 firingLength = list.length; 1078 for (; list && firingIndex < firingLength; firingIndex++) { 1079 if (list[firingIndex].apply(context, args) === false && flags.stopOnFalse) { 1080 memory = true; // Mark as halted 1081 break; 1082 } 1083 } 1084 firing = false; 1085 if (list) { 1086 if (!flags.once) { 1087 if (stack && stack.length) { 1088 memory = stack.shift(); 1089 self.fireWith(memory[0], memory[1]); 1090 } 1091 } else if (memory === true) { 1092 self.disable(); 1093 } else { 1094 list = []; 1095 } 1096 } 1097 }, 1098 // Actual Callbacks object 1099 self = { 1100 // Add a callback or a collection of callbacks to the list 1101 add: function () { 1102 if (list) { 1103 var length = list.length; 1104 add(arguments); 1105 // Do we need to add the callbacks to the 1106 // current firing batch? 1107 if (firing) { 1108 firingLength = list.length;
1109 // With memory, if we're not firing then 1110 // we should call right away, unless previous 1111 // firing was halted (stopOnFalse) 1112 } else if (memory && memory !== true) { 1113 firingStart = length; 1114 fire(memory[0], memory[1]); 1115 } 1116 } 1117 return this; 1118 }, 1119 // Remove a callback from the list 1120 remove: function () { 1121 if (list) { 1122 var args = arguments, 1123 argIndex = 0, 1124 argLength = args.length; 1125 for (; argIndex < argLength; argIndex++) { 1126 for (var i = 0; i < list.length; i++) { 1127 if (args[argIndex] === list[i]) { 1128 // Handle firingIndex and firingLength 1129 if (firing) { 1130 if (i <= firingLength) { 1131 firingLength--; 1132 if (i <= firingIndex) { 1133 firingIndex--; 1134 } 1135 } 1136 } 1137 // Remove the element 1138 list.splice(i--, 1); 1139 // If we have some unicity property then 1140 // we only need to do this once 1141 if (flags.unique) { 1142 break; 1143 } 1144 } 1145 } 1146 } 1147 } 1148 return this; 1149 }, 1150 // Control if a given callback is in the list 1151 has: function (fn) { 1152 if (list) { 1153 var i = 0, 1154 length = list.length; 1155 for (; i < length; i++) { 1156 if (fn === list[i]) { 1157 return true; 1158 } 1159 } 1160 } 1161 return false; 1162 }, 1163 // Remove all callbacks from the list 1164 empty: function () { 1165 list = []; 1166 return this; 1167 }, 1168 // Have the list do nothing anymore 1169 disable: function () { 1170 list = stack = memory = undefined; 1171 return this; 1172 }, 1173 // Is it disabled? 1174 disabled: function () { 1175 return !list; 1176 }, 1177 // Lock the list in its current state 1178 lock: function () { 1179 stack = undefined; 1180 if (!memory || memory === true) { 1181 self.disable(); 1182 } 1183 return this; 1184 }, 1185 // Is it locked? 1186 locked: function () { 1187 return !stack; 1188 }, 1189 // Call all callbacks with the given context and arguments 1190 fireWith: function (context, args) { 1191 if (stack) { 1192 if (firing) { 1193 if (!flags.once) { 1194 stack.push([context, args]); 1195 } 1196 } else if (!(flags.once && memory)) { 1197 fire(context, args); 1198 } 1199 } 1200 return this; 1201 }, 1202 // Call all the callbacks with the given arguments 1203 fire: function () { 1204 self.fireWith(this, arguments); 1205 return this; 1206 }, 1207 // To know if the callbacks have already been called at least once 1208 fired: function () { 1209 return !!fired; 1210 } 1211 }; 1212 1213 return self; 1214 }; 1215 1216 1217 var // Static reference to slice 1218 sliceDeferred = [].slice; 1219 1220 jQuery.extend({ 1221 1222 Deferred: function (func) { 1223 var doneList = jQuery.Callbacks("once memory"), 1224 failList = jQuery.Callbacks("once memory"), 1225 progressList = jQuery.Callbacks("memory"), 1226 state = "pending", 1227 lists = { 1228 resolve: doneList, 1229 reject: failList, 1230 notify: progressList 1231 }, 1232 promise = { 1233 done: doneList.add, 1234 fail: failList.add, 1235 progress: progressList.add, 1236 1237 state: function () { 1238 return state; 1239 }, 1240 1241 // Deprecated 1242 isResolved: doneList.fired, 1243 isRejected: failList.fired, 1244 1245 then: function (doneCallbacks, failCallbacks, progressCallbacks) { 1246 deferred.done(doneCallbacks).fail(failCallbacks).progress(progressCallbacks); 1247 return this; 1248 }, 1249 always: function () { 1250 deferred.done.apply(deferred, arguments).fail.apply(deferred, arguments); 1251 return this; 1252 }, 1253 pipe: function (fnDone, fnFail, fnProgress) { 1254 return jQuery.Deferred(function (newDefer) { 1255 jQuery.each({ 1256 done: [fnDone, "resolve"], 1257 fail: [fnFail, "reject"],
1258 progress: [fnProgress, "notify"] 1259 }, function (handler, data) { 1260 var fn = data[0], 1261 action = data[1], 1262 returned; 1263 if (jQuery.isFunction(fn)) { 1264 deferred[handler](function () { 1265 returned = fn.apply(this, arguments); 1266 if (returned && jQuery.isFunction(returned.promise)) { 1267 returned.promise().then(newDefer.resolve, newDefer.reject, newDefer.notify); 1268 } else { 1269 newDefer[action + "With"](this === deferred ? newDefer : this, [returned]); 1270 } 1271 }); 1272 } else { 1273 deferred[handler](newDefer[action]); 1274 } 1275 }); 1276 }).promise(); 1277 }, 1278 // Get a promise for this deferred 1279 // If obj is provided, the promise aspect is added to the object 1280 promise: function (obj) { 1281 if (obj == null) { 1282 obj = promise; 1283 } else { 1284 for (var key in promise) { 1285 obj[key] = promise[key]; 1286 } 1287 } 1288 return obj; 1289 } 1290 }, 1291 deferred = promise.promise({}), 1292 key; 1293 1294 for (key in lists) { 1295 deferred[key] = lists[key].fire; 1296 deferred[key + "With"] = lists[key].fireWith; 1297 } 1298 1299 // Handle state 1300 deferred.done(function () { 1301 state = "resolved"; 1302 }, failList.disable, progressList.lock).fail(function () { 1303 state = "rejected"; 1304 }, doneList.disable, progressList.lock); 1305 1306 // Call given func if any 1307 if (func) { 1308 func.call(deferred, deferred); 1309 } 1310 1311 // All done! 1312 return deferred; 1313 }, 1314 1315 // Deferred helper 1316 when: function (firstParam) { 1317 var args = sliceDeferred.call(arguments, 0), 1318 i = 0, 1319 length = args.length, 1320 pValues = new Array(length), 1321 count = length, 1322 pCount = length, 1323 deferred = length <= 1 && firstParam && jQuery.isFunction(firstParam.promise) ? 1324 firstParam : 1325 jQuery.Deferred(), 1326 promise = deferred.promise(); 1327 1328 function resolveFunc(i) { 1329 return function (value) { 1330 args[i] = arguments.length > 1 ? sliceDeferred.call(arguments, 0) : value; 1331 if (!(--count)) { 1332 deferred.resolveWith(deferred, args); 1333 } 1334 }; 1335 } 1336 1337 function progressFunc(i) { 1338 return function (value) { 1339 pValues[i] = arguments.length > 1 ? sliceDeferred.call(arguments, 0) : value; 1340 deferred.notifyWith(promise, pValues); 1341 }; 1342 } 1343 1344 if (length > 1) { 1345 for (; i < length; i++) { 1346 if (args[i] && args[i].promise && jQuery.isFunction(args[i].promise)) { 1347 args[i].promise().then(resolveFunc(i), deferred.reject, progressFunc(i)); 1348 } else { 1349 --count; 1350 } 1351 } 1352 if (!count) { 1353 deferred.resolveWith(deferred, args); 1354 } 1355 } else if (deferred !== firstParam) { 1356 deferred.resolveWith(deferred, length ? [firstParam] : []); 1357 } 1358 return promise; 1359 } 1360 }); 1361 1362 1363 jQuery.support = (function () { 1364 1365 var support, 1366 all, 1367 a, 1368 select, 1369 opt, 1370 input, 1371 fragment, 1372 tds, 1373 events, 1374 eventName, 1375 i, 1376 isSupported, 1377 div = document.createElement("div"), 1378 documentElement = document.documentElement; 1379 1380 // Preliminary tests 1381 div.setAttribute("className", "t"); 1382 div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a>
vendor: 2,638 bytes, lines 1382-1444
1382<input type='checkbox'/>"; 1383 1384 all = div.getElementsByTagName("*"); 1385 a = div.getElementsByTagName("a")[0]; 1386 1387 // Can't get basic test support 1388 if (!all || !all.length || !a) { 1389 return {}; 1390 } 1391 1392 // First batch of supports tests 1393 select = document.createElement("select"); 1394 opt = select.appendChild(document.createElement("option")); 1395 input = div.getElementsByTagName("input")[0]; 1396 1397 support = { 1398 // IE strips leading whitespace when .innerHTML is used 1399 leadingWhitespace: (div.firstChild.nodeType === 3), 1400 1401 // Make sure that tbody elements aren't automatically inserted 1402 // IE will insert them into empty tables 1403 tbody: !div.getElementsByTagName("tbody").length, 1404 1405 // Make sure that link elements get serialized correctly by innerHTML 1406 // This requires a wrapper element in IE 1407 htmlSerialize: !!div.getElementsByTagName("link").length, 1408 1409 // Get the style information from getAttribute 1410 // (IE uses .cssText instead) 1411 style: /top/.test(a.getAttribute("style")), 1412 1413 // Make sure that URLs aren't manipulated 1414 // (IE normalizes it by default) 1415 hrefNormalized: (a.getAttribute("href") === "/a"), 1416 1417 // Make sure that element opacity exists 1418 // (IE uses filter instead) 1419 // Use a regex to work around a WebKit issue. See #5145 1420 opacity: /^0.55/.test(a.style.opacity), 1421 1422 // Verify style float existence 1423 // (IE uses styleFloat instead of cssFloat) 1424 cssFloat: !!a.style.cssFloat, 1425 1426 // Make sure that if no value is specified for a checkbox 1427 // that it defaults to "on". 1428 // (WebKit defaults to "" instead) 1429 checkOn: (input.value === "on"), 1430 1431 // Make sure that a selected-by-default option has a working selected property. 1432 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) 1433 optSelected: opt.selected, 1434 1435 // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) 1436 getSetAttribute: div.className !== "t", 1437 1438 // Tests for enctype support on a form(#6743) 1439 enctype: !!document.createElement("form").enctype, 1440 1441 // Makes sure cloning an html5 element does not cause problems 1442 // Where outerHTML is undefined, this still works 1443 html5Clone: document.createElement("nav").cloneNode(true).outerHTML !== "<:nav></:nav>", 1444
1445 // Will be defined later 1446 submitBubbles: true, 1447 changeBubbles: true, 1448 focusinBubbles: false, 1449 deleteExpando: true, 1450 noCloneEvent: true, 1451 inlineBlockNeedsLayout: false, 1452 shrinkWrapBlocks: false, 1453 reliableMarginRight: true, 1454 pixelMargin: true 1455 }; 1456 1457 // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead 1458 jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat"); 1459 1460 // Make sure checked status is properly cloned 1461 input.checked = true; 1462 support.noCloneChecked = input.cloneNode(true).checked; 1463 1464 // Make sure that the options inside disabled selects aren't marked as disabled 1465 // (WebKit marks them as disabled) 1466 select.disabled = true; 1467 support.optDisabled = !opt.disabled; 1468 1469 // Test to see if it's possible to delete an expando from an element 1470 // Fails in Internet Explorer 1471 try { 1472 delete div.test; 1473 } catch (e) { 1474 support.deleteExpando = false; 1475 } 1476 1477 if (!div.addEventListener && div.attachEvent && div.fireEvent) { 1478 div.attachEvent("onclick", function () { 1479 // Cloning a node shouldn't copy over any 1480 // bound event handlers (IE does this) 1481 support.noCloneEvent = false; 1482 }); 1483 div.cloneNode(true).fireEvent("onclick"); 1484 } 1485 1486 // Check if a radio maintains its value 1487 // after being appended to the DOM 1488 input = document.createElement("input"); 1489 input.value = "t"; 1490 input.setAttribute("type", "radio"); 1491 support.radioValue = input.value === "t"; 1492 1493 input.setAttribute("checked", "checked"); 1494 1495 // #11217 - WebKit loses check when the name is after the checked attribute 1496 input.setAttribute("name", "t"); 1497 1498 div.appendChild(input); 1499 fragment = document.createDocumentFragment(); 1500 fragment.appendChild(div.lastChild); 1501 1502 // WebKit doesn't clone checked state correctly in fragments 1503 support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; 1504 1505 // Check if a disconnected checkbox will retain its checked 1506 // value of true after appended to the DOM (IE6/7) 1507 support.appendChecked = input.checked; 1508 1509 fragment.removeChild(input); 1510 fragment.appendChild(div); 1511 1512 // Technique from Juriy Zaytsev 1513 // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ 1514 // We only care about the case where non-standard event systems 1515 // are used, namely in IE. Short-circuiting here helps us to 1516 // avoid an eval call (in setAttribute) which can cause CSP 1517 // to go haywire. See: https://developer.mozilla.org/en/Security/CSP 1518 if (div.attachEvent) { 1519 for (i in { 1520 submit: 1, 1521 change: 1, 1522 focusin: 1 1523 }) { 1524 eventName = "on" + i; 1525 isSupported = (eventName in div); 1526 if (!isSupported) { 1527 div.setAttribute(eventName, "return;"); 1528 isSupported = (typeof div[eventName] === "function"); 1529 } 1530 support[i + "Bubbles"] = isSupported; 1531 } 1532 } 1533 1534 fragment.removeChild(div); 1535 1536 // Null elements to avoid leaks in IE 1537 fragment = select = opt = div = input = null; 1538 1539 // Run tests that need a body at doc ready 1540 jQuery(function () { 1541 var container, outer, inner, table, td, offsetSupport, 1542 marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight, 1543 paddingMarginBorderVisibility, paddingMarginBorder, 1544 body = document.getElementsByTagName("body")[0]; 1545 1546 if (!body) { 1547 // Return for frameset docs that don't have a body 1548 return; 1549 } 1550 1551 conMarginTop = 1; 1552 paddingMarginBorder = "padding:0;margin:0;border:"; 1553 positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;"; 1554 paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;"; 1555 style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;"; 1556 html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" + 1557 "<table " + style + "' cellpadding='0' cellspacing='0'>" + 1558 "<tr><td></td></tr></table>"; 1559 1560 container = document.createElement("div"); 1561 container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; 1562 body.insertBefore(container, body.firstChild); 1563 1564 // Construct the test element 1565 div = document.createElement("div"); 1566 container.appendChild(div); 1567 1568 // Check if table cells still have offsetWidth/Height when they are set 1569 // to display:none and there are still other visible table cells in a 1570 // table row; if so, offsetWidth/Height are not reliable for use when 1571 // determining if an element has been hidden directly using 1572 // display:none (it is still safe to use offsets if a parent element is 1573 // hidden; don safety goggles and see bug #4512 for more information). 1574 // (only IE 8 fails this test) 1575 div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>"; 1576 tds = div.getElementsByTagName("td"); 1577 isSupported = (tds[0].offsetHeight === 0); 1578 1579 tds[0].style.display = ""; 1580 tds[1].style.display = "none"; 1581 1582 // Check if empty table cells still have offsetWidth/Height 1583 // (IE <= 8 fail this test) 1584 support.reliableHiddenOffsets = isSupported && (tds[0].offsetHeight === 0); 1585 1586 // Check if div with explicit width and no margin-right incorrectly 1587 // gets computed margin-right based on width of container. For more 1588 // info see bug #3333 1589 // Fails in WebKit before Feb 2011 nightlies 1590 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 1591 if (window.getComputedStyle) { 1592 div.innerHTML = ""; 1593 marginDiv = document.createElement("div"); 1594 marginDiv.style.width = "0"; 1595 marginDiv.style.marginRight = "0"; 1596 div.style.width = "2px"; 1597 div.appendChild(marginDiv); 1598 support.reliableMarginRight = 1599 (parseInt((window.getComputedStyle(marginDiv, null) || {marginRight: 0}).marginRight, 10) || 0) === 0; 1600 } 1601 1602 if (typeof div.style.zoom !== "undefined") { 1603 // Check if natively block-level elements act like inline-block 1604 // elements when setting their display to 'inline' and giving 1605 // them layout 1606 // (IE < 8 does this) 1607 div.innerHTML = ""; 1608 div.style.width = div.style.padding = "1px"; 1609 div.style.border = 0; 1610 div.style.overflow = "hidden"; 1611 div.style.display = "inline"; 1612 div.style.zoom = 1; 1613 support.inlineBlockNeedsLayout = (div.offsetWidth === 3); 1614 1615 // Check if elements with layout shrink-wrap their children 1616 // (IE 6 does this) 1617 div.style.display = "block"; 1618 div.style.overflow = "visible"; 1619 div.innerHTML = "<div style='width:5px;'></div>"; 1620 support.shrinkWrapBlocks = (div.offsetWidth !== 3); 1621 } 1622 1623 div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility; 1624 div.innerHTML = html; 1625 1626 outer = div.firstChild; 1627 inner = outer.firstChild; 1628 td = outer.nextSibling.firstChild.firstChild; 1629 1630 offsetSupport = { 1631 doesNotAddBorder: (inner.offsetTop !== 5), 1632 doesAddBorderForTableAndCells: (td.offsetTop === 5) 1633 }; 1634 1635 inner.style.position = "fixed"; 1636 inner.style.top = "20px"; 1637 1638 // safari subtracts parent border width here which is 5px 1639 offsetSupport.fixedPosition = (inner.offsetTop === 20 || inner.offsetTop === 15); 1640 inner.style.position = inner.style.top = ""; 1641 1642 outer.style.overflow = "hidden"; 1643 outer.style.position = "relative"; 1644 1645 offsetSupport.subtractsBorderForOverflowNotVisible = (inner.offsetTop === -5); 1646 offsetSupport.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== conMarginTop); 1647 1648 if (window.getComputedStyle) { 1649 div.style.marginTop = "1%"; 1650 support.pixelMargin = (window.getComputedStyle(div, null) || {marginTop: 0}).marginTop !== "1%"; 1651 } 1652 1653 if (typeof container.style.zoom !== "undefined") { 1654 container.style.zoom = 1; 1655 } 1656 1657 body.removeChild(container); 1658 marginDiv = div = container = null; 1659 1660 jQuery.extend(support, offsetSupport); 1661 }); 1662 1663 return support; 1664 })(); 1665 1666 1667 var rbrace = /^(?:\{.*\}|\[.*\])$/, 1668 rmultiDash = /([A-Z])/g; 1669 1670 jQuery.extend({ 1671 cache: {}, 1672 1673 // Please use with caution 1674 uuid: 0, 1675 1676 // Unique for each copy of jQuery on the page 1677 // Non-digits removed to match rinlinejQuery 1678 expando: "jQuery" + (jQuery.fn.jquery + Math.random()).replace(/\D/g, ""), 1679 1680 // The following elements throw uncatchable exceptions if you 1681 // attempt to add expando properties to them. 1682 noData: { 1683 "embed": true, 1684 // Ban all objects except for Flash (which handle expandos) 1685 "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", 1686 "applet": true 1687 }, 1688 1689 hasData: function (elem) { 1690 elem = elem.nodeType ? jQuery.cache[elem[jQuery.expando]] : elem[jQuery.expando]; 1691 return !!elem && !isEmptyDataObject(elem); 1692 }, 1693 1694 data: function (elem, name, data, pvt /* Internal Use Only */) { 1695 if (!jQuery.acceptData(elem)) { 1696 return; 1697 } 1698 1699 var privateCache, thisCache, ret, 1700 internalKey = jQuery.expando, 1701 getByName = typeof name === "string", 1702 1703 // We have to handle DOM nodes and JS objects differently because IE6-7 1704 // can't GC object references properly across the DOM-JS boundary 1705 isNode = elem.nodeType, 1706 1707 // Only DOM nodes need the global jQuery cache; JS object data is 1708 // attached directly to the object so GC can occur automatically 1709 cache = isNode ? jQuery.cache : elem, 1710 1711 // Only defining an ID for JS objects if its cache already exists allows 1712 // the code to shortcut on the same path as a DOM node with no cache 1713 id = isNode ? elem[internalKey] : elem[internalKey] && internalKey, 1714 isEvents = name === "events"; 1715 1716 // Avoid doing any more work than we need to when trying to get data on an 1717 // object that has no data at all 1718 if ((!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined) { 1719 return; 1720 } 1721 1722 if (!id) { 1723 // Only DOM nodes need a new unique ID for each element since their data 1724 // ends up in the global cache 1725 if (isNode) { 1726 elem[internalKey] = id = ++jQuery.uuid; 1727 } else { 1728 id = internalKey; 1729 } 1730 } 1731 1732 if (!cache[id]) { 1733 cache[id] = {}; 1734 1735 // Avoids exposing jQuery metadata on plain JS objects when the object 1736 // is serialized using JSON.stringify 1737 if (!isNode) { 1738 cache[id].toJSON = jQuery.noop; 1739 } 1740 } 1741
vendor: 9,030 bytes, lines 1742-1997
1742 // An object can be passed to jQuery.data instead of a key/value pair; this gets 1743 // shallow copied over onto the existing cache 1744 if (typeof name === "object" || typeof name === "function") { 1745 if (pvt) { 1746 cache[id] = jQuery.extend(cache[id], name); 1747 } else { 1748 cache[id].data = jQuery.extend(cache[id].data, name); 1749 } 1750 } 1751 1752 privateCache = thisCache = cache[id]; 1753 1754 // jQuery data() is stored in a separate object inside the object's internal data 1755 // cache in order to avoid key collisions between internal data and user-defined 1756 // data. 1757 if (!pvt) { 1758 if (!thisCache.data) { 1759 thisCache.data = {}; 1760 } 1761 1762 thisCache = thisCache.data; 1763 } 1764 1765 if (data !== undefined) { 1766 thisCache[jQuery.camelCase(name)] = data; 1767 } 1768 1769 // Users should not attempt to inspect the internal events object using jQuery.data, 1770 // it is undocumented and subject to change. But does anyone listen? No. 1771 if (isEvents && !thisCache[name]) { 1772 return privateCache.events; 1773 } 1774 1775 // Check for both converted-to-camel and non-converted data property names 1776 // If a data property was specified 1777 if (getByName) { 1778 1779 // First Try to find as-is property data 1780 ret = thisCache[name]; 1781 1782 // Test for null|undefined property data 1783 if (ret == null) { 1784 1785 // Try to find the camelCased property 1786 ret = thisCache[jQuery.camelCase(name)]; 1787 } 1788 } else { 1789 ret = thisCache; 1790 } 1791 1792 return ret; 1793 }, 1794 1795 removeData: function (elem, name, pvt /* Internal Use Only */) { 1796 if (!jQuery.acceptData(elem)) { 1797 return; 1798 } 1799 1800 var thisCache, i, l, 1801 1802 // Reference to internal data cache key 1803 internalKey = jQuery.expando, 1804 1805 isNode = elem.nodeType, 1806 1807 // See jQuery.data for more information 1808 cache = isNode ? jQuery.cache : elem, 1809 1810 // See jQuery.data for more information 1811 id = isNode ? elem[internalKey] : internalKey; 1812 1813 // If there is already no cache entry for this object, there is no 1814 // purpose in continuing 1815 if (!cache[id]) { 1816 return; 1817 } 1818 1819 if (name) { 1820 1821 thisCache = pvt ? cache[id] : cache[id].data; 1822 1823 if (thisCache) { 1824 1825 // Support array or space separated string names for data keys 1826 if (!jQuery.isArray(name)) { 1827 1828 // try the string as a key before any manipulation 1829 if (name in thisCache) { 1830 name = [name]; 1831 } else { 1832 1833 // split the camel cased version by spaces unless a key with the spaces exists 1834 name = jQuery.camelCase(name); 1835 if (name in thisCache) { 1836 name = [name]; 1837 } else { 1838 name = name.split(" "); 1839 } 1840 } 1841 } 1842 1843 for (i = 0, l = name.length; i < l; i++) { 1844 delete thisCache[name[i]]; 1845 } 1846 1847 // If there is no data left in the cache, we want to continue 1848 // and let the cache object itself get destroyed 1849 if (!(pvt ? isEmptyDataObject : jQuery.isEmptyObject)(thisCache)) { 1850 return; 1851 } 1852 } 1853 } 1854 1855 // See jQuery.data for more information 1856 if (!pvt) { 1857 delete cache[id].data; 1858 1859 // Don't destroy the parent cache unless the internal data object 1860 // had been the only thing left in it 1861 if (!isEmptyDataObject(cache[id])) { 1862 return; 1863 } 1864 } 1865 1866 // Browsers that fail expando deletion also refuse to delete expandos on 1867 // the window, but it will allow it on all other JS objects; other browsers 1868 // don't care 1869 // Ensure that `cache` is not a window object #10080 1870 if (jQuery.support.deleteExpando || !cache.setInterval) { 1871 delete cache[id]; 1872 } else { 1873 cache[id] = null; 1874 } 1875 1876 // We destroyed the cache and need to eliminate the expando on the node to avoid 1877 // false lookups in the cache for entries that no longer exist 1878 if (isNode) { 1879 // IE does not allow us to delete expando properties from nodes, 1880 // nor does it have a removeAttribute function on Document nodes; 1881 // we must handle all of these cases 1882 if (jQuery.support.deleteExpando) { 1883 delete elem[internalKey]; 1884 } else if (elem.removeAttribute) { 1885 elem.removeAttribute(internalKey); 1886 } else { 1887 elem[internalKey] = null; 1888 } 1889 } 1890 }, 1891 1892 // For internal use only. 1893 _data: function (elem, name, data) { 1894 return jQuery.data(elem, name, data, true); 1895 }, 1896 1897 // A method for determining if a DOM node can handle the data expando 1898 acceptData: function (elem) { 1899 if (elem.nodeName) { 1900 var match = jQuery.noData[elem.nodeName.toLowerCase()]; 1901 1902 if (match) { 1903 return !(match === true || elem.getAttribute("classid") !== match); 1904 } 1905 } 1906 1907 return true; 1908 } 1909 }); 1910 1911 jQuery.fn.extend({ 1912 data: function (key, value) { 1913 var parts, part, attr, name, l, 1914 elem = this[0], 1915 i = 0, 1916 data = null; 1917 1918 // Gets all values 1919 if (key === undefined) { 1920 if (this.length) { 1921 data = jQuery.data(elem); 1922 1923 if (elem.nodeType === 1 && !jQuery._data(elem, "parsedAttrs")) { 1924 attr = elem.attributes; 1925 for (l = attr.length; i < l; i++) { 1926 name = attr[i].name; 1927 1928 if (name.indexOf("data-") === 0) { 1929 name = jQuery.camelCase(name.substring(5)); 1930 1931 dataAttr(elem, name, data[name]); 1932 } 1933 } 1934 jQuery._data(elem, "parsedAttrs", true); 1935 } 1936 } 1937 1938 return data; 1939 } 1940 1941 // Sets multiple values 1942 if (typeof key === "object") { 1943 return this.each(function () { 1944 jQuery.data(this, key); 1945 }); 1946 } 1947 1948 parts = key.split(".", 2); 1949 parts[1] = parts[1] ? "." + parts[1] : ""; 1950 part = parts[1] + "!"; 1951 1952 return jQuery.access(this, function (value) { 1953 1954 if (value === undefined) { 1955 data = this.triggerHandler("getData" + part, [parts[0]]); 1956 1957 // Try to fetch any internally stored data first 1958 if (data === undefined && elem) { 1959 data = jQuery.data(elem, key); 1960 data = dataAttr(elem, key, data); 1961 } 1962 1963 return data === undefined && parts[1] ? 1964 this.data(parts[0]) : 1965 data; 1966 } 1967 1968 parts[1] = value; 1969 this.each(function () { 1970 var self = jQuery(this); 1971 1972 self.triggerHandler("setData" + part, parts); 1973 jQuery.data(this, key, value); 1974 self.triggerHandler("changeData" + part, parts); 1975 }); 1976 }, null, value, arguments.length > 1, null, false); 1977 }, 1978 1979 removeData: function (key) { 1980 return this.each(function () { 1981 jQuery.removeData(this, key); 1982 }); 1983 } 1984 }); 1985 1986 function dataAttr(elem, key, data) { 1987 // If nothing was found internally, try to fetch any 1988 // data from the HTML5 data-* attribute 1989 if (data === undefined && elem.nodeType === 1) { 1990 1991 var name = "data-" + key.replace(rmultiDash, "-$1").toLowerCase(); 1992 1993 data = elem.getAttribute(name); 1994 1995 if (typeof data === "string") { 1996 try { 1997 data = data === "true" ? true :
1998 data === "false" ? false : 1999 data === "null" ? null : 2000 jQuery.isNumeric(data) ? +data : 2001 rbrace.test(data) ? jQuery.parseJSON(data) : 2002 data; 2003 } catch (e) { 2004 } 2005 2006 // Make sure we set the data so it isn't changed later 2007 jQuery.data(elem, key, data); 2008 2009 } else { 2010 data = undefined; 2011 } 2012 } 2013 2014 return data; 2015 } 2016 2017// checks a cache object for emptiness 2018 function isEmptyDataObject(obj) { 2019 for (var name in obj) { 2020 2021 // if the public data object is empty, the private is still empty 2022 if (name === "data" && jQuery.isEmptyObject(obj[name])) { 2023 continue; 2024 } 2025 if (name !== "toJSON") { 2026 return false; 2027 } 2028 } 2029 2030 return true; 2031 } 2032 2033 2034 function handleQueueMarkDefer(elem, type, src) { 2035 var deferDataKey = type + "defer", 2036 queueDataKey = type + "queue", 2037 markDataKey = type + "mark", 2038 defer = jQuery._data(elem, deferDataKey); 2039 if (defer && 2040 (src === "queue" || !jQuery._data(elem, queueDataKey)) && 2041 (src === "mark" || !jQuery._data(elem, markDataKey))) { 2042 // Give room for hard-coded callbacks to fire first 2043 // and eventually mark/queue something else on the element 2044 setTimeout(function () { 2045 if (!jQuery._data(elem, queueDataKey) && 2046 !jQuery._data(elem, markDataKey)) { 2047 jQuery.removeData(elem, deferDataKey, true); 2048 defer.fire(); 2049 } 2050 }, 0); 2051 } 2052 } 2053 2054 jQuery.extend({ 2055 2056 _mark: function (elem, type) { 2057 if (elem) { 2058 type = (type || "fx") + "mark"; 2059 jQuery._data(elem, type, (jQuery._data(elem, type) || 0) + 1); 2060 } 2061 }, 2062 2063 _unmark: function (force, elem, type) { 2064 if (force !== true) { 2065 type = elem; 2066 elem = force; 2067 force = false; 2068 } 2069 if (elem) { 2070 type = type || "fx"; 2071 var key = type + "mark", 2072 count = force ? 0 : ((jQuery._data(elem, key) || 1) - 1); 2073 if (count) { 2074 jQuery._data(elem, key, count); 2075 } else { 2076 jQuery.removeData(elem, key, true); 2077 handleQueueMarkDefer(elem, type, "mark"); 2078 } 2079 } 2080 }, 2081 2082 queue: function (elem, type, data) { 2083 var q; 2084 if (elem) { 2085 type = (type || "fx") + "queue"; 2086 q = jQuery._data(elem, type); 2087 2088 // Speed up dequeue by getting out quickly if this is just a lookup 2089 if (data) { 2090 if (!q || jQuery.isArray(data)) { 2091 q = jQuery._data(elem, type, jQuery.makeArray(data)); 2092 } else { 2093 q.push(data); 2094 } 2095 } 2096 return q || []; 2097 } 2098 }, 2099 2100 dequeue: function (elem, type) { 2101 type = type || "fx"; 2102 2103 var queue = jQuery.queue(elem, type), 2104 fn = queue.shift(), 2105 hooks = {}; 2106 2107 // If the fx queue is dequeued, always remove the progress sentinel 2108 if (fn === "inprogress") { 2109 fn = queue.shift(); 2110 } 2111 2112 if (fn) { 2113 // Add a progress sentinel to prevent the fx queue from being 2114 // automatically dequeued 2115 if (type === "fx") { 2116 queue.unshift("inprogress"); 2117 } 2118 2119 jQuery._data(elem, type + ".run", hooks); 2120 fn.call(elem, function () { 2121 jQuery.dequeue(elem, type); 2122 }, hooks); 2123 } 2124 2125 if (!queue.length) { 2126 jQuery.removeData(elem, type + "queue " + type + ".run", true); 2127 handleQueueMarkDefer(elem, type, "queue"); 2128 } 2129 } 2130 }); 2131 2132 jQuery.fn.extend({ 2133 queue: function (type, data) { 2134 var setter = 2; 2135 2136 if (typeof type !== "string") { 2137 data = type; 2138 type = "fx"; 2139 setter--; 2140 } 2141 2142 if (arguments.length < setter) { 2143 return jQuery.queue(this[0], type); 2144 } 2145 2146 return data === undefined ? 2147 this : 2148 this.each(function () { 2149 var queue = jQuery.queue(this, type, data); 2150 2151 if (type === "fx" && queue[0] !== "inprogress") { 2152 jQuery.dequeue(this, type); 2153 } 2154 }); 2155 }, 2156 dequeue: function (type) { 2157 return this.each(function () { 2158 jQuery.dequeue(this, type); 2159 }); 2160 }, 2161 // Based off of the plugin by Clint Helfers, with permission. 2162 // http://blindsignals.com/index.php/2009/07/jquery-delay/ 2163 delay: function (time, type) { 2164 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; 2165 type = type || "fx"; 2166 2167 return this.queue(type, function (next, hooks) { 2168 var timeout = setTimeout(next, time); 2169 hooks.stop = function () { 2170 clearTimeout(timeout); 2171 }; 2172 }); 2173 }, 2174 clearQueue: function (type) { 2175 return this.queue(type || "fx", []); 2176 }, 2177 // Get a promise resolved when queues of a certain type 2178 // are emptied (fx is the type by default) 2179 promise: function (type, object) { 2180 if (typeof type !== "string") { 2181 object = type; 2182 type = undefined; 2183 } 2184 type = type || "fx"; 2185 var defer = jQuery.Deferred(), 2186 elements = this, 2187 i = elements.length, 2188 count = 1, 2189 deferDataKey = type + "defer", 2190 queueDataKey = type + "queue", 2191 markDataKey = type + "mark", 2192 tmp; 2193 2194 function resolve() { 2195 if (!(--count)) { 2196 defer.resolveWith(elements, [elements]); 2197 } 2198 } 2199 2200 while (i--) { 2201 if ((tmp = jQuery.data(elements[i], deferDataKey, undefined, true) || 2202 (jQuery.data(elements[i], queueDataKey, undefined, true) || 2203 jQuery.data(elements[i], markDataKey, undefined, true)) && 2204 jQuery.data(elements[i], deferDataKey, jQuery.Callbacks("once memory"), true))) { 2205 count++; 2206 tmp.add(resolve); 2207 } 2208 } 2209 resolve(); 2210 return defer.promise(object); 2211 } 2212 }); 2213 2214 2215 var rclass = /[\n\t\r]/g, 2216 rspace = /\s+/, 2217 rreturn = /\r/g, 2218 rtype = /^(?:button|input)$/i, 2219 rfocusable = /^(?:button|input|object|select|textarea)$/i, 2220 rclickable = /^a(?:rea)?$/i, 2221 rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, 2222 getSetAttribute = jQuery.support.getSetAttribute, 2223 nodeHook, boolHook, fixSpecified; 2224 2225 jQuery.fn.extend({ 2226 attr: function (name, value) { 2227 return jQuery.access(this, jQuery.attr, name, value, arguments.length > 1); 2228 }, 2229 2230 removeAttr: function (name) { 2231 return this.each(function () { 2232 jQuery.removeAttr(this, name); 2233 }); 2234 }, 2235 2236 prop: function (name, value) { 2237 return jQuery.access(this, jQuery.prop, name, value, arguments.length > 1); 2238 }, 2239 2240 removeProp: function (name) { 2241 name = jQuery.propFix[name] || name; 2242 return this.each(function () { 2243 // try/catch handles cases where IE balks (such as removing a property on window) 2244 try { 2245 this[name] = undefined; 2246 delete this[name]; 2247 } catch (e) { 2248 } 2249 }); 2250 }, 2251 2252 addClass: function (value) { 2253 var classNames, i, l, elem, 2254 setClass, c, cl; 2255 2256 if (jQuery.isFunction(value)) { 2257 return this.each(function (j) { 2258 jQuery(this).addClass(value.call(this, j, this.className)); 2259 }); 2260 } 2261 2262 if (value && typeof value === "string") { 2263 classNames = value.split(rspace); 2264 2265 for (i = 0, l = this.length; i < l; i++) { 2266 elem = this[i]; 2267 2268 if (elem.nodeType === 1) { 2269 if (!elem.className && classNames.length === 1) { 2270 elem.className = value; 2271 2272 } else { 2273 setClass = " " + elem.className + " "; 2274 2275 for (c = 0, cl = classNames.length; c < cl; c++) { 2276 if (!~setClass.indexOf(" " + classNames[c] + " ")) { 2277 setClass += classNames[c] + " "; 2278 } 2279 } 2280 elem.className = jQuery.trim(setClass); 2281 } 2282 } 2283 } 2284 } 2285 2286 return this; 2287 }, 2288 2289 removeClass: function (value) { 2290 var classNames, i, l, elem, className, c, cl; 2291 2292 if (jQuery.isFunction(value)) { 2293 return this.each(function (j) { 2294 jQuery(this).removeClass(value.call(this, j, this.className)); 2295 }); 2296 } 2297 2298 if ((value && typeof value === "string") || value === undefined) { 2299 classNames = (value || "").split(rspace); 2300 2301 for (i = 0, l = this.length; i < l; i++) { 2302 elem = this[i]; 2303 2304 if (elem.nodeType === 1 && elem.className) { 2305 if (value) { 2306 className = (" " + elem.className + " ").replace(rclass, " "); 2307 for (c = 0, cl = classNames.length; c < cl; c++) { 2308 className = className.replace(" " + classNames[c] + " ", " "); 2309 } 2310 elem.className = jQuery.trim(className); 2311 2312 } else { 2313 elem.className = ""; 2314 } 2315 } 2316 } 2317 } 2318 2319 return this; 2320 }, 2321 2322 toggleClass: function (value, stateVal) { 2323 var type = typeof value, 2324 isBool = typeof stateVal === "boolean"; 2325 2326 if (jQuery.isFunction(value)) { 2327 return this.each(function (i) { 2328 jQuery(this).toggleClass(value.call(this, i, this.className, stateVal), stateVal); 2329 }); 2330 } 2331 2332 return this.each(function () { 2333 if (type === "string") { 2334 // toggle individual class names 2335 var className, 2336 i = 0, 2337 self = jQuery(this), 2338 state = stateVal, 2339 classNames = value.split(rspace); 2340 2341 while ((className = classNames[i++])) { 2342 // check each className given, space seperated list 2343 state = isBool ? state : !self.hasClass(className); 2344 self[state ? "addClass" : "removeClass"](className); 2345 } 2346 2347 } else if (type === "undefined" || type === "boolean") { 2348 if (this.className) { 2349 // store className if set 2350 jQuery._data(this, "__className__", this.className); 2351 } 2352 2353 // toggle whole className 2354 this.className = this.className || value === false ? "" : jQuery._data(this, "__className__") || ""; 2355 } 2356 }); 2357 }, 2358 2359 hasClass: function (selector) { 2360 var className = " " + selector + " ", 2361 i = 0, 2362 l = this.length; 2363 for (; i < l; i++) { 2364 if (this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf(className) > -1) { 2365 return true; 2366 } 2367 } 2368 2369 return false;
vendor: 61,620 bytes, lines 2370-3963
2370 }, 2371 2372 val: function (value) { 2373 var hooks, ret, isFunction, 2374 elem = this[0]; 2375 2376 if (!arguments.length) { 2377 if (elem) { 2378 hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()]; 2379 2380 if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) { 2381 return ret; 2382 } 2383 2384 ret = elem.value; 2385 2386 return typeof ret === "string" ? 2387 // handle most common string cases 2388 ret.replace(rreturn, "") : 2389 // handle cases where value is null/undef or number 2390 ret == null ? "" : ret; 2391 } 2392 2393 return; 2394 } 2395 2396 isFunction = jQuery.isFunction(value); 2397 2398 return this.each(function (i) { 2399 var self = jQuery(this), val; 2400 2401 if (this.nodeType !== 1) { 2402 return; 2403 } 2404 2405 if (isFunction) { 2406 val = value.call(this, i, self.val()); 2407 } else { 2408 val = value; 2409 } 2410 2411 // Treat null/undefined as ""; convert numbers to string 2412 if (val == null) { 2413 val = ""; 2414 } else if (typeof val === "number") { 2415 val += ""; 2416 } else if (jQuery.isArray(val)) { 2417 val = jQuery.map(val, function (value) { 2418 return value == null ? "" : value + ""; 2419 }); 2420 } 2421 2422 hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()]; 2423 2424 // If set returns undefined, fall back to normal setting 2425 if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) { 2426 this.value = val; 2427 } 2428 }); 2429 } 2430 }); 2431 2432 jQuery.extend({ 2433 valHooks: { 2434 option: { 2435 get: function (elem) { 2436 // attributes.value is undefined in Blackberry 4.7 but 2437 // uses .value. See #6932 2438 var val = elem.attributes.value; 2439 return !val || val.specified ? elem.value : elem.text; 2440 } 2441 }, 2442 select: { 2443 get: function (elem) { 2444 var value, i, max, option, 2445 index = elem.selectedIndex, 2446 values = [], 2447 options = elem.options, 2448 one = elem.type === "select-one"; 2449 2450 // Nothing was selected 2451 if (index < 0) { 2452 return null; 2453 } 2454 2455 // Loop through all the selected options 2456 i = one ? index : 0; 2457 max = one ? index + 1 : options.length; 2458 for (; i < max; i++) { 2459 option = options[i]; 2460 2461 // Don't return options that are disabled or in a disabled optgroup 2462 if (option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && 2463 (!option.parentNode.disabled || !jQuery.nodeName(option.parentNode, "optgroup"))) { 2464 2465 // Get the specific value for the option 2466 value = jQuery(option).val(); 2467 2468 // We don't need an array for one selects 2469 if (one) { 2470 return value; 2471 } 2472 2473 // Multi-Selects return an array 2474 values.push(value); 2475 } 2476 } 2477 2478 // Fixes Bug #2551 -- select.val() broken in IE after form.reset() 2479 if (one && !values.length && options.length) { 2480 return jQuery(options[index]).val(); 2481 } 2482 2483 return values; 2484 }, 2485 2486 set: function (elem, value) { 2487 var values = jQuery.makeArray(value); 2488 2489 jQuery(elem).find("option").each(function () { 2490 this.selected = jQuery.inArray(jQuery(this).val(), values) >= 0; 2491 }); 2492 2493 if (!values.length) { 2494 elem.selectedIndex = -1; 2495 } 2496 return values; 2497 } 2498 } 2499 }, 2500 2501 attrFn: { 2502 val: true, 2503 css: true, 2504 html: true, 2505 text: true, 2506 data: true, 2507 width: true, 2508 height: true, 2509 offset: true 2510 }, 2511 2512 attr: function (elem, name, value, pass) { 2513 var ret, hooks, notxml, 2514 nType = elem.nodeType; 2515 2516 // don't get/set attributes on text, comment and attribute nodes 2517 if (!elem || nType === 3 || nType === 8 || nType === 2) { 2518 return; 2519 } 2520 2521 if (pass && name in jQuery.attrFn) { 2522 return jQuery(elem)[name](value); 2523 } 2524 2525 // Fallback to prop when attributes are not supported 2526 if (typeof elem.getAttribute === "undefined") { 2527 return jQuery.prop(elem, name, value); 2528 } 2529 2530 notxml = nType !== 1 || !jQuery.isXMLDoc(elem); 2531 2532 // All attributes are lowercase 2533 // Grab necessary hook if one is defined 2534 if (notxml) { 2535 name = name.toLowerCase(); 2536 hooks = jQuery.attrHooks[name] || (rboolean.test(name) ? boolHook : nodeHook); 2537 } 2538 2539 if (value !== undefined) { 2540 2541 if (value === null) { 2542 jQuery.removeAttr(elem, name); 2543 return; 2544 2545 } else if (hooks && "set" in hooks && notxml && (ret = hooks.set(elem, value, name)) !== undefined) { 2546 return ret; 2547 2548 } else { 2549 elem.setAttribute(name, "" + value); 2550 return value; 2551 } 2552 2553 } else if (hooks && "get" in hooks && notxml && (ret = hooks.get(elem, name)) !== null) { 2554 return ret; 2555 2556 } else { 2557 2558 ret = elem.getAttribute(name); 2559 2560 // Non-existent attributes return null, we normalize to undefined 2561 return ret === null ? 2562 undefined : 2563 ret; 2564 } 2565 }, 2566 2567 removeAttr: function (elem, value) { 2568 var propName, attrNames, name, l, isBool, 2569 i = 0; 2570 2571 if (value && elem.nodeType === 1) { 2572 attrNames = value.toLowerCase().split(rspace); 2573 l = attrNames.length; 2574 2575 for (; i < l; i++) { 2576 name = attrNames[i]; 2577 2578 if (name) { 2579 propName = jQuery.propFix[name] || name; 2580 isBool = rboolean.test(name); 2581 2582 // See #9699 for explanation of this approach (setting first, then removal) 2583 // Do not do this for boolean attributes (see #10870) 2584 if (!isBool) { 2585 jQuery.attr(elem, name, ""); 2586 } 2587 elem.removeAttribute(getSetAttribute ? name : propName); 2588 2589 // Set corresponding property to false for boolean attributes 2590 if (isBool && propName in elem) { 2591 elem[propName] = false; 2592 } 2593 } 2594 } 2595 } 2596 }, 2597 2598 attrHooks: { 2599 type: { 2600 set: function (elem, value) { 2601 // We can't allow the type property to be changed (since it causes problems in IE) 2602 if (rtype.test(elem.nodeName) && elem.parentNode) { 2603 jQuery.error("type property can't be changed"); 2604 } else if (!jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input")) { 2605 // Setting the type on a radio button after the value resets the value in IE6-9 2606 // Reset value to it's default in case type is set after value 2607 // This is for element creation 2608 var val = elem.value; 2609 elem.setAttribute("type", value); 2610 if (val) { 2611 elem.value = val; 2612 } 2613 return value; 2614 } 2615 } 2616 }, 2617 // Use the value property for back compat 2618 // Use the nodeHook for button elements in IE6/7 (#1954) 2619 value: { 2620 get: function (elem, name) { 2621 if (nodeHook && jQuery.nodeName(elem, "button")) { 2622 return nodeHook.get(elem, name); 2623 } 2624 return name in elem ? 2625 elem.value : 2626 null; 2627 }, 2628 set: function (elem, value, name) { 2629 if (nodeHook && jQuery.nodeName(elem, "button")) { 2630 return nodeHook.set(elem, value, name); 2631 } 2632 // Does not return so that setAttribute is also used 2633 elem.value = value; 2634 } 2635 } 2636 }, 2637 2638 propFix: { 2639 tabindex: "tabIndex", 2640 readonly: "readOnly", 2641 "for": "htmlFor", 2642 "class": "className", 2643 maxlength: "maxLength", 2644 cellspacing: "cellSpacing", 2645 cellpadding: "cellPadding", 2646 rowspan: "rowSpan", 2647 colspan: "colSpan", 2648 usemap: "useMap", 2649 frameborder: "frameBorder", 2650 contenteditable: "contentEditable" 2651 }, 2652 2653 prop: function (elem, name, value) { 2654 var ret, hooks, notxml, 2655 nType = elem.nodeType; 2656 2657 // don't get/set properties on text, comment and attribute nodes 2658 if (!elem || nType === 3 || nType === 8 || nType === 2) { 2659 return; 2660 } 2661 2662 notxml = nType !== 1 || !jQuery.isXMLDoc(elem); 2663 2664 if (notxml) { 2665 // Fix name and attach hooks 2666 name = jQuery.propFix[name] || name; 2667 hooks = jQuery.propHooks[name]; 2668 } 2669 2670 if (value !== undefined) { 2671 if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) { 2672 return ret; 2673 2674 } else { 2675 return (elem[name] = value); 2676 } 2677 2678 } else { 2679 if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { 2680 return ret; 2681 2682 } else { 2683 return elem[name]; 2684 } 2685 } 2686 }, 2687 2688 propHooks: { 2689 tabIndex: { 2690 get: function (elem) { 2691 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set 2692 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 2693 var attributeNode = elem.getAttributeNode("tabindex"); 2694 2695 return attributeNode && attributeNode.specified ? 2696 parseInt(attributeNode.value, 10) : 2697 rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href ? 2698 0 : 2699 undefined; 2700 } 2701 } 2702 } 2703 }); 2704 2705// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) 2706 jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; 2707 2708// Hook for boolean attributes 2709 boolHook = { 2710 get: function (elem, name) { 2711 // Align boolean attributes with corresponding properties 2712 // Fall back to attribute presence where some booleans are not supported 2713 var attrNode, 2714 property = jQuery.prop(elem, name); 2715 return property === true || typeof property !== "boolean" && (attrNode = elem.getAttributeNode(name)) && attrNode.nodeValue !== false ? 2716 name.toLowerCase() : 2717 undefined; 2718 }, 2719 set: function (elem, value, name) { 2720 var propName; 2721 if (value === false) { 2722 // Remove boolean attributes when set to false 2723 jQuery.removeAttr(elem, name); 2724 } else { 2725 // value is true since we know at this point it's type boolean and not false 2726 // Set boolean attributes to the same name and set the DOM property 2727 propName = jQuery.propFix[name] || name; 2728 if (propName in elem) { 2729 // Only set the IDL specifically if it already exists on the element 2730 elem[propName] = true; 2731 } 2732 2733 elem.setAttribute(name, name.toLowerCase()); 2734 } 2735 return name; 2736 } 2737 }; 2738 2739// IE6/7 do not support getting/setting some attributes with get/setAttribute 2740 if (!getSetAttribute) { 2741 2742 fixSpecified = { 2743 name: true, 2744 id: true, 2745 coords: true 2746 }; 2747 2748 // Use this for any attribute in IE6/7 2749 // This fixes almost every IE6/7 issue 2750 nodeHook = jQuery.valHooks.button = { 2751 get: function (elem, name) { 2752 var ret; 2753 ret = elem.getAttributeNode(name); 2754 return ret && (fixSpecified[name] ? ret.nodeValue !== "" : ret.specified) ? 2755 ret.nodeValue : 2756 undefined; 2757 }, 2758 set: function (elem, value, name) { 2759 // Set the existing or create a new attribute node 2760 var ret = elem.getAttributeNode(name); 2761 if (!ret) { 2762 ret = document.createAttribute(name); 2763 elem.setAttributeNode(ret); 2764 } 2765 return (ret.nodeValue = value + ""); 2766 } 2767 }; 2768 2769 // Apply the nodeHook to tabindex 2770 jQuery.attrHooks.tabindex.set = nodeHook.set; 2771 2772 // Set width and height to auto instead of 0 on empty string( Bug #8150 ) 2773 // This is for removals 2774 jQuery.each(["width", "height"], function (i, name) { 2775 jQuery.attrHooks[name] = jQuery.extend(jQuery.attrHooks[name], { 2776 set: function (elem, value) { 2777 if (value === "") { 2778 elem.setAttribute(name, "auto"); 2779 return value; 2780 } 2781 } 2782 }); 2783 }); 2784 2785 // Set contenteditable to false on removals(#10429) 2786 // Setting to empty string throws an error as an invalid value 2787 jQuery.attrHooks.contenteditable = { 2788 get: nodeHook.get, 2789 set: function (elem, value, name) { 2790 if (value === "") { 2791 value = "false"; 2792 } 2793 nodeHook.set(elem, value, name); 2794 } 2795 }; 2796 } 2797 2798 2799// Some attributes require a special call on IE 2800 if (!jQuery.support.hrefNormalized) { 2801 jQuery.each(["href", "src", "width", "height"], function (i, name) { 2802 jQuery.attrHooks[name] = jQuery.extend(jQuery.attrHooks[name], { 2803 get: function (elem) { 2804 var ret = elem.getAttribute(name, 2); 2805 return ret === null ? undefined : ret; 2806 } 2807 }); 2808 }); 2809 } 2810 2811 if (!jQuery.support.style) { 2812 jQuery.attrHooks.style = { 2813 get: function (elem) { 2814 // Return undefined in the case of empty string 2815 // Normalize to lowercase since IE uppercases css property names 2816 return elem.style.cssText.toLowerCase() || undefined; 2817 }, 2818 set: function (elem, value) { 2819 return (elem.style.cssText = "" + value); 2820 } 2821 }; 2822 } 2823 2824// Safari mis-reports the default selected property of an option 2825// Accessing the parent's selectedIndex property fixes it 2826 if (!jQuery.support.optSelected) { 2827 jQuery.propHooks.selected = jQuery.extend(jQuery.propHooks.selected, { 2828 get: function (elem) { 2829 var parent = elem.parentNode; 2830 2831 if (parent) { 2832 parent.selectedIndex; 2833 2834 // Make sure that it also works with optgroups, see #5701 2835 if (parent.parentNode) { 2836 parent.parentNode.selectedIndex; 2837 } 2838 } 2839 return null; 2840 } 2841 }); 2842 } 2843 2844// IE6/7 call enctype encoding 2845 if (!jQuery.support.enctype) { 2846 jQuery.propFix.enctype = "encoding"; 2847 } 2848 2849// Radios and checkboxes getter/setter 2850 if (!jQuery.support.checkOn) { 2851 jQuery.each(["radio", "checkbox"], function () { 2852 jQuery.valHooks[this] = { 2853 get: function (elem) { 2854 // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified 2855 return elem.getAttribute("value") === null ? "on" : elem.value; 2856 } 2857 }; 2858 }); 2859 } 2860 jQuery.each(["radio", "checkbox"], function () { 2861 jQuery.valHooks[this] = jQuery.extend(jQuery.valHooks[this], { 2862 set: function (elem, value) { 2863 if (jQuery.isArray(value)) { 2864 return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) >= 0); 2865 } 2866 } 2867 }); 2868 }); 2869 2870 2871 var rformElems = /^(?:textarea|input|select)$/i, 2872 rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, 2873 rhoverHack = /(?:^|\s)hover(\.\S+)?\b/, 2874 rkeyEvent = /^key/, 2875 rmouseEvent = /^(?:mouse|contextmenu)|click/, 2876 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 2877 rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, 2878 quickParse = function (selector) { 2879 var quick = rquickIs.exec(selector); 2880 if (quick) { 2881 // 0 1 2 3 2882 // [ _, tag, id, class ] 2883 quick[1] = (quick[1] || "").toLowerCase(); 2884 quick[3] = quick[3] && new RegExp("(?:^|\\s)" + quick[3] + "(?:\\s|$)"); 2885 } 2886 return quick; 2887 }, 2888 quickIs = function (elem, m) { 2889 var attrs = elem.attributes || {}; 2890 return ( 2891 (!m[1] || elem.nodeName.toLowerCase() === m[1]) && 2892 (!m[2] || (attrs.id || {}).value === m[2]) && 2893 (!m[3] || m[3].test((attrs["class"] || {}).value)) 2894 ); 2895 }, 2896 hoverHack = function (events) { 2897 return jQuery.event.special.hover ? events : events.replace(rhoverHack, "mouseenter$1 mouseleave$1"); 2898 }; 2899 2900 /* 2901 * Helper functions for managing events -- not part of the public interface. 2902 * Props to Dean Edwards' addEvent library for many of the ideas. 2903 */ 2904 jQuery.event = { 2905 2906 add: function (elem, types, handler, data, selector) { 2907 2908 var elemData, eventHandle, events, 2909 t, tns, type, namespaces, handleObj, 2910 handleObjIn, quick, handlers, special; 2911 2912 // Don't attach events to noData or text/comment nodes (allow plain objects tho) 2913 if (elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data(elem))) { 2914 return; 2915 } 2916 2917 // Caller can pass in an object of custom data in lieu of the handler 2918 if (handler.handler) { 2919 handleObjIn = handler; 2920 handler = handleObjIn.handler; 2921 selector = handleObjIn.selector; 2922 } 2923 2924 // Make sure that the handler has a unique ID, used to find/remove it later 2925 if (!handler.guid) { 2926 handler.guid = jQuery.guid++; 2927 } 2928 2929 // Init the element's event structure and main handler, if this is the first 2930 events = elemData.events; 2931 if (!events) { 2932 elemData.events = events = {}; 2933 } 2934 eventHandle = elemData.handle; 2935 if (!eventHandle) { 2936 elemData.handle = eventHandle = function (e) { 2937 // Discard the second event of a jQuery.event.trigger() and 2938 // when an event is called after a page has unloaded 2939 return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? 2940 jQuery.event.dispatch.apply(eventHandle.elem, arguments) : 2941 undefined; 2942 }; 2943 // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events 2944 eventHandle.elem = elem; 2945 } 2946 2947 // Handle multiple events separated by a space 2948 // jQuery(...).bind("mouseover mouseout", fn); 2949 types = jQuery.trim(hoverHack(types)).split(" "); 2950 for (t = 0; t < types.length; t++) { 2951 2952 tns = rtypenamespace.exec(types[t]) || []; 2953 type = tns[1]; 2954 namespaces = (tns[2] || "").split(".").sort(); 2955 2956 // If event changes its type, use the special event handlers for the changed type 2957 special = jQuery.event.special[type] || {}; 2958 2959 // If selector defined, determine special event api type, otherwise given type 2960 type = (selector ? special.delegateType : special.bindType) || type; 2961 2962 // Update special based on newly reset type 2963 special = jQuery.event.special[type] || {}; 2964 2965 // handleObj is passed to all event handlers 2966 handleObj = jQuery.extend({ 2967 type: type, 2968 origType: tns[1], 2969 data: data, 2970 handler: handler, 2971 guid: handler.guid, 2972 selector: selector, 2973 quick: selector && quickParse(selector), 2974 namespace: namespaces.join(".") 2975 }, handleObjIn); 2976 2977 // Init the event handler queue if we're the first 2978 handlers = events[type]; 2979 if (!handlers) { 2980 handlers = events[type] = []; 2981 handlers.delegateCount = 0; 2982 2983 // Only use addEventListener/attachEvent if the special events handler returns false 2984 if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) { 2985 // Bind the global event handler to the element 2986 if (elem.addEventListener) { 2987 elem.addEventListener(type, eventHandle, false); 2988 2989 } else if (elem.attachEvent) { 2990 elem.attachEvent("on" + type, eventHandle); 2991 } 2992 } 2993 } 2994 2995 if (special.add) { 2996 special.add.call(elem, handleObj); 2997 2998 if (!handleObj.handler.guid) { 2999 handleObj.handler.guid = handler.guid; 3000 } 3001 } 3002 3003 // Add to the element's handler list, delegates in front 3004 if (selector) { 3005 handlers.splice(handlers.delegateCount++, 0, handleObj); 3006 } else { 3007 handlers.push(handleObj); 3008 } 3009 3010 // Keep track of which events have ever been used, for event optimization 3011 jQuery.event.global[type] = true; 3012 } 3013 3014 // Nullify elem to prevent memory leaks in IE 3015 elem = null; 3016 }, 3017 3018 global: {}, 3019 3020 // Detach an event or set of events from an element 3021 remove: function (elem, types, handler, selector, mappedTypes) { 3022 3023 var elemData = jQuery.hasData(elem) && jQuery._data(elem), 3024 t, tns, type, origType, namespaces, origCount, 3025 j, events, special, handle, eventType, handleObj; 3026 3027 if (!elemData || !(events = elemData.events)) { 3028 return; 3029 } 3030 3031 // Once for each type.namespace in types; type may be omitted 3032 types = jQuery.trim(hoverHack(types || "")).split(" "); 3033 for (t = 0; t < types.length; t++) { 3034 tns = rtypenamespace.exec(types[t]) || []; 3035 type = origType = tns[1]; 3036 namespaces = tns[2]; 3037 3038 // Unbind all events (on this namespace, if provided) for the element 3039 if (!type) { 3040 for (type in events) { 3041 jQuery.event.remove(elem, type + types[t], handler, selector, true); 3042 } 3043 continue; 3044 } 3045 3046 special = jQuery.event.special[type] || {}; 3047 type = (selector ? special.delegateType : special.bindType) || type; 3048 eventType = events[type] || []; 3049 origCount = eventType.length; 3050 namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; 3051 3052 // Remove matching events 3053 for (j = 0; j < eventType.length; j++) { 3054 handleObj = eventType[j]; 3055 3056 if ((mappedTypes || origType === handleObj.origType) && 3057 (!handler || handler.guid === handleObj.guid) && 3058 (!namespaces || namespaces.test(handleObj.namespace)) && 3059 (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) { 3060 eventType.splice(j--, 1); 3061 3062 if (handleObj.selector) { 3063 eventType.delegateCount--; 3064 } 3065 if (special.remove) { 3066 special.remove.call(elem, handleObj); 3067 } 3068 } 3069 } 3070 3071 // Remove generic event handler if we removed something and no more handlers exist 3072 // (avoids potential for endless recursion during removal of special event handlers) 3073 if (eventType.length === 0 && origCount !== eventType.length) { 3074 if (!special.teardown || special.teardown.call(elem, namespaces) === false) { 3075 jQuery.removeEvent(elem, type, elemData.handle); 3076 } 3077 3078 delete events[type]; 3079 } 3080 } 3081 3082 // Remove the expando if it's no longer used 3083 if (jQuery.isEmptyObject(events)) { 3084 handle = elemData.handle; 3085 if (handle) { 3086 handle.elem = null; 3087 } 3088 3089 // removeData also checks for emptiness and clears the expando if empty 3090 // so use it instead of delete 3091 jQuery.removeData(elem, ["events", "handle"], true); 3092 } 3093 }, 3094 3095 // Events that are safe to short-circuit if no handlers are attached. 3096 // Native DOM events should not be added, they may have inline handlers. 3097 customEvent: { 3098 "getData": true, 3099 "setData": true, 3100 "changeData": true 3101 }, 3102 3103 trigger: function (event, data, elem, onlyHandlers) { 3104 // Don't do events on text and comment nodes 3105 if (elem && (elem.nodeType === 3 || elem.nodeType === 8)) { 3106 return; 3107 } 3108 3109 // Event object or event type 3110 var type = event.type || event, 3111 namespaces = [], 3112 cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; 3113 3114 // focus/blur morphs to focusin/out; ensure we're not firing them right now 3115 if (rfocusMorph.test(type + jQuery.event.triggered)) { 3116 return; 3117 } 3118 3119 if (type.indexOf("!") >= 0) { 3120 // Exclusive events trigger only for the exact event (no namespaces) 3121 type = type.slice(0, -1); 3122 exclusive = true; 3123 } 3124 3125 if (type.indexOf(".") >= 0) { 3126 // Namespaced trigger; create a regexp to match event type in handle() 3127 namespaces = type.split("."); 3128 type = namespaces.shift(); 3129 namespaces.sort(); 3130 } 3131 3132 if ((!elem || jQuery.event.customEvent[type]) && !jQuery.event.global[type]) { 3133 // No jQuery handlers for this event type, and it can't have inline handlers 3134 return; 3135 } 3136 3137 // Caller can pass in an Event, Object, or just an event type string 3138 event = typeof event === "object" ? 3139 // jQuery.Event object 3140 event[jQuery.expando] ? event : 3141 // Object literal 3142 new jQuery.Event(type, event) : 3143 // Just the event type (string) 3144 new jQuery.Event(type); 3145 3146 event.type = type; 3147 event.isTrigger = true; 3148 event.exclusive = exclusive; 3149 event.namespace = namespaces.join("."); 3150 event.namespace_re = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; 3151 ontype = type.indexOf(":") < 0 ? "on" + type : ""; 3152 3153 // Handle a global trigger 3154 if (!elem) { 3155 3156 // TODO: Stop taunting the data cache; remove global events and always attach to document 3157 cache = jQuery.cache; 3158 for (i in cache) { 3159 if (cache[i].events && cache[i].events[type]) { 3160 jQuery.event.trigger(event, data, cache[i].handle.elem, true); 3161 } 3162 } 3163 return; 3164 } 3165 3166 // Clean up the event in case it is being reused 3167 event.result = undefined; 3168 if (!event.target) { 3169 event.target = elem; 3170 } 3171 3172 // Clone any incoming data and prepend the event, creating the handler arg list 3173 data = data != null ? jQuery.makeArray(data) : []; 3174 data.unshift(event); 3175 3176 // Allow special events to draw outside the lines 3177 special = jQuery.event.special[type] || {}; 3178 if (special.trigger && special.trigger.apply(elem, data) === false) { 3179 return; 3180 } 3181 3182 // Determine event propagation path in advance, per W3C events spec (#9951) 3183 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 3184 eventPath = [[elem, special.bindType || type]]; 3185 if (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) { 3186 3187 bubbleType = special.delegateType || type; 3188 cur = rfocusMorph.test(bubbleType + type) ? elem : elem.parentNode; 3189 old = null; 3190 for (; cur; cur = cur.parentNode) { 3191 eventPath.push([cur, bubbleType]); 3192 old = cur; 3193 } 3194 3195 // Only add window if we got to document (e.g., not plain obj or detached DOM) 3196 if (old && old === elem.ownerDocument) { 3197 eventPath.push([old.defaultView || old.parentWindow || window, bubbleType]); 3198 } 3199 } 3200 3201 // Fire handlers on the event path 3202 for (i = 0; i < eventPath.length && !event.isPropagationStopped(); i++) { 3203 3204 cur = eventPath[i][0]; 3205 event.type = eventPath[i][1]; 3206 3207 handle = (jQuery._data(cur, "events") || {})[event.type] && jQuery._data(cur, "handle"); 3208 if (handle) { 3209 handle.apply(cur, data); 3210 } 3211 // Note that this is a bare JS function and not a jQuery handler 3212 handle = ontype && cur[ontype]; 3213 if (handle && jQuery.acceptData(cur) && handle.apply(cur, data) === false) { 3214 event.preventDefault(); 3215 } 3216 } 3217 event.type = type; 3218 3219 // If nobody prevented the default action, do it now 3220 if (!onlyHandlers && !event.isDefaultPrevented()) { 3221 3222 if ((!special._default || special._default.apply(elem.ownerDocument, data) === false) && 3223 !(type === "click" && jQuery.nodeName(elem, "a")) && jQuery.acceptData(elem)) { 3224 3225 // Call a native DOM method on the target with the same name name as the event. 3226 // Can't use an .isFunction() check here because IE6/7 fails that test. 3227 // Don't do default actions on window, that's where global variables be (#6170) 3228 // IE<9 dies on focus/blur to hidden element (#1486) 3229 if (ontype && elem[type] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow(elem)) { 3230 3231 // Don't re-trigger an onFOO event when we call its FOO() method 3232 old = elem[ontype]; 3233 3234 if (old) { 3235 elem[ontype] = null; 3236 } 3237 3238 // Prevent re-triggering of the same event, since we already bubbled it above 3239 jQuery.event.triggered = type; 3240 elem[type](); 3241 jQuery.event.triggered = undefined; 3242 3243 if (old) { 3244 elem[ontype] = old; 3245 } 3246 } 3247 } 3248 } 3249 3250 return event.result; 3251 }, 3252 3253 dispatch: function (event) { 3254 3255 // Make a writable jQuery.Event from the native event object 3256 event = jQuery.event.fix(event || window.event); 3257 3258 var handlers = ((jQuery._data(this, "events") || {})[event.type] || []), 3259 delegateCount = handlers.delegateCount, 3260 args = [].slice.call(arguments, 0), 3261 run_all = !event.exclusive && !event.namespace, 3262 special = jQuery.event.special[event.type] || {}, 3263 handlerQueue = [], 3264 i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; 3265 3266 // Use the fix-ed jQuery.Event rather than the (read-only) native event 3267 args[0] = event; 3268 event.delegateTarget = this; 3269 3270 // Call the preDispatch hook for the mapped type, and let it bail if desired 3271 if (special.preDispatch && special.preDispatch.call(this, event) === false) { 3272 return; 3273 } 3274 3275 // Determine handlers that should run if there are delegated events 3276 // Avoid non-left-click bubbling in Firefox (#3861) 3277 if (delegateCount && !(event.button && event.type === "click")) { 3278 3279 // Pregenerate a single jQuery object for reuse with .is() 3280 jqcur = jQuery(this); 3281 jqcur.context = this.ownerDocument || this; 3282 3283 for (cur = event.target; cur != this; cur = cur.parentNode || this) { 3284 3285 // Don't process events on disabled elements (#6911, #8165) 3286 if (cur.disabled !== true) { 3287 selMatch = {}; 3288 matches = []; 3289 jqcur[0] = cur; 3290 for (i = 0; i < delegateCount; i++) { 3291 handleObj = handlers[i]; 3292 sel = handleObj.selector; 3293 3294 if (selMatch[sel] === undefined) { 3295 selMatch[sel] = ( 3296 handleObj.quick ? quickIs(cur, handleObj.quick) : jqcur.is(sel) 3297 ); 3298 } 3299 if (selMatch[sel]) { 3300 matches.push(handleObj); 3301 } 3302 } 3303 if (matches.length) { 3304 handlerQueue.push({elem: cur, matches: matches}); 3305 } 3306 } 3307 } 3308 } 3309 3310 // Add the remaining (directly-bound) handlers 3311 if (handlers.length > delegateCount) { 3312 handlerQueue.push({elem: this, matches: handlers.slice(delegateCount)}); 3313 } 3314 3315 // Run delegates first; they may want to stop propagation beneath us 3316 for (i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++) { 3317 matched = handlerQueue[i]; 3318 event.currentTarget = matched.elem; 3319 3320 for (j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++) { 3321 handleObj = matched.matches[j]; 3322 3323 // Triggered event must either 1) be non-exclusive and have no namespace, or 3324 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). 3325 if (run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test(handleObj.namespace)) { 3326 3327 event.data = handleObj.data; 3328 event.handleObj = handleObj; 3329 3330 ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler) 3331 .apply(matched.elem, args); 3332 3333 if (ret !== undefined) { 3334 event.result = ret; 3335 if (ret === false) { 3336 event.preventDefault(); 3337 event.stopPropagation(); 3338 } 3339 } 3340 } 3341 } 3342 } 3343 3344 // Call the postDispatch hook for the mapped type 3345 if (special.postDispatch) { 3346 special.postDispatch.call(this, event); 3347 } 3348 3349 return event.result; 3350 }, 3351 3352 // Includes some event props shared by KeyEvent and MouseEvent 3353 // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** 3354 props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), 3355 3356 fixHooks: {}, 3357 3358 keyHooks: { 3359 props: "char charCode key keyCode".split(" "), 3360 filter: function (event, original) { 3361 3362 // Add which for key events 3363 if (event.which == null) { 3364 event.which = original.charCode != null ? original.charCode : original.keyCode; 3365 } 3366 3367 return event; 3368 } 3369 }, 3370 3371 mouseHooks: { 3372 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), 3373 filter: function (event, original) { 3374 var eventDoc, doc, body, 3375 button = original.button, 3376 fromElement = original.fromElement; 3377 3378 // Calculate pageX/Y if missing and clientX/Y available 3379 if (event.pageX == null && original.clientX != null) { 3380 eventDoc = event.target.ownerDocument || document; 3381 doc = eventDoc.documentElement; 3382 body = eventDoc.body; 3383 3384 event.pageX = original.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); 3385 event.pageY = original.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); 3386 } 3387 3388 // Add relatedTarget, if necessary 3389 if (!event.relatedTarget && fromElement) { 3390 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; 3391 } 3392 3393 // Add which for click: 1 === left; 2 === middle; 3 === right 3394 // Note: button is not normalized, so don't use it 3395 if (!event.which && button !== undefined) { 3396 event.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0))); 3397 } 3398 3399 return event; 3400 } 3401 }, 3402 3403 fix: function (event) { 3404 if (event[jQuery.expando]) { 3405 return event; 3406 } 3407 3408 // Create a writable copy of the event object and normalize some properties 3409 var i, prop, 3410 originalEvent = event, 3411 fixHook = jQuery.event.fixHooks[event.type] || {}, 3412 copy = fixHook.props ? this.props.concat(fixHook.props) : this.props; 3413 3414 event = jQuery.Event(originalEvent); 3415 3416 for (i = copy.length; i;) { 3417 prop = copy[--i]; 3418 event[prop] = originalEvent[prop]; 3419 } 3420 3421 // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) 3422 if (!event.target) { 3423 event.target = originalEvent.srcElement || document; 3424 } 3425 3426 // Target should not be a text node (#504, Safari) 3427 if (event.target.nodeType === 3) { 3428 event.target = event.target.parentNode; 3429 } 3430 3431 // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) 3432 if (event.metaKey === undefined) { 3433 event.metaKey = event.ctrlKey; 3434 } 3435 3436 return fixHook.filter ? fixHook.filter(event, originalEvent) : event; 3437 }, 3438 3439 special: { 3440 ready: { 3441 // Make sure the ready event is setup 3442 setup: jQuery.bindReady 3443 }, 3444 3445 load: { 3446 // Prevent triggered image.load events from bubbling to window.load 3447 noBubble: true 3448 }, 3449 3450 focus: { 3451 delegateType: "focusin" 3452 }, 3453 blur: { 3454 delegateType: "focusout" 3455 }, 3456 3457 beforeunload: { 3458 setup: function (data, namespaces, eventHandle) { 3459 // We only want to do this special case on windows 3460 if (jQuery.isWindow(this)) { 3461 this.onbeforeunload = eventHandle; 3462 } 3463 }, 3464 3465 teardown: function (namespaces, eventHandle) { 3466 if (this.onbeforeunload === eventHandle) { 3467 this.onbeforeunload = null; 3468 } 3469 } 3470 } 3471 }, 3472 3473 simulate: function (type, elem, event, bubble) { 3474 // Piggyback on a donor event to simulate a different one. 3475 // Fake originalEvent to avoid donor's stopPropagation, but if the 3476 // simulated event prevents default then we do the same on the donor. 3477 var e = jQuery.extend( 3478 new jQuery.Event(), 3479 event, 3480 { 3481 type: type, 3482 isSimulated: true, 3483 originalEvent: {} 3484 } 3485 ); 3486 if (bubble) { 3487 jQuery.event.trigger(e, null, elem); 3488 } else { 3489 jQuery.event.dispatch.call(elem, e); 3490 } 3491 if (e.isDefaultPrevented()) { 3492 event.preventDefault(); 3493 } 3494 } 3495 }; 3496 3497// Some plugins are using, but it's undocumented/deprecated and will be removed. 3498// The 1.7 special event interface should provide all the hooks needed now. 3499 jQuery.event.handle = jQuery.event.dispatch; 3500 3501 jQuery.removeEvent = document.removeEventListener ? 3502 function (elem, type, handle) { 3503 if (elem.removeEventListener) { 3504 elem.removeEventListener(type, handle, false); 3505 } 3506 } : 3507 function (elem, type, handle) { 3508 if (elem.detachEvent) { 3509 elem.detachEvent("on" + type, handle); 3510 } 3511 }; 3512 3513 jQuery.Event = function (src, props) { 3514 // Allow instantiation without the 'new' keyword 3515 if (!(this instanceof jQuery.Event)) { 3516 return new jQuery.Event(src, props); 3517 } 3518 3519 // Event object 3520 if (src && src.type) { 3521 this.originalEvent = src; 3522 this.type = src.type; 3523 3524 // Events bubbling up the document may have been marked as prevented 3525 // by a handler lower down the tree; reflect the correct value. 3526 this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || 3527 src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse; 3528 3529 // Event type 3530 } else { 3531 this.type = src; 3532 } 3533 3534 // Put explicitly provided properties onto the event object 3535 if (props) { 3536 jQuery.extend(this, props); 3537 } 3538 3539 // Create a timestamp if incoming event doesn't have one 3540 this.timeStamp = src && src.timeStamp || jQuery.now(); 3541 3542 // Mark it as fixed 3543 this[jQuery.expando] = true; 3544 }; 3545 3546 function returnFalse() { 3547 return false; 3548 } 3549 3550 function returnTrue() { 3551 return true; 3552 } 3553 3554// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 3555// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 3556 jQuery.Event.prototype = { 3557 preventDefault: function () { 3558 this.isDefaultPrevented = returnTrue; 3559 3560 var e = this.originalEvent; 3561 if (!e) { 3562 return; 3563 } 3564 3565 // if preventDefault exists run it on the original event 3566 if (e.preventDefault) { 3567 e.preventDefault(); 3568 3569 // otherwise set the returnValue property of the original event to false (IE) 3570 } else { 3571 e.returnValue = false; 3572 } 3573 }, 3574 stopPropagation: function () { 3575 this.isPropagationStopped = returnTrue; 3576 3577 var e = this.originalEvent; 3578 if (!e) { 3579 return; 3580 } 3581 // if stopPropagation exists run it on the original event 3582 if (e.stopPropagation) { 3583 e.stopPropagation(); 3584 } 3585 // otherwise set the cancelBubble property of the original event to true (IE) 3586 e.cancelBubble = true; 3587 }, 3588 stopImmediatePropagation: function () { 3589 this.isImmediatePropagationStopped = returnTrue; 3590 this.stopPropagation(); 3591 }, 3592 isDefaultPrevented: returnFalse, 3593 isPropagationStopped: returnFalse, 3594 isImmediatePropagationStopped: returnFalse 3595 }; 3596 3597// Create mouseenter/leave events using mouseover/out and event-time checks 3598 jQuery.each({ 3599 mouseenter: "mouseover", 3600 mouseleave: "mouseout" 3601 }, function (orig, fix) { 3602 jQuery.event.special[orig] = { 3603 delegateType: fix, 3604 bindType: fix, 3605 3606 handle: function (event) { 3607 var target = this, 3608 related = event.relatedTarget, 3609 handleObj = event.handleObj, 3610 selector = handleObj.selector, 3611 ret; 3612 3613 // For mousenter/leave call the handler if related is outside the target. 3614 // NB: No relatedTarget if the mouse left/entered the browser window 3615 if (!related || (related !== target && !jQuery.contains(target, related))) { 3616 event.type = handleObj.origType; 3617 ret = handleObj.handler.apply(this, arguments); 3618 event.type = fix; 3619 } 3620 return ret; 3621 } 3622 }; 3623 }); 3624 3625// IE submit delegation 3626 if (!jQuery.support.submitBubbles) { 3627 3628 jQuery.event.special.submit = { 3629 setup: function () { 3630 // Only need this for delegated form submit events 3631 if (jQuery.nodeName(this, "form")) { 3632 return false; 3633 } 3634 3635 // Lazy-add a submit handler when a descendant form may potentially be submitted 3636 jQuery.event.add(this, "click._submit keypress._submit", function (e) { 3637 // Node name check avoids a VML-related crash in IE (#9807) 3638 var elem = e.target, 3639 form = jQuery.nodeName(elem, "input") || jQuery.nodeName(elem, "button") ? elem.form : undefined; 3640 if (form && !form._submit_attached) { 3641 jQuery.event.add(form, "submit._submit", function (event) { 3642 event._submit_bubble = true; 3643 }); 3644 form._submit_attached = true; 3645 } 3646 }); 3647 // return undefined since we don't need an event listener 3648 }, 3649 3650 postDispatch: function (event) { 3651 // If form was submitted by the user, bubble the event up the tree 3652 if (event._submit_bubble) { 3653 delete event._submit_bubble; 3654 if (this.parentNode && !event.isTrigger) { 3655 jQuery.event.simulate("submit", this.parentNode, event, true); 3656 } 3657 } 3658 }, 3659 3660 teardown: function () { 3661 // Only need this for delegated form submit events 3662 if (jQuery.nodeName(this, "form")) { 3663 return false; 3664 } 3665 3666 // Remove delegated handlers; cleanData eventually reaps submit handlers attached above 3667 jQuery.event.remove(this, "._submit"); 3668 } 3669 }; 3670 } 3671 3672// IE change delegation and checkbox/radio fix 3673 if (!jQuery.support.changeBubbles) { 3674 3675 jQuery.event.special.change = { 3676 3677 setup: function () { 3678 3679 if (rformElems.test(this.nodeName)) { 3680 // IE doesn't fire change on a check/radio until blur; trigger it on click 3681 // after a propertychange. Eat the blur-change in special.change.handle. 3682 // This still fires onchange a second time for check/radio after blur. 3683 if (this.type === "checkbox" || this.type === "radio") { 3684 jQuery.event.add(this, "propertychange._change", function (event) { 3685 if (event.originalEvent.propertyName === "checked") { 3686 this._just_changed = true; 3687 } 3688 }); 3689 jQuery.event.add(this, "click._change", function (event) { 3690 if (this._just_changed && !event.isTrigger) { 3691 this._just_changed = false; 3692 jQuery.event.simulate("change", this, event, true); 3693 } 3694 }); 3695 } 3696 return false; 3697 } 3698 // Delegated event; lazy-add a change handler on descendant inputs 3699 jQuery.event.add(this, "beforeactivate._change", function (e) { 3700 var elem = e.target; 3701 3702 if (rformElems.test(elem.nodeName) && !elem._change_attached) { 3703 jQuery.event.add(elem, "change._change", function (event) { 3704 if (this.parentNode && !event.isSimulated && !event.isTrigger) { 3705 jQuery.event.simulate("change", this.parentNode, event, true); 3706 } 3707 }); 3708 elem._change_attached = true; 3709 } 3710 }); 3711 }, 3712 3713 handle: function (event) { 3714 var elem = event.target; 3715 3716 // Swallow native change events from checkbox/radio, we already triggered them above 3717 if (this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox")) { 3718 return event.handleObj.handler.apply(this, arguments); 3719 } 3720 }, 3721 3722 teardown: function () { 3723 jQuery.event.remove(this, "._change"); 3724 3725 return rformElems.test(this.nodeName); 3726 } 3727 }; 3728 } 3729 3730// Create "bubbling" focus and blur events 3731 if (!jQuery.support.focusinBubbles) { 3732 jQuery.each({focus: "focusin", blur: "focusout"}, function (orig, fix) { 3733 3734 // Attach a single capturing handler while someone wants focusin/focusout 3735 var attaches = 0, 3736 handler = function (event) { 3737 jQuery.event.simulate(fix, event.target, jQuery.event.fix(event), true); 3738 }; 3739 3740 jQuery.event.special[fix] = { 3741 setup: function () { 3742 if (attaches++ === 0) { 3743 document.addEventListener(orig, handler, true); 3744 } 3745 }, 3746 teardown: function () { 3747 if (--attaches === 0) { 3748 document.removeEventListener(orig, handler, true); 3749 } 3750 } 3751 }; 3752 }); 3753 } 3754 3755 jQuery.fn.extend({ 3756 3757 on: function (types, selector, data, fn, /*INTERNAL*/ one) { 3758 var origFn, type; 3759 3760 // Types can be a map of types/handlers 3761 if (typeof types === "object") { 3762 // ( types-Object, selector, data ) 3763 if (typeof selector !== "string") { // && selector != null 3764 // ( types-Object, data ) 3765 data = data || selector; 3766 selector = undefined; 3767 } 3768 for (type in types) { 3769 this.on(type, selector, data, types[type], one); 3770 } 3771 return this; 3772 } 3773 3774 if (data == null && fn == null) { 3775 // ( types, fn ) 3776 fn = selector; 3777 data = selector = undefined; 3778 } else if (fn == null) { 3779 if (typeof selector === "string") { 3780 // ( types, selector, fn ) 3781 fn = data; 3782 data = undefined; 3783 } else { 3784 // ( types, data, fn ) 3785 fn = data; 3786 data = selector; 3787 selector = undefined; 3788 } 3789 } 3790 if (fn === false) { 3791 fn = returnFalse; 3792 } else if (!fn) { 3793 return this; 3794 } 3795 3796 if (one === 1) { 3797 origFn = fn; 3798 fn = function (event) { 3799 // Can use an empty set, since event contains the info 3800 jQuery().off(event); 3801 return origFn.apply(this, arguments); 3802 }; 3803 // Use same guid so caller can remove using origFn 3804 fn.guid = origFn.guid || (origFn.guid = jQuery.guid++); 3805 } 3806 return this.each(function () { 3807 jQuery.event.add(this, types, fn, data, selector); 3808 }); 3809 }, 3810 one: function (types, selector, data, fn) { 3811 return this.on(types, selector, data, fn, 1); 3812 }, 3813 off: function (types, selector, fn) { 3814 if (types && types.preventDefault && types.handleObj) { 3815 // ( event ) dispatched jQuery.Event 3816 var handleObj = types.handleObj; 3817 jQuery(types.delegateTarget).off( 3818 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, 3819 handleObj.selector, 3820 handleObj.handler 3821 ); 3822 return this; 3823 } 3824 if (typeof types === "object") { 3825 // ( types-object [, selector] ) 3826 for (var type in types) { 3827 this.off(type, selector, types[type]); 3828 } 3829 return this; 3830 } 3831 if (selector === false || typeof selector === "function") { 3832 // ( types [, fn] ) 3833 fn = selector; 3834 selector = undefined; 3835 } 3836 if (fn === false) { 3837 fn = returnFalse; 3838 } 3839 return this.each(function () { 3840 jQuery.event.remove(this, types, fn, selector); 3841 }); 3842 }, 3843 3844 bind: function (types, data, fn) { 3845 return this.on(types, null, data, fn); 3846 }, 3847 unbind: function (types, fn) { 3848 return this.off(types, null, fn); 3849 }, 3850 3851 live: function (types, data, fn) { 3852 jQuery(this.context).on(types, this.selector, data, fn); 3853 return this; 3854 }, 3855 die: function (types, fn) { 3856 jQuery(this.context).off(types, this.selector || "**", fn); 3857 return this; 3858 }, 3859 3860 delegate: function (selector, types, data, fn) { 3861 return this.on(types, selector, data, fn); 3862 }, 3863 undelegate: function (selector, types, fn) { 3864 // ( namespace ) or ( selector, types [, fn] ) 3865 return arguments.length == 1 ? this.off(selector, "**") : this.off(types, selector, fn); 3866 }, 3867 3868 trigger: function (type, data) { 3869 return this.each(function () { 3870 jQuery.event.trigger(type, data, this); 3871 }); 3872 }, 3873 triggerHandler: function (type, data) { 3874 if (this[0]) { 3875 return jQuery.event.trigger(type, data, this[0], true); 3876 } 3877 }, 3878 3879 toggle: function (fn) { 3880 // Save reference to arguments for access in closure 3881 var args = arguments, 3882 guid = fn.guid || jQuery.guid++, 3883 i = 0, 3884 toggler = function (event) { 3885 // Figure out which function to execute 3886 var lastToggle = (jQuery._data(this, "lastToggle" + fn.guid) || 0) % i; 3887 jQuery._data(this, "lastToggle" + fn.guid, lastToggle + 1); 3888 3889 // Make sure that clicks stop 3890 event.preventDefault(); 3891 3892 // and execute the function 3893 return args[lastToggle].apply(this, arguments) || false; 3894 }; 3895 3896 // link all the functions, so any of them can unbind this click handler 3897 toggler.guid = guid; 3898 while (i < args.length) { 3899 args[i++].guid = guid; 3900 } 3901 3902 return this.click(toggler); 3903 }, 3904 3905 hover: function (fnOver, fnOut) { 3906 return this.mouseenter(fnOver).mouseleave(fnOut || fnOver); 3907 } 3908 }); 3909 3910 jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick " + 3911 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 3912 "change select submit keydown keypress keyup error contextmenu").split(" "), function (i, name) { 3913 3914 // Handle event binding 3915 jQuery.fn[name] = function (data, fn) { 3916 if (fn == null) { 3917 fn = data; 3918 data = null; 3919 } 3920 3921 return arguments.length > 0 ? 3922 this.on(name, null, data, fn) : 3923 this.trigger(name); 3924 }; 3925 3926 if (jQuery.attrFn) { 3927 jQuery.attrFn[name] = true; 3928 } 3929 3930 if (rkeyEvent.test(name)) { 3931 jQuery.event.fixHooks[name] = jQuery.event.keyHooks; 3932 } 3933 3934 if (rmouseEvent.test(name)) { 3935 jQuery.event.fixHooks[name] = jQuery.event.mouseHooks; 3936 } 3937 }); 3938 3939 3940 /*! 3941 * Sizzle CSS Selector Engine 3942 * Copyright 2011, The Dojo Foundation 3943 * Released under the MIT, BSD, and GPL Licenses. 3944 * More information: http://sizzlejs.com/ 3945 */ 3946 (function () { 3947 3948 var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, 3949 expando = "sizcache" + (Math.random() + '').replace('.', ''), 3950 done = 0, 3951 toString = Object.prototype.toString, 3952 hasDuplicate = false, 3953 baseHasDuplicate = true, 3954 rBackslash = /\\/g, 3955 rReturn = /\r\n/g, 3956 rNonWord = /\W/; 3957 3958// Here we check if the JavaScript engine is using some sort of 3959// optimization where it does not always call our comparision 3960// function. If that is the case, discard the hasDuplicate value. 3961// Thus far that includes Google Chrome. 3962 [0, 0].sort(function () { 3963 baseHasDuplicate = false;
3964 return 0; 3965 }); 3966 3967 var Sizzle = function (selector, context, results, seed) { 3968 results = results || []; 3969 context = context || document; 3970 3971 var origContext = context; 3972 3973 if (context.nodeType !== 1 && context.nodeType !== 9) { 3974 return []; 3975 } 3976 3977 if (!selector || typeof selector !== "string") { 3978 return results; 3979 } 3980 3981 var m, set, checkSet, extra, ret, cur, pop, i, 3982 prune = true, 3983 contextXML = Sizzle.isXML(context), 3984 parts = [], 3985 soFar = selector; 3986 3987 // Reset the position of the chunker regexp (start from head) 3988 do { 3989 chunker.exec(""); 3990 m = chunker.exec(soFar); 3991 3992 if (m) { 3993 soFar = m[3]; 3994 3995 parts.push(m[1]); 3996 3997 if (m[2]) { 3998 extra = m[3]; 3999 break; 4000 } 4001 } 4002 } while (m); 4003 4004 if (parts.length > 1 && origPOS.exec(selector)) { 4005 4006 if (parts.length === 2 && Expr.relative[parts[0]]) { 4007 set = posProcess(parts[0] + parts[1], context, seed); 4008 4009 } else { 4010 set = Expr.relative[parts[0]] ? 4011 [context] : 4012 Sizzle(parts.shift(), context); 4013 4014 while (parts.length) { 4015 selector = parts.shift(); 4016 4017 if (Expr.relative[selector]) { 4018 selector += parts.shift(); 4019 } 4020 4021 set = posProcess(selector, set, seed); 4022 } 4023 } 4024 4025 } else { 4026 // Take a shortcut and set the context if the root selector is an ID 4027 // (but not if it'll be faster if the inner selector is an ID) 4028 if (!seed && parts.length > 1 && context.nodeType === 9 && !contextXML && 4029 Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1])) { 4030 4031 ret = Sizzle.find(parts.shift(), context, contextXML); 4032 context = ret.expr ? 4033 Sizzle.filter(ret.expr, ret.set)[0] : 4034 ret.set[0]; 4035 } 4036 4037 if (context) { 4038 ret = seed ? 4039 {expr: parts.pop(), set: makeArray(seed)} : 4040 Sizzle.find(parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML); 4041 4042 set = ret.expr ? 4043 Sizzle.filter(ret.expr, ret.set) : 4044 ret.set; 4045 4046 if (parts.length > 0) { 4047 checkSet = makeArray(set); 4048 4049 } else { 4050 prune = false;
4051 } 4052 4053 while (parts.length) { 4054 cur = parts.pop(); 4055 pop = cur; 4056 4057 if (!Expr.relative[cur]) { 4058 cur = ""; 4059 } else { 4060 pop = parts.pop(); 4061 } 4062 4063 if (pop == null) { 4064 pop = context; 4065 } 4066 4067 Expr.relative[cur](checkSet, pop, contextXML); 4068 } 4069 4070 } else { 4071 checkSet = parts = []; 4072 } 4073 } 4074 4075 if (!checkSet) { 4076 checkSet = set; 4077 } 4078 4079 if (!checkSet) { 4080 Sizzle.error(cur || selector); 4081 } 4082 4083 if (toString.call(checkSet) === "[object Array]") { 4084 if (!prune) { 4085 results.push.apply(results, checkSet); 4086 4087 } else if (context && context.nodeType === 1) { 4088 for (i = 0; checkSet[i] != null; i++) { 4089 if (checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i]))) { 4090 results.push(set[i]); 4091 } 4092 } 4093 4094 } else { 4095 for (i = 0; checkSet[i] != null; i++) { 4096 if (checkSet[i] && checkSet[i].nodeType === 1) { 4097 results.push(set[i]); 4098 } 4099 } 4100 } 4101 4102 } else { 4103 makeArray(checkSet, results); 4104 } 4105 4106 if (extra) { 4107 Sizzle(extra, origContext, results, seed); 4108 Sizzle.uniqueSort(results); 4109 } 4110 4111 return results; 4112 }; 4113 4114 Sizzle.uniqueSort = function (results) { 4115 if (sortOrder) { 4116 hasDuplicate = baseHasDuplicate; 4117 results.sort(sortOrder); 4118 4119 if (hasDuplicate) { 4120 for (var i = 1; i < results.length; i++) { 4121 if (results[i] === results[i - 1]) { 4122 results.splice(i--, 1); 4123 } 4124 } 4125 } 4126 } 4127 4128 return results; 4129 }; 4130 4131 Sizzle.matches = function (expr, set) { 4132 return Sizzle(expr, null, null, set); 4133 }; 4134 4135 Sizzle.matchesSelector = function (node, expr) { 4136 return Sizzle(expr, null, null, [node]).length > 0; 4137 }; 4138 4139 Sizzle.find = function (expr, context, isXML) { 4140 var set, i, len, match, type, left; 4141 4142 if (!expr) { 4143 return []; 4144 } 4145 4146 for (i = 0, len = Expr.order.length; i < len; i++) { 4147 type = Expr.order[i]; 4148 4149 if ((match = Expr.leftMatch[type].exec(expr))) { 4150 left = match[1]; 4151 match.splice(1, 1); 4152 4153 if (left.substr(left.length - 1) !== "\\") { 4154 match[1] = (match[1] || "").replace(rBackslash, ""); 4155 set = Expr.find[type](match, context, isXML); 4156 4157 if (set != null) { 4158 expr = expr.replace(Expr.match[type], ""); 4159 break; 4160 } 4161 } 4162 } 4163 } 4164 4165 if (!set) { 4166 set = typeof context.getElementsByTagName !== "undefined" ? 4167 context.getElementsByTagName("*") : 4168 []; 4169 } 4170 4171 return {set: set, expr: expr}; 4172 }; 4173 4174 Sizzle.filter = function (expr, set, inplace, not) { 4175 var match, anyFound, 4176 type, found, item, filter, left, 4177 i, pass, 4178 old = expr, 4179 result = [], 4180 curLoop = set, 4181 isXMLFilter = set && set[0] && Sizzle.isXML(set[0]); 4182 4183 while (expr && set.length) { 4184 for (type in Expr.filter) { 4185 if ((match = Expr.leftMatch[type].exec(expr)) != null && match[2]) { 4186 filter = Expr.filter[type]; 4187 left = match[1]; 4188 4189 anyFound = false;
4190 4191 match.splice(1, 1); 4192 4193 if (left.substr(left.length - 1) === "\\") { 4194 continue; 4195 } 4196 4197 if (curLoop === result) { 4198 result = []; 4199 } 4200 4201 if (Expr.preFilter[type]) { 4202 match = Expr.preFilter[type](match, curLoop, inplace, result, not, isXMLFilter); 4203 4204 if (!match) { 4205 anyFound = found = true; 4206 4207 } else if (match === true) { 4208 continue; 4209 } 4210 } 4211 4212 if (match) { 4213 for (i = 0; (item = curLoop[i]) != null; i++) { 4214 if (item) { 4215 found = filter(item, match, i, curLoop); 4216 pass = not ^ found; 4217 4218 if (inplace && found != null) { 4219 if (pass) { 4220 anyFound = true; 4221 4222 } else { 4223 curLoop[i] = false; 4224 } 4225 4226 } else if (pass) { 4227 result.push(item); 4228 anyFound = true; 4229 } 4230 } 4231 } 4232 } 4233 4234 if (found !== undefined) { 4235 if (!inplace) { 4236 curLoop = result; 4237 } 4238 4239 expr = expr.replace(Expr.match[type], ""); 4240 4241 if (!anyFound) { 4242 return []; 4243 } 4244 4245 break; 4246 } 4247 } 4248 } 4249 4250 // Improper expression 4251 if (expr === old) { 4252 if (anyFound == null) { 4253 Sizzle.error(expr); 4254 4255 } else { 4256 break; 4257 } 4258 } 4259 4260 old = expr; 4261 } 4262 4263 return curLoop; 4264 }; 4265 4266 Sizzle.error = function (msg) { 4267 throw new Error("Syntax error, unrecognized expression: " + msg); 4268 }; 4269 4270 /** 4271 * Utility function for retreiving the text value of an array of DOM nodes 4272 * @param {Array|Element} elem 4273 */ 4274 var getText = Sizzle.getText = function (elem) { 4275 var i, node, 4276 nodeType = elem.nodeType, 4277 ret = ""; 4278 4279 if (nodeType) { 4280 if (nodeType === 1 || nodeType === 9 || nodeType === 11) { 4281 // Use textContent || innerText for elements 4282 if (typeof elem.textContent === 'string') { 4283 return elem.textContent; 4284 } else if (typeof elem.innerText === 'string') { 4285 // Replace IE's carriage returns 4286 return elem.innerText.replace(rReturn, ''); 4287 } else { 4288 // Traverse it's children 4289 for (elem = elem.firstChild; elem; elem = elem.nextSibling) { 4290 ret += getText(elem); 4291 } 4292 } 4293 } else if (nodeType === 3 || nodeType === 4) { 4294 return elem.nodeValue; 4295 } 4296 } else { 4297 4298 // If no nodeType, this is expected to be an array 4299 for (i = 0; (node = elem[i]); i++) { 4300 // Do not traverse comment nodes 4301 if (node.nodeType !== 8) { 4302 ret += getText(node); 4303 } 4304 } 4305 } 4306 return ret; 4307 }; 4308 4309 var Expr = Sizzle.selectors = { 4310 order: ["ID", "NAME", "TAG"], 4311 4312 match: { 4313 ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, 4314 CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, 4315 NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, 4316 ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, 4317 TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, 4318 CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, 4319 POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, 4320 PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ 4321 }, 4322 4323 leftMatch: {}, 4324 4325 attrMap: { 4326 "class": "className", 4327 "for": "htmlFor" 4328 }, 4329 4330 attrHandle: { 4331 href: function (elem) { 4332 return elem.getAttribute("href"); 4333 }, 4334 type: function (elem) { 4335 return elem.getAttribute("type"); 4336 } 4337 }, 4338 4339 relative: { 4340 "+": function (checkSet, part) { 4341 var isPartStr = typeof part === "string", 4342 isTag = isPartStr && !rNonWord.test(part), 4343 isPartStrNotTag = isPartStr && !isTag; 4344 4345 if (isTag) { 4346 part = part.toLowerCase(); 4347 } 4348 4349 for (var i = 0, l = checkSet.length, elem; i < l; i++) { 4350 if ((elem = checkSet[i])) { 4351 while ((elem = elem.previousSibling) && elem.nodeType !== 1) { 4352 } 4353 4354 checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? 4355 elem || false : 4356 elem === part; 4357 } 4358 } 4359 4360 if (isPartStrNotTag) { 4361 Sizzle.filter(part, checkSet, true); 4362 } 4363 }, 4364 4365 ">": function (checkSet, part) { 4366 var elem, 4367 isPartStr = typeof part === "string", 4368 i = 0, 4369 l = checkSet.length; 4370 4371 if (isPartStr && !rNonWord.test(part)) { 4372 part = part.toLowerCase(); 4373 4374 for (; i < l; i++) { 4375 elem = checkSet[i]; 4376 4377 if (elem) { 4378 var parent = elem.parentNode; 4379 checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
vendor: 12,001 bytes, lines 4380-4704
4380 } 4381 } 4382 4383 } else { 4384 for (; i < l; i++) { 4385 elem = checkSet[i]; 4386 4387 if (elem) { 4388 checkSet[i] = isPartStr ? 4389 elem.parentNode : 4390 elem.parentNode === part; 4391 } 4392 } 4393 4394 if (isPartStr) { 4395 Sizzle.filter(part, checkSet, true); 4396 } 4397 } 4398 }, 4399 4400 "": function (checkSet, part, isXML) { 4401 var nodeCheck, 4402 doneName = done++, 4403 checkFn = dirCheck; 4404 4405 if (typeof part === "string" && !rNonWord.test(part)) { 4406 part = part.toLowerCase(); 4407 nodeCheck = part; 4408 checkFn = dirNodeCheck; 4409 } 4410 4411 checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); 4412 }, 4413 4414 "~": function (checkSet, part, isXML) { 4415 var nodeCheck, 4416 doneName = done++, 4417 checkFn = dirCheck; 4418 4419 if (typeof part === "string" && !rNonWord.test(part)) { 4420 part = part.toLowerCase(); 4421 nodeCheck = part; 4422 checkFn = dirNodeCheck; 4423 } 4424 4425 checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); 4426 } 4427 }, 4428 4429 find: { 4430 ID: function (match, context, isXML) { 4431 if (typeof context.getElementById !== "undefined" && !isXML) { 4432 var m = context.getElementById(match[1]); 4433 // Check parentNode to catch when Blackberry 4.6 returns 4434 // nodes that are no longer in the document #6963 4435 return m && m.parentNode ? [m] : []; 4436 } 4437 }, 4438 4439 NAME: function (match, context) { 4440 if (typeof context.getElementsByName !== "undefined") { 4441 var ret = [], 4442 results = context.getElementsByName(match[1]); 4443 4444 for (var i = 0, l = results.length; i < l; i++) { 4445 if (results[i].getAttribute("name") === match[1]) { 4446 ret.push(results[i]); 4447 } 4448 } 4449 4450 return ret.length === 0 ? null : ret; 4451 } 4452 }, 4453 4454 TAG: function (match, context) { 4455 if (typeof context.getElementsByTagName !== "undefined") { 4456 return context.getElementsByTagName(match[1]); 4457 } 4458 } 4459 }, 4460 preFilter: { 4461 CLASS: function (match, curLoop, inplace, result, not, isXML) { 4462 match = " " + match[1].replace(rBackslash, "") + " "; 4463 4464 if (isXML) { 4465 return match; 4466 } 4467 4468 for (var i = 0, elem; (elem = curLoop[i]) != null; i++) { 4469 if (elem) { 4470 if (not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0)) { 4471 if (!inplace) { 4472 result.push(elem); 4473 } 4474 4475 } else if (inplace) { 4476 curLoop[i] = false; 4477 } 4478 } 4479 } 4480 4481 return false; 4482 }, 4483 4484 ID: function (match) { 4485 return match[1].replace(rBackslash, ""); 4486 }, 4487 4488 TAG: function (match, curLoop) { 4489 return match[1].replace(rBackslash, "").toLowerCase(); 4490 }, 4491 4492 CHILD: function (match) { 4493 if (match[1] === "nth") { 4494 if (!match[2]) { 4495 Sizzle.error(match[0]); 4496 } 4497 4498 match[2] = match[2].replace(/^\+|\s*/g, ''); 4499 4500 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' 4501 var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( 4502 match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || 4503 !/\D/.test(match[2]) && "0n+" + match[2] || match[2]); 4504 4505 // calculate the numbers (first)n+(last) including if they are negative 4506 match[2] = (test[1] + (test[2] || 1)) - 0; 4507 match[3] = test[3] - 0; 4508 } 4509 else if (match[2]) { 4510 Sizzle.error(match[0]); 4511 } 4512 4513 // TODO: Move to normal caching system 4514 match[0] = done++; 4515 4516 return match; 4517 }, 4518 4519 ATTR: function (match, curLoop, inplace, result, not, isXML) { 4520 var name = match[1] = match[1].replace(rBackslash, ""); 4521 4522 if (!isXML && Expr.attrMap[name]) { 4523 match[1] = Expr.attrMap[name]; 4524 } 4525 4526 // Handle if an un-quoted value was used 4527 match[4] = (match[4] || match[5] || "").replace(rBackslash, ""); 4528 4529 if (match[2] === "~=") { 4530 match[4] = " " + match[4] + " "; 4531 } 4532 4533 return match; 4534 }, 4535 4536 PSEUDO: function (match, curLoop, inplace, result, not) { 4537 if (match[1] === "not") { 4538 // If we're dealing with a complex expression, or a simple one 4539 if ((chunker.exec(match[3]) || "").length > 1 || /^\w/.test(match[3])) { 4540 match[3] = Sizzle(match[3], null, null, curLoop); 4541 4542 } else { 4543 var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); 4544 4545 if (!inplace) { 4546 result.push.apply(result, ret); 4547 } 4548 4549 return false; 4550 } 4551 4552 } else if (Expr.match.POS.test(match[0]) || Expr.match.CHILD.test(match[0])) { 4553 return true; 4554 } 4555 4556 return match; 4557 }, 4558 4559 POS: function (match) { 4560 match.unshift(true); 4561 4562 return match; 4563 } 4564 }, 4565 4566 filters: { 4567 enabled: function (elem) { 4568 return elem.disabled === false && elem.type !== "hidden"; 4569 }, 4570 4571 disabled: function (elem) { 4572 return elem.disabled === true; 4573 }, 4574 4575 checked: function (elem) { 4576 return elem.checked === true; 4577 }, 4578 4579 selected: function (elem) { 4580 // Accessing this property makes selected-by-default 4581 // options in Safari work properly 4582 if (elem.parentNode) { 4583 elem.parentNode.selectedIndex; 4584 } 4585 4586 return elem.selected === true; 4587 }, 4588 4589 parent: function (elem) { 4590 return !!elem.firstChild; 4591 }, 4592 4593 empty: function (elem) { 4594 return !elem.firstChild; 4595 }, 4596 4597 has: function (elem, i, match) { 4598 return !!Sizzle(match[3], elem).length; 4599 }, 4600 4601 header: function (elem) { 4602 return (/h\d/i).test(elem.nodeName); 4603 }, 4604 4605 text: function (elem) { 4606 var attr = elem.getAttribute("type"), type = elem.type; 4607 // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) 4608 // use getAttribute instead to test this case 4609 return elem.nodeName.toLowerCase() === "input" && "text" === type && (attr === type || attr === null); 4610 }, 4611 4612 radio: function (elem) { 4613 return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; 4614 }, 4615 4616 checkbox: function (elem) { 4617 return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; 4618 }, 4619 4620 file: function (elem) { 4621 return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; 4622 }, 4623 4624 password: function (elem) { 4625 return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; 4626 }, 4627 4628 submit: function (elem) { 4629 var name = elem.nodeName.toLowerCase(); 4630 return (name === "input" || name === "button") && "submit" === elem.type; 4631 }, 4632 4633 image: function (elem) { 4634 return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; 4635 }, 4636 4637 reset: function (elem) { 4638 var name = elem.nodeName.toLowerCase(); 4639 return (name === "input" || name === "button") && "reset" === elem.type; 4640 }, 4641 4642 button: function (elem) { 4643 var name = elem.nodeName.toLowerCase(); 4644 return name === "input" && "button" === elem.type || name === "button"; 4645 }, 4646 4647 input: function (elem) { 4648 return (/input|select|textarea|button/i).test(elem.nodeName); 4649 }, 4650 4651 focus: function (elem) { 4652 return elem === elem.ownerDocument.activeElement; 4653 } 4654 }, 4655 setFilters: { 4656 first: function (elem, i) { 4657 return i === 0; 4658 }, 4659 4660 last: function (elem, i, match, array) { 4661 return i === array.length - 1; 4662 }, 4663 4664 even: function (elem, i) { 4665 return i % 2 === 0; 4666 }, 4667 4668 odd: function (elem, i) { 4669 return i % 2 === 1; 4670 }, 4671 4672 lt: function (elem, i, match) { 4673 return i < match[3] - 0; 4674 }, 4675 4676 gt: function (elem, i, match) { 4677 return i > match[3] - 0; 4678 }, 4679 4680 nth: function (elem, i, match) { 4681 return match[3] - 0 === i; 4682 }, 4683 4684 eq: function (elem, i, match) { 4685 return match[3] - 0 === i; 4686 } 4687 }, 4688 filter: { 4689 PSEUDO: function (elem, match, i, array) { 4690 var name = match[1], 4691 filter = Expr.filters[name]; 4692 4693 if (filter) { 4694 return filter(elem, i, match, array); 4695 4696 } else if (name === "contains") { 4697 return (elem.textContent || elem.innerText || getText([elem]) || "").indexOf(match[3]) >= 0; 4698 4699 } else if (name === "not") { 4700 var not = match[3]; 4701 4702 for (var j = 0, l = not.length; j < l; j++) { 4703 if (not[j] === elem) { 4704 return false;
4705 } 4706 } 4707 4708 return true; 4709 4710 } else { 4711 Sizzle.error(name); 4712 } 4713 }, 4714 4715 CHILD: function (elem, match) { 4716 var first, last, 4717 doneName, parent, cache, 4718 count, diff, 4719 type = match[1], 4720 node = elem; 4721 4722 switch (type) { 4723 case "only": 4724 case "first": 4725 while ((node = node.previousSibling)) { 4726 if (node.nodeType === 1) { 4727 return false; 4728 } 4729 } 4730 4731 if (type === "first") { 4732 return true; 4733 } 4734 4735 node = elem; 4736 4737 /* falls through */ 4738 case "last": 4739 while ((node = node.nextSibling)) { 4740 if (node.nodeType === 1) { 4741 return false; 4742 } 4743 } 4744 4745 return true; 4746 4747 case "nth": 4748 first = match[2]; 4749 last = match[3]; 4750 4751 if (first === 1 && last === 0) { 4752 return true; 4753 } 4754 4755 doneName = match[0]; 4756 parent = elem.parentNode; 4757 4758 if (parent && (parent[expando] !== doneName || !elem.nodeIndex)) { 4759 count = 0; 4760 4761 for (node = parent.firstChild; node; node = node.nextSibling) { 4762 if (node.nodeType === 1) { 4763 node.nodeIndex = ++count; 4764 } 4765 } 4766 4767 parent[expando] = doneName; 4768 } 4769 4770 diff = elem.nodeIndex - last; 4771 4772 if (first === 0) { 4773 return diff === 0; 4774 4775 } else { 4776 return (diff % first === 0 && diff / first >= 0); 4777 } 4778 } 4779 }, 4780 4781 ID: function (elem, match) { 4782 return elem.nodeType === 1 && elem.getAttribute("id") === match; 4783 }, 4784 4785 TAG: function (elem, match) { 4786 return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; 4787 }, 4788 4789 CLASS: function (elem, match) { 4790 return (" " + (elem.className || elem.getAttribute("class")) + " ") 4791 .indexOf(match) > -1; 4792 }, 4793 4794 ATTR: function (elem, match) { 4795 var name = match[1], 4796 result = Sizzle.attr ? 4797 Sizzle.attr(elem, name) : 4798 Expr.attrHandle[name] ? 4799 Expr.attrHandle[name](elem) : 4800 elem[name] != null ? 4801 elem[name] : 4802 elem.getAttribute(name), 4803 value = result + "", 4804 type = match[2], 4805 check = match[4]; 4806 4807 return result == null ? 4808 type === "!=" : 4809 !type && Sizzle.attr ? 4810 result != null : 4811 type === "=" ? 4812 value === check : 4813 type === "*=" ? 4814 value.indexOf(check) >= 0 : 4815 type === "~=" ? 4816 (" " + value + " ").indexOf(check) >= 0 : 4817 !check ? 4818 value && result !== false : 4819 type === "!=" ? 4820 value !== check : 4821 type === "^=" ? 4822 value.indexOf(check) === 0 : 4823 type === "$=" ? 4824 value.substr(value.length - check.length) === check : 4825 type === "|=" ? 4826 value === check || value.substr(0, check.length + 1) === check + "-" : 4827 false; 4828 }, 4829 4830 POS: function (elem, match, i, array) { 4831 var name = match[2], 4832 filter = Expr.setFilters[name]; 4833 4834 if (filter) { 4835 return filter(elem, i, match, array); 4836 } 4837 } 4838 } 4839 }; 4840 4841 var origPOS = Expr.match.POS, 4842 fescape = function (all, num) { 4843 return "\\" + (num - 0 + 1); 4844 }; 4845 4846 for (var type in Expr.match) { 4847 Expr.match[type] = new RegExp(Expr.match[type].source + (/(?![^\[]*\])(?![^\(]*\))/.source)); 4848 Expr.leftMatch[type] = new RegExp(/(^(?:.|\r|\n)*?)/.source + Expr.match[type].source.replace(/\\(\d+)/g, fescape)); 4849 } 4850// Expose origPOS 4851// "global" as in regardless of relation to brackets/parens 4852 Expr.match.globalPOS = origPOS; 4853 4854 var makeArray = function (array, results) { 4855 array = Array.prototype.slice.call(array, 0); 4856 4857 if (results) { 4858 results.push.apply(results, array); 4859 return results; 4860 } 4861 4862 return array; 4863 }; 4864 4865// Perform a simple check to determine if the browser is capable of
4866// converting a NodeList to an array using builtin methods. 4867// Also verifies that the returned array holds DOM nodes 4868// (which is not the case in the Blackberry browser) 4869 try { 4870 Array.prototype.slice.call(document.documentElement.childNodes, 0)[0].nodeType; 4871 4872// Provide a fallback method if it does not work 4873 } catch (e) { 4874 makeArray = function (array, results) { 4875 var i = 0, 4876 ret = results || []; 4877 4878 if (toString.call(array) === "[object Array]") { 4879 Array.prototype.push.apply(ret, array); 4880 4881 } else { 4882 if (typeof array.length === "number") { 4883 for (var l = array.length; i < l; i++) { 4884 ret.push(array[i]); 4885 } 4886 4887 } else { 4888 for (; array[i]; i++) { 4889 ret.push(array[i]); 4890 } 4891 } 4892 } 4893 4894 return ret; 4895 }; 4896 } 4897 4898 var sortOrder, siblingCheck; 4899 4900 if (document.documentElement.compareDocumentPosition) { 4901 sortOrder = function (a, b) { 4902 if (a === b) { 4903 hasDuplicate = true; 4904 return 0; 4905 } 4906 4907 if (!a.compareDocumentPosition || !b.compareDocumentPosition) { 4908 return a.compareDocumentPosition ? -1 : 1; 4909 } 4910 4911 return a.compareDocumentPosition(b) & 4 ? -1 : 1; 4912 }; 4913 4914 } else { 4915 sortOrder = function (a, b) { 4916 // The nodes are identical, we can exit early 4917 if (a === b) { 4918 hasDuplicate = true; 4919 return 0; 4920 4921 // Fallback to using sourceIndex (in IE) if it's available on both nodes 4922 } else if (a.sourceIndex && b.sourceIndex) { 4923 return a.sourceIndex - b.sourceIndex; 4924 } 4925 4926 var al, bl, 4927 ap = [], 4928 bp = [], 4929 aup = a.parentNode, 4930 bup = b.parentNode, 4931 cur = aup; 4932 4933 // If the nodes are siblings (or identical) we can do a quick check 4934 if (aup === bup) { 4935 return siblingCheck(a, b); 4936 4937 // If no parents were found then the nodes are disconnected 4938 } else if (!aup) { 4939 return -1; 4940 4941 } else if (!bup) { 4942 return 1; 4943 } 4944 4945 // Otherwise they're somewhere else in the tree so we need 4946 // to build up a full list of the parentNodes for comparison 4947 while (cur) { 4948 ap.unshift(cur); 4949 cur = cur.parentNode; 4950 } 4951 4952 cur = bup; 4953 4954 while (cur) { 4955 bp.unshift(cur); 4956 cur = cur.parentNode; 4957 } 4958 4959 al = ap.length; 4960 bl = bp.length; 4961 4962 // Start walking down the tree looking for a discrepancy 4963 for (var i = 0; i < al && i < bl; i++) { 4964 if (ap[i] !== bp[i]) { 4965 return siblingCheck(ap[i], bp[i]); 4966 } 4967 } 4968 4969 // We ended someplace up the tree so do a sibling check 4970 return i === al ? 4971 siblingCheck(a, bp[i], -1) : 4972 siblingCheck(ap[i], b, 1); 4973 }; 4974 4975 siblingCheck = function (a, b, ret) { 4976 if (a === b) { 4977 return ret; 4978 } 4979 4980 var cur = a.nextSibling; 4981 4982 while (cur) { 4983 if (cur === b) { 4984 return -1; 4985 } 4986 4987 cur = cur.nextSibling; 4988 } 4989 4990 return 1; 4991 }; 4992 } 4993 4994// Check to see if the browser returns elements by name when 4995// querying by getElementById (and provide a workaround) 4996 (function () { 4997 // We're going to inject a fake input element with a specified name 4998 var form = document.createElement("div"), 4999 id = "script" + (new Date()).getTime(), 5000 root = document.documentElement; 5001
5002 form.innerHTML = "<a name='" + id + "'/>"; 5003 5004 // Inject it into the root element, check its status, and remove it quickly 5005 root.insertBefore(form, root.firstChild); 5006 5007 // The workaround has to do additional checks after a getElementById 5008 // Which slows things down for other browsers (hence the branching) 5009 if (document.getElementById(id)) { 5010 Expr.find.ID = function (match, context, isXML) { 5011 if (typeof context.getElementById !== "undefined" && !isXML) { 5012 var m = context.getElementById(match[1]); 5013 5014 return m ? 5015 m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? 5016 [m] : 5017 undefined : 5018 []; 5019 } 5020 }; 5021 5022 Expr.filter.ID = function (elem, match) { 5023 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); 5024 5025 return elem.nodeType === 1 && node && node.nodeValue === match; 5026 }; 5027 } 5028 5029 root.removeChild(form); 5030 5031 // release memory in IE 5032 root = form = null; 5033 })(); 5034 5035 (function () { 5036 // Check to see if the browser returns only elements 5037 // when doing getElementsByTagName("*") 5038 5039 // Create a fake element 5040 var div = document.createElement("div"); 5041 div.appendChild(document.createComment("")); 5042 5043 // Make sure no comments are found 5044 if (div.getElementsByTagName("*").length > 0) { 5045 Expr.find.TAG = function (match, context) { 5046 var results = context.getElementsByTagName(match[1]); 5047 5048 // Filter out possible comments 5049 if (match[1] === "*") { 5050 var tmp = []; 5051 5052 for (var i = 0; results[i]; i++) { 5053 if (results[i].nodeType === 1) { 5054 tmp.push(results[i]); 5055 } 5056 } 5057 5058 results = tmp; 5059 } 5060 5061 return results; 5062 }; 5063 } 5064 5065 // Check to see if an attribute returns normalized href attributes 5066 div.innerHTML = "<a href='#'></a>"; 5067 5068 if (div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && 5069 div.firstChild.getAttribute("href") !== "#") { 5070 5071 Expr.attrHandle.href = function (elem) { 5072 return elem.getAttribute("href", 2); 5073 }; 5074 } 5075 5076 // release memory in IE 5077 div = null; 5078 })(); 5079 5080 if (document.querySelectorAll) { 5081 (function () { 5082 var oldSizzle = Sizzle, 5083 div = document.createElement("div"), 5084 id = "__sizzle__"; 5085 5086 div.innerHTML = "<p class='TEST'></p>"; 5087 5088 // Safari can't handle uppercase or unicode characters when 5089 // in quirks mode. 5090 if (div.querySelectorAll && div.querySelectorAll(".TEST").length === 0) { 5091 return; 5092 } 5093 5094 Sizzle = function (query, context, extra, seed) { 5095 context = context || document; 5096 5097 // Only use querySelectorAll on non-XML documents 5098 // (ID selectors don't work in non-HTML documents) 5099 if (!seed && !Sizzle.isXML(context)) { 5100 // See if we find a selector to speed up 5101 var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(query); 5102 5103 if (match && (context.nodeType === 1 || context.nodeType === 9)) { 5104 // Speed-up: Sizzle("TAG") 5105 if (match[1]) { 5106 return makeArray(context.getElementsByTagName(query), extra); 5107 5108 // Speed-up: Sizzle(".CLASS") 5109 } else if (match[2] && Expr.find.CLASS && context.getElementsByClassName) { 5110 return makeArray(context.getElementsByClassName(match[2]), extra); 5111 } 5112 } 5113 5114 if (context.nodeType === 9) { 5115 // Speed-up: Sizzle("body") 5116 // The body element only exists once, optimize finding it 5117 if (query === "body" && context.body) { 5118 return makeArray([context.body], extra); 5119 5120 // Speed-up: Sizzle("#ID") 5121 } else if (match && match[3]) { 5122 var elem = context.getElementById(match[3]); 5123 5124 // Check parentNode to catch when Blackberry 4.6 returns 5125 // nodes that are no longer in the document #6963 5126 if (elem && elem.parentNode) { 5127 // Handle the case where IE and Opera return items 5128 // by name instead of ID 5129 if (elem.id === match[3]) { 5130 return makeArray([elem], extra); 5131 } 5132 5133 } else { 5134 return makeArray([], extra); 5135 } 5136 } 5137 5138 try { 5139 return makeArray(context.querySelectorAll(query), extra); 5140 } catch (qsaError) { 5141 } 5142 5143 // qSA works strangely on Element-rooted queries 5144 // We can work around this by specifying an extra ID on the root 5145 // and working up from there (Thanks to Andrew Dupont for the technique) 5146 // IE 8 doesn't work on object elements 5147 } else if (context.nodeType === 1 && context.nodeName.toLowerCase() !== "object") { 5148 var oldContext = context, 5149 old = context.getAttribute("id"), 5150 nid = old || id, 5151 hasParent = context.parentNode, 5152 relativeHierarchySelector = /^\s*[+~]/.test(query); 5153 5154 if (!old) { 5155 context.setAttribute("id", nid); 5156 } else { 5157 nid = nid.replace(/'/g, "\\$&"); 5158 } 5159 if (relativeHierarchySelector && hasParent) { 5160 context = context.parentNode; 5161 } 5162 5163 try { 5164 if (!relativeHierarchySelector || hasParent) { 5165 return makeArray(context.querySelectorAll("[id='" + nid + "'] " + query), extra); 5166 } 5167 5168 } catch (pseudoError) { 5169 } finally { 5170 if (!old) { 5171 oldContext.removeAttribute("id"); 5172 } 5173 } 5174 } 5175 } 5176 5177 return oldSizzle(query, context, extra, seed); 5178 }; 5179 5180 for (var prop in oldSizzle) { 5181 Sizzle[prop] = oldSizzle[prop]; 5182 } 5183 5184 // release memory in IE 5185 div = null; 5186 })(); 5187 } 5188 5189 (function () { 5190 var html = document.documentElement, 5191 matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; 5192 5193 if (matches) { 5194 // Check to see if it's possible to do matchesSelector 5195 // on a disconnected node (IE 9 fails this) 5196 var disconnectedMatch = !matches.call(document.createElement("div"), "div"), 5197 pseudoWorks = false;
5198 5199 try { 5200 // This should fail with an exception 5201 // Gecko does not error, returns false instead 5202 matches.call(document.documentElement, "[test!='']:sizzle"); 5203 5204 } catch (pseudoError) { 5205 pseudoWorks = true; 5206 } 5207 5208 Sizzle.matchesSelector = function (node, expr) { 5209 // Make sure that attribute selectors are quoted 5210 expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); 5211 5212 if (!Sizzle.isXML(node)) { 5213 try { 5214 if (pseudoWorks || !Expr.match.PSEUDO.test(expr) && !/!=/.test(expr)) { 5215 var ret = matches.call(node, expr); 5216 5217 // IE 9's matchesSelector returns false on disconnected nodes 5218 if (ret || !disconnectedMatch || 5219 // As well, disconnected nodes are said to be in a document 5220 // fragment in IE 9, so check for that 5221 node.document && node.document.nodeType !== 11) { 5222 return ret; 5223 } 5224 } 5225 } catch (e) { 5226 } 5227 } 5228 5229 return Sizzle(expr, null, null, [node]).length > 0; 5230 }; 5231 } 5232 })(); 5233 5234 (function () { 5235 var div = document.createElement("div"); 5236 5237 div.innerHTML = "<div class='test e'></div><div class='test'></div>"; 5238 5239 // Opera can't find a second classname (in 9.6) 5240 // Also, make sure that getElementsByClassName actually exists 5241 if (!div.getElementsByClassName || div.getElementsByClassName("e").length === 0) { 5242 return; 5243 } 5244 5245 // Safari caches class attributes, doesn't catch changes (in 3.2)
5246 div.lastChild.className = "e"; 5247 5248 if (div.getElementsByClassName("e").length === 1) { 5249 return; 5250 } 5251 5252 Expr.order.splice(1, 0, "CLASS"); 5253 Expr.find.CLASS = function (match, context, isXML) { 5254 if (typeof context.getElementsByClassName !== "undefined" && !isXML) { 5255 return context.getElementsByClassName(match[1]); 5256 } 5257 }; 5258 5259 // release memory in IE 5260 div = null; 5261 })(); 5262 5263 function dirNodeCheck(dir, cur, doneName, checkSet, nodeCheck, isXML) { 5264 for (var i = 0, l = checkSet.length; i < l; i++) { 5265 var elem = checkSet[i]; 5266 5267 if (elem) { 5268 var match = false; 5269 5270 elem = elem[dir]; 5271 5272 while (elem) { 5273 if (elem[expando] === doneName) { 5274 match = checkSet[elem.sizset]; 5275 break; 5276 } 5277 5278 if (elem.nodeType === 1 && !isXML) { 5279 elem[expando] = doneName; 5280 elem.sizset = i; 5281 } 5282 5283 if (elem.nodeName.toLowerCase() === cur) { 5284 match = elem; 5285 break; 5286 } 5287 5288 elem = elem[dir]; 5289 } 5290 5291 checkSet[i] = match; 5292 } 5293 } 5294 } 5295 5296 function dirCheck(dir, cur, doneName, checkSet, nodeCheck, isXML) { 5297 for (var i = 0, l = checkSet.length; i < l; i++) { 5298 var elem = checkSet[i]; 5299 5300 if (elem) { 5301 var match = false; 5302 5303 elem = elem[dir]; 5304 5305 while (elem) { 5306 if (elem[expando] === doneName) { 5307 match = checkSet[elem.sizset]; 5308 break; 5309 } 5310 5311 if (elem.nodeType === 1) { 5312 if (!isXML) { 5313 elem[expando] = doneName; 5314 elem.sizset = i; 5315 } 5316 5317 if (typeof cur !== "string") { 5318 if (elem === cur) { 5319 match = true; 5320 break; 5321 } 5322 5323 } else if (Sizzle.filter(cur, [elem]).length > 0) { 5324 match = elem; 5325 break; 5326 } 5327 } 5328 5329 elem = elem[dir]; 5330 } 5331 5332 checkSet[i] = match; 5333 } 5334 } 5335 } 5336 5337 if (document.documentElement.contains) { 5338 Sizzle.contains = function (a, b) { 5339 return a !== b && (a.contains ? a.contains(b) : true); 5340 }; 5341 5342 } else if (document.documentElement.compareDocumentPosition) { 5343 Sizzle.contains = function (a, b) { 5344 return !!(a.compareDocumentPosition(b) & 16); 5345 }; 5346 5347 } else { 5348 Sizzle.contains = function () { 5349 return false; 5350 }; 5351 } 5352 5353 Sizzle.isXML = function (elem) { 5354 // documentElement is verified for cases where it doesn't yet exist 5355 // (such as loading iframes in IE - #4833) 5356 var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; 5357 5358 return documentElement ? documentElement.nodeName !== "HTML" : false; 5359 }; 5360 5361 var posProcess = function (selector, context, seed) { 5362 var match, 5363 tmpSet = [], 5364 later = "", 5365 root = context.nodeType ? [context] : context; 5366 5367 // Position selectors must be done after the filter 5368 // And so must :not(positional) so we move all PSEUDOs to the end 5369 while ((match = Expr.match.PSEUDO.exec(selector))) { 5370 later += match[0]; 5371 selector = selector.replace(Expr.match.PSEUDO, ""); 5372 } 5373 5374 selector = Expr.relative[selector] ? selector + "*" : selector; 5375 5376 for (var i = 0, l = root.length; i < l; i++) { 5377 Sizzle(selector, root[i], tmpSet, seed); 5378 } 5379 5380 return Sizzle.filter(later, tmpSet); 5381 }; 5382 5383// EXPOSE 5384// Override sizzle attribute retrieval 5385 Sizzle.attr = jQuery.attr; 5386 Sizzle.selectors.attrMap = {}; 5387 jQuery.find = Sizzle; 5388 jQuery.expr = Sizzle.selectors; 5389 jQuery.expr[":"] = jQuery.expr.filters; 5390 jQuery.unique = Sizzle.uniqueSort; 5391 jQuery.text = Sizzle.getText; 5392 jQuery.isXMLDoc = Sizzle.isXML; 5393 jQuery.contains = Sizzle.contains; 5394 5395 5396 })(); 5397 5398 5399 var runtil = /Until$/, 5400 rparentsprev = /^(?:parents|prevUntil|prevAll)/, 5401 // Note: This RegExp should be improved, or likely pulled from Sizzle 5402 rmultiselector = /,/, 5403 isSimple = /^.[^:#\[\.,]*$/, 5404 slice = Array.prototype.slice, 5405 POS = jQuery.expr.match.globalPOS, 5406 // methods guaranteed to produce a unique set when starting from a unique set 5407 guaranteedUnique = { 5408 children: true, 5409 contents: true, 5410 next: true, 5411 prev: true 5412 }; 5413 5414 jQuery.fn.extend({ 5415 find: function (selector) { 5416 var self = this, 5417 i, l; 5418 5419 if (typeof selector !== "string") { 5420 return jQuery(selector).filter(function () { 5421 for (i = 0, l = self.length; i < l; i++) { 5422 if (jQuery.contains(self[i], this)) { 5423 return true; 5424 } 5425 } 5426 }); 5427 } 5428 5429 var ret = this.pushStack("", "find", selector), 5430 length, n, r; 5431 5432 for (i = 0, l = this.length; i < l; i++) { 5433 length = ret.length; 5434 jQuery.find(selector, this[i], ret); 5435 5436 if (i > 0) { 5437 // Make sure that the results are unique 5438 for (n = length; n < ret.length; n++) { 5439 for (r = 0; r < length; r++) { 5440 if (ret[r] === ret[n]) { 5441 ret.splice(n--, 1); 5442 break; 5443 } 5444 } 5445 } 5446 } 5447 } 5448 5449 return ret; 5450 }, 5451 5452 has: function (target) { 5453 var targets = jQuery(target); 5454 return this.filter(function () { 5455 for (var i = 0, l = targets.length; i < l; i++) { 5456 if (jQuery.contains(this, targets[i])) { 5457 return true; 5458 } 5459 } 5460 }); 5461 }, 5462 5463 not: function (selector) { 5464 return this.pushStack(winnow(this, selector, false), "not", selector); 5465 }, 5466 5467 filter: function (selector) { 5468 return this.pushStack(winnow(this, selector, true), "f
vendor: 16,168 bytes, lines 5468-5942
5468ilter", selector); 5469 }, 5470 5471 is: function (selector) { 5472 return !!selector && ( 5473 typeof selector === "string" ? 5474 // If this is a positional selector, check membership in the returned set 5475 // so $("p:first").is("p:last") won't return true for a doc with two "p". 5476 POS.test(selector) ? 5477 jQuery(selector, this.context).index(this[0]) >= 0 : 5478 jQuery.filter(selector, this).length > 0 : 5479 this.filter(selector).length > 0); 5480 }, 5481 5482 closest: function (selectors, context) { 5483 var ret = [], i, l, cur = this[0]; 5484 5485 // Array (deprecated as of jQuery 1.7) 5486 if (jQuery.isArray(selectors)) { 5487 var level = 1; 5488 5489 while (cur && cur.ownerDocument && cur !== context) { 5490 for (i = 0; i < selectors.length; i++) { 5491 5492 if (jQuery(cur).is(selectors[i])) { 5493 ret.push({selector: selectors[i], elem: cur, level: level}); 5494 } 5495 } 5496 5497 cur = cur.parentNode; 5498 level++; 5499 } 5500 5501 return ret; 5502 } 5503 5504 // String 5505 var pos = POS.test(selectors) || typeof selectors !== "string" ? 5506 jQuery(selectors, context || this.context) : 5507 0; 5508 5509 for (i = 0, l = this.length; i < l; i++) { 5510 cur = this[i]; 5511 5512 while (cur) { 5513 if (pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors)) { 5514 ret.push(cur); 5515 break; 5516 5517 } else { 5518 cur = cur.parentNode; 5519 if (!cur || !cur.ownerDocument || cur === context || cur.nodeType === 11) { 5520 break; 5521 } 5522 } 5523 } 5524 } 5525 5526 ret = ret.length > 1 ? jQuery.unique(ret) : ret; 5527 5528 return this.pushStack(ret, "closest", selectors); 5529 }, 5530 5531 // Determine the position of an element within 5532 // the matched set of elements 5533 index: function (elem) { 5534 5535 // No argument, return index in parent 5536 if (!elem) { 5537 return (this[0] && this[0].parentNode) ? this.prevAll().length : -1; 5538 } 5539 5540 // index in selector 5541 if (typeof elem === "string") { 5542 return jQuery.inArray(this[0], jQuery(elem)); 5543 } 5544 5545 // Locate the position of the desired element 5546 return jQuery.inArray( 5547 // If it receives a jQuery object, the first element is used 5548 elem.jquery ? elem[0] : elem, this); 5549 }, 5550 5551 add: function (selector, context) { 5552 var set = typeof selector === "string" ? 5553 jQuery(selector, context) : 5554 jQuery.makeArray(selector && selector.nodeType ? [selector] : selector), 5555 all = jQuery.merge(this.get(), set); 5556 5557 return this.pushStack(isDisconnected(set[0]) || isDisconnected(all[0]) ? 5558 all : 5559 jQuery.unique(all)); 5560 }, 5561 5562 andSelf: function () { 5563 return this.add(this.prevObject); 5564 } 5565 }); 5566 5567// A painfully simple check to see if an element is disconnected 5568// from a document (should be improved, where feasible). 5569 function isDisconnected(node) { 5570 return !node || !node.parentNode || node.parentNode.nodeType === 11; 5571 } 5572 5573 jQuery.each({ 5574 parent: function (elem) { 5575 var parent = elem.parentNode; 5576 return parent && parent.nodeType !== 11 ? parent : null; 5577 }, 5578 parents: function (elem) { 5579 return jQuery.dir(elem, "parentNode"); 5580 }, 5581 parentsUntil: function (elem, i, until) { 5582 return jQuery.dir(elem, "parentNode", until); 5583 }, 5584 next: function (elem) { 5585 return jQuery.nth(elem, 2, "nextSibling"); 5586 }, 5587 prev: function (elem) { 5588 return jQuery.nth(elem, 2, "previousSibling"); 5589 }, 5590 nextAll: function (elem) { 5591 return jQuery.dir(elem, "nextSibling"); 5592 }, 5593 prevAll: function (elem) { 5594 return jQuery.dir(elem, "previousSibling"); 5595 }, 5596 nextUntil: function (elem, i, until) { 5597 return jQuery.dir(elem, "nextSibling", until); 5598 }, 5599 prevUntil: function (elem, i, until) { 5600 return jQuery.dir(elem, "previousSibling", until); 5601 }, 5602 siblings: function (elem) { 5603 return jQuery.sibling((elem.parentNode || {}).firstChild, elem); 5604 }, 5605 children: function (elem) { 5606 return jQuery.sibling(elem.firstChild); 5607 }, 5608 contents: function (elem) { 5609 return jQuery.nodeName(elem, "iframe") ? 5610 elem.contentDocument || elem.contentWindow.document : 5611 jQuery.makeArray(elem.childNodes); 5612 } 5613 }, function (name, fn) { 5614 jQuery.fn[name] = function (until, selector) { 5615 var ret = jQuery.map(this, fn, until); 5616 5617 if (!runtil.test(name)) { 5618 selector = until; 5619 } 5620 5621 if (selector && typeof selector === "string") { 5622 ret = jQuery.filter(selector, ret); 5623 } 5624 5625 ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret; 5626 5627 if ((this.length > 1 || rmultiselector.test(selector)) && rparentsprev.test(name)) { 5628 ret = ret.reverse(); 5629 } 5630 5631 return this.pushStack(ret, name, slice.call(arguments).join(",")); 5632 }; 5633 }); 5634 5635 jQuery.extend({ 5636 filter: function (expr, elems, not) { 5637 if (not) { 5638 expr = ":not(" + expr + ")"; 5639 } 5640 5641 return elems.length === 1 ? 5642 jQuery.find.matchesSelector(elems[0], expr) ? [elems[0]] : [] : 5643 jQuery.find.matches(expr, elems); 5644 }, 5645 5646 dir: function (elem, dir, until) { 5647 var matched = [], 5648 cur = elem[dir]; 5649 5650 while (cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery(cur).is(until))) { 5651 if (cur.nodeType === 1) { 5652 matched.push(cur); 5653 } 5654 cur = cur[dir]; 5655 } 5656 return matched; 5657 }, 5658 5659 nth: function (cur, result, dir, elem) { 5660 result = result || 1; 5661 var num = 0; 5662 5663 for (; cur; cur = cur[dir]) { 5664 if (cur.nodeType === 1 && ++num === result) { 5665 break; 5666 } 5667 } 5668 5669 return cur; 5670 }, 5671 5672 sibling: function (n, elem) { 5673 var r = []; 5674 5675 for (; n; n = n.nextSibling) { 5676 if (n.nodeType === 1 && n !== elem) { 5677 r.push(n); 5678 } 5679 } 5680 5681 return r; 5682 } 5683 }); 5684 5685// Implement the identical functionality for filter and not 5686 function winnow(elements, qualifier, keep) { 5687 5688 // Can't pass null or undefined to indexOf in Firefox 4 5689 // Set to 0 to skip string check 5690 qualifier = qualifier || 0; 5691 5692 if (jQuery.isFunction(qualifier)) { 5693 return jQuery.grep(elements, function (elem, i) { 5694 var retVal = !!qualifier.call(elem, i, elem); 5695 return retVal === keep; 5696 }); 5697 5698 } else if (qualifier.nodeType) { 5699 return jQuery.grep(elements, function (elem, i) { 5700 return (elem === qualifier) === keep; 5701 }); 5702 5703 } else if (typeof qualifier === "string") { 5704 var filtered = jQuery.grep(elements, function (elem) { 5705 return elem.nodeType === 1; 5706 }); 5707 5708 if (isSimple.test(qualifier)) { 5709 return jQuery.filter(qualifier, filtered, !keep); 5710 } else { 5711 qualifier = jQuery.filter(qualifier, filtered); 5712 } 5713 } 5714 5715 return jQuery.grep(elements, function (elem, i) { 5716 return (jQuery.inArray(elem, qualifier) >= 0) === keep; 5717 }); 5718 } 5719 5720 5721 function createSafeFragment(document) { 5722 var list = nodeNames.split("|"), 5723 safeFrag = document.createDocumentFragment(); 5724 5725 if (safeFrag.createElement) { 5726 while (list.length) { 5727 safeFrag.createElement( 5728 list.pop() 5729 ); 5730 } 5731 } 5732 return safeFrag; 5733 } 5734 5735 var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + 5736 "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", 5737 rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, 5738 rleadingWhitespace = /^\s+/, 5739 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, 5740 rtagName = /<([\w:]+)/, 5741 rtbody = /<tbody/i, 5742 rhtml = /<|&#?\w+;/, 5743 rnoInnerhtml = /<(?:script|style)/i, 5744 rnocache = /<(?:script|object|embed|option|style)/i, 5745 rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), 5746 // checked="checked" or checked 5747 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5748 rscriptType = /\/(java|ecma)script/i, 5749 rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/, 5750 wrapMap = { 5751 option: [1, "<select multiple='multiple'>", "</select>"], 5752 legend: [1, "<fieldset>", "</fieldset>"], 5753 thead: [1, "<table>", "</table>"], 5754 tr: [2, "<table><tbody>", "</tbody></table>"], 5755 td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], 5756 col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"], 5757 area: [1, "<map>", "</map>"], 5758 _default: [0, "", ""] 5759 }, 5760 safeFragment = createSafeFragment(document); 5761 5762 wrapMap.optgroup = wrapMap.option; 5763 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 5764 wrapMap.th = wrapMap.td; 5765 5766// IE can't serialize <link> and <script> tags normally 5767 if (!jQuery.support.htmlSerialize) { 5768 wrapMap._default = [1, "div<div>", "</div>"]; 5769 } 5770 5771 jQuery.fn.extend({ 5772 text: function (value) { 5773 return jQuery.access(this, function (value) { 5774 return value === undefined ? 5775 jQuery.text(this) : 5776 this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(value)); 5777 }, null, value, arguments.length); 5778 }, 5779 5780 wrapAll: function (html) { 5781 if (jQuery.isFunction(html)) { 5782 return this.each(function (i) { 5783 jQuery(this).wrapAll(html.call(this, i)); 5784 }); 5785 } 5786 5787 if (this[0]) { 5788 // The elements to wrap the target around 5789 var wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true); 5790 5791 if (this[0].parentNode) { 5792 wrap.insertBefore(this[0]); 5793 } 5794 5795 wrap.map(function () { 5796 var elem = this; 5797 5798 while (elem.firstChild && elem.firstChild.nodeType === 1) { 5799 elem = elem.firstChild; 5800 } 5801 5802 return elem; 5803 }).append(this); 5804 } 5805 5806 return this; 5807 }, 5808 5809 wrapInner: function (html) { 5810 if (jQuery.isFunction(html)) { 5811 return this.each(function (i) { 5812 jQuery(this).wrapInner(html.call(this, i)); 5813 }); 5814 } 5815 5816 return this.each(function () { 5817 var self = jQuery(this), 5818 contents = self.contents(); 5819 5820 if (contents.length) { 5821 contents.wrapAll(html); 5822 5823 } else { 5824 self.append(html); 5825 } 5826 }); 5827 }, 5828 5829 wrap: function (html) { 5830 var isFunction = jQuery.isFunction(html); 5831 5832 return this.each(function (i) { 5833 jQuery(this).wrapAll(isFunction ? html.call(this, i) : html); 5834 }); 5835 }, 5836 5837 unwrap: function () { 5838 return this.parent().each(function () { 5839 if (!jQuery.nodeName(this, "body")) { 5840 jQuery(this).replaceWith(this.childNodes); 5841 } 5842 }).end(); 5843 }, 5844 5845 append: function () { 5846 return this.domManip(arguments, true, function (elem) { 5847 if (this.nodeType === 1) { 5848 this.appendChild(elem); 5849 } 5850 }); 5851 }, 5852 5853 prepend: function () { 5854 return this.domManip(arguments, true, function (elem) { 5855 if (this.nodeType === 1) { 5856 this.insertBefore(elem, this.firstChild); 5857 } 5858 }); 5859 }, 5860 5861 before: function () { 5862 if (this[0] && this[0].parentNode) { 5863 return this.domManip(arguments, false, function (elem) { 5864 this.parentNode.insertBefore(elem, this); 5865 }); 5866 } else if (arguments.length) { 5867 var set = jQuery.clean(arguments); 5868 set.push.apply(set, this.toArray()); 5869 return this.pushStack(set, "before", arguments); 5870 } 5871 }, 5872 5873 after: function () { 5874 if (this[0] && this[0].parentNode) { 5875 return this.domManip(arguments, false, function (elem) { 5876 this.parentNode.insertBefore(elem, this.nextSibling); 5877 }); 5878 } else if (arguments.length) { 5879 var set = this.pushStack(this, "after", arguments); 5880 set.push.apply(set, jQuery.clean(arguments)); 5881 return set; 5882 } 5883 }, 5884 5885 // keepData is for internal use only--do not document 5886 remove: function (selector, keepData) { 5887 for (var i = 0, elem; (elem = this[i]) != null; i++) { 5888 if (!selector || jQuery.filter(selector, [elem]).length) { 5889 if (!keepData && elem.nodeType === 1) { 5890 jQuery.cleanData(elem.getElementsByTagName("*")); 5891 jQuery.cleanData([elem]); 5892 } 5893 5894 if (elem.parentNode) { 5895 elem.parentNode.removeChild(elem); 5896 } 5897 } 5898 } 5899 5900 return this; 5901 }, 5902 5903 empty: function () { 5904 for (var i = 0, elem; (elem = this[i]) != null; i++) { 5905 // Remove element nodes and prevent memory leaks 5906 if (elem.nodeType === 1) { 5907 jQuery.cleanData(elem.getElementsByTagName("*")); 5908 } 5909 5910 // Remove any remaining nodes 5911 while (elem.firstChild) { 5912 elem.removeChild(elem.firstChild); 5913 } 5914 } 5915 5916 return this; 5917 }, 5918 5919 clone: function (dataAndEvents, deepDataAndEvents) { 5920 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 5921 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 5922 5923 return this.map(function () { 5924 return jQuery.clone(this, dataAndEvents, deepDataAndEvents); 5925 }); 5926 }, 5927 5928 html: function (value) { 5929 return jQuery.access(this, function (value) { 5930 var elem = this[0] || {}, 5931 i = 0, 5932 l = this.length; 5933 5934 if (value === undefined) { 5935 return elem.nodeType === 1 ? 5936 elem.innerHTML.replace(rinlinejQuery, "") : 5937 null; 5938 } 5939 5940 5941 if (typeof value === "string" && !rnoInnerhtml.test(value) && 5942 (jQuery.support.leadingWhitespace || !rleadingWhitespace.test(value)) &&
5943 !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) { 5944 5945 value = value.replace(rxhtmlTag, "<$1></$2>"); 5946 5947 try { 5948 for (; i < l; i++) { 5949 // Remove element nodes and prevent memory leaks 5950 elem = this[i] || {}; 5951 if (elem.nodeType === 1) { 5952 jQuery.cleanData(elem.getElementsByTagName("*")); 5953 elem.innerHTML = value; 5954 } 5955 } 5956 5957 elem = 0; 5958 5959 // If using innerHTML throws an exception, use the fallback method 5960 } catch (e) { 5961 } 5962 } 5963 5964 if (elem) { 5965 this.empty().append(value); 5966 } 5967 }, null, value, arguments.length); 5968 }, 5969 5970 replaceWith: function (value) { 5971 if (this[0] && this[0].parentNode) { 5972 // Make sure that the elements are removed from the DOM before they are inserted 5973 // this can help fix replacing a parent with child elements 5974 if (jQuery.isFunction(value)) { 5975 return this.each(function (i) { 5976 var self = jQuery(this), old = self.html(); 5977 self.replaceWith(value.call(this, i, old)); 5978 }); 5979 } 5980 5981 if (typeof value !== "string") { 5982 value = jQuery(value).detach(); 5983 } 5984 5985 return this.each(function () { 5986 var next = this.nextSibling, 5987 parent = this.parentNode; 5988 5989 jQuery(this).remove(); 5990 5991 if (next) { 5992 jQuery(next).before(value); 5993 } else { 5994 jQuery(parent).append(value); 5995 } 5996 }); 5997 } else { 5998 return this.length ? 5999 this.pushStack(jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value) : 6000 this; 6001 } 6002 }, 6003 6004 detach: function (selector) { 6005 return this.remove(selector, true); 6006 }, 6007 6008 domManip: function (args, table, callback) { 6009 var results, first, fragment, parent, 6010 value = args[0], 6011 scripts = []; 6012 6013 // We can't cloneNode fragments that contain checked, in WebKit 6014 if (!jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test(value)) { 6015 return this.each(function () { 6016 jQuery(this).domManip(args, table, callback, true); 6017 }); 6018 } 6019 6020 if (jQuery.isFunction(value)) { 6021 return this.each(function (i) { 6022 var self = jQuery(this); 6023 args[0] = value.call(this, i, table ? self.html() : undefined); 6024 self.domManip(args, table, callback); 6025 }); 6026 } 6027 6028 if (this[0]) { 6029 parent = value && value.parentNode; 6030 6031 // If we're in a fragment, just use that instead of building a new one 6032 if (jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length) { 6033 results = {fragment: parent}; 6034 6035 } else { 6036 results = jQuery.buildFragment(args, this, scripts); 6037 } 6038 6039 fragment = results.fragment; 6040 6041 if (fragment.childNodes.length === 1) { 6042 first = fragment = fragment.firstChild; 6043 } else { 6044 first = fragment.firstChild; 6045 } 6046 6047 if (first) { 6048 table = table && jQuery.nodeName(first, "tr"); 6049 6050 for (var i = 0, l = this.length, lastIndex = l - 1; i < l; i++) { 6051 callback.call( 6052 table ? 6053 root(this[i], first) : 6054 this[i], 6055 // Make sure that we do not leak memory by inadvertently discarding 6056 // the original fragment (which might have attached data) instead of 6057 // using it; in addition, use the original fragment object for the last 6058 // item instead of first because it can end up being emptied incorrectly 6059 // in certain situations (Bug #8070). 6060 // Fragments from the fragment cache must always be cloned and never used 6061 // in place. 6062 results.cacheable || (l > 1 && i < lastIndex) ? 6063 jQuery.clone(fragment, true, true) : 6064 fragment 6065 ); 6066 } 6067 } 6068 6069 if (scripts.length) { 6070 jQuery.each(scripts, function (i, elem) { 6071 if (elem.src) { 6072 jQuery.ajax({ 6073 type: "GET", 6074 global: false, 6075 url: elem.src, 6076 async: false, 6077 dataType: "script" 6078 }); 6079 } else { 6080 jQuery.globalEval((elem.text || elem.textContent || elem.innerHTML || "").replace(rcleanScript, "/*$0*/")); 6081 } 6082 6083 if (elem.parentNode) { 6084 elem.parentNode.removeChild(elem); 6085 } 6086 }); 6087 } 6088 } 6089 6090 return this; 6091 } 6092 }); 6093 6094 function root(elem, cur) { 6095 return jQuery.nodeName(elem, "table") ? 6096 (elem.getElementsByTagName("tbody")[0] || 6097 elem.appendChild(elem.ownerDocument.createElement("tbody"))) : 6098 elem; 6099 } 6100 6101 function cloneCopyEvent(src, dest) { 6102 6103 if (dest.nodeType !== 1 || !jQuery.hasData(src)) { 6104 return; 6105 } 6106 6107 var type, i, l, 6108 oldData = jQuery._data(src), 6109 curData = jQuery._data(dest, oldData), 6110 events = oldData.events; 6111 6112 if (events) { 6113 delete curData.handle; 6114 curData.events = {}; 6115 6116 for (type in events) { 6117 for (i = 0, l = events[type].length; i < l; i++) { 6118 jQuery.event.add(dest, type, events[type][i]); 6119 } 6120 } 6121 } 6122 6123 // make the cloned public data object a copy from the original 6124 if (curData.data) { 6125 curData.data = jQuery.extend({}, curData.data); 6126 } 6127 } 6128 6129 function cloneFixAttributes(src, dest) { 6130 var nodeName; 6131 6132 // We do not need to do anything for non-Elements 6133 if (dest.nodeType !== 1) { 6134 return; 6135 } 6136 6137 // clearAttributes removes the attributes, which we don't want, 6138 // but also removes the attachEvent events, which we *do* want 6139 if (dest.clearAttributes) { 6140 dest.clearAttributes(); 6141 } 6142 6143 // mergeAttributes, in contrast, only merges back on the 6144 // original attributes, not the events 6145 if (dest.mergeAttributes) { 6146 dest.mergeAttributes(src); 6147 } 6148
6149 nodeName = dest.nodeName.toLowerCase(); 6150 6151 // IE6-8 fail to clone children inside object elements that use 6152 // the proprietary classid attribute value (rather than the type 6153 // attribute) to identify the type of content to display 6154 if (nodeName === "object") { 6155 dest.outerHTML = src.outerHTML; 6156 6157 } else if (nodeName === "input" && (src.type === "checkbox" || src.type === "radio")) { 6158 // IE6-8 fails to persist the checked state of a cloned checkbox 6159 // or radio button. Worse, IE6-7 fail to give the cloned element 6160 // a checked appearance if the defaultChecked value isn't also set 6161 if (src.checked) { 6162 dest.defaultChecked = dest.checked = src.checked; 6163 } 6164 6165 // IE6-7 get confused and end up setting the value of a cloned 6166 // checkbox/radio button to an empty string instead of "on" 6167 if (dest.value !== src.value) { 6168 dest.value = src.value; 6169 } 6170 6171 // IE6-8 fails to return the selected option to the default selected 6172 // state when cloning options 6173 } else if (nodeName === "option") { 6174 dest.selected = src.defaultSelected; 6175 6176 // IE6-8 fails to set the defaultValue to the correct value when 6177 // cloning other types of input fields 6178 } else if (nodeName === "input" || nodeName === "textarea") { 6179 dest.defaultValue = src.defaultValue; 6180 6181 // IE blanks contents when cloning scripts 6182 } else if (nodeName === "script" && dest.text !== src.text) { 6183 dest.text = src.text; 6184 } 6185 6186 // Event data gets referenced instead of copied if the expando 6187 // gets copied too 6188 dest.removeAttribute(jQuery.expando); 6189 6190 // Clear flags for bubbling special change/submit events, they must 6191 // be reattached when the newly cloned events are first activated 6192 dest.removeAttribute("_submit_attached"); 6193 dest.removeAttribute("_change_attached"); 6194 } 6195 6196 jQuery.buildFragment = function (args, nodes, scripts) { 6197 var fragment, cacheable, cacheresults, doc, 6198 first = args[0]; 6199 6200 // nodes may contain either an explicit document object, 6201 // a jQuery collection or context object. 6202 // If nodes[0] contains a valid object to assign to doc 6203 if (nodes && nodes[0]) { 6204 doc = nodes[0].ownerDocument || nodes[0]; 6205 } 6206 6207 // Ensure that an attr object doesn't incorrectly stand in as a document object 6208 // Chrome and Firefox seem to allow this to occur and will throw exception 6209 // Fixes #8950 6210 if (!doc.createDocumentFragment) { 6211 doc = document; 6212 } 6213 6214 // Only cache "small" (1/2 KB) HTML strings that are associated with the main document 6215 // Cloning options loses the selected state, so don't cache them 6216 // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment 6217 // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache 6218 // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 6219 if (args.length === 1 && typeof first === "string" && first.length < 512 && doc === document && 6220 first.charAt(0) === "<" && !rnocache.test(first) && 6221 (jQuery.support.checkClone || !rchecked.test(first)) && 6222 (jQuery.support.html5Clone || !rnoshimcache.test(first))) { 6223 6224 cacheable = true; 6225 6226 cacheresults = jQuery.fragments[first]; 6227 if (cacheresults && cacheresults !== 1) { 6228 fragment = cacheresults; 6229 } 6230 } 6231 6232 if (!fragment) { 6233 fragment = doc.createDocumentFragment(); 6234 jQuery.clean(args, doc, fragment, scripts); 6235 } 6236 6237 if (cacheable) { 6238 jQuery.fragments[first] = cacheresults ? fragment : 1; 6239 } 6240 6241 return {fragment: fragment, cacheable: cacheable}; 6242 }; 6243 6244 jQuery.fragments = {}; 6245 6246 jQuery.each({ 6247 appendTo: "append",
6248 prependTo: "prepend", 6249 insertBefore: "before", 6250 insertAfter: "after", 6251 replaceAll: "replaceWith" 6252 }, function (name, original) { 6253 jQuery.fn[name] = function (selector) { 6254 var ret = [], 6255 insert = jQuery(selector), 6256 parent = this.length === 1 && this[0].parentNode; 6257 6258 if (parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1) { 6259 insert[original](this[0]); 6260 return this; 6261 6262 } else { 6263 for (var i = 0, l = insert.length; i < l; i++) { 6264 var elems = (i > 0 ? this.clone(true) : this).get(); 6265 jQuery(insert[i])[original](elems); 6266 ret = ret.concat(elems); 6267 } 6268 6269 return this.pushStack(ret, name, insert.selector); 6270 } 6271 }; 6272 }); 6273 6274 function getAll(elem) { 6275 if (typeof elem.getElementsByTagName !== "undefined") { 6276 return elem.getElementsByTagName("*"); 6277 6278 } else if (typeof elem.querySelectorAll !== "undefined") { 6279 return elem.querySelectorAll("*"); 6280 6281 } else { 6282 return []; 6283 } 6284 } 6285 6286// Used in clean, fixes the defaultChecked property 6287 function fixDefaultChecked(elem) { 6288 if (elem.type === "checkbox" || elem.type === "radio") { 6289 elem.defaultChecked = elem.checked; 6290 } 6291 } 6292 6293// Finds all inputs and passes them to fixDefaultChecked 6294 function findInputs(elem) { 6295 var nodeName = (elem.nodeName || "").toLowerCase(); 6296 if (nodeName === "input") { 6297 fixDefaultChecked(elem); 6298 // Skip scripts, get other children 6299 } else if (nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined") { 6300 jQuery.grep(elem.getElementsByTagName("input"), fixDefaultChecked); 6301 } 6302 } 6303 6304// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js 6305 function shimCloneNode(elem) { 6306 var div = document.createElement("div"); 6307 safeFragment.appendChild(div); 6308 6309 div.innerHTML = elem.outerHTML; 6310 return div.firstChild; 6311 } 6312 6313 jQuery.extend({ 6314 clone: function (elem, dataAndEvents, deepDataAndEvents) { 6315 var srcElements, 6316 destElements, 6317 i, 6318 // IE<=8 does not properly clone detached, unknown element nodes 6319 clone = jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test("<" + elem.nodeName + ">") ? 6320 elem.cloneNode(true) : 6321 shimCloneNode(elem); 6322 6323 if ((!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && 6324 (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) { 6325 // IE copies events bound via attachEvent when using cloneNode. 6326 // Calling detachEvent on the clone will also remove the events 6327 // from the original. In order to get around this, we use some 6328 // proprietary methods to clear the events. Thanks to MooTools 6329 // guys for this hotness. 6330 6331 cloneFixAttributes(elem, clone); 6332 6333 // Using Sizzle here is crazy slow, so we use getElementsByTagName instead 6334 srcElements = getAll(elem); 6335 destElements = getAll(clone); 6336 6337 // Weird iteration because IE will replace the length property 6338 // with an element if you are cloning the body and one of the 6339 // elements on the page has a name or id of "length" 6340 for (i = 0; srcElements[i]; ++i) { 6341 // Ensure that the destination node is not null; Fixes #9587 6342 if (destElements[i]) { 6343 cloneFixAttributes(srcElements[i], destElements[i]); 6344 } 6345 } 6346 } 6347 6348 // Copy the events from the original to the clone 6349 if (dataAndEvents) { 6350 cloneCopyEvent(elem, clone); 6351 6352 if (deepDataAndEvents) { 6353 srcElements = getAll(elem); 6354 destElements = getAll(clone); 6355 6356 for (i = 0; srcElements[i]; ++i) { 6357 cloneCopyEvent(srcElements[i], destElements[i]); 6358 } 6359 } 6360 } 6361 6362 srcElements = destElements = null; 6363 6364 // Return the cloned set 6365 return clone; 6366 }, 6367 6368 clean: function (elems, context, fragment, scripts) { 6369 var checkScriptType, script, j, 6370 ret = []; 6371 6372 context = context || document; 6373 6374 // !context.createElement fails in IE with an error but returns typeof 'object' 6375 if (typeof context.createElement === "undefined") { 6376 context = context.ownerDocument || context[0] && context[0].ownerDocument || document; 6377 } 6378 6379 for (var i = 0, elem; (elem = elems[i]) != null; i++) { 6380 if (typeof elem === "number") { 6381 elem += ""; 6382 } 6383 6384 if (!elem) { 6385 continue; 6386 } 6387 6388 // Convert html string into DOM nodes 6389 if (typeof elem === "string") { 6390 if (!rhtml.test(elem)) { 6391 elem = context.createTextNode(elem); 6392 } else { 6393 // Fix "XHTML"-style tags in all browsers 6394 elem = elem.replace(rxhtmlTag, "<$1></$2>"); 6395 6396 // Trim whitespace, otherwise indexOf won't work as expected 6397 var tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase(), 6398 wrap = wrapMap[tag] || wrapMap._default, 6399 depth = wrap[0], 6400 div = context.createElement("div"), 6401 safeChildNodes = safeFragment.childNodes, 6402 remove; 6403 6404 // Append wrapper element to unknown element safe doc fragment 6405 if (context === document) { 6406 // Use the fragment we've already created for this document 6407 safeFragment.appendChild(div); 6408 } else { 6409 // Use a fragment created with the owner document 6410 createSafeFragment(context).appendChild(div); 6411 } 6412 6413 // Go to html and back, then peel off extra wrappers 6414 div.innerHTML = wrap[1] + elem + wrap[2]; 6415 6416 // Move to the right depth 6417 while (depth--) {
6418 div = div.lastChild; 6419 } 6420 6421 // Remove IE's autoinserted <tbody> from table fragments 6422 if (!jQuery.support.tbody) { 6423 6424 // String was a <table>, *may* have spurious <tbody> 6425 var hasBody = rtbody.test(elem), 6426 tbody = tag === "table" && !hasBody ? 6427 div.firstChild && div.firstChild.childNodes : 6428 6429 // String was a bare <thead> or <tfoot> 6430 wrap[1] === "<table>" && !hasBody ? 6431 div.childNodes : 6432 []; 6433 6434 for (j = tbody.length - 1; j >= 0; --j) { 6435 if (jQuery.nodeName(tbody[j], "tbody") && !tbody[j].childNodes.length) { 6436 tbody[j].parentNode.removeChild(tbody[j]); 6437 } 6438 } 6439 } 6440 6441 // IE completely kills leading whitespace when innerHTML is used 6442 if (!jQuery.support.leadingWhitespace && rleadingWhitespace.test(elem)) { 6443 div.insertBefore(context.createTextNode(rleadingWhitespace.exec(elem)[0]), div.firstChild); 6444 } 6445 6446 elem = div.childNodes; 6447 6448 // Clear elements from DocumentFragment (safeFragment or otherwise) 6449 // to avoid hoarding elements. Fixes #11356 6450 if (div) { 6451 div.parentNode.removeChild(div); 6452 6453 // Guard against -1 index exceptions in FF3.6 6454 if (safeChildNodes.length > 0) { 6455 remove = safeChildNodes[safeChildNodes.length - 1]; 6456 6457 if (remove && remove.parentNode) { 6458 remove.parentNode.removeChild(remove); 6459 } 6460 } 6461 } 6462 } 6463 } 6464 6465 // Resets defaultChecked for any radios and checkboxes 6466 // about to be appended to the DOM in IE 6/7 (#8060) 6467 var len; 6468 if (!jQuery.support.appendChecked) { 6469 if (elem[0] && typeof (len = elem.length) === "number") { 6470 for (j = 0; j < len; j++) { 6471 findInputs(elem[j]); 6472 } 6473 } else { 6474 findInputs(elem); 6475 } 6476 } 6477 6478 if (elem.nodeType) { 6479 ret.push(elem); 6480 } else { 6481 ret = jQuery.merge(ret, elem); 6482 } 6483 } 6484 6485 if (fragment) { 6486 checkScriptType = function (elem) { 6487 return !elem.type || rscriptType.test(elem.type); 6488 }; 6489 for (i = 0; ret[i]; i++) { 6490 script = ret[i]; 6491 if (scripts && jQuery.nodeName(script, "script") && (!script.type || rscriptType.test(script.type))) { 6492 scripts.push(script.parentNode ? script.parentNode.removeChild(script) : script); 6493 6494 } else { 6495 if (script.nodeType === 1) { 6496 var jsTags = jQuery.grep(script.getElementsByTagName("script"), checkScriptType); 6497 6498 ret.splice.apply(ret, [i + 1, 0].concat(jsTags)); 6499 } 6500 fragment.appendChild(script); 6501 } 6502 } 6503 } 6504 6505 return ret; 6506 }, 6507 6508 cleanData: function (elems) { 6509 var data, id, 6510 cache = jQuery.cache, 6511 special = jQuery.event.special, 6512 deleteExpando = jQuery.support.deleteExpando; 6513 6514 for (var i = 0, elem; (elem = elems[i]) != null; i++) { 6515 if (elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) { 6516 continue; 6517 } 6518 6519 id = elem[jQuery.expando]; 6520 6521 if (id) { 6522 data = cache[id]; 6523 6524 if (data && data.events) { 6525 for (var type in data.events) { 6526 if (special[type]) { 6527 jQuery.event.remove(elem, type); 6528 6529 // This is a shortcut to avoid jQuery.event.remove's overhead 6530 } else { 6531 jQuery.removeEvent(elem, type, data.handle); 6532 } 6533 } 6534 6535 // Null the DOM reference to avoid IE6/7/8 leak (#7054) 6536 if (data.handle) { 6537 data.handle.elem = null; 6538 } 6539 } 6540 6541 if (deleteExpando) { 6542 delete elem[jQuery.expando]; 6543 6544 } else if (elem.removeAttribute) { 6545 elem.removeAttribute(jQuery.expando); 6546 } 6547 6548 delete cache[id]; 6549 } 6550 } 6551 } 6552 }); 6553 6554 6555 var ralpha = /alpha\([^)]*\)/i, 6556 ropacity = /opacity=([^)]*)/, 6557 // fixed for IE9, see #8346 6558 rupper = /([A-Z]|^ms)/g, 6559 rnum = /^[\-+]?(?:\d*\.)?\d+$/i, 6560 rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i, 6561 rrelNum = /^([\-+])=([\-+.\de]+)/, 6562 rmargin = /^margin/, 6563 6564 cssShow = {position: "absolute", visibility: "hidden", display: "block"}, 6565 6566 // order is important! 6567 cssExpand = ["Top", "Right", "Bottom", "Left"], 6568 6569 curCSS, 6570 6571 getComputedStyle, 6572 currentStyle; 6573 6574 jQuery.fn.css = function (name, value) { 6575 return jQuery.access(this, function (elem, name, value) { 6576 return value !== undefined ? 6577 jQuery.style(elem, name, value) : 6578 jQuery.css(elem, name); 6579 }, name, value, arguments.length > 1); 6580 }; 6581 6582 jQuery.extend({ 6583 // Add in style property hooks for overriding the default 6584 // behavior of getting and setting a style property 6585 cssHooks: { 6586 opacity: { 6587 get: function (elem, computed) { 6588 if (computed) { 6589 // We should always get a number back from opacity 6590 var ret = curCSS(elem, "opacity"); 6591 return ret === "" ? "1" : ret; 6592 6593 } else { 6594 return elem.style.opacity; 6595 } 6596 } 6597 } 6598 }, 6599 6600 // Exclude the following css properties to add px 6601 cssNumber: { 6602 "fillOpacity": true, 6603 "fontWeight": true, 6604 "lineHeight": true, 6605 "opacity": true, 6606 "orphans": true, 6607 "widows": true, 6608 "zIndex": true, 6609 "zoom": true 6610 }, 6611 6612 // Add in properties whose names you wish to fix before 6613 // setting or getting the value 6614 cssProps: { 6615 // normalize float css property 6616 "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" 6617 }, 6618 6619 // Get and set the style property on a DOM Node 6620 style: function (elem, name, value, extra) { 6621 // Don't set styles on text and comment nodes 6622 if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) { 6623 return; 6624 } 6625 6626 // Make sure that we're working with the right name 6627 var ret, type, origName = jQuery.camelCase(name), 6628 style = elem.style, hooks = jQuery.cssHooks[origName]; 6629 6630 name = jQuery.cssProps[origName] || origName; 6631 6632 // Check if we're setting a value 6633 if (value !== undefined) { 6634 type = typeof value; 6635 6636 // convert relative number strings (+= or -=) to relative numbers. #7345 6637 if (type === "string" && (ret = rrelNum.exec(value))) { 6638 value = (+(ret[1] + 1) * +ret[2]) + parseFloat(jQuery.css(elem, name)); 6639 // Fixes bug #9237 6640 type = "number"; 6641 } 6642 6643 // Make sure that NaN and null values aren't set. See: #7116 6644 if (value == null || type === "number" && isNaN(value)) { 6645 return; 6646 } 6647 6648 // If a number was passed in, add 'px' to the (except for certain CSS properties) 6649 if (type === "number" && !jQuery.cssNumber[origName]) { 6650 value += "px"; 6651 } 6652 6653 // If a hook was provided, use that value, otherwise just set the specified value 6654 if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value)) !== undefined) { 6655 // Wrapped to prevent IE from throwing errors when 'invali
6655d' values are provided 6656 // Fixes bug #5509 6657 try { 6658 style[name] = value; 6659 } catch (e) { 6660 } 6661 } 6662 6663 } else { 6664 // If a hook was provided get the non-computed value from there 6665 if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) { 6666 return ret; 6667 } 6668 6669 // Otherwise just get the value from the style object 6670 return style[name]; 6671 } 6672 }, 6673 6674 css: function (elem, name, extra) { 6675 var ret, hooks; 6676 6677 // Make sure that we're working with the right name 6678 name = jQuery.camelCase(name); 6679 hooks = jQuery.cssHooks[name]; 6680 name = jQuery.cssProps[name] || name; 6681 6682 // cssFloat needs a special treatment 6683 if (name === "cssFloat") { 6684 name = "float"; 6685 } 6686 6687 // If a hook was provided get the computed value from there 6688 if (hooks && "get" in hooks && (ret = hooks.get(elem, true, extra)) !== undefined) { 6689 return ret; 6690 6691 // Otherwise, if a way to get the computed value exists, use that 6692 } else if (curCSS) { 6693 return curCSS(elem, name); 6694 } 6695 }, 6696 6697 // A method for quickly swapping in/out CSS properties to get correct calculations 6698 swap: function (elem, options, callback) { 6699 var old = {}, 6700 ret, name; 6701 6702 // Remember the old values, and insert the new ones 6703 for (name in options) { 6704 old[name] = elem.style[name]; 6705 elem.style[name] = options[name]; 6706 } 6707 6708 ret = callback.call(elem); 6709 6710 // Revert the old values 6711 for (name in options) { 6712 elem.style[name] = old[name]; 6713 } 6714 6715 return ret; 6716 } 6717 }); 6718 6719// DEPRECATED in 1.3, Use jQuery.css() instead 6720 jQuery.curCSS = jQuery.css; 6721 6722 if (document.defaultView && document.defaultView.getComputedStyle) { 6723 getComputedStyle = function (elem, name) { 6724 var ret, defaultView, computedStyle, width, 6725 style = elem.style; 6726 6727 name = name.replace(rupper, "-$1").toLowerCase(); 6728 6729 if ((defaultView = elem.ownerDocument.defaultView) && 6730 (computedStyle = defaultView.getComputedStyle(elem, null))) { 6731 6732 ret = computedStyle.getPropertyValue(name); 6733 if (ret === "" && !jQuery.contains(elem.ownerDocument.documentElement, elem)) { 6734 ret = jQuery.style(elem, name); 6735 } 6736 } 6737 6738 // A tribute to the "awesome hack by Dean Edwards" 6739 // WebKit uses "computed value (percentage if specified)" instead of "used value" for margins 6740 // which is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values 6741 if (!jQuery.support.pixelMargin && computedStyle && rmargin.test(name) && rnumnonpx.test(ret)) { 6742 width = style.width; 6743 style.width = ret; 6744 ret = computedStyle.width; 6745 style.width = width; 6746 } 6747 6748 return ret; 6749 }; 6750 } 6751 6752 if (document.documentElement.currentStyle) { 6753 currentStyle = function (elem, name) { 6754 var left, rsLeft, uncomputed, 6755 ret = elem.currentStyle && elem.currentStyle[name], 6756 style = elem.style; 6757 6758 // Avoid setting ret to empty string here 6759 // so we don't default to auto 6760 if (ret == null && style && (uncomputed = style[name])) { 6761 ret = uncomputed; 6762 } 6763 6764 // From the awesome hack by Dean Edwards 6765 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 6766 6767 // If we're not dealing with a regular pixel number 6768 // but a number that has a weird ending, we need to convert it to pixels 6769 if (rnumnonpx.test(ret)) { 6770 6771 // Remember the original values 6772 left = style.left; 6773 rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; 6774 6775 // Put in the new values to get a computed value out 6776 if (rsLeft) { 6777 elem.runtimeStyle.left = elem.currentStyle.left; 6778 } 6779 style.left = name === "fontSize" ? "1em" : ret; 6780 ret = style.pixelLeft + "px"; 6781 6782 // Revert the changed values 6783 style.left = left; 6784 if (rsLeft) { 6785 elem.runtimeStyle.left = rsLeft; 6786 } 6787 } 6788 6789 return ret === "" ? "auto" : ret; 6790 }; 6791 } 6792 6793 curCSS = getComputedStyle || currentStyle; 6794 6795 function getWidthOrHeight(elem, name, extra) { 6796 6797 // Start with offset property 6798 var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, 6799 i = name === "width" ? 1 : 0, 6800 len = 4; 6801 6802 if (val > 0) { 6803 if (extra !== "border") { 6804 for (; i < len; i += 2) { 6805 if (!extra) { 6806 val -= parseFloat(jQuery.css(elem, "padding" + cssExpand[i])) || 0; 6807 } 6808 if (extra === "margin") { 6809 val += parseFloat(jQuery.css(elem, extra + cssExpand[i])) || 0; 6810 } else { 6811 val -= parseFloat(jQuery.css(elem, "border" + cssExpand[i] + "Width")) || 0; 6812 } 6813 } 6814 } 6815 6816 return val + "px"; 6817 } 6818 6819 // Fall back to computed then uncomputed css if necessary 6820 val = curCSS(elem, name); 6821 if (val < 0 || val == null) { 6822 val = elem.style[name]; 6823 } 6824 6825 // Computed unit is not pixels. Stop here and return. 6826 if (rnumnonpx.test(val)) { 6827 return val; 6828 } 6829 6830 // Normalize "", auto, and prepare for extra 6831 val = parseFloat(val) || 0; 6832 6833 // Add padding, border, margin 6834 if (extra) { 6835 for (; i < len; i += 2) { 6836 val += parseFloat(jQuery.css(elem, "padding" + cssExpand[i])) || 0; 6837 if (extra !== "padding") { 6838 val += parseFloat(jQuery.css(elem, "border" + cssExpand[i] + "Width")) || 0; 6839 } 6840 if (extra === "margin") { 6841 val += parseFloat(jQuery.css(elem, extra + cssExpand[i])) || 0; 6842 } 6843 } 6844 } 6845 6846 return val + "px"; 6847 } 6848 6849 jQuery.each(["height", "width"], function (i, name) { 6850 jQuery.cssHooks[name] = { 6851 get: function (elem, computed, extra) { 6852 if (computed) { 6853 if (elem.offsetWidth !== 0) { 6854 return getWidthOrHeight(elem, name, extra); 6855 } else { 6856 return jQuery.swap(elem, cssShow, function () { 6857 return getWidthOrHeight(elem, name, extra); 6858 }); 6859 } 6860 } 6861 }, 6862 6863 set: function (elem, value) { 6864 return rnum.test(value) ? 6865 value + "px" : 6866 value; 6867 } 6868 }; 6869 }); 6870 6871 if (!jQuery.support.opacity) { 6872 jQuery.cssHooks.opacity = { 6873 get: function (elem, computed) { 6874 // IE uses filters for opacity 6875 return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ? 6876 (parseFloat(RegExp.$1) / 100) + "" : 6877 computed ? "1" : ""; 6878 }, 6879 6880 set: function (elem, value) { 6881 var style = elem.style, 6882 currentStyle = elem.currentStyle, 6883 opacity = jQuery.isNumeric(value) ? "alpha(opacity=" + value * 100 + ")" : "", 6884 filter = currentStyle && currentStyle.filter || style.filter || ""; 6885 6886 // IE has trouble with opacity if it does not have layout 6887 // Force it by setting the zoom level 6888 style.zoom = 1; 6889 6890 // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 6891 if (value >
vendor: 35,851 bytes, lines 6891-7857
6891= 1 && jQuery.trim(filter.replace(ralpha, "")) === "") { 6892 6893 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText 6894 // if "filter:" is present at all, clearType is disabled, we want to avoid this 6895 // style.removeAttribute is IE Only, but so apparently is this code path... 6896 style.removeAttribute("filter"); 6897 6898 // if there there is no filter style applied in a css rule, we are done 6899 if (currentStyle && !currentStyle.filter) { 6900 return; 6901 } 6902 } 6903 6904 // otherwise, set new filter values 6905 style.filter = ralpha.test(filter) ? 6906 filter.replace(ralpha, opacity) : 6907 filter + " " + opacity; 6908 } 6909 }; 6910 } 6911 6912 jQuery(function () { 6913 // This hook cannot be added until DOM ready because the support test 6914 // for it is not run until after DOM ready 6915 if (!jQuery.support.reliableMarginRight) { 6916 jQuery.cssHooks.marginRight = { 6917 get: function (elem, computed) { 6918 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 6919 // Work around by temporarily setting element display to inline-block 6920 return jQuery.swap(elem, {"display": "inline-block"}, function () { 6921 if (computed) { 6922 return curCSS(elem, "margin-right"); 6923 } else { 6924 return elem.style.marginRight; 6925 } 6926 }); 6927 } 6928 }; 6929 } 6930 }); 6931 6932 if (jQuery.expr && jQuery.expr.filters) { 6933 jQuery.expr.filters.hidden = function (elem) { 6934 var width = elem.offsetWidth, 6935 height = elem.offsetHeight; 6936 6937 return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css(elem, "display")) === "none"); 6938 }; 6939 6940 jQuery.expr.filters.visible = function (elem) { 6941 return !jQuery.expr.filters.hidden(elem); 6942 }; 6943 } 6944 6945// These hooks are used by animate to expand properties 6946 jQuery.each({ 6947 margin: "", 6948 padding: "", 6949 border: "Width" 6950 }, function (prefix, suffix) { 6951 6952 jQuery.cssHooks[prefix + suffix] = { 6953 expand: function (value) { 6954 var i, 6955 6956 // assumes a single number if not a string 6957 parts = typeof value === "string" ? value.split(" ") : [value], 6958 expanded = {}; 6959 6960 for (i = 0; i < 4; i++) { 6961 expanded[prefix + cssExpand[i] + suffix] = 6962 parts[i] || parts[i - 2] || parts[0]; 6963 } 6964 6965 return expanded; 6966 } 6967 }; 6968 }); 6969 6970 6971 var r20 = /%20/g, 6972 rbracket = /\[\]$/, 6973 rCRLF = /\r?\n/g, 6974 rhash = /#.*$/, 6975 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL 6976 rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, 6977 // #7653, #8125, #8152: local protocol detection 6978 rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, 6979 rnoContent = /^(?:GET|HEAD)$/, 6980 rprotocol = /^\/\//, 6981 rquery = /\?/, 6982 rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, 6983 rselectTextarea = /^(?:select|textarea)/i, 6984 rspacesAjax = /\s+/, 6985 rts = /([?&])_=[^&]*/, 6986 rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/, 6987 6988 // Keep a copy of the old load method 6989 _load = jQuery.fn.load, 6990 6991 /* Prefilters 6992 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 6993 * 2) These are called: 6994 * - BEFORE asking for a transport 6995 * - AFTER param serialization (s.data is a string if s.processData is true) 6996 * 3) key is the dataType 6997 * 4) the catchall symbol "*" can be used 6998 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 6999 */ 7000 prefilters = {}, 7001 7002 /* Transports bindings 7003 * 1) key is the dataType 7004 * 2) the catchall symbol "*" can be used 7005 * 3) selection will start with transport dataType and THEN go to "*" if needed 7006 */ 7007 transports = {}, 7008 7009 // Document location 7010 ajaxLocation, 7011 7012 // Document location segments 7013 ajaxLocParts, 7014 7015 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 7016 allTypes = ["*/"] + ["*"]; 7017 7018// #8138, IE may throw an exception when accessing 7019// a field from window.location if document.domain has been set 7020 try { 7021 ajaxLocation = location.href; 7022 } catch (e) { 7023 // Use the href attribute of an A element 7024 // since IE will modify it given document.location 7025 ajaxLocation = document.createElement("a"); 7026 ajaxLocation.href = ""; 7027 ajaxLocation = ajaxLocation.href; 7028 } 7029 7030// Segment location into parts 7031 ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || []; 7032 7033// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 7034 function addToPrefiltersOrTransports(structure) { 7035 7036 // dataTypeExpression is optional and defaults to "*" 7037 return function (dataTypeExpression, func) { 7038 7039 if (typeof dataTypeExpression !== "string") { 7040 func = dataTypeExpression; 7041 dataTypeExpression = "*"; 7042 } 7043 7044 if (jQuery.isFunction(func)) { 7045 var dataTypes = dataTypeExpression.toLowerCase().split(rspacesAjax), 7046 i = 0, 7047 length = dataTypes.length, 7048 dataType, 7049 list, 7050 placeBefore; 7051 7052 // For each dataType in the dataTypeExpression 7053 for (; i < length; i++) { 7054 dataType = dataTypes[i]; 7055 // We control if we're asked to add before 7056 // any existing element 7057 placeBefore = /^\+/.test(dataType); 7058 if (placeBefore) { 7059 dataType = dataType.substr(1) || "*"; 7060 } 7061 list = structure[dataType] = structure[dataType] || []; 7062 // then we add to the structure accordingly 7063 list[placeBefore ? "unshift" : "push"](func); 7064 } 7065 } 7066 }; 7067 } 7068 7069// Base inspection function for prefilters and transports 7070 function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR, 7071 dataType /* internal */, inspected /* internal */) { 7072 7073 dataType = dataType || options.dataTypes[0]; 7074 inspected = inspected || {}; 7075 7076 inspected[dataType] = true; 7077 7078 var list = structure[dataType], 7079 i = 0, 7080 length = list ? list.length : 0, 7081 executeOnly = (structure === prefilters), 7082 selection; 7083 7084 for (; i < length && (executeOnly || !selection); i++) { 7085 selection = list[i](options, originalOptions, jqXHR); 7086 // If we got redirected to another dataType 7087 // we try there if executing only and not done already 7088 if (typeof selection === "string") { 7089 if (!executeOnly || inspected[selection]) { 7090 selection = undefined; 7091 } else { 7092 options.dataTypes.unshift(selection); 7093 selection = inspectPrefiltersOrTransports( 7094 structure, options, originalOptions, jqXHR, selection, inspected); 7095 } 7096 } 7097 } 7098 // If we're only executing or nothing was selected 7099 // we try the catchall dataType if not done already 7100 if ((executeOnly || !selection) && !inspected["*"]) { 7101 selection = inspectPrefiltersOrTransports( 7102 structure, options, originalOptions, jqXHR, "*", inspected); 7103 } 7104 // unnecessary when only executing (prefilters) 7105 // but it'll be ignored by the caller in that case 7106 return selection; 7107 } 7108 7109// A special extend for ajax options 7110// that takes "flat" options (not to be deep extended) 7111// Fixes #9887 7112 function ajaxExtend(target, src) { 7113 var key, deep, 7114 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 7115 for (key in src) { 7116 if (src[key] !== undefined) { 7117 (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key]; 7118 } 7119 } 7120 if (deep) { 7121 jQuery.extend(true, target, deep); 7122 } 7123 } 7124 7125 jQuery.fn.extend({ 7126 load: function (url, params, callback) { 7127 if (typeof url !== "string" && _load) { 7128 return _load.apply(this, arguments); 7129 7130 // Don't do a request if no elements are being requested 7131 } else if (!this.length) { 7132 return this; 7133 } 7134 7135 var off = url.indexOf(" "); 7136 if (off >= 0) { 7137 var selector = url.slice(off, url.length); 7138 url = url.slice(0, off); 7139 } 7140 7141 // Default to a GET request 7142 var type = "GET"; 7143 7144 // If the second parameter was provided 7145 if (params) { 7146 // If it's a function 7147 if (jQuery.isFunction(params)) { 7148 // We assume that it's the callback 7149 callback = params; 7150 params = undefined; 7151 7152 // Otherwise, build a param string 7153 } else if (typeof params === "object") { 7154 params = jQuery.param(params, jQuery.ajaxSettings.traditional); 7155 type = "POST"; 7156 } 7157 } 7158 7159 var self = this; 7160 7161 // Request the remote document 7162 jQuery.ajax({ 7163 url: url, 7164 type: type, 7165 dataType: "html", 7166 data: params, 7167 // Complete callback (responseText is used internally) 7168 complete: function (jqXHR, status, responseText) { 7169 // Store the response as specified by the jqXHR object 7170 responseText = jqXHR.responseText; 7171 // If successful, inject the HTML into all the matched elements 7172 if (jqXHR.isResolved()) { 7173 // #4825: Get the actual response in case 7174 // a dataFilter is present in ajaxSettings 7175 jqXHR.done(function (r) { 7176 responseText = r; 7177 }); 7178 // See if a selector was specified 7179 self.html(selector ? 7180 // Create a dummy div to hold the results 7181 jQuery("<div>") 7182 // inject the contents of the document in, removing the scripts 7183 // to avoid any 'Permission Denied' errors in IE 7184 .append(responseText.replace(rscript, "")) 7185 7186 // Locate the specified elements 7187 .find(selector) : 7188 7189 // If not, just inject the full result 7190 responseText); 7191 } 7192 7193 if (callback) { 7194 self.each(callback, [responseText, status, jqXHR]); 7195 } 7196 } 7197 }); 7198 7199 return this; 7200 }, 7201 7202 serialize: function () { 7203 return jQuery.param(this.serializeArray()); 7204 }, 7205 7206 serializeArray: function () { 7207 return this.map(function () { 7208 return this.elements ? jQuery.makeArray(this.elements) : this; 7209 }) 7210 .filter(function () { 7211 return this.name && !this.disabled && 7212 (this.checked || rselectTextarea.test(this.nodeName) || 7213 rinput.test(this.type)); 7214 }) 7215 .map(function (i, elem) { 7216 var val = jQuery(this).val(); 7217 7218 return val == null ? 7219 null : 7220 jQuery.isArray(val) ? 7221 jQuery.map(val, function (val, i) { 7222 return {name: elem.name, value: val.replace(rCRLF, "\r\n")}; 7223 }) : 7224 {name: elem.name, value: val.replace(rCRLF, "\r\n")}; 7225 }).get(); 7226 } 7227 }); 7228 7229// Attach a bunch of functions for handling common AJAX events 7230 jQuery.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function (i, o) { 7231 jQuery.fn[o] = function (f) { 7232 return this.on(o, f); 7233 }; 7234 }); 7235 7236 jQuery.each(["get", "post"], function (i, method) { 7237 jQuery[method] = function (url, data, callback, type) { 7238 // shift arguments if data argument was omitted 7239 if (jQuery.isFunction(data)) { 7240 type = type || callback; 7241 callback = data; 7242 data = undefined; 7243 } 7244 7245 return jQuery.ajax({ 7246 type: method, 7247 url: url, 7248 data: data, 7249 success: callback, 7250 dataType: type 7251 }); 7252 }; 7253 }); 7254 7255 jQuery.extend({ 7256 7257 getScript: function (url, callback) { 7258 return jQuery.get(url, undefined, callback, "script"); 7259 }, 7260 7261 getJSON: function (url, data, callback) { 7262 return jQuery.get(url, data, callback, "json"); 7263 }, 7264 7265 // Creates a full fledged settings object into target 7266 // with both ajaxSettings and settings fields. 7267 // If target is omitted, writes into ajaxSettings. 7268 ajaxSetup: function (target, settings) { 7269 if (settings) { 7270 // Building a settings object 7271 ajaxExtend(target, jQuery.ajaxSettings); 7272 } else { 7273 // Extending ajaxSettings 7274 settings = target; 7275 target = jQuery.ajaxSettings; 7276 } 7277 ajaxExtend(target, settings); 7278 return target; 7279 }, 7280 7281 ajaxSettings: { 7282 url: ajaxLocation, 7283 isLocal: rlocalProtocol.test(ajaxLocParts[1]), 7284 global: true, 7285 type: "GET", 7286 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 7287 processData: true, 7288 async: true, 7289 /* 7290 timeout: 0, 7291 data: null, 7292 dataType: null, 7293 username: null, 7294 password: null, 7295 cache: null, 7296 traditional: false, 7297 headers: {}, 7298 */ 7299 7300 accepts: { 7301 xml: "application/xml, text/xml", 7302 html: "text/html", 7303 text: "text/plain", 7304 json: "application/json, text/javascript", 7305 "*": allTypes 7306 }, 7307 7308 contents: { 7309 xml: /xml/, 7310 html: /html/, 7311 json: /json/ 7312 }, 7313 7314 responseFields: { 7315 xml: "responseXML", 7316 text: "responseText" 7317 }, 7318 7319 // List of data converters 7320 // 1) key format is "source_type destination_type" (a single space in-between) 7321 // 2) the catchall symbol "*" can be used for source_type 7322 converters: { 7323 7324 // Convert anything to text 7325 "* text": window.String, 7326 7327 // Text to html (true = no transformation) 7328 "text html": true, 7329 7330 // Evaluate text as a json expression 7331 "text json": jQuery.parseJSON, 7332 7333 // Parse text as xml 7334 "text xml": jQuery.parseXML 7335 }, 7336 7337 // For options that shouldn't be deep extended: 7338 // you can add your own custom options here if 7339 // and when you create one that shouldn't be 7340 // deep extended (see ajaxExtend) 7341 flatOptions: { 7342 context: true, 7343 url: true 7344 } 7345 }, 7346 7347 ajaxPrefilter: addToPrefiltersOrTransports(prefilters), 7348 ajaxTransport: addToPrefiltersOrTransports(transports), 7349 7350 // Main method 7351 ajax: function (url, options) { 7352 7353 // If url is an object, simulate pre-1.5 signature 7354 if (typeof url === "object") { 7355 options = url; 7356 url = undefined; 7357 } 7358 7359 // Force options to be an object 7360 options = options || {}; 7361 7362 var // Create the final options object 7363 s = jQuery.ajaxSetup({}, options), 7364 // Callbacks context 7365 callbackContext = s.context || s, 7366 // Context for global events 7367 // It's the callbackContext if one was provided in the options 7368 // and if it's a DOM node or a jQuery collection 7369 globalEventContext = callbackContext !== s && 7370 (callbackContext.nodeType || callbackContext instanceof jQuery) ? 7371 jQuery(callbackContext) : jQuery.event, 7372 // Deferreds 7373 deferred = jQuery.Deferred(), 7374 completeDeferred = jQuery.Callbacks("once memory"), 7375 // Status-dependent callbacks 7376 statusCode = s.statusCode || {}, 7377 // ifModified key 7378 ifModifiedKey, 7379 // Headers (they are sent all at once) 7380 requestHeaders = {}, 7381 requestHeadersNames = {}, 7382 // Response headers 7383 responseHeadersString, 7384 responseHeaders, 7385 // transport 7386 transport, 7387 // timeout handle 7388 timeoutTimer, 7389 // Cross-domain detection vars 7390 parts, 7391 // The jqXHR state 7392 state = 0, 7393 // To know if global events are to be dispatched 7394 fireGlobals, 7395 // Loop variable 7396 i, 7397 // Fake xhr 7398 jqXHR = { 7399 7400 readyState: 0, 7401 7402 // Caches the header 7403 setRequestHeader: function (name, value) { 7404 if (!state) { 7405 var lname = name.toLowerCase(); 7406 name = requestHeadersNames[lname] = requestHeadersNames[lname] || name; 7407 requestHeaders[name] = value; 7408 } 7409 return this; 7410 }, 7411 7412 // Raw string 7413 getAllResponseHeaders: function () { 7414 return state === 2 ? responseHeadersString : null; 7415 }, 7416 7417 // Builds headers hashtable if needed 7418 getResponseHeader: function (key) { 7419 var match; 7420 if (state === 2) { 7421 if (!responseHeaders) { 7422 responseHeaders = {}; 7423 while ((match = rheaders.exec(responseHeadersString))) { 7424 responseHeaders[match[1].toLowerCase()] = match[2]; 7425 } 7426 } 7427 match = responseHeaders[key.toLowerCase()]; 7428 } 7429 return match === undefined ? null : match; 7430 }, 7431 7432 // Overrides response content-type header 7433 overrideMimeType: function (type) { 7434 if (!state) { 7435 s.mimeType = type; 7436 } 7437 return this; 7438 }, 7439 7440 // Cancel the request 7441 abort: function (statusText) { 7442 statusText = statusText || "abort"; 7443 if (transport) { 7444 transport.abort(statusText); 7445 } 7446 done(0, statusText); 7447 return this; 7448 } 7449 }; 7450 7451 // Callback for when everything is done 7452 // It is defined here because jslint complains if it is declared 7453 // at the end of the function (which would be more logical and readable) 7454 function done(status, nativeStatusText, responses, headers) { 7455 7456 // Called once 7457 if (state === 2) { 7458 return; 7459 } 7460 7461 // State is "done" now 7462 state = 2; 7463 7464 // Clear timeout if it exists 7465 if (timeoutTimer) { 7466 clearTimeout(timeoutTimer); 7467 } 7468 7469 // Dereference transport for early garbage collection 7470 // (no matter how long the jqXHR object will be used) 7471 transport = undefined; 7472 7473 // Cache response headers 7474 responseHeadersString = headers || ""; 7475 7476 // Set readyState 7477 jqXHR.readyState = status > 0 ? 4 : 0; 7478 7479 var isSuccess, 7480 success, 7481 error, 7482 statusText = nativeStatusText, 7483 response = responses ? ajaxHandleResponses(s, jqXHR, responses) : undefined, 7484 lastModified, 7485 etag; 7486 7487 // If successful, handle type chaining 7488 if (status >= 200 && status < 300 || status === 304) { 7489 7490 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 7491 if (s.ifModified) { 7492 7493 if ((lastModified = jqXHR.getResponseHeader("Last-Modified"))) { 7494 jQuery.lastModified[ifModifiedKey] = lastModified; 7495 } 7496 if ((etag = jqXHR.getResponseHeader("Etag"))) { 7497 jQuery.etag[ifModifiedKey] = etag; 7498 } 7499 } 7500 7501 // If not modified 7502 if (status === 304) { 7503 7504 statusText = "notmodified"; 7505 isSuccess = true; 7506 7507 // If we have data 7508 } else { 7509 7510 try { 7511 success = ajaxConvert(s, response); 7512 statusText = "success"; 7513 isSuccess = true; 7514 } catch (e) { 7515 // We have a parsererror 7516 statusText = "parsererror"; 7517 error = e; 7518 } 7519 } 7520 } else { 7521 // We extract error from statusText 7522 // then normalize statusText and status for non-aborts 7523 error = statusText; 7524 if (!statusText || status) { 7525 statusText = "error"; 7526 if (status < 0) { 7527 status = 0; 7528 } 7529 } 7530 } 7531 7532 // Set data for the fake xhr object 7533 jqXHR.status = status; 7534 jqXHR.statusText = "" + (nativeStatusText || statusText); 7535 7536 // Success/Error 7537 if (isSuccess) { 7538 deferred.resolveWith(callbackContext, [success, statusText, jqXHR]); 7539 } else { 7540 deferred.rejectWith(callbackContext, [jqXHR, statusText, error]); 7541 } 7542 7543 // Status-dependent callbacks 7544 jqXHR.statusCode(statusCode); 7545 statusCode = undefined; 7546 7547 if (fireGlobals) { 7548 globalEventContext.trigger("ajax" + (isSuccess ? "Success" : "Error"), 7549 [jqXHR, s, isSuccess ? success : error]); 7550 } 7551 7552 // Complete 7553 completeDeferred.fireWith(callbackContext, [jqXHR, statusText]); 7554 7555 if (fireGlobals) { 7556 globalEventContext.trigger("ajaxComplete", [jqXHR, s]); 7557 // Handle the global AJAX counter 7558 if (!(--jQuery.active)) { 7559 jQuery.event.trigger("ajaxStop"); 7560 } 7561 } 7562 } 7563 7564 // Attach deferreds 7565 deferred.promise(jqXHR); 7566 jqXHR.success = jqXHR.done; 7567 jqXHR.error = jqXHR.fail; 7568 jqXHR.complete = completeDeferred.add; 7569 7570 // Status-dependent callbacks 7571 jqXHR.statusCode = function (map) { 7572 if (map) { 7573 var tmp; 7574 if (state < 2) { 7575 for (tmp in map) { 7576 statusCode[tmp] = [statusCode[tmp], map[tmp]]; 7577 } 7578 } else { 7579 tmp = map[jqXHR.status]; 7580 jqXHR.then(tmp, tmp); 7581 } 7582 } 7583 return this; 7584 }; 7585 7586 // Remove hash character (#7531: and string promotion) 7587 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) 7588 // We also use the url parameter if available 7589 s.url = ((url || s.url) + "").replace(rhash, "").replace(rprotocol, ajaxLocParts[1] + "//"); 7590 7591 // Extract dataTypes list 7592 s.dataTypes = jQuery.trim(s.dataType || "*").toLowerCase().split(rspacesAjax); 7593 7594 // Determine if a cross-domain request is in order 7595 if (s.crossDomain == null) { 7596 parts = rurl.exec(s.url.toLowerCase()); 7597 s.crossDomain = !!(parts && 7598 (parts[1] != ajaxLocParts[1] || parts[2] != ajaxLocParts[2] || 7599 (parts[3] || (parts[1] === "http:" ? 80 : 443)) != 7600 (ajaxLocParts[3] || (ajaxLocParts[1] === "http:" ? 80 : 443))) 7601 ); 7602 } 7603 7604 // Convert data if not already a string 7605 if (s.data && s.processData && typeof s.data !== "string") { 7606 s.data = jQuery.param(s.data, s.traditional); 7607 } 7608 7609 // Apply prefilters 7610 inspectPrefiltersOrTransports(prefilters, s, options, jqXHR); 7611 7612 // If request was aborted inside a prefilter, stop there 7613 if (state === 2) { 7614 return false; 7615 } 7616 7617 // We can fire global events as of now if asked to 7618 fireGlobals = s.global; 7619 7620 // Uppercase the type 7621 s.type = s.type.toUpperCase(); 7622 7623 // Determine if request has content 7624 s.hasContent = !rnoContent.test(s.type); 7625 7626 // Watch for a new set of requests 7627 if (fireGlobals && jQuery.active++ === 0) { 7628 jQuery.event.trigger("ajaxStart"); 7629 } 7630 7631 // More options handling for requests with no content 7632 if (!s.hasContent) { 7633 7634 // If data is available, append data to url 7635 if (s.data) { 7636 s.url += (rquery.test(s.url) ? "&" : "?") + s.data; 7637 // #9682: remove data so that it's not used in an eventual retry 7638 delete s.data; 7639 } 7640 7641 // Get ifModifiedKey before adding the anti-cache parameter 7642 ifModifiedKey = s.url; 7643 7644 // Add anti-cache in url if needed 7645 if (s.cache === false) { 7646 7647 var ts = jQuery.now(), 7648 // try replacing _= if it is there 7649 ret = s.url.replace(rts, "$1_=" + ts); 7650 7651 // if nothing was replaced, add timestamp to the end 7652 s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : ""); 7653 } 7654 } 7655 7656 // Set the correct header, if data is being sent 7657 if (s.data && s.hasContent && s.contentType !== false || options.contentType) { 7658 jqXHR.setRequestHeader("Content-Type", s.contentType); 7659 } 7660 7661 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 7662 if (s.ifModified) { 7663 ifModifiedKey = ifModifiedKey || s.url; 7664 if (jQuery.lastModified[ifModifiedKey]) { 7665 jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[ifModifiedKey]); 7666 } 7667 if (jQuery.etag[ifModifiedKey]) { 7668 jqXHR.setRequestHeader("If-None-Match", jQuery.etag[ifModifiedKey]); 7669 } 7670 } 7671 7672 // Set the Accepts header for the server, depending on the dataType 7673 jqXHR.setRequestHeader( 7674 "Accept", 7675 s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? 7676 s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : 7677 s.accepts["*"] 7678 ); 7679 7680 // Check for headers option 7681 for (i in s.headers) { 7682 jqXHR.setRequestHeader(i, s.headers[i]); 7683 } 7684 7685 // Allow custom headers/mimetypes and early abort 7686 if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || state === 2)) { 7687 // Abort if not done already 7688 jqXHR.abort(); 7689 return false; 7690 7691 } 7692 7693 // Install callbacks on deferreds 7694 for (i in {success: 1, error: 1, complete: 1}) { 7695 jqXHR[i](s[i]); 7696 } 7697 7698 // Get transport 7699 transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR); 7700 7701 // If no transport, we auto-abort 7702 if (!transport) { 7703 done(-1, "No Transport"); 7704 } else { 7705 jqXHR.readyState = 1; 7706 // Send global event 7707 if (fireGlobals) { 7708 globalEventContext.trigger("ajaxSend", [jqXHR, s]); 7709 } 7710 // Timeout 7711 if (s.async && s.timeout > 0) { 7712 timeoutTimer = setTimeout(function () { 7713 jqXHR.abort("timeout"); 7714 }, s.timeout); 7715 } 7716 7717 try { 7718 state = 1; 7719 transport.send(requestHeaders, done); 7720 } catch (e) { 7721 // Propagate exception as error if not done 7722 if (state < 2) { 7723 done(-1, e); 7724 // Simply rethrow otherwise 7725 } else { 7726 throw e; 7727 } 7728 } 7729 } 7730 7731 return jqXHR; 7732 }, 7733 7734 // Serialize an array of form elements or a set of 7735 // key/values into a query string 7736 param: function (a, traditional) { 7737 var s = [], 7738 add = function (key, value) { 7739 // If value is a function, invoke it and return its value 7740 value = jQuery.isFunction(value) ? value() : value; 7741 s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value); 7742 }; 7743 7744 // Set traditional to true for jQuery <= 1.3.2 behavior. 7745 if (traditional === undefined) { 7746 traditional = jQuery.ajaxSettings.traditional; 7747 } 7748 7749 // If an array was passed in, assume that it is an array of form elements. 7750 if (jQuery.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) { 7751 // Serialize the form elements 7752 jQuery.each(a, function () { 7753 add(this.name, this.value); 7754 }); 7755 7756 } else { 7757 // If traditional, encode the "old" way (the way 1.3.2 or older 7758 // did it), otherwise encode params recursively. 7759 for (var prefix in a) { 7760 buildParams(prefix, a[prefix], traditional, add); 7761 } 7762 } 7763 7764 // Return the resulting serialization 7765 return s.join("&").replace(r20, "+"); 7766 } 7767 }); 7768 7769 function buildParams(prefix, obj, traditional, add) { 7770 if (jQuery.isArray(obj)) { 7771 // Serialize array item. 7772 jQuery.each(obj, function (i, v) { 7773 if (traditional || rbracket.test(prefix)) { 7774 // Treat each array item as a scalar. 7775 add(prefix, v); 7776 7777 } else { 7778 // If array item is non-scalar (array or object), encode its 7779 // numeric index to resolve deserialization ambiguity issues. 7780 // Note that rack (as of 1.0.0) can't currently deserialize 7781 // nested arrays properly, and attempting to do so may cause 7782 // a server error. Possible fixes are to modify rack's 7783 // deserialization algorithm or to provide an option or flag 7784 // to force array serialization to be shallow. 7785 buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add); 7786 } 7787 }); 7788 7789 } else if (!traditional && jQuery.type(obj) === "object") { 7790 // Serialize object item. 7791 for (var name in obj) { 7792 buildParams(prefix + "[" + name + "]", obj[name], traditional, add); 7793 } 7794 7795 } else { 7796 // Serialize scalar item. 7797 add(prefix, obj); 7798 } 7799 } 7800 7801// This is still on the jQuery object... for now 7802// Want to move this to jQuery.ajax some day 7803 jQuery.extend({ 7804 7805 // Counter for holding the number of active queries 7806 active: 0, 7807 7808 // Last-Modified header cache for next request 7809 lastModified: {}, 7810 etag: {} 7811 7812 }); 7813 7814 /* Handles responses to an ajax request: 7815 * - sets all responseXXX fields accordingly 7816 * - finds the right dataType (mediates between content-type and expected dataType) 7817 * - returns the corresponding response 7818 */ 7819 function ajaxHandleResponses(s, jqXHR, responses) { 7820 7821 var contents = s.contents, 7822 dataTypes = s.dataTypes, 7823 responseFields = s.responseFields, 7824 ct, 7825 type, 7826 finalDataType, 7827 firstDataType; 7828 7829 // Fill responseXXX fields 7830 for (type in responseFields) { 7831 if (type in responses) { 7832 jqXHR[responseFields[type]] = responses[type]; 7833 } 7834 } 7835 7836 // Remove auto dataType and get content-type in the process 7837 while (dataTypes[0] === "*") { 7838 dataTypes.shift(); 7839 if (ct === undefined) { 7840 ct = s.mimeType || jqXHR.getResponseHeader("content-type"); 7841 } 7842 } 7843 7844 // Check if we're dealing with a known content-type 7845 if (ct) { 7846 for (type in contents) { 7847 if (contents[type] && contents[type].test(ct)) { 7848 dataTypes.unshift(type); 7849 break; 7850 } 7851 } 7852 } 7853 7854 // Check to see if we have a response for the expected dataType 7855 if (dataTypes[0] in responses) { 7856 finalDataType = dataTypes[0]; 7857 } else {
7858 // Try convertible dataTypes 7859 for (type in responses) { 7860 if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) { 7861 finalDataType = type; 7862 break; 7863 } 7864 if (!firstDataType) { 7865 firstDataType = type; 7866 } 7867 } 7868 // Or just use first one 7869 finalDataType = finalDataType || firstDataType; 7870 } 7871 7872 // If we found a dataType 7873 // We add the dataType to the list if needed 7874 // and return the corresponding response 7875 if (finalDataType) { 7876 if (finalDataType !== dataTypes[0]) { 7877 dataTypes.unshift(finalDataType); 7878 } 7879 return responses[finalDataType]; 7880 } 7881 } 7882 7883// Chain conversions given the request and the original response 7884 function ajaxConvert(s, response) { 7885 7886 // Apply the dataFilter if provided 7887 if (s.dataFilter) { 7888 response = s.dataFilter(response, s.dataType); 7889 } 7890 7891 var dataTypes = s.dataTypes, 7892 converters = {}, 7893 i, 7894 key, 7895 length = dataTypes.length, 7896 tmp, 7897 // Current and previous dataTypes 7898 current = dataTypes[0], 7899 prev, 7900 // Conversion expression 7901 conversion, 7902 // Conversion function 7903 conv, 7904 // Conversion functions (transitive conversion) 7905 conv1, 7906 conv2; 7907 7908 // For each dataType in the chain 7909 for (i = 1; i < length; i++) { 7910 7911 // Create converters map 7912 // with lowercased keys 7913 if (i === 1) { 7914 for (key in s.converters) { 7915 if (typeof key === "string") { 7916 converters[key.toLowerCase()] = s.converters[key]; 7917 } 7918 } 7919 } 7920 7921 // Get the dataTypes 7922 prev = current; 7923 current = dataTypes[i]; 7924 7925 // If current is auto dataType, update it to prev 7926 if (current === "*") { 7927 current = prev; 7928 // If no auto and dataTypes are actually different 7929 } else if (prev !== "*" && prev !== current) { 7930 7931 // Get the converter 7932 conversion = prev + " " + current; 7933 conv = converters[conversion] || converters["* " + current]; 7934 7935 // If there is no direct converter, search transitively 7936 if (!conv) { 7937 conv2 = undefined; 7938 for (conv1 in converters) { 7939 tmp = conv1.split(" "); 7940 if (tmp[0] === prev || tmp[0] === "*") { 7941 conv2 = converters[tmp[1] + " " + current]; 7942 if (conv2) { 7943 conv1 = converters[conv1]; 7944 if (conv1 === true) { 7945 conv = conv2; 7946 } else if (conv2 === true) { 7947 conv = conv1; 7948 } 7949 break; 7950 } 7951 } 7952 } 7953 } 7954 // If we found no converter, dispatch an error 7955 if (!(conv || conv2)) { 7956 jQuery.error("No conversion from " + conversion.replace(" ", " to ")); 7957 } 7958 // If found converter is not an equivalence 7959 if (conv !== true) { 7960 // Convert with 1 or 2 converters accordingly 7961 response = conv ? conv(response) : conv2(conv1(response)); 7962 } 7963 } 7964 } 7965 return response; 7966 } 7967 7968 7969 var jsc = jQuery.now(), 7970 jsre = /(\=)\?(&|$)|\?\?/i; 7971 7972// Default jsonp settings 7973 jQuery.ajaxSetup({ 7974 jsonp: "callback", 7975 jsonpCallback: function () { 7976 return jQuery.expando + "_" + (jsc++); 7977 } 7978 }); 7979 7980// Detect, normalize options and install callbacks for jsonp requests 7981 jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) { 7982 7983 var inspectData = (typeof s.data === "string") && /^application\/x\-www\-form\-urlencoded/.test(s.contentType); 7984
7985 if (s.dataTypes[0] === "jsonp" || 7986 s.jsonp !== false && (jsre.test(s.url) || 7987 inspectData && jsre.test(s.data))) { 7988 7989 var responseContainer, 7990 jsonpCallback = s.jsonpCallback = 7991 jQuery.isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback, 7992 previous = window[jsonpCallback], 7993 url = s.url, 7994 data = s.data, 7995 replace = "$1" + jsonpCallback + "$2"; 7996 7997 if (s.jsonp !== false) { 7998 url = url.replace(jsre, replace); 7999 if (s.url === url) { 8000 if (inspectData) { 8001 data = data.replace(jsre, replace); 8002 } 8003 if (s.data === data) { 8004 // Add callback manually 8005 url += (/\?/.test(url) ? "&" : "?") + s.jsonp + "=" + jsonpCallback; 8006 } 8007 } 8008 } 8009 8010 s.url = url; 8011 s.data = data; 8012 8013 // Install callback 8014 window[jsonpCallback] = function (response) { 8015 responseContainer = [response]; 8016 }; 8017 8018 // Clean-up function 8019 jqXHR.always(function () { 8020 // Set callback back to previous value 8021 window[jsonpCallback] = previous; 8022 // Call if it was a function and we have a response 8023 if (responseContainer && jQuery.isFunction(previous)) { 8024 window[jsonpCallback](responseContainer[0]); 8025 } 8026 }); 8027 8028 // Use data converter to retrieve json after script execution 8029 s.converters["script json"] = function () { 8030 if (!responseContainer) { 8031 jQuery.error(jsonpCallback + " was not called"); 8032 } 8033 return responseContainer[0]; 8034 }; 8035 8036 // force json dataType 8037 s.dataTypes[0] = "json"; 8038 8039 // Delegate to script 8040 return "script"; 8041 } 8042 }); 8043 8044 8045// Install script dataType 8046 jQuery.ajaxSetup({ 8047 accepts: { 8048 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" 8049 }, 8050 contents: { 8051 script: /javascript|ecmascript/ 8052 }, 8053 converters: { 8054 "text script": function (text) { 8055 jQuery.globalEval(text); 8056 return text; 8057 } 8058 } 8059 }); 8060 8061// Handle cache's special case and global 8062 jQuery.ajaxPrefilter("script", function (s) { 8063 if (s.cache === undefined) { 8064 s.cache = false; 8065 } 8066 if (s.crossDomain) { 8067 s.type = "GET"; 8068 s.global = false; 8069 } 8070 }); 8071 8072// Bind script tag hack transport 8073 jQuery.ajaxTransport("script", function (s) { 8074 8075 // This transport only deals with cross domain requests 8076 if (s.crossDomain) { 8077 8078 var script, 8079 head = document.head || document.getElementsByTagName("head")[0] || document.documentElement; 8080 8081 return { 8082 8083 send: function (_, callback) { 8084 8085 script = document.createElement("script"); 8086 8087 script.async = "async"; 8088 8089 if (s.scriptCharset) { 8090 script.charset = s.scriptCharset; 8091 } 8092 8093 script.src = s.url; 8094 8095 // Attach handlers for all browsers 8096 script.onload = script.onreadystatechange = function (_, isAbort) { 8097 8098 if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState)) { 8099 8100 // Handle memory leak in IE 8101 script.onload = script.onreadystatechange = null; 8102 8103 // Remove the script 8104 if (head && script.parentNode) { 8105 head.removeChild(script); 8106 } 8107 8108 // Dereference the script 8109 script = undefined; 8110 8111 // Callback if not abort 8112 if (!isAbort) { 8113 callback(200, "success"); 8114 } 8115 } 8116 }; 8117 // Use insertBefore instead of appendChild to circumvent an IE6 bug. 8118 // This arises when a base node is used (#2709 and #4378). 8119 head.insertBefore(script, head.firstChild); 8120 }, 8121 8122 abort: function () { 8123 if (script) { 8124 script.onload(0, 1); 8125 } 8126 } 8127 }; 8128 } 8129 }); 8130 8131 8132 var // #5280: Internet Explorer will keep connections alive if we don't abort on unload 8133 xhrOnUnloadAbort = window.ActiveXObject ? function () { 8134 // Abort all pending requests
vendor: 7,419 bytes, lines 8135-8303
8135 for (var key in xhrCallbacks) { 8136 xhrCallbacks[key](0, 1); 8137 } 8138 } : false, 8139 xhrId = 0, 8140 xhrCallbacks; 8141 8142// Functions to create xhrs 8143 function createStandardXHR() { 8144 try { 8145 return new window.XMLHttpRequest(); 8146 } catch (e) { 8147 } 8148 } 8149 8150 function createActiveXHR() { 8151 try { 8152 return new window.ActiveXObject("Microsoft.XMLHTTP"); 8153 } catch (e) { 8154 } 8155 } 8156 8157// Create the request object 8158// (This is still attached to ajaxSettings for backward compatibility) 8159 jQuery.ajaxSettings.xhr = window.ActiveXObject ? 8160 /* Microsoft failed to properly 8161 * implement the XMLHttpRequest in IE7 (can't request local files), 8162 * so we use the ActiveXObject when it is available 8163 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so 8164 * we need a fallback. 8165 */ 8166 function () { 8167 return !this.isLocal && createStandardXHR() || createActiveXHR(); 8168 } : 8169 // For all other browsers, use the standard XMLHttpRequest object 8170 createStandardXHR; 8171 8172// Determine support properties 8173 (function (xhr) { 8174 jQuery.extend(jQuery.support, { 8175 ajax: !!xhr, 8176 cors: !!xhr && ("withCredentials" in xhr) 8177 }); 8178 })(jQuery.ajaxSettings.xhr()); 8179 8180// Create transport if the browser can provide an xhr 8181 if (jQuery.support.ajax) { 8182 8183 jQuery.ajaxTransport(function (s) { 8184 // Cross domain only allowed if supported through XMLHttpRequest 8185 if (!s.crossDomain || jQuery.support.cors) { 8186 8187 var callback; 8188 8189 return { 8190 send: function (headers, complete) { 8191 8192 // Get a new xhr 8193 var xhr = s.xhr(), 8194 handle, 8195 i; 8196 8197 // Open the socket 8198 // Passing null username, generates a login popup on Opera (#2865) 8199 if (s.username) { 8200 xhr.open(s.type, s.url, s.async, s.username, s.password); 8201 } else { 8202 xhr.open(s.type, s.url, s.async); 8203 } 8204 8205 // Apply custom fields if provided 8206 if (s.xhrFields) { 8207 for (i in s.xhrFields) { 8208 xhr[i] = s.xhrFields[i]; 8209 } 8210 } 8211 8212 // Override mime type if needed 8213 if (s.mimeType && xhr.overrideMimeType) { 8214 xhr.overrideMimeType(s.mimeType); 8215 } 8216 8217 // X-Requested-With header 8218 // For cross-domain requests, seeing as conditions for a preflight are 8219 // akin to a jigsaw puzzle, we simply never set it to be sure. 8220 // (it can always be set on a per-request basis or even using ajaxSetup) 8221 // For same-domain requests, won't change header if already provided. 8222 if (!s.crossDomain && !headers["X-Requested-With"]) { 8223 headers["X-Requested-With"] = "XMLHttpRequest"; 8224 } 8225 8226 // Need an extra try/catch for cross domain requests in Firefox 3 8227 try { 8228 for (i in headers) { 8229 xhr.setRequestHeader(i, headers[i]); 8230 } 8231 } catch (_) { 8232 } 8233 8234 // Do send the request 8235 // This may raise an exception which is actually 8236 // handled in jQuery.ajax (so no try/catch here) 8237 xhr.send((s.hasContent && s.data) || null); 8238 8239 // Listener 8240 callback = function (_, isAbort) { 8241 8242 var status, 8243 statusText, 8244 responseHeaders, 8245 responses, 8246 xml; 8247 8248 // Firefox throws exceptions when accessing properties 8249 // of an xhr when a network error occured 8250 // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) 8251 try { 8252 8253 // Was never called and is aborted or complete 8254 if (callback && (isAbort || xhr.readyState === 4)) { 8255 8256 // Only called once 8257 callback = undefined; 8258 8259 // Do not keep as active anymore 8260 if (handle) { 8261 xhr.onreadystatechange = jQuery.noop; 8262 if (xhrOnUnloadAbort) { 8263 delete xhrCallbacks[handle]; 8264 } 8265 } 8266 8267 // If it's an abort 8268 if (isAbort) { 8269 // Abort it manually if needed 8270 if (xhr.readyState !== 4) { 8271 xhr.abort(); 8272 } 8273 } else { 8274 status = xhr.status; 8275 responseHeaders = xhr.getAllResponseHeaders(); 8276 responses = {}; 8277 xml = xhr.responseXML; 8278 8279 // Construct response list 8280 if (xml && xml.documentElement /* #4958 */) { 8281 responses.xml = xml; 8282 } 8283 8284 // When requesting binary data, IE6-9 will throw an exception 8285 // on any attempt to access responseText (#11426) 8286 try { 8287 responses.text = xhr.responseText; 8288 } catch (_) { 8289 } 8290 8291 // Firefox throws an exception when accessing 8292 // statusText for faulty cross-domain requests 8293 try { 8294 statusText = xhr.statusText; 8295 } catch (e) { 8296 // We normalize with Webkit giving an empty statusText 8297 statusText = ""; 8298 } 8299 8300 // Filter status for non standard behaviors 8301 8302 // If the request is local and we have data: assume a success 8303 // (success with no data won't get notified, that's the best we
8304 // can do given current implementations) 8305 if (!status && s.isLocal && !s.crossDomain) { 8306 status = responses.text ? 200 : 404; 8307 // IE - #1450: sometimes returns 1223 when it should be 204 8308 } else if (status === 1223) { 8309 status = 204; 8310 } 8311 } 8312 } 8313 } catch (firefoxAccessException) { 8314 if (!isAbort) { 8315 complete(-1, firefoxAccessException); 8316 } 8317 } 8318 8319 // Call complete if needed 8320 if (responses) { 8321 complete(status, statusText, responses, responseHeaders); 8322 } 8323 }; 8324 8325 // if we're in sync mode or it's in cache 8326 // and has been retrieved directly (IE6 & IE7) 8327 // we need to manually fire the callback 8328 if (!s.async || xhr.readyState === 4) { 8329 callback(); 8330 } else { 8331 handle = ++xhrId; 8332 if (xhrOnUnloadAbort) { 8333 // Create the active xhrs callbacks list if needed 8334 // and attach the unload handler 8335 if (!xhrCallbacks) { 8336 xhrCallbacks = {}; 8337 jQuery(window).unload(xhrOnUnloadAbort); 8338 } 8339 // Add to list of active xhrs callbacks 8340 xhrCallbacks[handle] = callback; 8341 } 8342 xhr.onreadystatechange = callback; 8343 } 8344 }, 8345 8346 abort: function () { 8347 if (callback) { 8348 callback(0, 1); 8349 } 8350 } 8351 }; 8352 } 8353 }); 8354 } 8355 8356 8357 var elemdisplay = {}, 8358 iframe, iframeDoc, 8359 rfxtypes = /^(?:toggle|show|hide)$/, 8360 rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i, 8361 timerId, 8362 fxAttrs = [ 8363 // height animations 8364 ["height", "marginTop", "marginBottom", "paddingTop", "paddingBottom"], 8365 // width animations 8366 ["width", "marginLeft", "marginRight", "paddingLeft", "paddingRight"], 8367 // opacity animations 8368 ["opacity"] 8369 ], 8370 fxNow; 8371 8372 jQuery.fn.extend({ 8373 show: function (speed, easing, callback) { 8374 var elem, display; 8375 8376 if (speed || speed === 0) { 8377 return this.animate(genFx("show", 3), speed, easing, callback); 8378 8379 } else { 8380 for (var i = 0, j = this.length; i < j; i++) { 8381 elem = this[i]; 8382 8383 if (elem.style) { 8384 display = elem.style.display; 8385 8386 // Reset the inline display of this element to learn if it is 8387 // being hidden by cascaded rules or not 8388 if (!jQuery._data(elem, "olddisplay") && display === "none") { 8389 display = elem.style.display = ""; 8390 } 8391 8392 // Set elements which have been overridden with display: none 8393 // in a stylesheet to whatever the default browser style is 8394 // for such an element 8395 if ((display === "" && jQuery.css(elem, "display") === "none") || 8396 !jQuery.contains(elem.ownerDocument.documentElement, elem)) { 8397 jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName)); 8398 } 8399 } 8400 } 8401 8402 // Set the display of most of the elements in a second loop 8403 // to avoid the constant reflow 8404 for (i = 0; i < j; i++) { 8405 elem = this[i]; 8406 8407 if (elem.style) { 8408 display = elem.style.display; 8409 8410 if (display === "" || display === "none") { 8411 elem.style.display = jQuery._data(elem, "olddisplay") || ""; 8412 } 8413 } 8414 } 8415 8416 return this; 8417 } 8418 }, 8419 8420 hide: function (speed, easing, callback) { 8421 if (speed || speed === 0) { 8422 return this.animate(genFx("hide", 3), speed, easing, callback); 8423 8424 } else { 8425 var elem, display, 8426 i = 0, 8427 j = this.length; 8428 8429 for (; i < j; i++) { 8430 elem = this[i]; 8431 if (elem.style) {
8432 display = jQuery.css(elem, "display"); 8433 8434 if (display !== "none" && !jQuery._data(elem, "olddisplay")) { 8435 jQuery._data(elem, "olddisplay", display); 8436 } 8437 } 8438 } 8439 8440 // Set the display of the elements in a second loop 8441 // to avoid the constant reflow 8442 for (i = 0; i < j; i++) { 8443 if (this[i].style) { 8444 this[i].style.display = "none"; 8445 } 8446 } 8447 8448 return this; 8449 } 8450 }, 8451 8452 // Save the old toggle function 8453 _toggle: jQuery.fn.toggle, 8454 8455 toggle: function (fn, fn2, callback) { 8456 var bool = typeof fn === "boolean"; 8457 8458 if (jQuery.isFunction(fn) && jQuery.isFunction(fn2)) { 8459 this._toggle.apply(this, arguments); 8460 8461 } else if (fn == null || bool) { 8462 this.each(function () { 8463 var state = bool ? fn : jQuery(this).is(":hidden"); 8464 jQuery(this)[state ? "show" : "hide"](); 8465 }); 8466 8467 } else { 8468 this.animate(genFx("toggle", 3), fn, fn2, callback); 8469 } 8470 8471 return this; 8472 }, 8473 8474 fadeTo: function (speed, to, easing, callback) { 8475 return this.filter(":hidden").css("opacity", 0).show().end() 8476 .animate({opacity: to}, speed, easing, callback); 8477 }, 8478 8479 animate: function (prop, speed, easing, callback) { 8480 var optall = jQuery.speed(speed, easing, callback); 8481 8482 if (jQuery.isEmptyObject(prop)) { 8483 return this.each(optall.complete, [false]); 8484 } 8485 8486 // Do not change referenced properties as per-property easing will be lost 8487 prop = jQuery.extend({}, prop); 8488 8489 function doAnimation() { 8490 // XXX 'this' does not always have a nodeName when running the 8491 // test suite 8492 8493 if (optall.queue === false) { 8494 jQuery._mark(this); 8495 } 8496 8497 var opt = jQuery.extend({}, optall), 8498 isElement = this.nodeType === 1, 8499 hidden = isElement && jQuery(this).is(":hidden"), 8500 name, val, p, e, hooks, replace, 8501 parts, start, end, unit, 8502 method; 8503 8504 // will store per property easing and be used to determine when an animation is complete 8505 opt.animatedProperties = {}; 8506 8507 // first pass over propertys to expand / normalize 8508 for (p in prop) { 8509 name = jQuery.camelCase(p); 8510 if (p !== name) { 8511 prop[name] = prop[p]; 8512 delete prop[p]; 8513 } 8514 8515 if ((hooks = jQuery.cssHooks[name]) && "expand" in hooks) { 8516 replace = hooks.expand(prop[name]); 8517 delete prop[name]; 8518 8519 // not quite $.extend, this wont overwrite keys already present. 8520 // also - reusing 'p' from above because we have the correct "name" 8521 for (p in replace) { 8522 if (!(p in prop)) { 8523 prop[p] = replace[p]; 8524 } 8525 } 8526 } 8527 } 8528 8529 for (name in prop) { 8530 val = prop[name]; 8531 // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default) 8532 if (jQuery.isArray(val)) { 8533 opt.animatedProperties[name] = val[1]; 8534 val = prop[name] = val[0]; 8535 } else { 8536 opt.animatedProperties[name] = opt.specialEasing && opt.specialEasing[n
8536ame] || opt.easing || 'swing'; 8537 } 8538 8539 if (val === "hide" && hidden || val === "show" && !hidden) { 8540 return opt.complete.call(this); 8541 } 8542 8543 if (isElement && (name === "height" || name === "width")) { 8544 // Make sure that nothing sneaks out 8545 // Record all 3 overflow attributes because IE does not 8546 // change the overflow attribute when overflowX and 8547 // overflowY are set to the same value 8548 opt.overflow = [this.style.overflow, this.style.overflowX, this.style.overflowY]; 8549 8550 // Set display property to inline-block for height/width 8551 // animations on inline elements that are having width/height animated 8552 if (jQuery.css(this, "display") === "inline" && 8553 jQuery.css(this, "float") === "none") { 8554 8555 // inline-level elements accept inline-block; 8556 // block-level elements need to be inline with layout 8557 if (!jQuery.support.inlineBlockNeedsLayout || defaultDisplay(this.nodeName) === "inline") { 8558 this.style.display = "inline-block"; 8559 8560 } else { 8561 this.style.zoom = 1; 8562 } 8563 } 8564 } 8565 } 8566 8567 if (opt.overflow != null) { 8568 this.style.overflow = "hidden"; 8569 } 8570 8571 for (p in prop) { 8572 e = new jQuery.fx(this, opt, p); 8573 val = prop[p]; 8574 8575 if (rfxtypes.test(val)) { 8576 8577 // Tracks whether to show or hide based on private 8578 // data attached to the element 8579 method = jQuery._data(this, "toggle" + p) || (val === "toggle" ? hidden ? "show" : "hide" : 0); 8580 if (method) { 8581 jQuery._data(this, "toggle" + p, method === "show" ? "hide" : "show"); 8582 e[method](); 8583 } else { 8584 e[val](); 8585 } 8586 8587 } else { 8588 parts = rfxnum.exec(val); 8589 start = e.cur(); 8590 8591 if (parts) { 8592 end = parseFloat(parts[2]); 8593 unit = parts[3] || (jQuery.cssNumber[p] ? "" : "px"); 8594 8595 // We need to compute starting value 8596 if (unit !== "px") { 8597 jQuery.style(this, p, (end || 1) + unit); 8598 start = ((end || 1) / e.cur()) * start; 8599 jQuery.style(this, p, start + unit); 8600 } 8601 8602 // If a +=/-= token was provided, we're doing a relative animation 8603 if (parts[1]) { 8604 end = ((parts[1] === "-=" ? -1 : 1) * end) + start; 8605 } 8606 8607 e.custom(start, end, unit); 8608 8609 } else { 8610 e.custom(start, val, ""); 8611 } 8612 } 8613 } 8614 8615 // For JS strict compliance 8616 return true; 8617 } 8618 8619 return optall.queue === false ? 8620 this.each(doAnimation) : 8621 this.queue(optall.queue, doAnimation); 8622 }, 8623 8624 stop: function (type, clearQueue, gotoEnd) { 8625 if (typeof type !== "string") { 8626 gotoEnd = clearQueue; 8627 clearQueue = type; 8628 type = undefined; 8629 } 8630 if (clearQueue && type !== false) { 8631 this.queue(type || "fx", []); 8632 } 8633 8634 return this.each(function () { 8635 var index, 8636 hadTimers = false, 8637 timers = jQuery.timers, 8638 data = jQuery._data(this); 8639 8640 // clear marker counters if we know they won't be 8641 if (!gotoEnd) { 8642 jQuery._unmark(true, this); 8643 } 8644 8645 function stopQueue(elem, data, index) { 8646 var hooks = data[index]; 8647 jQuery.removeData(elem, index, true); 8648 hooks.stop(gotoEnd); 8649 } 8650 8651 if (type == null) { 8652 for (index in data) { 8653 if (data[index] && data[index].stop && index.indexOf(".run") === index.length - 4) { 8654 stopQueue(this, data, index); 8655 } 8656 } 8657 } else if (data[index = type + ".run"] && data[index].stop) { 8658 stopQueue(this, data, index); 8659 } 8660 8661 for (index = timers.length; index--;) { 8662 if (timers[index].elem === this && (type == null || timers[index].queue === type)) { 8663 if (gotoEnd) { 8664 8665 // force the next step to be the last 8666 timers[index](true); 8667 } else { 8668 timers[index].saveState(); 8669 } 8670 hadTimers = true; 8671 timers.splice(index, 1); 8672 } 8673 } 8674 8675 // start the next in the queue if the last step wasn't forced 8676 // timers currently will call their complete callbacks, which will dequeue 8677 // but only if they were gotoEnd 8678 if (!(gotoEnd && hadTimers)) { 8679 jQuery.dequeue(this, type); 8680 } 8681 }); 8682 } 8683 8684 }); 8685 8686// Animations created synchronously will run synchronously 8687 function createFxNow() { 8688 setTimeout(clearFxNow, 0); 8689 return (fxNow = jQuery.now()); 8690 } 8691 8692 function clearFxNow() { 8693 fxNow = undefined; 8694 } 8695 8696// Generate parameters to create a standard animation 8697 function genFx(type, num) { 8698 var obj = {}; 8699 8700 jQuery.each(fxAttrs.concat.apply([], fxAttrs.slice(0, num)), function () { 8701 obj[this] = type; 8702 }); 8703 8704 return obj; 8705 } 8706 8707// Generate shortcuts for custom animations 8708 jQuery.each({ 8709 slideDown: genFx("show", 1), 8710 slideUp: genFx("hide", 1), 8711 slideToggle: genFx("toggle", 1), 8712 fadeIn: {opacity: "show"}, 8713 fadeOut: {opacity: "hide"}, 8714 fadeToggle: {opacity: "toggle"} 8715 }, function (name, props) { 8716 jQuery.fn[name] = function (speed, easing, callback) { 8717 return this.animate(props, speed, easing, callback); 8718 }; 8719 }); 8720 8721 jQuery.extend({ 8722 speed: function (speed, easing, fn) { 8723 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : { 8724 complete: fn || !fn && easing || 8725 jQuery.isFunction(speed) && speed, 8726 duration: speed, 8727 easing: fn && easing || easing && !jQuery.isFunction(easing) && easing 8728 }; 8729 8730 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : 8731 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default; 8732 8733 // normalize opt.queue - true/undefined/null -> "fx" 8734 if (opt.queue == null || opt.queue === true) { 8735 opt.queue = "fx"; 8736 } 8737 8738 // Queueing 8739 opt.old = opt.complete; 8740 8741 opt.complete = function (noUnmark) { 8742 if (jQuery.isFunction(opt.old)) { 8743 opt.old.call(this); 8744 } 8745 8746 if (opt.queue) { 8747 jQuery.dequeue(this, opt.queue); 8748 } else if (noUnmark !== false) { 8749 jQuery._unmark(this); 8750 } 8751 }; 8752 8753 return opt; 8754 }, 8755 8756 easing: { 8757 linear: function (p) { 8758 return p; 8759 }, 8760 swing: function (p) { 8761 return (-Math.cos(p * Math.PI) / 2) + 0.5; 8762 } 8763 }, 8764 8765 timers: [], 8766 8767 fx: function (elem, options, prop) { 8768 this.options = options; 8769 this.elem = elem; 8770 this.prop = prop; 8771 8772 options.orig = options.orig || {}; 8773 } 8774 8775 }); 8776 8777 jQuery.fx.prototype = { 8778 // Simple function for setting a style value 8779 update: function () { 8780 if (this.options.step) { 8781 this.options.step.call(this.elem, this.now, this); 8782 } 8783 8784 (jQuery.fx.step[this.prop] || jQuery.fx.step._default)(this); 8785 }, 8786 8787 // Get the current size 8788 cur: function () { 8789 if (this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null)) { 8790 return this.elem[this.prop]; 8791 } 8792 8793 var parsed, 8794 r = jQuery.css(this.elem, this.prop); 8795 // Empty strings, null, undefined and "auto" are converted to 0, 8796 // complex values such as "rotate(1rad)" are returned as is, 8797 // simple values such as "10px" are parsed to Float. 8798 return isNaN(parsed = parseFloat(r)) ? !r || r === "auto" ? 0 : r : parsed; 8799 }, 8800 8801 // Start an animation from one number to another 8802 custom: function (from, to, unit) { 8803 var self = this, 8804 fx = jQuery.fx; 8805 8806 this.startTime = fxNow || createFxNow(); 8807 this.end = to; 8808 this.now = this.start = from; 8809 this.pos = this.state = 0; 8810 this.unit = unit || this.unit || (jQuery.cssNumber[this.prop] ? "" : "px"); 8811 8812 function t(gotoEnd) { 8813 return self.step(gotoEnd); 8814 } 8815 8816 t.queue = this.options.queue; 8817 t.elem = this.elem; 8818 t.saveState = function () { 8819 if (jQuery._data(self.elem, "fxshow" + self.prop) === undefined) { 8820 if (self.options.hide) { 8821 jQuery._data(self.elem, "fxshow" + self.prop, self.start); 8822 } else if (self.options.show) { 8823 jQuery._data(self.elem, "fxshow" + self.prop, self.end); 8824 } 8825 } 8826 }; 8827 8828 if (t() && jQuery.timers.push(t) && !timerId) { 8829 timerId = setInterval(fx.tick, fx.interval); 8830 } 8831 }, 8832 8833 // Simple 'show' function 8834 show: function () { 8835 var dataShow = jQuery._data(this.elem, "fxshow" + this.prop); 8836 8837 // Remember where we started, so that we can go back to it later 8838 this.options.orig[this.prop] = dataShow || jQuery.style(this.elem, this.prop); 8839 this.options.show = true; 8840 8841 // Begin the animation 8842 // Make sure that we start at a small width/height to avoid any flash of content 8843 if (dataShow !== undefined) { 8844 // This show is picking up where a previous hide or show left off 8845 this.custom(this.cur(), dataShow); 8846 } else { 8847 this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur()); 8848 } 8849 8850 // Start by showing the element 8851 jQuery(this.elem).show(); 8852 }, 8853 8854 // Simple 'hide' function 8855 hide: function () { 8856 // Remember where we started, so that we can go back to it later 8857 this.options.orig[this.prop] = jQuery._data(this.elem, "fxshow" + this.prop) || jQuery.style(this.elem, this.prop); 8858 this.options.hide = true; 8859 8860 // Begin the animation 8861 this.custom(this.cur(), 0); 8862 }, 8863 8864 // Each step of an animation 8865 step: function (gotoEnd) { 8866 var p, n, complete, 8867 t = fxNow || createFxNow(), 8868 done = true, 8869 elem = this.elem, 8870 options = this.options; 8871 8872 if (gotoEnd || t >= options.duration + this.startTime) { 8873 this.now = this.end; 8874 this.pos = this.state = 1; 8875 this.update(); 8876 8877 options.animatedProperties[this.prop] = true; 8878 8879 for (p in options.animatedProperties) { 8880 if (options.animatedProperties[p] !== true) { 8881 done = false;
8882 } 8883 } 8884 8885 if (done) { 8886 // Reset the overflow 8887 if (options.overflow != null && !jQuery.support.shrinkWrapBlocks) { 8888 8889 jQuery.each(["", "X", "Y"], function (index, value) { 8890 elem.style["overflow" + value] = options.overflow[index]; 8891 }); 8892 } 8893 8894 // Hide the element if the "hide" operation was done 8895 if (options.hide) { 8896 jQuery(elem).hide(); 8897 } 8898 8899 // Reset the properties, if the item has been hidden or shown 8900 if (options.hide || options.show) { 8901 for (p in options.animatedProperties) { 8902 jQuery.style(elem, p, options.orig[p]); 8903 jQuery.removeData(elem, "fxshow" + p, true); 8904 // Toggle data is no longer needed 8905 jQuery.removeData(elem, "toggle" + p, true); 8906 } 8907 } 8908 8909 // Execute the complete function 8910 // in the event that the complete function throws an exception 8911 // we must ensure it won't be called twice. #5684 8912 8913 complete = options.complete; 8914 if (complete) { 8915 8916 options.complete = false; 8917 complete.call(elem); 8918 } 8919 } 8920 8921 return false; 8922 8923 } else { 8924 // classical easing cannot be used with an Infinity duration 8925 if (options.duration == Infinity) { 8926 this.now = t; 8927 } else { 8928 n = t - this.startTime; 8929 this.state = n / options.duration; 8930 8931 // Perform the easing function, defaults to swing 8932 this.pos = jQuery.easing[options.animatedProperties[this.prop]](this.state, n, 0, 1, options.duration);
8933 this.now = this.start + ((this.end - this.start) * this.pos); 8934 } 8935 // Perform the next step of the animation 8936 this.update(); 8937 } 8938 8939 return true; 8940 } 8941 }; 8942 8943 jQuery.extend(jQuery.fx, { 8944 tick: function () { 8945 var timer, 8946 timers = jQuery.timers, 8947 i = 0; 8948 8949 for (; i < timers.length; i++) { 8950 timer = timers[i]; 8951 // Checks the timer has not already been removed 8952 if (!timer() && timers[i] === timer) { 8953 timers.splice(i--, 1); 8954 } 8955 } 8956 8957 if (!timers.length) { 8958 jQuery.fx.stop(); 8959 } 8960 }, 8961 8962 interval: 13, 8963 8964 stop: function () { 8965 clearInterval(timerId); 8966 timerId = null; 8967 }, 8968 8969 speeds: { 8970 slow: 600, 8971 fast: 200, 8972 // Default speed 8973 _default: 400 8974 }, 8975 8976 step: { 8977 opacity: function (fx) { 8978 jQuery.style(fx.elem, "opacity", fx.now); 8979 }, 8980 8981 _default: function (fx) { 8982 if (fx.elem.style && fx.elem.style[fx.prop] != null) { 8983 fx.elem.style[fx.prop] = fx.now + fx.unit; 8984 } else { 8985 fx.elem[fx.prop] = fx.now; 8986 } 8987 } 8988 } 8989 }); 8990 8991// Ensure props that can't be negative don't go there on undershoot easing 8992 jQuery.each(fxAttrs.concat.apply([], fxAttrs), function (i, prop) { 8993 // exclude marginTop, marginLeft, marginBottom and marginRight from this list 8994 if (prop.indexOf("margin")) { 8995 jQuery.fx.step[prop] = function (fx) { 8996 jQuery.style(fx.elem, prop, Math.max(0, fx.now) + fx.unit); 8997 }; 8998 } 8999 }); 9000 9001 if (jQuery.expr && jQuery.expr.filters) { 9002 jQuery.expr.filters.animated = function (elem) { 9003 return jQuery.grep(jQuery.timers, function (fn) { 9004 return elem === fn.elem; 9005 }).length; 9006 }; 9007 } 9008 9009// Try to restore the default display value of an element 9010 function defaultDisplay(nodeName) { 9011 9012 if (!elemdisplay[nodeName]) { 9013 9014 var body = document.body, 9015 elem = jQuery("<" + nodeName + ">").appendTo(body), 9016 display = elem.css("display"); 9017 elem.remove(); 9018 9019 // If the simple way fails, 9020 // get element's real default display by attaching it to a temp iframe 9021 if (display === "none" || display === "") { 9022 // No iframe to use yet, so create it 9023 if (!iframe) { 9024 iframe = document.createElement("iframe"); 9025 iframe.frameBorder = iframe.width = iframe.height = 0; 9026 } 9027 9028 body.appendChild(iframe); 9029 9030 // Create a cacheable copy of the iframe document on first call. 9031 // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML 9032 // document to it; WebKit & Firefox won't allow reusing the iframe document. 9033 if (!iframeDoc || !iframe.createElement) { 9034 iframeDoc = (iframe.contentWindow || iframe.contentDocument).document; 9035 iframeDoc.write((jQuery.support.boxModel ? "<!doctype html>" : "") + "<html><body>"); 9036 iframeDoc.close(); 9037 } 9038 9039 elem = iframeDoc.createElement(nodeName); 9040 9041 iframeDoc.body.appendChild(elem); 9042 9043 display = jQuery.css(elem, "display"); 9044 body.removeChild(iframe); 9045 } 9046 9047 // Store the correct default display 9048 elemdisplay[nodeName] = display; 9049 } 9050 9051 return elemdisplay[nodeName]; 9052 } 9053 9054 9055 var getOffset, 9056 rtable = /^t(?:able|d|h)$/i, 9057 rroot = /^(?:body|html)$/i; 9058 9059 if ("getBoundingClientRect" in document.documentElement) { 9060 getOffset = function (elem, doc, docElem, box) { 9061 try { 9062 box = elem.getBoundingClientRect(); 9063 } catch (e) { 9064 } 9065 9066 // Make sure we're not dealing with a disconnected DOM node 9067 if (!box || !jQuery.contains(docElem, elem)) { 9068 return box ? {top: box.top, left: box.left} : {top: 0, left: 0}; 9069 } 9070 9071 var body = doc.body, 9072 win = getWindow(doc), 9073 clientTop = docElem.clientTop || body.clientTop || 0, 9074 clientLeft = docElem.clientLeft || body.clientLeft || 0, 9075 scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop, 9076 scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft, 9077 top = box.top + scrollTop - clientTop, 9078 left = box.left + scrollLeft - clientLeft; 9079 9080 return {top: top, left: left}; 9081 }; 9082 9083 } else { 9084 getOffset = function (elem, doc, docElem) { 9085 var computedStyle, 9086 offsetParent = elem.offsetParent, 9087 prevOffsetParent = elem, 9088 body = doc.body, 9089 defaultView = doc.defaultView, 9090 prevComputedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle, 9091 top = elem.offsetTop, 9092 left = elem.offsetLeft; 9093 9094 while ((elem = elem.parentNode) && elem !== body && elem !== docElem) { 9095 if (jQuery.support.fixedPosition && prevComputedStyle.position === "fixed") { 9096 break; 9097 } 9098 9099 computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle; 9100 top -= elem.scrollTop; 9101 left -= elem.scrollLeft; 9102 9103 if (elem === offsetParent) { 9104 top += elem.offsetTop; 9105 left += elem.offsetLeft; 9106 9107 if (jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName))) { 9108 top += parseFloat(computedStyle.borderTopWidth) || 0; 9109 left += parseFloat(computedStyle.borderLeftWidth) || 0; 9110 } 9111 9112 prevOffsetParent = offsetParent; 9113 offsetParent = elem.offsetParent; 9114 } 9115 9116 if (jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible") { 9117 top += parseFloat(computedStyle.borderTopWidth) || 0; 9118 left += parseFloat(computedStyle.borderLeftWidth) || 0; 9119 } 9120 9121 prevComputedStyle = computedStyle; 9122 } 9123 9124 if (prevComputedStyle.position === "relative" || prevComputedStyle.position === "static") { 9125 top += body.offsetTop; 9126 left += body.offsetLeft; 9127 } 9128 9129 if (jQuery.support.fixedPosition && prevComputedStyle.position === "fixed") { 9130 top += Math.max(docElem.scrollTop, body.scrollTop); 9131 left += Math.max(docElem.scrollLeft, body.scrollLeft); 9132 } 9133 9134 return {top: top, left: left}; 9135 }; 9136 } 9137 9138 jQuery.fn.offset = function (options) { 9139 if (arguments.length) { 9140 return options === undefined ? 9141 this : 9142 this.each(function (i) { 9143 jQuery.offset.setOffset(this, options, i); 9144 }); 9145 } 9146 9147 var elem = this[0], 9148 doc = elem && elem.ownerDocument; 9149 9150 if (!doc) { 9151 return null; 9152 } 9153 9154 if (elem === doc.body) { 9155 return jQuery.offset.bodyOffset(elem); 9156 } 9157 9158 return getOffset(elem, doc, doc.documentElement); 9159 }; 9160 9161 jQuery.offset = { 9162 9163 bodyOffset: function (body) { 9164 var top = body.offsetTop, 9165 left = body.offsetLeft; 9166 9167 if (jQuery.support.doesNotIncludeMarginInBodyOffset) { 9168 top += parseFloat(jQuery.css(body, "marginTop")) || 0; 9169 left += parseFloat(jQuery.css(body, "marginLeft")) || 0; 9170 } 9171 9172 return {top: top, left: left}; 9173 }, 9174 9175 setOffset: function (elem, options, i) { 9176 var position = jQuery.css(elem, "position"); 9177 9178 // set position first, in-case top/left are set even on static elem 9179 if (position === "static") { 9180 elem.style.position = "relative"; 9181 } 9182 9183 var curElem = jQuery(elem), 9184 curOffset = curElem.offset(), 9185 curCSSTop = jQuery.css(elem, "top"), 9186 curCSSLeft = jQuery.css(elem, "left"), 9187 calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, 9188 props = {}, curPosition = {}, curTop, curLeft; 9189 9190 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed 9191 if (calculatePosition) { 9192 curPosition = curElem.position(); 9193 curTop = curPosition.top; 9194 curLeft = curPosition.left; 9195 } else { 9196 curTop = parseFloat(curCSSTop) || 0; 9197 curLeft = parseFloat(curCSSLeft) || 0; 9198 } 9199 9200 if (jQuery.isFunction(options)) { 9201 options = options.call(elem, i, curOffset); 9202 } 9203 9204 if (options.top != null) { 9205 props.top = (options.top - curOffset.top) + curTop; 9206 } 9207 if (options.left != null) { 9208 props.left = (options.left - curOffset.left) + curLeft; 9209 } 9210 9211 if ("using" in options) { 9212 options.using.call(elem, props); 9213 } else { 9214 curElem.css(props); 9215 } 9216 } 9217 }; 9218 9219 9220 jQuery.fn.extend({ 9221 9222 position: function () { 9223 if (!this[0]) { 9224 return null; 9225 } 9226 9227 var elem = this[0], 9228 9229 // Get *real* offsetParent 9230 offsetParent = this.offsetParent(), 9231 9232 // Get correct offsets 9233 offset = this.offset(), 9234 parentOffset = rroot.test(offsetParent[0].nodeName) ? {top: 0, left: 0} : offsetParent.offset(); 9235 9236 // Subtract element margins 9237 // note: when an element has margin: auto the offsetLeft and marginLeft 9238 // are the same in Safari causing offset.left to incorrectly be 0 9239 offset.top -= parseFloat(jQuery.css(elem, "marginTop")) || 0; 9240 offset.left -= parseFloat(jQuery.css(elem, "marginLeft")) || 0; 9241 9242 // Add offsetParent borders 9243 parentOffset.top += parseFloat(jQuery.css(offsetParent[0], "borderTopWidth")) || 0; 9244 parentOffset.left += parseFloat(jQuery.css(offsetParent[0], "borderLeftWidth")) || 0; 9245 9246 // Subtract the two offsets 9247 return { 9248 top: offset.top - parentOffset.top, 9249 left: offset.left - parentOffset.left 9250 }; 9251 }, 9252 9253 offsetParent: function () { 9254 return this.map(function () { 9255 var offsetParent = this.offsetParent || document.body; 9256 while (offsetParent && (!rroot.test(offsetParent.
9256nodeName) && jQuery.css(offsetParent, "position") === "static")) { 9257 offsetParent = offsetParent.offsetParent; 9258 } 9259 return offsetParent; 9260 }); 9261 } 9262 }); 9263 9264 9265// Create scrollLeft and scrollTop methods 9266 jQuery.each({scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function (method, prop) { 9267 var top = /Y/.test(prop); 9268 9269 jQuery.fn[method] = function (val) { 9270 return jQuery.access(this, function (elem, method, val) { 9271 var win = getWindow(elem); 9272 9273 if (val === undefined) { 9274 return win ? (prop in win) ? win[prop] : 9275 jQuery.support.boxModel && win.document.documentElement[method] || 9276 win.document.body[method] : 9277 elem[method]; 9278 } 9279 9280 if (win) { 9281 win.scrollTo( 9282 !top ? val : jQuery(win).scrollLeft(), 9283 top ? val : jQuery(win).scrollTop() 9284 ); 9285 9286 } else { 9287 elem[method] = val; 9288 } 9289 }, method, val, arguments.length, null); 9290 }; 9291 }); 9292 9293 function getWindow(elem) { 9294 return jQuery.isWindow(elem) ? 9295 elem : 9296 elem.nodeType === 9 ? 9297 elem.defaultView || elem.parentWindow : 9298 false; 9299 } 9300 9301 9302// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods 9303 jQuery.each({Height: "height", Width: "width"}, function (name, type) { 9304 var clientProp = "client" + name, 9305 scrollProp = "scroll" + name, 9306 offsetProp = "offset" + name; 9307 9308 // innerHeight and innerWidth 9309 jQuery.fn["inner" + name] = function () { 9310 var elem = this[0]; 9311 return elem ? 9312 elem.style ? 9313 parseFloat(jQuery.css(elem, type, "padding")) : 9314 this[type]() : 9315 null; 9316 }; 9317 9318 // outerHeight and outerWidth 9319 jQuery.fn["outer" + name] = function (margin) { 9320 var elem = this[0]; 9321 return elem ? 9322 elem.style ? 9323 parseFloat(jQuery.css(elem, type, margin ? "margin" : "border")) : 9324 this[type]() : 9325 null; 9326 }; 9327 9328 jQuery.fn[type] = function (value) { 9329 return jQuery.access(this, function (elem, type, value) { 9330 var doc, docElemProp, orig, ret; 9331 9332 if (jQuery.isWindow(elem)) { 9333 // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat 9334 doc = elem.document; 9335 docElemProp = doc.documentElement[clientProp]; 9336 return jQuery.support.boxModel && docElemProp || 9337 doc.body && doc.body[clientProp] || docElemProp; 9338 } 9339 9340 // Get document width or height 9341 if (elem.nodeType === 9) { 9342 // Either scroll[Width/Height] or offset[Width/Height], whichever is greater 9343 doc = elem.documentElement; 9344 9345 // when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height] 9346 // so we can't use max, as it'll choose the incorrect offset[Width/Height] 9347 // instead we use the correct client[Width/Height] 9348 // support:IE6 9349 if (doc[clientProp] >= doc[scrollProp]) { 9350 return doc[clientProp]; 9351 } 9352 9353 return Math.max( 9354 elem.body[scrollProp], doc[scrollProp], 9355 elem.body[offsetProp], doc[offsetProp] 9356 ); 9357 } 9358 9359 // Get width or height on the element 9360 if (value === undefined) { 9361 orig = jQuery.css(elem, type); 9362 ret = parseFloat(orig); 9363 return jQuery.isNumeric(ret) ? ret : orig; 9364 } 9365 9366 // Set the width or height on the element 9367 jQuery(elem).css(type, value); 9368 }, type, value, arguments.length, null); 9369 }; 9370 }); 9371 9372 9373// Expose jQuery to the global object 9374 window.jQuery = window.$ = jQuery; 9375 9376// Expose jQuery as an AMD module, but only for AMD loaders that 9377// understand the issues with loading multiple versions of jQuery 9378// in a page that all might call define(). The loader will indicate 9379// they have special allowances for multiple jQuery versions by 9380// specifying define.amd.jQuery = true. Register as a named module, 9381// since jQuery can be concatenated with other files that may use define, 9382// but not use a proper concatenation script that understands anonymous 9383// AMD modules. A named AMD is safest and most robust way to register. 9384// Lowercase jquery is used because AMD module names are derived from 9385// file names, and jQuery is normally delivered in a lowercase file name. 9386// Do this after creating the global so that if an AMD module wants to call
9387// noConflict to hide this version of jQuery, it will work. 9388 if (typeof define === "function" && define.amd && define.amd.jQuery) { 9389 define("jquery", [], function () { 9390 return jQuery; 9391 }); 9392 } 9393 9394 9395})(window);
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.