jquery-1.10.2.js 364 KB

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