jquery1.9.0.js 296 KB

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