jquery-1.11.0.js 276 KB

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