jquery-1.11.1.js 381 KB

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