説明なし

jquery-2.1.0.js 239KB

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