Jquery框架

来源:互联网 发布:淘宝网联名信用卡 编辑:程序博客网 时间:2024/06/08 12:04
(function( window, undefined ) {// Use the correct document accordingly with window argument (sandbox)var document = window.document,navigator = window.navigator,location = window.location;var jQuery = (function() {// Define a local copy of jQueryvar jQuery = function( selector, context ) {// The jQuery object is actually just the init constructor 'enhanced'return new jQuery.fn.init( selector, context, rootjQuery );};jQuery.fn = jQuery.prototype = {constructor: jQuery,init: function( selector, context, rootjQuery ) {return jQuery.makeArray( selector, this );}};// Give the init function the jQuery prototype for later instantiationjQuery.fn.init.prototype = jQuery.fn;jQuery.extend = jQuery.fn.extend = function() {// Return the modified objectreturn target;};jQuery.extend({// 这里都是方法browser: {}});// Populate the class2type mapjQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {class2type[ "[object " + name + "]" ] = name.toLowerCase();});browserMatch = jQuery.uaMatch( userAgent );if ( browserMatch.browser ) {jQuery.browser[ browserMatch.browser ] = true;jQuery.browser.version = browserMatch.version;}// Deprecated, use jQuery.browser.webkit insteadif ( jQuery.browser.webkit ) {jQuery.browser.safari = true;}// IE doesn't match non-breaking spaces with \sif ( rnotwhite.test( "\xA0" ) ) {trimLeft = /^[\s\xA0]+/;trimRight = /[\s\xA0]+$/;}// All jQuery objects should point back to theserootjQuery = jQuery(document);// Cleanup functions for the document ready methodif ( document.addEventListener ) {DOMContentLoaded = function() {document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );jQuery.ready();};} else if ( document.attachEvent ) {DOMContentLoaded = function() {// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).if ( document.readyState === "complete" ) {document.detachEvent( "onreadystatechange", DOMContentLoaded );jQuery.ready();}};}// The DOM ready check for Internet Explorerfunction doScrollCheck() {if ( jQuery.isReady ) {return;}try {// If IE is used, use the trick by Diego Perini// http://javascript.nwbox.com/IEContentLoaded/document.documentElement.doScroll("left");} catch(e) {setTimeout( doScrollCheck, 1 );return;}// and execute any waiting functionsjQuery.ready();}return jQuery;})();// String to Object flags format cachevar flagsCache = {};// Convert String-formatted flags into Object-formatted ones and store in cachefunction createFlags( flags ) {var object = flagsCache[ flags ] = {},i, length;flags = flags.split( /\s+/ );for ( i = 0, length = flags.length; i < length; i++ ) {object[ flags[i] ] = true;}return object;}/* * Create a callback list using the following parameters: * *flags:an optional list of space-separated flags that will change how *the callback list behaves * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible flags: * *once:will ensure the callback list can only be fired once (like a Deferred) * *memory:will keep track of previous values and will call any callback added *after the list has been fired right away with the latest "memorized" *values (like a Deferred) * *unique:will ensure a callback can only be added once (no duplicate in the list) * *stopOnFalse:interrupt callings when a callback returns false * */jQuery.Callbacks = function( flags ) { return self;};var // Static reference to slicesliceDeferred = [].slice;jQuery.extend({ });jQuery.support = (function() { return support;})();var rbrace = /^(?:\{.*\}|\[.*\])$/,rmultiDash = /([A-Z])/g;jQuery.extend({ });jQuery.fn.extend({ });function dataAttr( elem, key, data ) {// If nothing was found internally, try to fetch any return data;}// checks a cache object for emptinessfunction isEmptyDataObject( obj ) { return true;}function handleQueueMarkDefer( elem, type, src ) { }jQuery.extend({_mark: function( elem, type ) {if ( elem ) {type = ( type || "fx" ) + "mark";jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );}}, });jQuery.fn.extend({queue: function( type, data ) {if ( typeof type !== "string" ) {data = type;type = "fx";}if ( data === undefined ) {return jQuery.queue( this[0], type );}return this.each(function() {var queue = jQuery.queue( this, type, data );if ( type === "fx" && queue[0] !== "inprogress" ) {jQuery.dequeue( this, type );}});} });var rclass = /[\n\t\r]/g,rspace = /\s+/,rreturn = /\r/g,rtype = /^(?:button|input)$/i,rfocusable = /^(?:button|input|object|select|textarea)$/i,rclickable = /^a(?:rea)?$/i,rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,getSetAttribute = jQuery.support.getSetAttribute,nodeHook, boolHook, fixSpecified;jQuery.fn.extend({ });jQuery.extend({ });// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;// Hook for boolean attributesboolHook = {get: function( elem, name ) {// Align boolean attributes with corresponding properties// Fall back to attribute presence where some booleans are not supportedvar attrNode,property = jQuery.prop( elem, name );return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?name.toLowerCase() :undefined;} };// IE6/7 do not support getting/setting some attributes with get/setAttributeif ( !getSetAttribute ) {fixSpecified = {name: true,id: true}; // Apply the nodeHook to tabindexjQuery.attrHooks.tabindex.set = nodeHook.set; }// Some attributes require a special call on IEif ( !jQuery.support.hrefNormalized ) { }if ( !jQuery.support.style ) { }// Safari mis-reports the default selected property of an option// Accessing the parent's selectedIndex property fixes itif ( !jQuery.support.optSelected ) { }// IE6/7 call enctype encodingif ( !jQuery.support.enctype ) {jQuery.propFix.enctype = "encoding";}// Radios and checkboxes getter/setterif ( !jQuery.support.checkOn ) { }jQuery.each([ "radio", "checkbox" ], function() { });var rformElems = /^(?:textarea|input|select)$/i,rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,rhoverHack = /\bhover(\.\S+)?\b/,rkeyEvent = /^key/,rmouseEvent = /^(?:mouse|contextmenu)|click/,rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,quickParse = function( selector ) {var quick = rquickIs.exec( selector );if ( quick ) {//   0  1    2   3// [ _, tag, id, class ]quick[1] = ( quick[1] || "" ).toLowerCase();quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );}return quick;},quickIs = function( elem, m ) {var attrs = elem.attributes || {};return ((!m[1] || elem.nodeName.toLowerCase() === m[1]) &&(!m[2] || (attrs.id || {}).value === m[2]) &&(!m[3] || m[3].test( (attrs[ "class" ] || {}).value )));},hoverHack = function( events ) {return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );};/* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */jQuery.event = {add: function( elem, types, handler, data, selector ) { },global: {},// Detach an event or set of events from an elementremove: function( elem, types, handler, selector, mappedTypes ) { },// Events that are safe to short-circuit if no handlers are attached.// Native DOM events should not be added, they may have inline handlers.customEvent: {"getData": true,"setData": true,"changeData": true},trigger: function( event, data, elem, onlyHandlers ) { return event.result;},dispatch: function( event ) { return event.result;},// Includes some event props shared by KeyEvent and MouseEvent// *** attrChange attrName relatedNode srcElement  are not normalized, non-W3C, deprecated, will be removed in 1.8 ***props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks: {},keyHooks: { },mouseHooks: { },fix: function( event ) {},special: { } };// Some plugins are using, but it's undocumented/deprecated and will be removed.// The 1.7 special event interface should provide all the hooks needed now.jQuery.event.handle = jQuery.event.dispatch;jQuery.removeEvent = document.removeEventListener ?function( elem, type, handle ) {if ( elem.removeEventListener ) {elem.removeEventListener( type, handle, false );}} :function( elem, type, handle ) {if ( elem.detachEvent ) {elem.detachEvent( "on" + type, handle );}};jQuery.Event = function( src, props ) {// Allow instantiation without the 'new' keyword // Mark it as fixedthis[ jQuery.expando ] = true;};function returnFalse() {return false;}function returnTrue() {return true;}// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.htmljQuery.Event.prototype = { };// Create mouseenter/leave events using mouseover/out and event-time checksjQuery.each({mouseenter: "mouseover",mouseleave: "mouseout"}, function( orig, fix ) { };});// IE submit delegationif ( !jQuery.support.submitBubbles ) {  }// IE change delegation and checkbox/radio fixif ( !jQuery.support.changeBubbles ) {jQuery.event.special.change = { };}// Create "bubbling" focus and blur eventsif ( !jQuery.support.focusinBubbles ) {jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {// Attach a single capturing handler while someone wants focusin/focusoutvar attaches = 0,handler = function( event ) {jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );};jQuery.event.special[ fix ] = { };});}jQuery.fn.extend({ });jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { });/*! * Sizzle CSS Selector Engine *  Copyright 2011, The Dojo Foundation *  Released under the MIT, BSD, and GPL Licenses. *  More information: http://sizzlejs.com/ */(function(){var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,expando = "sizcache" + (Math.random() + '').replace('.', ''),done = 0,toString = Object.prototype.toString,hasDuplicate = false,baseHasDuplicate = true,rBackslash = /\\/g,rReturn = /\r\n/g,rNonWord = /\W/;// Here we check if the JavaScript engine is using some sort of// optimization where it does not always call our comparision// function. If that is the case, discard the hasDuplicate value.//   Thus far that includes Google Chrome.[0, 0].sort(function() {baseHasDuplicate = false;return 0;});var Sizzle = function( selector, context, results, seed ) { return results;};Sizzle.uniqueSort = function( results ) { return results;};Sizzle.matches = function( expr, set ) {return Sizzle( expr, null, null, set );};Sizzle.matchesSelector = function( node, expr ) {return Sizzle( expr, null, null, [node] ).length > 0;};Sizzle.find = function( expr, context, isXML ) { return { set: set, expr: expr };};Sizzle.filter = function( expr, set, inplace, not ) { return curLoop;};Sizzle.error = function( msg ) {throw new Error( "Syntax error, unrecognized expression: " + msg );};/** * Utility function for retreiving the text value of an array of DOM nodes * @param {Array|Element} elem */var getText = Sizzle.getText = function( elem ) {    return ret;};var Expr = Sizzle.selectors = { };var origPOS = Expr.match.POS,fescape = function(all, num){return "\\" + (num - 0 + 1);};for ( var type in Expr.match ) {Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );}var makeArray = function( array, results ) { };// Perform a simple check to determine if the browser is capable of// converting a NodeList to an array using builtin methods.// Also verifies that the returned array holds DOM nodes// (which is not the case in the Blackberry browser)try {Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;// Provide a fallback method if it does not work} catch( e ) {  }var sortOrder, siblingCheck;if ( document.documentElement.compareDocumentPosition ) {} else { }// Check to see if the browser returns elements by name when// querying by getElementById (and provide a workaround)(function(){ })(); } })();(function(){ })();var runtil = /Until$/,rparentsprev = /^(?:parents|prevUntil|prevAll)/,// Note: This RegExp should be improved, or likely pulled from Sizzlermultiselector = /,/,isSimple = /^.[^:#\[\.,]*$/,slice = Array.prototype.slice,POS = jQuery.expr.match.POS,// methods guaranteed to produce a unique set when starting from a unique setguaranteedUnique = {children: true,contents: true,next: true,prev: true};jQuery.fn.extend({ });jQuery.extend({});// Implement the identical functionality for filter and notfunction winnow( elements, qualifier, keep ) {}function createSafeFragment( document ) { } wrapMap.optgroup = wrapMap.option;wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;wrapMap.th = wrapMap.td;// IE can't serialize <link> and <script> tags normallyif ( !jQuery.support.htmlSerialize ) {wrapMap._default = [ 1, "div<div>", "</div>" ];}jQuery.fn.extend({  });function root( elem, cur ) {return jQuery.nodeName(elem, "table") ?(elem.getElementsByTagName("tbody")[0] ||elem.appendChild(elem.ownerDocument.createElement("tbody"))) :elem;}function cloneCopyEvent( src, dest ) { }function cloneFixAttributes( src, dest ) {var nodeName; }jQuery.buildFragment = function( args, nodes, scripts ) { };jQuery.fragments = {};jQuery.each({appendTo: "append",prependTo: "prepend",insertBefore: "before",insertAfter: "after",replaceAll: "replaceWith"}, function( name, original ) { });function getAll( elem ) {}// Used in clean, fixes the defaultChecked propertyfunction fixDefaultChecked( elem ) { }// Finds all inputs and passes them to fixDefaultCheckedfunction findInputs( elem ) { }// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.jsfunction shimCloneNode( elem ) { }jQuery.extend({});function evalScript( i, elem ) { }var ralpha = /alpha\([^)]*\)/i,ropacity = /opacity=([^)]*)/,// fixed for IE9, see #8346rupper = /([A-Z]|^ms)/g,rnumpx = /^-?\d+(?:px)?$/i,rnum = /^-?\d/,rrelNum = /^([\-+])=([\-+.\de]+)/,cssShow = { position: "absolute", visibility: "hidden", display: "block" },cssWidth = [ "Left", "Right" ],cssHeight = [ "Top", "Bottom" ],curCSS,getComputedStyle,currentStyle;jQuery.fn.css = function( name, value ) {};jQuery.extend({// Add in style property hooks for overriding the default// behavior of getting and setting a style property});// DEPRECATED, Use jQuery.css() insteadjQuery.curCSS = jQuery.css;jQuery.each(["height", "width"], function( i, name ) { });if ( !jQuery.support.opacity ) {}jQuery(function() {// This hook cannot be added until DOM ready because the support test// for it is not run until after DOM ready }curCSS = getComputedStyle || currentStyle;function getWH( elem, name, extra ) {return val + "px";}if ( jQuery.expr && jQuery.expr.filters ) {jQuery.expr.filters.hidden = function( elem ) {var width = elem.offsetWidth,height = elem.offsetHeight;return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");};jQuery.expr.filters.visible = function( elem ) {return !jQuery.expr.filters.hidden( elem );};}vjQuery.fn.extend({});// Attach a bunch of functions for handling common AJAX eventsjQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){jQuery.fn[ o ] = function( f ){return this.on( o, f );};});jQuery.each( [ "get", "post" ], function( i, method ) {});jQuery.extend({},});// Animations created synchronously will run synchronouslyfunction createFxNow() {setTimeout( clearFxNow, 0 );return ( fxNow = jQuery.now() );}function clearFxNow() {fxNow = undefined;}// Generate parameters to create a standard animationfunction genFx( type, num ) {var obj = {};jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() {obj[ this ] = type;});return obj;}// Generate shortcuts for custom animationsjQuery.each({slideDown: genFx( "show", 1 ),slideUp: genFx( "hide", 1 ),slideToggle: genFx( "toggle", 1 ),fadeIn: { opacity: "show" },fadeOut: { opacity: "hide" },fadeToggle: { opacity: "toggle" }}, function( name, props ) {jQuery.fn[ name ] = function( speed, easing, callback ) {return this.animate( props, speed, easing, callback );};});jQuery.extend({});jQuery.fx.prototype = { };jQuery.extend( jQuery.fx, {});// Adds width/height step functions// Do not set anything below 0jQuery.each([ "width", "height" ], function( i, prop ) {jQuery.fx.step[ prop ] = function( fx ) {jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );};});if ( jQuery.expr && jQuery.expr.filters ) {jQuery.expr.filters.animated = function( elem ) {return jQuery.grep(jQuery.timers, function( fn ) {return elem === fn.elem;}).length;};}// Try to restore the default display value of an elementfunction defaultDisplay( nodeName ) { return elemdisplay[ nodeName ];}var rtable = /^t(?:able|d|h)$/i,rroot = /^(?:body|html)$/i;if ( "getBoundingClientRect" in document.documentElement ) {jQuery.fn.offset = function( options ) { return { top: top, left: left };};} else {jQuery.fn.offset = function( options ) { return { top: top, left: left };};}jQuery.fn.extend({position: function() {});// Create scrollLeft and scrollTop methodsjQuery.each( ["Left", "Top"], function( i, name ) { }});function getWindow( elem ) { }// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methodsjQuery.each([ "Height", "Width" ], function( i, name ) {var type = name.toLowerCase();// innerHeight and innerWidthjQuery.fn[ "inner" + name ] = function() { };// outerHeight and outerWidthjQuery.fn[ "outer" + name ] = function( margin ) { };jQuery.fn[ type ] = function( size ) { };});// Expose jQuery to the global objectwindow.jQuery = window.$ = jQuery;// Expose jQuery as an AMD module, but only for AMD loaders that// understand the issues with loading multiple versions of jQuery// in a page that all might call define(). The loader will indicate// they have special allowances for multiple jQuery versions by// specifying define.amd.jQuery = true. Register as a named module,// since jQuery can be concatenated with other files that may use define,// but not use a proper concatenation script that understands anonymous// AMD modules. A named AMD is safest and most robust way to register.// Lowercase jquery is used because AMD module names are derived from// file names, and jQuery is normally delivered in a lowercase file name.// Do this after creating the global so that if an AMD module wants to call// noConflict to hide this version of jQuery, it will work.if ( typeof define === "function" && define.amd && define.amd.jQuery ) {define( "jquery", [], function () { return jQuery; } );}})( window );

原创粉丝点击