jquery.js 236 KB

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