网站
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

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