jq_lego.js 319 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129
  1. /*!
  2. * jQuery JavaScript Library v1.12.1
  3. * http://jquery.com/
  4. *
  5. * Includes Sizzle.js
  6. * http://sizzlejs.com/
  7. *
  8. * Copyright jQuery Foundation and other contributors
  9. * Released under the MIT license
  10. * http://jquery.org/license
  11. *
  12. * Date: 2016-02-22T19:07Z
  13. */
  14. (function( global, factory ) {
  15. if ( typeof module === "object" && typeof module.exports === "object" ) {
  16. // For CommonJS and CommonJS-like environments where a proper `window`
  17. // is present, execute the factory and get jQuery.
  18. // For environments that do not have a `window` with a `document`
  19. // (such as Node.js), expose a factory as module.exports.
  20. // This accentuates the need for the creation of a real `window`.
  21. // e.g. var jQuery = require("jquery")(window);
  22. // See ticket #14549 for more info.
  23. module.exports = global.document ?
  24. factory( global, true ) :
  25. function( w ) {
  26. if ( !w.document ) {
  27. throw new Error( "jQuery requires a window with a document" );
  28. }
  29. return factory( w );
  30. };
  31. } else {
  32. factory( global );
  33. }
  34. // Pass this if window is not defined yet
  35. }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  36. // Support: Firefox 18+
  37. // Can't be in strict mode, several libs including ASP.NET trace
  38. // the stack via arguments.caller.callee and Firefox dies if
  39. // you try to trace through "use strict" call chains. (#13335)
  40. //"use strict";
  41. var deletedIds = [];
  42. var document = window.document;
  43. var slice = deletedIds.slice;
  44. var concat = deletedIds.concat;
  45. var push = deletedIds.push;
  46. var indexOf = deletedIds.indexOf;
  47. var class2type = {};
  48. var toString = class2type.toString;
  49. var hasOwn = class2type.hasOwnProperty;
  50. var support = {};
  51. var
  52. version = "1.12.1",
  53. // Define a local copy of jQuery
  54. jQuery = function( selector, context ) {
  55. // The jQuery object is actually just the init constructor 'enhanced'
  56. // Need init if jQuery is called (just allow error to be thrown if not included)
  57. return new jQuery.fn.init( selector, context );
  58. },
  59. // Support: Android<4.1, IE<9
  60. // Make sure we trim BOM and NBSP
  61. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
  62. // Matches dashed string for camelizing
  63. rmsPrefix = /^-ms-/,
  64. rdashAlpha = /-([\da-z])/gi,
  65. // Used by jQuery.camelCase as callback to replace()
  66. fcamelCase = function( all, letter ) {
  67. return letter.toUpperCase();
  68. };
  69. jQuery.fn = jQuery.prototype = {
  70. // The current version of jQuery being used
  71. jquery: version,
  72. constructor: jQuery,
  73. // Start with an empty selector
  74. selector: "",
  75. // The default length of a jQuery object is 0
  76. length: 0,
  77. toArray: function() {
  78. return slice.call( this );
  79. },
  80. // Get the Nth element in the matched element set OR
  81. // Get the whole matched element set as a clean array
  82. get: function( num ) {
  83. return num != null ?
  84. // Return just the one element from the set
  85. ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
  86. // Return all the elements in a clean array
  87. slice.call( this );
  88. },
  89. // Take an array of elements and push it onto the stack
  90. // (returning the new matched element set)
  91. pushStack: function( elems ) {
  92. // Build a new jQuery matched element set
  93. var ret = jQuery.merge( this.constructor(), elems );
  94. // Add the old object onto the stack (as a reference)
  95. ret.prevObject = this;
  96. ret.context = this.context;
  97. // Return the newly-formed element set
  98. return ret;
  99. },
  100. // Execute a callback for every element in the matched set.
  101. each: function( callback ) {
  102. return jQuery.each( this, callback );
  103. },
  104. map: function( callback ) {
  105. return this.pushStack( jQuery.map( this, function( elem, i ) {
  106. return callback.call( elem, i, elem );
  107. } ) );
  108. },
  109. slice: function() {
  110. return this.pushStack( slice.apply( this, arguments ) );
  111. },
  112. first: function() {
  113. return this.eq( 0 );
  114. },
  115. last: function() {
  116. return this.eq( -1 );
  117. },
  118. eq: function( i ) {
  119. var len = this.length,
  120. j = +i + ( i < 0 ? len : 0 );
  121. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  122. },
  123. end: function() {
  124. return this.prevObject || this.constructor();
  125. },
  126. // For internal use only.
  127. // Behaves like an Array's method, not like a jQuery method.
  128. push: push,
  129. sort: deletedIds.sort,
  130. splice: deletedIds.splice
  131. };
  132. jQuery.extend = jQuery.fn.extend = function() {
  133. var src, copyIsArray, copy, name, options, clone,
  134. target = arguments[ 0 ] || {},
  135. i = 1,
  136. length = arguments.length,
  137. deep = false;
  138. // Handle a deep copy situation
  139. if ( typeof target === "boolean" ) {
  140. deep = target;
  141. // skip the boolean and the target
  142. target = arguments[ i ] || {};
  143. i++;
  144. }
  145. // Handle case when target is a string or something (possible in deep copy)
  146. if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
  147. target = {};
  148. }
  149. // extend jQuery itself if only one argument is passed
  150. if ( i === length ) {
  151. target = this;
  152. i--;
  153. }
  154. for ( ; i < length; i++ ) {
  155. // Only deal with non-null/undefined values
  156. if ( ( options = arguments[ i ] ) != null ) {
  157. // Extend the base object
  158. for ( name in options ) {
  159. src = target[ name ];
  160. copy = options[ name ];
  161. // Prevent never-ending loop
  162. if ( target === copy ) {
  163. continue;
  164. }
  165. // Recurse if we're merging plain objects or arrays
  166. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  167. ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
  168. if ( copyIsArray ) {
  169. copyIsArray = false;
  170. clone = src && jQuery.isArray( src ) ? src : [];
  171. } else {
  172. clone = src && jQuery.isPlainObject( src ) ? src : {};
  173. }
  174. // Never move original objects, clone them
  175. target[ name ] = jQuery.extend( deep, clone, copy );
  176. // Don't bring in undefined values
  177. } else if ( copy !== undefined ) {
  178. target[ name ] = copy;
  179. }
  180. }
  181. }
  182. }
  183. // Return the modified object
  184. return target;
  185. };
  186. jQuery.extend( {
  187. // Unique for each copy of jQuery on the page
  188. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  189. // Assume jQuery is ready without the ready module
  190. isReady: true,
  191. error: function( msg ) {
  192. throw new Error( msg );
  193. },
  194. noop: function() {},
  195. // See test/unit/core.js for details concerning isFunction.
  196. // Since version 1.3, DOM methods and functions like alert
  197. // aren't supported. They return false on IE (#2968).
  198. isFunction: function( obj ) {
  199. return jQuery.type( obj ) === "function";
  200. },
  201. isArray: Array.isArray || function( obj ) {
  202. return jQuery.type( obj ) === "array";
  203. },
  204. isWindow: function( obj ) {
  205. /* jshint eqeqeq: false */
  206. return obj != null && obj == obj.window;
  207. },
  208. isNumeric: function( obj ) {
  209. // parseFloat NaNs numeric-cast false positives (null|true|false|"")
  210. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  211. // subtraction forces infinities to NaN
  212. // adding 1 corrects loss of precision from parseFloat (#15100)
  213. var realStringObj = obj && obj.toString();
  214. return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
  215. },
  216. isEmptyObject: function( obj ) {
  217. var name;
  218. for ( name in obj ) {
  219. return false;
  220. }
  221. return true;
  222. },
  223. isPlainObject: function( obj ) {
  224. var key;
  225. // Must be an Object.
  226. // Because of IE, we also have to check the presence of the constructor property.
  227. // Make sure that DOM nodes and window objects don't pass through, as well
  228. if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
  229. return false;
  230. }
  231. try {
  232. // Not own constructor property must be Object
  233. if ( obj.constructor &&
  234. !hasOwn.call( obj, "constructor" ) &&
  235. !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
  236. return false;
  237. }
  238. } catch ( e ) {
  239. // IE8,9 Will throw exceptions on certain host objects #9897
  240. return false;
  241. }
  242. // Support: IE<9
  243. // Handle iteration over inherited properties before own properties.
  244. if ( !support.ownFirst ) {
  245. for ( key in obj ) {
  246. return hasOwn.call( obj, key );
  247. }
  248. }
  249. // Own properties are enumerated firstly, so to speed up,
  250. // if last one is own, then all properties are own.
  251. for ( key in obj ) {}
  252. return key === undefined || hasOwn.call( obj, key );
  253. },
  254. type: function( obj ) {
  255. if ( obj == null ) {
  256. return obj + "";
  257. }
  258. return typeof obj === "object" || typeof obj === "function" ?
  259. class2type[ toString.call( obj ) ] || "object" :
  260. typeof obj;
  261. },
  262. // Workarounds based on findings by Jim Driscoll
  263. // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
  264. globalEval: function( data ) {
  265. if ( data && jQuery.trim( data ) ) {
  266. // We use execScript on Internet Explorer
  267. // We use an anonymous function so that context is window
  268. // rather than jQuery in Firefox
  269. ( window.execScript || function( data ) {
  270. window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation
  271. } )( data );
  272. }
  273. },
  274. // Convert dashed to camelCase; used by the css and data modules
  275. // Microsoft forgot to hump their vendor prefix (#9572)
  276. camelCase: function( string ) {
  277. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  278. },
  279. nodeName: function( elem, name ) {
  280. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  281. },
  282. each: function( obj, callback ) {
  283. var length, i = 0;
  284. if ( isArrayLike( obj ) ) {
  285. length = obj.length;
  286. for ( ; i < length; i++ ) {
  287. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  288. break;
  289. }
  290. }
  291. } else {
  292. for ( i in obj ) {
  293. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  294. break;
  295. }
  296. }
  297. }
  298. return obj;
  299. },
  300. // Support: Android<4.1, IE<9
  301. trim: function( text ) {
  302. return text == null ?
  303. "" :
  304. ( text + "" ).replace( rtrim, "" );
  305. },
  306. // results is for internal usage only
  307. makeArray: function( arr, results ) {
  308. var ret = results || [];
  309. if ( arr != null ) {
  310. if ( isArrayLike( Object( arr ) ) ) {
  311. jQuery.merge( ret,
  312. typeof arr === "string" ?
  313. [ arr ] : arr
  314. );
  315. } else {
  316. push.call( ret, arr );
  317. }
  318. }
  319. return ret;
  320. },
  321. inArray: function( elem, arr, i ) {
  322. var len;
  323. if ( arr ) {
  324. if ( indexOf ) {
  325. return indexOf.call( arr, elem, i );
  326. }
  327. len = arr.length;
  328. i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
  329. for ( ; i < len; i++ ) {
  330. // Skip accessing in sparse arrays
  331. if ( i in arr && arr[ i ] === elem ) {
  332. return i;
  333. }
  334. }
  335. }
  336. return -1;
  337. },
  338. merge: function( first, second ) {
  339. var len = +second.length,
  340. j = 0,
  341. i = first.length;
  342. while ( j < len ) {
  343. first[ i++ ] = second[ j++ ];
  344. }
  345. // Support: IE<9
  346. // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
  347. if ( len !== len ) {
  348. while ( second[ j ] !== undefined ) {
  349. first[ i++ ] = second[ j++ ];
  350. }
  351. }
  352. first.length = i;
  353. return first;
  354. },
  355. grep: function( elems, callback, invert ) {
  356. var callbackInverse,
  357. matches = [],
  358. i = 0,
  359. length = elems.length,
  360. callbackExpect = !invert;
  361. // Go through the array, only saving the items
  362. // that pass the validator function
  363. for ( ; i < length; i++ ) {
  364. callbackInverse = !callback( elems[ i ], i );
  365. if ( callbackInverse !== callbackExpect ) {
  366. matches.push( elems[ i ] );
  367. }
  368. }
  369. return matches;
  370. },
  371. // arg is for internal usage only
  372. map: function( elems, callback, arg ) {
  373. var length, value,
  374. i = 0,
  375. ret = [];
  376. // Go through the array, translating each of the items to their new values
  377. if ( isArrayLike( elems ) ) {
  378. length = elems.length;
  379. for ( ; i < length; i++ ) {
  380. value = callback( elems[ i ], i, arg );
  381. if ( value != null ) {
  382. ret.push( value );
  383. }
  384. }
  385. // Go through every key on the object,
  386. } else {
  387. for ( i in elems ) {
  388. value = callback( elems[ i ], i, arg );
  389. if ( value != null ) {
  390. ret.push( value );
  391. }
  392. }
  393. }
  394. // Flatten any nested arrays
  395. return concat.apply( [], ret );
  396. },
  397. // A global GUID counter for objects
  398. guid: 1,
  399. // Bind a function to a context, optionally partially applying any
  400. // arguments.
  401. proxy: function( fn, context ) {
  402. var args, proxy, tmp;
  403. if ( typeof context === "string" ) {
  404. tmp = fn[ context ];
  405. context = fn;
  406. fn = tmp;
  407. }
  408. // Quick check to determine if target is callable, in the spec
  409. // this throws a TypeError, but we will just return undefined.
  410. if ( !jQuery.isFunction( fn ) ) {
  411. return undefined;
  412. }
  413. // Simulated bind
  414. args = slice.call( arguments, 2 );
  415. proxy = function() {
  416. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  417. };
  418. // Set the guid of unique handler to the same of original handler, so it can be removed
  419. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  420. return proxy;
  421. },
  422. now: function() {
  423. return +( new Date() );
  424. },
  425. // jQuery.support is not used in Core but other projects attach their
  426. // properties to it so it needs to exist.
  427. support: support
  428. } );
  429. // JSHint would error on this code due to the Symbol not being defined in ES5.
  430. // Defining this global in .jshintrc would create a danger of using the global
  431. // unguarded in another place, it seems safer to just disable JSHint for these
  432. // three lines.
  433. /* jshint ignore: start */
  434. if ( typeof Symbol === "function" ) {
  435. jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ];
  436. }
  437. /* jshint ignore: end */
  438. // Populate the class2type map
  439. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  440. function( i, name ) {
  441. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  442. } );
  443. function isArrayLike( obj ) {
  444. // Support: iOS 8.2 (not reproducible in simulator)
  445. // `in` check used to prevent JIT error (gh-2145)
  446. // hasOwn isn't used here due to false negatives
  447. // regarding Nodelist length in IE
  448. var length = !!obj && "length" in obj && obj.length,
  449. type = jQuery.type( obj );
  450. if ( type === "function" || jQuery.isWindow( obj ) ) {
  451. return false;
  452. }
  453. return type === "array" || length === 0 ||
  454. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  455. }
  456. var Sizzle =
  457. /*!
  458. * Sizzle CSS Selector Engine v2.2.1
  459. * http://sizzlejs.com/
  460. *
  461. * Copyright jQuery Foundation and other contributors
  462. * Released under the MIT license
  463. * http://jquery.org/license
  464. *
  465. * Date: 2015-10-17
  466. */
  467. (function( window ) {
  468. var i,
  469. support,
  470. Expr,
  471. getText,
  472. isXML,
  473. tokenize,
  474. compile,
  475. select,
  476. outermostContext,
  477. sortInput,
  478. hasDuplicate,
  479. // Local document vars
  480. setDocument,
  481. document,
  482. docElem,
  483. documentIsHTML,
  484. rbuggyQSA,
  485. rbuggyMatches,
  486. matches,
  487. contains,
  488. // Instance-specific data
  489. expando = "sizzle" + 1 * new Date(),
  490. preferredDoc = window.document,
  491. dirruns = 0,
  492. done = 0,
  493. classCache = createCache(),
  494. tokenCache = createCache(),
  495. compilerCache = createCache(),
  496. sortOrder = function( a, b ) {
  497. if ( a === b ) {
  498. hasDuplicate = true;
  499. }
  500. return 0;
  501. },
  502. // General-purpose constants
  503. MAX_NEGATIVE = 1 << 31,
  504. // Instance methods
  505. hasOwn = ({}).hasOwnProperty,
  506. arr = [],
  507. pop = arr.pop,
  508. push_native = arr.push,
  509. push = arr.push,
  510. slice = arr.slice,
  511. // Use a stripped-down indexOf as it's faster than native
  512. // http://jsperf.com/thor-indexof-vs-for/5
  513. indexOf = function( list, elem ) {
  514. var i = 0,
  515. len = list.length;
  516. for ( ; i < len; i++ ) {
  517. if ( list[i] === elem ) {
  518. return i;
  519. }
  520. }
  521. return -1;
  522. },
  523. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  524. // Regular expressions
  525. // http://www.w3.org/TR/css3-selectors/#whitespace
  526. whitespace = "[\\x20\\t\\r\\n\\f]",
  527. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  528. identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
  529. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  530. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  531. // Operator (capture 2)
  532. "*([*^$|!~]?=)" + whitespace +
  533. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  534. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  535. "*\\]",
  536. pseudos = ":(" + identifier + ")(?:\\((" +
  537. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  538. // 1. quoted (capture 3; capture 4 or capture 5)
  539. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  540. // 2. simple (capture 6)
  541. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  542. // 3. anything else (capture 2)
  543. ".*" +
  544. ")\\)|)",
  545. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  546. rwhitespace = new RegExp( whitespace + "+", "g" ),
  547. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  548. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  549. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  550. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  551. rpseudo = new RegExp( pseudos ),
  552. ridentifier = new RegExp( "^" + identifier + "$" ),
  553. matchExpr = {
  554. "ID": new RegExp( "^#(" + identifier + ")" ),
  555. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  556. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  557. "ATTR": new RegExp( "^" + attributes ),
  558. "PSEUDO": new RegExp( "^" + pseudos ),
  559. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  560. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  561. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  562. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  563. // For use in libraries implementing .is()
  564. // We use this for POS matching in `select`
  565. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  566. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  567. },
  568. rinputs = /^(?:input|select|textarea|button)$/i,
  569. rheader = /^h\d$/i,
  570. rnative = /^[^{]+\{\s*\[native \w/,
  571. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  572. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  573. rsibling = /[+~]/,
  574. rescape = /'|\\/g,
  575. // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  576. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  577. funescape = function( _, escaped, escapedWhitespace ) {
  578. var high = "0x" + escaped - 0x10000;
  579. // NaN means non-codepoint
  580. // Support: Firefox<24
  581. // Workaround erroneous numeric interpretation of +"0x"
  582. return high !== high || escapedWhitespace ?
  583. escaped :
  584. high < 0 ?
  585. // BMP codepoint
  586. String.fromCharCode( high + 0x10000 ) :
  587. // Supplemental Plane codepoint (surrogate pair)
  588. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  589. },
  590. // Used for iframes
  591. // See setDocument()
  592. // Removing the function wrapper causes a "Permission Denied"
  593. // error in IE
  594. unloadHandler = function() {
  595. setDocument();
  596. };
  597. // Optimize for push.apply( _, NodeList )
  598. try {
  599. push.apply(
  600. (arr = slice.call( preferredDoc.childNodes )),
  601. preferredDoc.childNodes
  602. );
  603. // Support: Android<4.0
  604. // Detect silently failing push.apply
  605. arr[ preferredDoc.childNodes.length ].nodeType;
  606. } catch ( e ) {
  607. push = { apply: arr.length ?
  608. // Leverage slice if possible
  609. function( target, els ) {
  610. push_native.apply( target, slice.call(els) );
  611. } :
  612. // Support: IE<9
  613. // Otherwise append directly
  614. function( target, els ) {
  615. var j = target.length,
  616. i = 0;
  617. // Can't trust NodeList.length
  618. while ( (target[j++] = els[i++]) ) {}
  619. target.length = j - 1;
  620. }
  621. };
  622. }
  623. function Sizzle( selector, context, results, seed ) {
  624. var m, i, elem, nid, nidselect, match, groups, newSelector,
  625. newContext = context && context.ownerDocument,
  626. // nodeType defaults to 9, since context defaults to document
  627. nodeType = context ? context.nodeType : 9;
  628. results = results || [];
  629. // Return early from calls with invalid selector or context
  630. if ( typeof selector !== "string" || !selector ||
  631. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  632. return results;
  633. }
  634. // Try to shortcut find operations (as opposed to filters) in HTML documents
  635. if ( !seed ) {
  636. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  637. setDocument( context );
  638. }
  639. context = context || document;
  640. if ( documentIsHTML ) {
  641. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  642. // (excepting DocumentFragment context, where the methods don't exist)
  643. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  644. // ID selector
  645. if ( (m = match[1]) ) {
  646. // Document context
  647. if ( nodeType === 9 ) {
  648. if ( (elem = context.getElementById( m )) ) {
  649. // Support: IE, Opera, Webkit
  650. // TODO: identify versions
  651. // getElementById can match elements by name instead of ID
  652. if ( elem.id === m ) {
  653. results.push( elem );
  654. return results;
  655. }
  656. } else {
  657. return results;
  658. }
  659. // Element context
  660. } else {
  661. // Support: IE, Opera, Webkit
  662. // TODO: identify versions
  663. // getElementById can match elements by name instead of ID
  664. if ( newContext && (elem = newContext.getElementById( m )) &&
  665. contains( context, elem ) &&
  666. elem.id === m ) {
  667. results.push( elem );
  668. return results;
  669. }
  670. }
  671. // Type selector
  672. } else if ( match[2] ) {
  673. push.apply( results, context.getElementsByTagName( selector ) );
  674. return results;
  675. // Class selector
  676. } else if ( (m = match[3]) && support.getElementsByClassName &&
  677. context.getElementsByClassName ) {
  678. push.apply( results, context.getElementsByClassName( m ) );
  679. return results;
  680. }
  681. }
  682. // Take advantage of querySelectorAll
  683. if ( support.qsa &&
  684. !compilerCache[ selector + " " ] &&
  685. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  686. if ( nodeType !== 1 ) {
  687. newContext = context;
  688. newSelector = selector;
  689. // qSA looks outside Element context, which is not what we want
  690. // Thanks to Andrew Dupont for this workaround technique
  691. // Support: IE <=8
  692. // Exclude object elements
  693. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  694. // Capture the context ID, setting it first if necessary
  695. if ( (nid = context.getAttribute( "id" )) ) {
  696. nid = nid.replace( rescape, "\\$&" );
  697. } else {
  698. context.setAttribute( "id", (nid = expando) );
  699. }
  700. // Prefix every selector in the list
  701. groups = tokenize( selector );
  702. i = groups.length;
  703. nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']";
  704. while ( i-- ) {
  705. groups[i] = nidselect + " " + toSelector( groups[i] );
  706. }
  707. newSelector = groups.join( "," );
  708. // Expand context for sibling selectors
  709. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  710. context;
  711. }
  712. if ( newSelector ) {
  713. try {
  714. push.apply( results,
  715. newContext.querySelectorAll( newSelector )
  716. );
  717. return results;
  718. } catch ( qsaError ) {
  719. } finally {
  720. if ( nid === expando ) {
  721. context.removeAttribute( "id" );
  722. }
  723. }
  724. }
  725. }
  726. }
  727. }
  728. // All others
  729. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  730. }
  731. /**
  732. * Create key-value caches of limited size
  733. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  734. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  735. * deleting the oldest entry
  736. */
  737. function createCache() {
  738. var keys = [];
  739. function cache( key, value ) {
  740. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  741. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  742. // Only keep the most recent entries
  743. delete cache[ keys.shift() ];
  744. }
  745. return (cache[ key + " " ] = value);
  746. }
  747. return cache;
  748. }
  749. /**
  750. * Mark a function for special use by Sizzle
  751. * @param {Function} fn The function to mark
  752. */
  753. function markFunction( fn ) {
  754. fn[ expando ] = true;
  755. return fn;
  756. }
  757. /**
  758. * Support testing using an element
  759. * @param {Function} fn Passed the created div and expects a boolean result
  760. */
  761. function assert( fn ) {
  762. var div = document.createElement("div");
  763. try {
  764. return !!fn( div );
  765. } catch (e) {
  766. return false;
  767. } finally {
  768. // Remove from its parent by default
  769. if ( div.parentNode ) {
  770. div.parentNode.removeChild( div );
  771. }
  772. // release memory in IE
  773. div = null;
  774. }
  775. }
  776. /**
  777. * Adds the same handler for all of the specified attrs
  778. * @param {String} attrs Pipe-separated list of attributes
  779. * @param {Function} handler The method that will be applied
  780. */
  781. function addHandle( attrs, handler ) {
  782. var arr = attrs.split("|"),
  783. i = arr.length;
  784. while ( i-- ) {
  785. Expr.attrHandle[ arr[i] ] = handler;
  786. }
  787. }
  788. /**
  789. * Checks document order of two siblings
  790. * @param {Element} a
  791. * @param {Element} b
  792. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  793. */
  794. function siblingCheck( a, b ) {
  795. var cur = b && a,
  796. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  797. ( ~b.sourceIndex || MAX_NEGATIVE ) -
  798. ( ~a.sourceIndex || MAX_NEGATIVE );
  799. // Use IE sourceIndex if available on both nodes
  800. if ( diff ) {
  801. return diff;
  802. }
  803. // Check if b follows a
  804. if ( cur ) {
  805. while ( (cur = cur.nextSibling) ) {
  806. if ( cur === b ) {
  807. return -1;
  808. }
  809. }
  810. }
  811. return a ? 1 : -1;
  812. }
  813. /**
  814. * Returns a function to use in pseudos for input types
  815. * @param {String} type
  816. */
  817. function createInputPseudo( type ) {
  818. return function( elem ) {
  819. var name = elem.nodeName.toLowerCase();
  820. return name === "input" && elem.type === type;
  821. };
  822. }
  823. /**
  824. * Returns a function to use in pseudos for buttons
  825. * @param {String} type
  826. */
  827. function createButtonPseudo( type ) {
  828. return function( elem ) {
  829. var name = elem.nodeName.toLowerCase();
  830. return (name === "input" || name === "button") && elem.type === type;
  831. };
  832. }
  833. /**
  834. * Returns a function to use in pseudos for positionals
  835. * @param {Function} fn
  836. */
  837. function createPositionalPseudo( fn ) {
  838. return markFunction(function( argument ) {
  839. argument = +argument;
  840. return markFunction(function( seed, matches ) {
  841. var j,
  842. matchIndexes = fn( [], seed.length, argument ),
  843. i = matchIndexes.length;
  844. // Match elements found at the specified indexes
  845. while ( i-- ) {
  846. if ( seed[ (j = matchIndexes[i]) ] ) {
  847. seed[j] = !(matches[j] = seed[j]);
  848. }
  849. }
  850. });
  851. });
  852. }
  853. /**
  854. * Checks a node for validity as a Sizzle context
  855. * @param {Element|Object=} context
  856. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  857. */
  858. function testContext( context ) {
  859. return context && typeof context.getElementsByTagName !== "undefined" && context;
  860. }
  861. // Expose support vars for convenience
  862. support = Sizzle.support = {};
  863. /**
  864. * Detects XML nodes
  865. * @param {Element|Object} elem An element or a document
  866. * @returns {Boolean} True iff elem is a non-HTML XML node
  867. */
  868. isXML = Sizzle.isXML = function( elem ) {
  869. // documentElement is verified for cases where it doesn't yet exist
  870. // (such as loading iframes in IE - #4833)
  871. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  872. return documentElement ? documentElement.nodeName !== "HTML" : false;
  873. };
  874. /**
  875. * Sets document-related variables once based on the current document
  876. * @param {Element|Object} [doc] An element or document object to use to set the document
  877. * @returns {Object} Returns the current document
  878. */
  879. setDocument = Sizzle.setDocument = function( node ) {
  880. var hasCompare, parent,
  881. doc = node ? node.ownerDocument || node : preferredDoc;
  882. // Return early if doc is invalid or already selected
  883. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  884. return document;
  885. }
  886. // Update global variables
  887. document = doc;
  888. docElem = document.documentElement;
  889. documentIsHTML = !isXML( document );
  890. // Support: IE 9-11, Edge
  891. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  892. if ( (parent = document.defaultView) && parent.top !== parent ) {
  893. // Support: IE 11
  894. if ( parent.addEventListener ) {
  895. parent.addEventListener( "unload", unloadHandler, false );
  896. // Support: IE 9 - 10 only
  897. } else if ( parent.attachEvent ) {
  898. parent.attachEvent( "onunload", unloadHandler );
  899. }
  900. }
  901. /* Attributes
  902. ---------------------------------------------------------------------- */
  903. // Support: IE<8
  904. // Verify that getAttribute really returns attributes and not properties
  905. // (excepting IE8 booleans)
  906. support.attributes = assert(function( div ) {
  907. div.className = "i";
  908. return !div.getAttribute("className");
  909. });
  910. /* getElement(s)By*
  911. ---------------------------------------------------------------------- */
  912. // Check if getElementsByTagName("*") returns only elements
  913. support.getElementsByTagName = assert(function( div ) {
  914. div.appendChild( document.createComment("") );
  915. return !div.getElementsByTagName("*").length;
  916. });
  917. // Support: IE<9
  918. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  919. // Support: IE<10
  920. // Check if getElementById returns elements by name
  921. // The broken getElementById methods don't pick up programatically-set names,
  922. // so use a roundabout getElementsByName test
  923. support.getById = assert(function( div ) {
  924. docElem.appendChild( div ).id = expando;
  925. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  926. });
  927. // ID find and filter
  928. if ( support.getById ) {
  929. Expr.find["ID"] = function( id, context ) {
  930. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  931. var m = context.getElementById( id );
  932. return m ? [ m ] : [];
  933. }
  934. };
  935. Expr.filter["ID"] = function( id ) {
  936. var attrId = id.replace( runescape, funescape );
  937. return function( elem ) {
  938. return elem.getAttribute("id") === attrId;
  939. };
  940. };
  941. } else {
  942. // Support: IE6/7
  943. // getElementById is not reliable as a find shortcut
  944. delete Expr.find["ID"];
  945. Expr.filter["ID"] = function( id ) {
  946. var attrId = id.replace( runescape, funescape );
  947. return function( elem ) {
  948. var node = typeof elem.getAttributeNode !== "undefined" &&
  949. elem.getAttributeNode("id");
  950. return node && node.value === attrId;
  951. };
  952. };
  953. }
  954. // Tag
  955. Expr.find["TAG"] = support.getElementsByTagName ?
  956. function( tag, context ) {
  957. if ( typeof context.getElementsByTagName !== "undefined" ) {
  958. return context.getElementsByTagName( tag );
  959. // DocumentFragment nodes don't have gEBTN
  960. } else if ( support.qsa ) {
  961. return context.querySelectorAll( tag );
  962. }
  963. } :
  964. function( tag, context ) {
  965. var elem,
  966. tmp = [],
  967. i = 0,
  968. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  969. results = context.getElementsByTagName( tag );
  970. // Filter out possible comments
  971. if ( tag === "*" ) {
  972. while ( (elem = results[i++]) ) {
  973. if ( elem.nodeType === 1 ) {
  974. tmp.push( elem );
  975. }
  976. }
  977. return tmp;
  978. }
  979. return results;
  980. };
  981. // Class
  982. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  983. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  984. return context.getElementsByClassName( className );
  985. }
  986. };
  987. /* QSA/matchesSelector
  988. ---------------------------------------------------------------------- */
  989. // QSA and matchesSelector support
  990. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  991. rbuggyMatches = [];
  992. // qSa(:focus) reports false when true (Chrome 21)
  993. // We allow this because of a bug in IE8/9 that throws an error
  994. // whenever `document.activeElement` is accessed on an iframe
  995. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  996. // See http://bugs.jquery.com/ticket/13378
  997. rbuggyQSA = [];
  998. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  999. // Build QSA regex
  1000. // Regex strategy adopted from Diego Perini
  1001. assert(function( div ) {
  1002. // Select is set to empty string on purpose
  1003. // This is to test IE's treatment of not explicitly
  1004. // setting a boolean content attribute,
  1005. // since its presence should be enough
  1006. // http://bugs.jquery.com/ticket/12359
  1007. docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
  1008. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  1009. "<option selected=''></option></select>";
  1010. // Support: IE8, Opera 11-12.16
  1011. // Nothing should be selected when empty strings follow ^= or $= or *=
  1012. // The test attribute must be unknown in Opera but "safe" for WinRT
  1013. // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1014. if ( div.querySelectorAll("[msallowcapture^='']").length ) {
  1015. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1016. }
  1017. // Support: IE8
  1018. // Boolean attributes and "value" are not treated correctly
  1019. if ( !div.querySelectorAll("[selected]").length ) {
  1020. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1021. }
  1022. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  1023. if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1024. rbuggyQSA.push("~=");
  1025. }
  1026. // Webkit/Opera - :checked should return selected option elements
  1027. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1028. // IE8 throws error here and will not see later tests
  1029. if ( !div.querySelectorAll(":checked").length ) {
  1030. rbuggyQSA.push(":checked");
  1031. }
  1032. // Support: Safari 8+, iOS 8+
  1033. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1034. // In-page `selector#id sibing-combinator selector` fails
  1035. if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1036. rbuggyQSA.push(".#.+[+~]");
  1037. }
  1038. });
  1039. assert(function( div ) {
  1040. // Support: Windows 8 Native Apps
  1041. // The type and name attributes are restricted during .innerHTML assignment
  1042. var input = document.createElement("input");
  1043. input.setAttribute( "type", "hidden" );
  1044. div.appendChild( input ).setAttribute( "name", "D" );
  1045. // Support: IE8
  1046. // Enforce case-sensitivity of name attribute
  1047. if ( div.querySelectorAll("[name=d]").length ) {
  1048. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1049. }
  1050. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1051. // IE8 throws error here and will not see later tests
  1052. if ( !div.querySelectorAll(":enabled").length ) {
  1053. rbuggyQSA.push( ":enabled", ":disabled" );
  1054. }
  1055. // Opera 10-11 does not throw on post-comma invalid pseudos
  1056. div.querySelectorAll("*,:x");
  1057. rbuggyQSA.push(",.*:");
  1058. });
  1059. }
  1060. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  1061. docElem.webkitMatchesSelector ||
  1062. docElem.mozMatchesSelector ||
  1063. docElem.oMatchesSelector ||
  1064. docElem.msMatchesSelector) )) ) {
  1065. assert(function( div ) {
  1066. // Check to see if it's possible to do matchesSelector
  1067. // on a disconnected node (IE 9)
  1068. support.disconnectedMatch = matches.call( div, "div" );
  1069. // This should fail with an exception
  1070. // Gecko does not error, returns false instead
  1071. matches.call( div, "[s!='']:x" );
  1072. rbuggyMatches.push( "!=", pseudos );
  1073. });
  1074. }
  1075. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1076. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1077. /* Contains
  1078. ---------------------------------------------------------------------- */
  1079. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1080. // Element contains another
  1081. // Purposefully self-exclusive
  1082. // As in, an element does not contain itself
  1083. contains = hasCompare || rnative.test( docElem.contains ) ?
  1084. function( a, b ) {
  1085. var adown = a.nodeType === 9 ? a.documentElement : a,
  1086. bup = b && b.parentNode;
  1087. return a === bup || !!( bup && bup.nodeType === 1 && (
  1088. adown.contains ?
  1089. adown.contains( bup ) :
  1090. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1091. ));
  1092. } :
  1093. function( a, b ) {
  1094. if ( b ) {
  1095. while ( (b = b.parentNode) ) {
  1096. if ( b === a ) {
  1097. return true;
  1098. }
  1099. }
  1100. }
  1101. return false;
  1102. };
  1103. /* Sorting
  1104. ---------------------------------------------------------------------- */
  1105. // Document order sorting
  1106. sortOrder = hasCompare ?
  1107. function( a, b ) {
  1108. // Flag for duplicate removal
  1109. if ( a === b ) {
  1110. hasDuplicate = true;
  1111. return 0;
  1112. }
  1113. // Sort on method existence if only one input has compareDocumentPosition
  1114. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1115. if ( compare ) {
  1116. return compare;
  1117. }
  1118. // Calculate position if both inputs belong to the same document
  1119. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1120. a.compareDocumentPosition( b ) :
  1121. // Otherwise we know they are disconnected
  1122. 1;
  1123. // Disconnected nodes
  1124. if ( compare & 1 ||
  1125. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1126. // Choose the first element that is related to our preferred document
  1127. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  1128. return -1;
  1129. }
  1130. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  1131. return 1;
  1132. }
  1133. // Maintain original order
  1134. return sortInput ?
  1135. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1136. 0;
  1137. }
  1138. return compare & 4 ? -1 : 1;
  1139. } :
  1140. function( a, b ) {
  1141. // Exit early if the nodes are identical
  1142. if ( a === b ) {
  1143. hasDuplicate = true;
  1144. return 0;
  1145. }
  1146. var cur,
  1147. i = 0,
  1148. aup = a.parentNode,
  1149. bup = b.parentNode,
  1150. ap = [ a ],
  1151. bp = [ b ];
  1152. // Parentless nodes are either documents or disconnected
  1153. if ( !aup || !bup ) {
  1154. return a === document ? -1 :
  1155. b === document ? 1 :
  1156. aup ? -1 :
  1157. bup ? 1 :
  1158. sortInput ?
  1159. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1160. 0;
  1161. // If the nodes are siblings, we can do a quick check
  1162. } else if ( aup === bup ) {
  1163. return siblingCheck( a, b );
  1164. }
  1165. // Otherwise we need full lists of their ancestors for comparison
  1166. cur = a;
  1167. while ( (cur = cur.parentNode) ) {
  1168. ap.unshift( cur );
  1169. }
  1170. cur = b;
  1171. while ( (cur = cur.parentNode) ) {
  1172. bp.unshift( cur );
  1173. }
  1174. // Walk down the tree looking for a discrepancy
  1175. while ( ap[i] === bp[i] ) {
  1176. i++;
  1177. }
  1178. return i ?
  1179. // Do a sibling check if the nodes have a common ancestor
  1180. siblingCheck( ap[i], bp[i] ) :
  1181. // Otherwise nodes in our document sort first
  1182. ap[i] === preferredDoc ? -1 :
  1183. bp[i] === preferredDoc ? 1 :
  1184. 0;
  1185. };
  1186. return document;
  1187. };
  1188. Sizzle.matches = function( expr, elements ) {
  1189. return Sizzle( expr, null, null, elements );
  1190. };
  1191. Sizzle.matchesSelector = function( elem, expr ) {
  1192. // Set document vars if needed
  1193. if ( ( elem.ownerDocument || elem ) !== document ) {
  1194. setDocument( elem );
  1195. }
  1196. // Make sure that attribute selectors are quoted
  1197. expr = expr.replace( rattributeQuotes, "='$1']" );
  1198. if ( support.matchesSelector && documentIsHTML &&
  1199. !compilerCache[ expr + " " ] &&
  1200. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  1201. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1202. try {
  1203. var ret = matches.call( elem, expr );
  1204. // IE 9's matchesSelector returns false on disconnected nodes
  1205. if ( ret || support.disconnectedMatch ||
  1206. // As well, disconnected nodes are said to be in a document
  1207. // fragment in IE 9
  1208. elem.document && elem.document.nodeType !== 11 ) {
  1209. return ret;
  1210. }
  1211. } catch (e) {}
  1212. }
  1213. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  1214. };
  1215. Sizzle.contains = function( context, elem ) {
  1216. // Set document vars if needed
  1217. if ( ( context.ownerDocument || context ) !== document ) {
  1218. setDocument( context );
  1219. }
  1220. return contains( context, elem );
  1221. };
  1222. Sizzle.attr = function( elem, name ) {
  1223. // Set document vars if needed
  1224. if ( ( elem.ownerDocument || elem ) !== document ) {
  1225. setDocument( elem );
  1226. }
  1227. var fn = Expr.attrHandle[ name.toLowerCase() ],
  1228. // Don't get fooled by Object.prototype properties (jQuery #13807)
  1229. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  1230. fn( elem, name, !documentIsHTML ) :
  1231. undefined;
  1232. return val !== undefined ?
  1233. val :
  1234. support.attributes || !documentIsHTML ?
  1235. elem.getAttribute( name ) :
  1236. (val = elem.getAttributeNode(name)) && val.specified ?
  1237. val.value :
  1238. null;
  1239. };
  1240. Sizzle.error = function( msg ) {
  1241. throw new Error( "Syntax error, unrecognized expression: " + msg );
  1242. };
  1243. /**
  1244. * Document sorting and removing duplicates
  1245. * @param {ArrayLike} results
  1246. */
  1247. Sizzle.uniqueSort = function( results ) {
  1248. var elem,
  1249. duplicates = [],
  1250. j = 0,
  1251. i = 0;
  1252. // Unless we *know* we can detect duplicates, assume their presence
  1253. hasDuplicate = !support.detectDuplicates;
  1254. sortInput = !support.sortStable && results.slice( 0 );
  1255. results.sort( sortOrder );
  1256. if ( hasDuplicate ) {
  1257. while ( (elem = results[i++]) ) {
  1258. if ( elem === results[ i ] ) {
  1259. j = duplicates.push( i );
  1260. }
  1261. }
  1262. while ( j-- ) {
  1263. results.splice( duplicates[ j ], 1 );
  1264. }
  1265. }
  1266. // Clear input after sorting to release objects
  1267. // See https://github.com/jquery/sizzle/pull/225
  1268. sortInput = null;
  1269. return results;
  1270. };
  1271. /**
  1272. * Utility function for retrieving the text value of an array of DOM nodes
  1273. * @param {Array|Element} elem
  1274. */
  1275. getText = Sizzle.getText = function( elem ) {
  1276. var node,
  1277. ret = "",
  1278. i = 0,
  1279. nodeType = elem.nodeType;
  1280. if ( !nodeType ) {
  1281. // If no nodeType, this is expected to be an array
  1282. while ( (node = elem[i++]) ) {
  1283. // Do not traverse comment nodes
  1284. ret += getText( node );
  1285. }
  1286. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  1287. // Use textContent for elements
  1288. // innerText usage removed for consistency of new lines (jQuery #11153)
  1289. if ( typeof elem.textContent === "string" ) {
  1290. return elem.textContent;
  1291. } else {
  1292. // Traverse its children
  1293. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1294. ret += getText( elem );
  1295. }
  1296. }
  1297. } else if ( nodeType === 3 || nodeType === 4 ) {
  1298. return elem.nodeValue;
  1299. }
  1300. // Do not include comment or processing instruction nodes
  1301. return ret;
  1302. };
  1303. Expr = Sizzle.selectors = {
  1304. // Can be adjusted by the user
  1305. cacheLength: 50,
  1306. createPseudo: markFunction,
  1307. match: matchExpr,
  1308. attrHandle: {},
  1309. find: {},
  1310. relative: {
  1311. ">": { dir: "parentNode", first: true },
  1312. " ": { dir: "parentNode" },
  1313. "+": { dir: "previousSibling", first: true },
  1314. "~": { dir: "previousSibling" }
  1315. },
  1316. preFilter: {
  1317. "ATTR": function( match ) {
  1318. match[1] = match[1].replace( runescape, funescape );
  1319. // Move the given value to match[3] whether quoted or unquoted
  1320. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  1321. if ( match[2] === "~=" ) {
  1322. match[3] = " " + match[3] + " ";
  1323. }
  1324. return match.slice( 0, 4 );
  1325. },
  1326. "CHILD": function( match ) {
  1327. /* matches from matchExpr["CHILD"]
  1328. 1 type (only|nth|...)
  1329. 2 what (child|of-type)
  1330. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  1331. 4 xn-component of xn+y argument ([+-]?\d*n|)
  1332. 5 sign of xn-component
  1333. 6 x of xn-component
  1334. 7 sign of y-component
  1335. 8 y of y-component
  1336. */
  1337. match[1] = match[1].toLowerCase();
  1338. if ( match[1].slice( 0, 3 ) === "nth" ) {
  1339. // nth-* requires argument
  1340. if ( !match[3] ) {
  1341. Sizzle.error( match[0] );
  1342. }
  1343. // numeric x and y parameters for Expr.filter.CHILD
  1344. // remember that false/true cast respectively to 0/1
  1345. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  1346. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  1347. // other types prohibit arguments
  1348. } else if ( match[3] ) {
  1349. Sizzle.error( match[0] );
  1350. }
  1351. return match;
  1352. },
  1353. "PSEUDO": function( match ) {
  1354. var excess,
  1355. unquoted = !match[6] && match[2];
  1356. if ( matchExpr["CHILD"].test( match[0] ) ) {
  1357. return null;
  1358. }
  1359. // Accept quoted arguments as-is
  1360. if ( match[3] ) {
  1361. match[2] = match[4] || match[5] || "";
  1362. // Strip excess characters from unquoted arguments
  1363. } else if ( unquoted && rpseudo.test( unquoted ) &&
  1364. // Get excess from tokenize (recursively)
  1365. (excess = tokenize( unquoted, true )) &&
  1366. // advance to the next closing parenthesis
  1367. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  1368. // excess is a negative index
  1369. match[0] = match[0].slice( 0, excess );
  1370. match[2] = unquoted.slice( 0, excess );
  1371. }
  1372. // Return only captures needed by the pseudo filter method (type and argument)
  1373. return match.slice( 0, 3 );
  1374. }
  1375. },
  1376. filter: {
  1377. "TAG": function( nodeNameSelector ) {
  1378. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  1379. return nodeNameSelector === "*" ?
  1380. function() { return true; } :
  1381. function( elem ) {
  1382. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  1383. };
  1384. },
  1385. "CLASS": function( className ) {
  1386. var pattern = classCache[ className + " " ];
  1387. return pattern ||
  1388. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  1389. classCache( className, function( elem ) {
  1390. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  1391. });
  1392. },
  1393. "ATTR": function( name, operator, check ) {
  1394. return function( elem ) {
  1395. var result = Sizzle.attr( elem, name );
  1396. if ( result == null ) {
  1397. return operator === "!=";
  1398. }
  1399. if ( !operator ) {
  1400. return true;
  1401. }
  1402. result += "";
  1403. return operator === "=" ? result === check :
  1404. operator === "!=" ? result !== check :
  1405. operator === "^=" ? check && result.indexOf( check ) === 0 :
  1406. operator === "*=" ? check && result.indexOf( check ) > -1 :
  1407. operator === "$=" ? check && result.slice( -check.length ) === check :
  1408. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  1409. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  1410. false;
  1411. };
  1412. },
  1413. "CHILD": function( type, what, argument, first, last ) {
  1414. var simple = type.slice( 0, 3 ) !== "nth",
  1415. forward = type.slice( -4 ) !== "last",
  1416. ofType = what === "of-type";
  1417. return first === 1 && last === 0 ?
  1418. // Shortcut for :nth-*(n)
  1419. function( elem ) {
  1420. return !!elem.parentNode;
  1421. } :
  1422. function( elem, context, xml ) {
  1423. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  1424. dir = simple !== forward ? "nextSibling" : "previousSibling",
  1425. parent = elem.parentNode,
  1426. name = ofType && elem.nodeName.toLowerCase(),
  1427. useCache = !xml && !ofType,
  1428. diff = false;
  1429. if ( parent ) {
  1430. // :(first|last|only)-(child|of-type)
  1431. if ( simple ) {
  1432. while ( dir ) {
  1433. node = elem;
  1434. while ( (node = node[ dir ]) ) {
  1435. if ( ofType ?
  1436. node.nodeName.toLowerCase() === name :
  1437. node.nodeType === 1 ) {
  1438. return false;
  1439. }
  1440. }
  1441. // Reverse direction for :only-* (if we haven't yet done so)
  1442. start = dir = type === "only" && !start && "nextSibling";
  1443. }
  1444. return true;
  1445. }
  1446. start = [ forward ? parent.firstChild : parent.lastChild ];
  1447. // non-xml :nth-child(...) stores cache data on `parent`
  1448. if ( forward && useCache ) {
  1449. // Seek `elem` from a previously-cached index
  1450. // ...in a gzip-friendly way
  1451. node = parent;
  1452. outerCache = node[ expando ] || (node[ expando ] = {});
  1453. // Support: IE <9 only
  1454. // Defend against cloned attroperties (jQuery gh-1709)
  1455. uniqueCache = outerCache[ node.uniqueID ] ||
  1456. (outerCache[ node.uniqueID ] = {});
  1457. cache = uniqueCache[ type ] || [];
  1458. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1459. diff = nodeIndex && cache[ 2 ];
  1460. node = nodeIndex && parent.childNodes[ nodeIndex ];
  1461. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1462. // Fallback to seeking `elem` from the start
  1463. (diff = nodeIndex = 0) || start.pop()) ) {
  1464. // When found, cache indexes on `parent` and break
  1465. if ( node.nodeType === 1 && ++diff && node === elem ) {
  1466. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  1467. break;
  1468. }
  1469. }
  1470. } else {
  1471. // Use previously-cached element index if available
  1472. if ( useCache ) {
  1473. // ...in a gzip-friendly way
  1474. node = elem;
  1475. outerCache = node[ expando ] || (node[ expando ] = {});
  1476. // Support: IE <9 only
  1477. // Defend against cloned attroperties (jQuery gh-1709)
  1478. uniqueCache = outerCache[ node.uniqueID ] ||
  1479. (outerCache[ node.uniqueID ] = {});
  1480. cache = uniqueCache[ type ] || [];
  1481. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1482. diff = nodeIndex;
  1483. }
  1484. // xml :nth-child(...)
  1485. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  1486. if ( diff === false ) {
  1487. // Use the same loop as above to seek `elem` from the start
  1488. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1489. (diff = nodeIndex = 0) || start.pop()) ) {
  1490. if ( ( ofType ?
  1491. node.nodeName.toLowerCase() === name :
  1492. node.nodeType === 1 ) &&
  1493. ++diff ) {
  1494. // Cache the index of each encountered element
  1495. if ( useCache ) {
  1496. outerCache = node[ expando ] || (node[ expando ] = {});
  1497. // Support: IE <9 only
  1498. // Defend against cloned attroperties (jQuery gh-1709)
  1499. uniqueCache = outerCache[ node.uniqueID ] ||
  1500. (outerCache[ node.uniqueID ] = {});
  1501. uniqueCache[ type ] = [ dirruns, diff ];
  1502. }
  1503. if ( node === elem ) {
  1504. break;
  1505. }
  1506. }
  1507. }
  1508. }
  1509. }
  1510. // Incorporate the offset, then check against cycle size
  1511. diff -= last;
  1512. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  1513. }
  1514. };
  1515. },
  1516. "PSEUDO": function( pseudo, argument ) {
  1517. // pseudo-class names are case-insensitive
  1518. // http://www.w3.org/TR/selectors/#pseudo-classes
  1519. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  1520. // Remember that setFilters inherits from pseudos
  1521. var args,
  1522. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  1523. Sizzle.error( "unsupported pseudo: " + pseudo );
  1524. // The user may use createPseudo to indicate that
  1525. // arguments are needed to create the filter function
  1526. // just as Sizzle does
  1527. if ( fn[ expando ] ) {
  1528. return fn( argument );
  1529. }
  1530. // But maintain support for old signatures
  1531. if ( fn.length > 1 ) {
  1532. args = [ pseudo, pseudo, "", argument ];
  1533. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  1534. markFunction(function( seed, matches ) {
  1535. var idx,
  1536. matched = fn( seed, argument ),
  1537. i = matched.length;
  1538. while ( i-- ) {
  1539. idx = indexOf( seed, matched[i] );
  1540. seed[ idx ] = !( matches[ idx ] = matched[i] );
  1541. }
  1542. }) :
  1543. function( elem ) {
  1544. return fn( elem, 0, args );
  1545. };
  1546. }
  1547. return fn;
  1548. }
  1549. },
  1550. pseudos: {
  1551. // Potentially complex pseudos
  1552. "not": markFunction(function( selector ) {
  1553. // Trim the selector passed to compile
  1554. // to avoid treating leading and trailing
  1555. // spaces as combinators
  1556. var input = [],
  1557. results = [],
  1558. matcher = compile( selector.replace( rtrim, "$1" ) );
  1559. return matcher[ expando ] ?
  1560. markFunction(function( seed, matches, context, xml ) {
  1561. var elem,
  1562. unmatched = matcher( seed, null, xml, [] ),
  1563. i = seed.length;
  1564. // Match elements unmatched by `matcher`
  1565. while ( i-- ) {
  1566. if ( (elem = unmatched[i]) ) {
  1567. seed[i] = !(matches[i] = elem);
  1568. }
  1569. }
  1570. }) :
  1571. function( elem, context, xml ) {
  1572. input[0] = elem;
  1573. matcher( input, null, xml, results );
  1574. // Don't keep the element (issue #299)
  1575. input[0] = null;
  1576. return !results.pop();
  1577. };
  1578. }),
  1579. "has": markFunction(function( selector ) {
  1580. return function( elem ) {
  1581. return Sizzle( selector, elem ).length > 0;
  1582. };
  1583. }),
  1584. "contains": markFunction(function( text ) {
  1585. text = text.replace( runescape, funescape );
  1586. return function( elem ) {
  1587. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  1588. };
  1589. }),
  1590. // "Whether an element is represented by a :lang() selector
  1591. // is based solely on the element's language value
  1592. // being equal to the identifier C,
  1593. // or beginning with the identifier C immediately followed by "-".
  1594. // The matching of C against the element's language value is performed case-insensitively.
  1595. // The identifier C does not have to be a valid language name."
  1596. // http://www.w3.org/TR/selectors/#lang-pseudo
  1597. "lang": markFunction( function( lang ) {
  1598. // lang value must be a valid identifier
  1599. if ( !ridentifier.test(lang || "") ) {
  1600. Sizzle.error( "unsupported lang: " + lang );
  1601. }
  1602. lang = lang.replace( runescape, funescape ).toLowerCase();
  1603. return function( elem ) {
  1604. var elemLang;
  1605. do {
  1606. if ( (elemLang = documentIsHTML ?
  1607. elem.lang :
  1608. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  1609. elemLang = elemLang.toLowerCase();
  1610. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  1611. }
  1612. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  1613. return false;
  1614. };
  1615. }),
  1616. // Miscellaneous
  1617. "target": function( elem ) {
  1618. var hash = window.location && window.location.hash;
  1619. return hash && hash.slice( 1 ) === elem.id;
  1620. },
  1621. "root": function( elem ) {
  1622. return elem === docElem;
  1623. },
  1624. "focus": function( elem ) {
  1625. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  1626. },
  1627. // Boolean properties
  1628. "enabled": function( elem ) {
  1629. return elem.disabled === false;
  1630. },
  1631. "disabled": function( elem ) {
  1632. return elem.disabled === true;
  1633. },
  1634. "checked": function( elem ) {
  1635. // In CSS3, :checked should return both checked and selected elements
  1636. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1637. var nodeName = elem.nodeName.toLowerCase();
  1638. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  1639. },
  1640. "selected": function( elem ) {
  1641. // Accessing this property makes selected-by-default
  1642. // options in Safari work properly
  1643. if ( elem.parentNode ) {
  1644. elem.parentNode.selectedIndex;
  1645. }
  1646. return elem.selected === true;
  1647. },
  1648. // Contents
  1649. "empty": function( elem ) {
  1650. // http://www.w3.org/TR/selectors/#empty-pseudo
  1651. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  1652. // but not by others (comment: 8; processing instruction: 7; etc.)
  1653. // nodeType < 6 works because attributes (2) do not appear as children
  1654. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1655. if ( elem.nodeType < 6 ) {
  1656. return false;
  1657. }
  1658. }
  1659. return true;
  1660. },
  1661. "parent": function( elem ) {
  1662. return !Expr.pseudos["empty"]( elem );
  1663. },
  1664. // Element/input types
  1665. "header": function( elem ) {
  1666. return rheader.test( elem.nodeName );
  1667. },
  1668. "input": function( elem ) {
  1669. return rinputs.test( elem.nodeName );
  1670. },
  1671. "button": function( elem ) {
  1672. var name = elem.nodeName.toLowerCase();
  1673. return name === "input" && elem.type === "button" || name === "button";
  1674. },
  1675. "text": function( elem ) {
  1676. var attr;
  1677. return elem.nodeName.toLowerCase() === "input" &&
  1678. elem.type === "text" &&
  1679. // Support: IE<8
  1680. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  1681. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  1682. },
  1683. // Position-in-collection
  1684. "first": createPositionalPseudo(function() {
  1685. return [ 0 ];
  1686. }),
  1687. "last": createPositionalPseudo(function( matchIndexes, length ) {
  1688. return [ length - 1 ];
  1689. }),
  1690. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1691. return [ argument < 0 ? argument + length : argument ];
  1692. }),
  1693. "even": createPositionalPseudo(function( matchIndexes, length ) {
  1694. var i = 0;
  1695. for ( ; i < length; i += 2 ) {
  1696. matchIndexes.push( i );
  1697. }
  1698. return matchIndexes;
  1699. }),
  1700. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  1701. var i = 1;
  1702. for ( ; i < length; i += 2 ) {
  1703. matchIndexes.push( i );
  1704. }
  1705. return matchIndexes;
  1706. }),
  1707. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1708. var i = argument < 0 ? argument + length : argument;
  1709. for ( ; --i >= 0; ) {
  1710. matchIndexes.push( i );
  1711. }
  1712. return matchIndexes;
  1713. }),
  1714. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1715. var i = argument < 0 ? argument + length : argument;
  1716. for ( ; ++i < length; ) {
  1717. matchIndexes.push( i );
  1718. }
  1719. return matchIndexes;
  1720. })
  1721. }
  1722. };
  1723. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  1724. // Add button/input type pseudos
  1725. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  1726. Expr.pseudos[ i ] = createInputPseudo( i );
  1727. }
  1728. for ( i in { submit: true, reset: true } ) {
  1729. Expr.pseudos[ i ] = createButtonPseudo( i );
  1730. }
  1731. // Easy API for creating new setFilters
  1732. function setFilters() {}
  1733. setFilters.prototype = Expr.filters = Expr.pseudos;
  1734. Expr.setFilters = new setFilters();
  1735. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  1736. var matched, match, tokens, type,
  1737. soFar, groups, preFilters,
  1738. cached = tokenCache[ selector + " " ];
  1739. if ( cached ) {
  1740. return parseOnly ? 0 : cached.slice( 0 );
  1741. }
  1742. soFar = selector;
  1743. groups = [];
  1744. preFilters = Expr.preFilter;
  1745. while ( soFar ) {
  1746. // Comma and first run
  1747. if ( !matched || (match = rcomma.exec( soFar )) ) {
  1748. if ( match ) {
  1749. // Don't consume trailing commas as valid
  1750. soFar = soFar.slice( match[0].length ) || soFar;
  1751. }
  1752. groups.push( (tokens = []) );
  1753. }
  1754. matched = false;
  1755. // Combinators
  1756. if ( (match = rcombinators.exec( soFar )) ) {
  1757. matched = match.shift();
  1758. tokens.push({
  1759. value: matched,
  1760. // Cast descendant combinators to space
  1761. type: match[0].replace( rtrim, " " )
  1762. });
  1763. soFar = soFar.slice( matched.length );
  1764. }
  1765. // Filters
  1766. for ( type in Expr.filter ) {
  1767. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  1768. (match = preFilters[ type ]( match ))) ) {
  1769. matched = match.shift();
  1770. tokens.push({
  1771. value: matched,
  1772. type: type,
  1773. matches: match
  1774. });
  1775. soFar = soFar.slice( matched.length );
  1776. }
  1777. }
  1778. if ( !matched ) {
  1779. break;
  1780. }
  1781. }
  1782. // Return the length of the invalid excess
  1783. // if we're just parsing
  1784. // Otherwise, throw an error or return tokens
  1785. return parseOnly ?
  1786. soFar.length :
  1787. soFar ?
  1788. Sizzle.error( selector ) :
  1789. // Cache the tokens
  1790. tokenCache( selector, groups ).slice( 0 );
  1791. };
  1792. function toSelector( tokens ) {
  1793. var i = 0,
  1794. len = tokens.length,
  1795. selector = "";
  1796. for ( ; i < len; i++ ) {
  1797. selector += tokens[i].value;
  1798. }
  1799. return selector;
  1800. }
  1801. function addCombinator( matcher, combinator, base ) {
  1802. var dir = combinator.dir,
  1803. checkNonElements = base && dir === "parentNode",
  1804. doneName = done++;
  1805. return combinator.first ?
  1806. // Check against closest ancestor/preceding element
  1807. function( elem, context, xml ) {
  1808. while ( (elem = elem[ dir ]) ) {
  1809. if ( elem.nodeType === 1 || checkNonElements ) {
  1810. return matcher( elem, context, xml );
  1811. }
  1812. }
  1813. } :
  1814. // Check against all ancestor/preceding elements
  1815. function( elem, context, xml ) {
  1816. var oldCache, uniqueCache, outerCache,
  1817. newCache = [ dirruns, doneName ];
  1818. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  1819. if ( xml ) {
  1820. while ( (elem = elem[ dir ]) ) {
  1821. if ( elem.nodeType === 1 || checkNonElements ) {
  1822. if ( matcher( elem, context, xml ) ) {
  1823. return true;
  1824. }
  1825. }
  1826. }
  1827. } else {
  1828. while ( (elem = elem[ dir ]) ) {
  1829. if ( elem.nodeType === 1 || checkNonElements ) {
  1830. outerCache = elem[ expando ] || (elem[ expando ] = {});
  1831. // Support: IE <9 only
  1832. // Defend against cloned attroperties (jQuery gh-1709)
  1833. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  1834. if ( (oldCache = uniqueCache[ dir ]) &&
  1835. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  1836. // Assign to newCache so results back-propagate to previous elements
  1837. return (newCache[ 2 ] = oldCache[ 2 ]);
  1838. } else {
  1839. // Reuse newcache so results back-propagate to previous elements
  1840. uniqueCache[ dir ] = newCache;
  1841. // A match means we're done; a fail means we have to keep checking
  1842. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  1843. return true;
  1844. }
  1845. }
  1846. }
  1847. }
  1848. }
  1849. };
  1850. }
  1851. function elementMatcher( matchers ) {
  1852. return matchers.length > 1 ?
  1853. function( elem, context, xml ) {
  1854. var i = matchers.length;
  1855. while ( i-- ) {
  1856. if ( !matchers[i]( elem, context, xml ) ) {
  1857. return false;
  1858. }
  1859. }
  1860. return true;
  1861. } :
  1862. matchers[0];
  1863. }
  1864. function multipleContexts( selector, contexts, results ) {
  1865. var i = 0,
  1866. len = contexts.length;
  1867. for ( ; i < len; i++ ) {
  1868. Sizzle( selector, contexts[i], results );
  1869. }
  1870. return results;
  1871. }
  1872. function condense( unmatched, map, filter, context, xml ) {
  1873. var elem,
  1874. newUnmatched = [],
  1875. i = 0,
  1876. len = unmatched.length,
  1877. mapped = map != null;
  1878. for ( ; i < len; i++ ) {
  1879. if ( (elem = unmatched[i]) ) {
  1880. if ( !filter || filter( elem, context, xml ) ) {
  1881. newUnmatched.push( elem );
  1882. if ( mapped ) {
  1883. map.push( i );
  1884. }
  1885. }
  1886. }
  1887. }
  1888. return newUnmatched;
  1889. }
  1890. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  1891. if ( postFilter && !postFilter[ expando ] ) {
  1892. postFilter = setMatcher( postFilter );
  1893. }
  1894. if ( postFinder && !postFinder[ expando ] ) {
  1895. postFinder = setMatcher( postFinder, postSelector );
  1896. }
  1897. return markFunction(function( seed, results, context, xml ) {
  1898. var temp, i, elem,
  1899. preMap = [],
  1900. postMap = [],
  1901. preexisting = results.length,
  1902. // Get initial elements from seed or context
  1903. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  1904. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  1905. matcherIn = preFilter && ( seed || !selector ) ?
  1906. condense( elems, preMap, preFilter, context, xml ) :
  1907. elems,
  1908. matcherOut = matcher ?
  1909. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  1910. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  1911. // ...intermediate processing is necessary
  1912. [] :
  1913. // ...otherwise use results directly
  1914. results :
  1915. matcherIn;
  1916. // Find primary matches
  1917. if ( matcher ) {
  1918. matcher( matcherIn, matcherOut, context, xml );
  1919. }
  1920. // Apply postFilter
  1921. if ( postFilter ) {
  1922. temp = condense( matcherOut, postMap );
  1923. postFilter( temp, [], context, xml );
  1924. // Un-match failing elements by moving them back to matcherIn
  1925. i = temp.length;
  1926. while ( i-- ) {
  1927. if ( (elem = temp[i]) ) {
  1928. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  1929. }
  1930. }
  1931. }
  1932. if ( seed ) {
  1933. if ( postFinder || preFilter ) {
  1934. if ( postFinder ) {
  1935. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  1936. temp = [];
  1937. i = matcherOut.length;
  1938. while ( i-- ) {
  1939. if ( (elem = matcherOut[i]) ) {
  1940. // Restore matcherIn since elem is not yet a final match
  1941. temp.push( (matcherIn[i] = elem) );
  1942. }
  1943. }
  1944. postFinder( null, (matcherOut = []), temp, xml );
  1945. }
  1946. // Move matched elements from seed to results to keep them synchronized
  1947. i = matcherOut.length;
  1948. while ( i-- ) {
  1949. if ( (elem = matcherOut[i]) &&
  1950. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  1951. seed[temp] = !(results[temp] = elem);
  1952. }
  1953. }
  1954. }
  1955. // Add elements to results, through postFinder if defined
  1956. } else {
  1957. matcherOut = condense(
  1958. matcherOut === results ?
  1959. matcherOut.splice( preexisting, matcherOut.length ) :
  1960. matcherOut
  1961. );
  1962. if ( postFinder ) {
  1963. postFinder( null, results, matcherOut, xml );
  1964. } else {
  1965. push.apply( results, matcherOut );
  1966. }
  1967. }
  1968. });
  1969. }
  1970. function matcherFromTokens( tokens ) {
  1971. var checkContext, matcher, j,
  1972. len = tokens.length,
  1973. leadingRelative = Expr.relative[ tokens[0].type ],
  1974. implicitRelative = leadingRelative || Expr.relative[" "],
  1975. i = leadingRelative ? 1 : 0,
  1976. // The foundational matcher ensures that elements are reachable from top-level context(s)
  1977. matchContext = addCombinator( function( elem ) {
  1978. return elem === checkContext;
  1979. }, implicitRelative, true ),
  1980. matchAnyContext = addCombinator( function( elem ) {
  1981. return indexOf( checkContext, elem ) > -1;
  1982. }, implicitRelative, true ),
  1983. matchers = [ function( elem, context, xml ) {
  1984. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  1985. (checkContext = context).nodeType ?
  1986. matchContext( elem, context, xml ) :
  1987. matchAnyContext( elem, context, xml ) );
  1988. // Avoid hanging onto element (issue #299)
  1989. checkContext = null;
  1990. return ret;
  1991. } ];
  1992. for ( ; i < len; i++ ) {
  1993. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  1994. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  1995. } else {
  1996. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  1997. // Return special upon seeing a positional matcher
  1998. if ( matcher[ expando ] ) {
  1999. // Find the next relative operator (if any) for proper handling
  2000. j = ++i;
  2001. for ( ; j < len; j++ ) {
  2002. if ( Expr.relative[ tokens[j].type ] ) {
  2003. break;
  2004. }
  2005. }
  2006. return setMatcher(
  2007. i > 1 && elementMatcher( matchers ),
  2008. i > 1 && toSelector(
  2009. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2010. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  2011. ).replace( rtrim, "$1" ),
  2012. matcher,
  2013. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2014. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  2015. j < len && toSelector( tokens )
  2016. );
  2017. }
  2018. matchers.push( matcher );
  2019. }
  2020. }
  2021. return elementMatcher( matchers );
  2022. }
  2023. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2024. var bySet = setMatchers.length > 0,
  2025. byElement = elementMatchers.length > 0,
  2026. superMatcher = function( seed, context, xml, results, outermost ) {
  2027. var elem, j, matcher,
  2028. matchedCount = 0,
  2029. i = "0",
  2030. unmatched = seed && [],
  2031. setMatched = [],
  2032. contextBackup = outermostContext,
  2033. // We must always have either seed elements or outermost context
  2034. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  2035. // Use integer dirruns iff this is the outermost matcher
  2036. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  2037. len = elems.length;
  2038. if ( outermost ) {
  2039. outermostContext = context === document || context || outermost;
  2040. }
  2041. // Add elements passing elementMatchers directly to results
  2042. // Support: IE<9, Safari
  2043. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  2044. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  2045. if ( byElement && elem ) {
  2046. j = 0;
  2047. if ( !context && elem.ownerDocument !== document ) {
  2048. setDocument( elem );
  2049. xml = !documentIsHTML;
  2050. }
  2051. while ( (matcher = elementMatchers[j++]) ) {
  2052. if ( matcher( elem, context || document, xml) ) {
  2053. results.push( elem );
  2054. break;
  2055. }
  2056. }
  2057. if ( outermost ) {
  2058. dirruns = dirrunsUnique;
  2059. }
  2060. }
  2061. // Track unmatched elements for set filters
  2062. if ( bySet ) {
  2063. // They will have gone through all possible matchers
  2064. if ( (elem = !matcher && elem) ) {
  2065. matchedCount--;
  2066. }
  2067. // Lengthen the array for every element, matched or not
  2068. if ( seed ) {
  2069. unmatched.push( elem );
  2070. }
  2071. }
  2072. }
  2073. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2074. // makes the latter nonnegative.
  2075. matchedCount += i;
  2076. // Apply set filters to unmatched elements
  2077. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2078. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2079. // no element matchers and no seed.
  2080. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2081. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2082. // numerically zero.
  2083. if ( bySet && i !== matchedCount ) {
  2084. j = 0;
  2085. while ( (matcher = setMatchers[j++]) ) {
  2086. matcher( unmatched, setMatched, context, xml );
  2087. }
  2088. if ( seed ) {
  2089. // Reintegrate element matches to eliminate the need for sorting
  2090. if ( matchedCount > 0 ) {
  2091. while ( i-- ) {
  2092. if ( !(unmatched[i] || setMatched[i]) ) {
  2093. setMatched[i] = pop.call( results );
  2094. }
  2095. }
  2096. }
  2097. // Discard index placeholder values to get only actual matches
  2098. setMatched = condense( setMatched );
  2099. }
  2100. // Add matches to results
  2101. push.apply( results, setMatched );
  2102. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2103. if ( outermost && !seed && setMatched.length > 0 &&
  2104. ( matchedCount + setMatchers.length ) > 1 ) {
  2105. Sizzle.uniqueSort( results );
  2106. }
  2107. }
  2108. // Override manipulation of globals by nested matchers
  2109. if ( outermost ) {
  2110. dirruns = dirrunsUnique;
  2111. outermostContext = contextBackup;
  2112. }
  2113. return unmatched;
  2114. };
  2115. return bySet ?
  2116. markFunction( superMatcher ) :
  2117. superMatcher;
  2118. }
  2119. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  2120. var i,
  2121. setMatchers = [],
  2122. elementMatchers = [],
  2123. cached = compilerCache[ selector + " " ];
  2124. if ( !cached ) {
  2125. // Generate a function of recursive functions that can be used to check each element
  2126. if ( !match ) {
  2127. match = tokenize( selector );
  2128. }
  2129. i = match.length;
  2130. while ( i-- ) {
  2131. cached = matcherFromTokens( match[i] );
  2132. if ( cached[ expando ] ) {
  2133. setMatchers.push( cached );
  2134. } else {
  2135. elementMatchers.push( cached );
  2136. }
  2137. }
  2138. // Cache the compiled function
  2139. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  2140. // Save selector and tokenization
  2141. cached.selector = selector;
  2142. }
  2143. return cached;
  2144. };
  2145. /**
  2146. * A low-level selection function that works with Sizzle's compiled
  2147. * selector functions
  2148. * @param {String|Function} selector A selector or a pre-compiled
  2149. * selector function built with Sizzle.compile
  2150. * @param {Element} context
  2151. * @param {Array} [results]
  2152. * @param {Array} [seed] A set of elements to match against
  2153. */
  2154. select = Sizzle.select = function( selector, context, results, seed ) {
  2155. var i, tokens, token, type, find,
  2156. compiled = typeof selector === "function" && selector,
  2157. match = !seed && tokenize( (selector = compiled.selector || selector) );
  2158. results = results || [];
  2159. // Try to minimize operations if there is only one selector in the list and no seed
  2160. // (the latter of which guarantees us context)
  2161. if ( match.length === 1 ) {
  2162. // Reduce context if the leading compound selector is an ID
  2163. tokens = match[0] = match[0].slice( 0 );
  2164. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  2165. support.getById && context.nodeType === 9 && documentIsHTML &&
  2166. Expr.relative[ tokens[1].type ] ) {
  2167. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  2168. if ( !context ) {
  2169. return results;
  2170. // Precompiled matchers will still verify ancestry, so step up a level
  2171. } else if ( compiled ) {
  2172. context = context.parentNode;
  2173. }
  2174. selector = selector.slice( tokens.shift().value.length );
  2175. }
  2176. // Fetch a seed set for right-to-left matching
  2177. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  2178. while ( i-- ) {
  2179. token = tokens[i];
  2180. // Abort if we hit a combinator
  2181. if ( Expr.relative[ (type = token.type) ] ) {
  2182. break;
  2183. }
  2184. if ( (find = Expr.find[ type ]) ) {
  2185. // Search, expanding context for leading sibling combinators
  2186. if ( (seed = find(
  2187. token.matches[0].replace( runescape, funescape ),
  2188. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  2189. )) ) {
  2190. // If seed is empty or no tokens remain, we can return early
  2191. tokens.splice( i, 1 );
  2192. selector = seed.length && toSelector( tokens );
  2193. if ( !selector ) {
  2194. push.apply( results, seed );
  2195. return results;
  2196. }
  2197. break;
  2198. }
  2199. }
  2200. }
  2201. }
  2202. // Compile and execute a filtering function if one is not provided
  2203. // Provide `match` to avoid retokenization if we modified the selector above
  2204. ( compiled || compile( selector, match ) )(
  2205. seed,
  2206. context,
  2207. !documentIsHTML,
  2208. results,
  2209. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  2210. );
  2211. return results;
  2212. };
  2213. // One-time assignments
  2214. // Sort stability
  2215. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  2216. // Support: Chrome 14-35+
  2217. // Always assume duplicates if they aren't passed to the comparison function
  2218. support.detectDuplicates = !!hasDuplicate;
  2219. // Initialize against the default document
  2220. setDocument();
  2221. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  2222. // Detached nodes confoundingly follow *each other*
  2223. support.sortDetached = assert(function( div1 ) {
  2224. // Should return 1, but returns 4 (following)
  2225. return div1.compareDocumentPosition( document.createElement("div") ) & 1;
  2226. });
  2227. // Support: IE<8
  2228. // Prevent attribute/property "interpolation"
  2229. // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  2230. if ( !assert(function( div ) {
  2231. div.innerHTML = "<a href='#'></a>";
  2232. return div.firstChild.getAttribute("href") === "#" ;
  2233. }) ) {
  2234. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  2235. if ( !isXML ) {
  2236. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  2237. }
  2238. });
  2239. }
  2240. // Support: IE<9
  2241. // Use defaultValue in place of getAttribute("value")
  2242. if ( !support.attributes || !assert(function( div ) {
  2243. div.innerHTML = "<input/>";
  2244. div.firstChild.setAttribute( "value", "" );
  2245. return div.firstChild.getAttribute( "value" ) === "";
  2246. }) ) {
  2247. addHandle( "value", function( elem, name, isXML ) {
  2248. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  2249. return elem.defaultValue;
  2250. }
  2251. });
  2252. }
  2253. // Support: IE<9
  2254. // Use getAttributeNode to fetch booleans when getAttribute lies
  2255. if ( !assert(function( div ) {
  2256. return div.getAttribute("disabled") == null;
  2257. }) ) {
  2258. addHandle( booleans, function( elem, name, isXML ) {
  2259. var val;
  2260. if ( !isXML ) {
  2261. return elem[ name ] === true ? name.toLowerCase() :
  2262. (val = elem.getAttributeNode( name )) && val.specified ?
  2263. val.value :
  2264. null;
  2265. }
  2266. });
  2267. }
  2268. return Sizzle;
  2269. })( window );
  2270. jQuery.find = Sizzle;
  2271. jQuery.expr = Sizzle.selectors;
  2272. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  2273. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  2274. jQuery.text = Sizzle.getText;
  2275. jQuery.isXMLDoc = Sizzle.isXML;
  2276. jQuery.contains = Sizzle.contains;
  2277. var dir = function( elem, dir, until ) {
  2278. var matched = [],
  2279. truncate = until !== undefined;
  2280. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  2281. if ( elem.nodeType === 1 ) {
  2282. if ( truncate && jQuery( elem ).is( until ) ) {
  2283. break;
  2284. }
  2285. matched.push( elem );
  2286. }
  2287. }
  2288. return matched;
  2289. };
  2290. var siblings = function( n, elem ) {
  2291. var matched = [];
  2292. for ( ; n; n = n.nextSibling ) {
  2293. if ( n.nodeType === 1 && n !== elem ) {
  2294. matched.push( n );
  2295. }
  2296. }
  2297. return matched;
  2298. };
  2299. var rneedsContext = jQuery.expr.match.needsContext;
  2300. var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ );
  2301. var risSimple = /^.[^:#\[\.,]*$/;
  2302. // Implement the identical functionality for filter and not
  2303. function winnow( elements, qualifier, not ) {
  2304. if ( jQuery.isFunction( qualifier ) ) {
  2305. return jQuery.grep( elements, function( elem, i ) {
  2306. /* jshint -W018 */
  2307. return !!qualifier.call( elem, i, elem ) !== not;
  2308. } );
  2309. }
  2310. if ( qualifier.nodeType ) {
  2311. return jQuery.grep( elements, function( elem ) {
  2312. return ( elem === qualifier ) !== not;
  2313. } );
  2314. }
  2315. if ( typeof qualifier === "string" ) {
  2316. if ( risSimple.test( qualifier ) ) {
  2317. return jQuery.filter( qualifier, elements, not );
  2318. }
  2319. qualifier = jQuery.filter( qualifier, elements );
  2320. }
  2321. return jQuery.grep( elements, function( elem ) {
  2322. return ( jQuery.inArray( elem, qualifier ) > -1 ) !== not;
  2323. } );
  2324. }
  2325. jQuery.filter = function( expr, elems, not ) {
  2326. var elem = elems[ 0 ];
  2327. if ( not ) {
  2328. expr = ":not(" + expr + ")";
  2329. }
  2330. return elems.length === 1 && elem.nodeType === 1 ?
  2331. jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
  2332. jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  2333. return elem.nodeType === 1;
  2334. } ) );
  2335. };
  2336. jQuery.fn.extend( {
  2337. find: function( selector ) {
  2338. var i,
  2339. ret = [],
  2340. self = this,
  2341. len = self.length;
  2342. if ( typeof selector !== "string" ) {
  2343. return this.pushStack( jQuery( selector ).filter( function() {
  2344. for ( i = 0; i < len; i++ ) {
  2345. if ( jQuery.contains( self[ i ], this ) ) {
  2346. return true;
  2347. }
  2348. }
  2349. } ) );
  2350. }
  2351. for ( i = 0; i < len; i++ ) {
  2352. jQuery.find( selector, self[ i ], ret );
  2353. }
  2354. // Needed because $( selector, context ) becomes $( context ).find( selector )
  2355. ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
  2356. ret.selector = this.selector ? this.selector + " " + selector : selector;
  2357. return ret;
  2358. },
  2359. filter: function( selector ) {
  2360. return this.pushStack( winnow( this, selector || [], false ) );
  2361. },
  2362. not: function( selector ) {
  2363. return this.pushStack( winnow( this, selector || [], true ) );
  2364. },
  2365. is: function( selector ) {
  2366. return !!winnow(
  2367. this,
  2368. // If this is a positional/relative selector, check membership in the returned set
  2369. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  2370. typeof selector === "string" && rneedsContext.test( selector ) ?
  2371. jQuery( selector ) :
  2372. selector || [],
  2373. false
  2374. ).length;
  2375. }
  2376. } );
  2377. // Initialize a jQuery object
  2378. // A central reference to the root jQuery(document)
  2379. var rootjQuery,
  2380. // A simple way to check for HTML strings
  2381. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  2382. // Strict HTML recognition (#11290: must start with <)
  2383. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
  2384. init = jQuery.fn.init = function( selector, context, root ) {
  2385. var match, elem;
  2386. // HANDLE: $(""), $(null), $(undefined), $(false)
  2387. if ( !selector ) {
  2388. return this;
  2389. }
  2390. // init accepts an alternate rootjQuery
  2391. // so migrate can support jQuery.sub (gh-2101)
  2392. root = root || rootjQuery;
  2393. // Handle HTML strings
  2394. if ( typeof selector === "string" ) {
  2395. if ( selector.charAt( 0 ) === "<" &&
  2396. selector.charAt( selector.length - 1 ) === ">" &&
  2397. selector.length >= 3 ) {
  2398. // Assume that strings that start and end with <> are HTML and skip the regex check
  2399. match = [ null, selector, null ];
  2400. } else {
  2401. match = rquickExpr.exec( selector );
  2402. }
  2403. // Match html or make sure no context is specified for #id
  2404. if ( match && ( match[ 1 ] || !context ) ) {
  2405. // HANDLE: $(html) -> $(array)
  2406. if ( match[ 1 ] ) {
  2407. context = context instanceof jQuery ? context[ 0 ] : context;
  2408. // scripts is true for back-compat
  2409. // Intentionally let the error be thrown if parseHTML is not present
  2410. jQuery.merge( this, jQuery.parseHTML(
  2411. match[ 1 ],
  2412. context && context.nodeType ? context.ownerDocument || context : document,
  2413. true
  2414. ) );
  2415. // HANDLE: $(html, props)
  2416. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  2417. for ( match in context ) {
  2418. // Properties of context are called as methods if possible
  2419. if ( jQuery.isFunction( this[ match ] ) ) {
  2420. this[ match ]( context[ match ] );
  2421. // ...and otherwise set as attributes
  2422. } else {
  2423. this.attr( match, context[ match ] );
  2424. }
  2425. }
  2426. }
  2427. return this;
  2428. // HANDLE: $(#id)
  2429. } else {
  2430. elem = document.getElementById( match[ 2 ] );
  2431. // Check parentNode to catch when Blackberry 4.6 returns
  2432. // nodes that are no longer in the document #6963
  2433. if ( elem && elem.parentNode ) {
  2434. // Handle the case where IE and Opera return items
  2435. // by name instead of ID
  2436. if ( elem.id !== match[ 2 ] ) {
  2437. return rootjQuery.find( selector );
  2438. }
  2439. // Otherwise, we inject the element directly into the jQuery object
  2440. this.length = 1;
  2441. this[ 0 ] = elem;
  2442. }
  2443. this.context = document;
  2444. this.selector = selector;
  2445. return this;
  2446. }
  2447. // HANDLE: $(expr, $(...))
  2448. } else if ( !context || context.jquery ) {
  2449. return ( context || root ).find( selector );
  2450. // HANDLE: $(expr, context)
  2451. // (which is just equivalent to: $(context).find(expr)
  2452. } else {
  2453. return this.constructor( context ).find( selector );
  2454. }
  2455. // HANDLE: $(DOMElement)
  2456. } else if ( selector.nodeType ) {
  2457. this.context = this[ 0 ] = selector;
  2458. this.length = 1;
  2459. return this;
  2460. // HANDLE: $(function)
  2461. // Shortcut for document ready
  2462. } else if ( jQuery.isFunction( selector ) ) {
  2463. return typeof root.ready !== "undefined" ?
  2464. root.ready( selector ) :
  2465. // Execute immediately if ready is not present
  2466. selector( jQuery );
  2467. }
  2468. if ( selector.selector !== undefined ) {
  2469. this.selector = selector.selector;
  2470. this.context = selector.context;
  2471. }
  2472. return jQuery.makeArray( selector, this );
  2473. };
  2474. // Give the init function the jQuery prototype for later instantiation
  2475. init.prototype = jQuery.fn;
  2476. // Initialize central reference
  2477. rootjQuery = jQuery( document );
  2478. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  2479. // methods guaranteed to produce a unique set when starting from a unique set
  2480. guaranteedUnique = {
  2481. children: true,
  2482. contents: true,
  2483. next: true,
  2484. prev: true
  2485. };
  2486. jQuery.fn.extend( {
  2487. has: function( target ) {
  2488. var i,
  2489. targets = jQuery( target, this ),
  2490. len = targets.length;
  2491. return this.filter( function() {
  2492. for ( i = 0; i < len; i++ ) {
  2493. if ( jQuery.contains( this, targets[ i ] ) ) {
  2494. return true;
  2495. }
  2496. }
  2497. } );
  2498. },
  2499. closest: function( selectors, context ) {
  2500. var cur,
  2501. i = 0,
  2502. l = this.length,
  2503. matched = [],
  2504. pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
  2505. jQuery( selectors, context || this.context ) :
  2506. 0;
  2507. for ( ; i < l; i++ ) {
  2508. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  2509. // Always skip document fragments
  2510. if ( cur.nodeType < 11 && ( pos ?
  2511. pos.index( cur ) > -1 :
  2512. // Don't pass non-elements to Sizzle
  2513. cur.nodeType === 1 &&
  2514. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  2515. matched.push( cur );
  2516. break;
  2517. }
  2518. }
  2519. }
  2520. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  2521. },
  2522. // Determine the position of an element within
  2523. // the matched set of elements
  2524. index: function( elem ) {
  2525. // No argument, return index in parent
  2526. if ( !elem ) {
  2527. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  2528. }
  2529. // index in selector
  2530. if ( typeof elem === "string" ) {
  2531. return jQuery.inArray( this[ 0 ], jQuery( elem ) );
  2532. }
  2533. // Locate the position of the desired element
  2534. return jQuery.inArray(
  2535. // If it receives a jQuery object, the first element is used
  2536. elem.jquery ? elem[ 0 ] : elem, this );
  2537. },
  2538. add: function( selector, context ) {
  2539. return this.pushStack(
  2540. jQuery.uniqueSort(
  2541. jQuery.merge( this.get(), jQuery( selector, context ) )
  2542. )
  2543. );
  2544. },
  2545. addBack: function( selector ) {
  2546. return this.add( selector == null ?
  2547. this.prevObject : this.prevObject.filter( selector )
  2548. );
  2549. }
  2550. } );
  2551. function sibling( cur, dir ) {
  2552. do {
  2553. cur = cur[ dir ];
  2554. } while ( cur && cur.nodeType !== 1 );
  2555. return cur;
  2556. }
  2557. jQuery.each( {
  2558. parent: function( elem ) {
  2559. var parent = elem.parentNode;
  2560. return parent && parent.nodeType !== 11 ? parent : null;
  2561. },
  2562. parents: function( elem ) {
  2563. return dir( elem, "parentNode" );
  2564. },
  2565. parentsUntil: function( elem, i, until ) {
  2566. return dir( elem, "parentNode", until );
  2567. },
  2568. next: function( elem ) {
  2569. return sibling( elem, "nextSibling" );
  2570. },
  2571. prev: function( elem ) {
  2572. return sibling( elem, "previousSibling" );
  2573. },
  2574. nextAll: function( elem ) {
  2575. return dir( elem, "nextSibling" );
  2576. },
  2577. prevAll: function( elem ) {
  2578. return dir( elem, "previousSibling" );
  2579. },
  2580. nextUntil: function( elem, i, until ) {
  2581. return dir( elem, "nextSibling", until );
  2582. },
  2583. prevUntil: function( elem, i, until ) {
  2584. return dir( elem, "previousSibling", until );
  2585. },
  2586. siblings: function( elem ) {
  2587. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  2588. },
  2589. children: function( elem ) {
  2590. return siblings( elem.firstChild );
  2591. },
  2592. contents: function( elem ) {
  2593. return jQuery.nodeName( elem, "iframe" ) ?
  2594. elem.contentDocument || elem.contentWindow.document :
  2595. jQuery.merge( [], elem.childNodes );
  2596. }
  2597. }, function( name, fn ) {
  2598. jQuery.fn[ name ] = function( until, selector ) {
  2599. var ret = jQuery.map( this, fn, until );
  2600. if ( name.slice( -5 ) !== "Until" ) {
  2601. selector = until;
  2602. }
  2603. if ( selector && typeof selector === "string" ) {
  2604. ret = jQuery.filter( selector, ret );
  2605. }
  2606. if ( this.length > 1 ) {
  2607. // Remove duplicates
  2608. if ( !guaranteedUnique[ name ] ) {
  2609. ret = jQuery.uniqueSort( ret );
  2610. }
  2611. // Reverse order for parents* and prev-derivatives
  2612. if ( rparentsprev.test( name ) ) {
  2613. ret = ret.reverse();
  2614. }
  2615. }
  2616. return this.pushStack( ret );
  2617. };
  2618. } );
  2619. var rnotwhite = ( /\S+/g );
  2620. // Convert String-formatted options into Object-formatted ones
  2621. function createOptions( options ) {
  2622. var object = {};
  2623. jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
  2624. object[ flag ] = true;
  2625. } );
  2626. return object;
  2627. }
  2628. /*
  2629. * Create a callback list using the following parameters:
  2630. *
  2631. * options: an optional list of space-separated options that will change how
  2632. * the callback list behaves or a more traditional option object
  2633. *
  2634. * By default a callback list will act like an event callback list and can be
  2635. * "fired" multiple times.
  2636. *
  2637. * Possible options:
  2638. *
  2639. * once: will ensure the callback list can only be fired once (like a Deferred)
  2640. *
  2641. * memory: will keep track of previous values and will call any callback added
  2642. * after the list has been fired right away with the latest "memorized"
  2643. * values (like a Deferred)
  2644. *
  2645. * unique: will ensure a callback can only be added once (no duplicate in the list)
  2646. *
  2647. * stopOnFalse: interrupt callings when a callback returns false
  2648. *
  2649. */
  2650. jQuery.Callbacks = function( options ) {
  2651. // Convert options from String-formatted to Object-formatted if needed
  2652. // (we check in cache first)
  2653. options = typeof options === "string" ?
  2654. createOptions( options ) :
  2655. jQuery.extend( {}, options );
  2656. var // Flag to know if list is currently firing
  2657. firing,
  2658. // Last fire value for non-forgettable lists
  2659. memory,
  2660. // Flag to know if list was already fired
  2661. fired,
  2662. // Flag to prevent firing
  2663. locked,
  2664. // Actual callback list
  2665. list = [],
  2666. // Queue of execution data for repeatable lists
  2667. queue = [],
  2668. // Index of currently firing callback (modified by add/remove as needed)
  2669. firingIndex = -1,
  2670. // Fire callbacks
  2671. fire = function() {
  2672. // Enforce single-firing
  2673. locked = options.once;
  2674. // Execute callbacks for all pending executions,
  2675. // respecting firingIndex overrides and runtime changes
  2676. fired = firing = true;
  2677. for ( ; queue.length; firingIndex = -1 ) {
  2678. memory = queue.shift();
  2679. while ( ++firingIndex < list.length ) {
  2680. // Run callback and check for early termination
  2681. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  2682. options.stopOnFalse ) {
  2683. // Jump to end and forget the data so .add doesn't re-fire
  2684. firingIndex = list.length;
  2685. memory = false;
  2686. }
  2687. }
  2688. }
  2689. // Forget the data if we're done with it
  2690. if ( !options.memory ) {
  2691. memory = false;
  2692. }
  2693. firing = false;
  2694. // Clean up if we're done firing for good
  2695. if ( locked ) {
  2696. // Keep an empty list if we have data for future add calls
  2697. if ( memory ) {
  2698. list = [];
  2699. // Otherwise, this object is spent
  2700. } else {
  2701. list = "";
  2702. }
  2703. }
  2704. },
  2705. // Actual Callbacks object
  2706. self = {
  2707. // Add a callback or a collection of callbacks to the list
  2708. add: function() {
  2709. if ( list ) {
  2710. // If we have memory from a past run, we should fire after adding
  2711. if ( memory && !firing ) {
  2712. firingIndex = list.length - 1;
  2713. queue.push( memory );
  2714. }
  2715. ( function add( args ) {
  2716. jQuery.each( args, function( _, arg ) {
  2717. if ( jQuery.isFunction( arg ) ) {
  2718. if ( !options.unique || !self.has( arg ) ) {
  2719. list.push( arg );
  2720. }
  2721. } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
  2722. // Inspect recursively
  2723. add( arg );
  2724. }
  2725. } );
  2726. } )( arguments );
  2727. if ( memory && !firing ) {
  2728. fire();
  2729. }
  2730. }
  2731. return this;
  2732. },
  2733. // Remove a callback from the list
  2734. remove: function() {
  2735. jQuery.each( arguments, function( _, arg ) {
  2736. var index;
  2737. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  2738. list.splice( index, 1 );
  2739. // Handle firing indexes
  2740. if ( index <= firingIndex ) {
  2741. firingIndex--;
  2742. }
  2743. }
  2744. } );
  2745. return this;
  2746. },
  2747. // Check if a given callback is in the list.
  2748. // If no argument is given, return whether or not list has callbacks attached.
  2749. has: function( fn ) {
  2750. return fn ?
  2751. jQuery.inArray( fn, list ) > -1 :
  2752. list.length > 0;
  2753. },
  2754. // Remove all callbacks from the list
  2755. empty: function() {
  2756. if ( list ) {
  2757. list = [];
  2758. }
  2759. return this;
  2760. },
  2761. // Disable .fire and .add
  2762. // Abort any current/pending executions
  2763. // Clear all callbacks and values
  2764. disable: function() {
  2765. locked = queue = [];
  2766. list = memory = "";
  2767. return this;
  2768. },
  2769. disabled: function() {
  2770. return !list;
  2771. },
  2772. // Disable .fire
  2773. // Also disable .add unless we have memory (since it would have no effect)
  2774. // Abort any pending executions
  2775. lock: function() {
  2776. locked = true;
  2777. if ( !memory ) {
  2778. self.disable();
  2779. }
  2780. return this;
  2781. },
  2782. locked: function() {
  2783. return !!locked;
  2784. },
  2785. // Call all callbacks with the given context and arguments
  2786. fireWith: function( context, args ) {
  2787. if ( !locked ) {
  2788. args = args || [];
  2789. args = [ context, args.slice ? args.slice() : args ];
  2790. queue.push( args );
  2791. if ( !firing ) {
  2792. fire();
  2793. }
  2794. }
  2795. return this;
  2796. },
  2797. // Call all the callbacks with the given arguments
  2798. fire: function() {
  2799. self.fireWith( this, arguments );
  2800. return this;
  2801. },
  2802. // To know if the callbacks have already been called at least once
  2803. fired: function() {
  2804. return !!fired;
  2805. }
  2806. };
  2807. return self;
  2808. };
  2809. jQuery.extend( {
  2810. Deferred: function( func ) {
  2811. var tuples = [
  2812. // action, add listener, listener list, final state
  2813. [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ],
  2814. [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ],
  2815. [ "notify", "progress", jQuery.Callbacks( "memory" ) ]
  2816. ],
  2817. state = "pending",
  2818. promise = {
  2819. state: function() {
  2820. return state;
  2821. },
  2822. always: function() {
  2823. deferred.done( arguments ).fail( arguments );
  2824. return this;
  2825. },
  2826. then: function( /* fnDone, fnFail, fnProgress */ ) {
  2827. var fns = arguments;
  2828. return jQuery.Deferred( function( newDefer ) {
  2829. jQuery.each( tuples, function( i, tuple ) {
  2830. var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
  2831. // deferred[ done | fail | progress ] for forwarding actions to newDefer
  2832. deferred[ tuple[ 1 ] ]( function() {
  2833. var returned = fn && fn.apply( this, arguments );
  2834. if ( returned && jQuery.isFunction( returned.promise ) ) {
  2835. returned.promise()
  2836. .progress( newDefer.notify )
  2837. .done( newDefer.resolve )
  2838. .fail( newDefer.reject );
  2839. } else {
  2840. newDefer[ tuple[ 0 ] + "With" ](
  2841. this === promise ? newDefer.promise() : this,
  2842. fn ? [ returned ] : arguments
  2843. );
  2844. }
  2845. } );
  2846. } );
  2847. fns = null;
  2848. } ).promise();
  2849. },
  2850. // Get a promise for this deferred
  2851. // If obj is provided, the promise aspect is added to the object
  2852. promise: function( obj ) {
  2853. return obj != null ? jQuery.extend( obj, promise ) : promise;
  2854. }
  2855. },
  2856. deferred = {};
  2857. // Keep pipe for back-compat
  2858. promise.pipe = promise.then;
  2859. // Add list-specific methods
  2860. jQuery.each( tuples, function( i, tuple ) {
  2861. var list = tuple[ 2 ],
  2862. stateString = tuple[ 3 ];
  2863. // promise[ done | fail | progress ] = list.add
  2864. promise[ tuple[ 1 ] ] = list.add;
  2865. // Handle state
  2866. if ( stateString ) {
  2867. list.add( function() {
  2868. // state = [ resolved | rejected ]
  2869. state = stateString;
  2870. // [ reject_list | resolve_list ].disable; progress_list.lock
  2871. }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
  2872. }
  2873. // deferred[ resolve | reject | notify ]
  2874. deferred[ tuple[ 0 ] ] = function() {
  2875. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments );
  2876. return this;
  2877. };
  2878. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  2879. } );
  2880. // Make the deferred a promise
  2881. promise.promise( deferred );
  2882. // Call given func if any
  2883. if ( func ) {
  2884. func.call( deferred, deferred );
  2885. }
  2886. // All done!
  2887. return deferred;
  2888. },
  2889. // Deferred helper
  2890. when: function( subordinate /* , ..., subordinateN */ ) {
  2891. var i = 0,
  2892. resolveValues = slice.call( arguments ),
  2893. length = resolveValues.length,
  2894. // the count of uncompleted subordinates
  2895. remaining = length !== 1 ||
  2896. ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
  2897. // the master Deferred.
  2898. // If resolveValues consist of only a single Deferred, just use that.
  2899. deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
  2900. // Update function for both resolve and progress values
  2901. updateFunc = function( i, contexts, values ) {
  2902. return function( value ) {
  2903. contexts[ i ] = this;
  2904. values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  2905. if ( values === progressValues ) {
  2906. deferred.notifyWith( contexts, values );
  2907. } else if ( !( --remaining ) ) {
  2908. deferred.resolveWith( contexts, values );
  2909. }
  2910. };
  2911. },
  2912. progressValues, progressContexts, resolveContexts;
  2913. // add listeners to Deferred subordinates; treat others as resolved
  2914. if ( length > 1 ) {
  2915. progressValues = new Array( length );
  2916. progressContexts = new Array( length );
  2917. resolveContexts = new Array( length );
  2918. for ( ; i < length; i++ ) {
  2919. if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
  2920. resolveValues[ i ].promise()
  2921. .progress( updateFunc( i, progressContexts, progressValues ) )
  2922. .done( updateFunc( i, resolveContexts, resolveValues ) )
  2923. .fail( deferred.reject );
  2924. } else {
  2925. --remaining;
  2926. }
  2927. }
  2928. }
  2929. // if we're not waiting on anything, resolve the master
  2930. if ( !remaining ) {
  2931. deferred.resolveWith( resolveContexts, resolveValues );
  2932. }
  2933. return deferred.promise();
  2934. }
  2935. } );
  2936. // The deferred used on DOM ready
  2937. var readyList;
  2938. jQuery.fn.ready = function( fn ) {
  2939. // Add the callback
  2940. jQuery.ready.promise().done( fn );
  2941. return this;
  2942. };
  2943. jQuery.extend( {
  2944. // Is the DOM ready to be used? Set to true once it occurs.
  2945. isReady: false,
  2946. // A counter to track how many items to wait for before
  2947. // the ready event fires. See #6781
  2948. readyWait: 1,
  2949. // Hold (or release) the ready event
  2950. holdReady: function( hold ) {
  2951. if ( hold ) {
  2952. jQuery.readyWait++;
  2953. } else {
  2954. jQuery.ready( true );
  2955. }
  2956. },
  2957. // Handle when the DOM is ready
  2958. ready: function( wait ) {
  2959. // Abort if there are pending holds or we're already ready
  2960. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  2961. return;
  2962. }
  2963. // Remember that the DOM is ready
  2964. jQuery.isReady = true;
  2965. // If a normal DOM Ready event fired, decrement, and wait if need be
  2966. if ( wait !== true && --jQuery.readyWait > 0 ) {
  2967. return;
  2968. }
  2969. // If there are functions bound, to execute
  2970. readyList.resolveWith( document, [ jQuery ] );
  2971. // Trigger any bound ready events
  2972. if ( jQuery.fn.triggerHandler ) {
  2973. jQuery( document ).triggerHandler( "ready" );
  2974. jQuery( document ).off( "ready" );
  2975. }
  2976. }
  2977. } );
  2978. /**
  2979. * Clean-up method for dom ready events
  2980. */
  2981. function detach() {
  2982. if ( document.addEventListener ) {
  2983. document.removeEventListener( "DOMContentLoaded", completed );
  2984. window.removeEventListener( "load", completed );
  2985. } else {
  2986. document.detachEvent( "onreadystatechange", completed );
  2987. window.detachEvent( "onload", completed );
  2988. }
  2989. }
  2990. /**
  2991. * The ready event handler and self cleanup method
  2992. */
  2993. function completed() {
  2994. // readyState === "complete" is good enough for us to call the dom ready in oldIE
  2995. if ( document.addEventListener ||
  2996. window.event.type === "load" ||
  2997. document.readyState === "complete" ) {
  2998. detach();
  2999. jQuery.ready();
  3000. }
  3001. }
  3002. jQuery.ready.promise = function( obj ) {
  3003. if ( !readyList ) {
  3004. readyList = jQuery.Deferred();
  3005. // Catch cases where $(document).ready() is called
  3006. // after the browser event has already occurred.
  3007. // Support: IE6-10
  3008. // Older IE sometimes signals "interactive" too soon
  3009. if ( document.readyState === "complete" ||
  3010. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  3011. // Handle it asynchronously to allow scripts the opportunity to delay ready
  3012. window.setTimeout( jQuery.ready );
  3013. // Standards-based browsers support DOMContentLoaded
  3014. } else if ( document.addEventListener ) {
  3015. // Use the handy event callback
  3016. document.addEventListener( "DOMContentLoaded", completed );
  3017. // A fallback to window.onload, that will always work
  3018. window.addEventListener( "load", completed );
  3019. // If IE event model is used
  3020. } else {
  3021. // Ensure firing before onload, maybe late but safe also for iframes
  3022. document.attachEvent( "onreadystatechange", completed );
  3023. // A fallback to window.onload, that will always work
  3024. window.attachEvent( "onload", completed );
  3025. // If IE and not a frame
  3026. // continually check to see if the document is ready
  3027. var top = false;
  3028. try {
  3029. top = window.frameElement == null && document.documentElement;
  3030. } catch ( e ) {}
  3031. if ( top && top.doScroll ) {
  3032. ( function doScrollCheck() {
  3033. if ( !jQuery.isReady ) {
  3034. try {
  3035. // Use the trick by Diego Perini
  3036. // http://javascript.nwbox.com/IEContentLoaded/
  3037. top.doScroll( "left" );
  3038. } catch ( e ) {
  3039. return window.setTimeout( doScrollCheck, 50 );
  3040. }
  3041. // detach all dom ready events
  3042. detach();
  3043. // and execute any waiting functions
  3044. jQuery.ready();
  3045. }
  3046. } )();
  3047. }
  3048. }
  3049. }
  3050. return readyList.promise( obj );
  3051. };
  3052. // Kick off the DOM ready check even if the user does not
  3053. jQuery.ready.promise();
  3054. // Support: IE<9
  3055. // Iteration over object's inherited properties before its own
  3056. var i;
  3057. for ( i in jQuery( support ) ) {
  3058. break;
  3059. }
  3060. support.ownFirst = i === "0";
  3061. // Note: most support tests are defined in their respective modules.
  3062. // false until the test is run
  3063. support.inlineBlockNeedsLayout = false;
  3064. // Execute ASAP in case we need to set body.style.zoom
  3065. jQuery( function() {
  3066. // Minified: var a,b,c,d
  3067. var val, div, body, container;
  3068. body = document.getElementsByTagName( "body" )[ 0 ];
  3069. if ( !body || !body.style ) {
  3070. // Return for frameset docs that don't have a body
  3071. return;
  3072. }
  3073. // Setup
  3074. div = document.createElement( "div" );
  3075. container = document.createElement( "div" );
  3076. container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
  3077. body.appendChild( container ).appendChild( div );
  3078. if ( typeof div.style.zoom !== "undefined" ) {
  3079. // Support: IE<8
  3080. // Check if natively block-level elements act like inline-block
  3081. // elements when setting their display to 'inline' and giving
  3082. // them layout
  3083. div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";
  3084. support.inlineBlockNeedsLayout = val = div.offsetWidth === 3;
  3085. if ( val ) {
  3086. // Prevent IE 6 from affecting layout for positioned elements #11048
  3087. // Prevent IE from shrinking the body in IE 7 mode #12869
  3088. // Support: IE<8
  3089. body.style.zoom = 1;
  3090. }
  3091. }
  3092. body.removeChild( container );
  3093. } );
  3094. ( function() {
  3095. var div = document.createElement( "div" );
  3096. // Support: IE<9
  3097. support.deleteExpando = true;
  3098. try {
  3099. delete div.test;
  3100. } catch ( e ) {
  3101. support.deleteExpando = false;
  3102. }
  3103. // Null elements to avoid leaks in IE.
  3104. div = null;
  3105. } )();
  3106. var acceptData = function( elem ) {
  3107. var noData = jQuery.noData[ ( elem.nodeName + " " ).toLowerCase() ],
  3108. nodeType = +elem.nodeType || 1;
  3109. // Do not set data on non-element DOM nodes because it will not be cleared (#8335).
  3110. return nodeType !== 1 && nodeType !== 9 ?
  3111. false :
  3112. // Nodes accept data unless otherwise specified; rejection can be conditional
  3113. !noData || noData !== true && elem.getAttribute( "classid" ) === noData;
  3114. };
  3115. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  3116. rmultiDash = /([A-Z])/g;
  3117. function dataAttr( elem, key, data ) {
  3118. // If nothing was found internally, try to fetch any
  3119. // data from the HTML5 data-* attribute
  3120. if ( data === undefined && elem.nodeType === 1 ) {
  3121. var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
  3122. data = elem.getAttribute( name );
  3123. if ( typeof data === "string" ) {
  3124. try {
  3125. data = data === "true" ? true :
  3126. data === "false" ? false :
  3127. data === "null" ? null :
  3128. // Only convert to a number if it doesn't change the string
  3129. +data + "" === data ? +data :
  3130. rbrace.test( data ) ? jQuery.parseJSON( data ) :
  3131. data;
  3132. } catch ( e ) {}
  3133. // Make sure we set the data so it isn't changed later
  3134. jQuery.data( elem, key, data );
  3135. } else {
  3136. data = undefined;
  3137. }
  3138. }
  3139. return data;
  3140. }
  3141. // checks a cache object for emptiness
  3142. function isEmptyDataObject( obj ) {
  3143. var name;
  3144. for ( name in obj ) {
  3145. // if the public data object is empty, the private is still empty
  3146. if ( name === "data" && jQuery.isEmptyObject( obj[ name ] ) ) {
  3147. continue;
  3148. }
  3149. if ( name !== "toJSON" ) {
  3150. return false;
  3151. }
  3152. }
  3153. return true;
  3154. }
  3155. function internalData( elem, name, data, pvt /* Internal Use Only */ ) {
  3156. if ( !acceptData( elem ) ) {
  3157. return;
  3158. }
  3159. var ret, thisCache,
  3160. internalKey = jQuery.expando,
  3161. // We have to handle DOM nodes and JS objects differently because IE6-7
  3162. // can't GC object references properly across the DOM-JS boundary
  3163. isNode = elem.nodeType,
  3164. // Only DOM nodes need the global jQuery cache; JS object data is
  3165. // attached directly to the object so GC can occur automatically
  3166. cache = isNode ? jQuery.cache : elem,
  3167. // Only defining an ID for JS objects if its cache already exists allows
  3168. // the code to shortcut on the same path as a DOM node with no cache
  3169. id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
  3170. // Avoid doing any more work than we need to when trying to get data on an
  3171. // object that has no data at all
  3172. if ( ( !id || !cache[ id ] || ( !pvt && !cache[ id ].data ) ) &&
  3173. data === undefined && typeof name === "string" ) {
  3174. return;
  3175. }
  3176. if ( !id ) {
  3177. // Only DOM nodes need a new unique ID for each element since their data
  3178. // ends up in the global cache
  3179. if ( isNode ) {
  3180. id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++;
  3181. } else {
  3182. id = internalKey;
  3183. }
  3184. }
  3185. if ( !cache[ id ] ) {
  3186. // Avoid exposing jQuery metadata on plain JS objects when the object
  3187. // is serialized using JSON.stringify
  3188. cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
  3189. }
  3190. // An object can be passed to jQuery.data instead of a key/value pair; this gets
  3191. // shallow copied over onto the existing cache
  3192. if ( typeof name === "object" || typeof name === "function" ) {
  3193. if ( pvt ) {
  3194. cache[ id ] = jQuery.extend( cache[ id ], name );
  3195. } else {
  3196. cache[ id ].data = jQuery.extend( cache[ id ].data, name );
  3197. }
  3198. }
  3199. thisCache = cache[ id ];
  3200. // jQuery data() is stored in a separate object inside the object's internal data
  3201. // cache in order to avoid key collisions between internal data and user-defined
  3202. // data.
  3203. if ( !pvt ) {
  3204. if ( !thisCache.data ) {
  3205. thisCache.data = {};
  3206. }
  3207. thisCache = thisCache.data;
  3208. }
  3209. if ( data !== undefined ) {
  3210. thisCache[ jQuery.camelCase( name ) ] = data;
  3211. }
  3212. // Check for both converted-to-camel and non-converted data property names
  3213. // If a data property was specified
  3214. if ( typeof name === "string" ) {
  3215. // First Try to find as-is property data
  3216. ret = thisCache[ name ];
  3217. // Test for null|undefined property data
  3218. if ( ret == null ) {
  3219. // Try to find the camelCased property
  3220. ret = thisCache[ jQuery.camelCase( name ) ];
  3221. }
  3222. } else {
  3223. ret = thisCache;
  3224. }
  3225. return ret;
  3226. }
  3227. function internalRemoveData( elem, name, pvt ) {
  3228. if ( !acceptData( elem ) ) {
  3229. return;
  3230. }
  3231. var thisCache, i,
  3232. isNode = elem.nodeType,
  3233. // See jQuery.data for more information
  3234. cache = isNode ? jQuery.cache : elem,
  3235. id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
  3236. // If there is already no cache entry for this object, there is no
  3237. // purpose in continuing
  3238. if ( !cache[ id ] ) {
  3239. return;
  3240. }
  3241. if ( name ) {
  3242. thisCache = pvt ? cache[ id ] : cache[ id ].data;
  3243. if ( thisCache ) {
  3244. // Support array or space separated string names for data keys
  3245. if ( !jQuery.isArray( name ) ) {
  3246. // try the string as a key before any manipulation
  3247. if ( name in thisCache ) {
  3248. name = [ name ];
  3249. } else {
  3250. // split the camel cased version by spaces unless a key with the spaces exists
  3251. name = jQuery.camelCase( name );
  3252. if ( name in thisCache ) {
  3253. name = [ name ];
  3254. } else {
  3255. name = name.split( " " );
  3256. }
  3257. }
  3258. } else {
  3259. // If "name" is an array of keys...
  3260. // When data is initially created, via ("key", "val") signature,
  3261. // keys will be converted to camelCase.
  3262. // Since there is no way to tell _how_ a key was added, remove
  3263. // both plain key and camelCase key. #12786
  3264. // This will only penalize the array argument path.
  3265. name = name.concat( jQuery.map( name, jQuery.camelCase ) );
  3266. }
  3267. i = name.length;
  3268. while ( i-- ) {
  3269. delete thisCache[ name[ i ] ];
  3270. }
  3271. // If there is no data left in the cache, we want to continue
  3272. // and let the cache object itself get destroyed
  3273. if ( pvt ? !isEmptyDataObject( thisCache ) : !jQuery.isEmptyObject( thisCache ) ) {
  3274. return;
  3275. }
  3276. }
  3277. }
  3278. // See jQuery.data for more information
  3279. if ( !pvt ) {
  3280. delete cache[ id ].data;
  3281. // Don't destroy the parent cache unless the internal data object
  3282. // had been the only thing left in it
  3283. if ( !isEmptyDataObject( cache[ id ] ) ) {
  3284. return;
  3285. }
  3286. }
  3287. // Destroy the cache
  3288. if ( isNode ) {
  3289. jQuery.cleanData( [ elem ], true );
  3290. // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
  3291. /* jshint eqeqeq: false */
  3292. } else if ( support.deleteExpando || cache != cache.window ) {
  3293. /* jshint eqeqeq: true */
  3294. delete cache[ id ];
  3295. // When all else fails, undefined
  3296. } else {
  3297. cache[ id ] = undefined;
  3298. }
  3299. }
  3300. jQuery.extend( {
  3301. cache: {},
  3302. // The following elements (space-suffixed to avoid Object.prototype collisions)
  3303. // throw uncatchable exceptions if you attempt to set expando properties
  3304. noData: {
  3305. "applet ": true,
  3306. "embed ": true,
  3307. // ...but Flash objects (which have this classid) *can* handle expandos
  3308. "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  3309. },
  3310. hasData: function( elem ) {
  3311. elem = elem.nodeType ? jQuery.cache[ elem[ jQuery.expando ] ] : elem[ jQuery.expando ];
  3312. return !!elem && !isEmptyDataObject( elem );
  3313. },
  3314. data: function( elem, name, data ) {
  3315. return internalData( elem, name, data );
  3316. },
  3317. removeData: function( elem, name ) {
  3318. return internalRemoveData( elem, name );
  3319. },
  3320. // For internal use only.
  3321. _data: function( elem, name, data ) {
  3322. return internalData( elem, name, data, true );
  3323. },
  3324. _removeData: function( elem, name ) {
  3325. return internalRemoveData( elem, name, true );
  3326. }
  3327. } );
  3328. jQuery.fn.extend( {
  3329. data: function( key, value ) {
  3330. var i, name, data,
  3331. elem = this[ 0 ],
  3332. attrs = elem && elem.attributes;
  3333. // Special expections of .data basically thwart jQuery.access,
  3334. // so implement the relevant behavior ourselves
  3335. // Gets all values
  3336. if ( key === undefined ) {
  3337. if ( this.length ) {
  3338. data = jQuery.data( elem );
  3339. if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
  3340. i = attrs.length;
  3341. while ( i-- ) {
  3342. // Support: IE11+
  3343. // The attrs elements can be null (#14894)
  3344. if ( attrs[ i ] ) {
  3345. name = attrs[ i ].name;
  3346. if ( name.indexOf( "data-" ) === 0 ) {
  3347. name = jQuery.camelCase( name.slice( 5 ) );
  3348. dataAttr( elem, name, data[ name ] );
  3349. }
  3350. }
  3351. }
  3352. jQuery._data( elem, "parsedAttrs", true );
  3353. }
  3354. }
  3355. return data;
  3356. }
  3357. // Sets multiple values
  3358. if ( typeof key === "object" ) {
  3359. return this.each( function() {
  3360. jQuery.data( this, key );
  3361. } );
  3362. }
  3363. return arguments.length > 1 ?
  3364. // Sets one value
  3365. this.each( function() {
  3366. jQuery.data( this, key, value );
  3367. } ) :
  3368. // Gets one value
  3369. // Try to fetch any internally stored data first
  3370. elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined;
  3371. },
  3372. removeData: function( key ) {
  3373. return this.each( function() {
  3374. jQuery.removeData( this, key );
  3375. } );
  3376. }
  3377. } );
  3378. jQuery.extend( {
  3379. queue: function( elem, type, data ) {
  3380. var queue;
  3381. if ( elem ) {
  3382. type = ( type || "fx" ) + "queue";
  3383. queue = jQuery._data( elem, type );
  3384. // Speed up dequeue by getting out quickly if this is just a lookup
  3385. if ( data ) {
  3386. if ( !queue || jQuery.isArray( data ) ) {
  3387. queue = jQuery._data( elem, type, jQuery.makeArray( data ) );
  3388. } else {
  3389. queue.push( data );
  3390. }
  3391. }
  3392. return queue || [];
  3393. }
  3394. },
  3395. dequeue: function( elem, type ) {
  3396. type = type || "fx";
  3397. var queue = jQuery.queue( elem, type ),
  3398. startLength = queue.length,
  3399. fn = queue.shift(),
  3400. hooks = jQuery._queueHooks( elem, type ),
  3401. next = function() {
  3402. jQuery.dequeue( elem, type );
  3403. };
  3404. // If the fx queue is dequeued, always remove the progress sentinel
  3405. if ( fn === "inprogress" ) {
  3406. fn = queue.shift();
  3407. startLength--;
  3408. }
  3409. if ( fn ) {
  3410. // Add a progress sentinel to prevent the fx queue from being
  3411. // automatically dequeued
  3412. if ( type === "fx" ) {
  3413. queue.unshift( "inprogress" );
  3414. }
  3415. // clear up the last queue stop function
  3416. delete hooks.stop;
  3417. fn.call( elem, next, hooks );
  3418. }
  3419. if ( !startLength && hooks ) {
  3420. hooks.empty.fire();
  3421. }
  3422. },
  3423. // not intended for public consumption - generates a queueHooks object,
  3424. // or returns the current one
  3425. _queueHooks: function( elem, type ) {
  3426. var key = type + "queueHooks";
  3427. return jQuery._data( elem, key ) || jQuery._data( elem, key, {
  3428. empty: jQuery.Callbacks( "once memory" ).add( function() {
  3429. jQuery._removeData( elem, type + "queue" );
  3430. jQuery._removeData( elem, key );
  3431. } )
  3432. } );
  3433. }
  3434. } );
  3435. jQuery.fn.extend( {
  3436. queue: function( type, data ) {
  3437. var setter = 2;
  3438. if ( typeof type !== "string" ) {
  3439. data = type;
  3440. type = "fx";
  3441. setter--;
  3442. }
  3443. if ( arguments.length < setter ) {
  3444. return jQuery.queue( this[ 0 ], type );
  3445. }
  3446. return data === undefined ?
  3447. this :
  3448. this.each( function() {
  3449. var queue = jQuery.queue( this, type, data );
  3450. // ensure a hooks for this queue
  3451. jQuery._queueHooks( this, type );
  3452. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  3453. jQuery.dequeue( this, type );
  3454. }
  3455. } );
  3456. },
  3457. dequeue: function( type ) {
  3458. return this.each( function() {
  3459. jQuery.dequeue( this, type );
  3460. } );
  3461. },
  3462. clearQueue: function( type ) {
  3463. return this.queue( type || "fx", [] );
  3464. },
  3465. // Get a promise resolved when queues of a certain type
  3466. // are emptied (fx is the type by default)
  3467. promise: function( type, obj ) {
  3468. var tmp,
  3469. count = 1,
  3470. defer = jQuery.Deferred(),
  3471. elements = this,
  3472. i = this.length,
  3473. resolve = function() {
  3474. if ( !( --count ) ) {
  3475. defer.resolveWith( elements, [ elements ] );
  3476. }
  3477. };
  3478. if ( typeof type !== "string" ) {
  3479. obj = type;
  3480. type = undefined;
  3481. }
  3482. type = type || "fx";
  3483. while ( i-- ) {
  3484. tmp = jQuery._data( elements[ i ], type + "queueHooks" );
  3485. if ( tmp && tmp.empty ) {
  3486. count++;
  3487. tmp.empty.add( resolve );
  3488. }
  3489. }
  3490. resolve();
  3491. return defer.promise( obj );
  3492. }
  3493. } );
  3494. ( function() {
  3495. var shrinkWrapBlocksVal;
  3496. support.shrinkWrapBlocks = function() {
  3497. if ( shrinkWrapBlocksVal != null ) {
  3498. return shrinkWrapBlocksVal;
  3499. }
  3500. // Will be changed later if needed.
  3501. shrinkWrapBlocksVal = false;
  3502. // Minified: var b,c,d
  3503. var div, body, container;
  3504. body = document.getElementsByTagName( "body" )[ 0 ];
  3505. if ( !body || !body.style ) {
  3506. // Test fired too early or in an unsupported environment, exit.
  3507. return;
  3508. }
  3509. // Setup
  3510. div = document.createElement( "div" );
  3511. container = document.createElement( "div" );
  3512. container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
  3513. body.appendChild( container ).appendChild( div );
  3514. // Support: IE6
  3515. // Check if elements with layout shrink-wrap their children
  3516. if ( typeof div.style.zoom !== "undefined" ) {
  3517. // Reset CSS: box-sizing; display; margin; border
  3518. div.style.cssText =
  3519. // Support: Firefox<29, Android 2.3
  3520. // Vendor-prefix box-sizing
  3521. "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
  3522. "box-sizing:content-box;display:block;margin:0;border:0;" +
  3523. "padding:1px;width:1px;zoom:1";
  3524. div.appendChild( document.createElement( "div" ) ).style.width = "5px";
  3525. shrinkWrapBlocksVal = div.offsetWidth !== 3;
  3526. }
  3527. body.removeChild( container );
  3528. return shrinkWrapBlocksVal;
  3529. };
  3530. } )();
  3531. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  3532. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  3533. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  3534. var isHidden = function( elem, el ) {
  3535. // isHidden might be called from jQuery#filter function;
  3536. // in that case, element will be second argument
  3537. elem = el || elem;
  3538. return jQuery.css( elem, "display" ) === "none" ||
  3539. !jQuery.contains( elem.ownerDocument, elem );
  3540. };
  3541. function adjustCSS( elem, prop, valueParts, tween ) {
  3542. var adjusted,
  3543. scale = 1,
  3544. maxIterations = 20,
  3545. currentValue = tween ?
  3546. function() { return tween.cur(); } :
  3547. function() { return jQuery.css( elem, prop, "" ); },
  3548. initial = currentValue(),
  3549. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  3550. // Starting value computation is required for potential unit mismatches
  3551. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  3552. rcssNum.exec( jQuery.css( elem, prop ) );
  3553. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  3554. // Trust units reported by jQuery.css
  3555. unit = unit || initialInUnit[ 3 ];
  3556. // Make sure we update the tween properties later on
  3557. valueParts = valueParts || [];
  3558. // Iteratively approximate from a nonzero starting point
  3559. initialInUnit = +initial || 1;
  3560. do {
  3561. // If previous iteration zeroed out, double until we get *something*.
  3562. // Use string for doubling so we don't accidentally see scale as unchanged below
  3563. scale = scale || ".5";
  3564. // Adjust and apply
  3565. initialInUnit = initialInUnit / scale;
  3566. jQuery.style( elem, prop, initialInUnit + unit );
  3567. // Update scale, tolerating zero or NaN from tween.cur()
  3568. // Break the loop if scale is unchanged or perfect, or if we've just had enough.
  3569. } while (
  3570. scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
  3571. );
  3572. }
  3573. if ( valueParts ) {
  3574. initialInUnit = +initialInUnit || +initial || 0;
  3575. // Apply relative offset (+=/-=) if specified
  3576. adjusted = valueParts[ 1 ] ?
  3577. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  3578. +valueParts[ 2 ];
  3579. if ( tween ) {
  3580. tween.unit = unit;
  3581. tween.start = initialInUnit;
  3582. tween.end = adjusted;
  3583. }
  3584. }
  3585. return adjusted;
  3586. }
  3587. // Multifunctional method to get and set values of a collection
  3588. // The value/s can optionally be executed if it's a function
  3589. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  3590. var i = 0,
  3591. length = elems.length,
  3592. bulk = key == null;
  3593. // Sets many values
  3594. if ( jQuery.type( key ) === "object" ) {
  3595. chainable = true;
  3596. for ( i in key ) {
  3597. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  3598. }
  3599. // Sets one value
  3600. } else if ( value !== undefined ) {
  3601. chainable = true;
  3602. if ( !jQuery.isFunction( value ) ) {
  3603. raw = true;
  3604. }
  3605. if ( bulk ) {
  3606. // Bulk operations run against the entire set
  3607. if ( raw ) {
  3608. fn.call( elems, value );
  3609. fn = null;
  3610. // ...except when executing function values
  3611. } else {
  3612. bulk = fn;
  3613. fn = function( elem, key, value ) {
  3614. return bulk.call( jQuery( elem ), value );
  3615. };
  3616. }
  3617. }
  3618. if ( fn ) {
  3619. for ( ; i < length; i++ ) {
  3620. fn(
  3621. elems[ i ],
  3622. key,
  3623. raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) )
  3624. );
  3625. }
  3626. }
  3627. }
  3628. return chainable ?
  3629. elems :
  3630. // Gets
  3631. bulk ?
  3632. fn.call( elems ) :
  3633. length ? fn( elems[ 0 ], key ) : emptyGet;
  3634. };
  3635. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  3636. var rtagName = ( /<([\w:-]+)/ );
  3637. var rscriptType = ( /^$|\/(?:java|ecma)script/i );
  3638. var rleadingWhitespace = ( /^\s+/ );
  3639. var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" +
  3640. "details|dialog|figcaption|figure|footer|header|hgroup|main|" +
  3641. "mark|meter|nav|output|picture|progress|section|summary|template|time|video";
  3642. function createSafeFragment( document ) {
  3643. var list = nodeNames.split( "|" ),
  3644. safeFrag = document.createDocumentFragment();
  3645. if ( safeFrag.createElement ) {
  3646. while ( list.length ) {
  3647. safeFrag.createElement(
  3648. list.pop()
  3649. );
  3650. }
  3651. }
  3652. return safeFrag;
  3653. }
  3654. ( function() {
  3655. var div = document.createElement( "div" ),
  3656. fragment = document.createDocumentFragment(),
  3657. input = document.createElement( "input" );
  3658. // Setup
  3659. div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
  3660. // IE strips leading whitespace when .innerHTML is used
  3661. support.leadingWhitespace = div.firstChild.nodeType === 3;
  3662. // Make sure that tbody elements aren't automatically inserted
  3663. // IE will insert them into empty tables
  3664. support.tbody = !div.getElementsByTagName( "tbody" ).length;
  3665. // Make sure that link elements get serialized correctly by innerHTML
  3666. // This requires a wrapper element in IE
  3667. support.htmlSerialize = !!div.getElementsByTagName( "link" ).length;
  3668. // Makes sure cloning an html5 element does not cause problems
  3669. // Where outerHTML is undefined, this still works
  3670. support.html5Clone =
  3671. document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>";
  3672. // Check if a disconnected checkbox will retain its checked
  3673. // value of true after appended to the DOM (IE6/7)
  3674. input.type = "checkbox";
  3675. input.checked = true;
  3676. fragment.appendChild( input );
  3677. support.appendChecked = input.checked;
  3678. // Make sure textarea (and checkbox) defaultValue is properly cloned
  3679. // Support: IE6-IE11+
  3680. div.innerHTML = "<textarea>x</textarea>";
  3681. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  3682. // #11217 - WebKit loses check when the name is after the checked attribute
  3683. fragment.appendChild( div );
  3684. // Support: Windows Web Apps (WWA)
  3685. // `name` and `type` must use .setAttribute for WWA (#14901)
  3686. input = document.createElement( "input" );
  3687. input.setAttribute( "type", "radio" );
  3688. input.setAttribute( "checked", "checked" );
  3689. input.setAttribute( "name", "t" );
  3690. div.appendChild( input );
  3691. // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
  3692. // old WebKit doesn't clone checked state correctly in fragments
  3693. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  3694. // Support: IE<9
  3695. // Cloned elements keep attachEvent handlers, we use addEventListener on IE9+
  3696. support.noCloneEvent = !!div.addEventListener;
  3697. // Support: IE<9
  3698. // Since attributes and properties are the same in IE,
  3699. // cleanData must set properties to undefined rather than use removeAttribute
  3700. div[ jQuery.expando ] = 1;
  3701. support.attributes = !div.getAttribute( jQuery.expando );
  3702. } )();
  3703. // We have to close these tags to support XHTML (#13200)
  3704. var wrapMap = {
  3705. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  3706. legend: [ 1, "<fieldset>", "</fieldset>" ],
  3707. area: [ 1, "<map>", "</map>" ],
  3708. // Support: IE8
  3709. param: [ 1, "<object>", "</object>" ],
  3710. thead: [ 1, "<table>", "</table>" ],
  3711. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  3712. col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
  3713. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  3714. // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
  3715. // unless wrapped in a div with non-breaking characters in front of it.
  3716. _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
  3717. };
  3718. // Support: IE8-IE9
  3719. wrapMap.optgroup = wrapMap.option;
  3720. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  3721. wrapMap.th = wrapMap.td;
  3722. function getAll( context, tag ) {
  3723. var elems, elem,
  3724. i = 0,
  3725. found = typeof context.getElementsByTagName !== "undefined" ?
  3726. context.getElementsByTagName( tag || "*" ) :
  3727. typeof context.querySelectorAll !== "undefined" ?
  3728. context.querySelectorAll( tag || "*" ) :
  3729. undefined;
  3730. if ( !found ) {
  3731. for ( found = [], elems = context.childNodes || context;
  3732. ( elem = elems[ i ] ) != null;
  3733. i++
  3734. ) {
  3735. if ( !tag || jQuery.nodeName( elem, tag ) ) {
  3736. found.push( elem );
  3737. } else {
  3738. jQuery.merge( found, getAll( elem, tag ) );
  3739. }
  3740. }
  3741. }
  3742. return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
  3743. jQuery.merge( [ context ], found ) :
  3744. found;
  3745. }
  3746. // Mark scripts as having already been evaluated
  3747. function setGlobalEval( elems, refElements ) {
  3748. var elem,
  3749. i = 0;
  3750. for ( ; ( elem = elems[ i ] ) != null; i++ ) {
  3751. jQuery._data(
  3752. elem,
  3753. "globalEval",
  3754. !refElements || jQuery._data( refElements[ i ], "globalEval" )
  3755. );
  3756. }
  3757. }
  3758. var rhtml = /<|&#?\w+;/,
  3759. rtbody = /<tbody/i;
  3760. function fixDefaultChecked( elem ) {
  3761. if ( rcheckableType.test( elem.type ) ) {
  3762. elem.defaultChecked = elem.checked;
  3763. }
  3764. }
  3765. function buildFragment( elems, context, scripts, selection, ignored ) {
  3766. var j, elem, contains,
  3767. tmp, tag, tbody, wrap,
  3768. l = elems.length,
  3769. // Ensure a safe fragment
  3770. safe = createSafeFragment( context ),
  3771. nodes = [],
  3772. i = 0;
  3773. for ( ; i < l; i++ ) {
  3774. elem = elems[ i ];
  3775. if ( elem || elem === 0 ) {
  3776. // Add nodes directly
  3777. if ( jQuery.type( elem ) === "object" ) {
  3778. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  3779. // Convert non-html into a text node
  3780. } else if ( !rhtml.test( elem ) ) {
  3781. nodes.push( context.createTextNode( elem ) );
  3782. // Convert html into DOM nodes
  3783. } else {
  3784. tmp = tmp || safe.appendChild( context.createElement( "div" ) );
  3785. // Deserialize a standard representation
  3786. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  3787. wrap = wrapMap[ tag ] || wrapMap._default;
  3788. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  3789. // Descend through wrappers to the right content
  3790. j = wrap[ 0 ];
  3791. while ( j-- ) {
  3792. tmp = tmp.lastChild;
  3793. }
  3794. // Manually add leading whitespace removed by IE
  3795. if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
  3796. nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[ 0 ] ) );
  3797. }
  3798. // Remove IE's autoinserted <tbody> from table fragments
  3799. if ( !support.tbody ) {
  3800. // String was a <table>, *may* have spurious <tbody>
  3801. elem = tag === "table" && !rtbody.test( elem ) ?
  3802. tmp.firstChild :
  3803. // String was a bare <thead> or <tfoot>
  3804. wrap[ 1 ] === "<table>" && !rtbody.test( elem ) ?
  3805. tmp :
  3806. 0;
  3807. j = elem && elem.childNodes.length;
  3808. while ( j-- ) {
  3809. if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) &&
  3810. !tbody.childNodes.length ) {
  3811. elem.removeChild( tbody );
  3812. }
  3813. }
  3814. }
  3815. jQuery.merge( nodes, tmp.childNodes );
  3816. // Fix #12392 for WebKit and IE > 9
  3817. tmp.textContent = "";
  3818. // Fix #12392 for oldIE
  3819. while ( tmp.firstChild ) {
  3820. tmp.removeChild( tmp.firstChild );
  3821. }
  3822. // Remember the top-level container for proper cleanup
  3823. tmp = safe.lastChild;
  3824. }
  3825. }
  3826. }
  3827. // Fix #11356: Clear elements from fragment
  3828. if ( tmp ) {
  3829. safe.removeChild( tmp );
  3830. }
  3831. // Reset defaultChecked for any radios and checkboxes
  3832. // about to be appended to the DOM in IE 6/7 (#8060)
  3833. if ( !support.appendChecked ) {
  3834. jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
  3835. }
  3836. i = 0;
  3837. while ( ( elem = nodes[ i++ ] ) ) {
  3838. // Skip elements already in the context collection (trac-4087)
  3839. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  3840. if ( ignored ) {
  3841. ignored.push( elem );
  3842. }
  3843. continue;
  3844. }
  3845. contains = jQuery.contains( elem.ownerDocument, elem );
  3846. // Append to fragment
  3847. tmp = getAll( safe.appendChild( elem ), "script" );
  3848. // Preserve script evaluation history
  3849. if ( contains ) {
  3850. setGlobalEval( tmp );
  3851. }
  3852. // Capture executables
  3853. if ( scripts ) {
  3854. j = 0;
  3855. while ( ( elem = tmp[ j++ ] ) ) {
  3856. if ( rscriptType.test( elem.type || "" ) ) {
  3857. scripts.push( elem );
  3858. }
  3859. }
  3860. }
  3861. }
  3862. tmp = null;
  3863. return safe;
  3864. }
  3865. ( function() {
  3866. var i, eventName,
  3867. div = document.createElement( "div" );
  3868. // Support: IE<9 (lack submit/change bubble), Firefox (lack focus(in | out) events)
  3869. for ( i in { submit: true, change: true, focusin: true } ) {
  3870. eventName = "on" + i;
  3871. if ( !( support[ i ] = eventName in window ) ) {
  3872. // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
  3873. div.setAttribute( eventName, "t" );
  3874. support[ i ] = div.attributes[ eventName ].expando === false;
  3875. }
  3876. }
  3877. // Null elements to avoid leaks in IE.
  3878. div = null;
  3879. } )();
  3880. var rformElems = /^(?:input|select|textarea)$/i,
  3881. rkeyEvent = /^key/,
  3882. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  3883. rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  3884. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  3885. function returnTrue() {
  3886. return true;
  3887. }
  3888. function returnFalse() {
  3889. return false;
  3890. }
  3891. // Support: IE9
  3892. // See #13393 for more info
  3893. function safeActiveElement() {
  3894. try {
  3895. return document.activeElement;
  3896. } catch ( err ) { }
  3897. }
  3898. function on( elem, types, selector, data, fn, one ) {
  3899. var origFn, type;
  3900. // Types can be a map of types/handlers
  3901. if ( typeof types === "object" ) {
  3902. // ( types-Object, selector, data )
  3903. if ( typeof selector !== "string" ) {
  3904. // ( types-Object, data )
  3905. data = data || selector;
  3906. selector = undefined;
  3907. }
  3908. for ( type in types ) {
  3909. on( elem, type, selector, data, types[ type ], one );
  3910. }
  3911. return elem;
  3912. }
  3913. if ( data == null && fn == null ) {
  3914. // ( types, fn )
  3915. fn = selector;
  3916. data = selector = undefined;
  3917. } else if ( fn == null ) {
  3918. if ( typeof selector === "string" ) {
  3919. // ( types, selector, fn )
  3920. fn = data;
  3921. data = undefined;
  3922. } else {
  3923. // ( types, data, fn )
  3924. fn = data;
  3925. data = selector;
  3926. selector = undefined;
  3927. }
  3928. }
  3929. if ( fn === false ) {
  3930. fn = returnFalse;
  3931. } else if ( !fn ) {
  3932. return elem;
  3933. }
  3934. if ( one === 1 ) {
  3935. origFn = fn;
  3936. fn = function( event ) {
  3937. // Can use an empty set, since event contains the info
  3938. jQuery().off( event );
  3939. return origFn.apply( this, arguments );
  3940. };
  3941. // Use same guid so caller can remove using origFn
  3942. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  3943. }
  3944. return elem.each( function() {
  3945. jQuery.event.add( this, types, fn, data, selector );
  3946. } );
  3947. }
  3948. /*
  3949. * Helper functions for managing events -- not part of the public interface.
  3950. * Props to Dean Edwards' addEvent library for many of the ideas.
  3951. */
  3952. jQuery.event = {
  3953. global: {},
  3954. add: function( elem, types, handler, data, selector ) {
  3955. var tmp, events, t, handleObjIn,
  3956. special, eventHandle, handleObj,
  3957. handlers, type, namespaces, origType,
  3958. elemData = jQuery._data( elem );
  3959. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  3960. if ( !elemData ) {
  3961. return;
  3962. }
  3963. // Caller can pass in an object of custom data in lieu of the handler
  3964. if ( handler.handler ) {
  3965. handleObjIn = handler;
  3966. handler = handleObjIn.handler;
  3967. selector = handleObjIn.selector;
  3968. }
  3969. // Make sure that the handler has a unique ID, used to find/remove it later
  3970. if ( !handler.guid ) {
  3971. handler.guid = jQuery.guid++;
  3972. }
  3973. // Init the element's event structure and main handler, if this is the first
  3974. if ( !( events = elemData.events ) ) {
  3975. events = elemData.events = {};
  3976. }
  3977. if ( !( eventHandle = elemData.handle ) ) {
  3978. eventHandle = elemData.handle = function( e ) {
  3979. // Discard the second event of a jQuery.event.trigger() and
  3980. // when an event is called after a page has unloaded
  3981. return typeof jQuery !== "undefined" &&
  3982. ( !e || jQuery.event.triggered !== e.type ) ?
  3983. jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
  3984. undefined;
  3985. };
  3986. // Add elem as a property of the handle fn to prevent a memory leak
  3987. // with IE non-native events
  3988. eventHandle.elem = elem;
  3989. }
  3990. // Handle multiple events separated by a space
  3991. types = ( types || "" ).match( rnotwhite ) || [ "" ];
  3992. t = types.length;
  3993. while ( t-- ) {
  3994. tmp = rtypenamespace.exec( types[ t ] ) || [];
  3995. type = origType = tmp[ 1 ];
  3996. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  3997. // There *must* be a type, no attaching namespace-only handlers
  3998. if ( !type ) {
  3999. continue;
  4000. }
  4001. // If event changes its type, use the special event handlers for the changed type
  4002. special = jQuery.event.special[ type ] || {};
  4003. // If selector defined, determine special event api type, otherwise given type
  4004. type = ( selector ? special.delegateType : special.bindType ) || type;
  4005. // Update special based on newly reset type
  4006. special = jQuery.event.special[ type ] || {};
  4007. // handleObj is passed to all event handlers
  4008. handleObj = jQuery.extend( {
  4009. type: type,
  4010. origType: origType,
  4011. data: data,
  4012. handler: handler,
  4013. guid: handler.guid,
  4014. selector: selector,
  4015. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  4016. namespace: namespaces.join( "." )
  4017. }, handleObjIn );
  4018. // Init the event handler queue if we're the first
  4019. if ( !( handlers = events[ type ] ) ) {
  4020. handlers = events[ type ] = [];
  4021. handlers.delegateCount = 0;
  4022. // Only use addEventListener/attachEvent if the special events handler returns false
  4023. if ( !special.setup ||
  4024. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  4025. // Bind the global event handler to the element
  4026. if ( elem.addEventListener ) {
  4027. elem.addEventListener( type, eventHandle, false );
  4028. } else if ( elem.attachEvent ) {
  4029. elem.attachEvent( "on" + type, eventHandle );
  4030. }
  4031. }
  4032. }
  4033. if ( special.add ) {
  4034. special.add.call( elem, handleObj );
  4035. if ( !handleObj.handler.guid ) {
  4036. handleObj.handler.guid = handler.guid;
  4037. }
  4038. }
  4039. // Add to the element's handler list, delegates in front
  4040. if ( selector ) {
  4041. handlers.splice( handlers.delegateCount++, 0, handleObj );
  4042. } else {
  4043. handlers.push( handleObj );
  4044. }
  4045. // Keep track of which events have ever been used, for event optimization
  4046. jQuery.event.global[ type ] = true;
  4047. }
  4048. // Nullify elem to prevent memory leaks in IE
  4049. elem = null;
  4050. },
  4051. // Detach an event or set of events from an element
  4052. remove: function( elem, types, handler, selector, mappedTypes ) {
  4053. var j, handleObj, tmp,
  4054. origCount, t, events,
  4055. special, handlers, type,
  4056. namespaces, origType,
  4057. elemData = jQuery.hasData( elem ) && jQuery._data( elem );
  4058. if ( !elemData || !( events = elemData.events ) ) {
  4059. return;
  4060. }
  4061. // Once for each type.namespace in types; type may be omitted
  4062. types = ( types || "" ).match( rnotwhite ) || [ "" ];
  4063. t = types.length;
  4064. while ( t-- ) {
  4065. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4066. type = origType = tmp[ 1 ];
  4067. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4068. // Unbind all events (on this namespace, if provided) for the element
  4069. if ( !type ) {
  4070. for ( type in events ) {
  4071. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  4072. }
  4073. continue;
  4074. }
  4075. special = jQuery.event.special[ type ] || {};
  4076. type = ( selector ? special.delegateType : special.bindType ) || type;
  4077. handlers = events[ type ] || [];
  4078. tmp = tmp[ 2 ] &&
  4079. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  4080. // Remove matching events
  4081. origCount = j = handlers.length;
  4082. while ( j-- ) {
  4083. handleObj = handlers[ j ];
  4084. if ( ( mappedTypes || origType === handleObj.origType ) &&
  4085. ( !handler || handler.guid === handleObj.guid ) &&
  4086. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  4087. ( !selector || selector === handleObj.selector ||
  4088. selector === "**" && handleObj.selector ) ) {
  4089. handlers.splice( j, 1 );
  4090. if ( handleObj.selector ) {
  4091. handlers.delegateCount--;
  4092. }
  4093. if ( special.remove ) {
  4094. special.remove.call( elem, handleObj );
  4095. }
  4096. }
  4097. }
  4098. // Remove generic event handler if we removed something and no more handlers exist
  4099. // (avoids potential for endless recursion during removal of special event handlers)
  4100. if ( origCount && !handlers.length ) {
  4101. if ( !special.teardown ||
  4102. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  4103. jQuery.removeEvent( elem, type, elemData.handle );
  4104. }
  4105. delete events[ type ];
  4106. }
  4107. }
  4108. // Remove the expando if it's no longer used
  4109. if ( jQuery.isEmptyObject( events ) ) {
  4110. delete elemData.handle;
  4111. // removeData also checks for emptiness and clears the expando if empty
  4112. // so use it instead of delete
  4113. jQuery._removeData( elem, "events" );
  4114. }
  4115. },
  4116. trigger: function( event, data, elem, onlyHandlers ) {
  4117. var handle, ontype, cur,
  4118. bubbleType, special, tmp, i,
  4119. eventPath = [ elem || document ],
  4120. type = hasOwn.call( event, "type" ) ? event.type : event,
  4121. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  4122. cur = tmp = elem = elem || document;
  4123. // Don't do events on text and comment nodes
  4124. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  4125. return;
  4126. }
  4127. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  4128. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  4129. return;
  4130. }
  4131. if ( type.indexOf( "." ) > -1 ) {
  4132. // Namespaced trigger; create a regexp to match event type in handle()
  4133. namespaces = type.split( "." );
  4134. type = namespaces.shift();
  4135. namespaces.sort();
  4136. }
  4137. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  4138. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  4139. event = event[ jQuery.expando ] ?
  4140. event :
  4141. new jQuery.Event( type, typeof event === "object" && event );
  4142. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  4143. event.isTrigger = onlyHandlers ? 2 : 3;
  4144. event.namespace = namespaces.join( "." );
  4145. event.rnamespace = event.namespace ?
  4146. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  4147. null;
  4148. // Clean up the event in case it is being reused
  4149. event.result = undefined;
  4150. if ( !event.target ) {
  4151. event.target = elem;
  4152. }
  4153. // Clone any incoming data and prepend the event, creating the handler arg list
  4154. data = data == null ?
  4155. [ event ] :
  4156. jQuery.makeArray( data, [ event ] );
  4157. // Allow special events to draw outside the lines
  4158. special = jQuery.event.special[ type ] || {};
  4159. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  4160. return;
  4161. }
  4162. // Determine event propagation path in advance, per W3C events spec (#9951)
  4163. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  4164. if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
  4165. bubbleType = special.delegateType || type;
  4166. if ( !rfocusMorph.test( bubbleType + type ) ) {
  4167. cur = cur.parentNode;
  4168. }
  4169. for ( ; cur; cur = cur.parentNode ) {
  4170. eventPath.push( cur );
  4171. tmp = cur;
  4172. }
  4173. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  4174. if ( tmp === ( elem.ownerDocument || document ) ) {
  4175. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  4176. }
  4177. }
  4178. // Fire handlers on the event path
  4179. i = 0;
  4180. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  4181. event.type = i > 1 ?
  4182. bubbleType :
  4183. special.bindType || type;
  4184. // jQuery handler
  4185. handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] &&
  4186. jQuery._data( cur, "handle" );
  4187. if ( handle ) {
  4188. handle.apply( cur, data );
  4189. }
  4190. // Native handler
  4191. handle = ontype && cur[ ontype ];
  4192. if ( handle && handle.apply && acceptData( cur ) ) {
  4193. event.result = handle.apply( cur, data );
  4194. if ( event.result === false ) {
  4195. event.preventDefault();
  4196. }
  4197. }
  4198. }
  4199. event.type = type;
  4200. // If nobody prevented the default action, do it now
  4201. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  4202. if (
  4203. ( !special._default ||
  4204. special._default.apply( eventPath.pop(), data ) === false
  4205. ) && acceptData( elem )
  4206. ) {
  4207. // Call a native DOM method on the target with the same name name as the event.
  4208. // Can't use an .isFunction() check here because IE6/7 fails that test.
  4209. // Don't do default actions on window, that's where global variables be (#6170)
  4210. if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
  4211. // Don't re-trigger an onFOO event when we call its FOO() method
  4212. tmp = elem[ ontype ];
  4213. if ( tmp ) {
  4214. elem[ ontype ] = null;
  4215. }
  4216. // Prevent re-triggering of the same event, since we already bubbled it above
  4217. jQuery.event.triggered = type;
  4218. try {
  4219. elem[ type ]();
  4220. } catch ( e ) {
  4221. // IE<9 dies on focus/blur to hidden element (#1486,#12518)
  4222. // only reproducible on winXP IE8 native, not IE9 in IE8 mode
  4223. }
  4224. jQuery.event.triggered = undefined;
  4225. if ( tmp ) {
  4226. elem[ ontype ] = tmp;
  4227. }
  4228. }
  4229. }
  4230. }
  4231. return event.result;
  4232. },
  4233. dispatch: function( event ) {
  4234. // Make a writable jQuery.Event from the native event object
  4235. event = jQuery.event.fix( event );
  4236. var i, j, ret, matched, handleObj,
  4237. handlerQueue = [],
  4238. args = slice.call( arguments ),
  4239. handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
  4240. special = jQuery.event.special[ event.type ] || {};
  4241. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  4242. args[ 0 ] = event;
  4243. event.delegateTarget = this;
  4244. // Call the preDispatch hook for the mapped type, and let it bail if desired
  4245. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  4246. return;
  4247. }
  4248. // Determine handlers
  4249. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  4250. // Run delegates first; they may want to stop propagation beneath us
  4251. i = 0;
  4252. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  4253. event.currentTarget = matched.elem;
  4254. j = 0;
  4255. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  4256. !event.isImmediatePropagationStopped() ) {
  4257. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  4258. // a subset or equal to those in the bound event (both can have no namespace).
  4259. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  4260. event.handleObj = handleObj;
  4261. event.data = handleObj.data;
  4262. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  4263. handleObj.handler ).apply( matched.elem, args );
  4264. if ( ret !== undefined ) {
  4265. if ( ( event.result = ret ) === false ) {
  4266. event.preventDefault();
  4267. event.stopPropagation();
  4268. }
  4269. }
  4270. }
  4271. }
  4272. }
  4273. // Call the postDispatch hook for the mapped type
  4274. if ( special.postDispatch ) {
  4275. special.postDispatch.call( this, event );
  4276. }
  4277. return event.result;
  4278. },
  4279. handlers: function( event, handlers ) {
  4280. var i, matches, sel, handleObj,
  4281. handlerQueue = [],
  4282. delegateCount = handlers.delegateCount,
  4283. cur = event.target;
  4284. // Support (at least): Chrome, IE9
  4285. // Find delegate handlers
  4286. // Black-hole SVG <use> instance trees (#13180)
  4287. //
  4288. // Support: Firefox<=42+
  4289. // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343)
  4290. if ( delegateCount && cur.nodeType &&
  4291. ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) {
  4292. /* jshint eqeqeq: false */
  4293. for ( ; cur != this; cur = cur.parentNode || this ) {
  4294. /* jshint eqeqeq: true */
  4295. // Don't check non-elements (#13208)
  4296. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  4297. if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) {
  4298. matches = [];
  4299. for ( i = 0; i < delegateCount; i++ ) {
  4300. handleObj = handlers[ i ];
  4301. // Don't conflict with Object.prototype properties (#13203)
  4302. sel = handleObj.selector + " ";
  4303. if ( matches[ sel ] === undefined ) {
  4304. matches[ sel ] = handleObj.needsContext ?
  4305. jQuery( sel, this ).index( cur ) > -1 :
  4306. jQuery.find( sel, this, null, [ cur ] ).length;
  4307. }
  4308. if ( matches[ sel ] ) {
  4309. matches.push( handleObj );
  4310. }
  4311. }
  4312. if ( matches.length ) {
  4313. handlerQueue.push( { elem: cur, handlers: matches } );
  4314. }
  4315. }
  4316. }
  4317. }
  4318. // Add the remaining (directly-bound) handlers
  4319. if ( delegateCount < handlers.length ) {
  4320. handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } );
  4321. }
  4322. return handlerQueue;
  4323. },
  4324. fix: function( event ) {
  4325. if ( event[ jQuery.expando ] ) {
  4326. return event;
  4327. }
  4328. // Create a writable copy of the event object and normalize some properties
  4329. var i, prop, copy,
  4330. type = event.type,
  4331. originalEvent = event,
  4332. fixHook = this.fixHooks[ type ];
  4333. if ( !fixHook ) {
  4334. this.fixHooks[ type ] = fixHook =
  4335. rmouseEvent.test( type ) ? this.mouseHooks :
  4336. rkeyEvent.test( type ) ? this.keyHooks :
  4337. {};
  4338. }
  4339. copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
  4340. event = new jQuery.Event( originalEvent );
  4341. i = copy.length;
  4342. while ( i-- ) {
  4343. prop = copy[ i ];
  4344. event[ prop ] = originalEvent[ prop ];
  4345. }
  4346. // Support: IE<9
  4347. // Fix target property (#1925)
  4348. if ( !event.target ) {
  4349. event.target = originalEvent.srcElement || document;
  4350. }
  4351. // Support: Safari 6-8+
  4352. // Target should not be a text node (#504, #13143)
  4353. if ( event.target.nodeType === 3 ) {
  4354. event.target = event.target.parentNode;
  4355. }
  4356. // Support: IE<9
  4357. // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
  4358. event.metaKey = !!event.metaKey;
  4359. return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
  4360. },
  4361. // Includes some event props shared by KeyEvent and MouseEvent
  4362. props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " +
  4363. "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ),
  4364. fixHooks: {},
  4365. keyHooks: {
  4366. props: "char charCode key keyCode".split( " " ),
  4367. filter: function( event, original ) {
  4368. // Add which for key events
  4369. if ( event.which == null ) {
  4370. event.which = original.charCode != null ? original.charCode : original.keyCode;
  4371. }
  4372. return event;
  4373. }
  4374. },
  4375. mouseHooks: {
  4376. props: ( "button buttons clientX clientY fromElement offsetX offsetY " +
  4377. "pageX pageY screenX screenY toElement" ).split( " " ),
  4378. filter: function( event, original ) {
  4379. var body, eventDoc, doc,
  4380. button = original.button,
  4381. fromElement = original.fromElement;
  4382. // Calculate pageX/Y if missing and clientX/Y available
  4383. if ( event.pageX == null && original.clientX != null ) {
  4384. eventDoc = event.target.ownerDocument || document;
  4385. doc = eventDoc.documentElement;
  4386. body = eventDoc.body;
  4387. event.pageX = original.clientX +
  4388. ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) -
  4389. ( doc && doc.clientLeft || body && body.clientLeft || 0 );
  4390. event.pageY = original.clientY +
  4391. ( doc && doc.scrollTop || body && body.scrollTop || 0 ) -
  4392. ( doc && doc.clientTop || body && body.clientTop || 0 );
  4393. }
  4394. // Add relatedTarget, if necessary
  4395. if ( !event.relatedTarget && fromElement ) {
  4396. event.relatedTarget = fromElement === event.target ?
  4397. original.toElement :
  4398. fromElement;
  4399. }
  4400. // Add which for click: 1 === left; 2 === middle; 3 === right
  4401. // Note: button is not normalized, so don't use it
  4402. if ( !event.which && button !== undefined ) {
  4403. event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
  4404. }
  4405. return event;
  4406. }
  4407. },
  4408. special: {
  4409. load: {
  4410. // Prevent triggered image.load events from bubbling to window.load
  4411. noBubble: true
  4412. },
  4413. focus: {
  4414. // Fire native event if possible so blur/focus sequence is correct
  4415. trigger: function() {
  4416. if ( this !== safeActiveElement() && this.focus ) {
  4417. try {
  4418. this.focus();
  4419. return false;
  4420. } catch ( e ) {
  4421. // Support: IE<9
  4422. // If we error on focus to hidden element (#1486, #12518),
  4423. // let .trigger() run the handlers
  4424. }
  4425. }
  4426. },
  4427. delegateType: "focusin"
  4428. },
  4429. blur: {
  4430. trigger: function() {
  4431. if ( this === safeActiveElement() && this.blur ) {
  4432. this.blur();
  4433. return false;
  4434. }
  4435. },
  4436. delegateType: "focusout"
  4437. },
  4438. click: {
  4439. // For checkbox, fire native event so checked state will be right
  4440. trigger: function() {
  4441. if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
  4442. this.click();
  4443. return false;
  4444. }
  4445. },
  4446. // For cross-browser consistency, don't fire native .click() on links
  4447. _default: function( event ) {
  4448. return jQuery.nodeName( event.target, "a" );
  4449. }
  4450. },
  4451. beforeunload: {
  4452. postDispatch: function( event ) {
  4453. // Support: Firefox 20+
  4454. // Firefox doesn't alert if the returnValue field is not set.
  4455. if ( event.result !== undefined && event.originalEvent ) {
  4456. event.originalEvent.returnValue = event.result;
  4457. }
  4458. }
  4459. }
  4460. },
  4461. // Piggyback on a donor event to simulate a different one
  4462. simulate: function( type, elem, event ) {
  4463. var e = jQuery.extend(
  4464. new jQuery.Event(),
  4465. event,
  4466. {
  4467. type: type,
  4468. isSimulated: true
  4469. // Previously, `originalEvent: {}` was set here, so stopPropagation call
  4470. // would not be triggered on donor event, since in our own
  4471. // jQuery.event.stopPropagation function we had a check for existence of
  4472. // originalEvent.stopPropagation method, so, consequently it would be a noop.
  4473. //
  4474. // Guard for simulated events was moved to jQuery.event.stopPropagation function
  4475. // since `originalEvent` should point to the original event for the
  4476. // constancy with other events and for more focused logic
  4477. }
  4478. );
  4479. jQuery.event.trigger( e, null, elem );
  4480. if ( e.isDefaultPrevented() ) {
  4481. event.preventDefault();
  4482. }
  4483. }
  4484. };
  4485. jQuery.removeEvent = document.removeEventListener ?
  4486. function( elem, type, handle ) {
  4487. // This "if" is needed for plain objects
  4488. if ( elem.removeEventListener ) {
  4489. elem.removeEventListener( type, handle );
  4490. }
  4491. } :
  4492. function( elem, type, handle ) {
  4493. var name = "on" + type;
  4494. if ( elem.detachEvent ) {
  4495. // #8545, #7054, preventing memory leaks for custom events in IE6-8
  4496. // detachEvent needed property on element, by name of that event,
  4497. // to properly expose it to GC
  4498. if ( typeof elem[ name ] === "undefined" ) {
  4499. elem[ name ] = null;
  4500. }
  4501. elem.detachEvent( name, handle );
  4502. }
  4503. };
  4504. jQuery.Event = function( src, props ) {
  4505. // Allow instantiation without the 'new' keyword
  4506. if ( !( this instanceof jQuery.Event ) ) {
  4507. return new jQuery.Event( src, props );
  4508. }
  4509. // Event object
  4510. if ( src && src.type ) {
  4511. this.originalEvent = src;
  4512. this.type = src.type;
  4513. // Events bubbling up the document may have been marked as prevented
  4514. // by a handler lower down the tree; reflect the correct value.
  4515. this.isDefaultPrevented = src.defaultPrevented ||
  4516. src.defaultPrevented === undefined &&
  4517. // Support: IE < 9, Android < 4.0
  4518. src.returnValue === false ?
  4519. returnTrue :
  4520. returnFalse;
  4521. // Event type
  4522. } else {
  4523. this.type = src;
  4524. }
  4525. // Put explicitly provided properties onto the event object
  4526. if ( props ) {
  4527. jQuery.extend( this, props );
  4528. }
  4529. // Create a timestamp if incoming event doesn't have one
  4530. this.timeStamp = src && src.timeStamp || jQuery.now();
  4531. // Mark it as fixed
  4532. this[ jQuery.expando ] = true;
  4533. };
  4534. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  4535. // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  4536. jQuery.Event.prototype = {
  4537. constructor: jQuery.Event,
  4538. isDefaultPrevented: returnFalse,
  4539. isPropagationStopped: returnFalse,
  4540. isImmediatePropagationStopped: returnFalse,
  4541. preventDefault: function() {
  4542. var e = this.originalEvent;
  4543. this.isDefaultPrevented = returnTrue;
  4544. if ( !e ) {
  4545. return;
  4546. }
  4547. // If preventDefault exists, run it on the original event
  4548. if ( e.preventDefault ) {
  4549. e.preventDefault();
  4550. // Support: IE
  4551. // Otherwise set the returnValue property of the original event to false
  4552. } else {
  4553. e.returnValue = false;
  4554. }
  4555. },
  4556. stopPropagation: function() {
  4557. var e = this.originalEvent;
  4558. this.isPropagationStopped = returnTrue;
  4559. if ( !e || this.isSimulated ) {
  4560. return;
  4561. }
  4562. // If stopPropagation exists, run it on the original event
  4563. if ( e.stopPropagation ) {
  4564. e.stopPropagation();
  4565. }
  4566. // Support: IE
  4567. // Set the cancelBubble property of the original event to true
  4568. e.cancelBubble = true;
  4569. },
  4570. stopImmediatePropagation: function() {
  4571. var e = this.originalEvent;
  4572. this.isImmediatePropagationStopped = returnTrue;
  4573. if ( e && e.stopImmediatePropagation ) {
  4574. e.stopImmediatePropagation();
  4575. }
  4576. this.stopPropagation();
  4577. }
  4578. };
  4579. // Create mouseenter/leave events using mouseover/out and event-time checks
  4580. // so that event delegation works in jQuery.
  4581. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  4582. //
  4583. // Support: Safari 7 only
  4584. // Safari sends mouseenter too often; see:
  4585. // https://code.google.com/p/chromium/issues/detail?id=470258
  4586. // for the description of the bug (it existed in older Chrome versions as well).
  4587. jQuery.each( {
  4588. mouseenter: "mouseover",
  4589. mouseleave: "mouseout",
  4590. pointerenter: "pointerover",
  4591. pointerleave: "pointerout"
  4592. }, function( orig, fix ) {
  4593. jQuery.event.special[ orig ] = {
  4594. delegateType: fix,
  4595. bindType: fix,
  4596. handle: function( event ) {
  4597. var ret,
  4598. target = this,
  4599. related = event.relatedTarget,
  4600. handleObj = event.handleObj;
  4601. // For mouseenter/leave call the handler if related is outside the target.
  4602. // NB: No relatedTarget if the mouse left/entered the browser window
  4603. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  4604. event.type = handleObj.origType;
  4605. ret = handleObj.handler.apply( this, arguments );
  4606. event.type = fix;
  4607. }
  4608. return ret;
  4609. }
  4610. };
  4611. } );
  4612. // IE submit delegation
  4613. if ( !support.submit ) {
  4614. jQuery.event.special.submit = {
  4615. setup: function() {
  4616. // Only need this for delegated form submit events
  4617. if ( jQuery.nodeName( this, "form" ) ) {
  4618. return false;
  4619. }
  4620. // Lazy-add a submit handler when a descendant form may potentially be submitted
  4621. jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
  4622. // Node name check avoids a VML-related crash in IE (#9807)
  4623. var elem = e.target,
  4624. form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ?
  4625. // Support: IE <=8
  4626. // We use jQuery.prop instead of elem.form
  4627. // to allow fixing the IE8 delegated submit issue (gh-2332)
  4628. // by 3rd party polyfills/workarounds.
  4629. jQuery.prop( elem, "form" ) :
  4630. undefined;
  4631. if ( form && !jQuery._data( form, "submit" ) ) {
  4632. jQuery.event.add( form, "submit._submit", function( event ) {
  4633. event._submitBubble = true;
  4634. } );
  4635. jQuery._data( form, "submit", true );
  4636. }
  4637. } );
  4638. // return undefined since we don't need an event listener
  4639. },
  4640. postDispatch: function( event ) {
  4641. // If form was submitted by the user, bubble the event up the tree
  4642. if ( event._submitBubble ) {
  4643. delete event._submitBubble;
  4644. if ( this.parentNode && !event.isTrigger ) {
  4645. jQuery.event.simulate( "submit", this.parentNode, event );
  4646. }
  4647. }
  4648. },
  4649. teardown: function() {
  4650. // Only need this for delegated form submit events
  4651. if ( jQuery.nodeName( this, "form" ) ) {
  4652. return false;
  4653. }
  4654. // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
  4655. jQuery.event.remove( this, "._submit" );
  4656. }
  4657. };
  4658. }
  4659. // IE change delegation and checkbox/radio fix
  4660. if ( !support.change ) {
  4661. jQuery.event.special.change = {
  4662. setup: function() {
  4663. if ( rformElems.test( this.nodeName ) ) {
  4664. // IE doesn't fire change on a check/radio until blur; trigger it on click
  4665. // after a propertychange. Eat the blur-change in special.change.handle.
  4666. // This still fires onchange a second time for check/radio after blur.
  4667. if ( this.type === "checkbox" || this.type === "radio" ) {
  4668. jQuery.event.add( this, "propertychange._change", function( event ) {
  4669. if ( event.originalEvent.propertyName === "checked" ) {
  4670. this._justChanged = true;
  4671. }
  4672. } );
  4673. jQuery.event.add( this, "click._change", function( event ) {
  4674. if ( this._justChanged && !event.isTrigger ) {
  4675. this._justChanged = false;
  4676. }
  4677. // Allow triggered, simulated change events (#11500)
  4678. jQuery.event.simulate( "change", this, event );
  4679. } );
  4680. }
  4681. return false;
  4682. }
  4683. // Delegated event; lazy-add a change handler on descendant inputs
  4684. jQuery.event.add( this, "beforeactivate._change", function( e ) {
  4685. var elem = e.target;
  4686. if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "change" ) ) {
  4687. jQuery.event.add( elem, "change._change", function( event ) {
  4688. if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
  4689. jQuery.event.simulate( "change", this.parentNode, event );
  4690. }
  4691. } );
  4692. jQuery._data( elem, "change", true );
  4693. }
  4694. } );
  4695. },
  4696. handle: function( event ) {
  4697. var elem = event.target;
  4698. // Swallow native change events from checkbox/radio, we already triggered them above
  4699. if ( this !== elem || event.isSimulated || event.isTrigger ||
  4700. ( elem.type !== "radio" && elem.type !== "checkbox" ) ) {
  4701. return event.handleObj.handler.apply( this, arguments );
  4702. }
  4703. },
  4704. teardown: function() {
  4705. jQuery.event.remove( this, "._change" );
  4706. return !rformElems.test( this.nodeName );
  4707. }
  4708. };
  4709. }
  4710. // Support: Firefox
  4711. // Firefox doesn't have focus(in | out) events
  4712. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  4713. //
  4714. // Support: Chrome, Safari
  4715. // focus(in | out) events fire after focus & blur events,
  4716. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  4717. // Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857
  4718. if ( !support.focusin ) {
  4719. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  4720. // Attach a single capturing handler on the document while someone wants focusin/focusout
  4721. var handler = function( event ) {
  4722. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  4723. };
  4724. jQuery.event.special[ fix ] = {
  4725. setup: function() {
  4726. var doc = this.ownerDocument || this,
  4727. attaches = jQuery._data( doc, fix );
  4728. if ( !attaches ) {
  4729. doc.addEventListener( orig, handler, true );
  4730. }
  4731. jQuery._data( doc, fix, ( attaches || 0 ) + 1 );
  4732. },
  4733. teardown: function() {
  4734. var doc = this.ownerDocument || this,
  4735. attaches = jQuery._data( doc, fix ) - 1;
  4736. if ( !attaches ) {
  4737. doc.removeEventListener( orig, handler, true );
  4738. jQuery._removeData( doc, fix );
  4739. } else {
  4740. jQuery._data( doc, fix, attaches );
  4741. }
  4742. }
  4743. };
  4744. } );
  4745. }
  4746. jQuery.fn.extend( {
  4747. on: function( types, selector, data, fn ) {
  4748. return on( this, types, selector, data, fn );
  4749. },
  4750. one: function( types, selector, data, fn ) {
  4751. return on( this, types, selector, data, fn, 1 );
  4752. },
  4753. off: function( types, selector, fn ) {
  4754. var handleObj, type;
  4755. if ( types && types.preventDefault && types.handleObj ) {
  4756. // ( event ) dispatched jQuery.Event
  4757. handleObj = types.handleObj;
  4758. jQuery( types.delegateTarget ).off(
  4759. handleObj.namespace ?
  4760. handleObj.origType + "." + handleObj.namespace :
  4761. handleObj.origType,
  4762. handleObj.selector,
  4763. handleObj.handler
  4764. );
  4765. return this;
  4766. }
  4767. if ( typeof types === "object" ) {
  4768. // ( types-object [, selector] )
  4769. for ( type in types ) {
  4770. this.off( type, selector, types[ type ] );
  4771. }
  4772. return this;
  4773. }
  4774. if ( selector === false || typeof selector === "function" ) {
  4775. // ( types [, fn] )
  4776. fn = selector;
  4777. selector = undefined;
  4778. }
  4779. if ( fn === false ) {
  4780. fn = returnFalse;
  4781. }
  4782. return this.each( function() {
  4783. jQuery.event.remove( this, types, fn, selector );
  4784. } );
  4785. },
  4786. trigger: function( type, data ) {
  4787. return this.each( function() {
  4788. jQuery.event.trigger( type, data, this );
  4789. } );
  4790. },
  4791. triggerHandler: function( type, data ) {
  4792. var elem = this[ 0 ];
  4793. if ( elem ) {
  4794. return jQuery.event.trigger( type, data, elem, true );
  4795. }
  4796. }
  4797. } );
  4798. var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
  4799. rnoshimcache = new RegExp( "<(?:" + nodeNames + ")[\\s/>]", "i" ),
  4800. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,
  4801. // Support: IE 10-11, Edge 10240+
  4802. // In IE/Edge using regex groups here causes severe slowdowns.
  4803. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  4804. rnoInnerhtml = /<script|<style|<link/i,
  4805. // checked="checked" or checked
  4806. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  4807. rscriptTypeMasked = /^true\/(.*)/,
  4808. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
  4809. safeFragment = createSafeFragment( document ),
  4810. fragmentDiv = safeFragment.appendChild( document.createElement( "div" ) );
  4811. // Support: IE<8
  4812. // Manipulating tables requires a tbody
  4813. function manipulationTarget( elem, content ) {
  4814. return jQuery.nodeName( elem, "table" ) &&
  4815. jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
  4816. elem.getElementsByTagName( "tbody" )[ 0 ] ||
  4817. elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) :
  4818. elem;
  4819. }
  4820. // Replace/restore the type attribute of script elements for safe DOM manipulation
  4821. function disableScript( elem ) {
  4822. elem.type = ( jQuery.find.attr( elem, "type" ) !== null ) + "/" + elem.type;
  4823. return elem;
  4824. }
  4825. function restoreScript( elem ) {
  4826. var match = rscriptTypeMasked.exec( elem.type );
  4827. if ( match ) {
  4828. elem.type = match[ 1 ];
  4829. } else {
  4830. elem.removeAttribute( "type" );
  4831. }
  4832. return elem;
  4833. }
  4834. function cloneCopyEvent( src, dest ) {
  4835. if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
  4836. return;
  4837. }
  4838. var type, i, l,
  4839. oldData = jQuery._data( src ),
  4840. curData = jQuery._data( dest, oldData ),
  4841. events = oldData.events;
  4842. if ( events ) {
  4843. delete curData.handle;
  4844. curData.events = {};
  4845. for ( type in events ) {
  4846. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  4847. jQuery.event.add( dest, type, events[ type ][ i ] );
  4848. }
  4849. }
  4850. }
  4851. // make the cloned public data object a copy from the original
  4852. if ( curData.data ) {
  4853. curData.data = jQuery.extend( {}, curData.data );
  4854. }
  4855. }
  4856. function fixCloneNodeIssues( src, dest ) {
  4857. var nodeName, e, data;
  4858. // We do not need to do anything for non-Elements
  4859. if ( dest.nodeType !== 1 ) {
  4860. return;
  4861. }
  4862. nodeName = dest.nodeName.toLowerCase();
  4863. // IE6-8 copies events bound via attachEvent when using cloneNode.
  4864. if ( !support.noCloneEvent && dest[ jQuery.expando ] ) {
  4865. data = jQuery._data( dest );
  4866. for ( e in data.events ) {
  4867. jQuery.removeEvent( dest, e, data.handle );
  4868. }
  4869. // Event data gets referenced instead of copied if the expando gets copied too
  4870. dest.removeAttribute( jQuery.expando );
  4871. }
  4872. // IE blanks contents when cloning scripts, and tries to evaluate newly-set text
  4873. if ( nodeName === "script" && dest.text !== src.text ) {
  4874. disableScript( dest ).text = src.text;
  4875. restoreScript( dest );
  4876. // IE6-10 improperly clones children of object elements using classid.
  4877. // IE10 throws NoModificationAllowedError if parent is null, #12132.
  4878. } else if ( nodeName === "object" ) {
  4879. if ( dest.parentNode ) {
  4880. dest.outerHTML = src.outerHTML;
  4881. }
  4882. // This path appears unavoidable for IE9. When cloning an object
  4883. // element in IE9, the outerHTML strategy above is not sufficient.
  4884. // If the src has innerHTML and the destination does not,
  4885. // copy the src.innerHTML into the dest.innerHTML. #10324
  4886. if ( support.html5Clone && ( src.innerHTML && !jQuery.trim( dest.innerHTML ) ) ) {
  4887. dest.innerHTML = src.innerHTML;
  4888. }
  4889. } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  4890. // IE6-8 fails to persist the checked state of a cloned checkbox
  4891. // or radio button. Worse, IE6-7 fail to give the cloned element
  4892. // a checked appearance if the defaultChecked value isn't also set
  4893. dest.defaultChecked = dest.checked = src.checked;
  4894. // IE6-7 get confused and end up setting the value of a cloned
  4895. // checkbox/radio button to an empty string instead of "on"
  4896. if ( dest.value !== src.value ) {
  4897. dest.value = src.value;
  4898. }
  4899. // IE6-8 fails to return the selected option to the default selected
  4900. // state when cloning options
  4901. } else if ( nodeName === "option" ) {
  4902. dest.defaultSelected = dest.selected = src.defaultSelected;
  4903. // IE6-8 fails to set the defaultValue to the correct value when
  4904. // cloning other types of input fields
  4905. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  4906. dest.defaultValue = src.defaultValue;
  4907. }
  4908. }
  4909. function domManip( collection, args, callback, ignored ) {
  4910. // Flatten any nested arrays
  4911. args = concat.apply( [], args );
  4912. var first, node, hasScripts,
  4913. scripts, doc, fragment,
  4914. i = 0,
  4915. l = collection.length,
  4916. iNoClone = l - 1,
  4917. value = args[ 0 ],
  4918. isFunction = jQuery.isFunction( value );
  4919. // We can't cloneNode fragments that contain checked, in WebKit
  4920. if ( isFunction ||
  4921. ( l > 1 && typeof value === "string" &&
  4922. !support.checkClone && rchecked.test( value ) ) ) {
  4923. return collection.each( function( index ) {
  4924. var self = collection.eq( index );
  4925. if ( isFunction ) {
  4926. args[ 0 ] = value.call( this, index, self.html() );
  4927. }
  4928. domManip( self, args, callback, ignored );
  4929. } );
  4930. }
  4931. if ( l ) {
  4932. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  4933. first = fragment.firstChild;
  4934. if ( fragment.childNodes.length === 1 ) {
  4935. fragment = first;
  4936. }
  4937. // Require either new content or an interest in ignored elements to invoke the callback
  4938. if ( first || ignored ) {
  4939. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  4940. hasScripts = scripts.length;
  4941. // Use the original fragment for the last item
  4942. // instead of the first because it can end up
  4943. // being emptied incorrectly in certain situations (#8070).
  4944. for ( ; i < l; i++ ) {
  4945. node = fragment;
  4946. if ( i !== iNoClone ) {
  4947. node = jQuery.clone( node, true, true );
  4948. // Keep references to cloned scripts for later restoration
  4949. if ( hasScripts ) {
  4950. // Support: Android<4.1, PhantomJS<2
  4951. // push.apply(_, arraylike) throws on ancient WebKit
  4952. jQuery.merge( scripts, getAll( node, "script" ) );
  4953. }
  4954. }
  4955. callback.call( collection[ i ], node, i );
  4956. }
  4957. if ( hasScripts ) {
  4958. doc = scripts[ scripts.length - 1 ].ownerDocument;
  4959. // Reenable scripts
  4960. jQuery.map( scripts, restoreScript );
  4961. // Evaluate executable scripts on first document insertion
  4962. for ( i = 0; i < hasScripts; i++ ) {
  4963. node = scripts[ i ];
  4964. if ( rscriptType.test( node.type || "" ) &&
  4965. !jQuery._data( node, "globalEval" ) &&
  4966. jQuery.contains( doc, node ) ) {
  4967. if ( node.src ) {
  4968. // Optional AJAX dependency, but won't run scripts if not present
  4969. if ( jQuery._evalUrl ) {
  4970. jQuery._evalUrl( node.src );
  4971. }
  4972. } else {
  4973. jQuery.globalEval(
  4974. ( node.text || node.textContent || node.innerHTML || "" )
  4975. .replace( rcleanScript, "" )
  4976. );
  4977. }
  4978. }
  4979. }
  4980. }
  4981. // Fix #11809: Avoid leaking memory
  4982. fragment = first = null;
  4983. }
  4984. }
  4985. return collection;
  4986. }
  4987. function remove( elem, selector, keepData ) {
  4988. var node,
  4989. elems = selector ? jQuery.filter( selector, elem ) : elem,
  4990. i = 0;
  4991. for ( ; ( node = elems[ i ] ) != null; i++ ) {
  4992. if ( !keepData && node.nodeType === 1 ) {
  4993. jQuery.cleanData( getAll( node ) );
  4994. }
  4995. if ( node.parentNode ) {
  4996. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  4997. setGlobalEval( getAll( node, "script" ) );
  4998. }
  4999. node.parentNode.removeChild( node );
  5000. }
  5001. }
  5002. return elem;
  5003. }
  5004. jQuery.extend( {
  5005. htmlPrefilter: function( html ) {
  5006. return html.replace( rxhtmlTag, "<$1></$2>" );
  5007. },
  5008. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  5009. var destElements, node, clone, i, srcElements,
  5010. inPage = jQuery.contains( elem.ownerDocument, elem );
  5011. if ( support.html5Clone || jQuery.isXMLDoc( elem ) ||
  5012. !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
  5013. clone = elem.cloneNode( true );
  5014. // IE<=8 does not properly clone detached, unknown element nodes
  5015. } else {
  5016. fragmentDiv.innerHTML = elem.outerHTML;
  5017. fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
  5018. }
  5019. if ( ( !support.noCloneEvent || !support.noCloneChecked ) &&
  5020. ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) {
  5021. // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
  5022. destElements = getAll( clone );
  5023. srcElements = getAll( elem );
  5024. // Fix all IE cloning issues
  5025. for ( i = 0; ( node = srcElements[ i ] ) != null; ++i ) {
  5026. // Ensure that the destination node is not null; Fixes #9587
  5027. if ( destElements[ i ] ) {
  5028. fixCloneNodeIssues( node, destElements[ i ] );
  5029. }
  5030. }
  5031. }
  5032. // Copy the events from the original to the clone
  5033. if ( dataAndEvents ) {
  5034. if ( deepDataAndEvents ) {
  5035. srcElements = srcElements || getAll( elem );
  5036. destElements = destElements || getAll( clone );
  5037. for ( i = 0; ( node = srcElements[ i ] ) != null; i++ ) {
  5038. cloneCopyEvent( node, destElements[ i ] );
  5039. }
  5040. } else {
  5041. cloneCopyEvent( elem, clone );
  5042. }
  5043. }
  5044. // Preserve script evaluation history
  5045. destElements = getAll( clone, "script" );
  5046. if ( destElements.length > 0 ) {
  5047. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  5048. }
  5049. destElements = srcElements = node = null;
  5050. // Return the cloned set
  5051. return clone;
  5052. },
  5053. cleanData: function( elems, /* internal */ forceAcceptData ) {
  5054. var elem, type, id, data,
  5055. i = 0,
  5056. internalKey = jQuery.expando,
  5057. cache = jQuery.cache,
  5058. attributes = support.attributes,
  5059. special = jQuery.event.special;
  5060. for ( ; ( elem = elems[ i ] ) != null; i++ ) {
  5061. if ( forceAcceptData || acceptData( elem ) ) {
  5062. id = elem[ internalKey ];
  5063. data = id && cache[ id ];
  5064. if ( data ) {
  5065. if ( data.events ) {
  5066. for ( type in data.events ) {
  5067. if ( special[ type ] ) {
  5068. jQuery.event.remove( elem, type );
  5069. // This is a shortcut to avoid jQuery.event.remove's overhead
  5070. } else {
  5071. jQuery.removeEvent( elem, type, data.handle );
  5072. }
  5073. }
  5074. }
  5075. // Remove cache only if it was not already removed by jQuery.event.remove
  5076. if ( cache[ id ] ) {
  5077. delete cache[ id ];
  5078. // Support: IE<9
  5079. // IE does not allow us to delete expando properties from nodes
  5080. // IE creates expando attributes along with the property
  5081. // IE does not have a removeAttribute function on Document nodes
  5082. if ( !attributes && typeof elem.removeAttribute !== "undefined" ) {
  5083. elem.removeAttribute( internalKey );
  5084. // Webkit & Blink performance suffers when deleting properties
  5085. // from DOM nodes, so set to undefined instead
  5086. // https://code.google.com/p/chromium/issues/detail?id=378607
  5087. } else {
  5088. elem[ internalKey ] = undefined;
  5089. }
  5090. deletedIds.push( id );
  5091. }
  5092. }
  5093. }
  5094. }
  5095. }
  5096. } );
  5097. jQuery.fn.extend( {
  5098. // Keep domManip exposed until 3.0 (gh-2225)
  5099. domManip: domManip,
  5100. detach: function( selector ) {
  5101. return remove( this, selector, true );
  5102. },
  5103. remove: function( selector ) {
  5104. return remove( this, selector );
  5105. },
  5106. text: function( value ) {
  5107. return access( this, function( value ) {
  5108. return value === undefined ?
  5109. jQuery.text( this ) :
  5110. this.empty().append(
  5111. ( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value )
  5112. );
  5113. }, null, value, arguments.length );
  5114. },
  5115. append: function() {
  5116. return domManip( this, arguments, function( elem ) {
  5117. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5118. var target = manipulationTarget( this, elem );
  5119. target.appendChild( elem );
  5120. }
  5121. } );
  5122. },
  5123. prepend: function() {
  5124. return domManip( this, arguments, function( elem ) {
  5125. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5126. var target = manipulationTarget( this, elem );
  5127. target.insertBefore( elem, target.firstChild );
  5128. }
  5129. } );
  5130. },
  5131. before: function() {
  5132. return domManip( this, arguments, function( elem ) {
  5133. if ( this.parentNode ) {
  5134. this.parentNode.insertBefore( elem, this );
  5135. }
  5136. } );
  5137. },
  5138. after: function() {
  5139. return domManip( this, arguments, function( elem ) {
  5140. if ( this.parentNode ) {
  5141. this.parentNode.insertBefore( elem, this.nextSibling );
  5142. }
  5143. } );
  5144. },
  5145. empty: function() {
  5146. var elem,
  5147. i = 0;
  5148. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  5149. // Remove element nodes and prevent memory leaks
  5150. if ( elem.nodeType === 1 ) {
  5151. jQuery.cleanData( getAll( elem, false ) );
  5152. }
  5153. // Remove any remaining nodes
  5154. while ( elem.firstChild ) {
  5155. elem.removeChild( elem.firstChild );
  5156. }
  5157. // If this is a select, ensure that it displays empty (#12336)
  5158. // Support: IE<9
  5159. if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
  5160. elem.options.length = 0;
  5161. }
  5162. }
  5163. return this;
  5164. },
  5165. clone: function( dataAndEvents, deepDataAndEvents ) {
  5166. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  5167. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  5168. return this.map( function() {
  5169. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  5170. } );
  5171. },
  5172. html: function( value ) {
  5173. return access( this, function( value ) {
  5174. var elem = this[ 0 ] || {},
  5175. i = 0,
  5176. l = this.length;
  5177. if ( value === undefined ) {
  5178. return elem.nodeType === 1 ?
  5179. elem.innerHTML.replace( rinlinejQuery, "" ) :
  5180. undefined;
  5181. }
  5182. // See if we can take a shortcut and just use innerHTML
  5183. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  5184. ( support.htmlSerialize || !rnoshimcache.test( value ) ) &&
  5185. ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
  5186. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  5187. value = jQuery.htmlPrefilter( value );
  5188. try {
  5189. for ( ; i < l; i++ ) {
  5190. // Remove element nodes and prevent memory leaks
  5191. elem = this[ i ] || {};
  5192. if ( elem.nodeType === 1 ) {
  5193. jQuery.cleanData( getAll( elem, false ) );
  5194. elem.innerHTML = value;
  5195. }
  5196. }
  5197. elem = 0;
  5198. // If using innerHTML throws an exception, use the fallback method
  5199. } catch ( e ) {}
  5200. }
  5201. if ( elem ) {
  5202. this.empty().append( value );
  5203. }
  5204. }, null, value, arguments.length );
  5205. },
  5206. replaceWith: function() {
  5207. var ignored = [];
  5208. // Make the changes, replacing each non-ignored context element with the new content
  5209. return domManip( this, arguments, function( elem ) {
  5210. var parent = this.parentNode;
  5211. if ( jQuery.inArray( this, ignored ) < 0 ) {
  5212. jQuery.cleanData( getAll( this ) );
  5213. if ( parent ) {
  5214. parent.replaceChild( elem, this );
  5215. }
  5216. }
  5217. // Force callback invocation
  5218. }, ignored );
  5219. }
  5220. } );
  5221. jQuery.each( {
  5222. appendTo: "append",
  5223. prependTo: "prepend",
  5224. insertBefore: "before",
  5225. insertAfter: "after",
  5226. replaceAll: "replaceWith"
  5227. }, function( name, original ) {
  5228. jQuery.fn[ name ] = function( selector ) {
  5229. var elems,
  5230. i = 0,
  5231. ret = [],
  5232. insert = jQuery( selector ),
  5233. last = insert.length - 1;
  5234. for ( ; i <= last; i++ ) {
  5235. elems = i === last ? this : this.clone( true );
  5236. jQuery( insert[ i ] )[ original ]( elems );
  5237. // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
  5238. push.apply( ret, elems.get() );
  5239. }
  5240. return this.pushStack( ret );
  5241. };
  5242. } );
  5243. var iframe,
  5244. elemdisplay = {
  5245. // Support: Firefox
  5246. // We have to pre-define these values for FF (#10227)
  5247. HTML: "block",
  5248. BODY: "block"
  5249. };
  5250. /**
  5251. * Retrieve the actual display of a element
  5252. * @param {String} name nodeName of the element
  5253. * @param {Object} doc Document object
  5254. */
  5255. // Called only from within defaultDisplay
  5256. function actualDisplay( name, doc ) {
  5257. var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
  5258. display = jQuery.css( elem[ 0 ], "display" );
  5259. // We don't have any data stored on the element,
  5260. // so use "detach" method as fast way to get rid of the element
  5261. elem.detach();
  5262. return display;
  5263. }
  5264. /**
  5265. * Try to determine the default display value of an element
  5266. * @param {String} nodeName
  5267. */
  5268. function defaultDisplay( nodeName ) {
  5269. var doc = document,
  5270. display = elemdisplay[ nodeName ];
  5271. if ( !display ) {
  5272. display = actualDisplay( nodeName, doc );
  5273. // If the simple way fails, read from inside an iframe
  5274. if ( display === "none" || !display ) {
  5275. // Use the already-created iframe if possible
  5276. iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) )
  5277. .appendTo( doc.documentElement );
  5278. // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
  5279. doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;
  5280. // Support: IE
  5281. doc.write();
  5282. doc.close();
  5283. display = actualDisplay( nodeName, doc );
  5284. iframe.detach();
  5285. }
  5286. // Store the correct default display
  5287. elemdisplay[ nodeName ] = display;
  5288. }
  5289. return display;
  5290. }
  5291. var rmargin = ( /^margin/ );
  5292. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  5293. var swap = function( elem, options, callback, args ) {
  5294. var ret, name,
  5295. old = {};
  5296. // Remember the old values, and insert the new ones
  5297. for ( name in options ) {
  5298. old[ name ] = elem.style[ name ];
  5299. elem.style[ name ] = options[ name ];
  5300. }
  5301. ret = callback.apply( elem, args || [] );
  5302. // Revert the old values
  5303. for ( name in options ) {
  5304. elem.style[ name ] = old[ name ];
  5305. }
  5306. return ret;
  5307. };
  5308. var documentElement = document.documentElement;
  5309. ( function() {
  5310. var pixelPositionVal, pixelMarginRightVal, boxSizingReliableVal,
  5311. reliableHiddenOffsetsVal, reliableMarginRightVal, reliableMarginLeftVal,
  5312. container = document.createElement( "div" ),
  5313. div = document.createElement( "div" );
  5314. // Finish early in limited (non-browser) environments
  5315. if ( !div.style ) {
  5316. return;
  5317. }
  5318. div.style.cssText = "float:left;opacity:.5";
  5319. // Support: IE<9
  5320. // Make sure that element opacity exists (as opposed to filter)
  5321. support.opacity = div.style.opacity === "0.5";
  5322. // Verify style float existence
  5323. // (IE uses styleFloat instead of cssFloat)
  5324. support.cssFloat = !!div.style.cssFloat;
  5325. div.style.backgroundClip = "content-box";
  5326. div.cloneNode( true ).style.backgroundClip = "";
  5327. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  5328. container = document.createElement( "div" );
  5329. container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
  5330. "padding:0;margin-top:1px;position:absolute";
  5331. div.innerHTML = "";
  5332. container.appendChild( div );
  5333. // Support: Firefox<29, Android 2.3
  5334. // Vendor-prefix box-sizing
  5335. support.boxSizing = div.style.boxSizing === "" || div.style.MozBoxSizing === "" ||
  5336. div.style.WebkitBoxSizing === "";
  5337. jQuery.extend( support, {
  5338. reliableHiddenOffsets: function() {
  5339. if ( pixelPositionVal == null ) {
  5340. computeStyleTests();
  5341. }
  5342. return reliableHiddenOffsetsVal;
  5343. },
  5344. boxSizingReliable: function() {
  5345. // We're checking for pixelPositionVal here instead of boxSizingReliableVal
  5346. // since that compresses better and they're computed together anyway.
  5347. if ( pixelPositionVal == null ) {
  5348. computeStyleTests();
  5349. }
  5350. return boxSizingReliableVal;
  5351. },
  5352. pixelMarginRight: function() {
  5353. // Support: Android 4.0-4.3
  5354. if ( pixelPositionVal == null ) {
  5355. computeStyleTests();
  5356. }
  5357. return pixelMarginRightVal;
  5358. },
  5359. pixelPosition: function() {
  5360. if ( pixelPositionVal == null ) {
  5361. computeStyleTests();
  5362. }
  5363. return pixelPositionVal;
  5364. },
  5365. reliableMarginRight: function() {
  5366. // Support: Android 2.3
  5367. if ( pixelPositionVal == null ) {
  5368. computeStyleTests();
  5369. }
  5370. return reliableMarginRightVal;
  5371. },
  5372. reliableMarginLeft: function() {
  5373. // Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37
  5374. if ( pixelPositionVal == null ) {
  5375. computeStyleTests();
  5376. }
  5377. return reliableMarginLeftVal;
  5378. }
  5379. } );
  5380. function computeStyleTests() {
  5381. var contents, divStyle,
  5382. documentElement = document.documentElement;
  5383. // Setup
  5384. documentElement.appendChild( container );
  5385. div.style.cssText =
  5386. // Support: Android 2.3
  5387. // Vendor-prefix box-sizing
  5388. "-webkit-box-sizing:border-box;box-sizing:border-box;" +
  5389. "position:relative;display:block;" +
  5390. "margin:auto;border:1px;padding:1px;" +
  5391. "top:1%;width:50%";
  5392. // Support: IE<9
  5393. // Assume reasonable values in the absence of getComputedStyle
  5394. pixelPositionVal = boxSizingReliableVal = reliableMarginLeftVal = false;
  5395. pixelMarginRightVal = reliableMarginRightVal = true;
  5396. // Check for getComputedStyle so that this code is not run in IE<9.
  5397. if ( window.getComputedStyle ) {
  5398. divStyle = window.getComputedStyle( div );
  5399. pixelPositionVal = ( divStyle || {} ).top !== "1%";
  5400. reliableMarginLeftVal = ( divStyle || {} ).marginLeft === "2px";
  5401. boxSizingReliableVal = ( divStyle || { width: "4px" } ).width === "4px";
  5402. // Support: Android 4.0 - 4.3 only
  5403. // Some styles come back with percentage values, even though they shouldn't
  5404. div.style.marginRight = "50%";
  5405. pixelMarginRightVal = ( divStyle || { marginRight: "4px" } ).marginRight === "4px";
  5406. // Support: Android 2.3 only
  5407. // Div with explicit width and no margin-right incorrectly
  5408. // gets computed margin-right based on width of container (#3333)
  5409. // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
  5410. contents = div.appendChild( document.createElement( "div" ) );
  5411. // Reset CSS: box-sizing; display; margin; border; padding
  5412. contents.style.cssText = div.style.cssText =
  5413. // Support: Android 2.3
  5414. // Vendor-prefix box-sizing
  5415. "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
  5416. "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
  5417. contents.style.marginRight = contents.style.width = "0";
  5418. div.style.width = "1px";
  5419. reliableMarginRightVal =
  5420. !parseFloat( ( window.getComputedStyle( contents ) || {} ).marginRight );
  5421. div.removeChild( contents );
  5422. }
  5423. // Support: IE6-8
  5424. // First check that getClientRects works as expected
  5425. // Check if table cells still have offsetWidth/Height when they are set
  5426. // to display:none and there are still other visible table cells in a
  5427. // table row; if so, offsetWidth/Height are not reliable for use when
  5428. // determining if an element has been hidden directly using
  5429. // display:none (it is still safe to use offsets if a parent element is
  5430. // hidden; don safety goggles and see bug #4512 for more information).
  5431. div.style.display = "none";
  5432. reliableHiddenOffsetsVal = div.getClientRects().length === 0;
  5433. if ( reliableHiddenOffsetsVal ) {
  5434. div.style.display = "";
  5435. div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
  5436. contents = div.getElementsByTagName( "td" );
  5437. contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
  5438. reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
  5439. if ( reliableHiddenOffsetsVal ) {
  5440. contents[ 0 ].style.display = "";
  5441. contents[ 1 ].style.display = "none";
  5442. reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
  5443. }
  5444. }
  5445. // Teardown
  5446. documentElement.removeChild( container );
  5447. }
  5448. } )();
  5449. var getStyles, curCSS,
  5450. rposition = /^(top|right|bottom|left)$/;
  5451. if ( window.getComputedStyle ) {
  5452. getStyles = function( elem ) {
  5453. // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
  5454. // IE throws on elements created in popups
  5455. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  5456. var view = elem.ownerDocument.defaultView;
  5457. if ( !view || !view.opener ) {
  5458. view = window;
  5459. }
  5460. return view.getComputedStyle( elem );
  5461. };
  5462. curCSS = function( elem, name, computed ) {
  5463. var width, minWidth, maxWidth, ret,
  5464. style = elem.style;
  5465. computed = computed || getStyles( elem );
  5466. // getPropertyValue is only needed for .css('filter') in IE9, see #12537
  5467. ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
  5468. // Support: Opera 12.1x only
  5469. // Fall back to style even without computed
  5470. // computed is undefined for elems on document fragments
  5471. if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
  5472. ret = jQuery.style( elem, name );
  5473. }
  5474. if ( computed ) {
  5475. // A tribute to the "awesome hack by Dean Edwards"
  5476. // Chrome < 17 and Safari 5.0 uses "computed value"
  5477. // instead of "used value" for margin-right
  5478. // Safari 5.1.7 (at least) returns percentage for a larger set of values,
  5479. // but width seems to be reliably pixels
  5480. // this is against the CSSOM draft spec:
  5481. // http://dev.w3.org/csswg/cssom/#resolved-values
  5482. if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
  5483. // Remember the original values
  5484. width = style.width;
  5485. minWidth = style.minWidth;
  5486. maxWidth = style.maxWidth;
  5487. // Put in the new values to get a computed value out
  5488. style.minWidth = style.maxWidth = style.width = ret;
  5489. ret = computed.width;
  5490. // Revert the changed values
  5491. style.width = width;
  5492. style.minWidth = minWidth;
  5493. style.maxWidth = maxWidth;
  5494. }
  5495. }
  5496. // Support: IE
  5497. // IE returns zIndex value as an integer.
  5498. return ret === undefined ?
  5499. ret :
  5500. ret + "";
  5501. };
  5502. } else if ( documentElement.currentStyle ) {
  5503. getStyles = function( elem ) {
  5504. return elem.currentStyle;
  5505. };
  5506. curCSS = function( elem, name, computed ) {
  5507. var left, rs, rsLeft, ret,
  5508. style = elem.style;
  5509. computed = computed || getStyles( elem );
  5510. ret = computed ? computed[ name ] : undefined;
  5511. // Avoid setting ret to empty string here
  5512. // so we don't default to auto
  5513. if ( ret == null && style && style[ name ] ) {
  5514. ret = style[ name ];
  5515. }
  5516. // From the awesome hack by Dean Edwards
  5517. // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  5518. // If we're not dealing with a regular pixel number
  5519. // but a number that has a weird ending, we need to convert it to pixels
  5520. // but not position css attributes, as those are
  5521. // proportional to the parent element instead
  5522. // and we can't measure the parent instead because it
  5523. // might trigger a "stacking dolls" problem
  5524. if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
  5525. // Remember the original values
  5526. left = style.left;
  5527. rs = elem.runtimeStyle;
  5528. rsLeft = rs && rs.left;
  5529. // Put in the new values to get a computed value out
  5530. if ( rsLeft ) {
  5531. rs.left = elem.currentStyle.left;
  5532. }
  5533. style.left = name === "fontSize" ? "1em" : ret;
  5534. ret = style.pixelLeft + "px";
  5535. // Revert the changed values
  5536. style.left = left;
  5537. if ( rsLeft ) {
  5538. rs.left = rsLeft;
  5539. }
  5540. }
  5541. // Support: IE
  5542. // IE returns zIndex value as an integer.
  5543. return ret === undefined ?
  5544. ret :
  5545. ret + "" || "auto";
  5546. };
  5547. }
  5548. function addGetHookIf( conditionFn, hookFn ) {
  5549. // Define the hook, we'll check on the first run if it's really needed.
  5550. return {
  5551. get: function() {
  5552. if ( conditionFn() ) {
  5553. // Hook not needed (or it's not possible to use it due
  5554. // to missing dependency), remove it.
  5555. delete this.get;
  5556. return;
  5557. }
  5558. // Hook needed; redefine it so that the support test is not executed again.
  5559. return ( this.get = hookFn ).apply( this, arguments );
  5560. }
  5561. };
  5562. }
  5563. var
  5564. ralpha = /alpha\([^)]*\)/i,
  5565. ropacity = /opacity\s*=\s*([^)]*)/i,
  5566. // swappable if display is none or starts with table except
  5567. // "table", "table-cell", or "table-caption"
  5568. // see here for display values:
  5569. // https://developer.mozilla.org/en-US/docs/CSS/display
  5570. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  5571. rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
  5572. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  5573. cssNormalTransform = {
  5574. letterSpacing: "0",
  5575. fontWeight: "400"
  5576. },
  5577. cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
  5578. emptyStyle = document.createElement( "div" ).style;
  5579. // return a css property mapped to a potentially vendor prefixed property
  5580. function vendorPropName( name ) {
  5581. // shortcut for names that are not vendor prefixed
  5582. if ( name in emptyStyle ) {
  5583. return name;
  5584. }
  5585. // check for vendor prefixed names
  5586. var capName = name.charAt( 0 ).toUpperCase() + name.slice( 1 ),
  5587. i = cssPrefixes.length;
  5588. while ( i-- ) {
  5589. name = cssPrefixes[ i ] + capName;
  5590. if ( name in emptyStyle ) {
  5591. return name;
  5592. }
  5593. }
  5594. }
  5595. function showHide( elements, show ) {
  5596. var display, elem, hidden,
  5597. values = [],
  5598. index = 0,
  5599. length = elements.length;
  5600. for ( ; index < length; index++ ) {
  5601. elem = elements[ index ];
  5602. if ( !elem.style ) {
  5603. continue;
  5604. }
  5605. values[ index ] = jQuery._data( elem, "olddisplay" );
  5606. display = elem.style.display;
  5607. if ( show ) {
  5608. // Reset the inline display of this element to learn if it is
  5609. // being hidden by cascaded rules or not
  5610. if ( !values[ index ] && display === "none" ) {
  5611. elem.style.display = "";
  5612. }
  5613. // Set elements which have been overridden with display: none
  5614. // in a stylesheet to whatever the default browser style is
  5615. // for such an element
  5616. if ( elem.style.display === "" && isHidden( elem ) ) {
  5617. values[ index ] =
  5618. jQuery._data( elem, "olddisplay", defaultDisplay( elem.nodeName ) );
  5619. }
  5620. } else {
  5621. hidden = isHidden( elem );
  5622. if ( display && display !== "none" || !hidden ) {
  5623. jQuery._data(
  5624. elem,
  5625. "olddisplay",
  5626. hidden ? display : jQuery.css( elem, "display" )
  5627. );
  5628. }
  5629. }
  5630. }
  5631. // Set the display of most of the elements in a second loop
  5632. // to avoid the constant reflow
  5633. for ( index = 0; index < length; index++ ) {
  5634. elem = elements[ index ];
  5635. if ( !elem.style ) {
  5636. continue;
  5637. }
  5638. if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
  5639. elem.style.display = show ? values[ index ] || "" : "none";
  5640. }
  5641. }
  5642. return elements;
  5643. }
  5644. function setPositiveNumber( elem, value, subtract ) {
  5645. var matches = rnumsplit.exec( value );
  5646. return matches ?
  5647. // Guard against undefined "subtract", e.g., when used as in cssHooks
  5648. Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
  5649. value;
  5650. }
  5651. function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
  5652. var i = extra === ( isBorderBox ? "border" : "content" ) ?
  5653. // If we already have the right measurement, avoid augmentation
  5654. 4 :
  5655. // Otherwise initialize for horizontal or vertical properties
  5656. name === "width" ? 1 : 0,
  5657. val = 0;
  5658. for ( ; i < 4; i += 2 ) {
  5659. // both box models exclude margin, so add it if we want it
  5660. if ( extra === "margin" ) {
  5661. val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
  5662. }
  5663. if ( isBorderBox ) {
  5664. // border-box includes padding, so remove it if we want content
  5665. if ( extra === "content" ) {
  5666. val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5667. }
  5668. // at this point, extra isn't border nor margin, so remove border
  5669. if ( extra !== "margin" ) {
  5670. val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5671. }
  5672. } else {
  5673. // at this point, extra isn't content, so add padding
  5674. val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5675. // at this point, extra isn't content nor padding, so add border
  5676. if ( extra !== "padding" ) {
  5677. val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5678. }
  5679. }
  5680. }
  5681. return val;
  5682. }
  5683. function getWidthOrHeight( elem, name, extra ) {
  5684. // Start with offset property, which is equivalent to the border-box value
  5685. var valueIsBorderBox = true,
  5686. val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
  5687. styles = getStyles( elem ),
  5688. isBorderBox = support.boxSizing &&
  5689. jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  5690. // Support: IE11 only
  5691. // In IE 11 fullscreen elements inside of an iframe have
  5692. // 100x too small dimensions (gh-1764).
  5693. if ( document.msFullscreenElement && window.top !== window ) {
  5694. // Support: IE11 only
  5695. // Running getBoundingClientRect on a disconnected node
  5696. // in IE throws an error.
  5697. if ( elem.getClientRects().length ) {
  5698. val = Math.round( elem.getBoundingClientRect()[ name ] * 100 );
  5699. }
  5700. }
  5701. // some non-html elements return undefined for offsetWidth, so check for null/undefined
  5702. // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
  5703. // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
  5704. if ( val <= 0 || val == null ) {
  5705. // Fall back to computed then uncomputed css if necessary
  5706. val = curCSS( elem, name, styles );
  5707. if ( val < 0 || val == null ) {
  5708. val = elem.style[ name ];
  5709. }
  5710. // Computed unit is not pixels. Stop here and return.
  5711. if ( rnumnonpx.test( val ) ) {
  5712. return val;
  5713. }
  5714. // we need the check for style in case a browser which returns unreliable values
  5715. // for getComputedStyle silently falls back to the reliable elem.style
  5716. valueIsBorderBox = isBorderBox &&
  5717. ( support.boxSizingReliable() || val === elem.style[ name ] );
  5718. // Normalize "", auto, and prepare for extra
  5719. val = parseFloat( val ) || 0;
  5720. }
  5721. // use the active box-sizing model to add/subtract irrelevant styles
  5722. return ( val +
  5723. augmentWidthOrHeight(
  5724. elem,
  5725. name,
  5726. extra || ( isBorderBox ? "border" : "content" ),
  5727. valueIsBorderBox,
  5728. styles
  5729. )
  5730. ) + "px";
  5731. }
  5732. jQuery.extend( {
  5733. // Add in style property hooks for overriding the default
  5734. // behavior of getting and setting a style property
  5735. cssHooks: {
  5736. opacity: {
  5737. get: function( elem, computed ) {
  5738. if ( computed ) {
  5739. // We should always get a number back from opacity
  5740. var ret = curCSS( elem, "opacity" );
  5741. return ret === "" ? "1" : ret;
  5742. }
  5743. }
  5744. }
  5745. },
  5746. // Don't automatically add "px" to these possibly-unitless properties
  5747. cssNumber: {
  5748. "animationIterationCount": true,
  5749. "columnCount": true,
  5750. "fillOpacity": true,
  5751. "flexGrow": true,
  5752. "flexShrink": true,
  5753. "fontWeight": true,
  5754. "lineHeight": true,
  5755. "opacity": true,
  5756. "order": true,
  5757. "orphans": true,
  5758. "widows": true,
  5759. "zIndex": true,
  5760. "zoom": true
  5761. },
  5762. // Add in properties whose names you wish to fix before
  5763. // setting or getting the value
  5764. cssProps: {
  5765. // normalize float css property
  5766. "float": support.cssFloat ? "cssFloat" : "styleFloat"
  5767. },
  5768. // Get and set the style property on a DOM Node
  5769. style: function( elem, name, value, extra ) {
  5770. // Don't set styles on text and comment nodes
  5771. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  5772. return;
  5773. }
  5774. // Make sure that we're working with the right name
  5775. var ret, type, hooks,
  5776. origName = jQuery.camelCase( name ),
  5777. style = elem.style;
  5778. name = jQuery.cssProps[ origName ] ||
  5779. ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
  5780. // gets hook for the prefixed version
  5781. // followed by the unprefixed version
  5782. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5783. // Check if we're setting a value
  5784. if ( value !== undefined ) {
  5785. type = typeof value;
  5786. // Convert "+=" or "-=" to relative numbers (#7345)
  5787. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  5788. value = adjustCSS( elem, name, ret );
  5789. // Fixes bug #9237
  5790. type = "number";
  5791. }
  5792. // Make sure that null and NaN values aren't set. See: #7116
  5793. if ( value == null || value !== value ) {
  5794. return;
  5795. }
  5796. // If a number was passed in, add the unit (except for certain CSS properties)
  5797. if ( type === "number" ) {
  5798. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  5799. }
  5800. // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
  5801. // but it would mean to define eight
  5802. // (for every problematic property) identical functions
  5803. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  5804. style[ name ] = "inherit";
  5805. }
  5806. // If a hook was provided, use that value, otherwise just set the specified value
  5807. if ( !hooks || !( "set" in hooks ) ||
  5808. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  5809. // Support: IE
  5810. // Swallow errors from 'invalid' CSS values (#5509)
  5811. try {
  5812. style[ name ] = value;
  5813. } catch ( e ) {}
  5814. }
  5815. } else {
  5816. // If a hook was provided get the non-computed value from there
  5817. if ( hooks && "get" in hooks &&
  5818. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  5819. return ret;
  5820. }
  5821. // Otherwise just get the value from the style object
  5822. return style[ name ];
  5823. }
  5824. },
  5825. css: function( elem, name, extra, styles ) {
  5826. var num, val, hooks,
  5827. origName = jQuery.camelCase( name );
  5828. // Make sure that we're working with the right name
  5829. name = jQuery.cssProps[ origName ] ||
  5830. ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
  5831. // gets hook for the prefixed version
  5832. // followed by the unprefixed version
  5833. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5834. // If a hook was provided get the computed value from there
  5835. if ( hooks && "get" in hooks ) {
  5836. val = hooks.get( elem, true, extra );
  5837. }
  5838. // Otherwise, if a way to get the computed value exists, use that
  5839. if ( val === undefined ) {
  5840. val = curCSS( elem, name, styles );
  5841. }
  5842. //convert "normal" to computed value
  5843. if ( val === "normal" && name in cssNormalTransform ) {
  5844. val = cssNormalTransform[ name ];
  5845. }
  5846. // Return, converting to number if forced or a qualifier was provided and val looks numeric
  5847. if ( extra === "" || extra ) {
  5848. num = parseFloat( val );
  5849. return extra === true || isFinite( num ) ? num || 0 : val;
  5850. }
  5851. return val;
  5852. }
  5853. } );
  5854. jQuery.each( [ "height", "width" ], function( i, name ) {
  5855. jQuery.cssHooks[ name ] = {
  5856. get: function( elem, computed, extra ) {
  5857. if ( computed ) {
  5858. // certain elements can have dimension info if we invisibly show them
  5859. // however, it must have a current display style that would benefit from this
  5860. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  5861. elem.offsetWidth === 0 ?
  5862. swap( elem, cssShow, function() {
  5863. return getWidthOrHeight( elem, name, extra );
  5864. } ) :
  5865. getWidthOrHeight( elem, name, extra );
  5866. }
  5867. },
  5868. set: function( elem, value, extra ) {
  5869. var styles = extra && getStyles( elem );
  5870. return setPositiveNumber( elem, value, extra ?
  5871. augmentWidthOrHeight(
  5872. elem,
  5873. name,
  5874. extra,
  5875. support.boxSizing &&
  5876. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  5877. styles
  5878. ) : 0
  5879. );
  5880. }
  5881. };
  5882. } );
  5883. if ( !support.opacity ) {
  5884. jQuery.cssHooks.opacity = {
  5885. get: function( elem, computed ) {
  5886. // IE uses filters for opacity
  5887. return ropacity.test( ( computed && elem.currentStyle ?
  5888. elem.currentStyle.filter :
  5889. elem.style.filter ) || "" ) ?
  5890. ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
  5891. computed ? "1" : "";
  5892. },
  5893. set: function( elem, value ) {
  5894. var style = elem.style,
  5895. currentStyle = elem.currentStyle,
  5896. opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
  5897. filter = currentStyle && currentStyle.filter || style.filter || "";
  5898. // IE has trouble with opacity if it does not have layout
  5899. // Force it by setting the zoom level
  5900. style.zoom = 1;
  5901. // if setting opacity to 1, and no other filters exist -
  5902. // attempt to remove filter attribute #6652
  5903. // if value === "", then remove inline opacity #12685
  5904. if ( ( value >= 1 || value === "" ) &&
  5905. jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
  5906. style.removeAttribute ) {
  5907. // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
  5908. // if "filter:" is present at all, clearType is disabled, we want to avoid this
  5909. // style.removeAttribute is IE Only, but so apparently is this code path...
  5910. style.removeAttribute( "filter" );
  5911. // if there is no filter style applied in a css rule
  5912. // or unset inline opacity, we are done
  5913. if ( value === "" || currentStyle && !currentStyle.filter ) {
  5914. return;
  5915. }
  5916. }
  5917. // otherwise, set new filter values
  5918. style.filter = ralpha.test( filter ) ?
  5919. filter.replace( ralpha, opacity ) :
  5920. filter + " " + opacity;
  5921. }
  5922. };
  5923. }
  5924. jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
  5925. function( elem, computed ) {
  5926. if ( computed ) {
  5927. return swap( elem, { "display": "inline-block" },
  5928. curCSS, [ elem, "marginRight" ] );
  5929. }
  5930. }
  5931. );
  5932. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  5933. function( elem, computed ) {
  5934. if ( computed ) {
  5935. return (
  5936. parseFloat( curCSS( elem, "marginLeft" ) ) ||
  5937. // Support: IE<=11+
  5938. // Running getBoundingClientRect on a disconnected node in IE throws an error
  5939. // Support: IE8 only
  5940. // getClientRects() errors on disconnected elems
  5941. ( jQuery.contains( elem.ownerDocument, elem ) ?
  5942. elem.getBoundingClientRect().left -
  5943. swap( elem, { marginLeft: 0 }, function() {
  5944. return elem.getBoundingClientRect().left;
  5945. } ) :
  5946. 0
  5947. )
  5948. ) + "px";
  5949. }
  5950. }
  5951. );
  5952. // These hooks are used by animate to expand properties
  5953. jQuery.each( {
  5954. margin: "",
  5955. padding: "",
  5956. border: "Width"
  5957. }, function( prefix, suffix ) {
  5958. jQuery.cssHooks[ prefix + suffix ] = {
  5959. expand: function( value ) {
  5960. var i = 0,
  5961. expanded = {},
  5962. // assumes a single number if not a string
  5963. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  5964. for ( ; i < 4; i++ ) {
  5965. expanded[ prefix + cssExpand[ i ] + suffix ] =
  5966. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  5967. }
  5968. return expanded;
  5969. }
  5970. };
  5971. if ( !rmargin.test( prefix ) ) {
  5972. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  5973. }
  5974. } );
  5975. jQuery.fn.extend( {
  5976. css: function( name, value ) {
  5977. return access( this, function( elem, name, value ) {
  5978. var styles, len,
  5979. map = {},
  5980. i = 0;
  5981. if ( jQuery.isArray( name ) ) {
  5982. styles = getStyles( elem );
  5983. len = name.length;
  5984. for ( ; i < len; i++ ) {
  5985. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  5986. }
  5987. return map;
  5988. }
  5989. return value !== undefined ?
  5990. jQuery.style( elem, name, value ) :
  5991. jQuery.css( elem, name );
  5992. }, name, value, arguments.length > 1 );
  5993. },
  5994. show: function() {
  5995. return showHide( this, true );
  5996. },
  5997. hide: function() {
  5998. return showHide( this );
  5999. },
  6000. toggle: function( state ) {
  6001. if ( typeof state === "boolean" ) {
  6002. return state ? this.show() : this.hide();
  6003. }
  6004. return this.each( function() {
  6005. if ( isHidden( this ) ) {
  6006. jQuery( this ).show();
  6007. } else {
  6008. jQuery( this ).hide();
  6009. }
  6010. } );
  6011. }
  6012. } );
  6013. function Tween( elem, options, prop, end, easing ) {
  6014. return new Tween.prototype.init( elem, options, prop, end, easing );
  6015. }
  6016. jQuery.Tween = Tween;
  6017. Tween.prototype = {
  6018. constructor: Tween,
  6019. init: function( elem, options, prop, end, easing, unit ) {
  6020. this.elem = elem;
  6021. this.prop = prop;
  6022. this.easing = easing || jQuery.easing._default;
  6023. this.options = options;
  6024. this.start = this.now = this.cur();
  6025. this.end = end;
  6026. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  6027. },
  6028. cur: function() {
  6029. var hooks = Tween.propHooks[ this.prop ];
  6030. return hooks && hooks.get ?
  6031. hooks.get( this ) :
  6032. Tween.propHooks._default.get( this );
  6033. },
  6034. run: function( percent ) {
  6035. var eased,
  6036. hooks = Tween.propHooks[ this.prop ];
  6037. if ( this.options.duration ) {
  6038. this.pos = eased = jQuery.easing[ this.easing ](
  6039. percent, this.options.duration * percent, 0, 1, this.options.duration
  6040. );
  6041. } else {
  6042. this.pos = eased = percent;
  6043. }
  6044. this.now = ( this.end - this.start ) * eased + this.start;
  6045. if ( this.options.step ) {
  6046. this.options.step.call( this.elem, this.now, this );
  6047. }
  6048. if ( hooks && hooks.set ) {
  6049. hooks.set( this );
  6050. } else {
  6051. Tween.propHooks._default.set( this );
  6052. }
  6053. return this;
  6054. }
  6055. };
  6056. Tween.prototype.init.prototype = Tween.prototype;
  6057. Tween.propHooks = {
  6058. _default: {
  6059. get: function( tween ) {
  6060. var result;
  6061. // Use a property on the element directly when it is not a DOM element,
  6062. // or when there is no matching style property that exists.
  6063. if ( tween.elem.nodeType !== 1 ||
  6064. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  6065. return tween.elem[ tween.prop ];
  6066. }
  6067. // passing an empty string as a 3rd parameter to .css will automatically
  6068. // attempt a parseFloat and fallback to a string if the parse fails
  6069. // so, simple values such as "10px" are parsed to Float.
  6070. // complex values such as "rotate(1rad)" are returned as is.
  6071. result = jQuery.css( tween.elem, tween.prop, "" );
  6072. // Empty strings, null, undefined and "auto" are converted to 0.
  6073. return !result || result === "auto" ? 0 : result;
  6074. },
  6075. set: function( tween ) {
  6076. // use step hook for back compat - use cssHook if its there - use .style if its
  6077. // available and use plain properties where available
  6078. if ( jQuery.fx.step[ tween.prop ] ) {
  6079. jQuery.fx.step[ tween.prop ]( tween );
  6080. } else if ( tween.elem.nodeType === 1 &&
  6081. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  6082. jQuery.cssHooks[ tween.prop ] ) ) {
  6083. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  6084. } else {
  6085. tween.elem[ tween.prop ] = tween.now;
  6086. }
  6087. }
  6088. }
  6089. };
  6090. // Support: IE <=9
  6091. // Panic based approach to setting things on disconnected nodes
  6092. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  6093. set: function( tween ) {
  6094. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  6095. tween.elem[ tween.prop ] = tween.now;
  6096. }
  6097. }
  6098. };
  6099. jQuery.easing = {
  6100. linear: function( p ) {
  6101. return p;
  6102. },
  6103. swing: function( p ) {
  6104. return 0.5 - Math.cos( p * Math.PI ) / 2;
  6105. },
  6106. _default: "swing"
  6107. };
  6108. jQuery.fx = Tween.prototype.init;
  6109. // Back Compat <1.8 extension point
  6110. jQuery.fx.step = {};
  6111. var
  6112. fxNow, timerId,
  6113. rfxtypes = /^(?:toggle|show|hide)$/,
  6114. rrun = /queueHooks$/;
  6115. // Animations created synchronously will run synchronously
  6116. function createFxNow() {
  6117. window.setTimeout( function() {
  6118. fxNow = undefined;
  6119. } );
  6120. return ( fxNow = jQuery.now() );
  6121. }
  6122. // Generate parameters to create a standard animation
  6123. function genFx( type, includeWidth ) {
  6124. var which,
  6125. attrs = { height: type },
  6126. i = 0;
  6127. // if we include width, step value is 1 to do all cssExpand values,
  6128. // if we don't include width, step value is 2 to skip over Left and Right
  6129. includeWidth = includeWidth ? 1 : 0;
  6130. for ( ; i < 4 ; i += 2 - includeWidth ) {
  6131. which = cssExpand[ i ];
  6132. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  6133. }
  6134. if ( includeWidth ) {
  6135. attrs.opacity = attrs.width = type;
  6136. }
  6137. return attrs;
  6138. }
  6139. function createTween( value, prop, animation ) {
  6140. var tween,
  6141. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  6142. index = 0,
  6143. length = collection.length;
  6144. for ( ; index < length; index++ ) {
  6145. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  6146. // we're done with this property
  6147. return tween;
  6148. }
  6149. }
  6150. }
  6151. function defaultPrefilter( elem, props, opts ) {
  6152. /* jshint validthis: true */
  6153. var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
  6154. anim = this,
  6155. orig = {},
  6156. style = elem.style,
  6157. hidden = elem.nodeType && isHidden( elem ),
  6158. dataShow = jQuery._data( elem, "fxshow" );
  6159. // handle queue: false promises
  6160. if ( !opts.queue ) {
  6161. hooks = jQuery._queueHooks( elem, "fx" );
  6162. if ( hooks.unqueued == null ) {
  6163. hooks.unqueued = 0;
  6164. oldfire = hooks.empty.fire;
  6165. hooks.empty.fire = function() {
  6166. if ( !hooks.unqueued ) {
  6167. oldfire();
  6168. }
  6169. };
  6170. }
  6171. hooks.unqueued++;
  6172. anim.always( function() {
  6173. // doing this makes sure that the complete handler will be called
  6174. // before this completes
  6175. anim.always( function() {
  6176. hooks.unqueued--;
  6177. if ( !jQuery.queue( elem, "fx" ).length ) {
  6178. hooks.empty.fire();
  6179. }
  6180. } );
  6181. } );
  6182. }
  6183. // height/width overflow pass
  6184. if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
  6185. // Make sure that nothing sneaks out
  6186. // Record all 3 overflow attributes because IE does not
  6187. // change the overflow attribute when overflowX and
  6188. // overflowY are set to the same value
  6189. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  6190. // Set display property to inline-block for height/width
  6191. // animations on inline elements that are having width/height animated
  6192. display = jQuery.css( elem, "display" );
  6193. // Test default display if display is currently "none"
  6194. checkDisplay = display === "none" ?
  6195. jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
  6196. if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
  6197. // inline-level elements accept inline-block;
  6198. // block-level elements need to be inline with layout
  6199. if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) {
  6200. style.display = "inline-block";
  6201. } else {
  6202. style.zoom = 1;
  6203. }
  6204. }
  6205. }
  6206. if ( opts.overflow ) {
  6207. style.overflow = "hidden";
  6208. if ( !support.shrinkWrapBlocks() ) {
  6209. anim.always( function() {
  6210. style.overflow = opts.overflow[ 0 ];
  6211. style.overflowX = opts.overflow[ 1 ];
  6212. style.overflowY = opts.overflow[ 2 ];
  6213. } );
  6214. }
  6215. }
  6216. // show/hide pass
  6217. for ( prop in props ) {
  6218. value = props[ prop ];
  6219. if ( rfxtypes.exec( value ) ) {
  6220. delete props[ prop ];
  6221. toggle = toggle || value === "toggle";
  6222. if ( value === ( hidden ? "hide" : "show" ) ) {
  6223. // If there is dataShow left over from a stopped hide or show
  6224. // and we are going to proceed with show, we should pretend to be hidden
  6225. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  6226. hidden = true;
  6227. } else {
  6228. continue;
  6229. }
  6230. }
  6231. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  6232. // Any non-fx value stops us from restoring the original display value
  6233. } else {
  6234. display = undefined;
  6235. }
  6236. }
  6237. if ( !jQuery.isEmptyObject( orig ) ) {
  6238. if ( dataShow ) {
  6239. if ( "hidden" in dataShow ) {
  6240. hidden = dataShow.hidden;
  6241. }
  6242. } else {
  6243. dataShow = jQuery._data( elem, "fxshow", {} );
  6244. }
  6245. // store state if its toggle - enables .stop().toggle() to "reverse"
  6246. if ( toggle ) {
  6247. dataShow.hidden = !hidden;
  6248. }
  6249. if ( hidden ) {
  6250. jQuery( elem ).show();
  6251. } else {
  6252. anim.done( function() {
  6253. jQuery( elem ).hide();
  6254. } );
  6255. }
  6256. anim.done( function() {
  6257. var prop;
  6258. jQuery._removeData( elem, "fxshow" );
  6259. for ( prop in orig ) {
  6260. jQuery.style( elem, prop, orig[ prop ] );
  6261. }
  6262. } );
  6263. for ( prop in orig ) {
  6264. tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  6265. if ( !( prop in dataShow ) ) {
  6266. dataShow[ prop ] = tween.start;
  6267. if ( hidden ) {
  6268. tween.end = tween.start;
  6269. tween.start = prop === "width" || prop === "height" ? 1 : 0;
  6270. }
  6271. }
  6272. }
  6273. // If this is a noop like .hide().hide(), restore an overwritten display value
  6274. } else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : display ) === "inline" ) {
  6275. style.display = display;
  6276. }
  6277. }
  6278. function propFilter( props, specialEasing ) {
  6279. var index, name, easing, value, hooks;
  6280. // camelCase, specialEasing and expand cssHook pass
  6281. for ( index in props ) {
  6282. name = jQuery.camelCase( index );
  6283. easing = specialEasing[ name ];
  6284. value = props[ index ];
  6285. if ( jQuery.isArray( value ) ) {
  6286. easing = value[ 1 ];
  6287. value = props[ index ] = value[ 0 ];
  6288. }
  6289. if ( index !== name ) {
  6290. props[ name ] = value;
  6291. delete props[ index ];
  6292. }
  6293. hooks = jQuery.cssHooks[ name ];
  6294. if ( hooks && "expand" in hooks ) {
  6295. value = hooks.expand( value );
  6296. delete props[ name ];
  6297. // not quite $.extend, this wont overwrite keys already present.
  6298. // also - reusing 'index' from above because we have the correct "name"
  6299. for ( index in value ) {
  6300. if ( !( index in props ) ) {
  6301. props[ index ] = value[ index ];
  6302. specialEasing[ index ] = easing;
  6303. }
  6304. }
  6305. } else {
  6306. specialEasing[ name ] = easing;
  6307. }
  6308. }
  6309. }
  6310. function Animation( elem, properties, options ) {
  6311. var result,
  6312. stopped,
  6313. index = 0,
  6314. length = Animation.prefilters.length,
  6315. deferred = jQuery.Deferred().always( function() {
  6316. // don't match elem in the :animated selector
  6317. delete tick.elem;
  6318. } ),
  6319. tick = function() {
  6320. if ( stopped ) {
  6321. return false;
  6322. }
  6323. var currentTime = fxNow || createFxNow(),
  6324. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  6325. // Support: Android 2.3
  6326. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  6327. temp = remaining / animation.duration || 0,
  6328. percent = 1 - temp,
  6329. index = 0,
  6330. length = animation.tweens.length;
  6331. for ( ; index < length ; index++ ) {
  6332. animation.tweens[ index ].run( percent );
  6333. }
  6334. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  6335. if ( percent < 1 && length ) {
  6336. return remaining;
  6337. } else {
  6338. deferred.resolveWith( elem, [ animation ] );
  6339. return false;
  6340. }
  6341. },
  6342. animation = deferred.promise( {
  6343. elem: elem,
  6344. props: jQuery.extend( {}, properties ),
  6345. opts: jQuery.extend( true, {
  6346. specialEasing: {},
  6347. easing: jQuery.easing._default
  6348. }, options ),
  6349. originalProperties: properties,
  6350. originalOptions: options,
  6351. startTime: fxNow || createFxNow(),
  6352. duration: options.duration,
  6353. tweens: [],
  6354. createTween: function( prop, end ) {
  6355. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  6356. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  6357. animation.tweens.push( tween );
  6358. return tween;
  6359. },
  6360. stop: function( gotoEnd ) {
  6361. var index = 0,
  6362. // if we are going to the end, we want to run all the tweens
  6363. // otherwise we skip this part
  6364. length = gotoEnd ? animation.tweens.length : 0;
  6365. if ( stopped ) {
  6366. return this;
  6367. }
  6368. stopped = true;
  6369. for ( ; index < length ; index++ ) {
  6370. animation.tweens[ index ].run( 1 );
  6371. }
  6372. // resolve when we played the last frame
  6373. // otherwise, reject
  6374. if ( gotoEnd ) {
  6375. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  6376. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  6377. } else {
  6378. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  6379. }
  6380. return this;
  6381. }
  6382. } ),
  6383. props = animation.props;
  6384. propFilter( props, animation.opts.specialEasing );
  6385. for ( ; index < length ; index++ ) {
  6386. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  6387. if ( result ) {
  6388. if ( jQuery.isFunction( result.stop ) ) {
  6389. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  6390. jQuery.proxy( result.stop, result );
  6391. }
  6392. return result;
  6393. }
  6394. }
  6395. jQuery.map( props, createTween, animation );
  6396. if ( jQuery.isFunction( animation.opts.start ) ) {
  6397. animation.opts.start.call( elem, animation );
  6398. }
  6399. jQuery.fx.timer(
  6400. jQuery.extend( tick, {
  6401. elem: elem,
  6402. anim: animation,
  6403. queue: animation.opts.queue
  6404. } )
  6405. );
  6406. // attach callbacks from options
  6407. return animation.progress( animation.opts.progress )
  6408. .done( animation.opts.done, animation.opts.complete )
  6409. .fail( animation.opts.fail )
  6410. .always( animation.opts.always );
  6411. }
  6412. jQuery.Animation = jQuery.extend( Animation, {
  6413. tweeners: {
  6414. "*": [ function( prop, value ) {
  6415. var tween = this.createTween( prop, value );
  6416. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  6417. return tween;
  6418. } ]
  6419. },
  6420. tweener: function( props, callback ) {
  6421. if ( jQuery.isFunction( props ) ) {
  6422. callback = props;
  6423. props = [ "*" ];
  6424. } else {
  6425. props = props.match( rnotwhite );
  6426. }
  6427. var prop,
  6428. index = 0,
  6429. length = props.length;
  6430. for ( ; index < length ; index++ ) {
  6431. prop = props[ index ];
  6432. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  6433. Animation.tweeners[ prop ].unshift( callback );
  6434. }
  6435. },
  6436. prefilters: [ defaultPrefilter ],
  6437. prefilter: function( callback, prepend ) {
  6438. if ( prepend ) {
  6439. Animation.prefilters.unshift( callback );
  6440. } else {
  6441. Animation.prefilters.push( callback );
  6442. }
  6443. }
  6444. } );
  6445. jQuery.speed = function( speed, easing, fn ) {
  6446. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  6447. complete: fn || !fn && easing ||
  6448. jQuery.isFunction( speed ) && speed,
  6449. duration: speed,
  6450. easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
  6451. };
  6452. opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
  6453. opt.duration in jQuery.fx.speeds ?
  6454. jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
  6455. // normalize opt.queue - true/undefined/null -> "fx"
  6456. if ( opt.queue == null || opt.queue === true ) {
  6457. opt.queue = "fx";
  6458. }
  6459. // Queueing
  6460. opt.old = opt.complete;
  6461. opt.complete = function() {
  6462. if ( jQuery.isFunction( opt.old ) ) {
  6463. opt.old.call( this );
  6464. }
  6465. if ( opt.queue ) {
  6466. jQuery.dequeue( this, opt.queue );
  6467. }
  6468. };
  6469. return opt;
  6470. };
  6471. jQuery.fn.extend( {
  6472. fadeTo: function( speed, to, easing, callback ) {
  6473. // show any hidden elements after setting opacity to 0
  6474. return this.filter( isHidden ).css( "opacity", 0 ).show()
  6475. // animate to the value specified
  6476. .end().animate( { opacity: to }, speed, easing, callback );
  6477. },
  6478. animate: function( prop, speed, easing, callback ) {
  6479. var empty = jQuery.isEmptyObject( prop ),
  6480. optall = jQuery.speed( speed, easing, callback ),
  6481. doAnimation = function() {
  6482. // Operate on a copy of prop so per-property easing won't be lost
  6483. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  6484. // Empty animations, or finishing resolves immediately
  6485. if ( empty || jQuery._data( this, "finish" ) ) {
  6486. anim.stop( true );
  6487. }
  6488. };
  6489. doAnimation.finish = doAnimation;
  6490. return empty || optall.queue === false ?
  6491. this.each( doAnimation ) :
  6492. this.queue( optall.queue, doAnimation );
  6493. },
  6494. stop: function( type, clearQueue, gotoEnd ) {
  6495. var stopQueue = function( hooks ) {
  6496. var stop = hooks.stop;
  6497. delete hooks.stop;
  6498. stop( gotoEnd );
  6499. };
  6500. if ( typeof type !== "string" ) {
  6501. gotoEnd = clearQueue;
  6502. clearQueue = type;
  6503. type = undefined;
  6504. }
  6505. if ( clearQueue && type !== false ) {
  6506. this.queue( type || "fx", [] );
  6507. }
  6508. return this.each( function() {
  6509. var dequeue = true,
  6510. index = type != null && type + "queueHooks",
  6511. timers = jQuery.timers,
  6512. data = jQuery._data( this );
  6513. if ( index ) {
  6514. if ( data[ index ] && data[ index ].stop ) {
  6515. stopQueue( data[ index ] );
  6516. }
  6517. } else {
  6518. for ( index in data ) {
  6519. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  6520. stopQueue( data[ index ] );
  6521. }
  6522. }
  6523. }
  6524. for ( index = timers.length; index--; ) {
  6525. if ( timers[ index ].elem === this &&
  6526. ( type == null || timers[ index ].queue === type ) ) {
  6527. timers[ index ].anim.stop( gotoEnd );
  6528. dequeue = false;
  6529. timers.splice( index, 1 );
  6530. }
  6531. }
  6532. // start the next in the queue if the last step wasn't forced
  6533. // timers currently will call their complete callbacks, which will dequeue
  6534. // but only if they were gotoEnd
  6535. if ( dequeue || !gotoEnd ) {
  6536. jQuery.dequeue( this, type );
  6537. }
  6538. } );
  6539. },
  6540. finish: function( type ) {
  6541. if ( type !== false ) {
  6542. type = type || "fx";
  6543. }
  6544. return this.each( function() {
  6545. var index,
  6546. data = jQuery._data( this ),
  6547. queue = data[ type + "queue" ],
  6548. hooks = data[ type + "queueHooks" ],
  6549. timers = jQuery.timers,
  6550. length = queue ? queue.length : 0;
  6551. // enable finishing flag on private data
  6552. data.finish = true;
  6553. // empty the queue first
  6554. jQuery.queue( this, type, [] );
  6555. if ( hooks && hooks.stop ) {
  6556. hooks.stop.call( this, true );
  6557. }
  6558. // look for any active animations, and finish them
  6559. for ( index = timers.length; index--; ) {
  6560. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  6561. timers[ index ].anim.stop( true );
  6562. timers.splice( index, 1 );
  6563. }
  6564. }
  6565. // look for any animations in the old queue and finish them
  6566. for ( index = 0; index < length; index++ ) {
  6567. if ( queue[ index ] && queue[ index ].finish ) {
  6568. queue[ index ].finish.call( this );
  6569. }
  6570. }
  6571. // turn off finishing flag
  6572. delete data.finish;
  6573. } );
  6574. }
  6575. } );
  6576. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  6577. var cssFn = jQuery.fn[ name ];
  6578. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6579. return speed == null || typeof speed === "boolean" ?
  6580. cssFn.apply( this, arguments ) :
  6581. this.animate( genFx( name, true ), speed, easing, callback );
  6582. };
  6583. } );
  6584. // Generate shortcuts for custom animations
  6585. jQuery.each( {
  6586. slideDown: genFx( "show" ),
  6587. slideUp: genFx( "hide" ),
  6588. slideToggle: genFx( "toggle" ),
  6589. fadeIn: { opacity: "show" },
  6590. fadeOut: { opacity: "hide" },
  6591. fadeToggle: { opacity: "toggle" }
  6592. }, function( name, props ) {
  6593. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6594. return this.animate( props, speed, easing, callback );
  6595. };
  6596. } );
  6597. jQuery.timers = [];
  6598. jQuery.fx.tick = function() {
  6599. var timer,
  6600. timers = jQuery.timers,
  6601. i = 0;
  6602. fxNow = jQuery.now();
  6603. for ( ; i < timers.length; i++ ) {
  6604. timer = timers[ i ];
  6605. // Checks the timer has not already been removed
  6606. if ( !timer() && timers[ i ] === timer ) {
  6607. timers.splice( i--, 1 );
  6608. }
  6609. }
  6610. if ( !timers.length ) {
  6611. jQuery.fx.stop();
  6612. }
  6613. fxNow = undefined;
  6614. };
  6615. jQuery.fx.timer = function( timer ) {
  6616. jQuery.timers.push( timer );
  6617. if ( timer() ) {
  6618. jQuery.fx.start();
  6619. } else {
  6620. jQuery.timers.pop();
  6621. }
  6622. };
  6623. jQuery.fx.interval = 13;
  6624. jQuery.fx.start = function() {
  6625. if ( !timerId ) {
  6626. timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
  6627. }
  6628. };
  6629. jQuery.fx.stop = function() {
  6630. window.clearInterval( timerId );
  6631. timerId = null;
  6632. };
  6633. jQuery.fx.speeds = {
  6634. slow: 600,
  6635. fast: 200,
  6636. // Default speed
  6637. _default: 400
  6638. };
  6639. // Based off of the plugin by Clint Helfers, with permission.
  6640. // http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  6641. jQuery.fn.delay = function( time, type ) {
  6642. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  6643. type = type || "fx";
  6644. return this.queue( type, function( next, hooks ) {
  6645. var timeout = window.setTimeout( next, time );
  6646. hooks.stop = function() {
  6647. window.clearTimeout( timeout );
  6648. };
  6649. } );
  6650. };
  6651. ( function() {
  6652. var a,
  6653. input = document.createElement( "input" ),
  6654. div = document.createElement( "div" ),
  6655. select = document.createElement( "select" ),
  6656. opt = select.appendChild( document.createElement( "option" ) );
  6657. // Setup
  6658. div = document.createElement( "div" );
  6659. div.setAttribute( "className", "t" );
  6660. div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
  6661. a = div.getElementsByTagName( "a" )[ 0 ];
  6662. // Support: Windows Web Apps (WWA)
  6663. // `type` must use .setAttribute for WWA (#14901)
  6664. input.setAttribute( "type", "checkbox" );
  6665. div.appendChild( input );
  6666. a = div.getElementsByTagName( "a" )[ 0 ];
  6667. // First batch of tests.
  6668. a.style.cssText = "top:1px";
  6669. // Test setAttribute on camelCase class.
  6670. // If it works, we need attrFixes when doing get/setAttribute (ie6/7)
  6671. support.getSetAttribute = div.className !== "t";
  6672. // Get the style information from getAttribute
  6673. // (IE uses .cssText instead)
  6674. support.style = /top/.test( a.getAttribute( "style" ) );
  6675. // Make sure that URLs aren't manipulated
  6676. // (IE normalizes it by default)
  6677. support.hrefNormalized = a.getAttribute( "href" ) === "/a";
  6678. // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
  6679. support.checkOn = !!input.value;
  6680. // Make sure that a selected-by-default option has a working selected property.
  6681. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
  6682. support.optSelected = opt.selected;
  6683. // Tests for enctype support on a form (#6743)
  6684. support.enctype = !!document.createElement( "form" ).enctype;
  6685. // Make sure that the options inside disabled selects aren't marked as disabled
  6686. // (WebKit marks them as disabled)
  6687. select.disabled = true;
  6688. support.optDisabled = !opt.disabled;
  6689. // Support: IE8 only
  6690. // Check if we can trust getAttribute("value")
  6691. input = document.createElement( "input" );
  6692. input.setAttribute( "value", "" );
  6693. support.input = input.getAttribute( "value" ) === "";
  6694. // Check if an input maintains its value after becoming a radio
  6695. input.value = "t";
  6696. input.setAttribute( "type", "radio" );
  6697. support.radioValue = input.value === "t";
  6698. } )();
  6699. var rreturn = /\r/g;
  6700. jQuery.fn.extend( {
  6701. val: function( value ) {
  6702. var hooks, ret, isFunction,
  6703. elem = this[ 0 ];
  6704. if ( !arguments.length ) {
  6705. if ( elem ) {
  6706. hooks = jQuery.valHooks[ elem.type ] ||
  6707. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  6708. if (
  6709. hooks &&
  6710. "get" in hooks &&
  6711. ( ret = hooks.get( elem, "value" ) ) !== undefined
  6712. ) {
  6713. return ret;
  6714. }
  6715. ret = elem.value;
  6716. return typeof ret === "string" ?
  6717. // handle most common string cases
  6718. ret.replace( rreturn, "" ) :
  6719. // handle cases where value is null/undef or number
  6720. ret == null ? "" : ret;
  6721. }
  6722. return;
  6723. }
  6724. isFunction = jQuery.isFunction( value );
  6725. return this.each( function( i ) {
  6726. var val;
  6727. if ( this.nodeType !== 1 ) {
  6728. return;
  6729. }
  6730. if ( isFunction ) {
  6731. val = value.call( this, i, jQuery( this ).val() );
  6732. } else {
  6733. val = value;
  6734. }
  6735. // Treat null/undefined as ""; convert numbers to string
  6736. if ( val == null ) {
  6737. val = "";
  6738. } else if ( typeof val === "number" ) {
  6739. val += "";
  6740. } else if ( jQuery.isArray( val ) ) {
  6741. val = jQuery.map( val, function( value ) {
  6742. return value == null ? "" : value + "";
  6743. } );
  6744. }
  6745. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  6746. // If set returns undefined, fall back to normal setting
  6747. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  6748. this.value = val;
  6749. }
  6750. } );
  6751. }
  6752. } );
  6753. jQuery.extend( {
  6754. valHooks: {
  6755. option: {
  6756. get: function( elem ) {
  6757. var val = jQuery.find.attr( elem, "value" );
  6758. return val != null ?
  6759. val :
  6760. // Support: IE10-11+
  6761. // option.text throws exceptions (#14686, #14858)
  6762. jQuery.trim( jQuery.text( elem ) );
  6763. }
  6764. },
  6765. select: {
  6766. get: function( elem ) {
  6767. var value, option,
  6768. options = elem.options,
  6769. index = elem.selectedIndex,
  6770. one = elem.type === "select-one" || index < 0,
  6771. values = one ? null : [],
  6772. max = one ? index + 1 : options.length,
  6773. i = index < 0 ?
  6774. max :
  6775. one ? index : 0;
  6776. // Loop through all the selected options
  6777. for ( ; i < max; i++ ) {
  6778. option = options[ i ];
  6779. // oldIE doesn't update selected after form reset (#2551)
  6780. if ( ( option.selected || i === index ) &&
  6781. // Don't return options that are disabled or in a disabled optgroup
  6782. ( support.optDisabled ?
  6783. !option.disabled :
  6784. option.getAttribute( "disabled" ) === null ) &&
  6785. ( !option.parentNode.disabled ||
  6786. !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
  6787. // Get the specific value for the option
  6788. value = jQuery( option ).val();
  6789. // We don't need an array for one selects
  6790. if ( one ) {
  6791. return value;
  6792. }
  6793. // Multi-Selects return an array
  6794. values.push( value );
  6795. }
  6796. }
  6797. return values;
  6798. },
  6799. set: function( elem, value ) {
  6800. var optionSet, option,
  6801. options = elem.options,
  6802. values = jQuery.makeArray( value ),
  6803. i = options.length;
  6804. while ( i-- ) {
  6805. option = options[ i ];
  6806. if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) {
  6807. // Support: IE6
  6808. // When new option element is added to select box we need to
  6809. // force reflow of newly added node in order to workaround delay
  6810. // of initialization properties
  6811. try {
  6812. option.selected = optionSet = true;
  6813. } catch ( _ ) {
  6814. // Will be executed only in IE6
  6815. option.scrollHeight;
  6816. }
  6817. } else {
  6818. option.selected = false;
  6819. }
  6820. }
  6821. // Force browsers to behave consistently when non-matching value is set
  6822. if ( !optionSet ) {
  6823. elem.selectedIndex = -1;
  6824. }
  6825. return options;
  6826. }
  6827. }
  6828. }
  6829. } );
  6830. // Radios and checkboxes getter/setter
  6831. jQuery.each( [ "radio", "checkbox" ], function() {
  6832. jQuery.valHooks[ this ] = {
  6833. set: function( elem, value ) {
  6834. if ( jQuery.isArray( value ) ) {
  6835. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  6836. }
  6837. }
  6838. };
  6839. if ( !support.checkOn ) {
  6840. jQuery.valHooks[ this ].get = function( elem ) {
  6841. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  6842. };
  6843. }
  6844. } );
  6845. var nodeHook, boolHook,
  6846. attrHandle = jQuery.expr.attrHandle,
  6847. ruseDefault = /^(?:checked|selected)$/i,
  6848. getSetAttribute = support.getSetAttribute,
  6849. getSetInput = support.input;
  6850. jQuery.fn.extend( {
  6851. attr: function( name, value ) {
  6852. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  6853. },
  6854. removeAttr: function( name ) {
  6855. return this.each( function() {
  6856. jQuery.removeAttr( this, name );
  6857. } );
  6858. }
  6859. } );
  6860. jQuery.extend( {
  6861. attr: function( elem, name, value ) {
  6862. var ret, hooks,
  6863. nType = elem.nodeType;
  6864. // Don't get/set attributes on text, comment and attribute nodes
  6865. if ( nType === 3 || nType === 8 || nType === 2 ) {
  6866. return;
  6867. }
  6868. // Fallback to prop when attributes are not supported
  6869. if ( typeof elem.getAttribute === "undefined" ) {
  6870. return jQuery.prop( elem, name, value );
  6871. }
  6872. // All attributes are lowercase
  6873. // Grab necessary hook if one is defined
  6874. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6875. name = name.toLowerCase();
  6876. hooks = jQuery.attrHooks[ name ] ||
  6877. ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
  6878. }
  6879. if ( value !== undefined ) {
  6880. if ( value === null ) {
  6881. jQuery.removeAttr( elem, name );
  6882. return;
  6883. }
  6884. if ( hooks && "set" in hooks &&
  6885. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  6886. return ret;
  6887. }
  6888. elem.setAttribute( name, value + "" );
  6889. return value;
  6890. }
  6891. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  6892. return ret;
  6893. }
  6894. ret = jQuery.find.attr( elem, name );
  6895. // Non-existent attributes return null, we normalize to undefined
  6896. return ret == null ? undefined : ret;
  6897. },
  6898. attrHooks: {
  6899. type: {
  6900. set: function( elem, value ) {
  6901. if ( !support.radioValue && value === "radio" &&
  6902. jQuery.nodeName( elem, "input" ) ) {
  6903. // Setting the type on a radio button after the value resets the value in IE8-9
  6904. // Reset value to default in case type is set after value during creation
  6905. var val = elem.value;
  6906. elem.setAttribute( "type", value );
  6907. if ( val ) {
  6908. elem.value = val;
  6909. }
  6910. return value;
  6911. }
  6912. }
  6913. }
  6914. },
  6915. removeAttr: function( elem, value ) {
  6916. var name, propName,
  6917. i = 0,
  6918. attrNames = value && value.match( rnotwhite );
  6919. if ( attrNames && elem.nodeType === 1 ) {
  6920. while ( ( name = attrNames[ i++ ] ) ) {
  6921. propName = jQuery.propFix[ name ] || name;
  6922. // Boolean attributes get special treatment (#10870)
  6923. if ( jQuery.expr.match.bool.test( name ) ) {
  6924. // Set corresponding property to false
  6925. if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
  6926. elem[ propName ] = false;
  6927. // Support: IE<9
  6928. // Also clear defaultChecked/defaultSelected (if appropriate)
  6929. } else {
  6930. elem[ jQuery.camelCase( "default-" + name ) ] =
  6931. elem[ propName ] = false;
  6932. }
  6933. // See #9699 for explanation of this approach (setting first, then removal)
  6934. } else {
  6935. jQuery.attr( elem, name, "" );
  6936. }
  6937. elem.removeAttribute( getSetAttribute ? name : propName );
  6938. }
  6939. }
  6940. }
  6941. } );
  6942. // Hooks for boolean attributes
  6943. boolHook = {
  6944. set: function( elem, value, name ) {
  6945. if ( value === false ) {
  6946. // Remove boolean attributes when set to false
  6947. jQuery.removeAttr( elem, name );
  6948. } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
  6949. // IE<8 needs the *property* name
  6950. elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
  6951. } else {
  6952. // Support: IE<9
  6953. // Use defaultChecked and defaultSelected for oldIE
  6954. elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
  6955. }
  6956. return name;
  6957. }
  6958. };
  6959. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  6960. var getter = attrHandle[ name ] || jQuery.find.attr;
  6961. if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
  6962. attrHandle[ name ] = function( elem, name, isXML ) {
  6963. var ret, handle;
  6964. if ( !isXML ) {
  6965. // Avoid an infinite loop by temporarily removing this function from the getter
  6966. handle = attrHandle[ name ];
  6967. attrHandle[ name ] = ret;
  6968. ret = getter( elem, name, isXML ) != null ?
  6969. name.toLowerCase() :
  6970. null;
  6971. attrHandle[ name ] = handle;
  6972. }
  6973. return ret;
  6974. };
  6975. } else {
  6976. attrHandle[ name ] = function( elem, name, isXML ) {
  6977. if ( !isXML ) {
  6978. return elem[ jQuery.camelCase( "default-" + name ) ] ?
  6979. name.toLowerCase() :
  6980. null;
  6981. }
  6982. };
  6983. }
  6984. } );
  6985. // fix oldIE attroperties
  6986. if ( !getSetInput || !getSetAttribute ) {
  6987. jQuery.attrHooks.value = {
  6988. set: function( elem, value, name ) {
  6989. if ( jQuery.nodeName( elem, "input" ) ) {
  6990. // Does not return so that setAttribute is also used
  6991. elem.defaultValue = value;
  6992. } else {
  6993. // Use nodeHook if defined (#1954); otherwise setAttribute is fine
  6994. return nodeHook && nodeHook.set( elem, value, name );
  6995. }
  6996. }
  6997. };
  6998. }
  6999. // IE6/7 do not support getting/setting some attributes with get/setAttribute
  7000. if ( !getSetAttribute ) {
  7001. // Use this for any attribute in IE6/7
  7002. // This fixes almost every IE6/7 issue
  7003. nodeHook = {
  7004. set: function( elem, value, name ) {
  7005. // Set the existing or create a new attribute node
  7006. var ret = elem.getAttributeNode( name );
  7007. if ( !ret ) {
  7008. elem.setAttributeNode(
  7009. ( ret = elem.ownerDocument.createAttribute( name ) )
  7010. );
  7011. }
  7012. ret.value = value += "";
  7013. // Break association with cloned elements by also using setAttribute (#9646)
  7014. if ( name === "value" || value === elem.getAttribute( name ) ) {
  7015. return value;
  7016. }
  7017. }
  7018. };
  7019. // Some attributes are constructed with empty-string values when not defined
  7020. attrHandle.id = attrHandle.name = attrHandle.coords =
  7021. function( elem, name, isXML ) {
  7022. var ret;
  7023. if ( !isXML ) {
  7024. return ( ret = elem.getAttributeNode( name ) ) && ret.value !== "" ?
  7025. ret.value :
  7026. null;
  7027. }
  7028. };
  7029. // Fixing value retrieval on a button requires this module
  7030. jQuery.valHooks.button = {
  7031. get: function( elem, name ) {
  7032. var ret = elem.getAttributeNode( name );
  7033. if ( ret && ret.specified ) {
  7034. return ret.value;
  7035. }
  7036. },
  7037. set: nodeHook.set
  7038. };
  7039. // Set contenteditable to false on removals(#10429)
  7040. // Setting to empty string throws an error as an invalid value
  7041. jQuery.attrHooks.contenteditable = {
  7042. set: function( elem, value, name ) {
  7043. nodeHook.set( elem, value === "" ? false : value, name );
  7044. }
  7045. };
  7046. // Set width and height to auto instead of 0 on empty string( Bug #8150 )
  7047. // This is for removals
  7048. jQuery.each( [ "width", "height" ], function( i, name ) {
  7049. jQuery.attrHooks[ name ] = {
  7050. set: function( elem, value ) {
  7051. if ( value === "" ) {
  7052. elem.setAttribute( name, "auto" );
  7053. return value;
  7054. }
  7055. }
  7056. };
  7057. } );
  7058. }
  7059. if ( !support.style ) {
  7060. jQuery.attrHooks.style = {
  7061. get: function( elem ) {
  7062. // Return undefined in the case of empty string
  7063. // Note: IE uppercases css property names, but if we were to .toLowerCase()
  7064. // .cssText, that would destroy case sensitivity in URL's, like in "background"
  7065. return elem.style.cssText || undefined;
  7066. },
  7067. set: function( elem, value ) {
  7068. return ( elem.style.cssText = value + "" );
  7069. }
  7070. };
  7071. }
  7072. var rfocusable = /^(?:input|select|textarea|button|object)$/i,
  7073. rclickable = /^(?:a|area)$/i;
  7074. jQuery.fn.extend( {
  7075. prop: function( name, value ) {
  7076. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  7077. },
  7078. removeProp: function( name ) {
  7079. name = jQuery.propFix[ name ] || name;
  7080. return this.each( function() {
  7081. // try/catch handles cases where IE balks (such as removing a property on window)
  7082. try {
  7083. this[ name ] = undefined;
  7084. delete this[ name ];
  7085. } catch ( e ) {}
  7086. } );
  7087. }
  7088. } );
  7089. jQuery.extend( {
  7090. prop: function( elem, name, value ) {
  7091. var ret, hooks,
  7092. nType = elem.nodeType;
  7093. // Don't get/set properties on text, comment and attribute nodes
  7094. if ( nType === 3 || nType === 8 || nType === 2 ) {
  7095. return;
  7096. }
  7097. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  7098. // Fix name and attach hooks
  7099. name = jQuery.propFix[ name ] || name;
  7100. hooks = jQuery.propHooks[ name ];
  7101. }
  7102. if ( value !== undefined ) {
  7103. if ( hooks && "set" in hooks &&
  7104. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  7105. return ret;
  7106. }
  7107. return ( elem[ name ] = value );
  7108. }
  7109. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  7110. return ret;
  7111. }
  7112. return elem[ name ];
  7113. },
  7114. propHooks: {
  7115. tabIndex: {
  7116. get: function( elem ) {
  7117. // elem.tabIndex doesn't always return the
  7118. // correct value when it hasn't been explicitly set
  7119. // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  7120. // Use proper attribute retrieval(#12072)
  7121. var tabindex = jQuery.find.attr( elem, "tabindex" );
  7122. return tabindex ?
  7123. parseInt( tabindex, 10 ) :
  7124. rfocusable.test( elem.nodeName ) ||
  7125. rclickable.test( elem.nodeName ) && elem.href ?
  7126. 0 :
  7127. -1;
  7128. }
  7129. }
  7130. },
  7131. propFix: {
  7132. "for": "htmlFor",
  7133. "class": "className"
  7134. }
  7135. } );
  7136. // Some attributes require a special call on IE
  7137. // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  7138. if ( !support.hrefNormalized ) {
  7139. // href/src property should get the full normalized URL (#10299/#12915)
  7140. jQuery.each( [ "href", "src" ], function( i, name ) {
  7141. jQuery.propHooks[ name ] = {
  7142. get: function( elem ) {
  7143. return elem.getAttribute( name, 4 );
  7144. }
  7145. };
  7146. } );
  7147. }
  7148. // Support: Safari, IE9+
  7149. // mis-reports the default selected property of an option
  7150. // Accessing the parent's selectedIndex property fixes it
  7151. if ( !support.optSelected ) {
  7152. jQuery.propHooks.selected = {
  7153. get: function( elem ) {
  7154. var parent = elem.parentNode;
  7155. if ( parent ) {
  7156. parent.selectedIndex;
  7157. // Make sure that it also works with optgroups, see #5701
  7158. if ( parent.parentNode ) {
  7159. parent.parentNode.selectedIndex;
  7160. }
  7161. }
  7162. return null;
  7163. }
  7164. };
  7165. }
  7166. jQuery.each( [
  7167. "tabIndex",
  7168. "readOnly",
  7169. "maxLength",
  7170. "cellSpacing",
  7171. "cellPadding",
  7172. "rowSpan",
  7173. "colSpan",
  7174. "useMap",
  7175. "frameBorder",
  7176. "contentEditable"
  7177. ], function() {
  7178. jQuery.propFix[ this.toLowerCase() ] = this;
  7179. } );
  7180. // IE6/7 call enctype encoding
  7181. if ( !support.enctype ) {
  7182. jQuery.propFix.enctype = "encoding";
  7183. }
  7184. var rclass = /[\t\r\n\f]/g;
  7185. function getClass( elem ) {
  7186. return jQuery.attr( elem, "class" ) || "";
  7187. }
  7188. jQuery.fn.extend( {
  7189. addClass: function( value ) {
  7190. var classes, elem, cur, curValue, clazz, j, finalValue,
  7191. i = 0;
  7192. if ( jQuery.isFunction( value ) ) {
  7193. return this.each( function( j ) {
  7194. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  7195. } );
  7196. }
  7197. if ( typeof value === "string" && value ) {
  7198. classes = value.match( rnotwhite ) || [];
  7199. while ( ( elem = this[ i++ ] ) ) {
  7200. curValue = getClass( elem );
  7201. cur = elem.nodeType === 1 &&
  7202. ( " " + curValue + " " ).replace( rclass, " " );
  7203. if ( cur ) {
  7204. j = 0;
  7205. while ( ( clazz = classes[ j++ ] ) ) {
  7206. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  7207. cur += clazz + " ";
  7208. }
  7209. }
  7210. // only assign if different to avoid unneeded rendering.
  7211. finalValue = jQuery.trim( cur );
  7212. if ( curValue !== finalValue ) {
  7213. jQuery.attr( elem, "class", finalValue );
  7214. }
  7215. }
  7216. }
  7217. }
  7218. return this;
  7219. },
  7220. removeClass: function( value ) {
  7221. var classes, elem, cur, curValue, clazz, j, finalValue,
  7222. i = 0;
  7223. if ( jQuery.isFunction( value ) ) {
  7224. return this.each( function( j ) {
  7225. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  7226. } );
  7227. }
  7228. if ( !arguments.length ) {
  7229. return this.attr( "class", "" );
  7230. }
  7231. if ( typeof value === "string" && value ) {
  7232. classes = value.match( rnotwhite ) || [];
  7233. while ( ( elem = this[ i++ ] ) ) {
  7234. curValue = getClass( elem );
  7235. // This expression is here for better compressibility (see addClass)
  7236. cur = elem.nodeType === 1 &&
  7237. ( " " + curValue + " " ).replace( rclass, " " );
  7238. if ( cur ) {
  7239. j = 0;
  7240. while ( ( clazz = classes[ j++ ] ) ) {
  7241. // Remove *all* instances
  7242. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  7243. cur = cur.replace( " " + clazz + " ", " " );
  7244. }
  7245. }
  7246. // Only assign if different to avoid unneeded rendering.
  7247. finalValue = jQuery.trim( cur );
  7248. if ( curValue !== finalValue ) {
  7249. jQuery.attr( elem, "class", finalValue );
  7250. }
  7251. }
  7252. }
  7253. }
  7254. return this;
  7255. },
  7256. toggleClass: function( value, stateVal ) {
  7257. var type = typeof value;
  7258. if ( typeof stateVal === "boolean" && type === "string" ) {
  7259. return stateVal ? this.addClass( value ) : this.removeClass( value );
  7260. }
  7261. if ( jQuery.isFunction( value ) ) {
  7262. return this.each( function( i ) {
  7263. jQuery( this ).toggleClass(
  7264. value.call( this, i, getClass( this ), stateVal ),
  7265. stateVal
  7266. );
  7267. } );
  7268. }
  7269. return this.each( function() {
  7270. var className, i, self, classNames;
  7271. if ( type === "string" ) {
  7272. // Toggle individual class names
  7273. i = 0;
  7274. self = jQuery( this );
  7275. classNames = value.match( rnotwhite ) || [];
  7276. while ( ( className = classNames[ i++ ] ) ) {
  7277. // Check each className given, space separated list
  7278. if ( self.hasClass( className ) ) {
  7279. self.removeClass( className );
  7280. } else {
  7281. self.addClass( className );
  7282. }
  7283. }
  7284. // Toggle whole class name
  7285. } else if ( value === undefined || type === "boolean" ) {
  7286. className = getClass( this );
  7287. if ( className ) {
  7288. // store className if set
  7289. jQuery._data( this, "__className__", className );
  7290. }
  7291. // If the element has a class name or if we're passed "false",
  7292. // then remove the whole classname (if there was one, the above saved it).
  7293. // Otherwise bring back whatever was previously saved (if anything),
  7294. // falling back to the empty string if nothing was stored.
  7295. jQuery.attr( this, "class",
  7296. className || value === false ?
  7297. "" :
  7298. jQuery._data( this, "__className__" ) || ""
  7299. );
  7300. }
  7301. } );
  7302. },
  7303. hasClass: function( selector ) {
  7304. var className, elem,
  7305. i = 0;
  7306. className = " " + selector + " ";
  7307. while ( ( elem = this[ i++ ] ) ) {
  7308. if ( elem.nodeType === 1 &&
  7309. ( " " + getClass( elem ) + " " ).replace( rclass, " " )
  7310. .indexOf( className ) > -1
  7311. ) {
  7312. return true;
  7313. }
  7314. }
  7315. return false;
  7316. }
  7317. } );
  7318. // Return jQuery for attributes-only inclusion
  7319. jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " +
  7320. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  7321. "change select submit keydown keypress keyup error contextmenu" ).split( " " ),
  7322. function( i, name ) {
  7323. // Handle event binding
  7324. jQuery.fn[ name ] = function( data, fn ) {
  7325. return arguments.length > 0 ?
  7326. this.on( name, null, data, fn ) :
  7327. this.trigger( name );
  7328. };
  7329. } );
  7330. jQuery.fn.extend( {
  7331. hover: function( fnOver, fnOut ) {
  7332. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  7333. }
  7334. } );
  7335. var location = window.location;
  7336. var nonce = jQuery.now();
  7337. var rquery = ( /\?/ );
  7338. var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
  7339. jQuery.parseJSON = function( data ) {
  7340. // Attempt to parse using the native JSON parser first
  7341. if ( window.JSON && window.JSON.parse ) {
  7342. // Support: Android 2.3
  7343. // Workaround failure to string-cast null input
  7344. return window.JSON.parse( data + "" );
  7345. }
  7346. var requireNonComma,
  7347. depth = null,
  7348. str = jQuery.trim( data + "" );
  7349. // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
  7350. // after removing valid tokens
  7351. return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {
  7352. // Force termination if we see a misplaced comma
  7353. if ( requireNonComma && comma ) {
  7354. depth = 0;
  7355. }
  7356. // Perform no more replacements after returning to outermost depth
  7357. if ( depth === 0 ) {
  7358. return token;
  7359. }
  7360. // Commas must not follow "[", "{", or ","
  7361. requireNonComma = open || comma;
  7362. // Determine new depth
  7363. // array/object open ("[" or "{"): depth += true - false (increment)
  7364. // array/object close ("]" or "}"): depth += false - true (decrement)
  7365. // other cases ("," or primitive): depth += true - true (numeric cast)
  7366. depth += !close - !open;
  7367. // Remove this token
  7368. return "";
  7369. } ) ) ?
  7370. ( Function( "return " + str ) )() :
  7371. jQuery.error( "Invalid JSON: " + data );
  7372. };
  7373. // Cross-browser xml parsing
  7374. jQuery.parseXML = function( data ) {
  7375. var xml, tmp;
  7376. if ( !data || typeof data !== "string" ) {
  7377. return null;
  7378. }
  7379. try {
  7380. if ( window.DOMParser ) { // Standard
  7381. tmp = new window.DOMParser();
  7382. xml = tmp.parseFromString( data, "text/xml" );
  7383. } else { // IE
  7384. xml = new window.ActiveXObject( "Microsoft.XMLDOM" );
  7385. xml.async = "false";
  7386. xml.loadXML( data );
  7387. }
  7388. } catch ( e ) {
  7389. xml = undefined;
  7390. }
  7391. if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
  7392. jQuery.error( "Invalid XML: " + data );
  7393. }
  7394. return xml;
  7395. };
  7396. var
  7397. rhash = /#.*$/,
  7398. rts = /([?&])_=[^&]*/,
  7399. // IE leaves an \r character at EOL
  7400. rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg,
  7401. // #7653, #8125, #8152: local protocol detection
  7402. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  7403. rnoContent = /^(?:GET|HEAD)$/,
  7404. rprotocol = /^\/\//,
  7405. rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
  7406. /* Prefilters
  7407. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  7408. * 2) These are called:
  7409. * - BEFORE asking for a transport
  7410. * - AFTER param serialization (s.data is a string if s.processData is true)
  7411. * 3) key is the dataType
  7412. * 4) the catchall symbol "*" can be used
  7413. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  7414. */
  7415. prefilters = {},
  7416. /* Transports bindings
  7417. * 1) key is the dataType
  7418. * 2) the catchall symbol "*" can be used
  7419. * 3) selection will start with transport dataType and THEN go to "*" if needed
  7420. */
  7421. transports = {},
  7422. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  7423. allTypes = "*/".concat( "*" ),
  7424. // Document location
  7425. ajaxLocation = location.href,
  7426. // Segment location into parts
  7427. ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
  7428. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  7429. function addToPrefiltersOrTransports( structure ) {
  7430. // dataTypeExpression is optional and defaults to "*"
  7431. return function( dataTypeExpression, func ) {
  7432. if ( typeof dataTypeExpression !== "string" ) {
  7433. func = dataTypeExpression;
  7434. dataTypeExpression = "*";
  7435. }
  7436. var dataType,
  7437. i = 0,
  7438. dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
  7439. if ( jQuery.isFunction( func ) ) {
  7440. // For each dataType in the dataTypeExpression
  7441. while ( ( dataType = dataTypes[ i++ ] ) ) {
  7442. // Prepend if requested
  7443. if ( dataType.charAt( 0 ) === "+" ) {
  7444. dataType = dataType.slice( 1 ) || "*";
  7445. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  7446. // Otherwise append
  7447. } else {
  7448. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  7449. }
  7450. }
  7451. }
  7452. };
  7453. }
  7454. // Base inspection function for prefilters and transports
  7455. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  7456. var inspected = {},
  7457. seekingTransport = ( structure === transports );
  7458. function inspect( dataType ) {
  7459. var selected;
  7460. inspected[ dataType ] = true;
  7461. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  7462. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  7463. if ( typeof dataTypeOrTransport === "string" &&
  7464. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  7465. options.dataTypes.unshift( dataTypeOrTransport );
  7466. inspect( dataTypeOrTransport );
  7467. return false;
  7468. } else if ( seekingTransport ) {
  7469. return !( selected = dataTypeOrTransport );
  7470. }
  7471. } );
  7472. return selected;
  7473. }
  7474. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  7475. }
  7476. // A special extend for ajax options
  7477. // that takes "flat" options (not to be deep extended)
  7478. // Fixes #9887
  7479. function ajaxExtend( target, src ) {
  7480. var deep, key,
  7481. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  7482. for ( key in src ) {
  7483. if ( src[ key ] !== undefined ) {
  7484. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  7485. }
  7486. }
  7487. if ( deep ) {
  7488. jQuery.extend( true, target, deep );
  7489. }
  7490. return target;
  7491. }
  7492. /* Handles responses to an ajax request:
  7493. * - finds the right dataType (mediates between content-type and expected dataType)
  7494. * - returns the corresponding response
  7495. */
  7496. function ajaxHandleResponses( s, jqXHR, responses ) {
  7497. var firstDataType, ct, finalDataType, type,
  7498. contents = s.contents,
  7499. dataTypes = s.dataTypes;
  7500. // Remove auto dataType and get content-type in the process
  7501. while ( dataTypes[ 0 ] === "*" ) {
  7502. dataTypes.shift();
  7503. if ( ct === undefined ) {
  7504. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  7505. }
  7506. }
  7507. // Check if we're dealing with a known content-type
  7508. if ( ct ) {
  7509. for ( type in contents ) {
  7510. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  7511. dataTypes.unshift( type );
  7512. break;
  7513. }
  7514. }
  7515. }
  7516. // Check to see if we have a response for the expected dataType
  7517. if ( dataTypes[ 0 ] in responses ) {
  7518. finalDataType = dataTypes[ 0 ];
  7519. } else {
  7520. // Try convertible dataTypes
  7521. for ( type in responses ) {
  7522. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  7523. finalDataType = type;
  7524. break;
  7525. }
  7526. if ( !firstDataType ) {
  7527. firstDataType = type;
  7528. }
  7529. }
  7530. // Or just use first one
  7531. finalDataType = finalDataType || firstDataType;
  7532. }
  7533. // If we found a dataType
  7534. // We add the dataType to the list if needed
  7535. // and return the corresponding response
  7536. if ( finalDataType ) {
  7537. if ( finalDataType !== dataTypes[ 0 ] ) {
  7538. dataTypes.unshift( finalDataType );
  7539. }
  7540. return responses[ finalDataType ];
  7541. }
  7542. }
  7543. /* Chain conversions given the request and the original response
  7544. * Also sets the responseXXX fields on the jqXHR instance
  7545. */
  7546. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  7547. var conv2, current, conv, tmp, prev,
  7548. converters = {},
  7549. // Work with a copy of dataTypes in case we need to modify it for conversion
  7550. dataTypes = s.dataTypes.slice();
  7551. // Create converters map with lowercased keys
  7552. if ( dataTypes[ 1 ] ) {
  7553. for ( conv in s.converters ) {
  7554. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  7555. }
  7556. }
  7557. current = dataTypes.shift();
  7558. // Convert to each sequential dataType
  7559. while ( current ) {
  7560. if ( s.responseFields[ current ] ) {
  7561. jqXHR[ s.responseFields[ current ] ] = response;
  7562. }
  7563. // Apply the dataFilter if provided
  7564. if ( !prev && isSuccess && s.dataFilter ) {
  7565. response = s.dataFilter( response, s.dataType );
  7566. }
  7567. prev = current;
  7568. current = dataTypes.shift();
  7569. if ( current ) {
  7570. // There's only work to do if current dataType is non-auto
  7571. if ( current === "*" ) {
  7572. current = prev;
  7573. // Convert response if prev dataType is non-auto and differs from current
  7574. } else if ( prev !== "*" && prev !== current ) {
  7575. // Seek a direct converter
  7576. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  7577. // If none found, seek a pair
  7578. if ( !conv ) {
  7579. for ( conv2 in converters ) {
  7580. // If conv2 outputs current
  7581. tmp = conv2.split( " " );
  7582. if ( tmp[ 1 ] === current ) {
  7583. // If prev can be converted to accepted input
  7584. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  7585. converters[ "* " + tmp[ 0 ] ];
  7586. if ( conv ) {
  7587. // Condense equivalence converters
  7588. if ( conv === true ) {
  7589. conv = converters[ conv2 ];
  7590. // Otherwise, insert the intermediate dataType
  7591. } else if ( converters[ conv2 ] !== true ) {
  7592. current = tmp[ 0 ];
  7593. dataTypes.unshift( tmp[ 1 ] );
  7594. }
  7595. break;
  7596. }
  7597. }
  7598. }
  7599. }
  7600. // Apply converter (if not an equivalence)
  7601. if ( conv !== true ) {
  7602. // Unless errors are allowed to bubble, catch and return them
  7603. if ( conv && s[ "throws" ] ) { // jscs:ignore requireDotNotation
  7604. response = conv( response );
  7605. } else {
  7606. try {
  7607. response = conv( response );
  7608. } catch ( e ) {
  7609. return {
  7610. state: "parsererror",
  7611. error: conv ? e : "No conversion from " + prev + " to " + current
  7612. };
  7613. }
  7614. }
  7615. }
  7616. }
  7617. }
  7618. }
  7619. return { state: "success", data: response };
  7620. }
  7621. jQuery.extend( {
  7622. // Counter for holding the number of active queries
  7623. active: 0,
  7624. // Last-Modified header cache for next request
  7625. lastModified: {},
  7626. etag: {},
  7627. ajaxSettings: {
  7628. url: ajaxLocation,
  7629. type: "GET",
  7630. isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
  7631. global: true,
  7632. processData: true,
  7633. async: true,
  7634. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  7635. /*
  7636. timeout: 0,
  7637. data: null,
  7638. dataType: null,
  7639. username: null,
  7640. password: null,
  7641. cache: null,
  7642. throws: false,
  7643. traditional: false,
  7644. headers: {},
  7645. */
  7646. accepts: {
  7647. "*": allTypes,
  7648. text: "text/plain",
  7649. html: "text/html",
  7650. xml: "application/xml, text/xml",
  7651. json: "application/json, text/javascript"
  7652. },
  7653. contents: {
  7654. xml: /\bxml\b/,
  7655. html: /\bhtml/,
  7656. json: /\bjson\b/
  7657. },
  7658. responseFields: {
  7659. xml: "responseXML",
  7660. text: "responseText",
  7661. json: "responseJSON"
  7662. },
  7663. // Data converters
  7664. // Keys separate source (or catchall "*") and destination types with a single space
  7665. converters: {
  7666. // Convert anything to text
  7667. "* text": String,
  7668. // Text to html (true = no transformation)
  7669. "text html": true,
  7670. // Evaluate text as a json expression
  7671. "text json": jQuery.parseJSON,
  7672. // Parse text as xml
  7673. "text xml": jQuery.parseXML
  7674. },
  7675. // For options that shouldn't be deep extended:
  7676. // you can add your own custom options here if
  7677. // and when you create one that shouldn't be
  7678. // deep extended (see ajaxExtend)
  7679. flatOptions: {
  7680. url: true,
  7681. context: true
  7682. }
  7683. },
  7684. // Creates a full fledged settings object into target
  7685. // with both ajaxSettings and settings fields.
  7686. // If target is omitted, writes into ajaxSettings.
  7687. ajaxSetup: function( target, settings ) {
  7688. return settings ?
  7689. // Building a settings object
  7690. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  7691. // Extending ajaxSettings
  7692. ajaxExtend( jQuery.ajaxSettings, target );
  7693. },
  7694. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  7695. ajaxTransport: addToPrefiltersOrTransports( transports ),
  7696. // Main method
  7697. ajax: function( url, options ) {
  7698. // If url is an object, simulate pre-1.5 signature
  7699. if ( typeof url === "object" ) {
  7700. options = url;
  7701. url = undefined;
  7702. }
  7703. // Force options to be an object
  7704. options = options || {};
  7705. var
  7706. // Cross-domain detection vars
  7707. parts,
  7708. // Loop variable
  7709. i,
  7710. // URL without anti-cache param
  7711. cacheURL,
  7712. // Response headers as string
  7713. responseHeadersString,
  7714. // timeout handle
  7715. timeoutTimer,
  7716. // To know if global events are to be dispatched
  7717. fireGlobals,
  7718. transport,
  7719. // Response headers
  7720. responseHeaders,
  7721. // Create the final options object
  7722. s = jQuery.ajaxSetup( {}, options ),
  7723. // Callbacks context
  7724. callbackContext = s.context || s,
  7725. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  7726. globalEventContext = s.context &&
  7727. ( callbackContext.nodeType || callbackContext.jquery ) ?
  7728. jQuery( callbackContext ) :
  7729. jQuery.event,
  7730. // Deferreds
  7731. deferred = jQuery.Deferred(),
  7732. completeDeferred = jQuery.Callbacks( "once memory" ),
  7733. // Status-dependent callbacks
  7734. statusCode = s.statusCode || {},
  7735. // Headers (they are sent all at once)
  7736. requestHeaders = {},
  7737. requestHeadersNames = {},
  7738. // The jqXHR state
  7739. state = 0,
  7740. // Default abort message
  7741. strAbort = "canceled",
  7742. // Fake xhr
  7743. jqXHR = {
  7744. readyState: 0,
  7745. // Builds headers hashtable if needed
  7746. getResponseHeader: function( key ) {
  7747. var match;
  7748. if ( state === 2 ) {
  7749. if ( !responseHeaders ) {
  7750. responseHeaders = {};
  7751. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  7752. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  7753. }
  7754. }
  7755. match = responseHeaders[ key.toLowerCase() ];
  7756. }
  7757. return match == null ? null : match;
  7758. },
  7759. // Raw string
  7760. getAllResponseHeaders: function() {
  7761. return state === 2 ? responseHeadersString : null;
  7762. },
  7763. // Caches the header
  7764. setRequestHeader: function( name, value ) {
  7765. var lname = name.toLowerCase();
  7766. if ( !state ) {
  7767. name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
  7768. requestHeaders[ name ] = value;
  7769. }
  7770. return this;
  7771. },
  7772. // Overrides response content-type header
  7773. overrideMimeType: function( type ) {
  7774. if ( !state ) {
  7775. s.mimeType = type;
  7776. }
  7777. return this;
  7778. },
  7779. // Status-dependent callbacks
  7780. statusCode: function( map ) {
  7781. var code;
  7782. if ( map ) {
  7783. if ( state < 2 ) {
  7784. for ( code in map ) {
  7785. // Lazy-add the new callback in a way that preserves old ones
  7786. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  7787. }
  7788. } else {
  7789. // Execute the appropriate callbacks
  7790. jqXHR.always( map[ jqXHR.status ] );
  7791. }
  7792. }
  7793. return this;
  7794. },
  7795. // Cancel the request
  7796. abort: function( statusText ) {
  7797. var finalText = statusText || strAbort;
  7798. if ( transport ) {
  7799. transport.abort( finalText );
  7800. }
  7801. done( 0, finalText );
  7802. return this;
  7803. }
  7804. };
  7805. // Attach deferreds
  7806. deferred.promise( jqXHR ).complete = completeDeferred.add;
  7807. jqXHR.success = jqXHR.done;
  7808. jqXHR.error = jqXHR.fail;
  7809. // Remove hash character (#7531: and string promotion)
  7810. // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
  7811. // Handle falsy url in the settings object (#10093: consistency with old signature)
  7812. // We also use the url parameter if available
  7813. s.url = ( ( url || s.url || ajaxLocation ) + "" )
  7814. .replace( rhash, "" )
  7815. .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
  7816. // Alias method option to type as per ticket #12004
  7817. s.type = options.method || options.type || s.method || s.type;
  7818. // Extract dataTypes list
  7819. s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
  7820. // A cross-domain request is in order when we have a protocol:host:port mismatch
  7821. if ( s.crossDomain == null ) {
  7822. parts = rurl.exec( s.url.toLowerCase() );
  7823. s.crossDomain = !!( parts &&
  7824. ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
  7825. ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
  7826. ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
  7827. );
  7828. }
  7829. // Convert data if not already a string
  7830. if ( s.data && s.processData && typeof s.data !== "string" ) {
  7831. s.data = jQuery.param( s.data, s.traditional );
  7832. }
  7833. // Apply prefilters
  7834. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  7835. // If request was aborted inside a prefilter, stop there
  7836. if ( state === 2 ) {
  7837. return jqXHR;
  7838. }
  7839. // We can fire global events as of now if asked to
  7840. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  7841. fireGlobals = jQuery.event && s.global;
  7842. // Watch for a new set of requests
  7843. if ( fireGlobals && jQuery.active++ === 0 ) {
  7844. jQuery.event.trigger( "ajaxStart" );
  7845. }
  7846. // Uppercase the type
  7847. s.type = s.type.toUpperCase();
  7848. // Determine if request has content
  7849. s.hasContent = !rnoContent.test( s.type );
  7850. // Save the URL in case we're toying with the If-Modified-Since
  7851. // and/or If-None-Match header later on
  7852. cacheURL = s.url;
  7853. // More options handling for requests with no content
  7854. if ( !s.hasContent ) {
  7855. // If data is available, append data to url
  7856. if ( s.data ) {
  7857. cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
  7858. // #9682: remove data so that it's not used in an eventual retry
  7859. delete s.data;
  7860. }
  7861. // Add anti-cache in url if needed
  7862. if ( s.cache === false ) {
  7863. s.url = rts.test( cacheURL ) ?
  7864. // If there is already a '_' parameter, set its value
  7865. cacheURL.replace( rts, "$1_=" + nonce++ ) :
  7866. // Otherwise add one to the end
  7867. cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
  7868. }
  7869. }
  7870. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7871. if ( s.ifModified ) {
  7872. if ( jQuery.lastModified[ cacheURL ] ) {
  7873. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  7874. }
  7875. if ( jQuery.etag[ cacheURL ] ) {
  7876. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  7877. }
  7878. }
  7879. // Set the correct header, if data is being sent
  7880. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  7881. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  7882. }
  7883. // Set the Accepts header for the server, depending on the dataType
  7884. jqXHR.setRequestHeader(
  7885. "Accept",
  7886. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  7887. s.accepts[ s.dataTypes[ 0 ] ] +
  7888. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  7889. s.accepts[ "*" ]
  7890. );
  7891. // Check for headers option
  7892. for ( i in s.headers ) {
  7893. jqXHR.setRequestHeader( i, s.headers[ i ] );
  7894. }
  7895. // Allow custom headers/mimetypes and early abort
  7896. if ( s.beforeSend &&
  7897. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
  7898. // Abort if not done already and return
  7899. return jqXHR.abort();
  7900. }
  7901. // aborting is no longer a cancellation
  7902. strAbort = "abort";
  7903. // Install callbacks on deferreds
  7904. for ( i in { success: 1, error: 1, complete: 1 } ) {
  7905. jqXHR[ i ]( s[ i ] );
  7906. }
  7907. // Get transport
  7908. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  7909. // If no transport, we auto-abort
  7910. if ( !transport ) {
  7911. done( -1, "No Transport" );
  7912. } else {
  7913. jqXHR.readyState = 1;
  7914. // Send global event
  7915. if ( fireGlobals ) {
  7916. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  7917. }
  7918. // If request was aborted inside ajaxSend, stop there
  7919. if ( state === 2 ) {
  7920. return jqXHR;
  7921. }
  7922. // Timeout
  7923. if ( s.async && s.timeout > 0 ) {
  7924. timeoutTimer = window.setTimeout( function() {
  7925. jqXHR.abort( "timeout" );
  7926. }, s.timeout );
  7927. }
  7928. try {
  7929. state = 1;
  7930. transport.send( requestHeaders, done );
  7931. } catch ( e ) {
  7932. // Propagate exception as error if not done
  7933. if ( state < 2 ) {
  7934. done( -1, e );
  7935. // Simply rethrow otherwise
  7936. } else {
  7937. throw e;
  7938. }
  7939. }
  7940. }
  7941. // Callback for when everything is done
  7942. function done( status, nativeStatusText, responses, headers ) {
  7943. var isSuccess, success, error, response, modified,
  7944. statusText = nativeStatusText;
  7945. // Called once
  7946. if ( state === 2 ) {
  7947. return;
  7948. }
  7949. // State is "done" now
  7950. state = 2;
  7951. // Clear timeout if it exists
  7952. if ( timeoutTimer ) {
  7953. window.clearTimeout( timeoutTimer );
  7954. }
  7955. // Dereference transport for early garbage collection
  7956. // (no matter how long the jqXHR object will be used)
  7957. transport = undefined;
  7958. // Cache response headers
  7959. responseHeadersString = headers || "";
  7960. // Set readyState
  7961. jqXHR.readyState = status > 0 ? 4 : 0;
  7962. // Determine if successful
  7963. isSuccess = status >= 200 && status < 300 || status === 304;
  7964. // Get response data
  7965. if ( responses ) {
  7966. response = ajaxHandleResponses( s, jqXHR, responses );
  7967. }
  7968. // Convert no matter what (that way responseXXX fields are always set)
  7969. response = ajaxConvert( s, response, jqXHR, isSuccess );
  7970. // If successful, handle type chaining
  7971. if ( isSuccess ) {
  7972. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7973. if ( s.ifModified ) {
  7974. modified = jqXHR.getResponseHeader( "Last-Modified" );
  7975. if ( modified ) {
  7976. jQuery.lastModified[ cacheURL ] = modified;
  7977. }
  7978. modified = jqXHR.getResponseHeader( "etag" );
  7979. if ( modified ) {
  7980. jQuery.etag[ cacheURL ] = modified;
  7981. }
  7982. }
  7983. // if no content
  7984. if ( status === 204 || s.type === "HEAD" ) {
  7985. statusText = "nocontent";
  7986. // if not modified
  7987. } else if ( status === 304 ) {
  7988. statusText = "notmodified";
  7989. // If we have data, let's convert it
  7990. } else {
  7991. statusText = response.state;
  7992. success = response.data;
  7993. error = response.error;
  7994. isSuccess = !error;
  7995. }
  7996. } else {
  7997. // We extract error from statusText
  7998. // then normalize statusText and status for non-aborts
  7999. error = statusText;
  8000. if ( status || !statusText ) {
  8001. statusText = "error";
  8002. if ( status < 0 ) {
  8003. status = 0;
  8004. }
  8005. }
  8006. }
  8007. // Set data for the fake xhr object
  8008. jqXHR.status = status;
  8009. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  8010. // Success/Error
  8011. if ( isSuccess ) {
  8012. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  8013. } else {
  8014. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  8015. }
  8016. // Status-dependent callbacks
  8017. jqXHR.statusCode( statusCode );
  8018. statusCode = undefined;
  8019. if ( fireGlobals ) {
  8020. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  8021. [ jqXHR, s, isSuccess ? success : error ] );
  8022. }
  8023. // Complete
  8024. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  8025. if ( fireGlobals ) {
  8026. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  8027. // Handle the global AJAX counter
  8028. if ( !( --jQuery.active ) ) {
  8029. jQuery.event.trigger( "ajaxStop" );
  8030. }
  8031. }
  8032. }
  8033. return jqXHR;
  8034. },
  8035. getJSON: function( url, data, callback ) {
  8036. return jQuery.get( url, data, callback, "json" );
  8037. },
  8038. getScript: function( url, callback ) {
  8039. return jQuery.get( url, undefined, callback, "script" );
  8040. }
  8041. } );
  8042. jQuery.each( [ "get", "post" ], function( i, method ) {
  8043. jQuery[ method ] = function( url, data, callback, type ) {
  8044. // shift arguments if data argument was omitted
  8045. if ( jQuery.isFunction( data ) ) {
  8046. type = type || callback;
  8047. callback = data;
  8048. data = undefined;
  8049. }
  8050. // The url can be an options object (which then must have .url)
  8051. return jQuery.ajax( jQuery.extend( {
  8052. url: url,
  8053. type: method,
  8054. dataType: type,
  8055. data: data,
  8056. success: callback
  8057. }, jQuery.isPlainObject( url ) && url ) );
  8058. };
  8059. } );
  8060. jQuery._evalUrl = function( url ) {
  8061. return jQuery.ajax( {
  8062. url: url,
  8063. // Make this explicit, since user can override this through ajaxSetup (#11264)
  8064. type: "GET",
  8065. dataType: "script",
  8066. cache: true,
  8067. async: false,
  8068. global: false,
  8069. "throws": true
  8070. } );
  8071. };
  8072. jQuery.fn.extend( {
  8073. wrapAll: function( html ) {
  8074. if ( jQuery.isFunction( html ) ) {
  8075. return this.each( function( i ) {
  8076. jQuery( this ).wrapAll( html.call( this, i ) );
  8077. } );
  8078. }
  8079. if ( this[ 0 ] ) {
  8080. // The elements to wrap the target around
  8081. var wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  8082. if ( this[ 0 ].parentNode ) {
  8083. wrap.insertBefore( this[ 0 ] );
  8084. }
  8085. wrap.map( function() {
  8086. var elem = this;
  8087. while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
  8088. elem = elem.firstChild;
  8089. }
  8090. return elem;
  8091. } ).append( this );
  8092. }
  8093. return this;
  8094. },
  8095. wrapInner: function( html ) {
  8096. if ( jQuery.isFunction( html ) ) {
  8097. return this.each( function( i ) {
  8098. jQuery( this ).wrapInner( html.call( this, i ) );
  8099. } );
  8100. }
  8101. return this.each( function() {
  8102. var self = jQuery( this ),
  8103. contents = self.contents();
  8104. if ( contents.length ) {
  8105. contents.wrapAll( html );
  8106. } else {
  8107. self.append( html );
  8108. }
  8109. } );
  8110. },
  8111. wrap: function( html ) {
  8112. var isFunction = jQuery.isFunction( html );
  8113. return this.each( function( i ) {
  8114. jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
  8115. } );
  8116. },
  8117. unwrap: function() {
  8118. return this.parent().each( function() {
  8119. if ( !jQuery.nodeName( this, "body" ) ) {
  8120. jQuery( this ).replaceWith( this.childNodes );
  8121. }
  8122. } ).end();
  8123. }
  8124. } );
  8125. function getDisplay( elem ) {
  8126. return elem.style && elem.style.display || jQuery.css( elem, "display" );
  8127. }
  8128. function filterHidden( elem ) {
  8129. while ( elem && elem.nodeType === 1 ) {
  8130. if ( getDisplay( elem ) === "none" || elem.type === "hidden" ) {
  8131. return true;
  8132. }
  8133. elem = elem.parentNode;
  8134. }
  8135. return false;
  8136. }
  8137. jQuery.expr.filters.hidden = function( elem ) {
  8138. // Support: Opera <= 12.12
  8139. // Opera reports offsetWidths and offsetHeights less than zero on some elements
  8140. return support.reliableHiddenOffsets() ?
  8141. ( elem.offsetWidth <= 0 && elem.offsetHeight <= 0 &&
  8142. !elem.getClientRects().length ) :
  8143. filterHidden( elem );
  8144. };
  8145. jQuery.expr.filters.visible = function( elem ) {
  8146. return !jQuery.expr.filters.hidden( elem );
  8147. };
  8148. var r20 = /%20/g,
  8149. rbracket = /\[\]$/,
  8150. rCRLF = /\r?\n/g,
  8151. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  8152. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  8153. function buildParams( prefix, obj, traditional, add ) {
  8154. var name;
  8155. if ( jQuery.isArray( obj ) ) {
  8156. // Serialize array item.
  8157. jQuery.each( obj, function( i, v ) {
  8158. if ( traditional || rbracket.test( prefix ) ) {
  8159. // Treat each array item as a scalar.
  8160. add( prefix, v );
  8161. } else {
  8162. // Item is non-scalar (array or object), encode its numeric index.
  8163. buildParams(
  8164. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  8165. v,
  8166. traditional,
  8167. add
  8168. );
  8169. }
  8170. } );
  8171. } else if ( !traditional && jQuery.type( obj ) === "object" ) {
  8172. // Serialize object item.
  8173. for ( name in obj ) {
  8174. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  8175. }
  8176. } else {
  8177. // Serialize scalar item.
  8178. add( prefix, obj );
  8179. }
  8180. }
  8181. // Serialize an array of form elements or a set of
  8182. // key/values into a query string
  8183. jQuery.param = function( a, traditional ) {
  8184. var prefix,
  8185. s = [],
  8186. add = function( key, value ) {
  8187. // If value is a function, invoke it and return its value
  8188. value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
  8189. s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
  8190. };
  8191. // Set traditional to true for jQuery <= 1.3.2 behavior.
  8192. if ( traditional === undefined ) {
  8193. traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
  8194. }
  8195. // If an array was passed in, assume that it is an array of form elements.
  8196. if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  8197. // Serialize the form elements
  8198. jQuery.each( a, function() {
  8199. add( this.name, this.value );
  8200. } );
  8201. } else {
  8202. // If traditional, encode the "old" way (the way 1.3.2 or older
  8203. // did it), otherwise encode params recursively.
  8204. for ( prefix in a ) {
  8205. buildParams( prefix, a[ prefix ], traditional, add );
  8206. }
  8207. }
  8208. // Return the resulting serialization
  8209. return s.join( "&" ).replace( r20, "+" );
  8210. };
  8211. jQuery.fn.extend( {
  8212. serialize: function() {
  8213. return jQuery.param( this.serializeArray() );
  8214. },
  8215. serializeArray: function() {
  8216. return this.map( function() {
  8217. // Can add propHook for "elements" to filter or add form elements
  8218. var elements = jQuery.prop( this, "elements" );
  8219. return elements ? jQuery.makeArray( elements ) : this;
  8220. } )
  8221. .filter( function() {
  8222. var type = this.type;
  8223. // Use .is(":disabled") so that fieldset[disabled] works
  8224. return this.name && !jQuery( this ).is( ":disabled" ) &&
  8225. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  8226. ( this.checked || !rcheckableType.test( type ) );
  8227. } )
  8228. .map( function( i, elem ) {
  8229. var val = jQuery( this ).val();
  8230. return val == null ?
  8231. null :
  8232. jQuery.isArray( val ) ?
  8233. jQuery.map( val, function( val ) {
  8234. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  8235. } ) :
  8236. { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  8237. } ).get();
  8238. }
  8239. } );
  8240. // Create the request object
  8241. // (This is still attached to ajaxSettings for backward compatibility)
  8242. jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?
  8243. // Support: IE6-IE8
  8244. function() {
  8245. // XHR cannot access local files, always use ActiveX for that case
  8246. if ( this.isLocal ) {
  8247. return createActiveXHR();
  8248. }
  8249. // Support: IE 9-11
  8250. // IE seems to error on cross-domain PATCH requests when ActiveX XHR
  8251. // is used. In IE 9+ always use the native XHR.
  8252. // Note: this condition won't catch Edge as it doesn't define
  8253. // document.documentMode but it also doesn't support ActiveX so it won't
  8254. // reach this code.
  8255. if ( document.documentMode > 8 ) {
  8256. return createStandardXHR();
  8257. }
  8258. // Support: IE<9
  8259. // oldIE XHR does not support non-RFC2616 methods (#13240)
  8260. // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx
  8261. // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
  8262. // Although this check for six methods instead of eight
  8263. // since IE also does not support "trace" and "connect"
  8264. return /^(get|post|head|put|delete|options)$/i.test( this.type ) &&
  8265. createStandardXHR() || createActiveXHR();
  8266. } :
  8267. // For all other browsers, use the standard XMLHttpRequest object
  8268. createStandardXHR;
  8269. var xhrId = 0,
  8270. xhrCallbacks = {},
  8271. xhrSupported = jQuery.ajaxSettings.xhr();
  8272. // Support: IE<10
  8273. // Open requests must be manually aborted on unload (#5280)
  8274. // See https://support.microsoft.com/kb/2856746 for more info
  8275. if ( window.attachEvent ) {
  8276. window.attachEvent( "onunload", function() {
  8277. for ( var key in xhrCallbacks ) {
  8278. xhrCallbacks[ key ]( undefined, true );
  8279. }
  8280. } );
  8281. }
  8282. // Determine support properties
  8283. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  8284. xhrSupported = support.ajax = !!xhrSupported;
  8285. // Create transport if the browser can provide an xhr
  8286. if ( xhrSupported ) {
  8287. jQuery.ajaxTransport( function( options ) {
  8288. // Cross domain only allowed if supported through XMLHttpRequest
  8289. if ( !options.crossDomain || support.cors ) {
  8290. var callback;
  8291. return {
  8292. send: function( headers, complete ) {
  8293. var i,
  8294. xhr = options.xhr(),
  8295. id = ++xhrId;
  8296. // Open the socket
  8297. xhr.open(
  8298. options.type,
  8299. options.url,
  8300. options.async,
  8301. options.username,
  8302. options.password
  8303. );
  8304. // Apply custom fields if provided
  8305. if ( options.xhrFields ) {
  8306. for ( i in options.xhrFields ) {
  8307. xhr[ i ] = options.xhrFields[ i ];
  8308. }
  8309. }
  8310. // Override mime type if needed
  8311. if ( options.mimeType && xhr.overrideMimeType ) {
  8312. xhr.overrideMimeType( options.mimeType );
  8313. }
  8314. // X-Requested-With header
  8315. // For cross-domain requests, seeing as conditions for a preflight are
  8316. // akin to a jigsaw puzzle, we simply never set it to be sure.
  8317. // (it can always be set on a per-request basis or even using ajaxSetup)
  8318. // For same-domain requests, won't change header if already provided.
  8319. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  8320. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  8321. }
  8322. // Set headers
  8323. for ( i in headers ) {
  8324. // Support: IE<9
  8325. // IE's ActiveXObject throws a 'Type Mismatch' exception when setting
  8326. // request header to a null-value.
  8327. //
  8328. // To keep consistent with other XHR implementations, cast the value
  8329. // to string and ignore `undefined`.
  8330. if ( headers[ i ] !== undefined ) {
  8331. xhr.setRequestHeader( i, headers[ i ] + "" );
  8332. }
  8333. }
  8334. // Do send the request
  8335. // This may raise an exception which is actually
  8336. // handled in jQuery.ajax (so no try/catch here)
  8337. xhr.send( ( options.hasContent && options.data ) || null );
  8338. // Listener
  8339. callback = function( _, isAbort ) {
  8340. var status, statusText, responses;
  8341. // Was never called and is aborted or complete
  8342. if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
  8343. // Clean up
  8344. delete xhrCallbacks[ id ];
  8345. callback = undefined;
  8346. xhr.onreadystatechange = jQuery.noop;
  8347. // Abort manually if needed
  8348. if ( isAbort ) {
  8349. if ( xhr.readyState !== 4 ) {
  8350. xhr.abort();
  8351. }
  8352. } else {
  8353. responses = {};
  8354. status = xhr.status;
  8355. // Support: IE<10
  8356. // Accessing binary-data responseText throws an exception
  8357. // (#11426)
  8358. if ( typeof xhr.responseText === "string" ) {
  8359. responses.text = xhr.responseText;
  8360. }
  8361. // Firefox throws an exception when accessing
  8362. // statusText for faulty cross-domain requests
  8363. try {
  8364. statusText = xhr.statusText;
  8365. } catch ( e ) {
  8366. // We normalize with Webkit giving an empty statusText
  8367. statusText = "";
  8368. }
  8369. // Filter status for non standard behaviors
  8370. // If the request is local and we have data: assume a success
  8371. // (success with no data won't get notified, that's the best we
  8372. // can do given current implementations)
  8373. if ( !status && options.isLocal && !options.crossDomain ) {
  8374. status = responses.text ? 200 : 404;
  8375. // IE - #1450: sometimes returns 1223 when it should be 204
  8376. } else if ( status === 1223 ) {
  8377. status = 204;
  8378. }
  8379. }
  8380. }
  8381. // Call complete if needed
  8382. if ( responses ) {
  8383. complete( status, statusText, responses, xhr.getAllResponseHeaders() );
  8384. }
  8385. };
  8386. // Do send the request
  8387. // `xhr.send` may raise an exception, but it will be
  8388. // handled in jQuery.ajax (so no try/catch here)
  8389. if ( !options.async ) {
  8390. // If we're in sync mode we fire the callback
  8391. callback();
  8392. } else if ( xhr.readyState === 4 ) {
  8393. // (IE6 & IE7) if it's in cache and has been
  8394. // retrieved directly we need to fire the callback
  8395. window.setTimeout( callback );
  8396. } else {
  8397. // Register the callback, but delay it in case `xhr.send` throws
  8398. // Add to the list of active xhr callbacks
  8399. xhr.onreadystatechange = xhrCallbacks[ id ] = callback;
  8400. }
  8401. },
  8402. abort: function() {
  8403. if ( callback ) {
  8404. callback( undefined, true );
  8405. }
  8406. }
  8407. };
  8408. }
  8409. } );
  8410. }
  8411. // Functions to create xhrs
  8412. function createStandardXHR() {
  8413. try {
  8414. return new window.XMLHttpRequest();
  8415. } catch ( e ) {}
  8416. }
  8417. function createActiveXHR() {
  8418. try {
  8419. return new window.ActiveXObject( "Microsoft.XMLHTTP" );
  8420. } catch ( e ) {}
  8421. }
  8422. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  8423. jQuery.ajaxPrefilter( function( s ) {
  8424. if ( s.crossDomain ) {
  8425. s.contents.script = false;
  8426. }
  8427. } );
  8428. // Install script dataType
  8429. jQuery.ajaxSetup( {
  8430. accepts: {
  8431. script: "text/javascript, application/javascript, " +
  8432. "application/ecmascript, application/x-ecmascript"
  8433. },
  8434. contents: {
  8435. script: /\b(?:java|ecma)script\b/
  8436. },
  8437. converters: {
  8438. "text script": function( text ) {
  8439. jQuery.globalEval( text );
  8440. return text;
  8441. }
  8442. }
  8443. } );
  8444. // Handle cache's special case and global
  8445. jQuery.ajaxPrefilter( "script", function( s ) {
  8446. if ( s.cache === undefined ) {
  8447. s.cache = false;
  8448. }
  8449. if ( s.crossDomain ) {
  8450. s.type = "GET";
  8451. s.global = false;
  8452. }
  8453. } );
  8454. // Bind script tag hack transport
  8455. jQuery.ajaxTransport( "script", function( s ) {
  8456. // This transport only deals with cross domain requests
  8457. if ( s.crossDomain ) {
  8458. var script,
  8459. head = document.head || jQuery( "head" )[ 0 ] || document.documentElement;
  8460. return {
  8461. send: function( _, callback ) {
  8462. script = document.createElement( "script" );
  8463. script.async = true;
  8464. if ( s.scriptCharset ) {
  8465. script.charset = s.scriptCharset;
  8466. }
  8467. script.src = s.url;
  8468. // Attach handlers for all browsers
  8469. script.onload = script.onreadystatechange = function( _, isAbort ) {
  8470. if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
  8471. // Handle memory leak in IE
  8472. script.onload = script.onreadystatechange = null;
  8473. // Remove the script
  8474. if ( script.parentNode ) {
  8475. script.parentNode.removeChild( script );
  8476. }
  8477. // Dereference the script
  8478. script = null;
  8479. // Callback if not abort
  8480. if ( !isAbort ) {
  8481. callback( 200, "success" );
  8482. }
  8483. }
  8484. };
  8485. // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
  8486. // Use native DOM manipulation to avoid our domManip AJAX trickery
  8487. head.insertBefore( script, head.firstChild );
  8488. },
  8489. abort: function() {
  8490. if ( script ) {
  8491. script.onload( undefined, true );
  8492. }
  8493. }
  8494. };
  8495. }
  8496. } );
  8497. var oldCallbacks = [],
  8498. rjsonp = /(=)\?(?=&|$)|\?\?/;
  8499. // Default jsonp settings
  8500. jQuery.ajaxSetup( {
  8501. jsonp: "callback",
  8502. jsonpCallback: function() {
  8503. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  8504. this[ callback ] = true;
  8505. return callback;
  8506. }
  8507. } );
  8508. // Detect, normalize options and install callbacks for jsonp requests
  8509. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  8510. var callbackName, overwritten, responseContainer,
  8511. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  8512. "url" :
  8513. typeof s.data === "string" &&
  8514. ( s.contentType || "" )
  8515. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  8516. rjsonp.test( s.data ) && "data"
  8517. );
  8518. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  8519. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  8520. // Get callback name, remembering preexisting value associated with it
  8521. callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
  8522. s.jsonpCallback() :
  8523. s.jsonpCallback;
  8524. // Insert callback into url or form data
  8525. if ( jsonProp ) {
  8526. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  8527. } else if ( s.jsonp !== false ) {
  8528. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  8529. }
  8530. // Use data converter to retrieve json after script execution
  8531. s.converters[ "script json" ] = function() {
  8532. if ( !responseContainer ) {
  8533. jQuery.error( callbackName + " was not called" );
  8534. }
  8535. return responseContainer[ 0 ];
  8536. };
  8537. // force json dataType
  8538. s.dataTypes[ 0 ] = "json";
  8539. // Install callback
  8540. overwritten = window[ callbackName ];
  8541. window[ callbackName ] = function() {
  8542. responseContainer = arguments;
  8543. };
  8544. // Clean-up function (fires after converters)
  8545. jqXHR.always( function() {
  8546. // If previous value didn't exist - remove it
  8547. if ( overwritten === undefined ) {
  8548. jQuery( window ).removeProp( callbackName );
  8549. // Otherwise restore preexisting value
  8550. } else {
  8551. window[ callbackName ] = overwritten;
  8552. }
  8553. // Save back as free
  8554. if ( s[ callbackName ] ) {
  8555. // make sure that re-using the options doesn't screw things around
  8556. s.jsonpCallback = originalSettings.jsonpCallback;
  8557. // save the callback name for future use
  8558. oldCallbacks.push( callbackName );
  8559. }
  8560. // Call if it was a function and we have a response
  8561. if ( responseContainer && jQuery.isFunction( overwritten ) ) {
  8562. overwritten( responseContainer[ 0 ] );
  8563. }
  8564. responseContainer = overwritten = undefined;
  8565. } );
  8566. // Delegate to script
  8567. return "script";
  8568. }
  8569. } );
  8570. // Support: Safari 8+
  8571. // In Safari 8 documents created via document.implementation.createHTMLDocument
  8572. // collapse sibling forms: the second one becomes a child of the first one.
  8573. // Because of that, this security measure has to be disabled in Safari 8.
  8574. // https://bugs.webkit.org/show_bug.cgi?id=137337
  8575. support.createHTMLDocument = ( function() {
  8576. if ( !document.implementation.createHTMLDocument ) {
  8577. return false;
  8578. }
  8579. var doc = document.implementation.createHTMLDocument( "" );
  8580. doc.body.innerHTML = "<form></form><form></form>";
  8581. return doc.body.childNodes.length === 2;
  8582. } )();
  8583. // data: string of html
  8584. // context (optional): If specified, the fragment will be created in this context,
  8585. // defaults to document
  8586. // keepScripts (optional): If true, will include scripts passed in the html string
  8587. jQuery.parseHTML = function( data, context, keepScripts ) {
  8588. if ( !data || typeof data !== "string" ) {
  8589. return null;
  8590. }
  8591. if ( typeof context === "boolean" ) {
  8592. keepScripts = context;
  8593. context = false;
  8594. }
  8595. // document.implementation stops scripts or inline event handlers from
  8596. // being executed immediately
  8597. context = context || ( support.createHTMLDocument ?
  8598. document.implementation.createHTMLDocument( "" ) :
  8599. document );
  8600. var parsed = rsingleTag.exec( data ),
  8601. scripts = !keepScripts && [];
  8602. // Single tag
  8603. if ( parsed ) {
  8604. return [ context.createElement( parsed[ 1 ] ) ];
  8605. }
  8606. parsed = buildFragment( [ data ], context, scripts );
  8607. if ( scripts && scripts.length ) {
  8608. jQuery( scripts ).remove();
  8609. }
  8610. return jQuery.merge( [], parsed.childNodes );
  8611. };
  8612. // Keep a copy of the old load method
  8613. var _load = jQuery.fn.load;
  8614. /**
  8615. * Load a url into a page
  8616. */
  8617. jQuery.fn.load = function( url, params, callback ) {
  8618. if ( typeof url !== "string" && _load ) {
  8619. return _load.apply( this, arguments );
  8620. }
  8621. var selector, type, response,
  8622. self = this,
  8623. off = url.indexOf( " " );
  8624. if ( off > -1 ) {
  8625. selector = jQuery.trim( url.slice( off, url.length ) );
  8626. url = url.slice( 0, off );
  8627. }
  8628. // If it's a function
  8629. if ( jQuery.isFunction( params ) ) {
  8630. // We assume that it's the callback
  8631. callback = params;
  8632. params = undefined;
  8633. // Otherwise, build a param string
  8634. } else if ( params && typeof params === "object" ) {
  8635. type = "POST";
  8636. }
  8637. // If we have elements to modify, make the request
  8638. if ( self.length > 0 ) {
  8639. jQuery.ajax( {
  8640. url: url,
  8641. // If "type" variable is undefined, then "GET" method will be used.
  8642. // Make value of this field explicit since
  8643. // user can override it through ajaxSetup method
  8644. type: type || "GET",
  8645. dataType: "html",
  8646. data: params
  8647. } ).done( function( responseText ) {
  8648. // Save response for use in complete callback
  8649. response = arguments;
  8650. self.html( selector ?
  8651. // If a selector was specified, locate the right elements in a dummy div
  8652. // Exclude scripts to avoid IE 'Permission Denied' errors
  8653. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  8654. // Otherwise use the full result
  8655. responseText );
  8656. // If the request succeeds, this function gets "data", "status", "jqXHR"
  8657. // but they are ignored because response was set above.
  8658. // If it fails, this function gets "jqXHR", "status", "error"
  8659. } ).always( callback && function( jqXHR, status ) {
  8660. self.each( function() {
  8661. callback.apply( self, response || [ jqXHR.responseText, status, jqXHR ] );
  8662. } );
  8663. } );
  8664. }
  8665. return this;
  8666. };
  8667. // Attach a bunch of functions for handling common AJAX events
  8668. jQuery.each( [
  8669. "ajaxStart",
  8670. "ajaxStop",
  8671. "ajaxComplete",
  8672. "ajaxError",
  8673. "ajaxSuccess",
  8674. "ajaxSend"
  8675. ], function( i, type ) {
  8676. jQuery.fn[ type ] = function( fn ) {
  8677. return this.on( type, fn );
  8678. };
  8679. } );
  8680. jQuery.expr.filters.animated = function( elem ) {
  8681. return jQuery.grep( jQuery.timers, function( fn ) {
  8682. return elem === fn.elem;
  8683. } ).length;
  8684. };
  8685. /**
  8686. * Gets a window from an element
  8687. */
  8688. function getWindow( elem ) {
  8689. return jQuery.isWindow( elem ) ?
  8690. elem :
  8691. elem.nodeType === 9 ?
  8692. elem.defaultView || elem.parentWindow :
  8693. false;
  8694. }
  8695. jQuery.offset = {
  8696. setOffset: function( elem, options, i ) {
  8697. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  8698. position = jQuery.css( elem, "position" ),
  8699. curElem = jQuery( elem ),
  8700. props = {};
  8701. // set position first, in-case top/left are set even on static elem
  8702. if ( position === "static" ) {
  8703. elem.style.position = "relative";
  8704. }
  8705. curOffset = curElem.offset();
  8706. curCSSTop = jQuery.css( elem, "top" );
  8707. curCSSLeft = jQuery.css( elem, "left" );
  8708. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  8709. jQuery.inArray( "auto", [ curCSSTop, curCSSLeft ] ) > -1;
  8710. // need to be able to calculate position if either top or left
  8711. // is auto and position is either absolute or fixed
  8712. if ( calculatePosition ) {
  8713. curPosition = curElem.position();
  8714. curTop = curPosition.top;
  8715. curLeft = curPosition.left;
  8716. } else {
  8717. curTop = parseFloat( curCSSTop ) || 0;
  8718. curLeft = parseFloat( curCSSLeft ) || 0;
  8719. }
  8720. if ( jQuery.isFunction( options ) ) {
  8721. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  8722. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  8723. }
  8724. if ( options.top != null ) {
  8725. props.top = ( options.top - curOffset.top ) + curTop;
  8726. }
  8727. if ( options.left != null ) {
  8728. props.left = ( options.left - curOffset.left ) + curLeft;
  8729. }
  8730. if ( "using" in options ) {
  8731. options.using.call( elem, props );
  8732. } else {
  8733. curElem.css( props );
  8734. }
  8735. }
  8736. };
  8737. jQuery.fn.extend( {
  8738. offset: function( options ) {
  8739. if ( arguments.length ) {
  8740. return options === undefined ?
  8741. this :
  8742. this.each( function( i ) {
  8743. jQuery.offset.setOffset( this, options, i );
  8744. } );
  8745. }
  8746. var docElem, win,
  8747. box = { top: 0, left: 0 },
  8748. elem = this[ 0 ],
  8749. doc = elem && elem.ownerDocument;
  8750. if ( !doc ) {
  8751. return;
  8752. }
  8753. docElem = doc.documentElement;
  8754. // Make sure it's not a disconnected DOM node
  8755. if ( !jQuery.contains( docElem, elem ) ) {
  8756. return box;
  8757. }
  8758. // If we don't have gBCR, just use 0,0 rather than error
  8759. // BlackBerry 5, iOS 3 (original iPhone)
  8760. if ( typeof elem.getBoundingClientRect !== "undefined" ) {
  8761. box = elem.getBoundingClientRect();
  8762. }
  8763. win = getWindow( doc );
  8764. return {
  8765. top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
  8766. left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
  8767. };
  8768. },
  8769. position: function() {
  8770. if ( !this[ 0 ] ) {
  8771. return;
  8772. }
  8773. var offsetParent, offset,
  8774. parentOffset = { top: 0, left: 0 },
  8775. elem = this[ 0 ];
  8776. // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
  8777. // because it is its only offset parent
  8778. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  8779. // we assume that getBoundingClientRect is available when computed position is fixed
  8780. offset = elem.getBoundingClientRect();
  8781. } else {
  8782. // Get *real* offsetParent
  8783. offsetParent = this.offsetParent();
  8784. // Get correct offsets
  8785. offset = this.offset();
  8786. if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
  8787. parentOffset = offsetParent.offset();
  8788. }
  8789. // Add offsetParent borders
  8790. parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
  8791. parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
  8792. }
  8793. // Subtract parent offsets and element margins
  8794. // note: when an element has margin: auto the offsetLeft and marginLeft
  8795. // are the same in Safari causing offset.left to incorrectly be 0
  8796. return {
  8797. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  8798. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  8799. };
  8800. },
  8801. offsetParent: function() {
  8802. return this.map( function() {
  8803. var offsetParent = this.offsetParent;
  8804. while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) &&
  8805. jQuery.css( offsetParent, "position" ) === "static" ) ) {
  8806. offsetParent = offsetParent.offsetParent;
  8807. }
  8808. return offsetParent || documentElement;
  8809. } );
  8810. }
  8811. } );
  8812. // Create scrollLeft and scrollTop methods
  8813. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  8814. var top = /Y/.test( prop );
  8815. jQuery.fn[ method ] = function( val ) {
  8816. return access( this, function( elem, method, val ) {
  8817. var win = getWindow( elem );
  8818. if ( val === undefined ) {
  8819. return win ? ( prop in win ) ? win[ prop ] :
  8820. win.document.documentElement[ method ] :
  8821. elem[ method ];
  8822. }
  8823. if ( win ) {
  8824. win.scrollTo(
  8825. !top ? val : jQuery( win ).scrollLeft(),
  8826. top ? val : jQuery( win ).scrollTop()
  8827. );
  8828. } else {
  8829. elem[ method ] = val;
  8830. }
  8831. }, method, val, arguments.length, null );
  8832. };
  8833. } );
  8834. // Support: Safari<7-8+, Chrome<37-44+
  8835. // Add the top/left cssHooks using jQuery.fn.position
  8836. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  8837. // getComputedStyle returns percent when specified for top/left/bottom/right
  8838. // rather than make the css module depend on the offset module, we just check for it here
  8839. jQuery.each( [ "top", "left" ], function( i, prop ) {
  8840. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  8841. function( elem, computed ) {
  8842. if ( computed ) {
  8843. computed = curCSS( elem, prop );
  8844. // if curCSS returns percentage, fallback to offset
  8845. return rnumnonpx.test( computed ) ?
  8846. jQuery( elem ).position()[ prop ] + "px" :
  8847. computed;
  8848. }
  8849. }
  8850. );
  8851. } );
  8852. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  8853. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  8854. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  8855. function( defaultExtra, funcName ) {
  8856. // margin is only for outerHeight, outerWidth
  8857. jQuery.fn[ funcName ] = function( margin, value ) {
  8858. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  8859. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  8860. return access( this, function( elem, type, value ) {
  8861. var doc;
  8862. if ( jQuery.isWindow( elem ) ) {
  8863. // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
  8864. // isn't a whole lot we can do. See pull request at this URL for discussion:
  8865. // https://github.com/jquery/jquery/pull/764
  8866. return elem.document.documentElement[ "client" + name ];
  8867. }
  8868. // Get document width or height
  8869. if ( elem.nodeType === 9 ) {
  8870. doc = elem.documentElement;
  8871. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  8872. // whichever is greatest
  8873. // unfortunately, this causes bug #3838 in IE6/8 only,
  8874. // but there is currently no good, small way to fix it.
  8875. return Math.max(
  8876. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  8877. elem.body[ "offset" + name ], doc[ "offset" + name ],
  8878. doc[ "client" + name ]
  8879. );
  8880. }
  8881. return value === undefined ?
  8882. // Get width or height on the element, requesting but not forcing parseFloat
  8883. jQuery.css( elem, type, extra ) :
  8884. // Set width or height on the element
  8885. jQuery.style( elem, type, value, extra );
  8886. }, type, chainable ? margin : undefined, chainable, null );
  8887. };
  8888. } );
  8889. } );
  8890. jQuery.fn.extend( {
  8891. bind: function( types, data, fn ) {
  8892. return this.on( types, null, data, fn );
  8893. },
  8894. unbind: function( types, fn ) {
  8895. return this.off( types, null, fn );
  8896. },
  8897. delegate: function( selector, types, data, fn ) {
  8898. return this.on( types, selector, data, fn );
  8899. },
  8900. undelegate: function( selector, types, fn ) {
  8901. // ( namespace ) or ( selector, types [, fn] )
  8902. return arguments.length === 1 ?
  8903. this.off( selector, "**" ) :
  8904. this.off( types, selector || "**", fn );
  8905. }
  8906. } );
  8907. // The number of elements contained in the matched element set
  8908. jQuery.fn.size = function() {
  8909. return this.length;
  8910. };
  8911. jQuery.fn.andSelf = jQuery.fn.addBack;
  8912. // Register as a named AMD module, since jQuery can be concatenated with other
  8913. // files that may use define, but not via a proper concatenation script that
  8914. // understands anonymous AMD modules. A named AMD is safest and most robust
  8915. // way to register. Lowercase jquery is used because AMD module names are
  8916. // derived from file names, and jQuery is normally delivered in a lowercase
  8917. // file name. Do this after creating the global so that if an AMD module wants
  8918. // to call noConflict to hide this version of jQuery, it will work.
  8919. // Note that for maximum portability, libraries that are not jQuery should
  8920. // declare themselves as anonymous modules, and avoid setting a global if an
  8921. // AMD loader is present. jQuery is a special case. For more information, see
  8922. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  8923. if ( typeof define === "function" && define.amd ) {
  8924. define( "jquery", [], function() {
  8925. return jQuery;
  8926. } );
  8927. }
  8928. var
  8929. // Map over jQuery in case of overwrite
  8930. _jQuery = window.jQuery,
  8931. // Map over the $ in case of overwrite
  8932. _$ = window.$;
  8933. jQuery.noConflict = function( deep ) {
  8934. if ( window.$ === jQuery ) {
  8935. window.$ = _$;
  8936. }
  8937. if ( deep && window.jQuery === jQuery ) {
  8938. window.jQuery = _jQuery;
  8939. }
  8940. return jQuery;
  8941. };
  8942. // Expose jQuery and $ identifiers, even in
  8943. // AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  8944. // and CommonJS for browser emulators (#13566)
  8945. if ( !noGlobal ) {
  8946. window.jQuery = window.$ = jQuery;
  8947. }
  8948. return jQuery;
  8949. }));
  8950. /**
  8951. * Copyright 2012,duowan.com
  8952. * Author:Linzhq
  8953. * $Date: 2012-10-12 11:12:41 +0800 (Fri, 12 Oct 2012) $
  8954. * require: jQuery 1.7.2
  8955. */
  8956. var LEGO = LEGO ? LEGO : {};
  8957. jQuery.extend( jQuery.easing, {
  8958. easeOutExpo: function (x, t, b, c, d) {
  8959. return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
  8960. }
  8961. });
  8962. (function($, k, w){
  8963. /**
  8964. * Switchable 抽象类,外部不能直接调用
  8965. * @constructor
  8966. * @param {jQuery object}
  8967. * @param {object} 配置参数
  8968. */
  8969. function Switchable(elem, opts){
  8970. if(arguments.length !== 0){
  8971. this.opts = {
  8972. event : "click",
  8973. effect : "none",
  8974. autoPlay : false,
  8975. speed : "normal",
  8976. timer : 4000,
  8977. nav : "J_nav",
  8978. content : "J_content",
  8979. btnPrev : "J_btnPrev",
  8980. btnNext : "J_btnNext",
  8981. steps : 1,
  8982. hoverInterval : 100,
  8983. mousewheel: false,
  8984. figureNav: false
  8985. }
  8986. jQuery.extend(this.opts, this.opts, opts);
  8987. this.$elem = elem;
  8988. this.$nav = elem.find("." + this.opts.nav).eq(0);
  8989. this.$cont = elem.find("." + this.opts.content).eq(0);
  8990. this.$btnPrev = elem.find("." + this.opts.btnPrev).eq(0);
  8991. this.$btnNext = elem.find("." + this.opts.btnNext).eq(0);
  8992. this._eventTimer = null; //事件触发的timer
  8993. this._autoPlayTimer = null; //自动播放的timer
  8994. this._activeIndex = 0;
  8995. }
  8996. }
  8997. Switchable.prototype = {
  8998. _struct : function(){
  8999. var self = this;
  9000. if(this.constructor===Tab && this.opts.event === "click"){
  9001. this.$nav.children().hover(function(){
  9002. $(this).addClass("hover");
  9003. },function(){
  9004. $(this).removeClass("hover");
  9005. });
  9006. }
  9007. if(this.constructor===Carousel){
  9008. var max = Math.ceil(this.$cont.children().size()/this.opts.steps) - 1;
  9009. if(this.$nav.length && ($.trim(this.$nav[0].innerHTML)=='')){
  9010. for(var i=0; i<= max ;i++){
  9011. var a = "<a href='#"+ i +"' target='_self'></a>";
  9012. if(i==0){
  9013. a = "<a href='#"+ i +"' class='selected' target='_self'></a>";
  9014. }
  9015. this.$nav.append(a);
  9016. }
  9017. }
  9018. if(this.opts.mousewheel){
  9019. this.$elem.bind('mousewheel', function(event, delta) {
  9020. event.preventDefault();
  9021. if(!self.$cont.is(":animated")){
  9022. if(delta === 1){
  9023. self.prev();
  9024. }else{
  9025. self.next();
  9026. }
  9027. }
  9028. });
  9029. }
  9030. if(this.opts.figureNav && this.$elem.find(".steps").length){
  9031. var figure = max + 1;
  9032. var figureHtml = '<span class="curr-step">1</span><span class="total-step">/'+ figure + '</span>';
  9033. this.$elem.find(".steps").html(figureHtml)
  9034. }
  9035. }
  9036. //绑定触发按钮事件
  9037. this.$nav.children().each(function(index, elem){
  9038. if(self.opts.event==="hover"){
  9039. $(elem).hover(function(){
  9040. //防止过快移动触发
  9041. clearTimeout(self._eventTimer);
  9042. self._eventTimer = setTimeout(function(){
  9043. self._switch(index);
  9044. }, self.opts.hoverInterval);
  9045. },function(){
  9046. clearTimeout(self._eventTimer);
  9047. });
  9048. }else{
  9049. $(elem).click(function(){
  9050. self._switch(index);
  9051. });
  9052. }
  9053. $(elem)[self.opts.event](function(){
  9054. if(self.opts.event === "click"){
  9055. self._switch(index);
  9056. }else{
  9057. }
  9058. });
  9059. });
  9060. if(this.$btnPrev.size()){
  9061. this.$btnPrev.unbind("click");
  9062. this.$btnPrev.bind("click",function(){
  9063. self.prev();
  9064. });
  9065. }
  9066. if(this.$btnNext.size()){
  9067. this.$btnNext.unbind("click");
  9068. this.$btnNext.bind("click",function(){
  9069. self.next();
  9070. });
  9071. }
  9072. //设置css
  9073. switch(this.opts.effect){
  9074. case "scrollX":
  9075. var contElems = this.$cont.children(),
  9076. contWidth = contElems.outerWidth(true) * contElems.length;
  9077. contElems.css({"float":"left"});
  9078. this.$cont.css({"width":contWidth});
  9079. break;
  9080. case "scrollY":
  9081. break;
  9082. case "fade":
  9083. this.$cont.css({"position":"relative"});
  9084. this.$cont.children().css({"position":"absolute", "left":"0", "top":"0", "z-index":"0", "opacity":"0"}).eq(0).css({"opacity":1, "z-index":1});
  9085. break;
  9086. }
  9087. //运行自动播放
  9088. (this.opts.autoPlay === true) && this._autoPlay();
  9089. },
  9090. _switch : function(index){
  9091. var indexOjb = this._checkIndex(index);
  9092. switch(this.opts.effect){
  9093. case "scrollX":
  9094. this._switchScrollx(indexOjb);
  9095. break;
  9096. case "scrollY":
  9097. this._switchScrolly(indexOjb);
  9098. break;
  9099. case "fade":
  9100. this._switchFade(indexOjb);
  9101. break;
  9102. default:
  9103. this._switchNormal(indexOjb);
  9104. }
  9105. if(this.opts.figureNav && this.$elem.find(".steps").length){
  9106. this._figureNav(indexOjb.index);
  9107. }
  9108. this._setNavCls(indexOjb.index);
  9109. this._activeIndex = indexOjb.index;
  9110. },
  9111. _figureNav : function(index){
  9112. this.$elem.find(".curr-step").text(index+1);
  9113. },
  9114. _switchNormal : function(indexOjb){
  9115. var contElems = this.$cont.children();
  9116. contElems.hide();
  9117. contElems.eq(indexOjb.index).show();
  9118. },
  9119. _switchFade : function(indexOjb){
  9120. var contElems = this.$cont.children();
  9121. contElems.eq(this._activeIndex)
  9122. .stop().animate({opacity:0}, 600)
  9123. .css("z-index", 0);
  9124. contElems.eq(indexOjb.index)
  9125. .stop().animate({opacity:1}, 600)
  9126. .css("z-index", 1);
  9127. },
  9128. _switchScrollx : function(indexOjb){
  9129. var contElems = this.$cont.children(),
  9130. panelWidth = contElems.outerWidth(true),
  9131. moveWidth = - indexOjb.index * this.opts.steps * panelWidth,
  9132. moveWidth2 = - (indexOjb.index-1) * this.opts.steps * panelWidth,
  9133. relaWidth = panelWidth * (indexOjb.maxIndex+1) * this.opts.steps;
  9134. contElems.each(function(index, element){
  9135. this.style.cssText = "float:left";
  9136. });
  9137. switch(indexOjb.type){
  9138. case "max":
  9139. for(var i = 0; i<this.opts.steps ;i++){
  9140. contElems.eq(i)
  9141. .css({"position":"relative","left": relaWidth});
  9142. }
  9143. this.$cont.animate({"left":-relaWidth}, 400, "easeOutExpo", function(){
  9144. contElems.each(function(index, element){
  9145. this.style.cssText = "float:left";
  9146. });
  9147. $(this).css("left",moveWidth);
  9148. });
  9149. break;
  9150. case "min":
  9151. for(var i = this.opts.steps; i>0 ;i--){
  9152. contElems.eq( contElems.length - i )
  9153. .css({"position":"relative","left": -relaWidth});
  9154. }
  9155. this.$cont.animate({"left":panelWidth*this.opts.steps}, 400, "easeOutExpo", function(){
  9156. contElems.each(function(index, element){
  9157. this.style.cssText = "float:left";
  9158. });
  9159. $(this).css("left",moveWidth);
  9160. });
  9161. break;
  9162. default:
  9163. this.$cont.stop().animate({"left":moveWidth}, 400, "easeOutExpo");
  9164. }
  9165. },
  9166. _switchScrolly : function(indexOjb){
  9167. var contElems = this.$cont.children(),
  9168. panelWidth = contElems.outerHeight(true),
  9169. moveWidth = - indexOjb.index * this.opts.steps * panelWidth;
  9170. switch(indexOjb.type){
  9171. case "max":
  9172. for(var i = 0; i<this.opts.steps ;i++){
  9173. contElems.eq(i)
  9174. .css({"position":"relative","top": panelWidth*(indexOjb.maxIndex+1)*this.opts.steps});
  9175. }
  9176. this.$cont.stop().animate({"top":-panelWidth*this.opts.steps*(indexOjb.maxIndex+1)}, 400, "easeOutExpo", function(){
  9177. contElems.each(function(){
  9178. this.style.cssText = "";
  9179. });
  9180. $(this).css("top",moveWidth);
  9181. });
  9182. break;
  9183. case "min":
  9184. for(var i = this.opts.steps; i>0 ;i--){
  9185. contElems.eq( contElems.length - i )
  9186. .css({"position":"relative","top": -panelWidth*(indexOjb.maxIndex+1)*this.opts.steps});
  9187. }
  9188. this.$cont.stop().animate({"top":panelWidth*this.opts.steps}, 400, "easeOutExpo", function(){
  9189. contElems.each(function(){
  9190. this.style.cssText = "";
  9191. });
  9192. $(this).css("top",moveWidth);
  9193. });
  9194. break;
  9195. default:
  9196. this.$cont.stop().animate({"top":moveWidth}, 400, "easeOutExpo");
  9197. }
  9198. },
  9199. _setNavCls : function(index){
  9200. var index = index||0,
  9201. navElems = this.$nav.children();
  9202. navElems.removeClass("selected");
  9203. navElems.eq(index).addClass("selected");
  9204. },
  9205. _autoPlay : function(){
  9206. var self = this
  9207. clearInterval(this._autoPlayTimer);
  9208. this._autoPlayTimer = setInterval(function(){
  9209. self._doPlay();
  9210. },self.opts.timer);
  9211. this.$elem.mouseenter(function(){
  9212. clearInterval(self._autoPlayTimer);
  9213. });
  9214. this.$elem.mouseleave(function(){
  9215. clearInterval(self._autoPlayTimer);
  9216. self._autoPlayTimer = setInterval(function(){
  9217. self._doPlay();
  9218. },self.opts.timer);
  9219. });
  9220. },
  9221. _doPlay : function(){
  9222. this._switch(this._activeIndex + 1);
  9223. },
  9224. _checkIndex : function(index){
  9225. var maxIndex = Math.ceil(this.$cont.children().size()/this.opts.steps) - 1;
  9226. var obj = {
  9227. index: index,
  9228. type: "normal",
  9229. maxIndex: maxIndex
  9230. }
  9231. if(index < 0){
  9232. obj.type = "min";
  9233. obj.index = maxIndex;
  9234. }else if(index > maxIndex){
  9235. obj.type = "max";
  9236. obj.index = 0;
  9237. }
  9238. return obj;
  9239. },
  9240. stop : function(){
  9241. alert("stop")
  9242. },
  9243. start : function(){
  9244. },
  9245. switchTo : function(index){
  9246. this._switch(index);
  9247. },
  9248. prev : function(){
  9249. this._switch(this._activeIndex - 1);
  9250. },
  9251. next : function(){
  9252. this._switch(this._activeIndex + 1);
  9253. },
  9254. _init : function(){
  9255. this._struct();
  9256. }
  9257. };
  9258. /**
  9259. * [kExtend description]
  9260. * @param {[type]} selector [description]
  9261. * @param {[type]} opts [description]
  9262. * @param {[type]} subClass [description]
  9263. * @return {[type]} [description]
  9264. */
  9265. function kExtend(selector, opts, subClass){
  9266. var elems = $(selector),
  9267. reFun = [];
  9268. if(elems.length == 1){
  9269. reFun = new subClass(elems, opts);
  9270. }else{
  9271. for(var i = 0; i < elems.length; i++) {
  9272. reFun.push(new subClass(elems.eq(i), opts));
  9273. }
  9274. }
  9275. return reFun;
  9276. }
  9277. /**
  9278. * Slide类
  9279. * @constructor
  9280. * @param {jQuery object}
  9281. * @param {object} 配置参数
  9282. */
  9283. function Slide(selector, opts){
  9284. //继承 Switchable 实例对象
  9285. var slideOpts = {
  9286. event : "hover",
  9287. effect : "fade",
  9288. autoPlay : true
  9289. }
  9290. $.extend(slideOpts, slideOpts, opts);
  9291. Switchable.call(this, selector, slideOpts);
  9292. this._init();
  9293. }
  9294. //继承 Switchable 原型方法
  9295. Slide.prototype = new Switchable();
  9296. Slide.prototype.constructor = Slide;
  9297. k.slide = function(selector, opts){
  9298. return kExtend(selector, opts, Slide);
  9299. };
  9300. /**
  9301. * wideSlide类
  9302. * @constructor
  9303. * @param {jQuery object}
  9304. * @param {object} 配置参数
  9305. */
  9306. function wideSlide(selector, opts){
  9307. //继承 Switchable 实例对象
  9308. var slideOpts = {
  9309. event : "hover",
  9310. effect : "fade",
  9311. autoPlay : true
  9312. }
  9313. $.extend(slideOpts, slideOpts, opts);
  9314. Switchable.call(this, selector, slideOpts);
  9315. var windowWidth = $(window).width(),
  9316. slideWrap = $(selector),
  9317. selectorWidth = $(selector).width();
  9318. if(selectorWidth > windowWidth)
  9319. {
  9320. slideWrap.css('left', -(selectorWidth - windowWidth)/2 + "px");//移正幻灯片
  9321. }
  9322. //屏幕改变时候情况
  9323. $(window).resize(function(event) {
  9324. if(selectorWidth > $(window).width())
  9325. {
  9326. slideWrap.css('left', -(selectorWidth - $(window).width())/2 + "px");
  9327. }
  9328. });
  9329. this._init();
  9330. }
  9331. //继承 Switchable 原型方法
  9332. wideSlide.prototype = new Switchable();
  9333. wideSlide.prototype.constructor = wideSlide;
  9334. k.wideSlide = function(selector, opts){
  9335. return kExtend(selector, opts, wideSlide);
  9336. };
  9337. /**
  9338. * Tab类
  9339. * @constructor
  9340. * @param {jQuery object}
  9341. * @param {object} 配置参数
  9342. */
  9343. function Tab(selector, opts){
  9344. Switchable.call(this, selector, opts);
  9345. this._init();
  9346. }
  9347. Tab.prototype = new Switchable();
  9348. Tab.prototype.constructor = Tab;
  9349. k.tab = function(selector, opts){
  9350. return kExtend(selector, opts, Tab);
  9351. };
  9352. //多玩日历
  9353. k.calendar= function(selector, opts){
  9354. var calendarOpts = {
  9355. event: "click",
  9356. fromSunday: false
  9357. },
  9358. day = new Date().getDay(),
  9359. dayNum = day,
  9360. Calendar = [];
  9361. $.extend(calendarOpts, calendarOpts, opts );
  9362. if ( !calendarOpts.fromSunday ) {
  9363. dayNum = day == 0 ? 6 : day - 1;
  9364. }
  9365. Calendar = kExtend(selector, opts, Tab);
  9366. if($(selector).length == 1){
  9367. Calendar.switchTo(dayNum);
  9368. }else{
  9369. for(var i = 0; i < elems.length; i++) {
  9370. Calendar[i].switchTo(dayNum);
  9371. }
  9372. }
  9373. };
  9374. /**
  9375. * Carousel类
  9376. * @constructor
  9377. * @param {jQuery object}
  9378. * @param {object} 配置参数
  9379. */
  9380. function Carousel(selector, opts){
  9381. Switchable.call(this, selector, opts);
  9382. this._init();
  9383. }
  9384. Carousel.prototype = new Switchable();
  9385. Carousel.prototype.constructor = Carousel;
  9386. k.imageScroll = function(selector, opts){
  9387. var caroOpts = {
  9388. effect : "scrollX",
  9389. autoPlay : true,
  9390. mousewheel: true,
  9391. figureNav: true
  9392. }
  9393. $.extend(caroOpts, caroOpts, opts);
  9394. return kExtend(selector, caroOpts, Carousel);
  9395. };
  9396. k.textScroll = function(selector, opts){
  9397. //add by petsa 20131127
  9398. //添加判断,当只有一条滚动新闻,不添加滚动效果
  9399. var listLength = $(selector).find('li').length;
  9400. if( listLength <= 1 )
  9401. {
  9402. return;
  9403. }
  9404. var caroOpts = {
  9405. effect : "scrollY",
  9406. autoPlay : true
  9407. }
  9408. $.extend(caroOpts, caroOpts, opts);
  9409. return kExtend(selector, caroOpts, Carousel);
  9410. };
  9411. /*
  9412. * 手风琴
  9413. * @param {[type]} selector [description]
  9414. * @return {[type]} [description]
  9415. */
  9416. k.accordion = function( selector ) {
  9417. if ( !jQuery(selector).is("div[class*='mod-accordion']") ) return false;
  9418. var accord = jQuery(selector),
  9419. accordHead = accord.children(":even"),
  9420. accordBody = accord.children(":odd"),
  9421. accordLength = accordHead.length;
  9422. accordHead.eq(0).addClass("active");//默认打开第一个项
  9423. accordBody.eq(0).show();
  9424. // 点击事件绑定
  9425. accord.delegate('.J_nav', 'click', function(event) {
  9426. var _index = accordHead.index($(this));
  9427. var _ifSelf = accordHead.eq(_index).hasClass("active");
  9428. accordHead.removeClass("active");
  9429. accordBody.hide();
  9430. if (_ifSelf){
  9431. _index = (accordLength != _index + 1) ? ++_index : -- _index;
  9432. }
  9433. accordHead.eq(_index).addClass('active');
  9434. accordBody.eq(_index).show();
  9435. });
  9436. };
  9437. /** 提示 */
  9438. k.toolTip = function( selector , options ) {
  9439. //基本参数
  9440. var _default = {
  9441. imgSrc: "",
  9442. style: 1,
  9443. location : "bottom"
  9444. };
  9445. var opts = jQuery.extend( {}, _default, options );
  9446. //插件初始函数
  9447. function _init(){
  9448. // 样式一
  9449. if ( opts.style === 1 ) {
  9450. var cssImgText = "";
  9451. if (opts.imgSrc != "") {
  9452. cssImgText = '.data-tips-left, .data-tips-center, .data-tips-right{background-image:url(' + opts.imgSrc + ')}';
  9453. }
  9454. document.write('<style type="text/css">' + cssImgText + '</style>');
  9455. }
  9456. // 分配事件
  9457. var aTags = $(selector);
  9458. for (var i = 0; i < aTags.length; i++) {
  9459. if (aTags[i].getAttribute("data-tips") != null) {
  9460. $(aTags[i]).on("mouseover",mouseover);
  9461. //$(aTags[i]).on("mousemove",mousemove);
  9462. $(aTags[i]).on("mouseout",mouseout);
  9463. // aTags[i].onmouseover = mouseover;
  9464. // aTags[i].onmousemove = mousemove;
  9465. // aTags[i].onmouseout = mouseout;
  9466. }
  9467. }
  9468. }
  9469. // 鼠标移上或离开
  9470. function isMouseLeaveOrEnter(e, handler) {
  9471. if (e.type != 'mouseout' && e.type != 'mouseover') return false;
  9472. var reltg = e.relatedTarget ? e.relatedTarget : e.type == 'mouseout' ? e.toElement : e.fromElement;
  9473. while (reltg && reltg != handler)
  9474. reltg = reltg.parentNode;
  9475. return (reltg != handler);
  9476. }
  9477. //提示层位置控制
  9478. function layerShowCenter( e , cfg ){
  9479. var tips = document.getElementById("data-tips");
  9480. if (tips) {
  9481. $(tips).html(cfg.struct);
  9482. $(tips).fadeIn();
  9483. } else {
  9484. tips = document.createElement("div");
  9485. $(tips).attr("id","data-tips");
  9486. $(tips).html(cfg.struct);
  9487. $("body").append( $(tips) );
  9488. $(tips).fadeIn();
  9489. }
  9490. //resetLocation(e , opts.location);
  9491. //方位选择
  9492. switch (cfg.location){
  9493. case "top":
  9494. $(tips).css({
  9495. left: e.pageX - e.offsetX ,
  9496. top: e.pageY - $(tips).outerHeight() - e.offsetY
  9497. });
  9498. break;
  9499. case "bottom":
  9500. $(tips).css({
  9501. left: e.pageX - e.offsetX ,
  9502. top: e.pageY + ( $(e.srcElement).outerHeight() - e.offsetY )
  9503. });
  9504. break;
  9505. case "left":
  9506. $(tips).css({
  9507. left: e.pageX - e.offsetX - $(tips).outerWidth(),
  9508. top: e.pageY - e.offsetY
  9509. });
  9510. break;
  9511. case "right":
  9512. $(tips).css({
  9513. left: e.pageX - e.offsetX + $(e.srcElement).outerWidth(),
  9514. top: e.pageY - e.offsetY
  9515. });
  9516. break;
  9517. }
  9518. }
  9519. //判断是否足够空间显示提示层,重设显示位置
  9520. function resetLocation( e , location ){
  9521. var tiplayer = $("#data-tips"),
  9522. el = $(e.srcElement),
  9523. locationArray = [];
  9524. var istop = el.offset().top - $(window).scrollTop() > tiplayer.outerHeight(),
  9525. isright = $(window).width() > el.offset().left - $(window).scrollLeft() + el.outerWidth() + tiplayer.outerWidth(),
  9526. isleft = el.offset().left - $(window).scrollLeft() > tiplayer.outerWidth(),
  9527. isbottom = $(window).height() > el.offset().top - $(window).scrollTop() + el.outerHeight() + tiplayer.outerHeight();
  9528. locationArray = [istop , isright , isleft , isbottom];
  9529. console.log(istop);
  9530. console.log(isright);
  9531. console.log(isbottom);
  9532. console.log(isleft);
  9533. console.log(tiplayer);
  9534. console.log(el);
  9535. console.log(locationArray);
  9536. }
  9537. function controlLoaction(location){
  9538. //to do
  9539. }
  9540. //创建提示层
  9541. function setupLayer(e , srcElement){
  9542. var html = "";
  9543. switch (opts.style) {
  9544. // 样式一
  9545. case 1:
  9546. html = '<div class="data-tips-top"><div class="data-tips-left"></div><div class="data-tips-center"></div><div class="data-tips-right"></div></div><div class="data-tips-middle"><div class="data-tips-left"></div><div class="data-tips-center">' + srcElement.getAttribute("data-tips") + '</div><div class="data-tips-right"></div></div><div class="data-tips-bottom"><div class="data-tips-left"></div><div class="data-tips-center"></div><div class="data-tips-right"></div></div>';
  9547. break;
  9548. // 样式二
  9549. case 2:
  9550. html = '<div id="data-tips-bd">' + srcElement.getAttribute("data-tips") + '</div>';
  9551. break;
  9552. }
  9553. layerShowCenter( e , {
  9554. location : opts.location,
  9555. struct : html
  9556. } )
  9557. }
  9558. // 鼠标移上
  9559. function mouseover(e) {
  9560. var event = window.event || arguments[0],
  9561. srcElement = event.srcElement || event.target;
  9562. if(!isMouseLeaveOrEnter(event, this)) return;
  9563. while (srcElement && !srcElement.getAttribute("data-tips")) srcElement = srcElement.parentNode;
  9564. setupLayer( e, srcElement);
  9565. }
  9566. // 鼠标移动(在目标上),(已经禁用)
  9567. function mousemove() {
  9568. var tips = document.getElementById("data-tips");
  9569. if (!tips) return;
  9570. var event = window.event || arguments[0];
  9571. var pos = mousecoords(event);
  9572. tips.style.left = (pos.x + opts.offset.x) + "px";
  9573. tips.style.top = (pos.y + opts.offset.y) + "px";
  9574. }
  9575. // 鼠标离开
  9576. function mouseout() {
  9577. var event = window.event || arguments[0];
  9578. if (!isMouseLeaveOrEnter(event, this)) return;
  9579. var tips = document.getElementById("data-tips");
  9580. if (!tips) return;
  9581. tips.style.display = "none";
  9582. }
  9583. // 鼠标位置
  9584. function mousecoords(event) {
  9585. if (event.pageX) {
  9586. return {x : event.pageX, y : event.pageY};
  9587. } else {
  9588. return {
  9589. x : event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft),
  9590. y : event.clientY + (document.documentElement.scrollTop || document.body.scrollTop)
  9591. }
  9592. }
  9593. }
  9594. //插件初始化
  9595. _init();
  9596. };
  9597. /** backToTop */
  9598. k.backToTop = function( selector, options ){
  9599. var _default = {
  9600. scrollEffect:true,
  9601. contentWidth:0,
  9602. showHeight : 0,
  9603. target:"" ,//返回到某个元素高度
  9604. counttime: 0
  9605. };
  9606. var opts = jQuery.extend( {}, _default, options ),
  9607. counttime;//ie6滚动定时执行器
  9608. var _init = function(){
  9609. // 检查是否有bacttotop结构
  9610. if( !$("#backtotop").get(0) )
  9611. {
  9612. $("body").append('<div id="backtotop" class="backtotop">回到顶部</div>');
  9613. $("#backtotop").css({
  9614. "display" : "none",
  9615. "position": "fixed",
  9616. "right": "0",
  9617. "bottom": "100px"
  9618. })
  9619. }
  9620. else{
  9621. $("#backtotop").css({
  9622. "display" : "none",
  9623. "position": "fixed",
  9624. "right": "0",
  9625. "bottom": "100px"
  9626. })
  9627. }
  9628. var str = selector ? selector : "#backtotop",
  9629. el = jQuery(str);
  9630. // 初始化ie6定位属性
  9631. if ( !window.XMLHttpRequest ) {
  9632. el.css({position: "absolute"});
  9633. };
  9634. //调用设置内容宽函数
  9635. setContentWidth(el);
  9636. //选择器标签点击后
  9637. el.bind("click", function(){
  9638. if( opts.target == "" )
  9639. {
  9640. scrollTo( 0 );
  9641. }
  9642. else{
  9643. scrollTo( opts.target );
  9644. }
  9645. });
  9646. //窗口大小改变
  9647. $(window).resize(function(event) {
  9648. setContentWidth();
  9649. });
  9650. $(document).ready(function(){
  9651. showBackBtn(el);
  9652. });
  9653. }
  9654. //滚动调度
  9655. var scrollTo = function(obj){
  9656. switch( typeof(obj) )
  9657. {
  9658. case "number":
  9659. scrollFn(obj);
  9660. break;
  9661. case "object":
  9662. //todo
  9663. case "string":
  9664. var elm = $(obj);
  9665. var backheight = getelementScrollTop(elm);
  9666. scrollFn(backheight);
  9667. }
  9668. }
  9669. //滚动函数
  9670. var scrollFn = function(num){
  9671. if(opts.scrollEffect){
  9672. $('body,html').animate({scrollTop:num},300);
  9673. }else{
  9674. $('body,html').animate({scrollTop:num},0);
  9675. }
  9676. }
  9677. //显示返回顶部按钮
  9678. var showBackBtn = function(obj){
  9679. $(window).scroll(function(){
  9680. if ( $(window).scrollTop() > opts.showHeight ) {
  9681. if ( !obj.is(":visible") ) {
  9682. obj.fadeIn();
  9683. }
  9684. // ie6
  9685. if ( !window.XMLHttpRequest ) {
  9686. clearTimeout(opts.counttime);
  9687. opts.counttime = setTimeout(function(){
  9688. var t = getScrollTop(obj);
  9689. obj.css({top: t});
  9690. },300)
  9691. }
  9692. } else {
  9693. obj.fadeOut();
  9694. }
  9695. });
  9696. }
  9697. //获取tag相对页面的高度
  9698. var getelementScrollTop = function(obj){
  9699. var offset = obj.offset();
  9700. console.log(offset.top);
  9701. return offset.top;
  9702. }
  9703. //获取滚动位置离顶部高度
  9704. var getScrollTop = function(obj){
  9705. var t = document.documentElement.scrollTop || document.body.scrollTop,
  9706. h = document.documentElement.clientHeight || document.body.clientHeight;
  9707. return t + h - parseInt(obj.css('bottom').split("px")[0]) - parseInt(obj.css('height').split("px")[0]);
  9708. }
  9709. // 浮动到内容侧边
  9710. var setContentWidth = function(obj){
  9711. if(opts.contentWidth)
  9712. {
  9713. var set_right = ( $(window).width() - opts.contentWidth ) /2 - obj.width();
  9714. obj.css('right', set_right+"px");
  9715. }
  9716. }
  9717. //初始化返回顶部插件
  9718. $(function(){
  9719. _init();
  9720. })
  9721. return {
  9722. scrollTo : scrollTo
  9723. }
  9724. }
  9725. /** popupBox */
  9726. k.popupBox = function (selector , options , data) {
  9727. var el = jQuery(selector),
  9728. mask = document.createElement("div"),
  9729. popupBox = el.get(0),
  9730. self = this;
  9731. var _default = {
  9732. existMask: true
  9733. };
  9734. var opts = jQuery.extend( {}, _default, options );
  9735. if ( !el.length )
  9736. {
  9737. //console.log("找不到弹窗");
  9738. return
  9739. };
  9740. // dom宽高
  9741. var boxWidth = el.width(),
  9742. boxHeight = el.height();
  9743. // console.log(el.width());
  9744. // console.log(el.height());
  9745. // 创建遮罩,显示弹出框
  9746. if( opts.width )
  9747. {
  9748. var maskCss = "position:fixed;left:0;top:0;z-index:32766;width:100%;height:100%;filter:alpha(opacity=70);-moz-opacity:0.7;opacity:0.7;background:#000;",
  9749. boxCss = "display:block;position:fixed;left:50%;top:50%;z-index:32767;margin:-" + el.height() / 2 + "px 0 0 -" + opts.width / 2 + "px;";
  9750. }
  9751. else{
  9752. var maskCss = "position:fixed;left:0;top:0;z-index:32766;width:100%;height:100%;filter:alpha(opacity=70);-moz-opacity:0.7;opacity:0.7;background:#000;",
  9753. boxCss = "display:block;position:fixed;left:50%;top:50%;z-index:32767;margin:-" + el.height() / 2 + "px 0 0 -" + el.width() / 2 + "px;";
  9754. }
  9755. // ie6
  9756. if(!window.XMLHttpRequest) {
  9757. // ie6 css表达式
  9758. maskCss += "position:absolute;top:expression(documentElement.scrollTop);height:expression(document.documentElement.clientHeight);";
  9759. boxCss += "position:absolute;top:expression(documentElement.scrollTop + document.documentElement.clientHeight/2);";
  9760. // 解决ie6 bug(没设置html背景的时候)
  9761. if ( document.getElementsByTagName("html")[0].style.backgroundImage == "") {
  9762. document.getElementsByTagName("html")[0].style.backgroundImage = "url(blank)";
  9763. }
  9764. }
  9765. //重新对齐弹出层
  9766. function resetPosition(){
  9767. // 创建遮罩,显示弹出框
  9768. if( opts.width )
  9769. {
  9770. maskCss = "position:fixed;left:0;top:0;z-index:32766;width:100%;height:100%;filter:alpha(opacity=70);-moz-opacity:0.7;opacity:0.7;background:#000;",
  9771. boxCss = "display:block;position:fixed;left:50%;top:50%;z-index:32767;width:"+ opts.width +"px;margin:-" + el.height() / 2 + "px 0 0 -" + opts.width / 2 + "px;";
  9772. }
  9773. else{
  9774. maskCss = "position:fixed;left:0;top:0;z-index:32766;width:100%;height:100%;filter:alpha(opacity=70);-moz-opacity:0.7;opacity:0.7;background:#000;",
  9775. boxCss = "display:block;position:fixed;left:50%;top:50%;z-index:32767;margin:-" + el.height() / 2 + "px 0 0 -" + el.width() / 2 + "px;";
  9776. }
  9777. // ie6
  9778. if(!window.XMLHttpRequest) {
  9779. // ie6 css表达式
  9780. maskCss += "position:absolute;top:expression(documentElement.scrollTop);height:expression(document.documentElement.clientHeight);";
  9781. boxCss += "position:absolute;top:expression(documentElement.scrollTop + document.documentElement.clientHeight/2);";
  9782. // 解决ie6 bug(没设置html背景的时候)
  9783. if ( document.getElementsByTagName("html")[0].style.backgroundImage == "") {
  9784. document.getElementsByTagName("html")[0].style.backgroundImage = "url(http://assets.dwstatic.com/lego/1.0.0/img/blank.png)";
  9785. }
  9786. }
  9787. }
  9788. //设置弹窗标题
  9789. this.title = function(str){
  9790. if( str )
  9791. {
  9792. jQuery(popupBox).find(".title").html(str);
  9793. }
  9794. resetPosition();
  9795. return this;
  9796. }
  9797. //设置弹窗内容
  9798. this.content = function(str){
  9799. if( str )
  9800. {
  9801. jQuery(popupBox).find(".cont").html(str);
  9802. }
  9803. resetPosition();
  9804. return this;
  9805. }
  9806. //构建弹出层,绑定默认事件,回调函数
  9807. var setupPopup = function(){
  9808. el.find(".J_btnClose").on("click",function(){
  9809. popupClose(el.get(0));
  9810. })
  9811. if( opts.note )
  9812. {
  9813. el.find(".cont").html(opts.note);
  9814. }
  9815. if( opts.title )
  9816. {
  9817. self.title(opts.title);
  9818. }
  9819. el.find(".J_btnConfirm").on("click",function(){
  9820. if( opts.ok )
  9821. {
  9822. opts.ok(data);
  9823. }
  9824. })
  9825. el.find(".J_btnCancle").on("click",function(){
  9826. if( opts.cancle )
  9827. {
  9828. opts.cancle(data);
  9829. }
  9830. popupClose();
  9831. })
  9832. }
  9833. //打开弹出层
  9834. var popupOpen = function(){
  9835. popupBox.style.display = "block";
  9836. if( opts.width )
  9837. {
  9838. //el.width(opts.width);
  9839. el.css({
  9840. width: opts.width
  9841. });
  9842. }
  9843. if( opts.height )
  9844. {
  9845. //el.height(opts.height);
  9846. el.css({
  9847. height: opts.height
  9848. });
  9849. }
  9850. resetPosition();
  9851. popupBox.style.cssText = boxCss;
  9852. mask.style.cssText = maskCss;
  9853. scrollSwitchControl(0);
  9854. // 解决ie6 bug
  9855. if(!window.XMLHttpRequest) {
  9856. document.documentElement.scrollTop++;
  9857. document.documentElement.scrollTop--;
  9858. }
  9859. jQuery(mask).attr("id","lego-popupbox-mask");
  9860. if ( opts.existMask ) jQuery("body").append(mask);
  9861. }
  9862. //关闭弹出层
  9863. var popupClose = function(){
  9864. // ie6 清空css表达式
  9865. popupBox.style.cssText = "";
  9866. popupBox.style.display = "none";
  9867. scrollSwitchControl(1);
  9868. if ( opts.existMask ) jQuery("#lego-popupbox-mask").remove();
  9869. }
  9870. //遮罩后滚动控制
  9871. var scrollSwitchControl = function(sign){
  9872. if(sign){
  9873. jQuery("body").unbind("mousewheel","",function(){
  9874. })
  9875. }
  9876. else{
  9877. jQuery("body").on("mousewheel","",function(){
  9878. return false;
  9879. })
  9880. }
  9881. }
  9882. var _init = function(){
  9883. //打开弹出层
  9884. //popupOpen();
  9885. setupPopup();
  9886. }
  9887. //初始化弹出层
  9888. jQuery(function(){
  9889. _init();
  9890. })
  9891. /**
  9892. * 返回窗口打开方法,关闭方法
  9893. */
  9894. return {
  9895. open : popupOpen,
  9896. close : popupClose,
  9897. title : this.title,
  9898. content : this.content
  9899. }
  9900. }
  9901. })(jQuery, LEGO, window);