jquery-1.12.3.js 287 KB

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