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ů.

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