2
0

jquery.js 408 KB

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