jQuery.js 324 KB

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