/* jquery 1.7.2 */ (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 jquery var jquery = function( selector, context ) { // the jquery object is actually just the init constructor 'enhanced' return new jquery.fn.init( selector, context, rootjquery ); }, // map over jquery in case of overwrite _jquery = window.jquery, // map over the $ in case of overwrite _$ = window.$, // a central reference to the root jquery(document) rootjquery, // a simple way to check for html strings or id strings // prioritize #id over to avoid xss via location.hash (#9521) quickexpr = /^(?:[^#<]*(<[\w\w]+>)[^>]*$|#([\w\-]*)$)/, // check if a string has a non-whitespace character in it rnotwhite = /\s/, // used for trimming whitespace trimleft = /^\s+/, trimright = /\s+$/, // match a standalone tag rsingletag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, // json regexp rvalidchars = /^[\],:{}\s]*$/, rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fa-f]{4})/g, rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[ee][+\-]?\d+)?/g, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, // useragent regexp rwebkit = /(webkit)[ \/]([\w.]+)/, ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, rmsie = /(msie) ([\w.]+)/, rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, // matches dashed string for camelizing rdashalpha = /-([a-z]|[0-9])/ig, rmsprefix = /^-ms-/, // used by jquery.camelcase as callback to replace() fcamelcase = function( all, letter ) { return ( letter + "" ).touppercase(); }, // keep a useragent string for use with jquery.browser useragent = navigator.useragent, // for matching the engine and version of the browser browsermatch, // the deferred used on dom ready readylist, // the ready event handler domcontentloaded, // save a reference to some core methods tostring = object.prototype.tostring, hasown = object.prototype.hasownproperty, push = array.prototype.push, slice = array.prototype.slice, trim = string.prototype.trim, indexof = array.prototype.indexof, // [[class]] -> type pairs class2type = {}; jquery.fn = jquery.prototype = { constructor: jquery, init: function( selector, context, rootjquery ) { var match, elem, ret, doc; // handle $(""), $(null), or $(undefined) if ( !selector ) { return this; } // handle $(domelement) if ( selector.nodetype ) { this.context = this[0] = selector; this.length = 1; return this; } // the body element only exists once, optimize finding it if ( selector === "body" && !context && document.body ) { this.context = document; this[0] = document.body; this.selector = selector; this.length = 1; return this; } // handle html strings if ( typeof selector === "string" ) { // are we dealing with html string or an id? if ( selector.charat(0) === "<" && selector.charat( selector.length - 1 ) === ">" && selector.length >= 3 ) { // assume that strings that start and end with <> are html and skip the regex check match = [ null, selector, null ]; } else { match = quickexpr.exec( selector ); } // verify a match, and that no context was specified for #id if ( match && (match[1] || !context) ) { // handle: $(html) -> $(array) if ( match[1] ) { context = context instanceof jquery ? context[0] : context; doc = ( context ? context.ownerdocument || context : document ); // if a single string is passed in and it's a single tag // just do a createelement and skip the rest ret = rsingletag.exec( selector ); if ( ret ) { if ( jquery.isplainobject( context ) ) { selector = [ document.createelement( ret[1] ) ]; jquery.fn.attr.call( selector, context, true ); } else { selector = [ doc.createelement( ret[1] ) ]; } } else { ret = jquery.buildfragment( [ match[1] ], [ doc ] ); selector = ( ret.cacheable ? jquery.clone(ret.fragment) : ret.fragment ).childnodes; } return jquery.merge( this, selector ); // handle: $("#id") } else { elem = document.getelementbyid( match[2] ); // check parentnode to catch when blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentnode ) { // handle the case where ie and opera return items // by name instead of id if ( elem.id !== match[2] ) { return rootjquery.find( selector ); } // otherwise, we inject the element directly into the jquery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // handle: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || rootjquery ).find( selector ); // handle: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // handle: $(function) // shortcut for document ready } else if ( jquery.isfunction( selector ) ) { return rootjquery.ready( selector ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } return jquery.makearray( selector, this ); }, // start with an empty selector selector: "", // the current version of jquery being used jquery: "1.7.2", // the default length of a jquery object is 0 length: 0, // the number of elements contained in the matched element set size: function() { return this.length; }, toarray: function() { return slice.call( this, 0 ); }, // get the nth element in the matched element set or // get the whole matched element set as a clean array get: function( num ) { return num == null ? // return a 'clean' array this.toarray() : // return just the object ( num < 0 ? this[ this.length + num ] : this[ num ] ); }, // take an array of elements and push it onto the stack // (returning the new matched element set) pushstack: function( elems, name, selector ) { // build a new jquery matched element set var ret = this.constructor(); if ( jquery.isarray( elems ) ) { push.apply( ret, elems ); } else { jquery.merge( ret, elems ); } // add the old object onto the stack (as a reference) ret.prevobject = this; ret.context = this.context; if ( name === "find" ) { ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; } else if ( name ) { ret.selector = this.selector + "." + name + "(" + selector + ")"; } // return the newly-formed element set return ret; }, // execute a callback for every element in the matched set. // (you can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jquery.each( this, callback, args ); }, ready: function( fn ) { // attach the listeners jquery.bindready(); // add the callback readylist.add( fn ); return this; }, eq: function( i ) { i = +i; return i === -1 ? this.slice( i ) : this.slice( i, i + 1 ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, slice: function() { return this.pushstack( slice.apply( this, arguments ), "slice", slice.call(arguments).join(",") ); }, map: function( callback ) { return this.pushstack( jquery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, end: function() { return this.prevobject || this.constructor(null); }, // for internal use only. // behaves like an array's method, not like a jquery method. push: push, sort: [].sort, splice: [].splice }; // give the init function the jquery prototype for later instantiation jquery.fn.init.prototype = jquery.fn; jquery.extend = jquery.fn.extend = function() { var options, name, src, copy, copyisarray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jquery.isfunction(target) ) { target = {}; } // extend jquery itself if only one argument is passed if ( length === i ) { target = this; --i; } for ( ; i < length; i++ ) { // only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // prevent never-ending loop if ( target === copy ) { continue; } // recurse if we're merging plain objects or arrays if ( deep && copy && ( jquery.isplainobject(copy) || (copyisarray = jquery.isarray(copy)) ) ) { if ( copyisarray ) { copyisarray = false; clone = src && jquery.isarray(src) ? src : []; } else { clone = src && jquery.isplainobject(src) ? src : {}; } // never move original objects, clone them target[ name ] = jquery.extend( deep, clone, copy ); // don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // return the modified object return target; }; jquery.extend({ noconflict: function( deep ) { if ( window.$ === jquery ) { window.$ = _$; } if ( deep && window.jquery === jquery ) { window.jquery = _jquery; } return jquery; }, // is the dom ready to be used? set to true once it occurs. isready: false, // a counter to track how many items to wait for before // the ready event fires. see #6781 readywait: 1, // hold (or release) the ready event holdready: function( hold ) { if ( hold ) { jquery.readywait++; } else { jquery.ready( true ); } }, // handle when the dom is ready ready: function( wait ) { // either a released hold or an domready/load event and not yet ready if ( (wait === true && !--jquery.readywait) || (wait !== true && !jquery.isready) ) { // make sure body exists, at least, in case ie gets a little overzealous (ticket #5443). if ( !document.body ) { return settimeout( jquery.ready, 1 ); } // remember that the dom is ready jquery.isready = true; // if a normal dom ready event fired, decrement, and wait if need be if ( wait !== true && --jquery.readywait > 0 ) { return; } // if there are functions bound, to execute readylist.firewith( document, [ jquery ] ); // trigger any bound ready events if ( jquery.fn.trigger ) { jquery( document ).trigger( "ready" ).off( "ready" ); } } }, bindready: function() { if ( readylist ) { return; } readylist = jquery.callbacks( "once memory" ); // catch cases where $(document).ready() is called after the // browser event has already occurred. if ( document.readystate === "complete" ) { // handle it asynchronously to allow scripts the opportunity to delay ready return settimeout( jquery.ready, 1 ); } // mozilla, opera and webkit nightlies currently support this event if ( document.addeventlistener ) { // use the handy event callback document.addeventlistener( "domcontentloaded", domcontentloaded, false ); // a fallback to window.onload, that will always work window.addeventlistener( "load", jquery.ready, false ); // if ie event model is used } else if ( document.attachevent ) { // ensure firing before onload, // maybe late but safe also for iframes document.attachevent( "onreadystatechange", domcontentloaded ); // a fallback to window.onload, that will always work window.attachevent( "onload", jquery.ready ); // if ie and not a frame // continually check to see if the document is ready var toplevel = false; try { toplevel = window.frameelement == null; } catch(e) {} if ( document.documentelement.doscroll && toplevel ) { doscrollcheck(); } } }, // see test/unit/core.js for details concerning isfunction. // since version 1.3, dom methods and functions like alert // aren't supported. they return false on ie (#2968). isfunction: function( obj ) { return jquery.type(obj) === "function"; }, isarray: array.isarray || function( obj ) { return jquery.type(obj) === "array"; }, iswindow: function( obj ) { return obj != null && obj == obj.window; }, isnumeric: function( obj ) { return !isnan( parsefloat(obj) ) && isfinite( obj ); }, type: function( obj ) { return obj == null ? string( obj ) : class2type[ tostring.call(obj) ] || "object"; }, isplainobject: function( obj ) { // must be an object. // because of ie, we also have to check the presence of the constructor property. // make sure that dom nodes and window objects don't pass through, as well if ( !obj || jquery.type(obj) !== "object" || obj.nodetype || jquery.iswindow( obj ) ) { return false; } try { // not own constructor property must be object if ( obj.constructor && !hasown.call(obj, "constructor") && !hasown.call(obj.constructor.prototype, "isprototypeof") ) { return false; } } catch ( e ) { // ie8,9 will throw exceptions on certain host objects #9897 return false; } // own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for ( key in obj ) {} return key === undefined || hasown.call( obj, key ); }, isemptyobject: function( obj ) { for ( var name in obj ) { return false; } return true; }, error: function( msg ) { throw new error( msg ); }, parsejson: function( data ) { if ( typeof data !== "string" || !data ) { return null; } // make sure leading/trailing whitespace is removed (ie can't handle it) data = jquery.trim( data ); // attempt to parse using the native json parser first if ( window.json && window.json.parse ) { return window.json.parse( data ); } // make sure the incoming data is actual json // logic borrowed from http://json.org/json2.js if ( rvalidchars.test( data.replace( rvalidescape, "@" ) .replace( rvalidtokens, "]" ) .replace( rvalidbraces, "")) ) { return ( new function( "return " + data ) )(); } jquery.error( "invalid json: " + data ); }, // cross-browser xml parsing parsexml: function( data ) { if ( typeof data !== "string" || !data ) { return null; } var xml, tmp; try { if ( window.domparser ) { // standard tmp = new domparser(); xml = tmp.parsefromstring( data , "text/xml" ); } else { // ie xml = new activexobject( "microsoft.xmldom" ); xml.async = "false"; xml.loadxml( data ); } } catch( e ) { xml = undefined; } if ( !xml || !xml.documentelement || xml.getelementsbytagname( "parsererror" ).length ) { jquery.error( "invalid xml: " + data ); } return xml; }, noop: function() {}, // evaluates a script in a global context // workarounds based on findings by jim driscoll // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globaleval: function( data ) { if ( data && rnotwhite.test( data ) ) { // we use execscript on internet explorer // we use an anonymous function so that context is window // rather than jquery in firefox ( window.execscript || function( data ) { window[ "eval" ].call( window, data ); } )( data ); } }, // convert dashed to camelcase; used by the css and data modules // microsoft forgot to hump their vendor prefix (#9572) camelcase: function( string ) { return string.replace( rmsprefix, "ms-" ).replace( rdashalpha, fcamelcase ); }, nodename: function( elem, name ) { return elem.nodename && elem.nodename.touppercase() === name.touppercase(); }, // args is for internal usage only each: function( object, callback, args ) { var name, i = 0, length = object.length, isobj = length === undefined || jquery.isfunction( object ); if ( args ) { if ( isobj ) { for ( name in object ) { if ( callback.apply( object[ name ], args ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.apply( object[ i++ ], args ) === false ) { break; } } } // a special, fast, case for the most common use of each } else { if ( isobj ) { for ( name in object ) { if ( callback.call( object[ name ], name, object[ name ] ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { break; } } } } return object; }, // use native string.trim function wherever possible trim: trim ? function( text ) { return text == null ? "" : trim.call( text ); } : // otherwise use our own trimming functionality function( text ) { return text == null ? "" : text.tostring().replace( trimleft, "" ).replace( trimright, "" ); }, // results is for internal usage only makearray: function( array, results ) { var ret = results || []; if ( array != null ) { // the window, strings (and functions) also have 'length' // tweaked logic slightly to handle blackberry 4.7 regexp issues #6930 var type = jquery.type( array ); if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jquery.iswindow( array ) ) { push.call( ret, array ); } else { jquery.merge( ret, array ); } } return ret; }, inarray: function( elem, array, i ) { var len; if ( array ) { if ( indexof ) { return indexof.call( array, elem, i ); } len = array.length; i = i ? i < 0 ? math.max( 0, len + i ) : i : 0; for ( ; i < len; i++ ) { // skip accessing in sparse arrays if ( i in array && array[ i ] === elem ) { return i; } } } return -1; }, merge: function( first, second ) { var i = first.length, j = 0; if ( typeof second.length === "number" ) { for ( var l = second.length; j < l; j++ ) { first[ i++ ] = second[ j ]; } } else { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; } } first.length = i; return first; }, grep: function( elems, callback, inv ) { var ret = [], retval; inv = !!inv; // go through the array, only saving the items // that pass the validator function for ( var i = 0, length = elems.length; i < length; i++ ) { retval = !!callback( elems[ i ], i ); if ( inv !== retval ) { ret.push( elems[ i ] ); } } return ret; }, // arg is for internal usage only map: function( elems, callback, arg ) { var value, key, ret = [], i = 0, length = elems.length, // jquery objects are treated as arrays isarray = elems instanceof jquery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jquery.isarray( elems ) ) ; // go through the array, translating each of the items to their if ( isarray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret[ ret.length ] = value; } } // go through every key on the object, } else { for ( key in elems ) { value = callback( elems[ key ], key, arg ); if ( value != null ) { ret[ ret.length ] = value; } } } // flatten any nested arrays return ret.concat.apply( [], ret ); }, // a global guid counter for objects guid: 1, // bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { if ( typeof context === "string" ) { var tmp = fn[ context ]; context = fn; fn = tmp; } // quick check to determine if target is callable, in the spec // this throws a typeerror, but we will just return undefined. if ( !jquery.isfunction( fn ) ) { return undefined; } // simulated bind var args = slice.call( arguments, 2 ), proxy = function() { return fn.apply( context, args.concat( slice.call( arguments ) ) ); }; // set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || proxy.guid || jquery.guid++; return proxy; }, // mutifunctional method to get and set values to a collection // the value/s can optionally be executed if it's a function access: function( elems, fn, key, value, chainable, emptyget, pass ) { var exec, bulk = key == null, i = 0, length = elems.length; // sets many values if ( key && typeof key === "object" ) { for ( i in key ) { jquery.access( elems, fn, i, key[i], 1, emptyget, value ); } chainable = 1; // sets one value } else if ( value !== undefined ) { // optionally, function values get executed if exec is true exec = pass === undefined && jquery.isfunction( value ); if ( bulk ) { // bulk operations only iterate when executing function values if ( exec ) { exec = fn; fn = function( elem, key, value ) { return exec.call( jquery( elem ), value ); }; // otherwise they run against the entire set } else { fn.call( elems, value ); fn = null; } } if ( fn ) { for (; i < length; i++ ) { fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); } } chainable = 1; } return chainable ? elems : // gets bulk ? fn.call( elems ) : length ? fn( elems[0], key ) : emptyget; }, now: function() { return ( new date() ).gettime(); }, // use of jquery.browser is frowned upon. // more details: http://docs.jquery.com/utilities/jquery.browser uamatch: function( ua ) { ua = ua.tolowercase(); var match = rwebkit.exec( ua ) || ropera.exec( ua ) || rmsie.exec( ua ) || ua.indexof("compatible") < 0 && rmozilla.exec( ua ) || []; return { browser: match[1] || "", version: match[2] || "0" }; }, sub: function() { function jquerysub( selector, context ) { return new jquerysub.fn.init( selector, context ); } jquery.extend( true, jquerysub, this ); jquerysub.superclass = this; jquerysub.fn = jquerysub.prototype = this(); jquerysub.fn.constructor = jquerysub; jquerysub.sub = this.sub; jquerysub.fn.init = function init( selector, context ) { if ( context && context instanceof jquery && !(context instanceof jquerysub) ) { context = jquerysub( context ); } return jquery.fn.init.call( this, selector, context, rootjquerysub ); }; jquerysub.fn.init.prototype = jquerysub.fn; var rootjquerysub = jquerysub(document); return jquerysub; }, browser: {} }); // populate the class2type map jquery.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 instead if ( jquery.browser.webkit ) { jquery.browser.safari = true; } // ie doesn't match non-breaking spaces with \s if ( rnotwhite.test( "\xa0" ) ) { trimleft = /^[\s\xa0]+/; trimright = /[\s\xa0]+$/; } // all jquery objects should point back to these rootjquery = jquery(document); // cleanup functions for the document ready method if ( 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 explorer function 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 functions jquery.ready(); } return jquery; })(); // string to object flags format cache var flagscache = {}; // convert string-formatted flags into object-formatted ones and store in cache function 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 ) { // convert flags from string-formatted to object-formatted // (we check in cache first) flags = flags ? ( flagscache[ flags ] || createflags( flags ) ) : {}; var // actual callback list list = [], // stack of fire calls for repeatable lists stack = [], // last fire value (for non-forgettable lists) memory, // flag to know if list was already fired fired, // flag to know if list is currently firing firing, // first callback to fire (used internally by add and firewith) firingstart, // end of the loop when firing firinglength, // index of currently firing callback (modified by remove if needed) firingindex, // add one or several callbacks to the list add = function( args ) { var i, length, elem, type, actual; for ( i = 0, length = args.length; i < length; i++ ) { elem = args[ i ]; type = jquery.type( elem ); if ( type === "array" ) { // inspect recursively add( elem ); } else if ( type === "function" ) { // add if not in unique mode and callback is not in if ( !flags.unique || !self.has( elem ) ) { list.push( elem ); } } } }, // fire callbacks fire = function( context, args ) { args = args || []; memory = !flags.memory || [ context, args ]; fired = true; firing = true; firingindex = firingstart || 0; firingstart = 0; firinglength = list.length; for ( ; list && firingindex < firinglength; firingindex++ ) { if ( list[ firingindex ].apply( context, args ) === false && flags.stoponfalse ) { memory = true; // mark as halted break; } } firing = false; if ( list ) { if ( !flags.once ) { if ( stack && stack.length ) { memory = stack.shift(); self.firewith( memory[ 0 ], memory[ 1 ] ); } } else if ( memory === true ) { self.disable(); } else { list = []; } } }, // actual callbacks object self = { // add a callback or a collection of callbacks to the list add: function() { if ( list ) { var length = list.length; add( arguments ); // do we need to add the callbacks to the // current firing batch? if ( firing ) { firinglength = list.length; // with memory, if we're not firing then // we should call right away, unless previous // firing was halted (stoponfalse) } else if ( memory && memory !== true ) { firingstart = length; fire( memory[ 0 ], memory[ 1 ] ); } } return this; }, // remove a callback from the list remove: function() { if ( list ) { var args = arguments, argindex = 0, arglength = args.length; for ( ; argindex < arglength ; argindex++ ) { for ( var i = 0; i < list.length; i++ ) { if ( args[ argindex ] === list[ i ] ) { // handle firingindex and firinglength if ( firing ) { if ( i <= firinglength ) { firinglength--; if ( i <= firingindex ) { firingindex--; } } } // remove the element list.splice( i--, 1 ); // if we have some unicity property then // we only need to do this once if ( flags.unique ) { break; } } } } } return this; }, // control if a given callback is in the list has: function( fn ) { if ( list ) { var i = 0, length = list.length; for ( ; i < length; i++ ) { if ( fn === list[ i ] ) { return true; } } } return false; }, // remove all callbacks from the list empty: function() { list = []; return this; }, // have the list do nothing anymore disable: function() { list = stack = memory = undefined; return this; }, // is it disabled? disabled: function() { return !list; }, // lock the list in its current state lock: function() { stack = undefined; if ( !memory || memory === true ) { self.disable(); } return this; }, // is it locked? locked: function() { return !stack; }, // call all callbacks with the given context and arguments firewith: function( context, args ) { if ( stack ) { if ( firing ) { if ( !flags.once ) { stack.push( [ context, args ] ); } } else if ( !( flags.once && memory ) ) { fire( context, args ); } } return this; }, // call all the callbacks with the given arguments fire: function() { self.firewith( this, arguments ); return this; }, // to know if the callbacks have already been called at least once fired: function() { return !!fired; } }; return self; }; var // static reference to slice slicedeferred = [].slice; jquery.extend({ deferred: function( func ) { var donelist = jquery.callbacks( "once memory" ), faillist = jquery.callbacks( "once memory" ), progresslist = jquery.callbacks( "memory" ), state = "pending", lists = { resolve: donelist, reject: faillist, notify: progresslist }, promise = { done: donelist.add, fail: faillist.add, progress: progresslist.add, state: function() { return state; }, // deprecated isresolved: donelist.fired, isrejected: faillist.fired, then: function( donecallbacks, failcallbacks, progresscallbacks ) { deferred.done( donecallbacks ).fail( failcallbacks ).progress( progresscallbacks ); return this; }, always: function() { deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); return this; }, pipe: function( fndone, fnfail, fnprogress ) { return jquery.deferred(function( newdefer ) { jquery.each( { done: [ fndone, "resolve" ], fail: [ fnfail, "reject" ], progress: [ fnprogress, "notify" ] }, function( handler, data ) { var fn = data[ 0 ], action = data[ 1 ], returned; if ( jquery.isfunction( fn ) ) { deferred[ handler ](function() { returned = fn.apply( this, arguments ); if ( returned && jquery.isfunction( returned.promise ) ) { returned.promise().then( newdefer.resolve, newdefer.reject, newdefer.notify ); } else { newdefer[ action + "with" ]( this === deferred ? newdefer : this, [ returned ] ); } }); } else { deferred[ handler ]( newdefer[ action ] ); } }); }).promise(); }, // get a promise for this deferred // if obj is provided, the promise aspect is added to the object promise: function( obj ) { if ( obj == null ) { obj = promise; } else { for ( var key in promise ) { obj[ key ] = promise[ key ]; } } return obj; } }, deferred = promise.promise({}), key; for ( key in lists ) { deferred[ key ] = lists[ key ].fire; deferred[ key + "with" ] = lists[ key ].firewith; } // handle state deferred.done( function() { state = "resolved"; }, faillist.disable, progresslist.lock ).fail( function() { state = "rejected"; }, donelist.disable, progresslist.lock ); // call given func if any if ( func ) { func.call( deferred, deferred ); } // all done! return deferred; }, // deferred helper when: function( firstparam ) { var args = slicedeferred.call( arguments, 0 ), i = 0, length = args.length, pvalues = new array( length ), count = length, pcount = length, deferred = length <= 1 && firstparam && jquery.isfunction( firstparam.promise ) ? firstparam : jquery.deferred(), promise = deferred.promise(); function resolvefunc( i ) { return function( value ) { args[ i ] = arguments.length > 1 ? slicedeferred.call( arguments, 0 ) : value; if ( !( --count ) ) { deferred.resolvewith( deferred, args ); } }; } function progressfunc( i ) { return function( value ) { pvalues[ i ] = arguments.length > 1 ? slicedeferred.call( arguments, 0 ) : value; deferred.notifywith( promise, pvalues ); }; } if ( length > 1 ) { for ( ; i < length; i++ ) { if ( args[ i ] && args[ i ].promise && jquery.isfunction( args[ i ].promise ) ) { args[ i ].promise().then( resolvefunc(i), deferred.reject, progressfunc(i) ); } else { --count; } } if ( !count ) { deferred.resolvewith( deferred, args ); } } else if ( deferred !== firstparam ) { deferred.resolvewith( deferred, length ? [ firstparam ] : [] ); } return promise; } }); jquery.support = (function() { var support, all, a, select, opt, input, fragment, tds, events, eventname, i, issupported, div = document.createelement( "div" ), documentelement = document.documentelement; // preliminary tests div.setattribute("classname", "t"); div.innerhtml = "
a"; all = div.getelementsbytagname( "*" ); a = div.getelementsbytagname( "a" )[ 0 ]; // can't get basic test support if ( !all || !all.length || !a ) { return {}; } // first batch of supports tests select = document.createelement( "select" ); opt = select.appendchild( document.createelement("option") ); input = div.getelementsbytagname( "input" )[ 0 ]; support = { // ie strips leading whitespace when .innerhtml is used leadingwhitespace: ( div.firstchild.nodetype === 3 ), // make sure that tbody elements aren't automatically inserted // ie will insert them into empty tables tbody: !div.getelementsbytagname("tbody").length, // make sure that link elements get serialized correctly by innerhtml // this requires a wrapper element in ie htmlserialize: !!div.getelementsbytagname("link").length, // get the style information from getattribute // (ie uses .csstext instead) style: /top/.test( a.getattribute("style") ), // make sure that urls aren't manipulated // (ie normalizes it by default) hrefnormalized: ( a.getattribute("href") === "/a" ), // make sure that element opacity exists // (ie uses filter instead) // use a regex to work around a webkit issue. see #5145 opacity: /^0.55/.test( a.style.opacity ), // verify style float existence // (ie uses stylefloat instead of cssfloat) cssfloat: !!a.style.cssfloat, // make sure that if no value is specified for a checkbox // that it defaults to "on". // (webkit defaults to "" instead) checkon: ( input.value === "on" ), // make sure that a selected-by-default option has a working selected property. // (webkit defaults to false instead of true, ie too, if it's in an optgroup) optselected: opt.selected, // test setattribute on camelcase class. if it works, we need attrfixes when doing get/setattribute (ie6/7) getsetattribute: div.classname !== "t", // tests for enctype support on a form(#6743) enctype: !!document.createelement("form").enctype, // makes sure cloning an html5 element does not cause problems // where outerhtml is undefined, this still works html5clone: document.createelement("nav").clonenode( true ).outerhtml !== "<:nav>", // will be defined later submitbubbles: true, changebubbles: true, focusinbubbles: false, deleteexpando: true, nocloneevent: true, inlineblockneedslayout: false, shrinkwrapblocks: false, reliablemarginright: true, pixelmargin: true }; // jquery.boxmodel deprecated in 1.3, use jquery.support.boxmodel instead jquery.boxmodel = support.boxmodel = (document.compatmode === "css1compat"); // make sure checked status is properly cloned input.checked = true; support.noclonechecked = input.clonenode( true ).checked; // make sure that the options inside disabled selects aren't marked as disabled // (webkit marks them as disabled) select.disabled = true; support.optdisabled = !opt.disabled; // test to see if it's possible to delete an expando from an element // fails in internet explorer try { delete div.test; } catch( e ) { support.deleteexpando = false; } if ( !div.addeventlistener && div.attachevent && div.fireevent ) { div.attachevent( "onclick", function() { // cloning a node shouldn't copy over any // bound event handlers (ie does this) support.nocloneevent = false; }); div.clonenode( true ).fireevent( "onclick" ); } // check if a radio maintains its value // after being appended to the dom input = document.createelement("input"); input.value = "t"; input.setattribute("type", "radio"); support.radiovalue = input.value === "t"; input.setattribute("checked", "checked"); // #11217 - webkit loses check when the name is after the checked attribute input.setattribute( "name", "t" ); div.appendchild( input ); fragment = document.createdocumentfragment(); fragment.appendchild( div.lastchild ); // webkit doesn't clone checked state correctly in fragments support.checkclone = fragment.clonenode( true ).clonenode( true ).lastchild.checked; // check if a disconnected checkbox will retain its checked // value of true after appended to the dom (ie6/7) support.appendchecked = input.checked; fragment.removechild( input ); fragment.appendchild( div ); // technique from juriy zaytsev // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ // we only care about the case where non-standard event systems // are used, namely in ie. short-circuiting here helps us to // avoid an eval call (in setattribute) which can cause csp // to go haywire. see: https://developer.mozilla.org/en/security/csp if ( div.attachevent ) { for ( i in { submit: 1, change: 1, focusin: 1 }) { eventname = "on" + i; issupported = ( eventname in div ); if ( !issupported ) { div.setattribute( eventname, "return;" ); issupported = ( typeof div[ eventname ] === "function" ); } support[ i + "bubbles" ] = issupported; } } fragment.removechild( div ); // null elements to avoid leaks in ie fragment = select = opt = div = input = null; // run tests that need a body at doc ready jquery(function() { var container, outer, inner, table, td, offsetsupport, margindiv, conmargintop, style, html, positiontopleftwidthheight, paddingmarginbordervisibility, paddingmarginborder, body = document.getelementsbytagname("body")[0]; if ( !body ) { // return for frameset docs that don't have a body return; } conmargintop = 1; paddingmarginborder = "padding:0;margin:0;border:"; positiontopleftwidthheight = "position:absolute;top:0;left:0;width:1px;height:1px;"; paddingmarginbordervisibility = paddingmarginborder + "0;visibility:hidden;"; style = "style='" + positiontopleftwidthheight + paddingmarginborder + "5px solid #000;"; html = "
" + "" + "
"; container = document.createelement("div"); container.style.csstext = paddingmarginbordervisibility + "width:0;height:0;position:static;top:0;margin-top:" + conmargintop + "px"; body.insertbefore( container, body.firstchild ); // construct the test element div = document.createelement("div"); container.appendchild( div ); // check if table cells still have offsetwidth/height when they are set // to display:none and there are still other visible table cells in a // table row; if so, offsetwidth/height are not reliable for use when // determining if an element has been hidden directly using // display:none (it is still safe to use offsets if a parent element is // hidden; don safety goggles and see bug #4512 for more information). // (only ie 8 fails this test) div.innerhtml = "
t
"; tds = div.getelementsbytagname( "td" ); issupported = ( tds[ 0 ].offsetheight === 0 ); tds[ 0 ].style.display = ""; tds[ 1 ].style.display = "none"; // check if empty table cells still have offsetwidth/height // (ie <= 8 fail this test) support.reliablehiddenoffsets = issupported && ( tds[ 0 ].offsetheight === 0 ); // check if div with explicit width and no margin-right incorrectly // gets computed margin-right based on width of container. for more // info see bug #3333 // fails in webkit before feb 2011 nightlies // webkit bug 13343 - getcomputedstyle returns wrong value for margin-right if ( window.getcomputedstyle ) { div.innerhtml = ""; margindiv = document.createelement( "div" ); margindiv.style.width = "0"; margindiv.style.marginright = "0"; div.style.width = "2px"; div.appendchild( margindiv ); support.reliablemarginright = ( parseint( ( window.getcomputedstyle( margindiv, null ) || { marginright: 0 } ).marginright, 10 ) || 0 ) === 0; } if ( typeof div.style.zoom !== "undefined" ) { // check if natively block-level elements act like inline-block // elements when setting their display to 'inline' and giving // them layout // (ie < 8 does this) div.innerhtml = ""; div.style.width = div.style.padding = "1px"; div.style.border = 0; div.style.overflow = "hidden"; div.style.display = "inline"; div.style.zoom = 1; support.inlineblockneedslayout = ( div.offsetwidth === 3 ); // check if elements with layout shrink-wrap their children // (ie 6 does this) div.style.display = "block"; div.style.overflow = "visible"; div.innerhtml = "
"; support.shrinkwrapblocks = ( div.offsetwidth !== 3 ); } div.style.csstext = positiontopleftwidthheight + paddingmarginbordervisibility; div.innerhtml = html; outer = div.firstchild; inner = outer.firstchild; td = outer.nextsibling.firstchild.firstchild; offsetsupport = { doesnotaddborder: ( inner.offsettop !== 5 ), doesaddborderfortableandcells: ( td.offsettop === 5 ) }; inner.style.position = "fixed"; inner.style.top = "20px"; // safari subtracts parent border width here which is 5px offsetsupport.fixedposition = ( inner.offsettop === 20 || inner.offsettop === 15 ); inner.style.position = inner.style.top = ""; outer.style.overflow = "hidden"; outer.style.position = "relative"; offsetsupport.subtractsborderforoverflownotvisible = ( inner.offsettop === -5 ); offsetsupport.doesnotincludemargininbodyoffset = ( body.offsettop !== conmargintop ); if ( window.getcomputedstyle ) { div.style.margintop = "1%"; support.pixelmargin = ( window.getcomputedstyle( div, null ) || { margintop: 0 } ).margintop !== "1%"; } if ( typeof container.style.zoom !== "undefined" ) { container.style.zoom = 1; } body.removechild( container ); margindiv = div = container = null; jquery.extend( support, offsetsupport ); }); return support; })(); var rbrace = /^(?:\{.*\}|\[.*\])$/, rmultidash = /([a-z])/g; jquery.extend({ cache: {}, // please use with caution uuid: 0, // unique for each copy of jquery on the page // non-digits removed to match rinlinejquery expando: "jquery" + ( jquery.fn.jquery + math.random() ).replace( /\d/g, "" ), // the following elements throw uncatchable exceptions if you // attempt to add expando properties to them. nodata: { "embed": true, // ban all objects except for flash (which handle expandos) "object": "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000", "applet": true }, hasdata: function( elem ) { elem = elem.nodetype ? jquery.cache[ elem[jquery.expando] ] : elem[ jquery.expando ]; return !!elem && !isemptydataobject( elem ); }, data: function( elem, name, data, pvt /* internal use only */ ) { if ( !jquery.acceptdata( elem ) ) { return; } var privatecache, thiscache, ret, internalkey = jquery.expando, getbyname = typeof name === "string", // we have to handle dom nodes and js objects differently because ie6-7 // can't gc object references properly across the dom-js boundary isnode = elem.nodetype, // only dom nodes need the global jquery cache; js object data is // attached directly to the object so gc can occur automatically cache = isnode ? jquery.cache : elem, // only defining an id for js objects if its cache already exists allows // the code to shortcut on the same path as a dom node with no cache id = isnode ? elem[ internalkey ] : elem[ internalkey ] && internalkey, isevents = name === "events"; // avoid doing any more work than we need to when trying to get data on an // object that has no data at all if ( (!id || !cache[id] || (!isevents && !pvt && !cache[id].data)) && getbyname && data === undefined ) { return; } if ( !id ) { // only dom nodes need a new unique id for each element since their data // ends up in the global cache if ( isnode ) { elem[ internalkey ] = id = ++jquery.uuid; } else { id = internalkey; } } if ( !cache[ id ] ) { cache[ id ] = {}; // avoids exposing jquery metadata on plain js objects when the object // is serialized using json.stringify if ( !isnode ) { cache[ id ].tojson = jquery.noop; } } // an object can be passed to jquery.data instead of a key/value pair; this gets // shallow copied over onto the existing cache if ( typeof name === "object" || typeof name === "function" ) { if ( pvt ) { cache[ id ] = jquery.extend( cache[ id ], name ); } else { cache[ id ].data = jquery.extend( cache[ id ].data, name ); } } privatecache = thiscache = cache[ id ]; // jquery data() is stored in a separate object inside the object's internal data // cache in order to avoid key collisions between internal data and user-defined // data. if ( !pvt ) { if ( !thiscache.data ) { thiscache.data = {}; } thiscache = thiscache.data; } if ( data !== undefined ) { thiscache[ jquery.camelcase( name ) ] = data; } // users should not attempt to inspect the internal events object using jquery.data, // it is undocumented and subject to change. but does anyone listen? no. if ( isevents && !thiscache[ name ] ) { return privatecache.events; } // check for both converted-to-camel and non-converted data property names // if a data property was specified if ( getbyname ) { // first try to find as-is property data ret = thiscache[ name ]; // test for null|undefined property data if ( ret == null ) { // try to find the camelcased property ret = thiscache[ jquery.camelcase( name ) ]; } } else { ret = thiscache; } return ret; }, removedata: function( elem, name, pvt /* internal use only */ ) { if ( !jquery.acceptdata( elem ) ) { return; } var thiscache, i, l, // reference to internal data cache key internalkey = jquery.expando, isnode = elem.nodetype, // see jquery.data for more information cache = isnode ? jquery.cache : elem, // see jquery.data for more information id = isnode ? elem[ internalkey ] : internalkey; // if there is already no cache entry for this object, there is no // purpose in continuing if ( !cache[ id ] ) { return; } if ( name ) { thiscache = pvt ? cache[ id ] : cache[ id ].data; if ( thiscache ) { // support array or space separated string names for data keys if ( !jquery.isarray( name ) ) { // try the string as a key before any manipulation if ( name in thiscache ) { name = [ name ]; } else { // split the camel cased version by spaces unless a key with the spaces exists name = jquery.camelcase( name ); if ( name in thiscache ) { name = [ name ]; } else { name = name.split( " " ); } } } for ( i = 0, l = name.length; i < l; i++ ) { delete thiscache[ name[i] ]; } // if there is no data left in the cache, we want to continue // and let the cache object itself get destroyed if ( !( pvt ? isemptydataobject : jquery.isemptyobject )( thiscache ) ) { return; } } } // see jquery.data for more information if ( !pvt ) { delete cache[ id ].data; // don't destroy the parent cache unless the internal data object // had been the only thing left in it if ( !isemptydataobject(cache[ id ]) ) { return; } } // browsers that fail expando deletion also refuse to delete expandos on // the window, but it will allow it on all other js objects; other browsers // don't care // ensure that `cache` is not a window object #10080 if ( jquery.support.deleteexpando || !cache.setinterval ) { delete cache[ id ]; } else { cache[ id ] = null; } // we destroyed the cache and need to eliminate the expando on the node to avoid // false lookups in the cache for entries that no longer exist if ( isnode ) { // ie does not allow us to delete expando properties from nodes, // nor does it have a removeattribute function on document nodes; // we must handle all of these cases if ( jquery.support.deleteexpando ) { delete elem[ internalkey ]; } else if ( elem.removeattribute ) { elem.removeattribute( internalkey ); } else { elem[ internalkey ] = null; } } }, // for internal use only. _data: function( elem, name, data ) { return jquery.data( elem, name, data, true ); }, // a method for determining if a dom node can handle the data expando acceptdata: function( elem ) { if ( elem.nodename ) { var match = jquery.nodata[ elem.nodename.tolowercase() ]; if ( match ) { return !(match === true || elem.getattribute("classid") !== match); } } return true; } }); jquery.fn.extend({ data: function( key, value ) { var parts, part, attr, name, l, elem = this[0], i = 0, data = null; // gets all values if ( key === undefined ) { if ( this.length ) { data = jquery.data( elem ); if ( elem.nodetype === 1 && !jquery._data( elem, "parsedattrs" ) ) { attr = elem.attributes; for ( l = attr.length; i < l; i++ ) { name = attr[i].name; if ( name.indexof( "data-" ) === 0 ) { name = jquery.camelcase( name.substring(5) ); dataattr( elem, name, data[ name ] ); } } jquery._data( elem, "parsedattrs", true ); } } return data; } // sets multiple values if ( typeof key === "object" ) { return this.each(function() { jquery.data( this, key ); }); } parts = key.split( ".", 2 ); parts[1] = parts[1] ? "." + parts[1] : ""; part = parts[1] + "!"; return jquery.access( this, function( value ) { if ( value === undefined ) { data = this.triggerhandler( "getdata" + part, [ parts[0] ] ); // try to fetch any internally stored data first if ( data === undefined && elem ) { data = jquery.data( elem, key ); data = dataattr( elem, key, data ); } return data === undefined && parts[1] ? this.data( parts[0] ) : data; } parts[1] = value; this.each(function() { var self = jquery( this ); self.triggerhandler( "setdata" + part, parts ); jquery.data( this, key, value ); self.triggerhandler( "changedata" + part, parts ); }); }, null, value, arguments.length > 1, null, false ); }, removedata: function( key ) { return this.each(function() { jquery.removedata( this, key ); }); } }); function dataattr( elem, key, data ) { // if nothing was found internally, try to fetch any // data from the html5 data-* attribute if ( data === undefined && elem.nodetype === 1 ) { var name = "data-" + key.replace( rmultidash, "-$1" ).tolowercase(); data = elem.getattribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : jquery.isnumeric( data ) ? +data : rbrace.test( data ) ? jquery.parsejson( data ) : data; } catch( e ) {} // make sure we set the data so it isn't changed later jquery.data( elem, key, data ); } else { data = undefined; } } return data; } // checks a cache object for emptiness function isemptydataobject( obj ) { for ( var name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jquery.isemptyobject( obj[name] ) ) { continue; } if ( name !== "tojson" ) { return false; } } return true; } function handlequeuemarkdefer( elem, type, src ) { var deferdatakey = type + "defer", queuedatakey = type + "queue", markdatakey = type + "mark", defer = jquery._data( elem, deferdatakey ); if ( defer && ( src === "queue" || !jquery._data(elem, queuedatakey) ) && ( src === "mark" || !jquery._data(elem, markdatakey) ) ) { // give room for hard-coded callbacks to fire first // and eventually mark/queue something else on the element settimeout( function() { if ( !jquery._data( elem, queuedatakey ) && !jquery._data( elem, markdatakey ) ) { jquery.removedata( elem, deferdatakey, true ); defer.fire(); } }, 0 ); } } jquery.extend({ _mark: function( elem, type ) { if ( elem ) { type = ( type || "fx" ) + "mark"; jquery._data( elem, type, (jquery._data( elem, type ) || 0) + 1 ); } }, _unmark: function( force, elem, type ) { if ( force !== true ) { type = elem; elem = force; force = false; } if ( elem ) { type = type || "fx"; var key = type + "mark", count = force ? 0 : ( (jquery._data( elem, key ) || 1) - 1 ); if ( count ) { jquery._data( elem, key, count ); } else { jquery.removedata( elem, key, true ); handlequeuemarkdefer( elem, type, "mark" ); } } }, queue: function( elem, type, data ) { var q; if ( elem ) { type = ( type || "fx" ) + "queue"; q = jquery._data( elem, type ); // speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !q || jquery.isarray(data) ) { q = jquery._data( elem, type, jquery.makearray(data) ); } else { q.push( data ); } } return q || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jquery.queue( elem, type ), fn = queue.shift(), hooks = {}; // if the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); } if ( fn ) { // add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } jquery._data( elem, type + ".run", hooks ); fn.call( elem, function() { jquery.dequeue( elem, type ); }, hooks ); } if ( !queue.length ) { jquery.removedata( elem, type + "queue " + type + ".run", true ); handlequeuemarkdefer( elem, type, "queue" ); } } }); jquery.fn.extend({ queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jquery.queue( this[0], type ); } return data === undefined ? this : this.each(function() { var queue = jquery.queue( this, type, data ); if ( type === "fx" && queue[0] !== "inprogress" ) { jquery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jquery.dequeue( this, type ); }); }, // based off of the plugin by clint helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function( time, type ) { time = jquery.fx ? jquery.fx.speeds[ time ] || time : time; type = type || "fx"; return this.queue( type, function( next, hooks ) { var timeout = settimeout( next, time ); hooks.stop = function() { cleartimeout( timeout ); }; }); }, clearqueue: function( type ) { return this.queue( type || "fx", [] ); }, // get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, object ) { if ( typeof type !== "string" ) { object = type; type = undefined; } type = type || "fx"; var defer = jquery.deferred(), elements = this, i = elements.length, count = 1, deferdatakey = type + "defer", queuedatakey = type + "queue", markdatakey = type + "mark", tmp; function resolve() { if ( !( --count ) ) { defer.resolvewith( elements, [ elements ] ); } } while( i-- ) { if (( tmp = jquery.data( elements[ i ], deferdatakey, undefined, true ) || ( jquery.data( elements[ i ], queuedatakey, undefined, true ) || jquery.data( elements[ i ], markdatakey, undefined, true ) ) && jquery.data( elements[ i ], deferdatakey, jquery.callbacks( "once memory" ), true ) )) { count++; tmp.add( resolve ); } } resolve(); return defer.promise( object ); } }); 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({ attr: function( name, value ) { return jquery.access( this, jquery.attr, name, value, arguments.length > 1 ); }, removeattr: function( name ) { return this.each(function() { jquery.removeattr( this, name ); }); }, prop: function( name, value ) { return jquery.access( this, jquery.prop, name, value, arguments.length > 1 ); }, removeprop: function( name ) { name = jquery.propfix[ name ] || name; return this.each(function() { // try/catch handles cases where ie balks (such as removing a property on window) try { this[ name ] = undefined; delete this[ name ]; } catch( e ) {} }); }, addclass: function( value ) { var classnames, i, l, elem, setclass, c, cl; if ( jquery.isfunction( value ) ) { return this.each(function( j ) { jquery( this ).addclass( value.call(this, j, this.classname) ); }); } if ( value && typeof value === "string" ) { classnames = value.split( rspace ); for ( i = 0, l = this.length; i < l; i++ ) { elem = this[ i ]; if ( elem.nodetype === 1 ) { if ( !elem.classname && classnames.length === 1 ) { elem.classname = value; } else { setclass = " " + elem.classname + " "; for ( c = 0, cl = classnames.length; c < cl; c++ ) { if ( !~setclass.indexof( " " + classnames[ c ] + " " ) ) { setclass += classnames[ c ] + " "; } } elem.classname = jquery.trim( setclass ); } } } } return this; }, removeclass: function( value ) { var classnames, i, l, elem, classname, c, cl; if ( jquery.isfunction( value ) ) { return this.each(function( j ) { jquery( this ).removeclass( value.call(this, j, this.classname) ); }); } if ( (value && typeof value === "string") || value === undefined ) { classnames = ( value || "" ).split( rspace ); for ( i = 0, l = this.length; i < l; i++ ) { elem = this[ i ]; if ( elem.nodetype === 1 && elem.classname ) { if ( value ) { classname = (" " + elem.classname + " ").replace( rclass, " " ); for ( c = 0, cl = classnames.length; c < cl; c++ ) { classname = classname.replace(" " + classnames[ c ] + " ", " "); } elem.classname = jquery.trim( classname ); } else { elem.classname = ""; } } } } return this; }, toggleclass: function( value, stateval ) { var type = typeof value, isbool = typeof stateval === "boolean"; if ( jquery.isfunction( value ) ) { return this.each(function( i ) { jquery( this ).toggleclass( value.call(this, i, this.classname, stateval), stateval ); }); } return this.each(function() { if ( type === "string" ) { // toggle individual class names var classname, i = 0, self = jquery( this ), state = stateval, classnames = value.split( rspace ); while ( (classname = classnames[ i++ ]) ) { // check each classname given, space seperated list state = isbool ? state : !self.hasclass( classname ); self[ state ? "addclass" : "removeclass" ]( classname ); } } else if ( type === "undefined" || type === "boolean" ) { if ( this.classname ) { // store classname if set jquery._data( this, "__classname__", this.classname ); } // toggle whole classname this.classname = this.classname || value === false ? "" : jquery._data( this, "__classname__" ) || ""; } }); }, hasclass: function( selector ) { var classname = " " + selector + " ", i = 0, l = this.length; for ( ; i < l; i++ ) { if ( this[i].nodetype === 1 && (" " + this[i].classname + " ").replace(rclass, " ").indexof( classname ) > -1 ) { return true; } } return false; }, val: function( value ) { var hooks, ret, isfunction, elem = this[0]; if ( !arguments.length ) { if ( elem ) { hooks = jquery.valhooks[ elem.type ] || jquery.valhooks[ elem.nodename.tolowercase() ]; if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { return ret; } ret = elem.value; return typeof ret === "string" ? // handle most common string cases ret.replace(rreturn, "") : // handle cases where value is null/undef or number ret == null ? "" : ret; } return; } isfunction = jquery.isfunction( value ); return this.each(function( i ) { var self = jquery(this), val; if ( this.nodetype !== 1 ) { return; } if ( isfunction ) { val = value.call( this, i, self.val() ); } else { val = value; } // treat null/undefined as ""; convert numbers to string if ( val == null ) { val = ""; } else if ( typeof val === "number" ) { val += ""; } else if ( jquery.isarray( val ) ) { val = jquery.map(val, function ( value ) { return value == null ? "" : value + ""; }); } hooks = jquery.valhooks[ this.type ] || jquery.valhooks[ this.nodename.tolowercase() ]; // if set returns undefined, fall back to normal setting if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { this.value = val; } }); } }); jquery.extend({ valhooks: { option: { get: function( elem ) { // attributes.value is undefined in blackberry 4.7 but // uses .value. see #6932 var val = elem.attributes.value; return !val || val.specified ? elem.value : elem.text; } }, select: { get: function( elem ) { var value, i, max, option, index = elem.selectedindex, values = [], options = elem.options, one = elem.type === "select-one"; // nothing was selected if ( index < 0 ) { return null; } // loop through all the selected options i = one ? index : 0; max = one ? index + 1 : options.length; for ( ; i < max; i++ ) { option = options[ i ]; // don't return options that are disabled or in a disabled optgroup if ( option.selected && (jquery.support.optdisabled ? !option.disabled : option.getattribute("disabled") === null) && (!option.parentnode.disabled || !jquery.nodename( option.parentnode, "optgroup" )) ) { // get the specific value for the option value = jquery( option ).val(); // we don't need an array for one selects if ( one ) { return value; } // multi-selects return an array values.push( value ); } } // fixes bug #2551 -- select.val() broken in ie after form.reset() if ( one && !values.length && options.length ) { return jquery( options[ index ] ).val(); } return values; }, set: function( elem, value ) { var values = jquery.makearray( value ); jquery(elem).find("option").each(function() { this.selected = jquery.inarray( jquery(this).val(), values ) >= 0; }); if ( !values.length ) { elem.selectedindex = -1; } return values; } } }, attrfn: { val: true, css: true, html: true, text: true, data: true, width: true, height: true, offset: true }, attr: function( elem, name, value, pass ) { var ret, hooks, notxml, ntype = elem.nodetype; // don't get/set attributes on text, comment and attribute nodes if ( !elem || ntype === 3 || ntype === 8 || ntype === 2 ) { return; } if ( pass && name in jquery.attrfn ) { return jquery( elem )[ name ]( value ); } // fallback to prop when attributes are not supported if ( typeof elem.getattribute === "undefined" ) { return jquery.prop( elem, name, value ); } notxml = ntype !== 1 || !jquery.isxmldoc( elem ); // all attributes are lowercase // grab necessary hook if one is defined if ( notxml ) { name = name.tolowercase(); hooks = jquery.attrhooks[ name ] || ( rboolean.test( name ) ? boolhook : nodehook ); } if ( value !== undefined ) { if ( value === null ) { jquery.removeattr( elem, name ); return; } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { elem.setattribute( name, "" + value ); return value; } } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { ret = elem.getattribute( name ); // non-existent attributes return null, we normalize to undefined return ret === null ? undefined : ret; } }, removeattr: function( elem, value ) { var propname, attrnames, name, l, isbool, i = 0; if ( value && elem.nodetype === 1 ) { attrnames = value.tolowercase().split( rspace ); l = attrnames.length; for ( ; i < l; i++ ) { name = attrnames[ i ]; if ( name ) { propname = jquery.propfix[ name ] || name; isbool = rboolean.test( name ); // see #9699 for explanation of this approach (setting first, then removal) // do not do this for boolean attributes (see #10870) if ( !isbool ) { jquery.attr( elem, name, "" ); } elem.removeattribute( getsetattribute ? name : propname ); // set corresponding property to false for boolean attributes if ( isbool && propname in elem ) { elem[ propname ] = false; } } } } }, attrhooks: { type: { set: function( elem, value ) { // we can't allow the type property to be changed (since it causes problems in ie) if ( rtype.test( elem.nodename ) && elem.parentnode ) { jquery.error( "type property can't be changed" ); } else if ( !jquery.support.radiovalue && value === "radio" && jquery.nodename(elem, "input") ) { // setting the type on a radio button after the value resets the value in ie6-9 // reset value to it's default in case type is set after value // this is for element creation var val = elem.value; elem.setattribute( "type", value ); if ( val ) { elem.value = val; } return value; } } }, // use the value property for back compat // use the nodehook for button elements in ie6/7 (#1954) value: { get: function( elem, name ) { if ( nodehook && jquery.nodename( elem, "button" ) ) { return nodehook.get( elem, name ); } return name in elem ? elem.value : null; }, set: function( elem, value, name ) { if ( nodehook && jquery.nodename( elem, "button" ) ) { return nodehook.set( elem, value, name ); } // does not return so that setattribute is also used elem.value = value; } } }, propfix: { tabindex: "tabindex", readonly: "readonly", "for": "htmlfor", "class": "classname", maxlength: "maxlength", cellspacing: "cellspacing", cellpadding: "cellpadding", rowspan: "rowspan", colspan: "colspan", usemap: "usemap", frameborder: "frameborder", contenteditable: "contenteditable" }, prop: function( elem, name, value ) { var ret, hooks, notxml, ntype = elem.nodetype; // don't get/set properties on text, comment and attribute nodes if ( !elem || ntype === 3 || ntype === 8 || ntype === 2 ) { return; } notxml = ntype !== 1 || !jquery.isxmldoc( elem ); if ( notxml ) { // fix name and attach hooks name = jquery.propfix[ name ] || name; hooks = jquery.prophooks[ name ]; } if ( value !== undefined ) { if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { return ( elem[ name ] = value ); } } else { if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { return elem[ name ]; } } }, prophooks: { tabindex: { get: function( elem ) { // elem.tabindex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ var attributenode = elem.getattributenode("tabindex"); return attributenode && attributenode.specified ? parseint( attributenode.value, 10 ) : rfocusable.test( elem.nodename ) || rclickable.test( elem.nodename ) && elem.href ? 0 : undefined; } } } }); // add the tabindex prophook to attrhooks for back-compat (different case is intentional) jquery.attrhooks.tabindex = jquery.prophooks.tabindex; // hook for boolean attributes boolhook = { get: function( elem, name ) { // align boolean attributes with corresponding properties // fall back to attribute presence where some booleans are not supported var attrnode, property = jquery.prop( elem, name ); return property === true || typeof property !== "boolean" && ( attrnode = elem.getattributenode(name) ) && attrnode.nodevalue !== false ? name.tolowercase() : undefined; }, set: function( elem, value, name ) { var propname; if ( value === false ) { // remove boolean attributes when set to false jquery.removeattr( elem, name ); } else { // value is true since we know at this point it's type boolean and not false // set boolean attributes to the same name and set the dom property propname = jquery.propfix[ name ] || name; if ( propname in elem ) { // only set the idl specifically if it already exists on the element elem[ propname ] = true; } elem.setattribute( name, name.tolowercase() ); } return name; } }; // ie6/7 do not support getting/setting some attributes with get/setattribute if ( !getsetattribute ) { fixspecified = { name: true, id: true, coords: true }; // use this for any attribute in ie6/7 // this fixes almost every ie6/7 issue nodehook = jquery.valhooks.button = { get: function( elem, name ) { var ret; ret = elem.getattributenode( name ); return ret && ( fixspecified[ name ] ? ret.nodevalue !== "" : ret.specified ) ? ret.nodevalue : undefined; }, set: function( elem, value, name ) { // set the existing or create a new attribute node var ret = elem.getattributenode( name ); if ( !ret ) { ret = document.createattribute( name ); elem.setattributenode( ret ); } return ( ret.nodevalue = value + "" ); } }; // apply the nodehook to tabindex jquery.attrhooks.tabindex.set = nodehook.set; // set width and height to auto instead of 0 on empty string( bug #8150 ) // this is for removals jquery.each([ "width", "height" ], function( i, name ) { jquery.attrhooks[ name ] = jquery.extend( jquery.attrhooks[ name ], { set: function( elem, value ) { if ( value === "" ) { elem.setattribute( name, "auto" ); return value; } } }); }); // set contenteditable to false on removals(#10429) // setting to empty string throws an error as an invalid value jquery.attrhooks.contenteditable = { get: nodehook.get, set: function( elem, value, name ) { if ( value === "" ) { value = "false"; } nodehook.set( elem, value, name ); } }; } // some attributes require a special call on ie if ( !jquery.support.hrefnormalized ) { jquery.each([ "href", "src", "width", "height" ], function( i, name ) { jquery.attrhooks[ name ] = jquery.extend( jquery.attrhooks[ name ], { get: function( elem ) { var ret = elem.getattribute( name, 2 ); return ret === null ? undefined : ret; } }); }); } if ( !jquery.support.style ) { jquery.attrhooks.style = { get: function( elem ) { // return undefined in the case of empty string // normalize to lowercase since ie uppercases css property names return elem.style.csstext.tolowercase() || undefined; }, set: function( elem, value ) { return ( elem.style.csstext = "" + value ); } }; } // safari mis-reports the default selected property of an option // accessing the parent's selectedindex property fixes it if ( !jquery.support.optselected ) { jquery.prophooks.selected = jquery.extend( jquery.prophooks.selected, { get: function( elem ) { var parent = elem.parentnode; if ( parent ) { parent.selectedindex; // make sure that it also works with optgroups, see #5701 if ( parent.parentnode ) { parent.parentnode.selectedindex; } } return null; } }); } // ie6/7 call enctype encoding if ( !jquery.support.enctype ) { jquery.propfix.enctype = "encoding"; } // radios and checkboxes getter/setter if ( !jquery.support.checkon ) { jquery.each([ "radio", "checkbox" ], function() { jquery.valhooks[ this ] = { get: function( elem ) { // handle the case where in webkit "" is returned instead of "on" if a value isn't specified return elem.getattribute("value") === null ? "on" : elem.value; } }; }); } jquery.each([ "radio", "checkbox" ], function() { jquery.valhooks[ this ] = jquery.extend( jquery.valhooks[ this ], { set: function( elem, value ) { if ( jquery.isarray( value ) ) { return ( elem.checked = jquery.inarray( jquery(elem).val(), value ) >= 0 ); } } }); }); var rformelems = /^(?:textarea|input|select)$/i, rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, rhoverhack = /(?:^|\s)hover(\.\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 ) { var elemdata, eventhandle, events, t, tns, type, namespaces, handleobj, handleobjin, quick, handlers, special; // don't attach events to nodata or text/comment nodes (allow plain objects tho) if ( elem.nodetype === 3 || elem.nodetype === 8 || !types || !handler || !(elemdata = jquery._data( elem )) ) { return; } // caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleobjin = handler; handler = handleobjin.handler; selector = handleobjin.selector; } // make sure that the handler has a unique id, used to find/remove it later if ( !handler.guid ) { handler.guid = jquery.guid++; } // init the element's event structure and main handler, if this is the first events = elemdata.events; if ( !events ) { elemdata.events = events = {}; } eventhandle = elemdata.handle; if ( !eventhandle ) { elemdata.handle = eventhandle = function( e ) { // discard the second event of a jquery.event.trigger() and // when an event is called after a page has unloaded return typeof jquery !== "undefined" && (!e || jquery.event.triggered !== e.type) ? jquery.event.dispatch.apply( eventhandle.elem, arguments ) : undefined; }; // add elem as a property of the handle fn to prevent a memory leak with ie non-native events eventhandle.elem = elem; } // handle multiple events separated by a space // jquery(...).bind("mouseover mouseout", fn); types = jquery.trim( hoverhack(types) ).split( " " ); for ( t = 0; t < types.length; t++ ) { tns = rtypenamespace.exec( types[t] ) || []; type = tns[1]; namespaces = ( tns[2] || "" ).split( "." ).sort(); // if event changes its type, use the special event handlers for the changed type special = jquery.event.special[ type ] || {}; // if selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegatetype : special.bindtype ) || type; // update special based on newly reset type special = jquery.event.special[ type ] || {}; // handleobj is passed to all event handlers handleobj = jquery.extend({ type: type, origtype: tns[1], data: data, handler: handler, guid: handler.guid, selector: selector, quick: selector && quickparse( selector ), namespace: namespaces.join(".") }, handleobjin ); // init the event handler queue if we're the first handlers = events[ type ]; if ( !handlers ) { handlers = events[ type ] = []; handlers.delegatecount = 0; // only use addeventlistener/attachevent if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventhandle ) === false ) { // bind the global event handler to the element if ( elem.addeventlistener ) { elem.addeventlistener( type, eventhandle, false ); } else if ( elem.attachevent ) { elem.attachevent( "on" + type, eventhandle ); } } } if ( special.add ) { special.add.call( elem, handleobj ); if ( !handleobj.handler.guid ) { handleobj.handler.guid = handler.guid; } } // add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegatecount++, 0, handleobj ); } else { handlers.push( handleobj ); } // keep track of which events have ever been used, for event optimization jquery.event.global[ type ] = true; } // nullify elem to prevent memory leaks in ie elem = null; }, global: {}, // detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedtypes ) { var elemdata = jquery.hasdata( elem ) && jquery._data( elem ), t, tns, type, origtype, namespaces, origcount, j, events, special, handle, eventtype, handleobj; if ( !elemdata || !(events = elemdata.events) ) { return; } // once for each type.namespace in types; type may be omitted types = jquery.trim( hoverhack( types || "" ) ).split(" "); for ( t = 0; t < types.length; t++ ) { tns = rtypenamespace.exec( types[t] ) || []; type = origtype = tns[1]; namespaces = tns[2]; // unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jquery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jquery.event.special[ type ] || {}; type = ( selector? special.delegatetype : special.bindtype ) || type; eventtype = events[ type ] || []; origcount = eventtype.length; namespaces = namespaces ? new regexp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; // remove matching events for ( j = 0; j < eventtype.length; j++ ) { handleobj = eventtype[ j ]; if ( ( mappedtypes || origtype === handleobj.origtype ) && ( !handler || handler.guid === handleobj.guid ) && ( !namespaces || namespaces.test( handleobj.namespace ) ) && ( !selector || selector === handleobj.selector || selector === "**" && handleobj.selector ) ) { eventtype.splice( j--, 1 ); if ( handleobj.selector ) { eventtype.delegatecount--; } if ( special.remove ) { special.remove.call( elem, handleobj ); } } } // remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( eventtype.length === 0 && origcount !== eventtype.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { jquery.removeevent( elem, type, elemdata.handle ); } delete events[ type ]; } } // remove the expando if it's no longer used if ( jquery.isemptyobject( events ) ) { handle = elemdata.handle; if ( handle ) { handle.elem = null; } // removedata also checks for emptiness and clears the expando if empty // so use it instead of delete jquery.removedata( elem, [ "events", "handle" ], true ); } }, // 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 ) { // don't do events on text and comment nodes if ( elem && (elem.nodetype === 3 || elem.nodetype === 8) ) { return; } // event object or event type var type = event.type || event, namespaces = [], cache, exclusive, i, cur, old, ontype, special, handle, eventpath, bubbletype; // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusmorph.test( type + jquery.event.triggered ) ) { return; } if ( type.indexof( "!" ) >= 0 ) { // exclusive events trigger only for the exact event (no namespaces) type = type.slice(0, -1); exclusive = true; } if ( type.indexof( "." ) >= 0 ) { // namespaced trigger; create a regexp to match event type in handle() namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } if ( (!elem || jquery.event.customevent[ type ]) && !jquery.event.global[ type ] ) { // no jquery handlers for this event type, and it can't have inline handlers return; } // caller can pass in an event, object, or just an event type string event = typeof event === "object" ? // jquery.event object event[ jquery.expando ] ? event : // object literal new jquery.event( type, event ) : // just the event type (string) new jquery.event( type ); event.type = type; event.istrigger = true; event.exclusive = exclusive; event.namespace = namespaces.join( "." ); event.namespace_re = event.namespace? new regexp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; ontype = type.indexof( ":" ) < 0 ? "on" + type : ""; // handle a global trigger if ( !elem ) { // todo: stop taunting the data cache; remove global events and always attach to document cache = jquery.cache; for ( i in cache ) { if ( cache[ i ].events && cache[ i ].events[ type ] ) { jquery.event.trigger( event, data, cache[ i ].handle.elem, true ); } } return; } // clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // clone any incoming data and prepend the event, creating the handler arg list data = data != null ? jquery.makearray( data ) : []; data.unshift( event ); // allow special events to draw outside the lines special = jquery.event.special[ type ] || {}; if ( special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // determine event propagation path in advance, per w3c events spec (#9951) // bubble up to document, then to window; watch for a global ownerdocument var (#9724) eventpath = [[ elem, special.bindtype || type ]]; if ( !onlyhandlers && !special.nobubble && !jquery.iswindow( elem ) ) { bubbletype = special.delegatetype || type; cur = rfocusmorph.test( bubbletype + type ) ? elem : elem.parentnode; old = null; for ( ; cur; cur = cur.parentnode ) { eventpath.push([ cur, bubbletype ]); old = cur; } // only add window if we got to document (e.g., not plain obj or detached dom) if ( old && old === elem.ownerdocument ) { eventpath.push([ old.defaultview || old.parentwindow || window, bubbletype ]); } } // fire handlers on the event path for ( i = 0; i < eventpath.length && !event.ispropagationstopped(); i++ ) { cur = eventpath[i][0]; event.type = eventpath[i][1]; handle = ( jquery._data( cur, "events" ) || {} )[ event.type ] && jquery._data( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // note that this is a bare js function and not a jquery handler handle = ontype && cur[ ontype ]; if ( handle && jquery.acceptdata( cur ) && handle.apply( cur, data ) === false ) { event.preventdefault(); } } event.type = type; // if nobody prevented the default action, do it now if ( !onlyhandlers && !event.isdefaultprevented() ) { if ( (!special._default || special._default.apply( elem.ownerdocument, data ) === false) && !(type === "click" && jquery.nodename( elem, "a" )) && jquery.acceptdata( elem ) ) { // call a native dom method on the target with the same name name as the event. // can't use an .isfunction() check here because ie6/7 fails that test. // don't do default actions on window, that's where global variables be (#6170) // ie<9 dies on focus/blur to hidden element (#1486) if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetwidth !== 0) && !jquery.iswindow( elem ) ) { // don't re-trigger an onfoo event when we call its foo() method old = elem[ ontype ]; if ( old ) { elem[ ontype ] = null; } // prevent re-triggering of the same event, since we already bubbled it above jquery.event.triggered = type; elem[ type ](); jquery.event.triggered = undefined; if ( old ) { elem[ ontype ] = old; } } } } return event.result; }, dispatch: function( event ) { // make a writable jquery.event from the native event object event = jquery.event.fix( event || window.event ); var handlers = ( (jquery._data( this, "events" ) || {} )[ event.type ] || []), delegatecount = handlers.delegatecount, args = [].slice.call( arguments, 0 ), run_all = !event.exclusive && !event.namespace, special = jquery.event.special[ event.type ] || {}, handlerqueue = [], i, j, cur, jqcur, ret, selmatch, matched, matches, handleobj, sel, related; // use the fix-ed jquery.event rather than the (read-only) native event args[0] = event; event.delegatetarget = this; // call the predispatch hook for the mapped type, and let it bail if desired if ( special.predispatch && special.predispatch.call( this, event ) === false ) { return; } // determine handlers that should run if there are delegated events // avoid non-left-click bubbling in firefox (#3861) if ( delegatecount && !(event.button && event.type === "click") ) { // pregenerate a single jquery object for reuse with .is() jqcur = jquery(this); jqcur.context = this.ownerdocument || this; for ( cur = event.target; cur != this; cur = cur.parentnode || this ) { // don't process events on disabled elements (#6911, #8165) if ( cur.disabled !== true ) { selmatch = {}; matches = []; jqcur[0] = cur; for ( i = 0; i < delegatecount; i++ ) { handleobj = handlers[ i ]; sel = handleobj.selector; if ( selmatch[ sel ] === undefined ) { selmatch[ sel ] = ( handleobj.quick ? quickis( cur, handleobj.quick ) : jqcur.is( sel ) ); } if ( selmatch[ sel ] ) { matches.push( handleobj ); } } if ( matches.length ) { handlerqueue.push({ elem: cur, matches: matches }); } } } } // add the remaining (directly-bound) handlers if ( handlers.length > delegatecount ) { handlerqueue.push({ elem: this, matches: handlers.slice( delegatecount ) }); } // run delegates first; they may want to stop propagation beneath us for ( i = 0; i < handlerqueue.length && !event.ispropagationstopped(); i++ ) { matched = handlerqueue[ i ]; event.currenttarget = matched.elem; for ( j = 0; j < matched.matches.length && !event.isimmediatepropagationstopped(); j++ ) { handleobj = matched.matches[ j ]; // triggered event must either 1) be non-exclusive and have no namespace, or // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). if ( run_all || (!event.namespace && !handleobj.namespace) || event.namespace_re && event.namespace_re.test( handleobj.namespace ) ) { event.data = handleobj.data; event.handleobj = handleobj; ret = ( (jquery.event.special[ handleobj.origtype ] || {}).handle || handleobj.handler ) .apply( matched.elem, args ); if ( ret !== undefined ) { event.result = ret; if ( ret === false ) { event.preventdefault(); event.stoppropagation(); } } } } } // call the postdispatch hook for the mapped type if ( special.postdispatch ) { special.postdispatch.call( this, 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: { props: "char charcode key keycode".split(" "), filter: function( event, original ) { // add which for key events if ( event.which == null ) { event.which = original.charcode != null ? original.charcode : original.keycode; } return event; } }, mousehooks: { props: "button buttons clientx clienty fromelement offsetx offsety pagex pagey screenx screeny toelement".split(" "), filter: function( event, original ) { var eventdoc, doc, body, button = original.button, fromelement = original.fromelement; // calculate pagex/y if missing and clientx/y available if ( event.pagex == null && original.clientx != null ) { eventdoc = event.target.ownerdocument || document; doc = eventdoc.documentelement; body = eventdoc.body; event.pagex = original.clientx + ( doc && doc.scrollleft || body && body.scrollleft || 0 ) - ( doc && doc.clientleft || body && body.clientleft || 0 ); event.pagey = original.clienty + ( doc && doc.scrolltop || body && body.scrolltop || 0 ) - ( doc && doc.clienttop || body && body.clienttop || 0 ); } // add relatedtarget, if necessary if ( !event.relatedtarget && fromelement ) { event.relatedtarget = fromelement === event.target ? original.toelement : fromelement; } // add which for click: 1 === left; 2 === middle; 3 === right // note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, fix: function( event ) { if ( event[ jquery.expando ] ) { return event; } // create a writable copy of the event object and normalize some properties var i, prop, originalevent = event, fixhook = jquery.event.fixhooks[ event.type ] || {}, copy = fixhook.props ? this.props.concat( fixhook.props ) : this.props; event = jquery.event( originalevent ); for ( i = copy.length; i; ) { prop = copy[ --i ]; event[ prop ] = originalevent[ prop ]; } // fix target property, if necessary (#1925, ie 6/7/8 & safari2) if ( !event.target ) { event.target = originalevent.srcelement || document; } // target should not be a text node (#504, safari) if ( event.target.nodetype === 3 ) { event.target = event.target.parentnode; } // for mouse/key events; add metakey if it's not there (#3368, ie6/7/8) if ( event.metakey === undefined ) { event.metakey = event.ctrlkey; } return fixhook.filter? fixhook.filter( event, originalevent ) : event; }, special: { ready: { // make sure the ready event is setup setup: jquery.bindready }, load: { // prevent triggered image.load events from bubbling to window.load nobubble: true }, focus: { delegatetype: "focusin" }, blur: { delegatetype: "focusout" }, beforeunload: { setup: function( data, namespaces, eventhandle ) { // we only want to do this special case on windows if ( jquery.iswindow( this ) ) { this.onbeforeunload = eventhandle; } }, teardown: function( namespaces, eventhandle ) { if ( this.onbeforeunload === eventhandle ) { this.onbeforeunload = null; } } } }, simulate: function( type, elem, event, bubble ) { // piggyback on a donor event to simulate a different one. // fake originalevent to avoid donor's stoppropagation, but if the // simulated event prevents default then we do the same on the donor. var e = jquery.extend( new jquery.event(), event, { type: type, issimulated: true, originalevent: {} } ); if ( bubble ) { jquery.event.trigger( e, null, elem ); } else { jquery.event.dispatch.call( elem, e ); } if ( e.isdefaultprevented() ) { event.preventdefault(); } } }; // 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 if ( !(this instanceof jquery.event) ) { return new jquery.event( src, props ); } // event object if ( src && src.type ) { this.originalevent = src; this.type = src.type; // events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isdefaultprevented = ( src.defaultprevented || src.returnvalue === false || src.getpreventdefault && src.getpreventdefault() ) ? returntrue : returnfalse; // event type } else { this.type = src; } // put explicitly provided properties onto the event object if ( props ) { jquery.extend( this, props ); } // create a timestamp if incoming event doesn't have one this.timestamp = src && src.timestamp || jquery.now(); // mark it as fixed this[ 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.html jquery.event.prototype = { preventdefault: function() { this.isdefaultprevented = returntrue; var e = this.originalevent; if ( !e ) { return; } // if preventdefault exists run it on the original event if ( e.preventdefault ) { e.preventdefault(); // otherwise set the returnvalue property of the original event to false (ie) } else { e.returnvalue = false; } }, stoppropagation: function() { this.ispropagationstopped = returntrue; var e = this.originalevent; if ( !e ) { return; } // if stoppropagation exists run it on the original event if ( e.stoppropagation ) { e.stoppropagation(); } // otherwise set the cancelbubble property of the original event to true (ie) e.cancelbubble = true; }, stopimmediatepropagation: function() { this.isimmediatepropagationstopped = returntrue; this.stoppropagation(); }, isdefaultprevented: returnfalse, ispropagationstopped: returnfalse, isimmediatepropagationstopped: returnfalse }; // create mouseenter/leave events using mouseover/out and event-time checks jquery.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function( orig, fix ) { jquery.event.special[ orig ] = { delegatetype: fix, bindtype: fix, handle: function( event ) { var target = this, related = event.relatedtarget, handleobj = event.handleobj, selector = handleobj.selector, ret; // for mousenter/leave call the handler if related is outside the target. // nb: no relatedtarget if the mouse left/entered the browser window if ( !related || (related !== target && !jquery.contains( target, related )) ) { event.type = handleobj.origtype; ret = handleobj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; }); // ie submit delegation if ( !jquery.support.submitbubbles ) { jquery.event.special.submit = { setup: function() { // only need this for delegated form submit events if ( jquery.nodename( this, "form" ) ) { return false; } // lazy-add a submit handler when a descendant form may potentially be submitted jquery.event.add( this, "click._submit keypress._submit", function( e ) { // node name check avoids a vml-related crash in ie (#9807) var elem = e.target, form = jquery.nodename( elem, "input" ) || jquery.nodename( elem, "button" ) ? elem.form : undefined; if ( form && !form._submit_attached ) { jquery.event.add( form, "submit._submit", function( event ) { event._submit_bubble = true; }); form._submit_attached = true; } }); // return undefined since we don't need an event listener }, postdispatch: function( event ) { // if form was submitted by the user, bubble the event up the tree if ( event._submit_bubble ) { delete event._submit_bubble; if ( this.parentnode && !event.istrigger ) { jquery.event.simulate( "submit", this.parentnode, event, true ); } } }, teardown: function() { // only need this for delegated form submit events if ( jquery.nodename( this, "form" ) ) { return false; } // remove delegated handlers; cleandata eventually reaps submit handlers attached above jquery.event.remove( this, "._submit" ); } }; } // ie change delegation and checkbox/radio fix if ( !jquery.support.changebubbles ) { jquery.event.special.change = { setup: function() { if ( rformelems.test( this.nodename ) ) { // ie doesn't fire change on a check/radio until blur; trigger it on click // after a propertychange. eat the blur-change in special.change.handle. // this still fires onchange a second time for check/radio after blur. if ( this.type === "checkbox" || this.type === "radio" ) { jquery.event.add( this, "propertychange._change", function( event ) { if ( event.originalevent.propertyname === "checked" ) { this._just_changed = true; } }); jquery.event.add( this, "click._change", function( event ) { if ( this._just_changed && !event.istrigger ) { this._just_changed = false; jquery.event.simulate( "change", this, event, true ); } }); } return false; } // delegated event; lazy-add a change handler on descendant inputs jquery.event.add( this, "beforeactivate._change", function( e ) { var elem = e.target; if ( rformelems.test( elem.nodename ) && !elem._change_attached ) { jquery.event.add( elem, "change._change", function( event ) { if ( this.parentnode && !event.issimulated && !event.istrigger ) { jquery.event.simulate( "change", this.parentnode, event, true ); } }); elem._change_attached = true; } }); }, handle: function( event ) { var elem = event.target; // swallow native change events from checkbox/radio, we already triggered them above if ( this !== elem || event.issimulated || event.istrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { return event.handleobj.handler.apply( this, arguments ); } }, teardown: function() { jquery.event.remove( this, "._change" ); return rformelems.test( this.nodename ); } }; } // create "bubbling" focus and blur events if ( !jquery.support.focusinbubbles ) { jquery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { // attach a single capturing handler while someone wants focusin/focusout var attaches = 0, handler = function( event ) { jquery.event.simulate( fix, event.target, jquery.event.fix( event ), true ); }; jquery.event.special[ fix ] = { setup: function() { if ( attaches++ === 0 ) { document.addeventlistener( orig, handler, true ); } }, teardown: function() { if ( --attaches === 0 ) { document.removeeventlistener( orig, handler, true ); } } }; }); } jquery.fn.extend({ on: function( types, selector, data, fn, /*internal*/ one ) { var origfn, type; // types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-object, selector, data ) if ( typeof selector !== "string" ) { // && selector != null // ( types-object, data ) data = data || selector; selector = undefined; } for ( type in types ) { this.on( type, selector, data, types[ type ], one ); } return this; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnfalse; } else if ( !fn ) { return this; } if ( one === 1 ) { origfn = fn; fn = function( event ) { // can use an empty set, since event contains the info jquery().off( event ); return origfn.apply( this, arguments ); }; // use same guid so caller can remove using origfn fn.guid = origfn.guid || ( origfn.guid = jquery.guid++ ); } return this.each( function() { jquery.event.add( this, types, fn, data, selector ); }); }, one: function( types, selector, data, fn ) { return this.on( types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { if ( types && types.preventdefault && types.handleobj ) { // ( event ) dispatched jquery.event var handleobj = types.handleobj; jquery( types.delegatetarget ).off( handleobj.namespace ? handleobj.origtype + "." + handleobj.namespace : handleobj.origtype, handleobj.selector, handleobj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( var type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnfalse; } return this.each(function() { jquery.event.remove( this, types, fn, selector ); }); }, bind: function( types, data, fn ) { return this.on( types, null, data, fn ); }, unbind: function( types, fn ) { return this.off( types, null, fn ); }, live: function( types, data, fn ) { jquery( this.context ).on( types, this.selector, data, fn ); return this; }, die: function( types, fn ) { jquery( this.context ).off( types, this.selector || "**", fn ); return this; }, delegate: function( selector, types, data, fn ) { return this.on( types, selector, data, fn ); }, undelegate: function( selector, types, fn ) { // ( namespace ) or ( selector, types [, fn] ) return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); }, trigger: function( type, data ) { return this.each(function() { jquery.event.trigger( type, data, this ); }); }, triggerhandler: function( type, data ) { if ( this[0] ) { return jquery.event.trigger( type, data, this[0], true ); } }, toggle: function( fn ) { // save reference to arguments for access in closure var args = arguments, guid = fn.guid || jquery.guid++, i = 0, toggler = function( event ) { // figure out which function to execute var lasttoggle = ( jquery._data( this, "lasttoggle" + fn.guid ) || 0 ) % i; jquery._data( this, "lasttoggle" + fn.guid, lasttoggle + 1 ); // make sure that clicks stop event.preventdefault(); // and execute the function return args[ lasttoggle ].apply( this, arguments ) || false; }; // link all the functions, so any of them can unbind this click handler toggler.guid = guid; while ( i < args.length ) { args[ i++ ].guid = guid; } return this.click( toggler ); }, hover: function( fnover, fnout ) { return this.mouseenter( fnover ).mouseleave( fnout || fnover ); } }); 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 ) { // handle event binding jquery.fn[ name ] = function( data, fn ) { if ( fn == null ) { fn = data; data = null; } return arguments.length > 0 ? this.on( name, null, data, fn ) : this.trigger( name ); }; if ( jquery.attrfn ) { jquery.attrfn[ name ] = true; } if ( rkeyevent.test( name ) ) { jquery.event.fixhooks[ name ] = jquery.event.keyhooks; } if ( rmouseevent.test( name ) ) { jquery.event.fixhooks[ name ] = jquery.event.mousehooks; } }); /*! * 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 ) { results = results || []; context = context || document; var origcontext = context; if ( context.nodetype !== 1 && context.nodetype !== 9 ) { return []; } if ( !selector || typeof selector !== "string" ) { return results; } var m, set, checkset, extra, ret, cur, pop, i, prune = true, contextxml = sizzle.isxml( context ), parts = [], sofar = selector; // reset the position of the chunker regexp (start from head) do { chunker.exec( "" ); m = chunker.exec( sofar ); if ( m ) { sofar = m[3]; parts.push( m[1] ); if ( m[2] ) { extra = m[3]; break; } } } while ( m ); if ( parts.length > 1 && origpos.exec( selector ) ) { if ( parts.length === 2 && expr.relative[ parts[0] ] ) { set = posprocess( parts[0] + parts[1], context, seed ); } else { set = expr.relative[ parts[0] ] ? [ context ] : sizzle( parts.shift(), context ); while ( parts.length ) { selector = parts.shift(); if ( expr.relative[ selector ] ) { selector += parts.shift(); } set = posprocess( selector, set, seed ); } } } else { // take a shortcut and set the context if the root selector is an id // (but not if it'll be faster if the inner selector is an id) if ( !seed && parts.length > 1 && context.nodetype === 9 && !contextxml && expr.match.id.test(parts[0]) && !expr.match.id.test(parts[parts.length - 1]) ) { ret = sizzle.find( parts.shift(), context, contextxml ); context = ret.expr ? sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; } if ( context ) { ret = seed ? { expr: parts.pop(), set: makearray(seed) } : sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentnode ? context.parentnode : context, contextxml ); set = ret.expr ? sizzle.filter( ret.expr, ret.set ) : ret.set; if ( parts.length > 0 ) { checkset = makearray( set ); } else { prune = false; } while ( parts.length ) { cur = parts.pop(); pop = cur; if ( !expr.relative[ cur ] ) { cur = ""; } else { pop = parts.pop(); } if ( pop == null ) { pop = context; } expr.relative[ cur ]( checkset, pop, contextxml ); } } else { checkset = parts = []; } } if ( !checkset ) { checkset = set; } if ( !checkset ) { sizzle.error( cur || selector ); } if ( tostring.call(checkset) === "[object array]" ) { if ( !prune ) { results.push.apply( results, checkset ); } else if ( context && context.nodetype === 1 ) { for ( i = 0; checkset[i] != null; i++ ) { if ( checkset[i] && (checkset[i] === true || checkset[i].nodetype === 1 && sizzle.contains(context, checkset[i])) ) { results.push( set[i] ); } } } else { for ( i = 0; checkset[i] != null; i++ ) { if ( checkset[i] && checkset[i].nodetype === 1 ) { results.push( set[i] ); } } } } else { makearray( checkset, results ); } if ( extra ) { sizzle( extra, origcontext, results, seed ); sizzle.uniquesort( results ); } return results; }; sizzle.uniquesort = function( results ) { if ( sortorder ) { hasduplicate = basehasduplicate; results.sort( sortorder ); if ( hasduplicate ) { for ( var i = 1; i < results.length; i++ ) { if ( results[i] === results[ i - 1 ] ) { results.splice( i--, 1 ); } } } } 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 ) { var set, i, len, match, type, left; if ( !expr ) { return []; } for ( i = 0, len = expr.order.length; i < len; i++ ) { type = expr.order[i]; if ( (match = expr.leftmatch[ type ].exec( expr )) ) { left = match[1]; match.splice( 1, 1 ); if ( left.substr( left.length - 1 ) !== "\\" ) { match[1] = (match[1] || "").replace( rbackslash, "" ); set = expr.find[ type ]( match, context, isxml ); if ( set != null ) { expr = expr.replace( expr.match[ type ], "" ); break; } } } } if ( !set ) { set = typeof context.getelementsbytagname !== "undefined" ? context.getelementsbytagname( "*" ) : []; } return { set: set, expr: expr }; }; sizzle.filter = function( expr, set, inplace, not ) { var match, anyfound, type, found, item, filter, left, i, pass, old = expr, result = [], curloop = set, isxmlfilter = set && set[0] && sizzle.isxml( set[0] ); while ( expr && set.length ) { for ( type in expr.filter ) { if ( (match = expr.leftmatch[ type ].exec( expr )) != null && match[2] ) { filter = expr.filter[ type ]; left = match[1]; anyfound = false; match.splice(1,1); if ( left.substr( left.length - 1 ) === "\\" ) { continue; } if ( curloop === result ) { result = []; } if ( expr.prefilter[ type ] ) { match = expr.prefilter[ type ]( match, curloop, inplace, result, not, isxmlfilter ); if ( !match ) { anyfound = found = true; } else if ( match === true ) { continue; } } if ( match ) { for ( i = 0; (item = curloop[i]) != null; i++ ) { if ( item ) { found = filter( item, match, i, curloop ); pass = not ^ found; if ( inplace && found != null ) { if ( pass ) { anyfound = true; } else { curloop[i] = false; } } else if ( pass ) { result.push( item ); anyfound = true; } } } } if ( found !== undefined ) { if ( !inplace ) { curloop = result; } expr = expr.replace( expr.match[ type ], "" ); if ( !anyfound ) { return []; } break; } } } // improper expression if ( expr === old ) { if ( anyfound == null ) { sizzle.error( expr ); } else { break; } } old = expr; } 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 ) { var i, node, nodetype = elem.nodetype, ret = ""; if ( nodetype ) { if ( nodetype === 1 || nodetype === 9 || nodetype === 11 ) { // use textcontent || innertext for elements if ( typeof elem.textcontent === 'string' ) { return elem.textcontent; } else if ( typeof elem.innertext === 'string' ) { // replace ie's carriage returns return elem.innertext.replace( rreturn, '' ); } else { // traverse it's children for ( elem = elem.firstchild; elem; elem = elem.nextsibling) { ret += gettext( elem ); } } } else if ( nodetype === 3 || nodetype === 4 ) { return elem.nodevalue; } } else { // if no nodetype, this is expected to be an array for ( i = 0; (node = elem[i]); i++ ) { // do not traverse comment nodes if ( node.nodetype !== 8 ) { ret += gettext( node ); } } } return ret; }; var expr = sizzle.selectors = { order: [ "id", "name", "tag" ], match: { id: /#((?:[\w\u00c0-\uffff\-]|\\.)+)/, class: /\.((?:[\w\u00c0-\uffff\-]|\\.)+)/, name: /\[name=['"]*((?:[\w\u00c0-\uffff\-]|\\.)+)['"]*\]/, attr: /\[\s*((?:[\w\u00c0-\uffff\-]|\\.)+)\s*(?:(\s?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uffff\-]|\\.)*)|)|)\s*\]/, tag: /^((?:[\w\u00c0-\uffff\*\-]|\\.)+)/, child: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, pos: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, pseudo: /:((?:[\w\u00c0-\uffff\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ }, leftmatch: {}, attrmap: { "class": "classname", "for": "htmlfor" }, attrhandle: { href: function( elem ) { return elem.getattribute( "href" ); }, type: function( elem ) { return elem.getattribute( "type" ); } }, relative: { "+": function(checkset, part){ var ispartstr = typeof part === "string", istag = ispartstr && !rnonword.test( part ), ispartstrnottag = ispartstr && !istag; if ( istag ) { part = part.tolowercase(); } for ( var i = 0, l = checkset.length, elem; i < l; i++ ) { if ( (elem = checkset[i]) ) { while ( (elem = elem.previoussibling) && elem.nodetype !== 1 ) {} checkset[i] = ispartstrnottag || elem && elem.nodename.tolowercase() === part ? elem || false : elem === part; } } if ( ispartstrnottag ) { sizzle.filter( part, checkset, true ); } }, ">": function( checkset, part ) { var elem, ispartstr = typeof part === "string", i = 0, l = checkset.length; if ( ispartstr && !rnonword.test( part ) ) { part = part.tolowercase(); for ( ; i < l; i++ ) { elem = checkset[i]; if ( elem ) { var parent = elem.parentnode; checkset[i] = parent.nodename.tolowercase() === part ? parent : false; } } } else { for ( ; i < l; i++ ) { elem = checkset[i]; if ( elem ) { checkset[i] = ispartstr ? elem.parentnode : elem.parentnode === part; } } if ( ispartstr ) { sizzle.filter( part, checkset, true ); } } }, "": function(checkset, part, isxml){ var nodecheck, donename = done++, checkfn = dircheck; if ( typeof part === "string" && !rnonword.test( part ) ) { part = part.tolowercase(); nodecheck = part; checkfn = dirnodecheck; } checkfn( "parentnode", part, donename, checkset, nodecheck, isxml ); }, "~": function( checkset, part, isxml ) { var nodecheck, donename = done++, checkfn = dircheck; if ( typeof part === "string" && !rnonword.test( part ) ) { part = part.tolowercase(); nodecheck = part; checkfn = dirnodecheck; } checkfn( "previoussibling", part, donename, checkset, nodecheck, isxml ); } }, find: { id: function( match, context, isxml ) { if ( typeof context.getelementbyid !== "undefined" && !isxml ) { var m = context.getelementbyid(match[1]); // check parentnode to catch when blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentnode ? [m] : []; } }, name: function( match, context ) { if ( typeof context.getelementsbyname !== "undefined" ) { var ret = [], results = context.getelementsbyname( match[1] ); for ( var i = 0, l = results.length; i < l; i++ ) { if ( results[i].getattribute("name") === match[1] ) { ret.push( results[i] ); } } return ret.length === 0 ? null : ret; } }, tag: function( match, context ) { if ( typeof context.getelementsbytagname !== "undefined" ) { return context.getelementsbytagname( match[1] ); } } }, prefilter: { class: function( match, curloop, inplace, result, not, isxml ) { match = " " + match[1].replace( rbackslash, "" ) + " "; if ( isxml ) { return match; } for ( var i = 0, elem; (elem = curloop[i]) != null; i++ ) { if ( elem ) { if ( not ^ (elem.classname && (" " + elem.classname + " ").replace(/[\t\n\r]/g, " ").indexof(match) >= 0) ) { if ( !inplace ) { result.push( elem ); } } else if ( inplace ) { curloop[i] = false; } } } return false; }, id: function( match ) { return match[1].replace( rbackslash, "" ); }, tag: function( match, curloop ) { return match[1].replace( rbackslash, "" ).tolowercase(); }, child: function( match ) { if ( match[1] === "nth" ) { if ( !match[2] ) { sizzle.error( match[0] ); } match[2] = match[2].replace(/^\+|\s*/g, ''); // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || !/\d/.test( match[2] ) && "0n+" + match[2] || match[2]); // calculate the numbers (first)n+(last) including if they are negative match[2] = (test[1] + (test[2] || 1)) - 0; match[3] = test[3] - 0; } else if ( match[2] ) { sizzle.error( match[0] ); } // todo: move to normal caching system match[0] = done++; return match; }, attr: function( match, curloop, inplace, result, not, isxml ) { var name = match[1] = match[1].replace( rbackslash, "" ); if ( !isxml && expr.attrmap[name] ) { match[1] = expr.attrmap[name]; } // handle if an un-quoted value was used match[4] = ( match[4] || match[5] || "" ).replace( rbackslash, "" ); if ( match[2] === "~=" ) { match[4] = " " + match[4] + " "; } return match; }, pseudo: function( match, curloop, inplace, result, not ) { if ( match[1] === "not" ) { // if we're dealing with a complex expression, or a simple one if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { match[3] = sizzle(match[3], null, null, curloop); } else { var ret = sizzle.filter(match[3], curloop, inplace, true ^ not); if ( !inplace ) { result.push.apply( result, ret ); } return false; } } else if ( expr.match.pos.test( match[0] ) || expr.match.child.test( match[0] ) ) { return true; } return match; }, pos: function( match ) { match.unshift( true ); return match; } }, filters: { enabled: function( elem ) { return elem.disabled === false && elem.type !== "hidden"; }, disabled: function( elem ) { return elem.disabled === true; }, checked: function( elem ) { return elem.checked === true; }, selected: function( elem ) { // accessing this property makes selected-by-default // options in safari work properly if ( elem.parentnode ) { elem.parentnode.selectedindex; } return elem.selected === true; }, parent: function( elem ) { return !!elem.firstchild; }, empty: function( elem ) { return !elem.firstchild; }, has: function( elem, i, match ) { return !!sizzle( match[3], elem ).length; }, header: function( elem ) { return (/h\d/i).test( elem.nodename ); }, text: function( elem ) { var attr = elem.getattribute( "type" ), type = elem.type; // ie6 and 7 will map elem.type to 'text' for new html5 types (search, etc) // use getattribute instead to test this case return elem.nodename.tolowercase() === "input" && "text" === type && ( attr === type || attr === null ); }, radio: function( elem ) { return elem.nodename.tolowercase() === "input" && "radio" === elem.type; }, checkbox: function( elem ) { return elem.nodename.tolowercase() === "input" && "checkbox" === elem.type; }, file: function( elem ) { return elem.nodename.tolowercase() === "input" && "file" === elem.type; }, password: function( elem ) { return elem.nodename.tolowercase() === "input" && "password" === elem.type; }, submit: function( elem ) { var name = elem.nodename.tolowercase(); return (name === "input" || name === "button") && "submit" === elem.type; }, image: function( elem ) { return elem.nodename.tolowercase() === "input" && "image" === elem.type; }, reset: function( elem ) { var name = elem.nodename.tolowercase(); return (name === "input" || name === "button") && "reset" === elem.type; }, button: function( elem ) { var name = elem.nodename.tolowercase(); return name === "input" && "button" === elem.type || name === "button"; }, input: function( elem ) { return (/input|select|textarea|button/i).test( elem.nodename ); }, focus: function( elem ) { return elem === elem.ownerdocument.activeelement; } }, setfilters: { first: function( elem, i ) { return i === 0; }, last: function( elem, i, match, array ) { return i === array.length - 1; }, even: function( elem, i ) { return i % 2 === 0; }, odd: function( elem, i ) { return i % 2 === 1; }, lt: function( elem, i, match ) { return i < match[3] - 0; }, gt: function( elem, i, match ) { return i > match[3] - 0; }, nth: function( elem, i, match ) { return match[3] - 0 === i; }, eq: function( elem, i, match ) { return match[3] - 0 === i; } }, filter: { pseudo: function( elem, match, i, array ) { var name = match[1], filter = expr.filters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } else if ( name === "contains" ) { return (elem.textcontent || elem.innertext || gettext([ elem ]) || "").indexof(match[3]) >= 0; } else if ( name === "not" ) { var not = match[3]; for ( var j = 0, l = not.length; j < l; j++ ) { if ( not[j] === elem ) { return false; } } return true; } else { sizzle.error( name ); } }, child: function( elem, match ) { var first, last, donename, parent, cache, count, diff, type = match[1], node = elem; switch ( type ) { case "only": case "first": while ( (node = node.previoussibling) ) { if ( node.nodetype === 1 ) { return false; } } if ( type === "first" ) { return true; } node = elem; /* falls through */ case "last": while ( (node = node.nextsibling) ) { if ( node.nodetype === 1 ) { return false; } } return true; case "nth": first = match[2]; last = match[3]; if ( first === 1 && last === 0 ) { return true; } donename = match[0]; parent = elem.parentnode; if ( parent && (parent[ expando ] !== donename || !elem.nodeindex) ) { count = 0; for ( node = parent.firstchild; node; node = node.nextsibling ) { if ( node.nodetype === 1 ) { node.nodeindex = ++count; } } parent[ expando ] = donename; } diff = elem.nodeindex - last; if ( first === 0 ) { return diff === 0; } else { return ( diff % first === 0 && diff / first >= 0 ); } } }, id: function( elem, match ) { return elem.nodetype === 1 && elem.getattribute("id") === match; }, tag: function( elem, match ) { return (match === "*" && elem.nodetype === 1) || !!elem.nodename && elem.nodename.tolowercase() === match; }, class: function( elem, match ) { return (" " + (elem.classname || elem.getattribute("class")) + " ") .indexof( match ) > -1; }, attr: function( elem, match ) { var name = match[1], result = sizzle.attr ? sizzle.attr( elem, name ) : expr.attrhandle[ name ] ? expr.attrhandle[ name ]( elem ) : elem[ name ] != null ? elem[ name ] : elem.getattribute( name ), value = result + "", type = match[2], check = match[4]; return result == null ? type === "!=" : !type && sizzle.attr ? result != null : type === "=" ? value === check : type === "*=" ? value.indexof(check) >= 0 : type === "~=" ? (" " + value + " ").indexof(check) >= 0 : !check ? value && result !== false : type === "!=" ? value !== check : type === "^=" ? value.indexof(check) === 0 : type === "$=" ? value.substr(value.length - check.length) === check : type === "|=" ? value === check || value.substr(0, check.length + 1) === check + "-" : false; }, pos: function( elem, match, i, array ) { var name = match[2], filter = expr.setfilters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } } } }; 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) ); } // expose origpos // "global" as in regardless of relation to brackets/parens expr.match.globalpos = origpos; var makearray = function( array, results ) { array = array.prototype.slice.call( array, 0 ); if ( results ) { results.push.apply( results, array ); return results; } return array; }; // 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 ) { makearray = function( array, results ) { var i = 0, ret = results || []; if ( tostring.call(array) === "[object array]" ) { array.prototype.push.apply( ret, array ); } else { if ( typeof array.length === "number" ) { for ( var l = array.length; i < l; i++ ) { ret.push( array[i] ); } } else { for ( ; array[i]; i++ ) { ret.push( array[i] ); } } } return ret; }; } var sortorder, siblingcheck; if ( document.documentelement.comparedocumentposition ) { sortorder = function( a, b ) { if ( a === b ) { hasduplicate = true; return 0; } if ( !a.comparedocumentposition || !b.comparedocumentposition ) { return a.comparedocumentposition ? -1 : 1; } return a.comparedocumentposition(b) & 4 ? -1 : 1; }; } else { sortorder = function( a, b ) { // the nodes are identical, we can exit early if ( a === b ) { hasduplicate = true; return 0; // fallback to using sourceindex (in ie) if it's available on both nodes } else if ( a.sourceindex && b.sourceindex ) { return a.sourceindex - b.sourceindex; } var al, bl, ap = [], bp = [], aup = a.parentnode, bup = b.parentnode, cur = aup; // if the nodes are siblings (or identical) we can do a quick check if ( aup === bup ) { return siblingcheck( a, b ); // if no parents were found then the nodes are disconnected } else if ( !aup ) { return -1; } else if ( !bup ) { return 1; } // otherwise they're somewhere else in the tree so we need // to build up a full list of the parentnodes for comparison while ( cur ) { ap.unshift( cur ); cur = cur.parentnode; } cur = bup; while ( cur ) { bp.unshift( cur ); cur = cur.parentnode; } al = ap.length; bl = bp.length; // start walking down the tree looking for a discrepancy for ( var i = 0; i < al && i < bl; i++ ) { if ( ap[i] !== bp[i] ) { return siblingcheck( ap[i], bp[i] ); } } // we ended someplace up the tree so do a sibling check return i === al ? siblingcheck( a, bp[i], -1 ) : siblingcheck( ap[i], b, 1 ); }; siblingcheck = function( a, b, ret ) { if ( a === b ) { return ret; } var cur = a.nextsibling; while ( cur ) { if ( cur === b ) { return -1; } cur = cur.nextsibling; } return 1; }; } // check to see if the browser returns elements by name when // querying by getelementbyid (and provide a workaround) (function(){ // we're going to inject a fake input element with a specified name var form = document.createelement("div"), id = "script" + (new date()).gettime(), root = document.documentelement; form.innerhtml = ""; // inject it into the root element, check its status, and remove it quickly root.insertbefore( form, root.firstchild ); // the workaround has to do additional checks after a getelementbyid // which slows things down for other browsers (hence the branching) if ( document.getelementbyid( id ) ) { expr.find.id = function( match, context, isxml ) { if ( typeof context.getelementbyid !== "undefined" && !isxml ) { var m = context.getelementbyid(match[1]); return m ? m.id === match[1] || typeof m.getattributenode !== "undefined" && m.getattributenode("id").nodevalue === match[1] ? [m] : undefined : []; } }; expr.filter.id = function( elem, match ) { var node = typeof elem.getattributenode !== "undefined" && elem.getattributenode("id"); return elem.nodetype === 1 && node && node.nodevalue === match; }; } root.removechild( form ); // release memory in ie root = form = null; })(); (function(){ // check to see if the browser returns only elements // when doing getelementsbytagname("*") // create a fake element var div = document.createelement("div"); div.appendchild( document.createcomment("") ); // make sure no comments are found if ( div.getelementsbytagname("*").length > 0 ) { expr.find.tag = function( match, context ) { var results = context.getelementsbytagname( match[1] ); // filter out possible comments if ( match[1] === "*" ) { var tmp = []; for ( var i = 0; results[i]; i++ ) { if ( results[i].nodetype === 1 ) { tmp.push( results[i] ); } } results = tmp; } return results; }; } // check to see if an attribute returns normalized href attributes div.innerhtml = ""; if ( div.firstchild && typeof div.firstchild.getattribute !== "undefined" && div.firstchild.getattribute("href") !== "#" ) { expr.attrhandle.href = function( elem ) { return elem.getattribute( "href", 2 ); }; } // release memory in ie div = null; })(); if ( document.queryselectorall ) { (function(){ var oldsizzle = sizzle, div = document.createelement("div"), id = "__sizzle__"; div.innerhtml = "

"; // safari can't handle uppercase or unicode characters when // in quirks mode. if ( div.queryselectorall && div.queryselectorall(".test").length === 0 ) { return; } sizzle = function( query, context, extra, seed ) { context = context || document; // only use queryselectorall on non-xml documents // (id selectors don't work in non-html documents) if ( !seed && !sizzle.isxml(context) ) { // see if we find a selector to speed up var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); if ( match && (context.nodetype === 1 || context.nodetype === 9) ) { // speed-up: sizzle("tag") if ( match[1] ) { return makearray( context.getelementsbytagname( query ), extra ); // speed-up: sizzle(".class") } else if ( match[2] && expr.find.class && context.getelementsbyclassname ) { return makearray( context.getelementsbyclassname( match[2] ), extra ); } } if ( context.nodetype === 9 ) { // speed-up: sizzle("body") // the body element only exists once, optimize finding it if ( query === "body" && context.body ) { return makearray( [ context.body ], extra ); // speed-up: sizzle("#id") } else if ( match && match[3] ) { var elem = context.getelementbyid( match[3] ); // check parentnode to catch when blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentnode ) { // handle the case where ie and opera return items // by name instead of id if ( elem.id === match[3] ) { return makearray( [ elem ], extra ); } } else { return makearray( [], extra ); } } try { return makearray( context.queryselectorall(query), extra ); } catch(qsaerror) {} // qsa works strangely on element-rooted queries // we can work around this by specifying an extra id on the root // and working up from there (thanks to andrew dupont for the technique) // ie 8 doesn't work on object elements } else if ( context.nodetype === 1 && context.nodename.tolowercase() !== "object" ) { var oldcontext = context, old = context.getattribute( "id" ), nid = old || id, hasparent = context.parentnode, relativehierarchyselector = /^\s*[+~]/.test( query ); if ( !old ) { context.setattribute( "id", nid ); } else { nid = nid.replace( /'/g, "\\$&" ); } if ( relativehierarchyselector && hasparent ) { context = context.parentnode; } try { if ( !relativehierarchyselector || hasparent ) { return makearray( context.queryselectorall( "[id='" + nid + "'] " + query ), extra ); } } catch(pseudoerror) { } finally { if ( !old ) { oldcontext.removeattribute( "id" ); } } } } return oldsizzle(query, context, extra, seed); }; for ( var prop in oldsizzle ) { sizzle[ prop ] = oldsizzle[ prop ]; } // release memory in ie div = null; })(); } (function(){ var html = document.documentelement, matches = html.matchesselector || html.mozmatchesselector || html.webkitmatchesselector || html.msmatchesselector; if ( matches ) { // check to see if it's possible to do matchesselector // on a disconnected node (ie 9 fails this) var disconnectedmatch = !matches.call( document.createelement( "div" ), "div" ), pseudoworks = false; try { // this should fail with an exception // gecko does not error, returns false instead matches.call( document.documentelement, "[test!='']:sizzle" ); } catch( pseudoerror ) { pseudoworks = true; } sizzle.matchesselector = function( node, expr ) { // make sure that attribute selectors are quoted expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); if ( !sizzle.isxml( node ) ) { try { if ( pseudoworks || !expr.match.pseudo.test( expr ) && !/!=/.test( expr ) ) { var ret = matches.call( node, expr ); // ie 9's matchesselector returns false on disconnected nodes if ( ret || !disconnectedmatch || // as well, disconnected nodes are said to be in a document // fragment in ie 9, so check for that node.document && node.document.nodetype !== 11 ) { return ret; } } } catch(e) {} } return sizzle(expr, null, null, [node]).length > 0; }; } })(); (function(){ var div = document.createelement("div"); div.innerhtml = "
"; // opera can't find a second classname (in 9.6) // also, make sure that getelementsbyclassname actually exists if ( !div.getelementsbyclassname || div.getelementsbyclassname("e").length === 0 ) { return; } // safari caches class attributes, doesn't catch changes (in 3.2) div.lastchild.classname = "e"; if ( div.getelementsbyclassname("e").length === 1 ) { return; } expr.order.splice(1, 0, "class"); expr.find.class = function( match, context, isxml ) { if ( typeof context.getelementsbyclassname !== "undefined" && !isxml ) { return context.getelementsbyclassname(match[1]); } }; // release memory in ie div = null; })(); function dirnodecheck( dir, cur, donename, checkset, nodecheck, isxml ) { for ( var i = 0, l = checkset.length; i < l; i++ ) { var elem = checkset[i]; if ( elem ) { var match = false; elem = elem[dir]; while ( elem ) { if ( elem[ expando ] === donename ) { match = checkset[elem.sizset]; break; } if ( elem.nodetype === 1 && !isxml ){ elem[ expando ] = donename; elem.sizset = i; } if ( elem.nodename.tolowercase() === cur ) { match = elem; break; } elem = elem[dir]; } checkset[i] = match; } } } function dircheck( dir, cur, donename, checkset, nodecheck, isxml ) { for ( var i = 0, l = checkset.length; i < l; i++ ) { var elem = checkset[i]; if ( elem ) { var match = false; elem = elem[dir]; while ( elem ) { if ( elem[ expando ] === donename ) { match = checkset[elem.sizset]; break; } if ( elem.nodetype === 1 ) { if ( !isxml ) { elem[ expando ] = donename; elem.sizset = i; } if ( typeof cur !== "string" ) { if ( elem === cur ) { match = true; break; } } else if ( sizzle.filter( cur, [elem] ).length > 0 ) { match = elem; break; } } elem = elem[dir]; } checkset[i] = match; } } } if ( document.documentelement.contains ) { sizzle.contains = function( a, b ) { return a !== b && (a.contains ? a.contains(b) : true); }; } else if ( document.documentelement.comparedocumentposition ) { sizzle.contains = function( a, b ) { return !!(a.comparedocumentposition(b) & 16); }; } else { sizzle.contains = function() { return false; }; } sizzle.isxml = function( elem ) { // documentelement is verified for cases where it doesn't yet exist // (such as loading iframes in ie - #4833) var documentelement = (elem ? elem.ownerdocument || elem : 0).documentelement; return documentelement ? documentelement.nodename !== "html" : false; }; var posprocess = function( selector, context, seed ) { var match, tmpset = [], later = "", root = context.nodetype ? [context] : context; // position selectors must be done after the filter // and so must :not(positional) so we move all pseudos to the end while ( (match = expr.match.pseudo.exec( selector )) ) { later += match[0]; selector = selector.replace( expr.match.pseudo, "" ); } selector = expr.relative[selector] ? selector + "*" : selector; for ( var i = 0, l = root.length; i < l; i++ ) { sizzle( selector, root[i], tmpset, seed ); } return sizzle.filter( later, tmpset ); }; // expose // override sizzle attribute retrieval sizzle.attr = jquery.attr; sizzle.selectors.attrmap = {}; jquery.find = sizzle; jquery.expr = sizzle.selectors; jquery.expr[":"] = jquery.expr.filters; jquery.unique = sizzle.uniquesort; jquery.text = sizzle.gettext; jquery.isxmldoc = sizzle.isxml; jquery.contains = sizzle.contains; })(); var runtil = /until$/, rparentsprev = /^(?:parents|prevuntil|prevall)/, // note: this regexp should be improved, or likely pulled from sizzle rmultiselector = /,/, issimple = /^.[^:#\[\.,]*$/, slice = array.prototype.slice, pos = jquery.expr.match.globalpos, // methods guaranteed to produce a unique set when starting from a unique set guaranteedunique = { children: true, contents: true, next: true, prev: true }; jquery.fn.extend({ find: function( selector ) { var self = this, i, l; if ( typeof selector !== "string" ) { return jquery( selector ).filter(function() { for ( i = 0, l = self.length; i < l; i++ ) { if ( jquery.contains( self[ i ], this ) ) { return true; } } }); } var ret = this.pushstack( "", "find", selector ), length, n, r; for ( i = 0, l = this.length; i < l; i++ ) { length = ret.length; jquery.find( selector, this[i], ret ); if ( i > 0 ) { // make sure that the results are unique for ( n = length; n < ret.length; n++ ) { for ( r = 0; r < length; r++ ) { if ( ret[r] === ret[n] ) { ret.splice(n--, 1); break; } } } } } return ret; }, has: function( target ) { var targets = jquery( target ); return this.filter(function() { for ( var i = 0, l = targets.length; i < l; i++ ) { if ( jquery.contains( this, targets[i] ) ) { return true; } } }); }, not: function( selector ) { return this.pushstack( winnow(this, selector, false), "not", selector); }, filter: function( selector ) { return this.pushstack( winnow(this, selector, true), "filter", selector ); }, is: function( selector ) { return !!selector && ( typeof selector === "string" ? // if this is a positional selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". pos.test( selector ) ? jquery( selector, this.context ).index( this[0] ) >= 0 : jquery.filter( selector, this ).length > 0 : this.filter( selector ).length > 0 ); }, closest: function( selectors, context ) { var ret = [], i, l, cur = this[0]; // array (deprecated as of jquery 1.7) if ( jquery.isarray( selectors ) ) { var level = 1; while ( cur && cur.ownerdocument && cur !== context ) { for ( i = 0; i < selectors.length; i++ ) { if ( jquery( cur ).is( selectors[ i ] ) ) { ret.push({ selector: selectors[ i ], elem: cur, level: level }); } } cur = cur.parentnode; level++; } return ret; } // string var pos = pos.test( selectors ) || typeof selectors !== "string" ? jquery( selectors, context || this.context ) : 0; for ( i = 0, l = this.length; i < l; i++ ) { cur = this[i]; while ( cur ) { if ( pos ? pos.index(cur) > -1 : jquery.find.matchesselector(cur, selectors) ) { ret.push( cur ); break; } else { cur = cur.parentnode; if ( !cur || !cur.ownerdocument || cur === context || cur.nodetype === 11 ) { break; } } } } ret = ret.length > 1 ? jquery.unique( ret ) : ret; return this.pushstack( ret, "closest", selectors ); }, // determine the position of an element within // the matched set of elements index: function( elem ) { // no argument, return index in parent if ( !elem ) { return ( this[0] && this[0].parentnode ) ? this.prevall().length : -1; } // index in selector if ( typeof elem === "string" ) { return jquery.inarray( this[0], jquery( elem ) ); } // locate the position of the desired element return jquery.inarray( // if it receives a jquery object, the first element is used elem.jquery ? elem[0] : elem, this ); }, add: function( selector, context ) { var set = typeof selector === "string" ? jquery( selector, context ) : jquery.makearray( selector && selector.nodetype ? [ selector ] : selector ), all = jquery.merge( this.get(), set ); return this.pushstack( isdisconnected( set[0] ) || isdisconnected( all[0] ) ? all : jquery.unique( all ) ); }, andself: function() { return this.add( this.prevobject ); } }); // a painfully simple check to see if an element is disconnected // from a document (should be improved, where feasible). function isdisconnected( node ) { return !node || !node.parentnode || node.parentnode.nodetype === 11; } jquery.each({ parent: function( elem ) { var parent = elem.parentnode; return parent && parent.nodetype !== 11 ? parent : null; }, parents: function( elem ) { return jquery.dir( elem, "parentnode" ); }, parentsuntil: function( elem, i, until ) { return jquery.dir( elem, "parentnode", until ); }, next: function( elem ) { return jquery.nth( elem, 2, "nextsibling" ); }, prev: function( elem ) { return jquery.nth( elem, 2, "previoussibling" ); }, nextall: function( elem ) { return jquery.dir( elem, "nextsibling" ); }, prevall: function( elem ) { return jquery.dir( elem, "previoussibling" ); }, nextuntil: function( elem, i, until ) { return jquery.dir( elem, "nextsibling", until ); }, prevuntil: function( elem, i, until ) { return jquery.dir( elem, "previoussibling", until ); }, siblings: function( elem ) { return jquery.sibling( ( elem.parentnode || {} ).firstchild, elem ); }, children: function( elem ) { return jquery.sibling( elem.firstchild ); }, contents: function( elem ) { return jquery.nodename( elem, "iframe" ) ? elem.contentdocument || elem.contentwindow.document : jquery.makearray( elem.childnodes ); } }, function( name, fn ) { jquery.fn[ name ] = function( until, selector ) { var ret = jquery.map( this, fn, until ); if ( !runtil.test( name ) ) { selector = until; } if ( selector && typeof selector === "string" ) { ret = jquery.filter( selector, ret ); } ret = this.length > 1 && !guaranteedunique[ name ] ? jquery.unique( ret ) : ret; if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { ret = ret.reverse(); } return this.pushstack( ret, name, slice.call( arguments ).join(",") ); }; }); jquery.extend({ filter: function( expr, elems, not ) { if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 ? jquery.find.matchesselector(elems[0], expr) ? [ elems[0] ] : [] : jquery.find.matches(expr, elems); }, dir: function( elem, dir, until ) { var matched = [], cur = elem[ dir ]; while ( cur && cur.nodetype !== 9 && (until === undefined || cur.nodetype !== 1 || !jquery( cur ).is( until )) ) { if ( cur.nodetype === 1 ) { matched.push( cur ); } cur = cur[dir]; } return matched; }, nth: function( cur, result, dir, elem ) { result = result || 1; var num = 0; for ( ; cur; cur = cur[dir] ) { if ( cur.nodetype === 1 && ++num === result ) { break; } } return cur; }, sibling: function( n, elem ) { var r = []; for ( ; n; n = n.nextsibling ) { if ( n.nodetype === 1 && n !== elem ) { r.push( n ); } } return r; } }); // implement the identical functionality for filter and not function winnow( elements, qualifier, keep ) { // can't pass null or undefined to indexof in firefox 4 // set to 0 to skip string check qualifier = qualifier || 0; if ( jquery.isfunction( qualifier ) ) { return jquery.grep(elements, function( elem, i ) { var retval = !!qualifier.call( elem, i, elem ); return retval === keep; }); } else if ( qualifier.nodetype ) { return jquery.grep(elements, function( elem, i ) { return ( elem === qualifier ) === keep; }); } else if ( typeof qualifier === "string" ) { var filtered = jquery.grep(elements, function( elem ) { return elem.nodetype === 1; }); if ( issimple.test( qualifier ) ) { return jquery.filter(qualifier, filtered, !keep); } else { qualifier = jquery.filter( qualifier, filtered ); } } return jquery.grep(elements, function( elem, i ) { return ( jquery.inarray( elem, qualifier ) >= 0 ) === keep; }); } function createsafefragment( document ) { var list = nodenames.split( "|" ), safefrag = document.createdocumentfragment(); if ( safefrag.createelement ) { while ( list.length ) { safefrag.createelement( list.pop() ); } } return safefrag; } var nodenames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", rinlinejquery = / jquery\d+="(?:\d+|null)"/g, rleadingwhitespace = /^\s+/, rxhtmltag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, rtagname = /<([\w:]+)/, rtbody = /]", "i"), // checked="checked" or checked rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscripttype = /\/(java|ecma)script/i, rcleanscript = /^\s*", "" ], legend: [ 1, "
", "
" ], thead: [ 1, "", "
" ], tr: [ 2, "", "
" ], td: [ 3, "", "
" ], col: [ 2, "", "
" ], area: [ 1, "", "" ], _default: [ 0, "", "" ] }, safefragment = createsafefragment( document ); wrapmap.optgroup = wrapmap.option; wrapmap.tbody = wrapmap.tfoot = wrapmap.colgroup = wrapmap.caption = wrapmap.thead; wrapmap.th = wrapmap.td; // ie can't serialize and