kityminder.index.js 281 KB

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