Built files from Bizgaze WebServer
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

jquery.js 365KB

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