jquery-1.8.0.js 252 KB

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