netca-jquery-client.js 299 KB

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