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