jQuery.js 358 KB

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