jquery.js 235 KB

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